Skip to content

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

Launcher: refine Hebrew date order, year and holiday wording

lionlev219bfb06f09447
diff --git a/docs/switches/hebrew_date.jpg b/docs/switches/hebrew_date.jpg
index d442b7bcd..ae3759bb3 100644
Binary files a/docs/switches/hebrew_date.jpg and b/docs/switches/hebrew_date.jpg differ
diff --git a/docs/switches/jewish_holiday_greetings.jpg b/docs/switches/jewish_holiday_greetings.jpg
index c39187965..7d1a816fd 100644
Binary files a/docs/switches/jewish_holiday_greetings.jpg and b/docs/switches/jewish_holiday_greetings.jpg differ
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/JewishDate.java b/launcher/app/src/main/java/com/gathin/tvhome/JewishDate.java
index 4ba9130a6..03e773037 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/JewishDate.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/JewishDate.java
@@ -84,7 +84,13 @@ final class JewishDate {
: new ULocale(locale.toString() + "@calendar=hebrew"));
HebrewCalendar calendar = calendar(day);
format.setCalendar(calendar);
- return format.format(calendar.getTime());
+ String text = format.format(calendar.getTime());
+ return he ? withoutMillennium(text) : text;
+ }
+
+ /** Omit only a year's thousands prefix; preserve day 5 and Adar I/II markers. */
+ static String withoutMillennium(String text) {
+ return text.replaceFirst(" [א-ט]׳(?=[א-ת׳״]+$)", " ");
}
int greeting(LocalDate day, Locale locale) {
@@ -102,8 +108,8 @@ final class JewishDate {
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 israel ? R.string.jewish_simchat_torah : R.string.jewish_happy_holiday;
- if (day == 23 && !israel) return R.string.jewish_simchat_torah;
+ if (day == 22) return R.string.jewish_happy_holiday;
+ if (day == 23 && !israel) return R.string.jewish_happy_holiday;
}
if ((month == 2 && day >= 25 && day <= kislevDays)
|| (month == 3 && day >= 1 && day <= 32 - kislevDays)) return R.string.jewish_hanukkah;
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 a99336022..f79f4f39b 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -454,6 +454,9 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
}
if (jewishDate != null && jewishDate.showDate) {
shamsiDate.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;
+ ViewGroup dates = (ViewGroup) shamsiDate.getParent();
+ dates.removeView(shamsiDate);
+ dates.addView(shamsiDate);
}
shamsiDate.setVisibility(View.VISIBLE);
TextView date = findViewById(R.id.date);
diff --git a/launcher/app/src/main/res/values-iw/strings.xml b/launcher/app/src/main/res/values-iw/strings.xml
index 7fabb6fbb..a8383e3ad 100644
--- a/launcher/app/src/main/res/values-iw/strings.xml
+++ b/launcher/app/src/main/res/values-iw/strings.xml
@@ -144,7 +144,6 @@
<!-- 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_simchat_torah">חג שמחת תורה שמח</string>
<string name="jewish_hanukkah">חנוכה שמח</string>
<string name="jewish_purim">פורים שמח</string>
<string name="jewish_happy_holiday">חג שמח</string>
diff --git a/launcher/app/src/main/res/values/strings.xml b/launcher/app/src/main/res/values/strings.xml
index daa84f96a..ae709c916 100644
--- a/launcher/app/src/main/res/values/strings.xml
+++ b/launcher/app/src/main/res/values/strings.xml
@@ -148,7 +148,6 @@
<!-- 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_simchat_torah">Happy holiday</string>
<string name="jewish_hanukkah">Happy Hanukkah</string>
<string name="jewish_purim">Happy Purim</string>
<string name="jewish_happy_holiday">Happy holiday</string>
diff --git a/launcher/app/src/test/java/com/gathin/tvhome/JewishDateTest.java b/launcher/app/src/test/java/com/gathin/tvhome/JewishDateTest.java
index 02a049228..c672150e5 100644
--- a/launcher/app/src/test/java/com/gathin/tvhome/JewishDateTest.java
+++ b/launcher/app/src/test/java/com/gathin/tvhome/JewishDateTest.java
@@ -38,9 +38,9 @@ public class JewishDateTest {
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_simchat_torah, JewishDate.holiday(0, 22, 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_simchat_torah, JewishDate.holiday(0, 23, 30, false));
+ assertEquals(R.string.jewish_happy_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(0, JewishDate.holiday(7, 22, 30, true));
@@ -50,6 +50,15 @@ public class JewishDateTest {
assertEquals(R.string.jewish_purim, JewishDate.holiday(6, 14, 30, true));
assertEquals(R.string.jewish_purim, JewishDate.holiday(6, 15, 30, true));
}
+ @Test public void omitYearThousandsWithoutChangingDaysOrLeapMonths() {
+ assertEquals("ה׳ בחשוון תשפ״ז", JewishDate.withoutMillennium("ה׳ בחשוון ה׳תשפ״ז"));
+ assertEquals("ט״ו באדר א׳ תשפ״ד", JewishDate.withoutMillennium("ט״ו באדר א׳ ה׳תשפ״ד"));
+ assertEquals("ט״ז באדר ב׳ תשפ״ד", JewishDate.withoutMillennium("ט״ז באדר ב׳ ה׳תשפ״ד"));
+ assertEquals("י״ג בחשוון תשפ״ז", JewishDate.withoutMillennium("י״ג בחשוון ה׳תשפ״ז"));
+ assertEquals("א׳ בתשרי ה׳", JewishDate.withoutMillennium("א׳ בתשרי ה׳"));
+ assertEquals("13 Heshvan 5787", JewishDate.withoutMillennium("13 Heshvan 5787"));
+ }
+
@Test public void hanukkahHasEightDaysWithShortOrLongKislev() {
for (int length : new int[]{29, 30}) {
int count = 0;
diff --git a/themes/README.md b/themes/README.md
index b372ca602..ef0d29531 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -70,7 +70,7 @@ A new key needs one there in the same pull request.
| `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_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 above the Gregorian one. Requires the manual location described below for offline sunset rollover |
+| `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_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 |
@@ -222,3 +222,7 @@ other languages use ICU's localized Hebrew-calendar month names. Existing explic
Calendar validation uses [Hebcal's converter and holiday API](https://www.hebcal.com/home/developer-apis)
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 use
+the same general holiday greeting in Israel and the Diaspora, while their observed dates still differ.