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: library_ok_opens, OK opens every app in the library (#1081)
Mazin Kanuga1e46e0e3226e
diff --git a/docs/app-library.md b/docs/app-library.mdindex 99944b6a6..68c78711d 100644--- a/docs/app-library.md+++ b/docs/app-library.md@@ -13,6 +13,14 @@ than following the hidden app into the second group. Adding an app focuses itin the checked group. Hold-OK actions are omitted in this mode; it only controlsHome shortcuts and never uninstalls apps.+## Optional: OK opens every app++Set `"library_ok_opens": true` along with `"app_library": true` when the library is where you open the+apps a theme keeps off Home with `hidden_apps`. OK then opens every app, not only the ones on Home. Hold+OK for Add to Home or Remove from Home, as before. Cards that are not on Home drop their "Add to Home"+line (a new app keeps its green dot), and the hint reads "Press to open" for every app. It is off by+default, and with `app_library_selection` also on, selection mode wins.+## Standard behaviorSet `"app_library": true` in a theme’s `config.json`, or enable the `app_library`diff --git a/docs/switches.md b/docs/switches.mdindex 38819542e..ed79e3ac3 100644--- a/docs/switches.md+++ b/docs/switches.md@@ -45,3 +45,4 @@ fits the rules; keys from before the rule sit on its wanted list until a screens| `dock_band_all` | <img src="switches/single_row.jpg" width="320" alt="dock_band_all on a TV"> || `uniform_tiles` | <img src="switches/uniform_tiles.jpg" width="320" alt="uniform_tiles on a TV"> || `lunar_date` | <img src="switches/lunar_date.jpg" width="320" alt="lunar_date on a TV"> |+| `library_ok_opens` | <img src="switches/library_ok_opens.jpg" width="320" alt="library_ok_opens on a TV"> |diff --git a/docs/switches/library_ok_opens.jpg b/docs/switches/library_ok_opens.jpgnew file mode 100644index 000000000..c2e4066edBinary files /dev/null and b/docs/switches/library_ok_opens.jpg differdiff --git a/launcher/app/src/main/java/com/gathin/tvhome/AppLibraryDialog.java b/launcher/app/src/main/java/com/gathin/tvhome/AppLibraryDialog.javaindex bda17c2cb..e62db4635 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/AppLibraryDialog.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/AppLibraryDialog.java@@ -80,6 +80,8 @@ final class AppLibraryDialog {private final LinearLayout panel;private final boolean reducedMotion;private final boolean selectionMode;+ /** library_ok_opens without app_library_selection: OK opens every app, Add to Home is in the hold menu. */+ private final boolean okOpens;private final boolean animations;private final boolean rtl;private TextView instructions;@@ -141,12 +143,13 @@ final class AppLibraryDialog {if (popup.isShowing()) popup.update(width, height);}- AppLibraryDialog(Activity activity, boolean animations, boolean reducedMotion, boolean selectionMode, Predicate<String> onHome, Runnable changed, Runnable dismissed) {+ AppLibraryDialog(Activity activity, boolean animations, boolean reducedMotion, boolean selectionMode, boolean okOpens, Predicate<String> onHome, Runnable changed, Runnable dismissed) {this.activity = activity;this.animations = animations;this.rtl = activity.getResources().getBoolean(R.bool.rtl_app_grid);this.reducedMotion = reducedMotion;this.selectionMode = selectionMode;+ this.okOpens = okOpens && !selectionMode;this.onHome = onHome;this.changed = changed;this.dismissed = dismissed;@@ -337,7 +340,7 @@ final class AppLibraryDialog {private String hint(boolean home) {if (selectionMode) return activity.getString(android.R.string.ok) + ": "+ activity.getString(home ? R.string.library_remove_shortcut : R.string.library_add_home);- return activity.getString(home ? R.string.library_hint_open : R.string.library_hint_add);+ return activity.getString(home || okOpens ? R.string.library_hint_open : R.string.library_hint_add);}private void showCatalog() {@@ -637,7 +640,7 @@ final class AppLibraryDialog {boolean home = onHome.test(pkg);boolean recent = !selectionMode && LibraryApps.recent(installTimes.getOrDefault(pkg, 0L), catalogTime);status.setText(home ? R.string.library_on_home : recent ? R.string.library_recent : R.string.library_add_home);- status.setVisibility(View.VISIBLE);+ status.setVisibility(home || !okOpens ? View.VISIBLE : View.INVISIBLE);holder.itemView.setBackground(surface(home ? 0x1475BBA4 : 0x0CFFFFFF, 18));View check = holder.itemView.findViewById(R.id.dot);check.getLayoutParams().width = dp(home ? 18 : 8);@@ -646,9 +649,9 @@ final class AppLibraryDialog {else check.setBackground(surface(0xFF70D9A0, 8));check.setVisibility(home || recent ? View.VISIBLE : View.GONE);holder.itemView.setOnClickListener(v -> {- if (selectionMode) changeHome(app, !onHome.test(pkg));- else if (onHome.test(pkg)) open(app);- else changeHome(app, true);+ boolean onHomeNow = onHome.test(pkg);+ if (LibraryApps.okOpens(selectionMode, okOpens, onHomeNow)) open(app);+ else changeHome(app, !onHomeNow);});holder.itemView.setOnLongClickListener(selectionMode ? null : v -> { showActions(app, v); return true; });holder.itemView.setOnFocusChangeListener((v, focused) -> {diff --git a/launcher/app/src/main/java/com/gathin/tvhome/Config.java b/launcher/app/src/main/java/com/gathin/tvhome/Config.javaindex 92f2ff9ab..772e746e8 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java@@ -133,6 +133,8 @@ final class Config {final boolean appLibrary;/** OK directly toggles Home membership in the library (app_library_selection). */final boolean appLibrarySelection;+ /** OK opens every app in the library; Add to Home stays in the hold menu (library_ok_opens). */+ final boolean libraryOkOpens;/** Icon on a card tinted from that icon, instead of the app's banner (config.xml uniform_tiles). */final boolean uniformTiles;/** Background colour behind everything, #RRGGBB; black unless a theme says otherwise. */@@ -243,7 +245,7 @@ final class Config {String sourcePanelExtra, boolean coocaaSources, String inputAction,String inputUriScheme, int columns, int rowsBelowDock, boolean animations, boolean advancedEffects,boolean shamsiDate, String greetingName, boolean moduleCards, boolean reducedMotion, boolean bootToLiveTv, boolean openOnStartChoice, boolean dockTitle, boolean dockRow, boolean topMenu, boolean launcherSettingsButton, boolean reorderButton, boolean showNetworkPill, boolean showInputsPill, boolean iconOnlyButtons, boolean iconOnlyInputs, boolean libraryButton, int wifiLabelWidth, boolean alwaysShowNames, boolean wallpaperTrueColor, boolean focusOvershoot, String vpnApp,- boolean showHomeSettingsShortcut, boolean showStats, boolean appLibrary, boolean appLibrarySelection, boolean uniformTiles, int backgroundColor, int skyIntensity,+ boolean showHomeSettingsShortcut, boolean showStats, boolean appLibrary, boolean appLibrarySelection, boolean libraryOkOpens, boolean uniformTiles, int backgroundColor, int skyIntensity,int[] settingsKeycodes, boolean settingsKeyPanel, boolean restoreKeyServices, boolean wallpaperEnabled, File wallpaper, List<File> wallpapers,int wallpaperRotationMinutes, int wallpaperDim, int dockOpacity, String wallpaperOrder, boolean overlayApplied,Festival festival, int[] inputKeycodes, List<String> appKeys, String stockHomeRedirect,@@ -304,6 +306,7 @@ final class Config {this.showStats = showStats;this.appLibrary = appLibrary;this.appLibrarySelection = appLibrarySelection;+ this.libraryOkOpens = libraryOkOpens;this.uniformTiles = uniformTiles;this.backgroundColor = backgroundColor;this.skyIntensity = skyIntensity;@@ -418,6 +421,7 @@ final class Config {boolean showStats = res.getBoolean(R.bool.show_stats);boolean library = res.getBoolean(R.bool.app_library);boolean librarySelection = res.getBoolean(R.bool.app_library_selection);+ boolean libraryOkOpens = res.getBoolean(R.bool.library_ok_opens);boolean uniformTiles = res.getBoolean(R.bool.uniform_tiles);int background = 0xFF000000;int skyIntensity = res.getInteger(R.integer.sky_intensity);@@ -512,6 +516,7 @@ final class Config {showStats = bool(json, "show_stats", showStats);library = bool(json, "app_library", library);librarySelection = bool(json, "app_library_selection", librarySelection);+ libraryOkOpens = bool(json, "library_ok_opens", libraryOkOpens);uniformTiles = bool(json, "uniform_tiles", uniformTiles);background = color(json, "background_color", background);skyIntensity = integer(json, "sky_intensity", skyIntensity, 0, 100);@@ -601,7 +606,7 @@ final class Config {packageMap(appBanners), panelService,panelAction, panelExtra, coocaaSources, inputAction, inputUriScheme,Math.max(1, columns), Math.max(0, rowsBelow), animations, advancedEffects,- shamsi, greetingName, moduleCards, reducedMotion, bootToLiveTv, openOnStartChoice, dockTitle, dockRow, topMenu, launcherSettingsButton, reorderButton, showNetworkPill, showInputsPill, iconOnlyButtons, iconOnlyInputs, libraryButton, wifiLabelWidth, alwaysShowNames, wallpaperTrueColor, focusOvershoot, vpn, homeSettings, showStats, library, librarySelection, uniformTiles, background,+ shamsi, greetingName, moduleCards, reducedMotion, bootToLiveTv, openOnStartChoice, dockTitle, dockRow, topMenu, launcherSettingsButton, reorderButton, showNetworkPill, showInputsPill, iconOnlyButtons, iconOnlyInputs, libraryButton, wifiLabelWidth, alwaysShowNames, wallpaperTrueColor, focusOvershoot, vpn, homeSettings, showStats, library, librarySelection, libraryOkOpens, uniformTiles, background,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, fadeRows,diff --git a/launcher/app/src/main/java/com/gathin/tvhome/LibraryApps.java b/launcher/app/src/main/java/com/gathin/tvhome/LibraryApps.javaindex b55407306..bafffa19d 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/LibraryApps.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/LibraryApps.java@@ -102,6 +102,12 @@ final class LibraryApps {return !removedFromHome && (explicitlyAdded || (tvApp && !themeHidden));}+ /** OK on a library card opens the app (true) or changes its Home shortcut. app_library_selection's OK always+ * changes it; otherwise an app on Home opens, and with library_ok_opens every app does. */+ static boolean okOpens(boolean selection, boolean openAll, boolean onHome) {+ return !selection && (openAll || onHome);+ }+static boolean recent(long installedAt, long now) {return installedAt > 0 && installedAt <= now && now - installedAt <= RECENT_MS;}diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.javaindex d992768a0..d76392125 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java@@ -283,6 +283,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {private String dockEditAppKey;private AppLibraryDialog appLibrary;private boolean appLibrarySelection;+ private boolean libraryOkOpens;private boolean libraryFocusPending;private RecyclerView.OnScrollListener pendingFocusScroll;@@ -377,6 +378,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);appLibrarySelection = cfg.appLibrarySelection;+ libraryOkOpens = cfg.libraryOkOpens;// restore_key_services: after a force stop, put back the remote's accessibility helpers that Android took// off the list (needs WRITE_SECURE_SETTINGS, granted by build-and-install with RESTORE_KEY_SERVICES=1).if (cfg.restoreKeyServices) ServiceRepair.restore(this);@@ -1562,7 +1564,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {if (openPopup != null) openPopup.dismiss();libraryFocusPending = false;libraryFromTopBar = false;- appLibrary = new AppLibraryDialog(this, animations, reducedMotion, appLibrarySelection, adapter::containsPackage, () -> reloadApps(false), () -> {+ appLibrary = new AppLibraryDialog(this, animations, reducedMotion, appLibrarySelection, libraryOkOpens, adapter::containsPackage, () -> reloadApps(false), () -> {appLibrary = null;openPopup = null;if (libraryFromTopBar) {diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xmlindex 8dbd32bec..f7c2ed4b1 100644--- a/launcher/app/src/main/res/values/config.xml+++ b/launcher/app/src/main/res/values/config.xml@@ -321,6 +321,10 @@<!-- Optional direct Home picker in the app library: OK toggles the checkmark, checked apps first.Off by default; a theme can set "app_library_selection": true (also needs app_library). --><bool name="app_library_selection">false</bool>+ <!-- OK opens every app in the library, not only the apps on Home: for a library that holds the apps a theme+ keeps off Home with hidden_apps. Hold OK still offers Add to Home. app_library_selection wins when both are+ on. Off by default; a theme can set "library_ok_opens": true (also needs app_library). -->+ <bool name="library_ok_opens">false</bool><!-- Apps pre-seeded into the App library's "added" set at startup (config.xml library_apps, or a theme'sconfig.json). They show on Home as if the owner had added them in the App library UI, and staydiff --git a/launcher/app/src/test/java/com/gathin/tvhome/LibraryAppsTest.java b/launcher/app/src/test/java/com/gathin/tvhome/LibraryAppsTest.javaindex b3e91ac26..d6c70dc7a 100644--- a/launcher/app/src/test/java/com/gathin/tvhome/LibraryAppsTest.java+++ b/launcher/app/src/test/java/com/gathin/tvhome/LibraryAppsTest.java@@ -9,6 +9,15 @@ import java.util.Set;import static org.junit.Assert.*;public class LibraryAppsTest {+ @Test public void okOpensHomeAppsAndEveryAppWithTheSwitchButNeverInSelectionMode() {+ assertTrue(LibraryApps.okOpens(false, false, true));+ assertFalse(LibraryApps.okOpens(false, false, false));+ assertTrue(LibraryApps.okOpens(false, true, false));+ assertTrue(LibraryApps.okOpens(false, true, true));+ assertFalse(LibraryApps.okOpens(true, true, false));+ assertFalse(LibraryApps.okOpens(true, false, true));+ }+@Test public void hidingKeepsTheNextAppOrThePreviousAppAtTheEnd() {assertEquals(1, LibraryApps.nextAfterRemoval(0, 5));assertEquals(3, LibraryApps.nextAfterRemoval(2, 5));diff --git a/themes/README.md b/themes/README.mdindex a4c5310cd..240b096cf 100644--- a/themes/README.md+++ b/themes/README.md@@ -75,6 +75,7 @@ A new key needs one there in the same pull request.| `app_library` | bool | An App library pill after the last Home row: every installed app, add one to Home or take it off (`false` by default). The choices stay on the TV when a theme is pushed or reset; see [docs/app-library.md](../docs/app-library.md) || `uniform_tiles` | bool | Each app tile is its icon on a card tinted from that icon, with the name only under the focused tile, instead of the app's own banner (`false` by default) || `app_library_selection` | bool | OK toggles Home checkmarks in the library; checked apps first, both groups alphabetized. Hiding keeps focus on the adjacent next app (previous at the end). Requires `app_library`; `false` preserves the standard open/long-press behavior |+| `library_ok_opens` | bool | OK opens every app in the library, not only the ones on Home, for a library that holds the apps `hidden_apps` keeps off Home; holding OK still offers Add to Home, and cards drop their "Add to Home" line. Requires `app_library`; `app_library_selection` wins when both are on; `false` by default || `library_apps` | list of package names | Packages pre-seeded into the App library's "added" set at startup (config.xml `library_apps`, or a theme's `config.json`). They show on Home as if the owner had added them in the App library UI, and stay removable there (a removed one stays hidden); empty (off) by default || `shamsi_date` | bool | Show the Solar Hijri date above the Gregorian one || `lunar_date` | bool | Show the lunisolar date under the Gregorian one, e.g. `LUNAR 13/9 · YEAR OF THE HORSE`, or `13/9 ÂM LỊCH · BÍNH NGỌ` in Vietnamese; a leap month is marked. Off by default |