Skip to content

Commit f35bd14

Browse files
committed
issue #164 fixed touch control in image viewer and some minor cleaning
1 parent 220f502 commit f35bd14

3 files changed

Lines changed: 45 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ tobexyz
1515
alt="Get it on F-Droid"
1616
height="80">](https://f-droid.org/packages/de.yaacc/)
1717

18-
<img src="./docs/screenshots/4.2.x/browse_servers.png" alt= “” width="30%" height="30%"> <img src="./docs/screenshots/4.2.x/browse_image_folder.png" alt= “” width="30%" height="30%"> <img src="./docs/screenshots/4.2.x/browse_receiver.png" alt= “” width="30%" height="30%">
19-
<img src="./docs/screenshots/4.2.x/music_player.png" alt= “” width="30%" height="30%"> <img src="./docs/screenshots/4.2.x/playlist_fully_editable.png" alt= “” width="30%" height="30%"> <img src="./docs/screenshots/4.2.x/image_player_show_menu.png" alt= “” width="30%" height="30%">
18+
<img src="./docs/screenshots/4.4.x/browse_servers.png" alt= “” width="30%" height="30%"> <img src="./docs/screenshots/4.4.x/browse_image_folder.png" alt= “” width="30%" height="30%"> <img src="./docs/screenshots/4.4.x/browse_receiver.png" alt= “” width="30%" height="30%">
19+
<img src="./docs/screenshots/4.2.x/music_player.png" alt= “” width="30%" height="30%"> <img src="./docs/screenshots/4.4.x/playlist_fully_editable.png" alt= “” width="30%" height="30%"> <img src="./docs/screenshots/4.4.x/image_player_show_menu.png" alt= “” width="30%" height="30%">
2020

2121
## Description
2222

yaacc/src/main/java/de/yaacc/imageviewer/ImageViewerActivity.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,12 @@ public boolean onCreateOptionsMenu(Menu menu) {
250250
pauseButton.setImageDrawable(icon);
251251
pauseButton.setFocusable(true);
252252
pauseButton.setFocusableInTouchMode(true);
253+
pauseButton.setOnTouchListener((v, event) -> {
254+
if (event.getAction() == MotionEvent.ACTION_DOWN) {
255+
pause();
256+
}
257+
return false;
258+
});
253259
pauseButton.setOnClickListener(v -> pause());
254260
pauseButton.setOnKeyListener((v, keyCode, event) -> {
255261
if (event.getAction() == KeyEvent.ACTION_DOWN &&
@@ -266,6 +272,12 @@ public boolean onCreateOptionsMenu(Menu menu) {
266272
playButton.setImageDrawable(icon);
267273
playButton.setFocusable(true);
268274
playButton.setFocusableInTouchMode(true);
275+
playButton.setOnTouchListener((v, event) -> {
276+
if (event.getAction() == MotionEvent.ACTION_DOWN) {
277+
play();
278+
}
279+
return false;
280+
});
269281
playButton.setOnClickListener(v -> play());
270282
playButton.setOnKeyListener((v, keyCode, event) -> {
271283
if (event.getAction() == KeyEvent.ACTION_DOWN &&
@@ -283,6 +295,12 @@ public boolean onCreateOptionsMenu(Menu menu) {
283295
stopButton.setFocusable(true);
284296
stopButton.setFocusableInTouchMode(true);
285297
stopButton.setFocusableInTouchMode(true);
298+
stopButton.setOnTouchListener((v, event) -> {
299+
if (event.getAction() == MotionEvent.ACTION_DOWN) {
300+
stop();
301+
}
302+
return false;
303+
});
286304
stopButton.setOnClickListener(v -> stop());
287305
stopButton.setOnKeyListener((v, keyCode, event) -> {
288306
if (event.getAction() == KeyEvent.ACTION_DOWN &&
@@ -300,6 +318,12 @@ public boolean onCreateOptionsMenu(Menu menu) {
300318
nextButton.setFocusable(true);
301319
nextButton.setFocusableInTouchMode(true);
302320
nextButton.setFocusableInTouchMode(true);
321+
nextButton.setOnTouchListener((v, event) -> {
322+
if (event.getAction() == MotionEvent.ACTION_DOWN) {
323+
next();
324+
}
325+
return false;
326+
});
303327
nextButton.setOnClickListener(v -> previous());
304328
nextButton.setOnKeyListener((v, keyCode, event) -> {
305329
if (event.getAction() == KeyEvent.ACTION_DOWN &&
@@ -317,6 +341,12 @@ public boolean onCreateOptionsMenu(Menu menu) {
317341
previousButton.setFocusable(true);
318342
previousButton.setFocusableInTouchMode(true);
319343
previousButton.setFocusableInTouchMode(true);
344+
previousButton.setOnTouchListener((v, event) -> {
345+
if (event.getAction() == MotionEvent.ACTION_DOWN) {
346+
previous();
347+
}
348+
return false;
349+
});
320350
previousButton.setOnClickListener(v -> previous());
321351
previousButton.setOnKeyListener((v, keyCode, event) -> {
322352
if (event.getAction() == KeyEvent.ACTION_DOWN &&
@@ -334,6 +364,12 @@ public boolean onCreateOptionsMenu(Menu menu) {
334364
exitButton.setFocusable(true);
335365
exitButton.setFocusableInTouchMode(true);
336366
exitButton.setFocusableInTouchMode(true);
367+
exitButton.setOnTouchListener((v, event) -> {
368+
if (event.getAction() == MotionEvent.ACTION_DOWN) {
369+
exit();
370+
}
371+
return false;
372+
});
337373
exitButton.setOnClickListener(v -> exit());
338374
exitButton.setOnKeyListener((v, keyCode, event) -> {
339375
if (event.getAction() == KeyEvent.ACTION_DOWN &&

yaacc/src/main/java/de/yaacc/upnp/server/YaaccUpnpServerService.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncServer;
4848
import org.apache.hc.core5.http2.impl.nio.bootstrap.H2ServerBootstrap;
4949
import org.apache.hc.core5.reactor.IOReactorConfig;
50+
import org.apache.hc.core5.reactor.IOReactorStatus;
5051
import org.apache.hc.core5.util.TimeValue;
5152
import org.apache.hc.core5.util.Timeout;
5253
import org.fourthline.cling.binding.annotations.AnnotationLocalServiceBinder;
@@ -338,14 +339,15 @@ public void execute(Exception ex) {
338339
Log.d(getClass().getName(), "Server status: " + httpServer.getStatus().name());
339340
Log.d(getClass().getName(), "Server Endpoints: " + httpServer.getEndpoints().size());
340341
httpServer.getEndpoints().forEach(endpoint -> Log.d(getClass().getName(), "Endpoint: " + endpoint.toString()));
342+
/*
341343
timer.schedule(new TimerTask() {
342344
343345
@Override
344346
public void run() {
345-
checkIfHttpServerIsRunning();
347+
checkIfHttpServerIsRunning();
346348
}
347349
}, 6000L);
348-
350+
*/
349351

350352
}
351353

@@ -371,7 +373,7 @@ private void checkIfHttpServerIsRunning() {
371373
} catch (IOException e) {
372374
Log.e(getClass().getName(), "HttpServer is NOT responding to HTTP requests or is unreachable. Trying restart", e);
373375
//restartServerService();
374-
if (httpServer != null) {
376+
if (httpServer != null && httpServer.getStatus() == IOReactorStatus.ACTIVE) {
375377
httpServer.listen(new InetSocketAddress(PORT), URIScheme.HTTP);
376378
timer.schedule(new TimerTask() {
377379

@@ -381,7 +383,8 @@ public void run() {
381383
httpServer.getEndpoints().forEach(endpoint -> Log.d(getClass().getName(), "Endpoint: " + endpoint.toString()));
382384
}
383385
}, 500L);
384-
386+
} else {
387+
restartServerService();
385388
}
386389

387390
return;

0 commit comments

Comments
 (0)