Skip to content

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

launcher: glow_style horizon, the app's colour washing down from the top

sim5a5508ad51e0
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/Config.java b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
index b55b5a100..4b7975b62 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@ -128,6 +128,10 @@ final class Config {
final boolean ambientGlow;
/** Minutes Home may sit untouched before the clock screensaver (config.xml, home_idle_clock_minutes); 0 is off. */
final int homeIdleClockMinutes;
+ /** Shape of the glow behind the focused app (config.xml, glow_style): {@link #GLOW_RADIAL} or {@link #GLOW_HORIZON}. */
+ final String glowStyle;
+
+ static final String GLOW_RADIAL = "radial", GLOW_HORIZON = "horizon";
private Config(List<String> dockApps, boolean fillDock, List<String> hiddenApps, String liveTvPackage,
String liveTvAction, Map<String, String> launchActions, Map<String, String> appLabels,
@@ -138,7 +142,7 @@ final class Config {
int[] settingsKeycodes, boolean settingsKeyPanel, boolean wallpaperEnabled, File wallpaper, List<File> wallpapers,
int wallpaperRotationMinutes, int wallpaperDim, String wallpaperOrder, boolean overlayApplied,
Festival festival, int[] inputKeycodes, List<String> appKeys,
- List<RaceWeekend.Race> raceCalendar, boolean cinematicHome, boolean ambientGlow, int homeIdleClockMinutes) {
+ List<RaceWeekend.Race> raceCalendar, boolean cinematicHome, boolean ambientGlow, int homeIdleClockMinutes, String glowStyle) {
this.inputKeycodes = inputKeycodes;
this.appKeys = Collections.unmodifiableList(appKeys);
this.dockApps = Collections.unmodifiableList(dockApps);
@@ -189,6 +193,12 @@ final class Config {
this.cinematicHome = cinematicHome;
this.ambientGlow = ambientGlow;
this.homeIdleClockMinutes = homeIdleClockMinutes;
+ this.glowStyle = glowStyle(glowStyle);
+ }
+
+ /** A known glow_style, or radial (the default) for anything else. */
+ static String glowStyle(String value) {
+ return value != null && GLOW_HORIZON.equalsIgnoreCase(value.trim()) ? GLOW_HORIZON : GLOW_RADIAL;
}
/** The folder the theme tools push into; null when external storage is unavailable. */
@@ -239,6 +249,7 @@ final class Config {
boolean cinematic = res.getBoolean(R.bool.cinematic_home);
boolean ambientGlow = res.getBoolean(R.bool.ambient_glow);
int idleClockMinutes = res.getInteger(R.integer.home_idle_clock_minutes);
+ String glowStyle = res.getString(R.string.glow_style);
boolean applied = false;
File dir = dir(ctx);
@@ -288,6 +299,7 @@ final class Config {
cinematic = bool(json, "cinematic_home", cinematic);
ambientGlow = bool(json, "ambient_glow", ambientGlow);
idleClockMinutes = integer(json, "home_idle_clock_minutes", idleClockMinutes, 0, 1440);
+ glowStyle = string(json, "glow_style", glowStyle);
}
// A theme push or reset invalidates choices made on the TV. On first use, remember the
// current theme without clearing choices from an older launcher version.
@@ -347,7 +359,7 @@ final class Config {
Math.max(0, Math.min(100, skyIntensity)), settingsKeycodes, settingsKeyPanel, wallpaperEnabled, wallpaper,
wallpapers, rotationMinutes, wallpaperDim, wallpaperOrder, applied,
festival, inputKeycodes, appKeys, json == null ? Collections.emptyList() : raceCalendar(json), cinematic, ambientGlow,
- Math.max(0, idleClockMinutes));
+ Math.max(0, idleClockMinutes), glowStyle);
}
/**
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
index e89977e15..aeac587c9 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -128,6 +128,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
/** config.xml ambient_glow, overridable by a theme. Off: the glow view is gone and no fade or colour animator
* is started for it, so a focus move costs nothing extra on a launcher that runs all day. */
private boolean ambientGlow;
+ /** config.xml glow_style: the shape setAmbient paints the glow mask in. */
+ private String glowStyle;
private ImageView heroArt;
private static final float HERO_ART_ALPHA = 0.5f;
/** Softened artwork per app (HeroArt, about 5 KB each), made the first time its dock tile is focused. */
@@ -347,6 +349,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
heroDots = findViewById(R.id.heroDots);
heroArt = findViewById(R.id.heroArt);
cinematic = cfg.cinematicHome;
+ glowStyle = cfg.glowStyle;
if (cinematic) setUpCinematicShelf();
// dock_title false: the name above the dock (and the cinematic lines under it) never shows; the glow
// still follows the dock.
@@ -1477,6 +1480,19 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
new int[]{0xA6FFFFFF, 0x47FFFFFF, 0x00FFFFFF},
new float[]{0f, 0.5f, 1f},
Shader.TileMode.CLAMP));
+ } else if (Config.GLOW_HORIZON.equals(glowStyle)) {
+ // The colour washes down from the top edge and fades out three quarters of the way down,
+ // with a brighter band along the top like light over a horizon.
+ paint.setShader(new LinearGradient(0, 0, 0, h * 0.75f,
+ new int[]{0x66FFFFFF, 0x24FFFFFF, 0x00FFFFFF},
+ new float[]{0f, 0.4f, 1f},
+ Shader.TileMode.CLAMP));
+ canvas.drawRect(0, 0, w, h, paint);
+ paint.setShader(new RadialGradient(
+ w * 0.5f, -h * 0.25f, w * 0.55f,
+ new int[]{0x40FFFFFF, 0x00FFFFFF},
+ null,
+ Shader.TileMode.CLAMP));
} else {
paint.setShader(new RadialGradient(
w * 0.32f, h * 0.42f, w * 0.62f,
diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xml
index 4ca1b963c..a3e4223f0 100644
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@ -196,4 +196,8 @@
Live TV window does not keep the screen on (CVTE): there the system screensaver would start in the
middle of a programme. Can also be set with "home_idle_clock_minutes": 10 in a theme's config.json. -->
<integer name="home_idle_clock_minutes">0</integer>
+ <!-- Shape of the glow behind the focused app, in its colour: radial (a soft glow, the default) or horizon (the
+ colour washes down from the top edge and fades to black, brightest along the top). The cinematic shelf
+ keeps its own glow. Can also be set with "glow_style": "horizon" in a theme's config.json. -->
+ <string name="glow_style" translatable="false">radial</string>
</resources>
diff --git a/launcher/app/src/test/java/com/gathin/tvhome/GlowStyleTest.java b/launcher/app/src/test/java/com/gathin/tvhome/GlowStyleTest.java
new file mode 100644
index 000000000..05c2ec2b5
--- /dev/null
+++ b/launcher/app/src/test/java/com/gathin/tvhome/GlowStyleTest.java
@@ -0,0 +1,23 @@
+package com.gathin.tvhome;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/** glow_style from config.xml or a theme: horizon by name, radial for anything else. */
+public class GlowStyleTest {
+
+ @Test
+ public void horizonByNameAnyCase() {
+ assertEquals(Config.GLOW_HORIZON, Config.glowStyle("horizon"));
+ assertEquals(Config.GLOW_HORIZON, Config.glowStyle(" Horizon "));
+ }
+
+ @Test
+ public void anythingElseIsRadial() {
+ assertEquals(Config.GLOW_RADIAL, Config.glowStyle("radial"));
+ assertEquals(Config.GLOW_RADIAL, Config.glowStyle(""));
+ assertEquals(Config.GLOW_RADIAL, Config.glowStyle(null));
+ assertEquals(Config.GLOW_RADIAL, Config.glowStyle("aurora"));
+ }
+}
diff --git a/themes/README.md b/themes/README.md
index e9ae32cfe..e1bdf4540 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -73,6 +73,7 @@ is ignored, and a file that doesn't parse is ignored as a whole, so a theme can
| `app_keys` | list of strings | Remote buttons that open an app, as `"190:com.google.android.youtube.tv"` or `"KEYCODE_BUTTON_3:com.google.android.youtube.tv"`, or by scancode as `"scan:490:com.wbd.hbomax"` for remotes that share one keycode between app buttons (Sony BRAVIA), for `InputKeyService` or `HomeKeyService` |
| `race_calendar` | list of races | F1 race-weekend mode: from 12 hours before a weekend's first session until 4 hours after the race starts, a panel under the clock shows the next session with a countdown (or the live one) and the weekend's session times in the TV's time zone. Write it with `tools/race_calendar.py <theme folder>`, which fetches the season from the free Jolpica API; the launcher itself never goes online |
| `home_idle_clock_minutes` | 0 to 1440 | Minutes Home may sit untouched before it shows the clock screensaver (a thin clock and date drifting over a slow glow, as the system "Clock" screensaver does). Any key returns to Home. It starts only from Home, never over Live TV or an app; 0 is off (default) |
+| `glow_style` | string | Shape of the glow behind the focused app, in its colour: `radial` (default) or `horizon`, the colour washing down from the top edge to black; the cinematic shelf keeps its own |
| `cinematic_home` | bool | Cinematic top shelf: the focused dock app's artwork, softened, fills the top of the screen in its colour, with a larger name, "Last opened" (apps opened from Home), dock position dots, a focus glow in the app's colour and a translucent dock band; off by default |
| `ambient_glow` | bool | The glow behind the dock in the focused app's colour (`true` by default); `false` keeps only `background_color` or the wallpaper, e.g. for a calm photo background |