Skip to content

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

Launcher: skip the glow's fades and colour animator when ambient_glow is off

Renjith Sasidharan52ee16a479b5
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 b11be4c2d..a321a0541 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -120,6 +120,9 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
private LinearLayout heroDots;
/** Cinematic top shelf (config.xml, cinematic_home): the focused dock app's artwork behind a larger shelf. */
private boolean cinematic;
+ /** 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;
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. */
@@ -319,8 +322,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
// The glow is one bitmap, so its alpha can be applied while drawing it. Otherwise every frame of
// a fade renders it into a full-screen offscreen buffer first.
ambient.forceHasOverlappingRendering(false);
- // Off by config: the view never draws, and the fades below only change the alpha of a gone view.
- if (!cfg.ambientGlow) ambient.setVisibility(View.GONE);
+ ambientGlow = cfg.ambientGlow;
+ if (!ambientGlow) ambient.setVisibility(View.GONE);
heroName = findViewById(R.id.heroName);
hero = findViewById(R.id.hero);
// The hero is now a group (name, and the cinematic lines): without this every fade of the default
@@ -1182,15 +1185,16 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
hero.setY(y);
hero.setTranslationX(0f);
hero.setAlpha(1f);
- setAmbient(color);
- if (!animations) {
- ambient.setAlpha(1f);
- heroShown = true;
- } else if (!heroShown) {
- ambient.setAlpha(0f);
- ambient.animate().alpha(1f).setDuration(160).start();
- heroShown = true;
+ if (ambientGlow) {
+ setAmbient(color);
+ if (!animations) {
+ ambient.setAlpha(1f);
+ } else if (!heroShown) {
+ ambient.setAlpha(0f);
+ ambient.animate().alpha(1f).setDuration(160).start();
+ }
}
+ heroShown = true;
return;
}
@@ -1202,8 +1206,10 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
hero.setY(y);
hero.setTranslationX(0f);
hero.animate().alpha(1f).setDuration(260).start();
- setAmbient(color);
- ambient.animate().alpha(1f).setDuration(600).start();
+ if (ambientGlow) {
+ setAmbient(color);
+ ambient.animate().alpha(1f).setDuration(600).start();
+ }
heroShown = true;
} else if (changed) {
if (advancedEffects) hero.animate().cancel();
@@ -1213,9 +1219,9 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
hero.setTranslationX(12 * density);
hero.animate().alpha(1f).translationX(0f).setDuration(200).start();
}).start();
- if (advancedEffects) {
+ if (ambientGlow && advancedEffects) {
transitionAmbient(color);
- } else if (color != ambientColor) {
+ } else if (ambientGlow && color != ambientColor) {
ambient.animate().alpha(0.35f).setDuration(200).withEndAction(() -> {
setAmbient(color);
ambient.animate().alpha(1f).setDuration(500).start();
@@ -1426,6 +1432,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
heroArt.animate().cancel();
heroArt.setAlpha(0f);
heroShown = false;
+ if (!ambientGlow) return;
if (!animations || reducedMotion) {
setAmbient(color);
ambient.setAlpha(1f);
@@ -1451,7 +1458,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
heroShown = false;
if (animations) {
hero.animate().alpha(0f).setDuration(reducedMotion ? 100 : 160).start();
- ambient.animate().alpha(0f).setDuration(reducedMotion ? 140 : 300).start();
+ if (ambientGlow) ambient.animate().alpha(0f).setDuration(reducedMotion ? 140 : 300).start();
heroArt.animate().alpha(0f).setDuration(reducedMotion ? 140 : 300).start();
} else {
hero.setAlpha(0f);