Skip to content

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

Merge PR #863: Launcher: top_menu folds Inputs, Wi-Fi and Settings into one gear

Gathin233f121885a51d
diff --cc launcher/app/src/main/java/com/gathin/tvhome/Config.java
index 08ab4ecc5,93d33b43f..f56a54dad
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@@ -169,9 -168,9 +171,9 @@@ final class Config
Map<String, String> appBanners, String sourcePanelService, String sourcePanelAction,
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 dockTitle, boolean dockRow, boolean reorderButton, boolean showNetworkPill, boolean showInputsPill, boolean iconOnlyButtons, boolean libraryButton, int wifiLabelWidth, boolean alwaysShowNames, boolean wallpaperTrueColor, boolean focusOvershoot, String vpnApp,
+ boolean shamsiDate, String greetingName, boolean moduleCards, boolean reducedMotion, boolean bootToLiveTv, boolean dockTitle, boolean dockRow, boolean topMenu, boolean reorderButton, boolean showNetworkPill, boolean showInputsPill, boolean iconOnlyButtons, boolean libraryButton, int wifiLabelWidth, boolean alwaysShowNames, boolean wallpaperTrueColor, boolean focusOvershoot, String vpnApp,
boolean showHomeSettingsShortcut, boolean showStats, boolean appLibrary, int backgroundColor, int skyIntensity,
- int[] settingsKeycodes, boolean settingsKeyPanel, boolean wallpaperEnabled, File wallpaper, List<File> wallpapers,
+ 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,
List<RaceWeekend.Race> raceCalendar, boolean cinematicHome, boolean ambientGlow, boolean appGlow, int homeIdleClockMinutes,
@@@ -434,8 -432,8 +439,8 @@@
packageMap(appBanners), panelService,
panelAction, panelExtra, coocaaSources, inputAction, inputUriScheme,
Math.max(1, columns), Math.max(0, rowsBelow), animations, advancedEffects,
- shamsi, greetingName, moduleCards, reducedMotion, bootToLiveTv, dockTitle, dockRow, reorderButton, showNetworkPill, showInputsPill, iconOnlyButtons, libraryButton, wifiLabelWidth, alwaysShowNames, wallpaperTrueColor, focusOvershoot, vpn, homeSettings, showStats, library, background,
+ shamsi, greetingName, moduleCards, reducedMotion, bootToLiveTv, dockTitle, dockRow, topMenu, reorderButton, showNetworkPill, showInputsPill, iconOnlyButtons, libraryButton, wifiLabelWidth, alwaysShowNames, wallpaperTrueColor, focusOvershoot, vpn, homeSettings, showStats, library, background,
- Math.max(0, Math.min(100, skyIntensity)), settingsKeycodes, settingsKeyPanel, wallpaperEnabled, wallpaper,
+ 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);
diff --cc launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
index 4e30eed2b,74d8462f7..183e582af
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@@ -585,7 -572,23 +586,24 @@@ public class MainActivity extends Activ
});
btnLibraryTop.setVisibility(cfg.libraryButton && cfg.appLibrary ? View.VISIBLE : View.GONE);
iconOnlyButtons = cfg.iconOnlyButtons;
++ topMenu = cfg.topMenu;
wifiIconOnly = iconOnlyButtons && cfg.wifiLabelWidth <= 0;
+ if (cfg.topMenu) {
+ // One gear: Inputs and Wi-Fi move into its dropdown. The Wi-Fi pill stays hidden but keeps its
+ // label up to date, which the menu's Wi-Fi row shows.
+ showInputsPill = false;
+ btnInputs.setVisibility(View.GONE);
+ btnWifi.setVisibility(View.GONE);
+ if (!iconOnlyButtons) makeIconOnly((TextView) btnSettings);
+ btnSettings.setOnClickListener(v -> showTopMenu());
+ // The lone gear sits at the header's middle, not on its bottom line like the row of pills.
+ LinearLayout topButtons = findViewById(R.id.topButtons);
+ RelativeLayout.LayoutParams tlp = (RelativeLayout.LayoutParams) topButtons.getLayoutParams();
+ tlp.addRule(RelativeLayout.ALIGN_TOP, R.id.leftBlock);
+ tlp.bottomMargin = 0;
+ topButtons.setLayoutParams(tlp);
+ topButtons.setGravity(Gravity.CENTER_VERTICAL);
+ }
if (iconOnlyButtons) {
if (cfg.wifiLabelWidth > 0) btnWifi.setMaxWidth(Math.round(cfg.wifiLabelWidth * density));
else makeIconOnly(btnWifi);
@@@ -2280,6 -2283,6 +2298,8 @@@
/** config.xml icon_only_buttons. */
private boolean iconOnlyButtons;
++ /** config.xml top_menu: Inputs, Wi-Fi and Settings folded into one gear. */
++ private boolean topMenu;
/** icon_only_buttons without wifi_label_width: the Wi-Fi pill shows no network name. */
private boolean wifiIconOnly;
/** The app library button in the top bar (library_button). */
@@@ -2502,7 -2505,9 +2522,11 @@@
openSourcePanel();
return;
}
- View anchor = findViewById(R.id.btnInputs);
+ // top_menu: the pill is gone, so the list hangs under the gear, growing inward from the right.
- boolean underGear = btnInputs.getVisibility() != View.VISIBLE;
++ // Read the switch, not the pill: show_inputs_pill=false hides the pill too, and there the list
++ // keeps its usual place.
++ boolean underGear = topMenu;
+ View anchor = findViewById(underGear ? R.id.btnSettings : R.id.btnInputs);
View panel = getLayoutInflater().inflate(R.layout.popup_inputs, root, false);
LinearLayout rows = panel.findViewById(R.id.rows);