Skip to content

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

Launcher: top_menu folds Inputs, Wi-Fi and Settings into one gear

Suuuiii3613acafcd29
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/Config.java b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
index 9fa072656..93d33b43f 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@ -80,6 +80,8 @@ final class Config {
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;
+ /** Inputs, Wi-Fi and Settings folded into one gear button with a dropdown, like Google TV (config.xml top_menu). */
+ final boolean topMenu;
/** Names under every tile, dimmed until focused (config.xml always_show_names); the dock band grows for them. */
final boolean alwaysShowNames;
/** Reorder button in the top bar (config.xml reorder_button); the Settings long-press menu offers it either way. */
@@ -166,7 +168,7 @@ 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 wallpaperRotationMinutes, int wallpaperDim, int dockOpacity, String wallpaperOrder, boolean overlayApplied,
@@ -205,6 +207,7 @@ final class Config {
this.bootToLiveTv = bootToLiveTv;
this.dockTitle = dockTitle;
this.dockRow = dockRow;
+ this.topMenu = topMenu;
this.reorderButton = reorderButton;
this.showNetworkPill = showNetworkPill;
this.showInputsPill = showInputsPill;
@@ -279,6 +282,7 @@ final class Config {
boolean bootToLiveTv = res.getBoolean(R.bool.boot_to_live_tv);
boolean dockTitle = res.getBoolean(R.bool.dock_title);
boolean dockRow = res.getBoolean(R.bool.dock_row);
+ boolean topMenu = res.getBoolean(R.bool.top_menu);
boolean reorderButton = res.getBoolean(R.bool.reorder_button);
boolean showNetworkPill = res.getBoolean(R.bool.show_network_pill);
boolean showInputsPill = res.getBoolean(R.bool.show_inputs_pill);
@@ -342,6 +346,7 @@ final class Config {
bootToLiveTv = bool(json, "boot_to_live_tv", bootToLiveTv);
dockTitle = bool(json, "dock_title", dockTitle);
dockRow = bool(json, "dock_row", dockRow);
+ topMenu = bool(json, "top_menu", topMenu);
reorderButton = bool(json, "reorder_button", reorderButton);
showNetworkPill = bool(json, "show_network_pill", showNetworkPill);
showInputsPill = bool(json, "show_inputs_pill", showInputsPill);
@@ -427,7 +432,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, 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,
wallpapers, rotationMinutes, wallpaperDim, dockOpacity, wallpaperOrder, applied,
festival, inputKeycodes, appKeys, stockHomeRedirect, json == null ? Collections.emptyList() : raceCalendar(json), cinematic, ambientGlow, appGlow,
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
index d5a729c21..74d8462f7 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -64,6 +64,7 @@ import android.view.animation.LayoutAnimationController;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import android.widget.Toast;
@@ -572,6 +573,22 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
btnLibraryTop.setVisibility(cfg.libraryButton && cfg.appLibrary ? View.VISIBLE : View.GONE);
iconOnlyButtons = cfg.iconOnlyButtons;
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);
@@ -2488,7 +2505,9 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
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;
+ 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);
@@ -2643,7 +2662,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
panel.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
popup.setWidth(Math.max(width, Math.min(panel.getMeasuredWidth(), (int) (360 * density))));
- int alignment = getResources().getBoolean(R.bool.rtl_menu_bar) ? Gravity.END : Gravity.START;
+ int alignment = getResources().getBoolean(R.bool.rtl_menu_bar) != underGear ? Gravity.END : Gravity.START;
dropIn(popup, panel, anchor, alignment);
rows.getChildAt(0).requestFocus();
}
@@ -2708,6 +2727,29 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
// ---- launcher settings and module cards -------------------------------------------------------
+ /** top_menu: the gear's dropdown, standing in for the Inputs, Wi-Fi and Settings pills. */
+ private void showTopMenu() {
+ View anchor = findViewById(R.id.btnSettings);
+ View panel = getLayoutInflater().inflate(R.layout.popup_inputs, root, false);
+ LinearLayout rows = panel.findViewById(R.id.rows);
+ PopupWindow popup = glassPopup(panel, (int) (220 * density));
+ // Inputs opens its own list once this one has closed.
+ addInputRow(rows, popup, R.drawable.ic_input, getString(R.string.inputs), -1, () -> root.post(this::showInputs));
+ addInputRow(rows, popup, R.drawable.ic_wifi, getString(R.string.quick_network), -1, this::openNetworkPill);
+ CharSequence network = wifiIconOnly ? btnWifi.getContentDescription() : btnWifi.getText();
+ if (!TextUtils.isEmpty(network)) {
+ TextView status = rows.getChildAt(rows.getChildCount() - 1).findViewById(R.id.status);
+ status.setText(network);
+ status.setVisibility(View.VISIBLE);
+ }
+ addInputRow(rows, popup, R.drawable.ic_settings, getString(R.string.settings), -1,
+ () -> open(systemIntent(Settings.ACTION_SETTINGS)));
+ panel.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
+ popup.setWidth(Math.max((int) (220 * density), Math.min(panel.getMeasuredWidth(), (int) (360 * density))));
+ dropIn(popup, panel, anchor, getResources().getBoolean(R.bool.rtl_menu_bar) ? Gravity.START : Gravity.END);
+ rows.getChildAt(0).requestFocus();
+ }
+
/** Keep a normal Settings click for the TV; the launcher's choices live behind hold OK. */
private void showSettingsMenu() {
View anchor = findViewById(R.id.btnSettings);
diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xml
index b98866f6f..1a39661aa 100644
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@ -177,6 +177,9 @@
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>
+ <!-- Inputs, Wi-Fi and Settings folded into one round gear at the top right, like Google TV: OK drops a menu
+ with the three, hold OK keeps the launcher menu. Off by default; a theme can set "top_menu": true. -->
+ <bool name="top_menu">false</bool>
<!-- The dock band as light frosted glass, like the Inputs, Wi-Fi and Settings pills, so a sky or wallpaper shows
through it. false (the default) keeps the solid near-black band, or the cinematic shelf's dark glass. Can
also be set with "dock_glass": true in a theme's config.json. -->
diff --git a/themes/README.md b/themes/README.md
index 9c1c549bf..baf36b918 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -52,6 +52,7 @@ is ignored, and a file that doesn't parse is ignored as a whole, so a theme can
| `show_network_pill` | bool | The Wi-Fi/Ethernet pill in the top bar (`true` by default); `false` hides it |
| `show_inputs_pill` | bool | The Inputs pill in the top bar, shown when the TV has inputs (`true` by default); `false` hides it; what the remote's Input button does is unchanged |
| `icon_only_buttons` | bool | Wi-Fi and Settings as round icon buttons; Inputs keeps its label (`false` by default) |
+| `top_menu` | bool | Inputs, Wi-Fi and Settings folded into one round gear, centred on the header: OK drops a menu with the three, hold OK keeps the launcher menu (`false` by default) |
| `wifi_label_width` | 0 to 300 | With `icon_only_buttons`, keep the network name on the Wi-Fi pill up to this width in dp, cut with an ellipsis; 0 leaves only the icon |
| `library_button` | bool | The app library as a round button in the top bar, beside Settings; needs `app_library`. Closing the library returns to it |
| `always_show_names` | bool | Names under every tile, dimmed until focused, the dock included (its band grows to hold them); `false` by default shows only the focused tile's name |