Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

addons: photo screensaver settings by holding OK in the slideshow

JorickGUf68ad8c36526
diff --git a/addons/photo-screensaver/README.md b/addons/photo-screensaver/README.md
index 16679a2a5..662d22e57 100644
--- a/addons/photo-screensaver/README.md
+++ b/addons/photo-screensaver/README.md
@@ -7,12 +7,13 @@ fill the screen, then the loop moves on; a lone clip loops. Any key wakes the TV
Package `com.gathin.photodream`. You see it as **Photos** (Dutch: **Foto's**) in the TV's screensaver
settings. On cleanyourtv's Home it is also a module card, **Photos**: OK starts the same slideshow at once,
-Menu opens the settings, Back leaves.
+holding OK (or Menu) opens the settings, Back leaves.
## Options
All off by default, which is the plain full-screen slideshow above. Switch them on in the screensaver's own
-settings (TV settings > screensaver > Photos > settings), or with Menu in the card's slideshow:
+settings (TV settings > screensaver > Photos > settings), or by holding OK (or pressing Menu) in the card's
+slideshow. Google TV has no settings entry for other screensavers, so there it is the slideshow only:
| Option | What it does |
|---|---|
diff --git a/addons/photo-screensaver/app/src/main/java/com/gathin/photodream/SettingsActivity.java b/addons/photo-screensaver/app/src/main/java/com/gathin/photodream/SettingsActivity.java
index 8a93dad25..b1336a7cc 100644
--- a/addons/photo-screensaver/app/src/main/java/com/gathin/photodream/SettingsActivity.java
+++ b/addons/photo-screensaver/app/src/main/java/com/gathin/photodream/SettingsActivity.java
@@ -18,7 +18,7 @@ import android.widget.TextView;
/**
* The options, one switch each, for the remote's D-pad. Reached from the TV's screensaver settings (the
- * screensaver's own settings entry) and with Menu in the card's slideshow. All off: the plain slideshow.
+ * screensaver's own settings entry) and by holding OK or pressing Menu in the card's slideshow. All off: the plain slideshow.
*/
public class SettingsActivity extends Activity {
diff --git a/addons/photo-screensaver/app/src/main/java/com/gathin/photodream/SlideshowActivity.java b/addons/photo-screensaver/app/src/main/java/com/gathin/photodream/SlideshowActivity.java
index 9d760ff29..aa39ec4f5 100644
--- a/addons/photo-screensaver/app/src/main/java/com/gathin/photodream/SlideshowActivity.java
+++ b/addons/photo-screensaver/app/src/main/java/com/gathin/photodream/SlideshowActivity.java
@@ -7,8 +7,8 @@ import android.view.KeyEvent;
import android.view.WindowManager;
/**
- * The module card on cleanyourtv's Home: the same scene as the screensaver, right away, until Back. Menu opens
- * the settings. The screen stays on while it shows.
+ * The module card on cleanyourtv's Home: the same scene as the screensaver, right away, until Back. Holding OK
+ * or pressing Menu opens the settings. The screen stays on while it shows.
*/
public class SlideshowActivity extends Activity {
@@ -39,9 +39,38 @@ public class SlideshowActivity extends Activity {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU || keyCode == KeyEvent.KEYCODE_SETTINGS) {
- startActivity(new Intent(this, SettingsActivity.class));
+ openSettings();
+ return true;
+ }
+ if (isOk(keyCode)) {
+ // Not every remote has a Menu key that reaches apps, so holding OK opens the settings too.
+ event.startTracking();
return true;
}
return super.onKeyDown(keyCode, event);
}
+
+ @Override
+ public boolean onKeyLongPress(int keyCode, KeyEvent event) {
+ if (isOk(keyCode)) {
+ openSettings();
+ return true;
+ }
+ return super.onKeyLongPress(keyCode, event);
+ }
+
+ @Override
+ public boolean onKeyUp(int keyCode, KeyEvent event) {
+ if (isOk(keyCode)) return true;
+ return super.onKeyUp(keyCode, event);
+ }
+
+ private static boolean isOk(int keyCode) {
+ return keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_ENTER
+ || keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER;
+ }
+
+ private void openSettings() {
+ startActivity(new Intent(this, SettingsActivity.class));
+ }
}