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
fix: dock band corners are concentric with its tiles; opt-in dock_even_padding
iyts45da1350a10d
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/Config.java b/launcher/app/src/main/java/com/gathin/tvhome/Config.javaindex 70c48b0b5..3c5e7ce62 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java@@ -159,6 +159,8 @@ final class Config {final int homeIdleClockMinutes;/** The dock band as light frosted glass like the pills (config.xml, dock_glass); false keeps the solid band. */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;/** Shape of the glow behind the focused app (config.xml, glow_style): {@link #GLOW_RADIAL} or {@link #GLOW_HORIZON}. */final String glowStyle;@@ -182,7 +184,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 handleViewInputs, boolean tileMenu, boolean dockEvenPadding) {this.handleViewInputs = handleViewInputs;this.tileMenu = tileMenu;this.inputKeycodes = inputKeycodes;@@ -250,6 +252,7 @@ final class Config {this.appGlow = appGlow;this.homeIdleClockMinutes = homeIdleClockMinutes;this.dockGlass = dockGlass;+ this.dockEvenPadding = dockEvenPadding;this.glowStyle = glowStyle(glowStyle);this.wallpaperCaptions = wallpaperCaptions;}@@ -324,6 +327,7 @@ final class Config {int idleClockMinutes = res.getInteger(R.integer.home_idle_clock_minutes);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);String glowStyle = res.getString(R.string.glow_style);boolean applied = false;@@ -391,6 +395,7 @@ final class Config {idleClockMinutes = integer(json, "home_idle_clock_minutes", idleClockMinutes, 0, 1440);keyFilter = bool(json, "key_filter", keyFilter);dockGlass = bool(json, "dock_glass", dockGlass);+ dockEvenPadding = bool(json, "dock_even_padding", dockEvenPadding);glowStyle = string(json, "glow_style", glowStyle);}// A theme push or reset invalidates choices made on the TV. On first use, remember the@@ -453,7 +458,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);+ Math.max(0, idleClockMinutes), keyFilter, dockGlass, glowStyle, wallpaperCaptions, handleViewInputs, tileMenu, dockEvenPadding);}/**diff --git a/launcher/app/src/main/java/com/gathin/tvhome/DockDecoration.java b/launcher/app/src/main/java/com/gathin/tvhome/DockDecoration.javaindex a6399154e..0efacb99b 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/DockDecoration.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/DockDecoration.java@@ -24,6 +24,8 @@ public class DockDecoration extends RecyclerView.ItemDecoration {private final float namesRoom;/** Light glass like the top bar's pills (config.xml dock_glass): a white tint that fades downwards. */private final boolean lightGlass;+ /** Padding all round the tiles equal to the gap between them (config.xml dock_even_padding). */+ private final boolean evenPadding;/** The band's top and bottom the glass gradient was made for; it is remade when they move. */private float shaderTop = Float.NaN, shaderBottom = Float.NaN;@@ -32,18 +34,35 @@ public class DockDecoration extends RecyclerView.ItemDecoration {* @param names the dock tiles show their names, so the band reaches down over them.* @param opacity the plain band's opacity in percent (dock_opacity), so a wallpaper can show through it.* @param lightGlass a light frosted band like the pills, for a sky or wallpaper behind it.+ * @param evenPadding the band's padding is the gap between the tiles on all four sides (dock_even_padding).*/- DockDecoration(int dockSize, float density, boolean translucent, boolean names, int opacity, boolean lightGlass) {+ DockDecoration(int dockSize, float density, boolean translucent, boolean names, int opacity, boolean lightGlass,+ boolean evenPadding) {this.dockSize = dockSize;this.density = density;this.namesRoom = names ? 22 * density : 0;this.lightGlass = lightGlass;+ this.evenPadding = evenPadding;band.setColor(translucent ? 0x8C121014 : (Math.round(opacity * 2.55f) << 24) | 0x141416);edge.setStyle(Paint.Style.STROKE);edge.setStrokeWidth(density);edge.setColor(lightGlass ? 0x38FFFFFF : translucent ? 0x26FFFFFF : 0x1FFFFFFF);}+ /** Concentric corners: the band's radius is the tiles' radius plus the band's padding around them. */+ static float radiusPx(float tileRadiusPx, float paddingPx) {+ return tileRadiusPx + paddingPx;+ }++ /**+ * The band's padding on every side for dock_even_padding: the gap between two dock tiles (a cell minus its tile, as+ * AppAdapter.tileWidthPx lays them out), capped by the room the grid leaves at its edges.+ */+ static float evenPaddingPx(int innerWidthPx, int columns, int tileWidthPx, float roomPx) {+ float gap = columns > 0 ? innerWidthPx / (float) columns - tileWidthPx : 0f;+ return Math.max(0f, Math.min(gap, roomPx));+ }+@Overridepublic void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent,@NonNull RecyclerView.State state) {@@ -57,6 +76,7 @@ public class DockDecoration extends RecyclerView.ItemDecoration {@Overridepublic void onDraw(@NonNull Canvas c, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {boolean any = false;+ int cardWidth = 0;for (int i = 0; i < parent.getChildCount(); i++) {View child = parent.getChildAt(i);int pos = parent.getChildAdapterPosition(child);@@ -68,6 +88,7 @@ public class DockDecoration extends RecyclerView.ItemDecoration {float t = child.getTop() + card.getTop() + child.getTranslationY();float r = l + card.getWidth();float b = t + card.getHeight();+ cardWidth = card.getWidth();if (!any) {rect.set(l, t, r, b);any = true;@@ -84,9 +105,20 @@ public class DockDecoration extends RecyclerView.ItemDecoration {// outwards and still keeps about the band's top margin from its rounded end.float sidePad = 22 * density;float side = Math.max(0f, Math.min(sidePad, Math.min(rect.left, parent.getWidth() - rect.right) - density));- rect.inset(-side, -pad);+ float radius = AppAdapter.cornerRadius(cardWidth, density);+ if (evenPadding) {+ // The same padding on all four sides, so the band's corners are concentric with the tiles' everywhere.+ int inner = parent.getWidth() - parent.getPaddingLeft() - parent.getPaddingRight();+ float room = Math.min(rect.top, Math.min(rect.left, parent.getWidth() - rect.right)) - density;+ float even = evenPaddingPx(inner, dockSize, cardWidth, room);+ rect.inset(-even, -even);+ radius = radiusPx(radius, even);+ } else {+ // Concentric with the tiles along the top and bottom, where the padding is 'pad'.+ rect.inset(-side, -pad);+ radius = radiusPx(radius, Math.min(pad, side));+ }rect.bottom += namesRoom;- float radius = 26 * density;if (lightGlass && (rect.top != shaderTop || rect.bottom != shaderBottom)) {// The pills' glass (pill_bg: white, 18% fading to 8%), a little fainter over this much larger area.band.setShader(new LinearGradient(0, rect.top, 0, rect.bottom, 0x24FFFFFF, 0x0DFFFFFF,diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.javaindex e6d030c6d..fe1be04c1 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java@@ -494,7 +494,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {public void onChildViewDetachedFromWindow(@NonNull View v) {}});- if (dockRow) grid.addItemDecoration(new DockDecoration(COLUMNS, density, cinematic, cfg.alwaysShowNames, cfg.dockOpacity, cfg.dockGlass));+ if (dockRow) grid.addItemDecoration(new DockDecoration(COLUMNS, density, cinematic, cfg.alwaysShowNames, cfg.dockOpacity, cfg.dockGlass, cfg.dockEvenPadding));// Reduced motion: the tiles are simply there, with no entrance (reloadApps skips it there too).if (animations && !reducedMotion) {grid.setLayoutAnimation(new LayoutAnimationController(diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xmlindex 518f0fd67..30eec110f 100644--- a/launcher/app/src/main/res/values/config.xml+++ b/launcher/app/src/main/res/values/config.xml@@ -198,6 +198,10 @@through it. false (the default) keeps the solid near-black band, or the cinematic shelf's dark glass. Canalso be set with "dock_glass": true in a theme's config.json. --><bool name="dock_glass">false</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),+ so its corners are concentric with the tiles' and the spacing reads even. false (the default) keeps the fixed+ 14dp above and below and up to 22dp at the sides. Can also be set with "dock_even_padding": true in a theme's config.json. -->+ <bool name="dock_even_padding">false</bool><!-- A reorder button (two arrows) in the top bar. Off by default: reordering is also in the Settingsbutton's long-press menu, so it needs no extra button on screen. --><bool name="reorder_button">false</bool>diff --git a/launcher/app/src/test/java/com/gathin/tvhome/DockCornersTest.java b/launcher/app/src/test/java/com/gathin/tvhome/DockCornersTest.javanew file mode 100644index 000000000..1cbdc4cfa--- /dev/null+++ b/launcher/app/src/test/java/com/gathin/tvhome/DockCornersTest.java@@ -0,0 +1,34 @@+package com.gathin.tvhome;++import static org.junit.Assert.assertEquals;+import static org.junit.Assert.assertTrue;++import org.junit.Test;++/** The dock band's corners are concentric with its tiles' corners. */+public class DockCornersTest {+ private static final float DENSITY = 2f; // 1080p TV, 320 dpi+ /** activity_main.xml: 56dp root padding and 10dp grid padding on each side of a 1920 px screen. */+ private static final int INNER = 1920 - 2 * 56 * 2 - 2 * 10 * 2;++ @Test public void bandRadiusIsTileRadiusPlusPadding() {+ assertEquals(77f, DockDecoration.radiusPx(25f, 52f), 0f);+ }++ @Test public void evenPaddingIsTheGapBetweenTilesUnlessTheEdgeIsTighter() {+ assertEquals(50f, DockDecoration.evenPaddingPx(1000, 4, 200, 80f), 0.001f);+ assertEquals(30f, DockDecoration.evenPaddingPx(1000, 4, 200, 30f), 0.001f);+ assertEquals(0f, DockDecoration.evenPaddingPx(1000, 0, 200, 30f), 0.001f);+ }++ @Test public void evenPaddingStaysPositiveAndBelowTheCellFromFourToSevenColumns() {+ for (int columns = 4; columns <= 7; columns++) {+ int tile = AppAdapter.tileWidthPx(INNER, columns, DENSITY);+ float gap = INNER / (float) columns - tile;+ float pad = DockDecoration.evenPaddingPx(INNER, columns, tile, Float.MAX_VALUE);+ assertEquals("columns " + columns, gap, pad, 0.001f);+ float radius = DockDecoration.radiusPx(AppAdapter.cornerRadius(tile, DENSITY), pad);+ assertEquals("columns " + columns, pad, radius - AppAdapter.cornerRadius(tile, DENSITY), 0.001f);+ }+ }+}\ No newline at end of filediff --git a/themes/README.md b/themes/README.mdindex 29701c8a0..ad73b49ef 100644--- a/themes/README.md+++ b/themes/README.md@@ -100,6 +100,7 @@ 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 |+| `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 || `app_glow` | bool | The focus highlight glows in the focused app's colour on every tile, as `cinematic_home` does for the dock (`false` by default) |