Skip to content

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

Complete Hebrew RTL navigation and input selector

lionlev21c6f404fa5f96
diff --git a/README.md b/README.md
index a607f7e38..4f220fcb4 100644
--- a/README.md
+++ b/README.md
@@ -212,7 +212,7 @@ the install script finds `~/Android/Sdk` and the `java` on your PATH.
- **Configure** in [`config.xml`](launcher/app/src/main/res/values/config.xml): dock order, hidden apps, the Live TV package, columns (tiles shrink from 5 up), rows under the dock, an optional VPN app for the network pill, and `reduced_motion` for TVs whose GPU cannot keep up.
- **Themes** set the same keys plus a background colour and a wallpaper from a `config.json` pushed to the TV, no rebuild. Three ship in [`themes/`](themes/), documented there.
- **Language** follows the TV: English, German, Spanish, Catalan, French, Russian, Serbian (Latin), Polish, Arabic, Hebrew, Simplified Chinese, Thai, Turkish. Android 13+ can set it for the launcher alone: `tools/tv.py 'cmd locale set-app-locales com.gathin.tvhome --locales he'`.
- Hebrew places the menu buttons on the left and the date and clock on the right, with the greeting above the clock. The Clock screensaver right-aligns its date and time, and Hebrew dates include the month prefix ב (for example, 19 באוקטובר). Other languages keep their original layouts.
+ Hebrew places the menu buttons on the left and the date and clock on the right, with the greeting above the clock. The Clock screensaver right-aligns its date and time, and Hebrew dates include the month prefix ב (for example, 19 באוקטובר). Hebrew dock and app-grid rows start on the right, with matching left/right remote navigation. The Hebrew input selector places icons and labels on the right, status on the left, and aligns the dropdown with the Inputs button’s right edge. Other languages keep their original layouts.
Russian includes the module-card approval and management screens and the VPN-off badge.
- **Module cards** let any TV app declare its own tile (label, caption, glow). The launcher asks you once per app, Keep hidden by default, and remembers the answer for that app's signing key and card name. Hold OK on Settings to change your mind. How to make one: [`docs/modules.md`](docs/modules.md); the contract: [`docs/specs/card.md`](docs/specs/card.md).
- **Clock screensaver**: a drifting clock over the glow, so nothing burns in. Pick "Clock" in the TV's screensaver settings, or over ADB:
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/GridNavigation.java b/launcher/app/src/main/java/com/gathin/tvhome/GridNavigation.java
new file mode 100644
index 000000000..caab314d0
--- /dev/null
+++ b/launcher/app/src/main/java/com/gathin/tvhome/GridNavigation.java
@@ -0,0 +1,12 @@
+package com.gathin.tvhome;
+
+/** Physical left/right boundaries for a grid whose first column follows its reading direction. */
+final class GridNavigation {
+ private GridNavigation() { }
+
+ static boolean atHorizontalEdge(int position, int count, int columns, boolean rtl, boolean left) {
+ boolean towardStart = left != rtl;
+ if (towardStart) return position % columns == 0;
+ return position % columns == columns - 1 || position == count - 1;
+ }
+}
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 499018535..c7d1db5be 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -75,6 +75,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
/** Tiles per row and dock slots (res/values/config.xml, columns). Set in onCreate. */
static int COLUMNS = 4;
+ private boolean rtlAppGrid;
private static final long MINUTE_MS = 60_000L;
private String liveTvPkg;
private String liveTvAction;
@@ -215,7 +216,14 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
hiddenApps = new HashSet<>(cfg.hiddenApps);
grid = findViewById(R.id.grid);
- grid.setLayoutManager(new GridLayoutManager(this, COLUMNS));
+ rtlAppGrid = getResources().getBoolean(R.bool.rtl_app_grid);
+ // Mirror only the app grid; the header and other locales keep their own layouts.
+ grid.setLayoutManager(new GridLayoutManager(this, COLUMNS) {
+ @Override
+ protected boolean isLayoutRTL() {
+ return rtlAppGrid;
+ }
+ });
grid.setHasFixedSize(true);
grid.setItemAnimator(null);
grid.addItemDecoration(new DockDecoration(COLUMNS, density));
@@ -294,6 +302,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
// Keep focus on the top bar at its ends and at the top: Android's focus finder would otherwise
// jump to a tile far below when there is nothing in that direction.
+ boolean rtlMenuBar = getResources().getBoolean(R.bool.rtl_menu_bar);
View.OnKeyListener pillKeys = (v, keyCode, event) -> {
if (event.getAction() != KeyEvent.ACTION_DOWN) return false;
if (keyCode == KeyEvent.KEYCODE_DPAD_UP) return true;
@@ -302,12 +311,11 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
focusTile(lastFocused % COLUMNS);
return true;
}
- if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
- // The left end is Inputs, or Wi-Fi on a box without inputs.
- return v.getId() == R.id.btnInputs
- || (v.getId() == R.id.btnWifi && btnInputs.getVisibility() != View.VISIBLE);
- }
- return keyCode == KeyEvent.KEYCODE_DPAD_RIGHT && v.getId() == R.id.btnSettings;
+ int firstButton = btnInputs.getVisibility() == View.VISIBLE ? R.id.btnInputs : R.id.btnWifi;
+ int leftButton = rtlMenuBar ? R.id.btnSettings : firstButton;
+ int rightButton = rtlMenuBar ? firstButton : R.id.btnSettings;
+ if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) return v.getId() == leftButton;
+ return keyCode == KeyEvent.KEYCODE_DPAD_RIGHT && v.getId() == rightButton;
};
btnInputs.setOnKeyListener(pillKeys);
btnWifi.setOnKeyListener(pillKeys);
@@ -642,11 +650,9 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
int target;
// Horizontal: swallow the key at a row's ends so focus never wraps to the next row or
// escapes up into the top bar. Mid-row moves fall through to the default focus search.
- if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
- return position % COLUMNS == 0;
- }
- if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
- return position % COLUMNS == COLUMNS - 1 || position == count - 1;
+ if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
+ return GridNavigation.atHorizontalEdge(position, count, COLUMNS,
+ rtlAppGrid, keyCode == KeyEvent.KEYCODE_DPAD_LEFT);
}
if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
if (position < COLUMNS) return false; // dock row: let focus move to the top bar
@@ -927,7 +933,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
panel.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
popup.setWidth(Math.max(width, panel.getMeasuredWidth()));
- dropIn(popup, panel, anchor, Gravity.START);
+ int alignment = getResources().getBoolean(R.bool.rtl_menu_bar) ? Gravity.END : Gravity.START;
+ dropIn(popup, panel, anchor, alignment);
rows.getChildAt(0).requestFocus();
}
diff --git a/launcher/app/src/main/res/layout-iw/activity_main.xml b/launcher/app/src/main/res/layout-iw/activity_main.xml
index 328c1caa6..9fa2bd95c 100644
--- a/launcher/app/src/main/res/layout-iw/activity_main.xml
+++ b/launcher/app/src/main/res/layout-iw/activity_main.xml
@@ -18,7 +18,9 @@
android:id="@+id/heroName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="68dp"
+ android:layout_marginEnd="68dp"
+ android:layout_gravity="right"
+ android:gravity="right"
android:alpha="0"
android:textColor="#FFFFFFFF"
android:textSize="48sp"
@@ -164,10 +166,10 @@
android:orientation="horizontal">
<TextView
- android:id="@+id/btnInputs"
+ android:id="@+id/btnSettings"
style="@style/TopButton"
- android:text="@string/inputs"
- android:drawableStart="@drawable/ic_input"
+ android:text="@string/settings"
+ android:drawableStart="@drawable/ic_settings"
android:nextFocusDown="@+id/grid" />
<TextView
@@ -181,10 +183,10 @@
android:nextFocusDown="@+id/grid" />
<TextView
- android:id="@+id/btnSettings"
+ android:id="@+id/btnInputs"
style="@style/TopButton"
- android:text="@string/settings"
- android:drawableStart="@drawable/ic_settings"
+ android:text="@string/inputs"
+ android:drawableStart="@drawable/ic_input"
android:nextFocusDown="@+id/grid" />
</LinearLayout>
</RelativeLayout>
diff --git a/launcher/app/src/main/res/layout-iw/item_input.xml b/launcher/app/src/main/res/layout-iw/item_input.xml
new file mode 100644
index 000000000..9bff69760
--- /dev/null
+++ b/launcher/app/src/main/res/layout-iw/item_input.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Hebrew input rows: status on the left, right-aligned name and icon on the right. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="42dp"
+ android:orientation="horizontal"
+ android:layoutDirection="ltr"
+ android:gravity="center_vertical"
+ android:paddingStart="12dp"
+ android:paddingEnd="12dp"
+ android:background="@drawable/input_row_bg"
+ android:focusable="true"
+ android:clickable="true">
+
+ <TextView
+ android:id="@+id/status"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@drawable/pill_text_dim"
+ android:duplicateParentState="true"
+ android:textSize="11sp"
+ android:textDirection="locale"
+ android:fontFamily="@font/outfit"
+ android:letterSpacing="0.04" />
+
+ <View
+ android:id="@+id/dot"
+ android:layout_width="7dp"
+ android:layout_height="7dp"
+ android:layout_marginStart="8dp"
+ android:background="@drawable/status_dot" />
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_marginStart="12dp"
+ android:layout_marginEnd="10dp"
+ android:textColor="@drawable/pill_text"
+ android:duplicateParentState="true"
+ android:textSize="15sp"
+ android:fontFamily="@font/outfit"
+ android:fontVariationSettings="'wght' 500"
+ android:gravity="right"
+ android:textDirection="locale"
+ android:singleLine="true" />
+
+ <ImageView
+ android:id="@+id/icon"
+ android:layout_width="20dp"
+ android:layout_height="20dp"
+ android:tint="@drawable/pill_text"
+ android:duplicateParentState="true"
+ android:contentDescription="@null" />
+</LinearLayout>
diff --git a/launcher/app/src/main/res/values-iw/bools.xml b/launcher/app/src/main/res/values-iw/bools.xml
new file mode 100644
index 000000000..dbecde185
--- /dev/null
+++ b/launcher/app/src/main/res/values-iw/bools.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <bool name="rtl_app_grid">true</bool>
+ <bool name="rtl_menu_bar">true</bool>
+</resources>
diff --git a/launcher/app/src/main/res/values/bools.xml b/launcher/app/src/main/res/values/bools.xml
new file mode 100644
index 000000000..a0fce471c
--- /dev/null
+++ b/launcher/app/src/main/res/values/bools.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <bool name="rtl_app_grid">false</bool>
+ <bool name="rtl_menu_bar">false</bool>
+</resources>
diff --git a/launcher/app/src/test/java/com/gathin/tvhome/GridNavigationTest.java b/launcher/app/src/test/java/com/gathin/tvhome/GridNavigationTest.java
new file mode 100644
index 000000000..d395c3df3
--- /dev/null
+++ b/launcher/app/src/test/java/com/gathin/tvhome/GridNavigationTest.java
@@ -0,0 +1,36 @@
+package com.gathin.tvhome;
+
+import org.junit.Test;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class GridNavigationTest {
+ @Test public void hebrewDockStartsOnTheRightAndStopsAtTheLeft() {
+ assertTrue(GridNavigation.atHorizontalEdge(0, 11, 4, true, false));
+ assertFalse(GridNavigation.atHorizontalEdge(0, 11, 4, true, true));
+ assertTrue(GridNavigation.atHorizontalEdge(3, 11, 4, true, true));
+ assertFalse(GridNavigation.atHorizontalEdge(3, 11, 4, true, false));
+ }
+
+ @Test public void incompleteHebrewLastRowDoesNotWrapIntoEmptySpace() {
+ assertTrue(GridNavigation.atHorizontalEdge(8, 11, 4, true, false));
+ assertTrue(GridNavigation.atHorizontalEdge(10, 11, 4, true, true));
+ assertFalse(GridNavigation.atHorizontalEdge(9, 11, 4, true, true));
+ assertFalse(GridNavigation.atHorizontalEdge(9, 11, 4, true, false));
+ }
+
+ @Test public void originalLeftToRightBoundariesArePreserved() {
+ assertTrue(GridNavigation.atHorizontalEdge(0, 11, 4, false, true));
+ assertTrue(GridNavigation.atHorizontalEdge(3, 11, 4, false, false));
+ assertTrue(GridNavigation.atHorizontalEdge(10, 11, 4, false, false));
+ assertFalse(GridNavigation.atHorizontalEdge(1, 11, 4, false, true));
+ assertFalse(GridNavigation.atHorizontalEdge(1, 11, 4, false, false));
+ }
+
+ @Test public void singleColumnHasBothHorizontalEdges() {
+ assertTrue(GridNavigation.atHorizontalEdge(1, 3, 1, true, true));
+ assertTrue(GridNavigation.atHorizontalEdge(1, 3, 1, true, false));
+ assertTrue(GridNavigation.atHorizontalEdge(1, 3, 1, false, true));
+ assertTrue(GridNavigation.atHorizontalEdge(1, 3, 1, false, false));
+ }
+}