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: match date styling and add Shabbat greeting precedence
lionlev2115867c41c4be
diff --git a/docs/switches/hebrew_date.jpg b/docs/switches/hebrew_date.jpgindex ae3759bb3..9ce763973 100644Binary files a/docs/switches/hebrew_date.jpg and b/docs/switches/hebrew_date.jpg differdiff --git a/launcher/app/src/main/java/com/gathin/tvhome/JewishDate.java b/launcher/app/src/main/java/com/gathin/tvhome/JewishDate.javaindex 03e773037..31a6f8c26 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/JewishDate.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/JewishDate.java@@ -11,6 +11,8 @@ import java.util.Locale;/** Optional civil display, computed offline; sunset is approximate, not a source of religious times. */final class JewishDate {+ // One-based indices into jewish_greetings; zero keeps the ordinary greeting.+ static final int NEW_YEAR = 1, KIPPUR = 2, HANUKKAH = 3, PURIM = 4, HOLIDAY = 5, SHABBAT = 6;final boolean showDate, greetings;private final double latitude, longitude;private final String region;@@ -94,6 +96,20 @@ final class JewishDate {}int greeting(LocalDate day, Locale locale) {+ int today = holidayOn(day, locale);+ if (today != 0) return today;+ return preferredGreeting(0, holidayOn(day.plusDays(1), locale), day);+ }++ static int preferredGreeting(int holiday, int eve, LocalDate day) {+ if (holiday != 0) return holiday;+ if (eve != 0) return eve;+ // Epoch day 2 was Saturday; Java's signed remainder is -5 for pre-1970 Saturdays.+ long weekday = day.toEpochDay() % 7;+ return weekday == 2 || weekday == -5 ? SHABBAT : 0;+ }++ private int holidayOn(LocalDate day, Locale locale) {HebrewCalendar c = calendar(day);int month = c.get(HebrewCalendar.MONTH), date = c.get(HebrewCalendar.DAY_OF_MONTH);// Kislev may have 29 or 30 days; Hanukkah always lasts eight days.@@ -105,17 +121,17 @@ final class JewishDate {/** ICU month numbers: Tishri=0, Kislev=2, Tevet=3, Adar/Adar II=6, Nisan=7, Sivan=9. */static int holiday(int month, int day, int kislevDays, boolean israel) {if (month == 0) {- if (day == 1 || day == 2) return R.string.jewish_rosh_hashanah;- if (day == 10) return R.string.jewish_yom_kippur;- if (day >= 15 && day <= 21) return R.string.jewish_happy_holiday;- if (day == 22) return R.string.jewish_happy_holiday;- if (day == 23 && !israel) return R.string.jewish_happy_holiday;+ if (day == 1 || day == 2) return NEW_YEAR;+ if (day == 10) return KIPPUR;+ if (day >= 15 && day <= 21) return HOLIDAY;+ if (day == 22) return HOLIDAY;+ if (day == 23 && !israel) return HOLIDAY;}if ((month == 2 && day >= 25 && day <= kislevDays)- || (month == 3 && day >= 1 && day <= 32 - kislevDays)) return R.string.jewish_hanukkah;- if (month == 6 && (day == 14 || day == 15)) return R.string.jewish_purim;- if (month == 7 && day >= 15 && day <= (israel ? 21 : 22)) return R.string.jewish_happy_holiday;- if (month == 9 && (day == 6 || (day == 7 && !israel))) return R.string.jewish_happy_holiday;+ || (month == 3 && day >= 1 && day <= 32 - kislevDays)) return HANUKKAH;+ if (month == 6 && (day == 14 || day == 15)) return PURIM;+ if (month == 7 && day >= 15 && day <= (israel ? 21 : 22)) return HOLIDAY;+ if (month == 9 && (day == 6 || (day == 7 && !israel))) return HOLIDAY;return 0;}}diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.javaindex f79f4f39b..cc5477e10 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java@@ -447,23 +447,27 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {shamsi = cfg.shamsiDate;jewishDate = cfg.jewishDate;greetingName = cfg.greetingName;- if (shamsi || (jewishDate != null && jewishDate.showDate)) {- if (shamsi && jewishDate != null && jewishDate.showDate) {+ boolean hebrewDate = jewishDate != null && jewishDate.showDate;+ if (shamsi || hebrewDate) {+ if (shamsi && hebrewDate) {shamsiDate.setSingleLine(false);shamsiDate.setMaxLines(2);}- if (jewishDate != null && jewishDate.showDate) {+ if (hebrewDate) {shamsiDate.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;ViewGroup dates = (ViewGroup) shamsiDate.getParent();dates.removeView(shamsiDate);dates.addView(shamsiDate);+ dates.setTranslationY(6 * density);}shamsiDate.setVisibility(View.VISIBLE);TextView date = findViewById(R.id.date);- if (jewishDate != null && jewishDate.showDate) {- date.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;+ if (hebrewDate) {+ date.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;+ shamsiDate.setTextSize(14f);+ date.setLetterSpacing(0.02f);}- date.setTextSize(11f);+ date.setTextSize(hebrewDate ? 14f : 11f);date.setPadding(0, (int) (4 * density), 0, 0);}vpnApp = cfg.vpnApp;@@ -2294,7 +2298,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {: jewishDate.day(java.time.ZonedDateTime.now());int holiday = jewishDay != null && jewishDate.greetings ? jewishDate.greeting(jewishDay, locale) : 0;String festiveGreeting = festive ? festival.greetingText(getResources()) : "";- if (festiveGreeting.isEmpty() && holiday != 0) festiveGreeting = getString(holiday);+ if (festiveGreeting.isEmpty() && holiday != 0) festiveGreeting = getResources().getStringArray(R.array.jewish_greetings)[holiday - 1];if (!festiveGreeting.isEmpty()) {greeting.setText(festiveGreeting);greeting.setTextColor(festive ? liftTowardsWhite(festival.accentColor(), 0.25f) : greetingColor);diff --git a/launcher/app/src/main/res/layout-iw/activity_main.xml b/launcher/app/src/main/res/layout-iw/activity_main.xmlindex 313f96a52..f60ac5411 100644--- a/launcher/app/src/main/res/layout-iw/activity_main.xml+++ b/launcher/app/src/main/res/layout-iw/activity_main.xml@@ -184,6 +184,7 @@android:layout_height="wrap_content"android:layout_gravity="bottom"android:layout_marginBottom="9dp"+ android:gravity="right"android:orientation="vertical"><!-- Shamsi date ("27 Mehr 1405"), shown when shamsi_date is on. -->diff --git a/launcher/app/src/main/res/values-iw/jewish_greetings.xml b/launcher/app/src/main/res/values-iw/jewish_greetings.xmlnew file mode 100644index 000000000..da11a7043--- /dev/null+++ b/launcher/app/src/main/res/values-iw/jewish_greetings.xml@@ -0,0 +1,12 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <!-- Order: New Year, Yom Kippur, Hanukkah, Purim, holiday, Shabbat. All opt-in. -->+ <string-array name="jewish_greetings">+ <item>שנה טובה</item>+ <item>גמר חתימה טובה</item>+ <item>חנוכה שמח</item>+ <item>פורים שמח</item>+ <item>חג שמח</item>+ <item>שבת שלום</item>+ </string-array>+</resources>diff --git a/launcher/app/src/main/res/values-iw/strings.xml b/launcher/app/src/main/res/values-iw/strings.xmlindex a8383e3ad..d67716df0 100644--- a/launcher/app/src/main/res/values-iw/strings.xml+++ b/launcher/app/src/main/res/values-iw/strings.xml@@ -141,10 +141,4 @@<string name="race_countdown_hours">%1$d שע׳ %2$d דק׳</string><string name="race_countdown_days">%1$d ימ׳ %2$d שע׳</string><string name="last_opened">פתיחה אחרונה: %1$s</string>- <!-- Optional Jewish holiday greetings; enabled explicitly in config.xml or a theme. -->- <string name="jewish_rosh_hashanah">שנה טובה</string>- <string name="jewish_yom_kippur">גמר חתימה טובה</string>- <string name="jewish_hanukkah">חנוכה שמח</string>- <string name="jewish_purim">פורים שמח</string>- <string name="jewish_happy_holiday">חג שמח</string></resources>diff --git a/launcher/app/src/main/res/values/jewish_greetings.xml b/launcher/app/src/main/res/values/jewish_greetings.xmlnew file mode 100644index 000000000..109b13609--- /dev/null+++ b/launcher/app/src/main/res/values/jewish_greetings.xml@@ -0,0 +1,12 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <!-- Order: New Year, Yom Kippur, Hanukkah, Purim, holiday, Shabbat. All opt-in. -->+ <string-array name="jewish_greetings">+ <item>Happy New Year</item>+ <item>Gmar tov</item>+ <item>Happy Hanukkah</item>+ <item>Happy Purim</item>+ <item>Happy holiday</item>+ <item>Shabbat shalom</item>+ </string-array>+</resources>diff --git a/launcher/app/src/main/res/values/strings.xml b/launcher/app/src/main/res/values/strings.xmlindex ae709c916..aa9d3e9e2 100644--- a/launcher/app/src/main/res/values/strings.xml+++ b/launcher/app/src/main/res/values/strings.xml@@ -145,10 +145,4 @@<!-- Cinematic top shelf (cinematic_home): the line under the focused dock app's name; %1$s is when it waslast opened, e.g. "5 minutes ago" or "yesterday, 9:40 pm". --><string name="last_opened">Last opened %1$s</string>- <!-- Optional Jewish holiday greetings; enabled explicitly in config.xml or a theme. -->- <string name="jewish_rosh_hashanah">Happy New Year</string>- <string name="jewish_yom_kippur">Gmar tov</string>- <string name="jewish_hanukkah">Happy Hanukkah</string>- <string name="jewish_purim">Happy Purim</string>- <string name="jewish_happy_holiday">Happy holiday</string></resources>diff --git a/launcher/app/src/test/java/com/gathin/tvhome/JewishDateTest.java b/launcher/app/src/test/java/com/gathin/tvhome/JewishDateTest.javaindex c672150e5..c948ae2f1 100644--- a/launcher/app/src/test/java/com/gathin/tvhome/JewishDateTest.java+++ b/launcher/app/src/test/java/com/gathin/tvhome/JewishDateTest.java@@ -34,21 +34,21 @@ public class JewishDateTest {assertFalse(JewishDate.israel(new Locale("he", "IL"), "diaspora"));}@Test public void holidayRangesAndDiasporaExtraDays() {- assertEquals(R.string.jewish_rosh_hashanah, JewishDate.holiday(0, 1, 30, true));+ assertEquals(JewishDate.NEW_YEAR, JewishDate.holiday(0, 1, 30, true));assertEquals(0, JewishDate.holiday(0, 3, 30, true));- assertEquals(R.string.jewish_yom_kippur, JewishDate.holiday(0, 10, 30, true));- assertEquals(R.string.jewish_happy_holiday, JewishDate.holiday(0, 21, 30, true));- assertEquals(R.string.jewish_happy_holiday, JewishDate.holiday(0, 22, 30, true));- assertEquals(R.string.jewish_happy_holiday, JewishDate.holiday(0, 22, 30, false));- assertEquals(R.string.jewish_happy_holiday, JewishDate.holiday(0, 23, 30, false));+ assertEquals(JewishDate.KIPPUR, JewishDate.holiday(0, 10, 30, true));+ assertEquals(JewishDate.HOLIDAY, JewishDate.holiday(0, 21, 30, true));+ assertEquals(JewishDate.HOLIDAY, JewishDate.holiday(0, 22, 30, true));+ assertEquals(JewishDate.HOLIDAY, JewishDate.holiday(0, 22, 30, false));+ assertEquals(JewishDate.HOLIDAY, JewishDate.holiday(0, 23, 30, false));assertEquals(0, JewishDate.holiday(0, 23, 30, true));- assertEquals(R.string.jewish_happy_holiday, JewishDate.holiday(7, 22, 30, false));+ assertEquals(JewishDate.HOLIDAY, JewishDate.holiday(7, 22, 30, false));assertEquals(0, JewishDate.holiday(7, 22, 30, true));- assertEquals(R.string.jewish_happy_holiday, JewishDate.holiday(9, 7, 30, false));+ assertEquals(JewishDate.HOLIDAY, JewishDate.holiday(9, 7, 30, false));assertEquals(0, JewishDate.holiday(9, 7, 30, true));assertEquals(0, JewishDate.holiday(5, 14, 30, true)); // Adar I is not Purim.- assertEquals(R.string.jewish_purim, JewishDate.holiday(6, 14, 30, true));- assertEquals(R.string.jewish_purim, JewishDate.holiday(6, 15, 30, true));+ assertEquals(JewishDate.PURIM, JewishDate.holiday(6, 14, 30, true));+ assertEquals(JewishDate.PURIM, JewishDate.holiday(6, 15, 30, true));}@Test public void omitYearThousandsWithoutChangingDaysOrLeapMonths() {assertEquals("ה׳ בחשוון תשפ״ז", JewishDate.withoutMillennium("ה׳ בחשוון ה׳תשפ״ז"));@@ -59,11 +59,25 @@ public class JewishDateTest {assertEquals("13 Heshvan 5787", JewishDate.withoutMillennium("13 Heshvan 5787"));}+ @Test public void holidaysAndTheirEvesOverrideShabbat() {+ LocalDate shabbat = LocalDate.of(2026, 10, 24);+ assertEquals(JewishDate.SHABBAT, JewishDate.preferredGreeting(0, 0, shabbat));+ assertEquals(JewishDate.NEW_YEAR,+ JewishDate.preferredGreeting(JewishDate.NEW_YEAR, 0, shabbat));+ assertEquals(JewishDate.HOLIDAY,+ JewishDate.preferredGreeting(0, JewishDate.HOLIDAY, LocalDate.of(2025, 4, 12)));+ assertEquals(JewishDate.HANUKKAH, JewishDate.preferredGreeting(+ JewishDate.HANUKKAH, JewishDate.NEW_YEAR, shabbat));+ assertEquals(0, JewishDate.preferredGreeting(0, 0, shabbat.plusDays(1)));+ assertEquals(JewishDate.SHABBAT,+ JewishDate.preferredGreeting(0, 0, LocalDate.of(1969, 12, 27)));+ }+@Test public void hanukkahHasEightDaysWithShortOrLongKislev() {for (int length : new int[]{29, 30}) {int count = 0;for (int month : new int[]{2, 3}) for (int d = 1; d <= (month == 2 ? length : 29); d++)- if (JewishDate.holiday(month, d, length, true) == R.string.jewish_hanukkah) count++;+ if (JewishDate.holiday(month, d, length, true) == JewishDate.HANUKKAH) count++;assertEquals(8, count);}}diff --git a/tests/test_hebrew_resources.py b/tests/test_hebrew_resources.pyindex 63e5a0f0e..ead2aea4b 100644--- a/tests/test_hebrew_resources.py+++ b/tests/test_hebrew_resources.py@@ -35,6 +35,17 @@ class HebrewResourcesTest(unittest.TestCase):for key in ("hebrew_date", "jewish_holiday_greetings"):self.assertEqual("false", config.find("bool[@name='" + key + "']").text)+ def test_jewish_greeting_translations_keep_the_same_order(self):+ lists = []+ for folder in ("values", "values-iw"):+ array = ET.parse(RES / folder / "jewish_greetings.xml").getroot().find("string-array")+ self.assertEqual("jewish_greetings", array.get("name"))+ lists.append([item.text for item in array])+ self.assertEqual(6, len(lists[0]))+ self.assertEqual(6, len(lists[1]))+ self.assertEqual("Shabbat shalom", lists[0][-1])+ self.assertEqual("שבת שלום", lists[1][-1])+def test_hebrew_home_keeps_all_default_view_ids_and_types(self):default, hebrew = views("layout"), views("layout-iw")for view_id, tag in default.items():diff --git a/themes/README.md b/themes/README.mdindex ef0d29531..13e8e203e 100644--- a/themes/README.md+++ b/themes/README.md@@ -71,7 +71,7 @@ A new key needs one there in the same pull request.| `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 || `hebrew_date` | bool | Off by default; show the Hebrew calendar date below the Gregorian one. Requires the manual location described below for offline sunset rollover |-| `jewish_holiday_greetings` | bool | Off by default; replace the normal greeting during major Jewish holidays, Hanukkah and Purim (including Shushan Purim). An explicit festival-theme greeting has priority |+| `jewish_holiday_greetings` | bool | Off by default; replace the normal greeting during major Jewish holidays, their eves, Hanukkah, Purim (including Shushan Purim) and Shabbat. An explicit festival-theme greeting has priority || `jewish_holiday_region` | string | `auto` (default): country `IL` uses Israel, other countries use Diaspora; Hebrew without a country uses Israel. Override with `israel` or `diaspora` || `greeting_name` | string | A name after the greeting, e.g. `"Mr. Trịnh"` for GOOD MORNING, MR. TRỊNH; empty for the greeting alone || `module_cards` | bool | Look for module cards and ask about them (`true`); `false` turns the feature off |@@ -226,3 +226,9 @@ on the development computer only; the launcher never calls them.The Gregorian date stays on top of the optional Hebrew date. Hebrew years omit the thousands prefix(for example תשפ״ז); day-number and Adar I/II marks remain intact. Shemini Atzeret and Simchat Torah usethe same general holiday greeting in Israel and the Diaspora, while their observed dates still differ.++With greetings enabled, priority is: an explicit festival-theme greeting, today’s Jewish holiday,+a holiday beginning the following Hebrew day (holiday eve), Shabbat, then the normal time-of-day greeting.+Shabbat follows the same sunset-based date: Friday sunset through Saturday sunset (approximate display,+not Havdalah timing). Holiday-eve greetings use the upcoming holiday’s wording. The optional date pair+uses the same 14sp regular font and letter spacing on both lines, with a 6dp downward offset.