Skip to content

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

Launcher: cinematic_scrim and cinematic_art, to let a wallpaper show through the cinematic shelf

Bansi Patelced98cc9c581
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 6071c886f..276acdf70 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@ -175,6 +175,10 @@ final class Config {
final boolean dockGlass;
/** The dock band's padding equals the gap between its tiles (config.xml, dock_even_padding); false keeps the fixed padding. */
final boolean dockEvenPadding;
+ /** Opacity of the app's artwork behind the cinematic shelf, 0 to 100 (config.xml, cinematic_art); 50 as before. */
+ final int cinematicArt;
+ /** Strength of the cinematic shelf's dark scrim, 0 to 100 percent (config.xml, cinematic_scrim); 100 as before. */
+ final int cinematicScrim;
/** Shape of the glow behind the focused app (config.xml, glow_style): {@link #GLOW_RADIAL} or {@link #GLOW_HORIZON}. */
final String glowStyle;
@@ -198,7 +202,7 @@ final class Config {
Festival festival, int[] inputKeycodes, List<String> appKeys, String stockHomeRedirect,
List<RaceWeekend.Race> raceCalendar, boolean cinematicHome, boolean ambientGlow, boolean appGlow, int homeIdleClockMinutes,
boolean keyFilter, boolean dockGlass, String glowStyle, boolean wallpaperCaptions,
- boolean handleViewInputs, boolean tileMenu, boolean dockEvenPadding) {
+ boolean handleViewInputs, boolean tileMenu, boolean dockEvenPadding, int cinematicScrim, int cinematicArt) {
this.handleViewInputs = handleViewInputs;
this.tileMenu = tileMenu;
this.inputKeycodes = inputKeycodes;
@@ -269,6 +273,8 @@ final class Config {
this.homeIdleClockMinutes = homeIdleClockMinutes;
this.dockGlass = dockGlass;
this.dockEvenPadding = dockEvenPadding;
+ this.cinematicArt = cinematicArt;
+ this.cinematicScrim = cinematicScrim;
this.glowStyle = glowStyle(glowStyle);
this.wallpaperCaptions = wallpaperCaptions;
}
@@ -346,6 +352,8 @@ final class Config {
boolean keyFilter = res.getBoolean(R.bool.key_filter);
boolean dockGlass = res.getBoolean(R.bool.dock_glass);
boolean dockEvenPadding = res.getBoolean(R.bool.dock_even_padding);
+ int cinematicArt = res.getInteger(R.integer.cinematic_art);
+ int cinematicScrim = res.getInteger(R.integer.cinematic_scrim);
String glowStyle = res.getString(R.string.glow_style);
boolean applied = false;
@@ -416,6 +424,8 @@ final class Config {
keyFilter = bool(json, "key_filter", keyFilter);
dockGlass = bool(json, "dock_glass", dockGlass);
dockEvenPadding = bool(json, "dock_even_padding", dockEvenPadding);
+ cinematicArt = integer(json, "cinematic_art", cinematicArt, 0, 100);
+ cinematicScrim = integer(json, "cinematic_scrim", cinematicScrim, 0, 100);
glowStyle = string(json, "glow_style", glowStyle);
}
// A theme push or reset invalidates choices made on the TV. On first use, remember the
@@ -470,7 +480,7 @@ final class Config {
Math.max(0, Math.min(100, skyIntensity)), settingsKeycodes, settingsKeyPanel, restoreKeyServices, wallpaperEnabled, wallpaper,
wallpapers, rotationMinutes, wallpaperDim, dockOpacity, wallpaperOrder, applied,
festival, inputKeycodes, appKeys, stockHomeRedirect, json == null ? Collections.emptyList() : raceCalendar(json), cinematic, ambientGlow, appGlow,
- Math.max(0, idleClockMinutes), keyFilter, dockGlass, glowStyle, wallpaperCaptions, handleViewInputs, tileMenu, dockEvenPadding);
+ Math.max(0, idleClockMinutes), keyFilter, dockGlass, glowStyle, wallpaperCaptions, handleViewInputs, tileMenu, dockEvenPadding, cinematicScrim, cinematicArt);
}
/**
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 5be43c946..956d3a6bc 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -150,7 +150,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
/** 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;
+ /** The artwork's opacity behind the cinematic shelf (config.xml cinematic_art); 0 leaves it out. */
+ private float heroArtAlpha = 0.5f;
/** Softened artwork per app (HeroArt, about 5 KB each), made the first time its dock tile is focused. */
private final Map<String, Bitmap> heroArtCache = new HashMap<>();
/** The app whose artwork heroArt shows, so focusing it again only fades it back in. */
@@ -405,7 +406,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
heroArt = findViewById(R.id.heroArt);
cinematic = cfg.cinematicHome;
glowStyle = cfg.glowStyle;
- if (cinematic) setUpCinematicShelf();
+ heroArtAlpha = cfg.cinematicArt / 100f;
+ if (cinematic) setUpCinematicShelf(cfg.cinematicScrim);
// dock_title false: the name above the dock (and the cinematic lines under it) never shows; the glow
// still follows the dock.
if (!cfg.dockTitle) hero.setVisibility(View.GONE);
@@ -1552,7 +1554,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
int color = adapter.ambientColorAt(position);
float y = dockTopInRoot - 14 * density - 26 * density - hero.getHeight();
boolean changed = !label.contentEquals(heroName.getText());
- if (cinematic) showHeroArt(position);
+ if (cinematic && heroArtAlpha > 0f) showHeroArt(position);
if (!animations || reducedMotion) {
// Snap the shelf instead of sliding and fading it: each of those frames repaints the
@@ -1615,17 +1617,24 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
// ---- cinematic shelf -------------------------------------------------------------------------
- /** The parts that never change: a larger name, the meta line and the dots, the artwork and the scrim. */
- private void setUpCinematicShelf() {
+ /**
+ * The parts that never change: a larger name, the meta line and the dots, the artwork and the scrim, at
+ * scrimPercent of its strength (cinematic_scrim). cinematic_art 0 leaves the artwork out, 0 percent the scrim.
+ */
+ private void setUpCinematicShelf(int scrimPercent) {
heroName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 68f);
heroName.setLetterSpacing(-0.025f);
heroMeta.setVisibility(View.INVISIBLE); // keeps its height, so the name does not jump when it fills in
heroDots.setVisibility(View.VISIBLE);
- heroArt.setVisibility(View.VISIBLE);
+ heroArt.setVisibility(heroArtAlpha > 0f ? View.VISIBLE : View.GONE);
// One stretched bitmap: apply its alpha while drawing instead of through an offscreen buffer.
heroArt.forceHasOverlappingRendering(false);
+ if (scrimPercent <= 0) return; // cinematic_scrim 0: no scrim at all
View scrim = findViewById(R.id.heroScrim);
- scrim.setBackground(scrimDrawable());
+ Drawable shade = scrimDrawable();
+ // On the bitmap's paint, not the view: a view's alpha would draw the full screen through an offscreen buffer.
+ shade.setAlpha(scrimPercent * 255 / 100);
+ scrim.setBackground(shade);
scrim.setVisibility(View.VISIBLE);
}
@@ -1674,13 +1683,13 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
}
heroArt.animate().alpha(0f).setDuration(140).withEndAction(() -> {
heroArt.setImageBitmap(next);
- heroArt.animate().alpha(HERO_ART_ALPHA).setDuration(420).start();
+ heroArt.animate().alpha(heroArtAlpha).setDuration(420).start();
}).start();
}
private void fadeHeroArt(int ms) {
- if (!animations) heroArt.setAlpha(HERO_ART_ALPHA);
- else heroArt.animate().alpha(HERO_ART_ALPHA).setDuration(reducedMotion ? Math.min(ms, Motion.REDUCED_MS) : ms).start();
+ if (!animations) heroArt.setAlpha(heroArtAlpha);
+ else heroArt.animate().alpha(heroArtAlpha).setDuration(reducedMotion ? Math.min(ms, Motion.REDUCED_MS) : ms).start();
}
/** "Last opened yesterday, 9:40 PM", the time in white; nothing (but the same height) when it was never seen. */
diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xml
index f600676d0..77f6183d7 100644
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@ -305,6 +305,12 @@
dots, the focus glow takes the app's colour and the dock band turns translucent. false keeps the plain
shelf. Can also be set with "cinematic_home": true in a theme's config.json. -->
<bool name="cinematic_home">false</bool>
+ <!-- With cinematic_home, how much of a wallpaper the shelf covers: cinematic_scrim is the strength of the dark
+ scrim that keeps the name readable (0 to 100 percent, 100 as before) and cinematic_art the opacity of the
+ app's softened artwork (0 to 100, 50 as before; 0 leaves the wallpaper uncovered). Lower values let a
+ theme's wallpaper show through. A theme can set "cinematic_scrim" and "cinematic_art". -->
+ <integer name="cinematic_scrim">100</integer>
+ <integer name="cinematic_art">50</integer>
<!-- The glow behind the dock in the focused app's colour (red for YouTube, blue for Prime Video). false keeps
only background_color or the wallpaper behind everything. Can also be set with "ambient_glow": false in a
diff --git a/themes/README.md b/themes/README.md
index c0b455181..77191dec7 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -98,6 +98,8 @@ is ignored, and a file that doesn't parse is ignored as a whole, so a theme can
| `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 |
+| `cinematic_scrim` | 0 to 100 | With `cinematic_home`, the strength of the dark scrim behind the shelf's name (`100` by default); lower lets a wallpaper show through |
+| `cinematic_art` | 0 to 100 | With `cinematic_home`, the opacity of the focused app's softened artwork (`50` by default); `0` leaves the wallpaper uncovered |
| `dock_even_padding` | bool | The dock band's padding equals the gap between its tiles on all four sides, as far as the grid's edges leave room (`false` by default) |
| `dock_glass` | bool | The dock band as light frosted glass like the top bar's pills (`false` by default); suits `sky_intensity` or a wallpaper, where the solid band reads as a dark slab |
| `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 |