Skip to content

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

launcher: add an opt-in reduced-motion mode

occcat3532872e9ca5
diff --git a/README.md b/README.md
index 4fb0d03e3..0332daa5b 100644
--- a/README.md
+++ b/README.md
@@ -167,7 +167,7 @@ AndroidX RecyclerView and nothing heavier. Built for sets with 1 GB of RAM: no b
network, no background services. It needs JDK 17 and Android SDK platform 34 to build; on macOS,
`brew install openjdk@17 android-commandlinetools` and `sdkmanager "platforms;android-34" "build-tools;34.0.0"`.
-- **Configure** in [`config.xml`](launcher/app/src/main/res/values/config.xml): dock order, hidden apps, the Live TV package, columns (tiles shrink from 5 up), rows under the dock, an optional VPN app for the network pill.
+- **Configure** in [`config.xml`](launcher/app/src/main/res/values/config.xml): dock order, hidden apps, the Live TV package, columns (tiles shrink from 5 up), rows under the dock, an optional VPN app for the network pill, and `reduced_motion` for TVs whose GPU cannot keep up.
- **Themes** set the same keys plus a background colour and a wallpaper from a `config.json` pushed to the TV, no rebuild. Three ship in [`themes/`](themes/), documented there.
- **Language** follows the TV: English, German, Spanish, Catalan, French, Russian, Simplified Chinese, Thai. Android 13+ can set it for the launcher alone: `tools/tv.py 'cmd locale set-app-locales com.gathin.tvhome --locales ca'`.
- **Module cards** let any TV app declare its own tile (label, caption, glow). The launcher asks you once per app, Keep hidden by default, and remembers the answer for that app's signing key and card name. Hold OK on Settings to change your mind. How to make one: [`docs/modules.md`](docs/modules.md); the contract: [`docs/specs/card.md`](docs/specs/card.md).
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java b/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java
index 5a5ff1dc0..826760577 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java
@@ -19,6 +19,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
+import android.view.animation.DecelerateInterpolator;
import android.view.animation.OvershootInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
@@ -112,6 +113,8 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
/** Never shown as tiles (res/values/config.xml, hidden_apps). */
private final Set<String> hidden;
private final boolean showHomeSettings;
+ /** Calmer motion for weak GPUs (config.xml, reduced_motion): no overshoot, shorter fades. */
+ private final boolean reducedMotion;
private final List<Entry> items = new ArrayList<>();
AppAdapter(Context ctx, TileListener listener, int dockSize, Config cfg) {
@@ -121,6 +124,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
this.favourites = cfg.dockApps;
this.hidden = new HashSet<>(cfg.hiddenApps);
this.showHomeSettings = cfg.showHomeSettingsShortcut;
+ this.reducedMotion = cfg.reducedMotion;
// Tiles keep their identity across reload(), so a focused tile stays on its app instead of
// its view being rebound to whatever app now sits in that slot.
setHasStableIds(true);
@@ -195,7 +199,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
nameLp.width = w;
nameLp.topMargin = h + Math.round(7 * density);
name.setLayoutParams(nameLp);
- return new Holder(v, listener);
+ return new Holder(v, listener, reducedMotion);
}
@Override
@@ -339,14 +343,16 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
final ImageView icon;
final TextView label;
final TextView name;
+ final boolean reducedMotion;
- Holder(View v, TileListener listener) {
+ Holder(View v, TileListener listener, boolean reducedMotion) {
super(v);
card = v.findViewById(R.id.card);
banner = v.findViewById(R.id.banner);
icon = v.findViewById(R.id.icon);
label = v.findViewById(R.id.label);
name = v.findViewById(R.id.name);
+ this.reducedMotion = reducedMotion;
final float density = v.getResources().getDisplayMetrics().density;
card.setOutlineProvider(new ViewOutlineProvider() {
@@ -369,15 +375,25 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
card.setOnFocusChangeListener((view, focused) -> {
float s = focused ? FOCUS_SCALE : 1.0f;
view.animate().cancel();
- view.animate().scaleX(s).scaleY(s)
- .setDuration(focused ? 260 : 180)
- .setInterpolator(new OvershootInterpolator(focused ? 1.6f : 0f))
- .withLayer()
- .start();
name.animate().cancel();
- name.animate().alpha(focused ? 1f : 0f)
- .translationY(focused ? density * 4f : -density * 6f)
- .setDuration(220).start();
+ if (reducedMotion) {
+ // No overshoot: the extra frames redraw the banner and the dock band on a weak GPU.
+ view.animate().scaleX(s).scaleY(s)
+ .setDuration(focused ? 120 : 80)
+ .setInterpolator(new DecelerateInterpolator())
+ .withLayer()
+ .start();
+ name.animate().alpha(focused ? 1f : 0f).setDuration(100).start();
+ } else {
+ view.animate().scaleX(s).scaleY(s)
+ .setDuration(focused ? 260 : 180)
+ .setInterpolator(new OvershootInterpolator(focused ? 1.6f : 0f))
+ .withLayer()
+ .start();
+ name.animate().alpha(focused ? 1f : 0f)
+ .translationY(focused ? density * 4f : -density * 6f)
+ .setDuration(220).start();
+ }
int pos = getBindingAdapterPosition();
if (focused && listener != null && pos != RecyclerView.NO_POSITION) {
listener.onTileFocused(pos, view);
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 36c5e9a7c..ab95d9611 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@ -42,6 +42,8 @@ final class Config {
final int rowsBelowDock;
final boolean shamsiDate;
final boolean moduleCards;
+ /** Calmer motion for weak GPUs (config.xml, reduced_motion): stiff spring, short fades, no replay. */
+ final boolean reducedMotion;
final String vpnApp;
final boolean showHomeSettingsShortcut;
/** Background colour behind everything, #RRGGBB; black unless a theme says otherwise. */
@@ -54,7 +56,8 @@ final class Config {
private Config(List<String> dockApps, List<String> hiddenApps, String liveTvPackage, String liveTvAction,
String sourcePanelService, String sourcePanelAction, String inputAction,
int columns, int rowsBelowDock,
- boolean shamsiDate, boolean moduleCards, String vpnApp, boolean showHomeSettingsShortcut, int backgroundColor,
+ boolean shamsiDate, boolean moduleCards, boolean reducedMotion, String vpnApp,
+ boolean showHomeSettingsShortcut, int backgroundColor,
File wallpaper, boolean overlayApplied) {
this.dockApps = Collections.unmodifiableList(dockApps);
this.hiddenApps = Collections.unmodifiableList(hiddenApps);
@@ -67,6 +70,7 @@ final class Config {
this.rowsBelowDock = rowsBelowDock;
this.shamsiDate = shamsiDate;
this.moduleCards = moduleCards;
+ this.reducedMotion = reducedMotion;
this.vpnApp = vpnApp;
this.showHomeSettingsShortcut = showHomeSettingsShortcut;
this.backgroundColor = backgroundColor;
@@ -92,6 +96,7 @@ final class Config {
int rowsBelow = res.getInteger(R.integer.rows_below_dock);
boolean shamsi = res.getBoolean(R.bool.shamsi_date);
boolean moduleCards = res.getBoolean(R.bool.module_cards);
+ boolean reducedMotion = res.getBoolean(R.bool.reduced_motion);
String vpn = res.getString(R.string.vpn_app).trim();
boolean homeSettings = res.getBoolean(R.bool.show_home_settings_shortcut);
int background = 0xFF000000;
@@ -113,6 +118,7 @@ final class Config {
rowsBelow = integer(json, "rows_below_dock", rowsBelow, 0, 3);
shamsi = bool(json, "shamsi_date", shamsi);
moduleCards = bool(json, "module_cards", moduleCards);
+ reducedMotion = bool(json, "reduced_motion", reducedMotion);
vpn = string(json, "vpn_app", vpn);
homeSettings = bool(json, "show_home_settings_shortcut", homeSettings);
background = color(json, "background_color", background);
@@ -123,8 +129,8 @@ final class Config {
if (json != null && json.has("wallpaper") && !bool(json, "wallpaper", true)) wallpaper = null;
return new Config(dock, hidden, liveTv, liveTvAction, panelService, panelAction, inputAction,
- Math.max(1, columns), Math.max(0, rowsBelow), shamsi, moduleCards, vpn, homeSettings, background,
- wallpaper, applied);
+ Math.max(1, columns), Math.max(0, rowsBelow), shamsi, moduleCards, reducedMotion,
+ vpn, homeSettings, background, wallpaper, applied);
}
/** Reads and parses the overlay; any problem means "no overlay", never a crash on the home screen. */
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 4d9a20f1d..f26f35ef5 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -110,6 +110,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
private float density;
/** Module cards (res/values/config.xml, module_cards): discovered on resume, shown only after the owner's Show. */
private boolean moduleCards;
+ /** Calmer motion for weak GPUs (config.xml, reduced_motion): stiff spring, short fades, no replay. */
+ private boolean reducedMotion;
/** hidden_apps as the adapter sees them (config.xml or a theme's config.json): a hidden app gets no card either. */
private Set<String> hiddenApps = Collections.emptySet();
private List<Cards.Card> cards = Collections.emptyList();
@@ -185,6 +187,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
// config.xml, overlaid by config.json from a pushed theme (see Config and tools/theme.sh).
Config cfg = Config.load(this);
COLUMNS = cfg.columns;
+ reducedMotion = cfg.reducedMotion;
liveTvPkg = cfg.liveTvPackage;
liveTvAction = cfg.liveTvAction;
inputAction = cfg.inputAction;
@@ -216,8 +219,10 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
grid.setHasFixedSize(true);
grid.setItemAnimator(null);
grid.addItemDecoration(new DockDecoration(COLUMNS, density));
+ int enterAnim = reducedMotion ? R.anim.tile_enter_reduced : R.anim.tile_enter;
+ float enterDelay = reducedMotion ? 0f : 0.06f;
grid.setLayoutAnimation(new LayoutAnimationController(
- AnimationUtils.loadAnimation(this, R.anim.tile_enter), 0.06f));
+ AnimationUtils.loadAnimation(this, enterAnim), enterDelay));
adapter = new AppAdapter(this, this, COLUMNS, cfg);
grid.setAdapter(adapter);
@@ -262,7 +267,14 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
}
});
for (SpringAnimation s : new SpringAnimation[]{springX, springY}) {
- s.setSpring(new SpringForce().setStiffness(260f).setDampingRatio(0.58f));
+ if (reducedMotion) {
+ // Stiff and almost critically damped: settles in a few frames instead of oscillating,
+ // and stops once the highlight is within 1.5 px of its tile.
+ s.setSpring(new SpringForce().setStiffness(1400f).setDampingRatio(0.95f));
+ s.setMinimumVisibleChange(1.5f);
+ } else {
+ s.setSpring(new SpringForce().setStiffness(260f).setDampingRatio(0.58f));
+ }
}
btnInputs = findViewById(R.id.btnInputs);
@@ -376,7 +388,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
ambient.setAlpha(0f);
}
reloadTiles();
- if (animate) grid.scheduleLayoutAnimation();
+ if (animate && !reducedMotion) grid.scheduleLayoutAnimation();
if (restoreFocus) {
// Follow the same app, or the nearest remaining slot when it was removed.
@@ -486,7 +498,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
springY.cancel();
glass.setTranslationX(x);
glass.setTranslationY(y);
- glass.animate().alpha(1f).setDuration(180).start();
+ glass.animate().alpha(1f).setDuration(reducedMotion ? 100 : 180).start();
glassShown = true;
} else {
springX.animateToFinalPosition(x);
@@ -497,13 +509,18 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
// Dock: park it at the bottom of the screen and show the top shelf for this app.
int decoratedTop = item.getTop() - (int) (6 * density);
int dy = decoratedTop - grid.getPaddingTop();
- if (Math.abs(dy) > 1) grid.smoothScrollBy(0, dy);
+ // A 1px mismatch used to start a scroll on every dock move. Only scroll when the row is
+ // actually off; reduced motion does it in one jump so it does not fight the highlight.
+ if (Math.abs(dy) > (int) (8 * density)) {
+ if (reducedMotion) grid.scrollBy(0, dy);
+ else grid.smoothScrollBy(0, dy);
+ }
showHero(position, r.top - dy);
} else {
hideHero();
// Scroll just enough so the whole glass (not only the tile) is visible.
Rect want = new Rect(0, -(int) pad * 2, item.getWidth(), item.getHeight() + (int) pad);
- grid.requestChildRectangleOnScreen(item, want, false);
+ grid.requestChildRectangleOnScreen(item, want, reducedMotion);
}
}
@@ -515,6 +532,23 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
float y = dockTopInRoot - 14 * density - 26 * density - heroName.getHeight();
boolean changed = !label.contentEquals(heroName.getText());
+ if (reducedMotion) {
+ // Snap the shelf instead of sliding and fading it: each of those frames repaints the
+ // full-screen panel, and this switch exists for the GPUs that cannot afford it.
+ heroName.animate().cancel();
+ heroName.setText(label);
+ heroName.setY(y);
+ heroName.setTranslationX(0f);
+ heroName.setAlpha(1f);
+ setAmbient(color);
+ if (!heroShown) {
+ ambient.setAlpha(0f);
+ ambient.animate().alpha(1f).setDuration(160).start();
+ heroShown = true;
+ }
+ return;
+ }
+
if (!heroShown) {
heroName.setText(label);
heroName.setY(y);
@@ -570,8 +604,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
private void hideHero() {
if (!heroShown) return;
heroShown = false;
- heroName.animate().alpha(0f).setDuration(160).start();
- ambient.animate().alpha(0f).setDuration(300).start();
+ heroName.animate().alpha(0f).setDuration(reducedMotion ? 100 : 160).start();
+ ambient.animate().alpha(0f).setDuration(reducedMotion ? 140 : 300).start();
}
private void hideGlass() {
diff --git a/launcher/app/src/main/res/anim/tile_enter_reduced.xml b/launcher/app/src/main/res/anim/tile_enter_reduced.xml
new file mode 100644
index 000000000..6f8289645
--- /dev/null
+++ b/launcher/app/src/main/res/anim/tile_enter_reduced.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:interpolator="@android:interpolator/decelerate_cubic"
+ android:duration="160">
+ <alpha android:fromAlpha="0.0" android:toAlpha="1.0" />
+ <translate android:fromYDelta="6%" android:toYDelta="0%" />
+ <scale
+ android:fromXScale="0.98" android:toXScale="1.0"
+ android:fromYScale="0.98" android:toYScale="1.0"
+ android:pivotX="50%" android:pivotY="50%" />
+</set>
diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xml
index 369800c56..d10ea0bd7 100644
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@ -61,4 +61,10 @@
<!-- Module cards: an app that declares a card (docs/specs/card.md) can stand in for its tile with its own
label, caption and glow colour, once you answer Show on the prompt. false: never look for cards or ask. -->
<bool name="module_cards">true</bool>
+
+ <!-- Reduced motion: for TVs whose GPU cannot keep up (MediaTek MT5895 on Android 10 is the known case).
+ true keeps the GPU drawing path but calms the movement: a stiff highlight spring with no bounce,
+ tiles that zoom without overshoot, shorter fades and no tile entrance when Home comes back. Set it
+ here or with "reduced_motion": true in a theme's config.json; false keeps the normal motion. -->
+ <bool name="reduced_motion">false</bool>
</resources>
diff --git a/themes/README.md b/themes/README.md
index 7e3440bb6..02634cc2d 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -32,6 +32,7 @@ is ignored, and a file that doesn't parse is ignored as a whole, so a theme can
| `rows_below_dock` | 0 to 3 | Grid rows left visible under the dock |
| `shamsi_date` | bool | Show the Solar Hijri date above the Gregorian one |
| `module_cards` | bool | Look for module cards and ask about them (`true`); `false` turns the feature off |
+| `reduced_motion` | bool | Calmer motion for weak GPUs: stiff highlight spring, no tile overshoot, short fades, no entrance replay |
| `vpn_app` | string | App the network pill opens when a VPN is configured; also shows a red "VPN off" badge while no VPN is up |
| `show_home_settings_shortcut` | bool | The "Default home" tile, where the TV has a home picker |
| `background_color` | `#RRGGBB` | Colour behind everything; black by default |
@@ -43,6 +44,17 @@ is ignored, and a file that doesn't parse is ignored as a whole, so a theme can
under about 300 KB: the text, the hero name and the dock band are designed for black, and a 1 GB TV
decodes the picture into memory on every Home start. Pictures larger than the screen are downsampled.
+## Reduced motion
+
+`"reduced_motion": true` keeps the look but calms the movement: the highlight spring is stiff instead
+of bouncing, tiles zoom without overshoot, fades are shorter, and Home does not replay the tile
+entrance when you come back to it. Use it on TVs whose GPU cannot keep up; a MediaTek MT5895 on
+Android 10 is the known case. The default, `false`, keeps the normal motion.
+
+```json
+{ "reduced_motion": true }
+```
+
## Adding a theme
Open a PR with a new folder here, a one-line row in the table above and a screenshot from a real TV
diff --git a/themes/default/config.json b/themes/default/config.json
index 1370ae3ac..11c42ffc4 100644
--- a/themes/default/config.json
+++ b/themes/default/config.json
@@ -3,6 +3,7 @@
"hidden_apps": ["com.mediatek.wwtv.tvcenter", "com.mitv.gallery"],
"columns": 4,
"rows_below_dock": 0,
+ "reduced_motion": false,
"background_color": "#000000",
"wallpaper": false
}