Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.
Python adbadblockandroid-tvandroid-tv-launcherapple-tvbloatware-removalclaude-codedebloatfire-tvgoogle-tvlauncherprivacysmart-tvsony-braviatclvibe-codingxiaomi
launcher: dock_row option for one plain grid without a dock band
Samuel Hintonf11b07650e36
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java b/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.javaindex 5b0eb318f..1ec17b55b 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java@@ -106,9 +106,22 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {/** Height of one grid item: the tile, the name label under it and the item's own padding. */static int itemHeightPx(int tileHeightPx, float density) {- return tileHeightPx + Math.round(ITEM_EXTRA_DP * density);+ return itemHeightPx(tileHeightPx, true, density);}+ /** The same for either layout: the plain grid (dock_row false) uses the compact spacing. */+ static int itemHeightPx(int tileHeightPx, boolean dockRow, float density) {+ return tileHeightPx + Math.round((dockRow ? ITEM_EXTRA_DP : COMPACT_ITEM_EXTRA_DP) * density);+ }++ /**+ * dock_row false: 4dp padding above and below, a 4dp gap and a 20dp name label, and 16dp kept under the last+ * row. The plain grid fits more rows on the screen, and with item_app.xml's roomier spacing the tiles came+ * out small with wide gaps between them.+ */+ static final float COMPACT_ITEM_EXTRA_DP = 4 + 4 + 4 + 20;+ static final float COMPACT_BOTTOM_ROOM_DP = 16;+/** item_app.xml: 8dp padding above and below, a 7dp gap and the 22dp name label under the tile. */static final float ITEM_EXTRA_DP = 45;/** DockDecoration's offsets above and below the dock row. */@@ -117,20 +130,24 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {static final float BOTTOM_ROOM_DP = 30;/** Room kept above the dock for the dock title (48sp hero name plus its 40dp gap) when dock_title is on. */static final float TITLE_ROOM_DP = 104;+ /** dock_row false: room above the first row for its zoom and glass (MainActivity places the grid with it). */+ static final float TOP_ROOM_DP = 12;/*** Tile width that fits the columns across and, with rows_below_dock > 0, the dock (with its title above it,* if shown) plus that many rows down the grid's height; the smaller wins. With rows_below_dock = 0, or before* the grid has a height, only the width counts, as before. Without this, 2 or 3 rows below the dock did not- * fit: the dock was pushed to the top and its title drew over the clock.+ * fit: the dock was pushed to the top and its title drew over the clock. With dock_row false there is no band+ * or title to make room for: the first row plus rows_below_dock rows fit under a small top margin.*/static int tileWidthPx(int innerWidthPx, int gridHeightPx, int columns, int rowsBelowDock, boolean dockTitle,- float density) {+ boolean dockRow, float density) {int w = tileWidthPx(innerWidthPx, columns, density);if (gridHeightPx <= 0 || rowsBelowDock <= 0) return w;- float reserved = (DOCK_EXTRA_DP + BOTTOM_ROOM_DP + (dockTitle ? TITLE_ROOM_DP : 0)) * density;+ float reserved = (dockRow ? DOCK_EXTRA_DP + BOTTOM_ROOM_DP + (dockTitle ? TITLE_ROOM_DP : 0)+ : TOP_ROOM_DP + COMPACT_BOTTOM_ROOM_DP) * density;float perItem = (gridHeightPx - reserved) / (rowsBelowDock + 1);- float tileH = perItem - ITEM_EXTRA_DP * density;+ float tileH = perItem - (dockRow ? ITEM_EXTRA_DP : COMPACT_ITEM_EXTRA_DP) * density;int byHeight = Math.round(tileH * DESIGN_W_DP / DESIGN_H_DP);return Math.max(Math.round(80 * density), Math.min(w, byHeight));}@@ -140,6 +157,8 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {private final boolean dockTitle;private final TileListener listener;private final int dockSize;+ /** config dock_row: false makes the dock apps the first tiles of one plain grid (names shown, no empty slots). */+ private final boolean dockRow;/** Dock order (config.xml dock_apps, or a theme's config.json). */private final List<String> favourites;/** Grid apps fill the dock slots dock_apps leaves free (config.xml, fill_dock). */@@ -168,6 +187,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {this.reducedMotion = cfg.reducedMotion;this.rowsBelowDock = cfg.rowsBelowDock;this.dockTitle = cfg.dockTitle;+ this.dockRow = cfg.dockRow;// 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);@@ -222,7 +242,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {}docked = 0;while (docked < fresh.size() && favourites.contains(fresh.get(docked).pkg)) docked++;- emptySlots = DockSlots.empty(docked, dockSize, fresh.size(), fillDock);+ emptySlots = dockRow ? DockSlots.empty(docked, dockSize, fresh.size(), fillDock) : 0;for (int i = 0; i < emptySlots; i++) {fresh.add(docked + i, new Entry(Entry.EMPTY, "", new ComponentName(ctx, "empty-dock-slot-" + i),null, null, null, 0));@@ -254,7 +274,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {float density = parent.getResources().getDisplayMetrics().density;int width = parent.getWidth() > 0 ? parent.getWidth() : parent.getMeasuredWidth();int inner = width - parent.getPaddingLeft() - parent.getPaddingRight();- int w = tileWidthPx(inner, parent.getHeight(), dockSize, rowsBelowDock, dockTitle, density), h = tileHeightPx(w);+ int w = tileWidthPx(inner, parent.getHeight(), dockSize, rowsBelowDock, dockTitle, dockRow, density), h = tileHeightPx(w);View card = v.findViewById(R.id.card);ViewGroup.LayoutParams cardLp = card.getLayoutParams();cardLp.width = w;@@ -263,7 +283,13 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {View name = v.findViewById(R.id.name);ViewGroup.MarginLayoutParams nameLp = (ViewGroup.MarginLayoutParams) name.getLayoutParams();nameLp.width = w;- nameLp.topMargin = h + Math.round(7 * density);+ nameLp.topMargin = h + Math.round((dockRow ? 7 : 4) * density);+ if (!dockRow) {+ // Compact spacing (COMPACT_ITEM_EXTRA_DP): 4dp item padding and a 20dp name instead of 8dp and 22dp.+ nameLp.height = Math.round(20 * density);+ int pad = Math.round(4 * density);+ v.setPadding(v.getPaddingLeft(), pad, v.getPaddingRight(), pad);+ }name.setLayoutParams(nameLp);return new Holder(v, listener, animations, advancedEffects, reducedMotion);}@@ -285,7 +311,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {h.card.setVisibility(View.VISIBLE);h.card.setFocusable(true);h.name.setText(e.name);- h.name.setVisibility(position < dockSize ? View.INVISIBLE : View.VISIBLE); // the dock has no labels+ h.name.setVisibility(dockRow && position < dockSize ? View.INVISIBLE : View.VISIBLE); // the dock has no labelsboolean focused = h.card.isFocused(); // a rebind after reload() can hit the focused tileh.name.setAlpha(focused ? 1f : 0f);h.card.setScaleX(focused && animations ? focusScale() : 1f);diff --git a/launcher/app/src/main/java/com/gathin/tvhome/Config.java b/launcher/app/src/main/java/com/gathin/tvhome/Config.javaindex 7670a61c2..150908b7f 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java@@ -54,6 +54,8 @@ final class Config {final boolean reducedMotion;/** The focused dock app's name in large type above the dock (config.xml, dock_title). */final boolean dockTitle;+ /** The dock as its own row: band, no names, parked low (config.xml dock_row). false: one plain grid. */+ final boolean dockRow;final String vpnApp;final boolean showHomeSettingsShortcut;/** Background colour behind everything, #RRGGBB; black unless a theme says otherwise. */@@ -74,7 +76,7 @@ final class Config {private Config(List<String> dockApps, boolean fillDock, List<String> hiddenApps, String liveTvPackage,String liveTvAction, String sourcePanelService, String sourcePanelAction, String inputAction,int columns, int rowsBelowDock, boolean animations, boolean advancedEffects,- boolean shamsiDate, boolean moduleCards, boolean reducedMotion, boolean dockTitle, String vpnApp,+ boolean shamsiDate, boolean moduleCards, boolean reducedMotion, boolean dockTitle, boolean dockRow, String vpnApp,boolean showHomeSettingsShortcut, int backgroundColor, int skyIntensity,int[] settingsKeycodes, boolean settingsKeyPanel, File wallpaper, boolean overlayApplied,Festival festival) {@@ -94,6 +96,7 @@ final class Config {this.moduleCards = moduleCards;this.reducedMotion = reducedMotion;this.dockTitle = dockTitle;+ this.dockRow = dockRow;this.vpnApp = vpnApp;this.showHomeSettingsShortcut = showHomeSettingsShortcut;this.backgroundColor = backgroundColor;@@ -128,6 +131,7 @@ final class Config {boolean moduleCards = res.getBoolean(R.bool.module_cards);boolean reducedMotion = res.getBoolean(R.bool.reduced_motion);boolean dockTitle = res.getBoolean(R.bool.dock_title);+ boolean dockRow = res.getBoolean(R.bool.dock_row);String vpn = res.getString(R.string.vpn_app).trim();boolean homeSettings = res.getBoolean(R.bool.show_home_settings_shortcut);int background = 0xFF000000;@@ -157,6 +161,7 @@ final class Config {moduleCards = bool(json, "module_cards", moduleCards);reducedMotion = bool(json, "reduced_motion", reducedMotion);dockTitle = bool(json, "dock_title", dockTitle);+ dockRow = bool(json, "dock_row", dockRow);vpn = string(json, "vpn_app", vpn);homeSettings = bool(json, "show_home_settings_shortcut", homeSettings);background = color(json, "background_color", background);@@ -182,7 +187,7 @@ final class Config {return new Config(dock, fillDock, hidden, liveTv, liveTvAction, panelService, panelAction, inputAction,Math.max(1, columns), Math.max(0, rowsBelow), animations, advancedEffects,- shamsi, moduleCards, reducedMotion, dockTitle, vpn, homeSettings, background,+ shamsi, moduleCards, reducedMotion, dockTitle, dockRow, vpn, homeSettings, background,Math.max(0, Math.min(100, skyIntensity)), settingsKeycodes, settingsKeyPanel, wallpaper, applied,festival);}diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.javaindex 24daf7280..66b4521b5 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java@@ -126,6 +126,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {private boolean moduleCards;/** Calmer motion for weak GPUs (config.xml, reduced_motion): stiff spring, short fades, no replay. */private boolean reducedMotion;+ /** config.xml dock_row: the first row is a separate dock (band, parked low, top shelf) rather than plain grid. */+ private boolean dockRow;/** Festive skin from the theme (see Festival); applied while it is active today. */private Festival festival = Festival.NONE;private boolean festive;@@ -216,6 +218,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {animations = cfg.animations;advancedEffects = cfg.animations && cfg.advancedEffects;reducedMotion = cfg.reducedMotion;+ dockRow = cfg.dockRow;festival = cfg.festival;festive = festival.active(LocalDate.now());liveTvPkg = cfg.liveTvPackage;@@ -275,7 +278,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {public boolean requestChildRectangleOnScreen(@NonNull RecyclerView parent, @NonNull View child,@NonNull Rect rect, boolean immediate,boolean focusedChildVisible) {- if (getPosition(child) < COLUMNS) return false;+ if (dockRow && getPosition(child) < COLUMNS) return false;int top = child.getTop() + rect.top;int bottom = top + rect.height();int limitBottom = getHeight() - getPaddingBottom();@@ -291,7 +294,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {});grid.setHasFixedSize(true);grid.setItemAnimator(null);- grid.addItemDecoration(new DockDecoration(COLUMNS, density));+ if (dockRow) grid.addItemDecoration(new DockDecoration(COLUMNS, density));if (animations) {int enterAnim = reducedMotion ? R.anim.tile_enter_reduced : R.anim.tile_enter;float enterDelay = reducedMotion ? 0f : 0.06f;@@ -308,14 +311,16 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {int h = b - t;// Item height follows the tile size, which follows the columns and the rows that must fit (AppAdapter.tileWidthPx).int inner = (r - l) - grid.getPaddingLeft() - grid.getPaddingRight();- int tileW = AppAdapter.tileWidthPx(inner, h, COLUMNS, rowsBelowDock, cfg.dockTitle, density);+ int tileW = AppAdapter.tileWidthPx(inner, h, COLUMNS, rowsBelowDock, cfg.dockTitle, cfg.dockRow, density);int itemH = AppAdapter.itemHeightPx(AppAdapter.tileHeightPx(tileW), density);int dockRow = itemH + (int) (AppAdapter.DOCK_EXTRA_DP * density); // item height plus DockDecoration offsetsint gridRows = itemH * rowsBelowDock;int want = Math.max(0, h - dockRow - gridRows - (int) (AppAdapter.BOTTOM_ROOM_DP * density));// Where the rows cannot fit even at the smallest tile (3 rows with the title on), the title keeps its// room above the dock and the last rows run off the bottom instead of the title drawing over the clock.- if (cfg.dockTitle && rowsBelowDock > 0) want = Math.max(want, (int) (AppAdapter.TITLE_ROOM_DP * density));+ if (MainActivity.this.dockRow && cfg.dockTitle && rowsBelowDock > 0) want = Math.max(want, (int) (AppAdapter.TITLE_ROOM_DP * density));+ // No dock to push down: the grid starts at the top, with room for the first row's zoom and glass.+ if (!MainActivity.this.dockRow) want = (int) (AppAdapter.TOP_ROOM_DP * density);if (grid.getPaddingTop() != want) {grid.setPadding(grid.getPaddingLeft(), want, grid.getPaddingRight(), grid.getPaddingBottom());}@@ -678,7 +683,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {springY.animateToFinalPosition(y - glassScrollShift);}View item = (View) card.getParent();- if (position < COLUMNS) {+ if (dockRow && position < COLUMNS) {// 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();@@ -691,7 +696,9 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {}showHero(position, scroll ? r.top - dy : r.top);} else {- hideHero();+ // A plain grid (dock_row false) has no dock to carry the glow, so it follows every tile there.+ if (dockRow) hideHero();+ else showGlowOnly(position);// 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, reducedMotion);@@ -812,6 +819,33 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {}}+ /**+ * dock_row false: the glow behind the grid takes the focused tile's colour; the big name above the dock does not+ * show (every tile has its name underneath).+ */+ private void showGlowOnly(int position) {+ int color = adapter.ambientColorAt(position);+ stopAmbientAnimation();+ heroName.animate().cancel();+ ambient.animate().cancel();+ heroName.setAlpha(0f);+ heroShown = false;+ if (!animations || reducedMotion) {+ setAmbient(color);+ ambient.setAlpha(1f);+ return;+ }+ if (color == ambientColor && ambient.getBackground() != null) {+ ambient.animate().alpha(1f).setDuration(300).start();+ return;+ }+ // The same dip-and-swap as the dock's top shelf.+ ambient.animate().alpha(0.35f).setDuration(ambient.getAlpha() > 0.35f ? 200 : 0).withEndAction(() -> {+ setAmbient(color);+ ambient.animate().alpha(1f).setDuration(500).start();+ }).start();+ }+private void hideHero() {if (!heroShown) return;stopAmbientAnimation();diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xmlindex 7bc6d1ba3..30925a3ef 100644--- a/launcher/app/src/main/res/values/config.xml+++ b/launcher/app/src/main/res/values/config.xml@@ -68,6 +68,11 @@VPN you use. Empty: the pill opens Wi-Fi settings. The green VPN badge shows for any VPN either way;with an app set here, a red "VPN off" badge also shows while no VPN is up. --><string name="vpn_app" translatable="false"></string>+ <!-- The dock as its own row: a lighter band, no names under the tiles, parked low on the screen with the top+ shelf above it. false makes the dock apps simply the first tiles of one plain grid (still in dock_apps+ order, no empty slots), with names under every tile and the glow behind every focused tile. -->+ <bool name="dock_row">true</bool>+<!-- Grid rows left visible under the dock on the home screen. 0 = dock sits at the very bottom. Tiles shrink ifthe dock, its title and this many rows would not otherwise fit the screen height. --><integer name="rows_below_dock">0</integer>diff --git a/launcher/app/src/test/java/com/gathin/tvhome/TileFitTest.java b/launcher/app/src/test/java/com/gathin/tvhome/TileFitTest.javaindex 8187db0b9..63c95f513 100644--- a/launcher/app/src/test/java/com/gathin/tvhome/TileFitTest.java+++ b/launcher/app/src/test/java/com/gathin/tvhome/TileFitTest.java@@ -21,8 +21,8 @@ public class TileFitTest {@Testpublic void noRowsBelowDockKeepsTheWidthOnlySize() {int widthOnly = AppAdapter.tileWidthPx(INNER, 4, D);- assertEquals(widthOnly, AppAdapter.tileWidthPx(INNER, GRID_H, 4, 0, true, D));- assertEquals(widthOnly, AppAdapter.tileWidthPx(INNER, 0, 4, 3, true, D)); // not laid out yet+ assertEquals(widthOnly, AppAdapter.tileWidthPx(INNER, GRID_H, 4, 0, true, true, D));+ assertEquals(widthOnly, AppAdapter.tileWidthPx(INNER, 0, 4, 3, true, true, D)); // not laid out yet}@Test@@ -30,7 +30,7 @@ public class TileFitTest {for (int rows = 1; rows <= 3; rows++) {for (boolean title : new boolean[]{true, false}) {if (rows == 3 && title) continue; // below the 80dp minimum, see the next test- int w = AppAdapter.tileWidthPx(INNER, GRID_H, 4, rows, title, D);+ int w = AppAdapter.tileWidthPx(INNER, GRID_H, 4, rows, title, true, D);assertTrue("rows " + rows + " title " + title, height(w, rows, title) <= GRID_H + 2);}}@@ -39,12 +39,23 @@ public class TileFitTest {@Testpublic void threeRowsWithTheTitleStopAtTheMinimumTile() {// Tiles would have to be about 23dp tall; they stop at the 80dp-wide minimum instead (dock_title false fits).- assertEquals(Math.round(80 * D), AppAdapter.tileWidthPx(INNER, GRID_H, 4, 3, true, D));+ assertEquals(Math.round(80 * D), AppAdapter.tileWidthPx(INNER, GRID_H, 4, 3, true, true, D));+ }++ @Test+ public void plainGridFitsFourRowsAtSixColumns() {+ // dock_row false, rows_below_dock 3: the first row and 3 more under a 12dp top margin.+ int w = AppAdapter.tileWidthPx(INNER, GRID_H, 6, 3, true, false, D);+ int itemH = AppAdapter.itemHeightPx(AppAdapter.tileHeightPx(w), false, D);+ int needed = itemH * 4 + Math.round((AppAdapter.TOP_ROOM_DP + AppAdapter.COMPACT_BOTTOM_ROOM_DP) * D);+ assertTrue(needed + " > " + GRID_H, needed <= GRID_H + 2);+ // With the compact spacing the width limit decides, not the height: no extra whitespace between tiles.+ assertEquals(AppAdapter.tileWidthPx(INNER, 6, D), w);}@Testpublic void droppingTheTitleGivesBiggerTiles() {- assertTrue(AppAdapter.tileWidthPx(INNER, GRID_H, 4, 3, false, D)- > AppAdapter.tileWidthPx(INNER, GRID_H, 4, 3, true, D));+ assertTrue(AppAdapter.tileWidthPx(INNER, GRID_H, 4, 3, false, true, D)+ > AppAdapter.tileWidthPx(INNER, GRID_H, 4, 3, true, true, D));}}diff --git a/themes/README.md b/themes/README.mdindex 92519ee86..382c6a500 100644--- a/themes/README.md+++ b/themes/README.md@@ -35,6 +35,7 @@ is ignored, and a file that doesn't parse is ignored as a whole, so a theme can| `columns` | 1 to 8 | Tiles per row; tiles shrink to fit from 5 up || `rows_below_dock` | 0 to 3 | Grid rows left visible under the dock; tiles shrink if the dock, its title and that many rows would not fit the screen height || `dock_title` | bool | The focused dock app's name in large type above the dock (`true`); `false` keeps only the glow |+| `dock_row` | bool | The dock as its own row with a band (`true`); `false` makes the dock apps the first tiles of one plain grid || `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 |