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: icon_only_vpn, the VPN pill as a round lock button
Matt McNamee405d2458627d
diff --git a/docs/switches.md b/docs/switches.mdindex b826bfea7..3514d6606 100644--- a/docs/switches.md+++ b/docs/switches.md@@ -55,6 +55,7 @@ fits the rules; keys from before the rule sit on its wanted list until a screens| `power_on_home` | <img src="switches/power_on_home.jpg" width="320" alt="power_on_home on a TV"> || `home_long_press_home` | <img src="switches/home_long_press_home.jpg" width="320" alt="home_long_press_home on a TV"> || `vpn_pill` | <img src="switches/vpn_pill.jpg" width="320" alt="vpn_pill on a TV"> <img src="switches/vpn_pill_rest.jpg" width="320" alt="vpn_pill at rest: the pill outlined in red, focus on a tile"> |+| `icon_only_vpn` | <img src="switches/icon_only_vpn.jpg" width="320" alt="icon_only_vpn with no VPN up: an open lock on the plain round button, between Wi-Fi and Settings"> <img src="switches/icon_only_vpn_on.jpg" width="320" alt="icon_only_vpn with a VPN up: the closed lock in a green outline"> || `power_on_home_always` | <img src="switches/power_on_home_always.jpg" width="320" alt="power_on_home_always on a TV"> || `inputs_connected_only` | <img src="switches/inputs_connected_only.jpg" width="320" alt="inputs_connected_only on a TV"> || `icon_tiles` | <img src="switches/icon_tiles.jpg" width="320" alt="icon_tiles: an app drawn from its icon in the grid on a TV"> |diff --git a/docs/switches/icon_only_vpn.jpg b/docs/switches/icon_only_vpn.jpgnew file mode 100644index 000000000..6a9a04e02Binary files /dev/null and b/docs/switches/icon_only_vpn.jpg differdiff --git a/docs/switches/icon_only_vpn_on.jpg b/docs/switches/icon_only_vpn_on.jpgnew file mode 100644index 000000000..11c8c6034Binary files /dev/null and b/docs/switches/icon_only_vpn_on.jpg differdiff --git a/launcher/app/src/main/java/com/gathin/tvhome/Config.java b/launcher/app/src/main/java/com/gathin/tvhome/Config.javaindex 7689b8f3c..8f923fceb 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java@@ -129,6 +129,8 @@ final class Config {final boolean iconOnlyButtons;/** The Inputs pill as a round icon button too (config.xml icon_only_inputs). */final boolean iconOnlyInputs;+ /** With vpn_pill, the VPN pill as a round lock button (config.xml / theme icon_only_vpn). */+ final boolean iconOnlyVpn;/** App library as a round button in the top bar (config.xml library_button); needs app_library. */final boolean libraryButton;/** The App library pill after the last Home row; false hides it while libraryButton is on (show_library_pill). */@@ -279,7 +281,7 @@ final class Config {boolean keyFilter, boolean dockGlass, String glowStyle, boolean wallpaperCaptions,boolean handleViewInputs, boolean tileMenu, boolean dockEvenPadding, boolean dockBand, boolean cinematicDots, boolean cinematicWhiteFocus, boolean wifiStatusColor, int cinematicScrim, int cinematicArt,Map<String, Set<String>> wallpaperMoods, boolean gamepadPassthrough, boolean consumeVolumeKeys, boolean powerOnHome, boolean homeLongPressHome, boolean wifiStatusWarnings, List<String> topBarApps, boolean showGreeting, boolean headerWhite, boolean clockWallpaper, int clockWallpaperDim, boolean clockGlow, String glassStyle, boolean singleRow, boolean dockBandAll, boolean lunarDate, int lunarUtcOffset, boolean dateBelowClock, boolean vpnPill, String locale, boolean powerOnHomeAlways, boolean inputsConnectedOnly,- int openOnStartNetworkWait) {+ int openOnStartNetworkWait, boolean iconOnlyVpn) {this.handleViewInputs = handleViewInputs;this.tileMenu = tileMenu;this.inputKeycodes = inputKeycodes;@@ -328,6 +330,7 @@ final class Config {this.showInputsPill = showInputsPill;this.iconOnlyButtons = iconOnlyButtons;this.iconOnlyInputs = iconOnlyInputs;+ this.iconOnlyVpn = iconOnlyVpn;this.libraryButton = libraryButton;this.showLibraryPill = showLibraryPill;this.wifiLabelWidth = wifiLabelWidth;@@ -452,6 +455,7 @@ final class Config {boolean showInputsPill = res.getBoolean(R.bool.show_inputs_pill);boolean iconOnlyButtons = res.getBoolean(R.bool.icon_only_buttons);boolean iconOnlyInputs = res.getBoolean(R.bool.icon_only_inputs);+ boolean iconOnlyVpn = res.getBoolean(R.bool.icon_only_vpn);boolean libraryButton = res.getBoolean(R.bool.library_button);boolean showLibraryPill = res.getBoolean(R.bool.show_library_pill);int wifiLabelWidth = res.getInteger(R.integer.wifi_label_width);@@ -560,6 +564,7 @@ final class Config {showInputsPill = bool(json, "show_inputs_pill", showInputsPill);iconOnlyButtons = bool(json, "icon_only_buttons", iconOnlyButtons);iconOnlyInputs = bool(json, "icon_only_inputs", iconOnlyInputs);+ iconOnlyVpn = bool(json, "icon_only_vpn", iconOnlyVpn);libraryButton = bool(json, "library_button", libraryButton);showLibraryPill = bool(json, "show_library_pill", showLibraryPill);wifiLabelWidth = integer(json, "wifi_label_width", wifiLabelWidth, 0, 300);@@ -682,7 +687,7 @@ final class Config {consumeVolumeKeys, powerOnHome, homeLongPressHome, wifiStatusWarnings, topBarApps, showGreeting, headerWhite, clockWallpaper,Math.max(0, Math.min(90, clockWallpaperDim)), clockGlow, glassStyle, singleRow && dockRow, dockBandAll, lunar, lunarOffset,dateBelowClock, vpnPill, locale, powerOnHomeAlways, inputsConnectedOnly,- Math.max(0, Math.min(600, openOnStartNetworkWait)));+ Math.max(0, Math.min(600, openOnStartNetworkWait)), iconOnlyVpn);}/**diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.javaindex f453692e7..1bb91dade 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java@@ -215,6 +215,10 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {private TextView btnVpn;/** The VpnBadge pill state btnVpn shows, so a refresh that changes nothing does not restyle it. */private int vpnPillState = VpnBadge.PILL_HIDDEN;+ /** icon_only_vpn: the VPN pill is a round lock button; off, it keeps the plain glass look saved here. */+ private boolean iconOnlyVpn;+ private Drawable.ConstantState vpnPlainBackground;+ private ColorStateList vpnPlainInk;private SpringAnimation springX, springY;private float glassTargetX, glassTargetY;// How far the grid has scrolled the glass. springY works without it, in grid content space, so a@@ -828,6 +832,12 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {makeIconOnly((TextView) btnSettings);}if (cfg.iconOnlyInputs) makeIconOnly((TextView) btnInputs);+ iconOnlyVpn = vpnPill && cfg.iconOnlyVpn;+ if (iconOnlyVpn) {+ vpnPlainBackground = btnVpn.getBackground().getConstantState();+ vpnPlainInk = btnVpn.getCompoundDrawableTintList();+ makeIconOnly(btnVpn);+ }btnSettings.setOnLongClickListener(v -> {showSettingsMenu();return true;@@ -2989,6 +2999,16 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {ColorStateList ink = new ColorStateList(new int[][]{new int[]{android.R.attr.state_focused}, new int[0]},new int[]{VpnBadge.pillInkColor(up, true), VpnBadge.pillInkColor(up, false)});+ if (iconOnlyVpn) {+ // An open lock on the plain glass button, or the closed lock outlined in green like the pill (solid+ // while focused); the words go to talkback.+ btnVpn.setContentDescription(getString(up ? R.string.vpn : R.string.vpn_off));+ btnVpn.setBackground(up ? VpnBadge.pillBackground(true, density) : vpnPlainBackground.newDrawable());+ btnVpn.setCompoundDrawablesRelativeWithIntrinsicBounds(VpnBadge.iconOnlyLock(up), 0, 0, 0);+ btnVpn.setCompoundDrawableTintList(up ? ink : vpnPlainInk);+ btnVpn.setVisibility(View.VISIBLE);+ return;+ }btnVpn.setText(up ? R.string.vpn : R.string.vpn_off);btnVpn.setTextColor(ink);btnVpn.setBackground(VpnBadge.pillBackground(up, density));diff --git a/launcher/app/src/main/java/com/gathin/tvhome/VpnBadge.java b/launcher/app/src/main/java/com/gathin/tvhome/VpnBadge.javaindex cb6b47d39..c90a8f0ac 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/VpnBadge.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/VpnBadge.java@@ -47,6 +47,11 @@ final class VpnBadge extends ReplacementSpan {return vpnUp ? PILL_UP : vpnAppInstalled ? PILL_OFF : PILL_HIDDEN;}+ /** icon_only_vpn: the closed lock while a VPN is up, the open lock while none is. */+ static int iconOnlyLock(boolean up) {+ return up ? R.drawable.ic_lock : R.drawable.ic_lock_open;+ }+/*** vpn_pill: the pill's background. At rest it is an outline in the state colour and only the focused state is* filled solid with a white ring — a solid pill at rest read as already selected, so OK pressed on a tile wasdiff --git a/launcher/app/src/main/res/drawable/ic_lock_open.xml b/launcher/app/src/main/res/drawable/ic_lock_open.xmlnew file mode 100644index 000000000..914e30fcc--- /dev/null+++ b/launcher/app/src/main/res/drawable/ic_lock_open.xml@@ -0,0 +1,8 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Material "lock_open", the open counterpart of ic_lock, for icon_only_vpn while no VPN is up. -->+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="24dp" android:height="24dp"+ android:viewportWidth="24" android:viewportHeight="24">+ <path android:fillColor="#FFFFFFFF"+ android:pathData="M18,8h-1V6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6h1.9c0,-1.71 1.39,-3.1 3.1,-3.1s3.1,1.39 3.1,3.1v2H6c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V10C20,8.9 19.1,8 18,8zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2z" />+</vector>diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xmlindex 229221d84..e626a4207 100644--- a/launcher/app/src/main/res/values/config.xml+++ b/launcher/app/src/main/res/values/config.xml@@ -306,6 +306,10 @@<bool name="icon_only_buttons">false</bool><!-- The Inputs pill as a round icon button too (the label moves to the talkback description). --><bool name="icon_only_inputs">false</bool>+ <!-- With vpn_pill, the VPN pill as a round icon button too: an open lock on the plain glass button while no VPN is+ up, the closed lock in a green outline while one is (solid green only while focused, like the pill). "VPN" /+ "VPN off" become its talkback description. A theme can set "icon_only_vpn": true. -->+ <bool name="icon_only_vpn">false</bool><!-- true colours the Wi-Fi pill's icon green while the TV is online and leaves it white while it is not (dark onthe focused pill either way), so the connection shows at a glance, also as an icon-only button. Can also beset with "wifi_status_color": true in a theme's config.json. -->diff --git a/launcher/app/src/test/java/com/gathin/tvhome/VpnPillTest.java b/launcher/app/src/test/java/com/gathin/tvhome/VpnPillTest.javaindex 8bce93153..f657aad82 100644--- a/launcher/app/src/test/java/com/gathin/tvhome/VpnPillTest.java+++ b/launcher/app/src/test/java/com/gathin/tvhome/VpnPillTest.java@@ -17,6 +17,12 @@ public class VpnPillTest {assertEquals(VpnBadge.PILL_OFF, VpnBadge.pillState(false, true));}+ @Test+ public void iconOnlyShowsTheClosedLockOnlyWhileUp() {+ assertEquals(R.drawable.ic_lock, VpnBadge.iconOnlyLock(true));+ assertEquals(R.drawable.ic_lock_open, VpnBadge.iconOnlyLock(false));+ }+@Testpublic void hiddenWithNoVpnAndNoInstalledVpnApp() {assertEquals(VpnBadge.PILL_HIDDEN, VpnBadge.pillState(false, false));diff --git a/themes/README.md b/themes/README.mdindex 12d643424..268dab376 100644--- a/themes/README.md+++ b/themes/README.md@@ -99,6 +99,7 @@ A new key needs one there in the same pull request.| `focus_overshoot` | bool | The highlight and the focused tile swing past their target before settling (`true` by default); `false` glides straight there with smooth scrolling || `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 || `vpn_pill` | bool | The VPN as its own pill after the network pill instead of a badge inside it: solid green while a VPN is up, solid red "VPN off" while none is and `vpn_app` is installed, hidden otherwise. Pressing it opens `vpn_app` (without it, the App library, or VPN settings with `app_library` off); it keeps its label with `icon_only_buttons`; the network pill then opens Wi-Fi settings. Ignored with `top_menu`. A VPN app's kill switch holds a VPN up while the app says disconnected, so the pill stays green then (`false` by default) |+| `icon_only_vpn` | bool | With `vpn_pill`, the VPN pill as a round icon button too, matching `icon_only_buttons`: an open lock on the plain glass button while no VPN is up, the closed lock in a green outline while one is, solid green only while focused, like the pill; "VPN" / "VPN off" become its TalkBack description (`false` by default) || `animations` | bool | Basic focus, glass, title and tile entrance motion; true by default || `advanced_effects` | bool | Optional lifted tile, icon zoom, smooth ambient colour and app opening effects; false by default || `show_home_settings_shortcut` | bool | Keep the optional Default-home tile visible when the TV has a home picker; false by default |