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
addons: add offline Jewish calendar and optional clock screensaver
lionlev213ee70ede53c0
diff --git a/addons/README.md b/addons/README.mdindex 2da690c29..1bd2de092 100644--- a/addons/README.md+++ b/addons/README.md@@ -9,6 +9,7 @@ the core bigger or change how it behaves. You install an add-on only if you want| Add-on | What it does | Author | Tested on | Permissions | Screenshot ||---|---|---|---|---|---|+| [Jewish Calendar](jewish-calendar/) | Offline Hebrew and Gregorian dates, holiday/Shabbat greetings, and an optional clock screensaver | [lionlev21](https://github.com/lionlev21) | Android TV 12 (model private) | None | <img src="jewish-calendar/screenshot.jpg" width="240" alt="Jewish Calendar on a TV"> || [Frigate Glance](frigate-glance/) | Frigate camera pop-ups over whatever is playing | [NickLD](https://github.com/NickLD) | TCL 65Q650G | overlay, accessibility (card keys), network, foreground service | <img src="frigate-glance/screenshot.jpg" width="240" alt="Frigate Glance on a TV"> || [Capacity Stats](capacity-stats/) | Available/total and used/total RAM; available/total storage | [lionlev21](https://github.com/lionlev21) | Android TV 12 (model private) | None | <img src="capacity-stats/screenshot.jpg" width="240" alt="Capacity Stats on a TV"> || [Weather](weather/) | The weather for one city: now, US air quality and the next three days, from Open-Meteo (no key) | [@Sumyabazar1](https://github.com/Sumyabazar1) | Hisense SmartTV 4K FFM (lushan), Google TV 12 | `INTERNET` | <img src="weather/screenshot.jpg" width="240" alt="Weather on a TV"> |diff --git a/addons/jewish-calendar/.gitignore b/addons/jewish-calendar/.gitignorenew file mode 100644index 000000000..b1ba6bbc2--- /dev/null+++ b/addons/jewish-calendar/.gitignore@@ -0,0 +1,3 @@+/.gradle/+/local.properties+/**/build/diff --git a/addons/jewish-calendar/README.md b/addons/jewish-calendar/README.mdnew file mode 100644index 000000000..370dfff6e--- /dev/null+++ b/addons/jewish-calendar/README.md@@ -0,0 +1,70 @@+# Jewish Calendar++An optional, standalone module card with Gregorian and Hebrew dates, Jewish holiday/eve and Shabbat+greetings, and a clock. It also offers an optional system clock screensaver. Installing it never changes+the launcher's header, date line, settings or theme. This replaces the launcher-switch proposal in #1284;+it uses only the existing module-card contract.++## Setup++Build from this folder with JDK 17 and Android SDK 34:++```sh+./gradlew --no-daemon testReleaseUnitTest lintRelease assembleRelease+```++Sideload the APK with the repository's normal ADB tools. On Home, approve **Jewish Calendar** when the+launcher asks about its card, or enable it later under Settings → Module cards. The card opens the+calendar's own screen; it cannot put a live date or greeting into the launcher header or tile caption.++Open **Calendar settings**, enter your city's latitude and longitude, and save. Both coordinates are+stored only in this app's private preferences; no coordinates are built in, and no GPS or network lookup+runs. Clearing both removes the location. Use a decimal point and a minus sign for south/west. Keep the+TV's date, time and time zone correct. Invalid/non-finite coordinates are refused. Without a location,+or when the location has no sunset that day, Hebrew dates and holiday greetings are omitted and the+screen explains why. The Gregorian date and clock remain usable.++The Hebrew day changes at approximate local sunset, refreshed once a minute while visible. This is+an informational calendar, **not candle-lighting or Havdalah guidance**. Holiday scheduling defaults+to the app locale's country: Israel for country IL, Diaspora for other explicit countries; Hebrew without+a country uses Israel. Choose Israel or Diaspora explicitly if that does not match the schedule you observe.++Holiday and Shabbat greetings can be disabled independently in this app. Priority is today's holiday,+then an upcoming holiday on the following Hebrew day (holiday eve), then Shabbat. Shabbat uses Friday+sunset to Saturday sunset, not Havdalah. The supported greetings cover Rosh Hashanah, Yom Kippur,+Sukkot/Shemini Atzeret/Simchat Torah, Hanukkah, Purim/Shushan Purim, Pesach and Shavuot. Israel and+Diaspora use the same greeting wording, with their respective observed dates. These are calendar-based+messages, not a complete personal observance schedule.++Hebrew and English UI strings are included. Other locales use English controls and Android ICU's localized+Hebrew-calendar month names. RTL follows the system locale. Hebrew years omit the thousands prefix;+day 5 and Adar I/II markers remain intact. Dates keep the proper Hebrew gershayim character, with its+excess font padding trimmed visually.++## Optional screensaver++Open **System screensaver settings** and select this app if desired. The add-on does not select itself or+change the idle timeout. Its dream shows the clock and “Gregorian date, Hebrew date”, with the greeting+when applicable; it drifts within a padded area. Any key leaves the screensaver. It uses the same private+location and holiday settings as the card. It does not replace the launcher's own idle-clock activity.++## Permissions++None requested. The exported dream requires Android's `BIND_DREAM_SERVICE` permission from its caller;+this is a binding restriction, not a permission granted to the app. No Internet, location, overlays,+accessibility, boot receiver, alarms, foreground service, analytics or ads. The only service is the+optional system-managed `DreamService`; updates stop when the activity/dream is not visible.++## Validation++Unit tests cover sunset boundaries and DST, invalid/polar locations, locale/region precedence,+Israel/Diaspora festival lengths, eight-day Hanukkah, Adar and Hebrew-year punctuation, and+holiday/eve/Shabbat priority. The offline solar helper is copied from the repository's MIT-licensed+launcher; date conversion uses Android's built-in ICU HebrewCalendar (API 24+, app minimum API 26).+Host-side reference validation uses [Hebcal](https://www.hebcal.com/home/developer-apis); no Hebcal+network call or library runs on the TV.++Real-TV validation and an approved date/clock-only crop are recorded in the PR. Device model and+location remain private at the owner's request.++diff --git a/addons/jewish-calendar/app/build.gradle b/addons/jewish-calendar/app/build.gradlenew file mode 100644index 000000000..399751ef7--- /dev/null+++ b/addons/jewish-calendar/app/build.gradle@@ -0,0 +1,18 @@+plugins { id 'com.android.application' }+android {+ namespace 'com.lionlev.tv.jewishcalendar'+ compileSdk 34+ buildFeatures { aidl false }+ defaultConfig { applicationId 'com.lionlev.tv.jewishcalendar'; minSdk 26; targetSdk 34; versionCode 1; versionName '1.0' }+ buildTypes { release {+ minifyEnabled true+ shrinkResources true+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'+ signingConfig signingConfigs.debug+ } }+ compileOptions { sourceCompatibility JavaVersion.VERSION_17; targetCompatibility JavaVersion.VERSION_17 }+}+dependencies {++ testImplementation 'junit:junit:4.13.2'+}diff --git a/addons/jewish-calendar/app/proguard-rules.pro b/addons/jewish-calendar/app/proguard-rules.pronew file mode 100644index 000000000..e69de29bbdiff --git a/addons/jewish-calendar/app/src/main/AndroidManifest.xml b/addons/jewish-calendar/app/src/main/AndroidManifest.xmlnew file mode 100644index 000000000..1c5f49698--- /dev/null+++ b/addons/jewish-calendar/app/src/main/AndroidManifest.xml@@ -0,0 +1,15 @@+<manifest xmlns:android="http://schemas.android.com/apk/res/android">+ <uses-feature android:name="android.software.leanback" android:required="true" />+ <uses-feature android:name="android.hardware.touchscreen" android:required="false" />+ <application android:allowBackup="false" android:supportsRtl="true" android:theme="@android:style/Theme.Material.NoActionBar.Fullscreen"+ android:label="@string/app_name" android:icon="@drawable/icon" android:banner="@drawable/icon">+ <activity android:name=".CalendarActivity" android:exported="true">+ <intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LEANBACK_LAUNCHER" /></intent-filter>+ <intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="com.gathin.tvhome.category.DOCK_CARD" /></intent-filter>+ <meta-data android:name="com.gathin.tvhome.card" android:resource="@xml/module_card" />+ </activity>+ <service android:name=".CalendarDream" android:exported="true" android:permission="android.permission.BIND_DREAM_SERVICE">+ <intent-filter><action android:name="android.service.dreams.DreamService" /></intent-filter>+ </service>+ </application>+</manifest>diff --git a/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/CalendarActivity.java b/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/CalendarActivity.javanew file mode 100644index 000000000..e98121208--- /dev/null+++ b/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/CalendarActivity.java@@ -0,0 +1,111 @@+package com.lionlev.tv.jewishcalendar;++import android.app.Activity;+import android.app.AlertDialog;+import android.content.ActivityNotFoundException;+import android.content.Context;+import android.content.Intent;+import android.content.SharedPreferences;+import android.os.Bundle;+import android.provider.Settings;+import android.text.InputType;+import android.view.Gravity;+import android.view.View;+import android.widget.*;++/** A standalone module card; it never writes the launcher's configuration. */+public final class CalendarActivity extends Activity {+ private CalendarPanel panel;++ @Override public void onCreate(Bundle state) {+ super.onCreate(state);+ panel = new CalendarPanel(this, false);+ LinearLayout actions = new LinearLayout(this);+ actions.setGravity(Gravity.CENTER);+ Button settings = new Button(this);+ settings.setText(R.string.settings);+ settings.setOnClickListener(v -> configure());+ actions.addView(settings);+ Button screensaver = new Button(this);+ screensaver.setText(R.string.screensaver);+ screensaver.setOnClickListener(v -> {+ try { startActivity(new Intent(Settings.ACTION_DREAM_SETTINGS)); }+ catch (ActivityNotFoundException | SecurityException e) {+ Toast.makeText(this, R.string.screensaver_missing, Toast.LENGTH_LONG).show();+ }+ });+ actions.addView(screensaver);+ panel.addView(actions);+ setContentView(panel);+ settings.requestFocus();+ }++ @Override protected void onResume() { super.onResume(); panel.start(); }+ @Override protected void onPause() { panel.stop(); super.onPause(); }++ private void configure() {+ SharedPreferences prefs = getSharedPreferences("calendar", Context.MODE_PRIVATE);+ LinearLayout fields = new LinearLayout(this);+ fields.setOrientation(LinearLayout.VERTICAL);+ fields.setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE);+ fields.setPadding(panel.dp(24), panel.dp(8), panel.dp(24), panel.dp(8));+ TextView description = new TextView(this);+ description.setText(R.string.location_note);+ fields.addView(description);+ EditText latitude = coordinate(fields, R.string.latitude, prefs.getString("latitude", ""));+ EditText longitude = coordinate(fields, R.string.longitude, prefs.getString("longitude", ""));+ TextView regionLabel = new TextView(this);+ regionLabel.setText(R.string.region);+ fields.addView(regionLabel);+ Spinner region = new Spinner(this);+ region.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item,+ new String[]{getString(R.string.auto_region), getString(R.string.israel), getString(R.string.diaspora)}));+ String current = prefs.getString("region", "auto");+ region.setSelection("israel".equals(current) ? 1 : "diaspora".equals(current) ? 2 : 0);+ fields.addView(region);+ CheckBox greetings = new CheckBox(this);+ greetings.setText(R.string.greetings);+ greetings.setChecked(prefs.getBoolean("greetings", true));+ fields.addView(greetings);+ ScrollView scroll = new ScrollView(this);+ scroll.addView(fields);+ AlertDialog dialog = new AlertDialog.Builder(this).setTitle(R.string.settings).setView(scroll)+ .setNegativeButton(R.string.cancel, null).setPositiveButton(R.string.save, null).create();+ dialog.setOnShowListener(ignored -> dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(v -> {+ String lat = latitude.getText().toString().trim(), lon = longitude.getText().toString().trim();+ if (!validLocationInput(lat, lon)) {+ latitude.setError(getString(R.string.invalid_location));+ latitude.requestFocus();+ return;+ }+ prefs.edit().putString("latitude", lat).putString("longitude", lon)+ .putString("region", new String[]{"auto", "israel", "diaspora"}[region.getSelectedItemPosition()])+ .putBoolean("greetings", greetings.isChecked()).apply();+ dialog.dismiss();+ panel.start();+ }));+ dialog.show();+ }++ static boolean validLocationInput(String latitude, String longitude) {+ if (latitude.isEmpty() && longitude.isEmpty()) return true;+ try { return JewishDate.validLocation(Double.parseDouble(latitude), Double.parseDouble(longitude)); }+ catch (NumberFormatException e) { return false; }+ }++ private EditText coordinate(LinearLayout parent, int label, String value) {+ TextView title = new TextView(this);+ title.setText(label);+ parent.addView(title);+ EditText field = new EditText(this);+ field.setId(View.generateViewId());+ field.setContentDescription(getString(label));+ field.setTextDirection(View.TEXT_DIRECTION_LTR);+ field.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED);+ field.setSingleLine(true);+ field.setText(value);+ parent.addView(field);+ title.setLabelFor(field.getId());+ return field;+ }+}diff --git a/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/CalendarDream.java b/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/CalendarDream.javanew file mode 100644index 000000000..a1dba54b3--- /dev/null+++ b/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/CalendarDream.java@@ -0,0 +1,19 @@+package com.lionlev.tv.jewishcalendar;++import android.service.dreams.DreamService;++/** Optional system screensaver. Android starts it only when the owner selects this dream. */+public final class CalendarDream extends DreamService {+ private CalendarPanel panel;+ @Override public void onAttachedToWindow() {+ super.onAttachedToWindow();+ setInteractive(false);+ setFullscreen(true);+ setScreenBright(false);+ panel = new CalendarPanel(this, true);+ setContentView(panel);+ }+ @Override public void onDreamingStarted() { super.onDreamingStarted(); panel.start(); }+ @Override public void onDreamingStopped() { if (panel != null) panel.stop(); super.onDreamingStopped(); }+ @Override public void onDetachedFromWindow() { if (panel != null) panel.stop(); super.onDetachedFromWindow(); }+}diff --git a/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/CalendarPanel.java b/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/CalendarPanel.javanew file mode 100644index 000000000..a18b349d6--- /dev/null+++ b/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/CalendarPanel.java@@ -0,0 +1,98 @@+package com.lionlev.tv.jewishcalendar;++import android.content.Context;+import android.graphics.Color;+import android.os.Handler;+import android.os.Looper;+import android.view.Gravity;+import android.view.View;+import android.widget.LinearLayout;+import android.widget.TextView;+import java.time.LocalDate;+import java.time.ZonedDateTime;+import java.util.Locale;++/** Shared foreground-only scene. No timers survive the activity or dream stopping. */+final class CalendarPanel extends LinearLayout {+ private final Handler handler = new Handler(Looper.getMainLooper());+ private final TextView greeting, clock, gregorian, hebrew, note;+ private final boolean dream;+ private final Runnable tick = new Runnable() {+ @Override public void run() {+ refresh();+ handler.postDelayed(this, 60_000L);+ }+ };++ CalendarPanel(Context context, boolean dream) {+ super(context);+ this.dream = dream;+ setOrientation(VERTICAL);+ setGravity(Gravity.CENTER);+ setLayoutDirection(LAYOUT_DIRECTION_LOCALE);+ setPadding(dp(32), dp(24), dp(32), dp(24));+ setBackgroundColor(Color.rgb(15, 23, 36));+ greeting = line(28, 0xffabc8ef);+ clock = line(92, Color.WHITE);+ gregorian = line(26, 0xffdddddd);+ hebrew = line(26, 0xffdddddd);+ hebrew.setTransformationMethod(new JewishDate.CompactQuotes());+ if (isHebrew()) gregorian.setTransformationMethod(new JewishDate.CompactQuotes());+ note = line(16, 0xffa0aab8);+ note.setPadding(0, dp(20), 0, 0);+ }++ private TextView line(int size, int color) {+ TextView text = new TextView(getContext());+ text.setTextSize(size);+ text.setTextColor(color);+ text.setGravity(Gravity.CENTER);+ text.setTextDirection(TEXT_DIRECTION_LOCALE);+ text.setMaxLines(2);+ text.setIncludeFontPadding(false);+ text.setPadding(0, dp(5), 0, dp(5));+ addView(text, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));+ return text;+ }++ int dp(int value) { return Math.round(value * getResources().getDisplayMetrics().density); }+ private boolean isHebrew() {+ String language = Locale.getDefault().getLanguage();+ return "he".equals(language) || "iw".equals(language);+ }++ void start() {+ handler.removeCallbacks(tick);+ tick.run();+ }++ void stop() { handler.removeCallbacksAndMessages(null); }++ private void refresh() {+ ZonedDateTime now = ZonedDateTime.now();+ Locale locale = Locale.getDefault();+ boolean he = isHebrew();+ String pattern = he ? "EEEE d 'ב'MMMM" : android.text.format.DateFormat.getBestDateTimePattern(locale, "EEEEdMMMM");+ String date = java.time.format.DateTimeFormatter.ofPattern(pattern, locale).format(now);+ clock.setText(java.time.format.DateTimeFormatter.ofPattern(+ android.text.format.DateFormat.is24HourFormat(getContext()) ? "HH:mm" : "h:mm a", locale).format(now));+ clock.setTextDirection(TEXT_DIRECTION_LTR);+ JewishDate calendar = JewishDate.load(getContext().getSharedPreferences("calendar", Context.MODE_PRIVATE));+ LocalDate day = calendar == null ? null : calendar.day(now);+ String alternate = day == null ? "" : JewishDate.text(day, locale);+ gregorian.setText(dream && !alternate.isEmpty() ? date + ", " + alternate : date);+ hebrew.setText(alternate);+ hebrew.setVisibility(dream || alternate.isEmpty() ? View.GONE : View.VISIBLE);+ int holiday = day != null && calendar.greetings ? calendar.greeting(day, locale) : 0;+ greeting.setText(holiday == 0 ? "" : getResources().getStringArray(R.array.jewish_greetings)[holiday - 1]);+ greeting.setVisibility(holiday == 0 ? View.GONE : View.VISIBLE);+ note.setText(calendar == null ? R.string.missing_location : day == null ? R.string.no_sunset : R.string.timing_note);+ note.setVisibility(dream && day != null ? View.GONE : View.VISIBLE);+ // Drift in a padded area, keeping all content inside the full-screen panel.+ if (dream) {+ float scale = getResources().getDisplayMetrics().density;+ float displacement = ((now.getMinute() % 5) - 2) * 8 * scale;+ for (int i = 0; i < getChildCount(); i++) getChildAt(i).setTranslationY(displacement);+ }+ }+}diff --git a/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/JewishDate.java b/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/JewishDate.javanew file mode 100644index 000000000..5ed1385b3--- /dev/null+++ b/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/JewishDate.java@@ -0,0 +1,153 @@+package com.lionlev.tv.jewishcalendar;++import android.content.SharedPreferences;+import android.icu.text.SimpleDateFormat;+import android.icu.util.HebrewCalendar;+import android.icu.util.ULocale;+import java.time.LocalDate;+import java.time.ZonedDateTime;+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 greetings;+ private final double latitude, longitude;+ private final String region;++ private JewishDate(boolean greetings, String region, double latitude, double longitude) {+ this.greetings = greetings;+ this.region = region;+ this.latitude = latitude;+ this.longitude = longitude;+ }++ static JewishDate load(SharedPreferences preferences) {+ try {+ double latitude = Double.parseDouble(preferences.getString("latitude", ""));+ double longitude = Double.parseDouble(preferences.getString("longitude", ""));+ if (!validLocation(latitude, longitude)) return null;+ return new JewishDate(preferences.getBoolean("greetings", true),+ preferences.getString("region", "auto"), latitude, longitude);+ } catch (NumberFormatException e) {+ return null;+ }+ }++ static boolean validLocation(double latitude, double longitude) {+ return Double.isFinite(latitude) && Double.isFinite(longitude)+ && Math.abs(latitude) <= 90 && Math.abs(longitude) <= 180;+ }++ /** Null when there is no sunset; never silently substitute another city's sunset. */+ LocalDate day(ZonedDateTime now) {+ return day(now, latitude, longitude);+ }++ static LocalDate day(ZonedDateTime now, double latitude, double longitude) {+ if (!validLocation(latitude, longitude)) return null;+ LocalDate date = now.toLocalDate();+ int[] sun = Sun.riseAndSet(date, latitude, longitude, now.getZone());+ if (sun == null) return null;+ return now.getHour() * 60 + now.getMinute() >= sun[1] ? date.plusDays(1) : date;+ }++ static boolean israel(Locale locale, String region) {+ if ("israel".equals(region)) return true;+ if ("diaspora".equals(region)) return false;+ return "IL".equals(locale.getCountry()) || (locale.getCountry().isEmpty()+ && ("he".equals(locale.getLanguage()) || "iw".equals(locale.getLanguage())));+ }++ private static HebrewCalendar calendar(LocalDate day) {+ HebrewCalendar calendar = new HebrewCalendar(android.icu.util.TimeZone.getTimeZone("UTC"));+ calendar.setTimeInMillis(day.toEpochDay() * 86400000L + 43200000L);+ return calendar;+ }++ static String text(LocalDate day, Locale locale) {+ boolean he = "he".equals(locale.getLanguage()) || "iw".equals(locale.getLanguage());+ SimpleDateFormat format = new SimpleDateFormat(he ? "d בMMMM y" : "d MMMM y",+ he ? new ULocale("he_IL@calendar=hebrew;numbers=hebr")+ : new ULocale(locale.toString() + "@calendar=hebrew"));+ HebrewCalendar calendar = calendar(day);+ format.setCalendar(calendar);+ String text = format.format(calendar.getTime());+ return he ? withoutMillennium(text) : text;+ }++ /** Keep the proper Hebrew punctuation, but trim its font's oversized side bearings. */+ static final class CompactQuotes extends android.text.method.SingleLineTransformationMethod {+ @Override public CharSequence getTransformation(CharSequence source, android.view.View view) {+ CharSequence text = super.getTransformation(source, view);+ if (text == null) return null;+ android.text.SpannableString result = new android.text.SpannableString(text);+ for (int i = 0; i < text.length(); i++) {+ if (text.charAt(i) == '״') result.setSpan(new Quote(), i, i + 1,+ android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);+ }+ return result;+ }+ }++ private static final class Quote extends android.text.style.ReplacementSpan {+ private final android.graphics.Rect bounds = new android.graphics.Rect();++ @Override public int getSize(android.graphics.Paint paint, CharSequence text, int start, int end,+ android.graphics.Paint.FontMetricsInt metrics) {+ paint.getTextBounds(text.toString(), start, end, bounds);+ return bounds.width();+ }++ @Override public void draw(android.graphics.Canvas canvas, CharSequence text, int start, int end,+ float x, int top, int y, int bottom, android.graphics.Paint paint) {+ canvas.drawText(text, start, end, x - bounds.left, y, paint);+ }+ }++ /** 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) {+ 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.+ c.set(HebrewCalendar.MONTH, HebrewCalendar.KISLEV);+ c.set(HebrewCalendar.DAY_OF_MONTH, 1);+ return holiday(month, date, c.getActualMaximum(HebrewCalendar.DAY_OF_MONTH), israel(locale, region));+ }++ /** 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 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 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/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/Sun.java b/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/Sun.javanew file mode 100644index 000000000..f320bda98--- /dev/null+++ b/addons/jewish-calendar/app/src/main/java/com/lionlev/tv/jewishcalendar/Sun.java@@ -0,0 +1,38 @@+package com.lionlev.tv.jewishcalendar;++import java.time.LocalDate;+import java.time.ZoneId;++/**+ * Sunrise and sunset for a place, computed offline with NOAA's general solar position equations+ * (accurate to a few minutes, which is plenty for a backdrop). Pure maths, no Android types, so+ * it runs in JVM tests; no network and no location permission, the place comes from config.xml.+ */+final class Sun {++ private Sun() {+ }++ /**+ * Local minutes of the day of sunrise and sunset, as {@code {sunrise, sunset}}, or null when the+ * sun does not rise or does not set that day (polar night or midnight sun).+ */+ static int[] riseAndSet(LocalDate date, double latitude, double longitude, ZoneId zone) {+ double g = 2 * Math.PI / 365 * (date.getDayOfYear() - 1);+ double eqTime = 229.18 * (0.000075 + 0.001868 * Math.cos(g) - 0.032077 * Math.sin(g)+ - 0.014615 * Math.cos(2 * g) - 0.040849 * Math.sin(2 * g));+ double decl = 0.006918 - 0.399912 * Math.cos(g) + 0.070257 * Math.sin(g)+ - 0.006758 * Math.cos(2 * g) + 0.000907 * Math.sin(2 * g)+ - 0.002697 * Math.cos(3 * g) + 0.00148 * Math.sin(3 * g);+ double lat = Math.toRadians(latitude);+ // 90.833 degrees: the sun's upper edge on the horizon, with refraction.+ double cosHa = Math.cos(Math.toRadians(90.833)) / (Math.cos(lat) * Math.cos(decl))+ - Math.tan(lat) * Math.tan(decl);+ if (cosHa > 1 || cosHa < -1) return null;+ double ha = Math.toDegrees(Math.acos(cosHa));+ int offset = zone.getRules().getOffset(date.atTime(12, 0)).getTotalSeconds() / 60;+ return new int[]{+ (int) Math.round(720 - 4 * (longitude + ha) - eqTime + offset),+ (int) Math.round(720 - 4 * (longitude - ha) - eqTime + offset)};+ }+}diff --git a/addons/jewish-calendar/app/src/main/res/drawable/icon.xml b/addons/jewish-calendar/app/src/main/res/drawable/icon.xmlnew file mode 100644index 000000000..6f1db9985--- /dev/null+++ b/addons/jewish-calendar/app/src/main/res/drawable/icon.xml@@ -0,0 +1,6 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="320dp" android:height="180dp" android:viewportWidth="320" android:viewportHeight="180">+ <path android:fillColor="#152337" android:pathData="M0,0h320v180h-320z" />+ <path android:fillColor="#91B6E8" android:pathData="M109,44h102v96h-102z" />+ <path android:fillColor="#152337" android:pathData="M118,70h84v61h-84zM125,36h9v26h-9zM186,36h9v26h-9z" />+ <path android:fillColor="#FFFFFF" android:pathData="M132,83h13v13h-13zM154,83h13v13h-13zM176,83h13v13h-13zM132,106h13v13h-13zM154,106h13v13h-13zM176,106h13v13h-13z" />+</vector>diff --git a/addons/jewish-calendar/app/src/main/res/values-iw/jewish_greetings.xml b/addons/jewish-calendar/app/src/main/res/values-iw/jewish_greetings.xmlnew file mode 100644index 000000000..da11a7043--- /dev/null+++ b/addons/jewish-calendar/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/addons/jewish-calendar/app/src/main/res/values-iw/strings.xml b/addons/jewish-calendar/app/src/main/res/values-iw/strings.xmlnew file mode 100644index 000000000..f9e9985c1--- /dev/null+++ b/addons/jewish-calendar/app/src/main/res/values-iw/strings.xml@@ -0,0 +1,20 @@+<resources>+ <string name="app_name">לוח שנה עברי</string>+ <string name="settings">הגדרות לוח השנה</string>+ <string name="latitude">קו רוחב (מ־90− עד 90)</string>+ <string name="longitude">קו אורך (מ־180− עד 180)</string>+ <string name="location_note">יש להזין את הקואורדינטות של העיר. השקיעה מחושבת ללא אינטרנט לפי אזור הזמן בטלוויזיה. המיקום אינו נאסף אוטומטית.</string>+ <string name="missing_location">יש להגדיר מיקום להצגת תאריך עברי שמתחלף בשקיעה.</string>+ <string name="no_sunset">אין שקיעה במיקום הזה היום, ולכן התאריך העברי אינו זמין.</string>+ <string name="invalid_location">יש להזין קו רוחב וקו אורך תקינים, או להשאיר את שניהם ריקים.</string>+ <string name="greetings">ברכות לחגים ולשבת</string>+ <string name="region">מועדי החגים</string>+ <string name="auto_region">אוטומטי (לפי השפה והמדינה)</string>+ <string name="israel">ישראל</string>+ <string name="diaspora">חו״ל</string>+ <string name="save">שמירה</string>+ <string name="cancel">ביטול</string>+ <string name="screensaver">הגדרות שומר המסך</string>+ <string name="screensaver_missing">הגדרות שומר המסך אינן זמינות בטלוויזיה הזאת.</string>+ <string name="timing_note">תצוגה המבוססת על שקיעה משוערת, ולא על זמני הדלקת נרות או הבדלה.</string>+</resources>diff --git a/addons/jewish-calendar/app/src/main/res/values/jewish_greetings.xml b/addons/jewish-calendar/app/src/main/res/values/jewish_greetings.xmlnew file mode 100644index 000000000..109b13609--- /dev/null+++ b/addons/jewish-calendar/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/addons/jewish-calendar/app/src/main/res/values/strings.xml b/addons/jewish-calendar/app/src/main/res/values/strings.xmlnew file mode 100644index 000000000..c3d735eff--- /dev/null+++ b/addons/jewish-calendar/app/src/main/res/values/strings.xml@@ -0,0 +1,20 @@+<resources>+ <string name="app_name">Jewish Calendar</string>+ <string name="settings">Calendar settings</string>+ <string name="latitude">Latitude (−90 to 90)</string>+ <string name="longitude">Longitude (−180 to 180)</string>+ <string name="location_note">Enter coordinates for your city. Sunset is calculated offline using the TV time zone. No location is collected automatically.</string>+ <string name="missing_location">Set your location for Hebrew dates that change at sunset.</string>+ <string name="no_sunset">No sunset for this location today; the Hebrew date is unavailable.</string>+ <string name="invalid_location">Enter valid latitude and longitude, or leave both empty.</string>+ <string name="greetings">Holiday and Shabbat greetings</string>+ <string name="region">Holiday schedule</string>+ <string name="auto_region">Automatic (language and country)</string>+ <string name="israel">Israel</string>+ <string name="diaspora">Diaspora</string>+ <string name="save">Save</string>+ <string name="cancel">Cancel</string>+ <string name="screensaver">System screensaver settings</string>+ <string name="screensaver_missing">Screensaver settings are unavailable on this TV.</string>+ <string name="timing_note">Approximate sunset display; not candle-lighting or Havdalah times.</string>+</resources>diff --git a/addons/jewish-calendar/app/src/main/res/xml/module_card.xml b/addons/jewish-calendar/app/src/main/res/xml/module_card.xmlnew file mode 100644index 000000000..b00859882--- /dev/null+++ b/addons/jewish-calendar/app/src/main/res/xml/module_card.xml@@ -0,0 +1 @@+<card spec="1" label="Jewish Calendar" caption="Dates and greetings" accent="#91B6E8" />diff --git a/addons/jewish-calendar/app/src/test/java/com/lionlev/tv/jewishcalendar/JewishDateTest.java b/addons/jewish-calendar/app/src/test/java/com/lionlev/tv/jewishcalendar/JewishDateTest.javanew file mode 100644index 000000000..374a473f1--- /dev/null+++ b/addons/jewish-calendar/app/src/test/java/com/lionlev/tv/jewishcalendar/JewishDateTest.java@@ -0,0 +1,84 @@+package com.lionlev.tv.jewishcalendar;++import org.junit.Test;+import java.time.LocalDate;+import java.time.ZoneId;+import java.time.ZonedDateTime;+import java.util.Locale;+import static org.junit.Assert.*;++public class JewishDateTest {+ @Test public void sunsetRollsForwardOnlyAtBoundaryAndHandlesDst() {+ for (LocalDate day : new LocalDate[]{LocalDate.of(2026, 3, 26), LocalDate.of(2026, 3, 27),+ LocalDate.of(2026, 9, 11), LocalDate.of(2026, 10, 25)}) {+ ZoneId zone = ZoneId.of("Asia/Jerusalem");+ int sunset = Sun.riseAndSet(day, 31.778, 35.235, zone)[1];+ ZonedDateTime boundary = day.atStartOfDay(zone).withHour(sunset / 60).withMinute(sunset % 60);+ assertEquals(day, JewishDate.day(boundary.minusMinutes(1), 31.778, 35.235));+ assertEquals(day.plusDays(1), JewishDate.day(boundary, 31.778, 35.235));+ }+ }+ @Test public void invalidOrPolarLocationDoesNotInventSunset() {+ assertFalse(JewishDate.validLocation(Double.NaN, 0));+ assertFalse(JewishDate.validLocation(0, Double.POSITIVE_INFINITY));+ assertFalse(JewishDate.validLocation(91, 0));+ assertFalse(JewishDate.validLocation(0, -181));+ assertNull(JewishDate.day(ZonedDateTime.parse("2026-06-21T12:00:00Z"), 90, 0));+ }+ @Test public void explicitRegionAndCountryBeatLanguage() {+ assertTrue(JewishDate.israel(new Locale("en", "IL"), "auto"));+ assertTrue(JewishDate.israel(new Locale("he"), "auto"));+ assertFalse(JewishDate.israel(new Locale("he", "US"), "auto"));+ assertFalse(JewishDate.israel(Locale.US, "auto"));+ assertTrue(JewishDate.israel(Locale.US, "israel"));+ assertFalse(JewishDate.israel(new Locale("he", "IL"), "diaspora"));+ }+ @Test public void holidayRangesAndDiasporaExtraDays() {+ assertEquals(JewishDate.NEW_YEAR, JewishDate.holiday(0, 1, 30, true));+ assertEquals(0, JewishDate.holiday(0, 3, 30, true));+ 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(JewishDate.HOLIDAY, JewishDate.holiday(7, 22, 30, false));+ assertEquals(0, JewishDate.holiday(7, 22, 30, true));+ 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(JewishDate.PURIM, JewishDate.holiday(6, 14, 30, true));+ assertEquals(JewishDate.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 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) == JewishDate.HANUKKAH) count++;+ assertEquals(8, count);+ }+ }+}diff --git a/addons/jewish-calendar/app/src/test/java/com/lionlev/tv/jewishcalendar/LocationInputTest.java b/addons/jewish-calendar/app/src/test/java/com/lionlev/tv/jewishcalendar/LocationInputTest.javanew file mode 100644index 000000000..baed4967b--- /dev/null+++ b/addons/jewish-calendar/app/src/test/java/com/lionlev/tv/jewishcalendar/LocationInputTest.java@@ -0,0 +1,15 @@+package com.lionlev.tv.jewishcalendar;+import org.junit.Test;+import static org.junit.Assert.*;+public class LocationInputTest {+ @Test public void validatesBothCoordinatesAndAllowsClearing() {+ assertTrue(CalendarActivity.validLocationInput("", ""));+ assertTrue(CalendarActivity.validLocationInput("-33.9", "151.2"));+ assertFalse(CalendarActivity.validLocationInput("", "151.2"));+ assertFalse(CalendarActivity.validLocationInput("NaN", "0"));+ assertFalse(CalendarActivity.validLocationInput("0", "Infinity"));+ assertFalse(CalendarActivity.validLocationInput("91", "0"));+ assertFalse(CalendarActivity.validLocationInput("0", "-181"));+ assertFalse(CalendarActivity.validLocationInput("not a number", "0"));+ }+}diff --git a/addons/jewish-calendar/build.gradle b/addons/jewish-calendar/build.gradlenew file mode 100644index 000000000..48978475f--- /dev/null+++ b/addons/jewish-calendar/build.gradle@@ -0,0 +1,3 @@+plugins {+ id 'com.android.application' version '8.5.2' apply false+}diff --git a/addons/jewish-calendar/gradle.properties b/addons/jewish-calendar/gradle.propertiesnew file mode 100644index 000000000..18825f968--- /dev/null+++ b/addons/jewish-calendar/gradle.properties@@ -0,0 +1,3 @@+org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8+android.useAndroidX=true+android.nonTransitiveRClass=truediff --git a/addons/jewish-calendar/gradle/wrapper/gradle-wrapper.jar b/addons/jewish-calendar/gradle/wrapper/gradle-wrapper.jarnew file mode 100644index 000000000..2c3521197Binary files /dev/null and b/addons/jewish-calendar/gradle/wrapper/gradle-wrapper.jar differdiff --git a/addons/jewish-calendar/gradle/wrapper/gradle-wrapper.properties b/addons/jewish-calendar/gradle/wrapper/gradle-wrapper.propertiesnew file mode 100644index 000000000..77f5d0ba6--- /dev/null+++ b/addons/jewish-calendar/gradle/wrapper/gradle-wrapper.properties@@ -0,0 +1,8 @@+distributionBase=GRADLE_USER_HOME+distributionPath=wrapper/dists+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip+distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab+networkTimeout=10000+validateDistributionUrl=true+zipStoreBase=GRADLE_USER_HOME+zipStorePath=wrapper/distsdiff --git a/addons/jewish-calendar/gradlew b/addons/jewish-calendar/gradlewnew file mode 100755index 000000000..f5feea6d6--- /dev/null+++ b/addons/jewish-calendar/gradlew@@ -0,0 +1,252 @@+#!/bin/sh++#+# Copyright © 2015-2021 the original authors.+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# https://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+#+# SPDX-License-Identifier: Apache-2.0+#++##############################################################################+#+# Gradle start up script for POSIX generated by Gradle.+#+# Important for running:+#+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is+# noncompliant, but you have some other compliant shell such as ksh or+# bash, then to run this script, type that shell name before the whole+# command line, like:+#+# ksh Gradle+#+# Busybox and similar reduced shells will NOT work, because this script+# requires all of these POSIX shell features:+# * functions;+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;+# * compound commands having a testable exit status, especially «case»;+# * various built-in commands including «command», «set», and «ulimit».+#+# Important for patching:+#+# (2) This script targets any POSIX shell, so it avoids extensions provided+# by Bash, Ksh, etc; in particular arrays are avoided.+#+# The "traditional" practice of packing multiple parameters into a+# space-separated string is a well documented source of bugs and security+# problems, so this is (mostly) avoided, by progressively accumulating+# options in "$@", and eventually passing that to Java.+#+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;+# see the in-line comments for details.+#+# There are tweaks for specific operating systems such as AIX, CygWin,+# Darwin, MinGW, and NonStop.+#+# (3) This script is generated from the Groovy template+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt+# within the Gradle project.+#+# You can find Gradle at https://github.com/gradle/gradle/.+#+##############################################################################++# Attempt to set APP_HOME++# Resolve links: $0 may be a link+app_path=$0++# Need this for daisy-chained symlinks.+while+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path+ [ -h "$app_path" ]+do+ ls=$( ls -ld "$app_path" )+ link=${ls#*' -> '}+ case $link in #(+ /*) app_path=$link ;; #(+ *) app_path=$APP_HOME$link ;;+ esac+done++# This is normally unused+# shellcheck disable=SC2034+APP_BASE_NAME=${0##*/}+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s+' "$PWD" ) || exit++# Use the maximum available, or set MAX_FD != -1 to use that value.+MAX_FD=maximum++warn () {+ echo "$*"+} >&2++die () {+ echo+ echo "$*"+ echo+ exit 1+} >&2++# OS specific support (must be 'true' or 'false').+cygwin=false+msys=false+darwin=false+nonstop=false+case "$( uname )" in #(+ CYGWIN* ) cygwin=true ;; #(+ Darwin* ) darwin=true ;; #(+ MSYS* | MINGW* ) msys=true ;; #(+ NONSTOP* ) nonstop=true ;;+esac++CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar+++# Determine the Java command to use to start the JVM.+if [ -n "$JAVA_HOME" ] ; then+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then+ # IBM's JDK on AIX uses strange locations for the executables+ JAVACMD=$JAVA_HOME/jre/sh/java+ else+ JAVACMD=$JAVA_HOME/bin/java+ fi+ if [ ! -x "$JAVACMD" ] ; then+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME++Please set the JAVA_HOME variable in your environment to match the+location of your Java installation."+ fi+else+ JAVACMD=java+ if ! command -v java >/dev/null 2>&1+ then+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.++Please set the JAVA_HOME variable in your environment to match the+location of your Java installation."+ fi+fi++# Increase the maximum file descriptors if we can.+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then+ case $MAX_FD in #(+ max*)+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.+ # shellcheck disable=SC2039,SC3045+ MAX_FD=$( ulimit -H -n ) ||+ warn "Could not query maximum file descriptor limit"+ esac+ case $MAX_FD in #(+ '' | soft) :;; #(+ *)+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.+ # shellcheck disable=SC2039,SC3045+ ulimit -n "$MAX_FD" ||+ warn "Could not set maximum file descriptor limit to $MAX_FD"+ esac+fi++# Collect all arguments for the java command, stacking in reverse order:+# * args from the command line+# * the main class name+# * -classpath+# * -D...appname settings+# * --module-path (only if needed)+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.++# For Cygwin or MSYS, switch paths to Windows format before running java+if "$cygwin" || "$msys" ; then+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )++ JAVACMD=$( cygpath --unix "$JAVACMD" )++ # Now convert the arguments - kludge to limit ourselves to /bin/sh+ for arg do+ if+ case $arg in #(+ -*) false ;; # don't mess with options #(+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath+ [ -e "$t" ] ;; #(+ *) false ;;+ esac+ then+ arg=$( cygpath --path --ignore --mixed "$arg" )+ fi+ # Roll the args list around exactly as many times as the number of+ # args, so each arg winds up back in the position where it started, but+ # possibly modified.+ #+ # NB: a `for` loop captures its iteration list before it begins, so+ # changing the positional parameters here affects neither the number of+ # iterations, nor the values presented in `arg`.+ shift # remove old arg+ set -- "$@" "$arg" # push replacement arg+ done+fi+++# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'++# Collect all arguments for the java command:+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,+# and any embedded shellness will be escaped.+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be+# treated as '${Hostname}' itself on the command line.++set -- \+ "-Dorg.gradle.appname=$APP_BASE_NAME" \+ -classpath "$CLASSPATH" \+ org.gradle.wrapper.GradleWrapperMain \+ "$@"++# Stop when "xargs" is not available.+if ! command -v xargs >/dev/null 2>&1+then+ die "xargs is not available"+fi++# Use "xargs" to parse quoted args.+#+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.+#+# In Bash we could simply go:+#+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&+# set -- "${ARGS[@]}" "$@"+#+# but POSIX shell has neither arrays nor command substitution, so instead we+# post-process each arg (as a line of input to sed) to backslash-escape any+# character that might be a shell metacharacter, then use eval to reverse+# that process (while maintaining the separation between arguments), and wrap+# the whole thing up as a single "set" statement.+#+# This will of course break if any of these variables contains a newline or+# an unmatched quote.+#++eval "set -- $(+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |+ xargs -n1 |+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |+ tr '\n' ' '+ )" '"$@"'++exec "$JAVACMD" "$@"diff --git a/addons/jewish-calendar/gradlew.bat b/addons/jewish-calendar/gradlew.batnew file mode 100644index 000000000..9d21a2183--- /dev/null+++ b/addons/jewish-calendar/gradlew.bat@@ -0,0 +1,94 @@+@rem+@rem Copyright 2015 the original author or authors.+@rem+@rem Licensed under the Apache License, Version 2.0 (the "License");+@rem you may not use this file except in compliance with the License.+@rem You may obtain a copy of the License at+@rem+@rem https://www.apache.org/licenses/LICENSE-2.0+@rem+@rem Unless required by applicable law or agreed to in writing, software+@rem distributed under the License is distributed on an "AS IS" BASIS,+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+@rem See the License for the specific language governing permissions and+@rem limitations under the License.+@rem+@rem SPDX-License-Identifier: Apache-2.0+@rem++@if "%DEBUG%"=="" @echo off+@rem ##########################################################################+@rem+@rem Gradle startup script for Windows+@rem+@rem ##########################################################################++@rem Set local scope for the variables with windows NT shell+if "%OS%"=="Windows_NT" setlocal++set DIRNAME=%~dp0+if "%DIRNAME%"=="" set DIRNAME=.+@rem This is normally unused+set APP_BASE_NAME=%~n0+set APP_HOME=%DIRNAME%++@rem Resolve any "." and ".." in APP_HOME to make it shorter.+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi++@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"++@rem Find java.exe+if defined JAVA_HOME goto findJavaFromJavaHome++set JAVA_EXE=java.exe+%JAVA_EXE% -version >NUL 2>&1+if %ERRORLEVEL% equ 0 goto execute++echo. 1>&2+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2+echo. 1>&2+echo Please set the JAVA_HOME variable in your environment to match the 1>&2+echo location of your Java installation. 1>&2++goto fail++:findJavaFromJavaHome+set JAVA_HOME=%JAVA_HOME:"=%+set JAVA_EXE=%JAVA_HOME%/bin/java.exe++if exist "%JAVA_EXE%" goto execute++echo. 1>&2+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2+echo. 1>&2+echo Please set the JAVA_HOME variable in your environment to match the 1>&2+echo location of your Java installation. 1>&2++goto fail++:execute+@rem Setup the command line++set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar+++@rem Execute Gradle+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*++:end+@rem End local scope for the variables with windows NT shell+if %ERRORLEVEL% equ 0 goto mainEnd++:fail+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of+rem the _cmd.exe /c_ return code!+set EXIT_CODE=%ERRORLEVEL%+if %EXIT_CODE% equ 0 set EXIT_CODE=1+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%+exit /b %EXIT_CODE%++:mainEnd+if "%OS%"=="Windows_NT" endlocal++:omegadiff --git a/addons/jewish-calendar/screenshot.jpg b/addons/jewish-calendar/screenshot.jpgnew file mode 100644index 000000000..f11b57f18Binary files /dev/null and b/addons/jewish-calendar/screenshot.jpg differdiff --git a/addons/jewish-calendar/settings.gradle b/addons/jewish-calendar/settings.gradlenew file mode 100644index 000000000..b5999edc4--- /dev/null+++ b/addons/jewish-calendar/settings.gradle@@ -0,0 +1,16 @@+pluginManagement {+ repositories {+ google()+ mavenCentral()+ gradlePluginPortal()+ }+}+dependencyResolutionManagement {+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)+ repositories {+ google()+ mavenCentral()+ }+}+rootProject.name = "jewish-calendar"+include ':app'diff --git a/tests/test_jewish_calendar_addon.py b/tests/test_jewish_calendar_addon.pynew file mode 100644index 000000000..5af99e2e6--- /dev/null+++ b/tests/test_jewish_calendar_addon.py@@ -0,0 +1,19 @@+"""The calendar's Hebrew controls must stay complete as its English UI evolves."""+from pathlib import Path+import unittest+import xml.etree.ElementTree as ET++RES = Path(__file__).resolve().parents[1] / "addons/jewish-calendar/app/src/main/res"++class CalendarTranslationsTest(unittest.TestCase):+ def test_hebrew_has_every_control_and_greeting(self):+ for file in ("strings.xml", "jewish_greetings.xml"):+ default = ET.parse(RES / "values" / file).getroot()+ hebrew = {value.get("name"): value for value in ET.parse(RES / "values-iw" / file).getroot()}+ for value in default:+ with self.subTest(resource=value.get("name")):+ self.assertIn(value.get("name"), hebrew)+ if value.tag == "string-array":+ self.assertEqual(len(value), len(hebrew[value.get("name")]))+ else:+ self.assertTrue(hebrew[value.get("name")].text)