Skip to content

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

Launcher: clock_format, the launcher's clocks in 12- or 24-hour time whatever the TV is set to

Adith Sureshbabu6a115f41ce92
diff --git a/docs/launcher.md b/docs/launcher.md
index 1d3036a53..ac94b1b1a 100644
--- a/docs/launcher.md
+++ b/docs/launcher.md
@@ -54,6 +54,8 @@ The launcher's own page has these rows, top to bottom:
- **Apps per row** 4, 5, 6 or 7; **Rows below dock** 0 to 3, how many rows of tiles stay visible under the
dock band; **Dock band opacity** 100%, 70%, 50% or 30%. The last two only do anything while the dock is
its own row (`dock_row`, on by default).
+- **Clock**: **System** follows the TV's 12- or 24-hour setting; **12-hour** or **24-hour** sets the launcher's
+ clocks (Home and the clock screensaver) to that, whatever the TV uses (`clock_format` in a theme).
- **Wallpaper**: one picture from the theme's collection (or its `wallpaper.jpg`), **None**, or **Theme
default**. A pick holds that picture and stops the rotation until you choose Theme default, press
Follow theme, or push the theme again.
diff --git a/docs/switches.md b/docs/switches.md
index b826bfea7..13f3e8d29 100644
--- a/docs/switches.md
+++ b/docs/switches.md
@@ -59,3 +59,4 @@ fits the rules; keys from before the rule sit on its wanted list until a screens
| `inputs_connected_only` | <img src="switches/inputs_connected_only.jpg" width="320" alt="inputs_connected_only on a TV"> |
| `icon_tiles` | <img src="switches/icon_tiles.jpg" width="320" alt="icon_tiles: an app drawn from its icon in the grid on a TV"> |
| `game_day` | <img src="switches/game_day.jpg" width="320" alt="game_day: Minnesota Vikings at Detroit Lions, Kickoff in 5d 13h, with four dots, under the clock on a TV"> |
+| `clock_format` | <img src="switches/clock_format.jpg" width="320" alt="clock_format on a TV"> |
diff --git a/docs/switches/clock_format.jpg b/docs/switches/clock_format.jpg
new file mode 100644
index 000000000..ac0ccc0fc
Binary files /dev/null and b/docs/switches/clock_format.jpg differ
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/ClockActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/ClockActivity.java
index 905931f87..25f8ce773 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/ClockActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/ClockActivity.java
@@ -24,6 +24,7 @@ public class ClockActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dream_clock);
+ ClockFormat.apply(getWindow().getDecorView(), Config.load(this).clockFormat);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE);
scene = new ClockScene(getWindow().getDecorView());
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/ClockDream.java b/launcher/app/src/main/java/com/gathin/tvhome/ClockDream.java
index 5dd174f29..739d5c5bb 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/ClockDream.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/ClockDream.java
@@ -17,6 +17,7 @@ public class ClockDream extends DreamService {
setFullscreen(true);
setScreenBright(false);
setContentView(R.layout.dream_clock);
+ ClockFormat.apply(getWindow().getDecorView(), Config.load(this).clockFormat);
scene = new ClockScene(getWindow().getDecorView());
scene.useHomeWallpaper(this);
}
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/ClockFormat.java b/launcher/app/src/main/java/com/gathin/tvhome/ClockFormat.java
new file mode 100644
index 000000000..a26954dd3
--- /dev/null
+++ b/launcher/app/src/main/java/com/gathin/tvhome/ClockFormat.java
@@ -0,0 +1,30 @@
+package com.gathin.tvhome;
+
+import android.content.Context;
+import android.text.format.DateFormat;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextClock;
+
+/** clock_format: "12" or "24" makes the launcher's clocks use that format whatever the TV is set to; else the TV's. */
+final class ClockFormat {
+ private ClockFormat() {
+ }
+
+ /** Every TextClock under root: its 12- and 24-hour patterns become the chosen one's (the AM/PM clock follows). */
+ static void apply(View root, String mode) {
+ if (!"12".equals(mode) && !"24".equals(mode)) return;
+ if (root instanceof TextClock) {
+ TextClock c = (TextClock) root;
+ if ("12".equals(mode)) c.setFormat24Hour(c.getFormat12Hour());
+ else c.setFormat12Hour(c.getFormat24Hour());
+ } else if (root instanceof ViewGroup) {
+ ViewGroup g = (ViewGroup) root;
+ for (int i = 0; i < g.getChildCount(); i++) apply(g.getChildAt(i), mode);
+ }
+ }
+
+ static boolean is24(Context ctx, String mode) {
+ return "24".equals(mode) || !"12".equals(mode) && DateFormat.is24HourFormat(ctx);
+ }
+}
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/Config.java b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
index 7689b8f3c..6ce37ae15 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java
@@ -43,6 +43,7 @@ final class Config {
static final String ROWS_BELOW_DOCK_KEY = "rows_below_dock";
static final String WALLPAPER_CHOICE_KEY = "wallpaper_choice";
static final String DOCK_OPACITY_KEY = "dock_opacity";
+ static final String CLOCK_FORMAT_KEY = "clock_format";
/**
* Counts the changes made in Launcher settings. Home remembers the count it was built with and rebuilds on
* resume when it differs, however the settings were left (see MainActivity#onResume).
@@ -180,6 +181,8 @@ final class Config {
final boolean powerOnHomeAlways;
/** The Inputs menu lists only inputs reporting connected; the rest fold behind a More inputs row (config.xml / theme inputs_connected_only). */
final boolean inputsConnectedOnly;
+ /** "12", "24" or "system" (theme clock_format, or Launcher settings' Clock row); see ClockFormat. */
+ final String clockFormat;
/** The Settings button opens the quick settings panel instead of the TV's Settings (settings_key_panel). */
final boolean settingsKeyPanel;
/** Home puts the remote's accessibility helpers back after a force stop (restore_key_services; ServiceRepair). */
@@ -279,7 +282,7 @@ final class Config {
boolean keyFilter, boolean dockGlass, String glowStyle, boolean wallpaperCaptions,
boolean handleViewInputs, boolean tileMenu, boolean dockEvenPadding, boolean dockBand, boolean cinematicDots, boolean cinematicWhiteFocus, boolean wifiStatusColor, int cinematicScrim, int cinematicArt,
Map<String, Set<String>> wallpaperMoods, boolean gamepadPassthrough, boolean consumeVolumeKeys, boolean powerOnHome, boolean homeLongPressHome, boolean wifiStatusWarnings, List<String> topBarApps, boolean showGreeting, boolean headerWhite, boolean clockWallpaper, int clockWallpaperDim, boolean clockGlow, String glassStyle, boolean singleRow, boolean dockBandAll, boolean lunarDate, int lunarUtcOffset, boolean dateBelowClock, boolean vpnPill, String locale, boolean powerOnHomeAlways, boolean inputsConnectedOnly,
- int openOnStartNetworkWait) {
+ int openOnStartNetworkWait, String clockFormat) {
this.handleViewInputs = handleViewInputs;
this.tileMenu = tileMenu;
this.inputKeycodes = inputKeycodes;
@@ -378,6 +381,7 @@ final class Config {
this.powerOnHomeAlways = powerOnHomeAlways;
this.inputsConnectedOnly = inputsConnectedOnly;
this.openOnStartNetworkWait = openOnStartNetworkWait;
+ this.clockFormat = clockFormat;
this.wifiStatusWarnings = wifiStatusWarnings;
this.topBarApps = Collections.unmodifiableList(topBarApps);
this.showGreeting = showGreeting;
@@ -489,6 +493,7 @@ final class Config {
boolean homeLongPressHome = res.getBoolean(R.bool.home_long_press_home);
boolean powerOnHomeAlways = res.getBoolean(R.bool.power_on_home_always);
boolean inputsConnectedOnly = res.getBoolean(R.bool.inputs_connected_only);
+ String clockFormat = "system";
boolean dockGlass = res.getBoolean(R.bool.dock_glass);
boolean dockEvenPadding = res.getBoolean(R.bool.dock_even_padding);
boolean dockBand = res.getBoolean(R.bool.dock_band);
@@ -597,6 +602,7 @@ final class Config {
homeLongPressHome = bool(json, "home_long_press_home", homeLongPressHome);
powerOnHomeAlways = bool(json, "power_on_home_always", powerOnHomeAlways);
inputsConnectedOnly = bool(json, "inputs_connected_only", inputsConnectedOnly);
+ clockFormat = string(json, CLOCK_FORMAT_KEY, clockFormat);
dockGlass = bool(json, "dock_glass", dockGlass);
dockEvenPadding = bool(json, "dock_even_padding", dockEvenPadding);
dockBand = bool(json, "dock_band", dockBand);
@@ -644,6 +650,7 @@ final class Config {
int wallpaperDim = json == null ? 0 : integer(json, "wallpaper_dim", 0, 0, 90);
int dockOpacity = json == null ? 100 : integer(json, "dock_opacity", 100, 30, 100);
dockOpacity = chosenDockOpacity(choices.getInt(DOCK_OPACITY_KEY, -1), dockOpacity);
+ clockFormat = choices.getString(CLOCK_FORMAT_KEY, clockFormat);
String wallpaperOrder = json == null ? WallpaperRotation.ORDER_SHUFFLE
: string(json, "wallpaper_order", WallpaperRotation.ORDER_SHUFFLE);
// An unknown order must not silently change how an existing collection rotates.
@@ -682,7 +689,7 @@ final class Config {
consumeVolumeKeys, powerOnHome, homeLongPressHome, wifiStatusWarnings, topBarApps, showGreeting, headerWhite, clockWallpaper,
Math.max(0, Math.min(90, clockWallpaperDim)), clockGlow, glassStyle, singleRow && dockRow, dockBandAll, lunar, lunarOffset,
dateBelowClock, vpnPill, locale, powerOnHomeAlways, inputsConnectedOnly,
- Math.max(0, Math.min(600, openOnStartNetworkWait)));
+ Math.max(0, Math.min(600, openOnStartNetworkWait)), clockFormat);
}
/**
@@ -726,12 +733,12 @@ final class Config {
SharedPreferences.Editor editor = choices.edit();
if (!"absent".equals(token)) editor.remove("columns").remove("animations")
.remove("advanced_effects").remove(ROWS_BELOW_DOCK_KEY).remove(WALLPAPER_CHOICE_KEY)
- .remove(DOCK_OPACITY_KEY);
+ .remove(DOCK_OPACITY_KEY).remove(CLOCK_FORMAT_KEY);
editor.putString(THEME_SIGNATURE_KEY, signature).commit();
} else if (!seen.equals(signature)) {
choices.edit().remove("columns").remove("animations").remove("advanced_effects")
.remove(ROWS_BELOW_DOCK_KEY).remove(WALLPAPER_CHOICE_KEY).remove(DOCK_OPACITY_KEY)
- .putString(THEME_SIGNATURE_KEY, signature).commit();
+ .remove(CLOCK_FORMAT_KEY).putString(THEME_SIGNATURE_KEY, signature).commit();
}
}
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/LauncherSettingsActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/LauncherSettingsActivity.java
index e4d1ab463..5df0a5196 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/LauncherSettingsActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/LauncherSettingsActivity.java
@@ -32,6 +32,8 @@ public final class LauncherSettingsActivity extends Activity {
private final TextView[] rowChoices = new TextView[4];
private static final int[] DOCK_OPACITIES = {100, 70, 50, 30};
private final TextView[] dockChoices = new TextView[DOCK_OPACITIES.length];
+ private static final String[] CLOCK_FORMATS = {"system", "12", "24"};
+ private final TextView[] clockChoices = new TextView[CLOCK_FORMATS.length];
private TextView wallpaperChoice;
private TextView animationsChoice;
private TextView advancedChoice;
@@ -40,6 +42,7 @@ public final class LauncherSettingsActivity extends Activity {
private int columns;
private int rowsBelowDock;
private int dockOpacity;
+ private String clockFormat;
private boolean animations;
private boolean advancedEffects;
@@ -58,6 +61,7 @@ public final class LauncherSettingsActivity extends Activity {
columns = config.columns;
rowsBelowDock = config.rowsBelowDock;
dockOpacity = config.dockOpacity;
+ clockFormat = config.clockFormat;
animations = config.animations;
advancedEffects = config.animations && config.advancedEffects;
@@ -97,6 +101,18 @@ public final class LauncherSettingsActivity extends Activity {
refresh();
});
}
+ int[] clockIds = {R.id.clockSystem, R.id.clock12, R.id.clock24};
+ for (int i = 0; i < clockIds.length; i++) {
+ final String value = CLOCK_FORMATS[i];
+ clockChoices[i] = findViewById(clockIds[i]);
+ clockChoices[i].setOnClickListener(v -> {
+ if (value.equals(clockFormat)) return;
+ clockFormat = value;
+ choices.edit().putString(Config.CLOCK_FORMAT_KEY, value).apply();
+ changed();
+ refresh();
+ });
+ }
// Mirror text alignment without globally opting the launcher into RTL. Numeric rows
// still need explicit ordering in Android's no-supportsRtl compatibility mode.
if (getResources().getBoolean(R.bool.rtl_menu_bar))
@@ -105,6 +121,7 @@ public final class LauncherSettingsActivity extends Activity {
reverseRow(columnChoices);
reverseRow(rowChoices);
reverseRow(dockChoices);
+ reverseRow(clockChoices);
}
wallpaperChoice = findViewById(R.id.wallpaperChoice);
wallpaperChoice.setOnClickListener(v -> showWallpaperPicker());
@@ -140,11 +157,12 @@ public final class LauncherSettingsActivity extends Activity {
if (!hasOnTvChoices()) return;
choices.edit().remove("columns").remove(Config.ROWS_BELOW_DOCK_KEY).remove("animations")
.remove("advanced_effects").remove(Config.WALLPAPER_CHOICE_KEY)
- .remove(Config.DOCK_OPACITY_KEY).remove(OpenOnStart.KEY).commit();
+ .remove(Config.DOCK_OPACITY_KEY).remove(Config.CLOCK_FORMAT_KEY).remove(OpenOnStart.KEY).commit();
Config current = Config.load(this);
columns = current.columns;
rowsBelowDock = current.rowsBelowDock;
dockOpacity = current.dockOpacity;
+ clockFormat = current.clockFormat;
animations = current.animations;
advancedEffects = current.animations && current.advancedEffects;
changed();
@@ -286,6 +304,9 @@ public final class LauncherSettingsActivity extends Activity {
for (int i = 0; i < dockChoices.length; i++) {
dockChoices[i].setSelected(dockOpacity == DOCK_OPACITIES[i]);
}
+ for (int i = 0; i < clockChoices.length; i++) {
+ clockChoices[i].setSelected(CLOCK_FORMATS[i].equals(clockFormat));
+ }
animationsChoice.setText(getString(R.string.animations_state,
getString(animations ? R.string.on : R.string.off)));
advancedChoice.setText(getString(R.string.advanced_effects_state,
@@ -305,7 +326,7 @@ public final class LauncherSettingsActivity extends Activity {
return choices.contains("columns") || choices.contains(Config.ROWS_BELOW_DOCK_KEY)
|| choices.contains("animations") || choices.contains("advanced_effects")
|| choices.contains(Config.WALLPAPER_CHOICE_KEY) || choices.contains(Config.DOCK_OPACITY_KEY)
- || choices.contains(OpenOnStart.KEY);
+ || choices.contains(Config.CLOCK_FORMAT_KEY) || choices.contains(OpenOnStart.KEY);
}
private void open(Intent intent) {
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 f453692e7..e9ec957a7 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -416,6 +416,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
};
private java.util.Map<Integer, String> homeAppKeys = java.util.Collections.emptyMap();
+ /** clock_format, for the race panel's session times (the TextClocks take it in onCreate). */
+ private String clockFormat = "system";
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -425,6 +427,8 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
// config.xml, overlaid by config.json from a pushed theme (see Config and tools/theme.sh).
Config cfg = Config.load(this);
homeAppKeys = RemoteKeys.parseAppKeys(cfg.appKeys);
+ clockFormat = cfg.clockFormat;
+ ClockFormat.apply(getWindow().getDecorView(), clockFormat);
appLibrarySelection = cfg.appLibrarySelection;
libraryOkOpens = cfg.libraryOkOpens;
// restore_key_services: after a force stop, put back the remote's accessibility helpers that Android took
@@ -2721,7 +2725,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
// FP1 FRI 11:00 PM FP2 SAT 2:30 AM ...: done sessions fade, the live one is red, the next one bright.
java.time.format.DateTimeFormatter when = java.time.format.DateTimeFormatter.ofPattern(
- android.text.format.DateFormat.is24HourFormat(this) ? "EEE HH:mm" : "EEE h:mm a", Locale.getDefault())
+ ClockFormat.is24(this, clockFormat) ? "EEE HH:mm" : "EEE h:mm a", Locale.getDefault())
.withZone(java.time.ZoneId.systemDefault());
android.text.SpannableStringBuilder row = new android.text.SpannableStringBuilder();
for (int i = 0; i < race.sessions.size(); i++) {
diff --git a/launcher/app/src/main/res/layout/activity_launcher_settings.xml b/launcher/app/src/main/res/layout/activity_launcher_settings.xml
index b3de8647d..601a7de26 100644
--- a/launcher/app/src/main/res/layout/activity_launcher_settings.xml
+++ b/launcher/app/src/main/res/layout/activity_launcher_settings.xml
@@ -88,6 +88,25 @@
<TextView android:id="@+id/dock30" style="@style/SettingsColumnChoice" android:text="30%" />
</LinearLayout>
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="18dp"
+ android:text="@string/dream_name"
+ android:textColor="#FFFFFFFF"
+ android:textSize="20sp" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:orientation="horizontal">
+
+ <TextView android:id="@+id/clockSystem" style="@style/SettingsColumnChoice" android:text="@string/clock_format_system" />
+ <TextView android:id="@+id/clock12" style="@style/SettingsColumnChoice" android:text="@string/clock_format_12" />
+ <TextView android:id="@+id/clock24" style="@style/SettingsColumnChoice" android:text="@string/clock_format_24" />
+ </LinearLayout>
+
<TextView
android:id="@+id/wallpaperChoice"
style="@style/SettingsRow"
diff --git a/launcher/app/src/main/res/values-ar/strings.xml b/launcher/app/src/main/res/values-ar/strings.xml
index b60be457e..1a8df5341 100644
--- a/launcher/app/src/main/res/values-ar/strings.xml
+++ b/launcher/app/src/main/res/values-ar/strings.xml
@@ -98,4 +98,7 @@
</plurals>
<string name="greeting_with_name">%1$s، %2$s</string>
<string name="game_live">مباشر الآن</string>
+ <string name="clock_format_system">النظام</string>
+ <string name="clock_format_12">12 ساعة</string>
+ <string name="clock_format_24">24 ساعة</string>
</resources>
diff --git a/launcher/app/src/main/res/values-b+sr+Latn/strings.xml b/launcher/app/src/main/res/values-b+sr+Latn/strings.xml
index e54e0c11e..8b7d3786c 100644
--- a/launcher/app/src/main/res/values-b+sr+Latn/strings.xml
+++ b/launcher/app/src/main/res/values-b+sr+Latn/strings.xml
@@ -76,4 +76,7 @@
</plurals>
<string name="greeting_with_name">%1$s, %2$s</string>
<string name="game_live">Uživo sada</string>
+ <string name="clock_format_system">Sistem</string>
+ <string name="clock_format_12">12-časovni</string>
+ <string name="clock_format_24">24-časovni</string>
</resources>
diff --git a/launcher/app/src/main/res/values-bn/strings.xml b/launcher/app/src/main/res/values-bn/strings.xml
index d6cc3d9f0..a7d845447 100644
--- a/launcher/app/src/main/res/values-bn/strings.xml
+++ b/launcher/app/src/main/res/values-bn/strings.xml
@@ -99,4 +99,7 @@
</plurals>
<string name="greeting_with_name">%1$s, %2$s</string>
<string name="game_live">এখন সরাসরি</string>
+ <string name="clock_format_system">সিস্টেম</string>
+ <string name="clock_format_12">১২ ঘণ্টা</string>
+ <string name="clock_format_24">২৪ ঘণ্টা</string>
</resources>
diff --git a/launcher/app/src/main/res/values-ca/strings.xml b/launcher/app/src/main/res/values-ca/strings.xml
index 27bf7b670..694896c18 100644
--- a/launcher/app/src/main/res/values-ca/strings.xml
+++ b/launcher/app/src/main/res/values-ca/strings.xml
@@ -109,4 +109,7 @@
<string name="race_finished">Bandera de quadres</string>
<string name="last_opened">Obert per últim cop: %1$s</string>
<string name="game_live">En directe</string>
+ <string name="clock_format_system">Sistema</string>
+ <string name="clock_format_12">12 hores</string>
+ <string name="clock_format_24">24 hores</string>
</resources>
diff --git a/launcher/app/src/main/res/values-cs/strings.xml b/launcher/app/src/main/res/values-cs/strings.xml
index 752886b76..baa29707b 100644
--- a/launcher/app/src/main/res/values-cs/strings.xml
+++ b/launcher/app/src/main/res/values-cs/strings.xml
@@ -109,4 +109,7 @@
<string name="greeting_with_name">%1$s, %2$s</string>
<string name="last_opened">Naposledy otevřeno: %1$s</string>
<string name="game_live">Právě živě</string>
+ <string name="clock_format_system">Systém</string>
+ <string name="clock_format_12">12hodinové</string>
+ <string name="clock_format_24">24hodinové</string>
</resources>
diff --git a/launcher/app/src/main/res/values-da/strings.xml b/launcher/app/src/main/res/values-da/strings.xml
index 05593e6c8..27adee112 100644
--- a/launcher/app/src/main/res/values-da/strings.xml
+++ b/launcher/app/src/main/res/values-da/strings.xml
@@ -97,4 +97,7 @@
<string name="race_countdown_days">%1$dd %2$dt</string>
<string name="last_opened">Sidst åbnet %1$s</string>
<string name="game_live">Live nu</string>
+ <string name="clock_format_system">System</string>
+ <string name="clock_format_12">12 timer</string>
+ <string name="clock_format_24">24 timer</string>
</resources>
diff --git a/launcher/app/src/main/res/values-de/strings.xml b/launcher/app/src/main/res/values-de/strings.xml
index 743d63aef..54ef82921 100644
--- a/launcher/app/src/main/res/values-de/strings.xml
+++ b/launcher/app/src/main/res/values-de/strings.xml
@@ -71,4 +71,7 @@
</plurals>
<string name="greeting_with_name">%1$s, %2$s</string>
<string name="game_live">Jetzt live</string>
+ <string name="clock_format_system">System</string>
+ <string name="clock_format_12">12 Stunden</string>
+ <string name="clock_format_24">24 Stunden</string>
</resources>
diff --git a/launcher/app/src/main/res/values-es/strings.xml b/launcher/app/src/main/res/values-es/strings.xml
index 2530c2acd..b9f918b1b 100644
--- a/launcher/app/src/main/res/values-es/strings.xml
+++ b/launcher/app/src/main/res/values-es/strings.xml
@@ -145,4 +145,7 @@
<string name="race_countdown_days">%1$dd %2$dh</string>
<string name="last_opened">Abierta por última vez %1$s</string>
<string name="game_live">En directo</string>
+ <string name="clock_format_system">Sistema</string>
+ <string name="clock_format_12">12 horas</string>
+ <string name="clock_format_24">24 horas</string>
</resources>
diff --git a/launcher/app/src/main/res/values-fi/strings.xml b/launcher/app/src/main/res/values-fi/strings.xml
index 6cd638a9b..90cc70b99 100644
--- a/launcher/app/src/main/res/values-fi/strings.xml
+++ b/launcher/app/src/main/res/values-fi/strings.xml
@@ -112,4 +112,7 @@
<string name="race_finished">Ruutulippu</string>
<string name="last_opened">Viimeksi avattu %1$s</string>
<string name="game_live">Käynnissä nyt</string>
+ <string name="clock_format_system">Järjestelmä</string>
+ <string name="clock_format_12">12 tuntia</string>
+ <string name="clock_format_24">24 tuntia</string>
</resources>
diff --git a/launcher/app/src/main/res/values-fr/strings.xml b/launcher/app/src/main/res/values-fr/strings.xml
index e416d3e1e..34b456f9b 100644
--- a/launcher/app/src/main/res/values-fr/strings.xml
+++ b/launcher/app/src/main/res/values-fr/strings.xml
@@ -95,4 +95,7 @@
<string name="greeting_with_name">%1$s, %2$s</string>
<string name="last_opened">Dernière ouverture : %1$s</string>
<string name="game_live">En direct</string>
+ <string name="clock_format_system">Système</string>
+ <string name="clock_format_12">12 heures</string>
+ <string name="clock_format_24">24 heures</string>
</resources>
diff --git a/launcher/app/src/main/res/values-in/strings.xml b/launcher/app/src/main/res/values-in/strings.xml
index 75d02a974..7b3c161fe 100644
--- a/launcher/app/src/main/res/values-in/strings.xml
+++ b/launcher/app/src/main/res/values-in/strings.xml
@@ -110,4 +110,7 @@
<string name="race_finished">Bendera finis</string>
<string name="last_opened">Terakhir dibuka %1$s</string>
<string name="game_live">Langsung sekarang</string>
+ <string name="clock_format_system">Sistem</string>
+ <string name="clock_format_12">12 jam</string>
+ <string name="clock_format_24">24 jam</string>
</resources>
diff --git a/launcher/app/src/main/res/values-it/strings.xml b/launcher/app/src/main/res/values-it/strings.xml
index 5fc97d499..d5cbaa500 100644
--- a/launcher/app/src/main/res/values-it/strings.xml
+++ b/launcher/app/src/main/res/values-it/strings.xml
@@ -145,4 +145,7 @@
<string name="race_countdown_days">%1$dg %2$dh</string>
<string name="last_opened">Ultima apertura: %1$s</string>
<string name="game_live">In diretta</string>
+ <string name="clock_format_system">Sistema</string>
+ <string name="clock_format_12">12 ore</string>
+ <string name="clock_format_24">24 ore</string>
</resources>
diff --git a/launcher/app/src/main/res/values-iw/strings.xml b/launcher/app/src/main/res/values-iw/strings.xml
index a346a4e7f..95b35659c 100644
--- a/launcher/app/src/main/res/values-iw/strings.xml
+++ b/launcher/app/src/main/res/values-iw/strings.xml
@@ -148,4 +148,7 @@
<string name="race_countdown_days">%1$d ימ׳ %2$d שע׳</string>
<string name="last_opened">פתיחה אחרונה: %1$s</string>
<string name="game_live">בשידור חי עכשיו</string>
+ <string name="clock_format_system">מערכת</string>
+ <string name="clock_format_12">12 שעות</string>
+ <string name="clock_format_24">24 שעות</string>
</resources>
diff --git a/launcher/app/src/main/res/values-ko/strings.xml b/launcher/app/src/main/res/values-ko/strings.xml
index a2336606e..c9b5f159d 100644
--- a/launcher/app/src/main/res/values-ko/strings.xml
+++ b/launcher/app/src/main/res/values-ko/strings.xml
@@ -147,4 +147,7 @@
<!-- Cinematic top shelf (cinematic_home): %1$s is when it was last opened, e.g. "5분 전". -->
<string name="last_opened">마지막 실행 %1$s</string>
<string name="game_live">지금 생중계</string>
+ <string name="clock_format_system">시스템</string>
+ <string name="clock_format_12">12시간</string>
+ <string name="clock_format_24">24시간</string>
</resources>
diff --git a/launcher/app/src/main/res/values-nb/strings.xml b/launcher/app/src/main/res/values-nb/strings.xml
index 4dce56ca1..ec98daba3 100644
--- a/launcher/app/src/main/res/values-nb/strings.xml
+++ b/launcher/app/src/main/res/values-nb/strings.xml
@@ -111,4 +111,7 @@
<string name="race_finished">Målgang</string>
<string name="last_opened">Sist åpnet %1$s</string>
<string name="game_live">Direkte nå</string>
+ <string name="clock_format_system">System</string>
+ <string name="clock_format_12">12 timer</string>
+ <string name="clock_format_24">24 timer</string>
</resources>
diff --git a/launcher/app/src/main/res/values-nl/strings.xml b/launcher/app/src/main/res/values-nl/strings.xml
index 811b2a10f..c0f73ebe7 100644
--- a/launcher/app/src/main/res/values-nl/strings.xml
+++ b/launcher/app/src/main/res/values-nl/strings.xml
@@ -112,4 +112,7 @@
<string name="race_finished">Geblokte vlag</string>
<string name="last_opened">Laatst geopend %1$s</string>
<string name="game_live">Nu live</string>
+ <string name="clock_format_system">Systeem</string>
+ <string name="clock_format_12">12-uurs</string>
+ <string name="clock_format_24">24-uurs</string>
</resources>
diff --git a/launcher/app/src/main/res/values-pl/strings.xml b/launcher/app/src/main/res/values-pl/strings.xml
index 4623c0621..52a296977 100644
--- a/launcher/app/src/main/res/values-pl/strings.xml
+++ b/launcher/app/src/main/res/values-pl/strings.xml
@@ -96,4 +96,7 @@
</plurals>
<string name="greeting_with_name">%1$s, %2$s</string>
<string name="game_live">Na żywo</string>
+ <string name="clock_format_system">Systemowy</string>
+ <string name="clock_format_12">12-godzinny</string>
+ <string name="clock_format_24">24-godzinny</string>
</resources>
diff --git a/launcher/app/src/main/res/values-pt-rPT/strings.xml b/launcher/app/src/main/res/values-pt-rPT/strings.xml
index fa6029f73..5bdb77738 100644
--- a/launcher/app/src/main/res/values-pt-rPT/strings.xml
+++ b/launcher/app/src/main/res/values-pt-rPT/strings.xml
@@ -11,4 +11,7 @@
<string name="dock_edit_pick_place">Escolha o lugar da dock para esta app e prima OK. Voltar para cancelar.</string>
<string name="more_inputs">Mais entradas</string>
<string name="game_live">Em direto</string>
+ <string name="clock_format_system">System</string>
+ <string name="clock_format_12">12-hour</string>
+ <string name="clock_format_24">24-hour</string>
</resources>
diff --git a/launcher/app/src/main/res/values-pt/strings.xml b/launcher/app/src/main/res/values-pt/strings.xml
index 669ee78b2..517b01eee 100644
--- a/launcher/app/src/main/res/values-pt/strings.xml
+++ b/launcher/app/src/main/res/values-pt/strings.xml
@@ -148,4 +148,7 @@
<string name="race_countdown_days">%1$dd %2$dh</string>
<string name="last_opened">Aberto %1$s</string>
<string name="game_live">Ao vivo agora</string>
+ <string name="clock_format_system">Sistema</string>
+ <string name="clock_format_12">12 horas</string>
+ <string name="clock_format_24">24 horas</string>
</resources>
diff --git a/launcher/app/src/main/res/values-ru/strings.xml b/launcher/app/src/main/res/values-ru/strings.xml
index adadf9adc..c698d4537 100644
--- a/launcher/app/src/main/res/values-ru/strings.xml
+++ b/launcher/app/src/main/res/values-ru/strings.xml
@@ -151,4 +151,7 @@
last opened, e.g. "5 minutes ago" or "yesterday, 9:40 pm". -->
<string name="last_opened">Последний запуск: %1$s</string>
<string name="game_live">Сейчас в эфире</string>
+ <string name="clock_format_system">Системные</string>
+ <string name="clock_format_12">12-часовой</string>
+ <string name="clock_format_24">24-часовой</string>
</resources>
diff --git a/launcher/app/src/main/res/values-sv/strings.xml b/launcher/app/src/main/res/values-sv/strings.xml
index 7dc452756..12095aaf6 100644
--- a/launcher/app/src/main/res/values-sv/strings.xml
+++ b/launcher/app/src/main/res/values-sv/strings.xml
@@ -121,4 +121,7 @@
<string name="race_race">Lopp</string>
<string name="last_opened">Senast öppnad %1$s</string>
<string name="game_live">Direkt nu</string>
+ <string name="clock_format_system">System</string>
+ <string name="clock_format_12">12 timmar</string>
+ <string name="clock_format_24">24 timmar</string>
</resources>
diff --git a/launcher/app/src/main/res/values-th/strings.xml b/launcher/app/src/main/res/values-th/strings.xml
index c0fec2c8a..8fda21b5c 100644
--- a/launcher/app/src/main/res/values-th/strings.xml
+++ b/launcher/app/src/main/res/values-th/strings.xml
@@ -68,4 +68,7 @@
</plurals>
<string name="greeting_with_name">%1$s %2$s</string>
<string name="game_live">กำลังถ่ายทอดสด</string>
+ <string name="clock_format_system">ระบบ</string>
+ <string name="clock_format_12">12 ชั่วโมง</string>
+ <string name="clock_format_24">24 ชั่วโมง</string>
</resources>
diff --git a/launcher/app/src/main/res/values-tr/strings.xml b/launcher/app/src/main/res/values-tr/strings.xml
index a3ebd4e15..5fff8205a 100644
--- a/launcher/app/src/main/res/values-tr/strings.xml
+++ b/launcher/app/src/main/res/values-tr/strings.xml
@@ -94,4 +94,7 @@
</plurals>
<string name="greeting_with_name">%1$s, %2$s</string>
<string name="game_live">Şimdi canlı</string>
+ <string name="clock_format_system">Sistem</string>
+ <string name="clock_format_12">12 saat</string>
+ <string name="clock_format_24">24 saat</string>
</resources>
diff --git a/launcher/app/src/main/res/values-uk/strings.xml b/launcher/app/src/main/res/values-uk/strings.xml
index 31e5a3862..291d8ce98 100644
--- a/launcher/app/src/main/res/values-uk/strings.xml
+++ b/launcher/app/src/main/res/values-uk/strings.xml
@@ -150,4 +150,7 @@
last opened, e.g. "5 minutes ago" or "yesterday, 9:40 pm". -->
<string name="last_opened">Востаннє відкрито %1$s</string>
<string name="game_live">Наживо зараз</string>
+ <string name="clock_format_system">Системний</string>
+ <string name="clock_format_12">12-годинний</string>
+ <string name="clock_format_24">24-годинний</string>
</resources>
diff --git a/launcher/app/src/main/res/values-uz/strings.xml b/launcher/app/src/main/res/values-uz/strings.xml
index bf0ad4ff5..f4c1ff14f 100644
--- a/launcher/app/src/main/res/values-uz/strings.xml
+++ b/launcher/app/src/main/res/values-uz/strings.xml
@@ -111,4 +111,7 @@
<string name="race_finished">Marra</string>
<string name="last_opened">Oxirgi marta ochilgan: %1$s</string>
<string name="game_live">Hozir jonli</string>
+ <string name="clock_format_system">Tizim</string>
+ <string name="clock_format_12">12 soatlik</string>
+ <string name="clock_format_24">24 soatlik</string>
</resources>
diff --git a/launcher/app/src/main/res/values-vi/strings.xml b/launcher/app/src/main/res/values-vi/strings.xml
index 1546901db..99606bc42 100644
--- a/launcher/app/src/main/res/values-vi/strings.xml
+++ b/launcher/app/src/main/res/values-vi/strings.xml
@@ -122,4 +122,7 @@
<string name="last_opened">Mở lần cuối %1$s</string>
<string name="tile_move">Di chuyển</string>
<string name="game_live">Đang diễn ra</string>
+ <string name="clock_format_system">Hệ thống</string>
+ <string name="clock_format_12">12 giờ</string>
+ <string name="clock_format_24">24 giờ</string>
</resources>
diff --git a/launcher/app/src/main/res/values-zh-rCN/strings.xml b/launcher/app/src/main/res/values-zh-rCN/strings.xml
index 2444a50ef..f7b0c5166 100644
--- a/launcher/app/src/main/res/values-zh-rCN/strings.xml
+++ b/launcher/app/src/main/res/values-zh-rCN/strings.xml
@@ -147,4 +147,7 @@
<string name="tile_move">移动</string>
<string name="tile_replace_in_dock">替换为其他应用</string>
<string name="game_live">直播中</string>
+ <string name="clock_format_system">系统</string>
+ <string name="clock_format_12">12 小时制</string>
+ <string name="clock_format_24">24 小时制</string>
</resources>
\ No newline at end of file
diff --git a/launcher/app/src/main/res/values-zh-rTW/strings.xml b/launcher/app/src/main/res/values-zh-rTW/strings.xml
index 8cff1e8a0..bfd41f618 100644
--- a/launcher/app/src/main/res/values-zh-rTW/strings.xml
+++ b/launcher/app/src/main/res/values-zh-rTW/strings.xml
@@ -94,4 +94,7 @@
</plurals>
<string name="greeting_with_name">%1$s,%2$s</string>
<string name="game_live">直播中</string>
+ <string name="clock_format_system">系統</string>
+ <string name="clock_format_12">12 小時制</string>
+ <string name="clock_format_24">24 小時制</string>
</resources>
diff --git a/launcher/app/src/main/res/values/strings.xml b/launcher/app/src/main/res/values/strings.xml
index e65576620..16c04e14d 100644
--- a/launcher/app/src/main/res/values/strings.xml
+++ b/launcher/app/src/main/res/values/strings.xml
@@ -154,4 +154,7 @@
<string name="last_opened">Last opened %1$s</string>
<!-- game_day: a game on now, in the race panel. -->
<string name="game_live">Live now</string>
+ <string name="clock_format_system">System</string>
+ <string name="clock_format_12">12-hour</string>
+ <string name="clock_format_24">24-hour</string>
</resources>
diff --git a/launcher/app/src/test/java/com/gathin/tvhome/ClockFormatTest.java b/launcher/app/src/test/java/com/gathin/tvhome/ClockFormatTest.java
new file mode 100644
index 000000000..32aa43125
--- /dev/null
+++ b/launcher/app/src/test/java/com/gathin/tvhome/ClockFormatTest.java
@@ -0,0 +1,16 @@
+package com.gathin.tvhome;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class ClockFormatTest {
+
+ @Test
+ public void aChosenFormatWinsWithoutAskingTheTv() {
+ // A null context would throw if the TV's own setting were read.
+ assertTrue(ClockFormat.is24(null, "24"));
+ assertFalse(ClockFormat.is24(null, "12"));
+ }
+}
diff --git a/themes/README.md b/themes/README.md
index 12d643424..d5ca53a1f 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -133,6 +133,7 @@ A new key needs one there in the same pull request.
| `home_long_press_home` | bool | Every Home press opens Home, a held one too. Android turns a Home press held past 400 ms into ALL_APPS for the system-image launcher, which nothing answers once the stock launcher is disabled, so a firm press on a slow remote did nothing (Philips TPM191E, Android 12, where `long_press_timeout` does not move that limit). Needs `key_filter` (`HOME_KEY_SERVICE=1`), so held keys such as Volume Up/Down stop repeating, confirmed on that Philips; single presses still step. Off by default |
| `power_on_home_always` | bool | Home at every power-on, whatever the TV put in front: the last HDMI input, Live TV or an app, for TVs that come back to the last source (Philips). Unlike `power_on_home`, it does not wait for a window to show: the Home screen comes up about a second after the screen turns on (`HOME_KEY_SERVICE=1`). A key pressed before that wins. Ignored with `boot_to_live_tv`, or with an Open on start app. Off by default |
| `inputs_connected_only` | bool | The Inputs list shows only HDMI ports and CEC devices that report connected; empty ports, the AV jacks and devices asleep in standby fold behind a "More inputs" row that expands them. Some TVs (TCL) report an empty HDMI port as connected-standby, the same state a sleeping device has, so a device in standby is folded too. An HDMI row whose state the TV cannot be trusted with stays (`false` by default) |
+| `clock_format` | `12`, `24` or `system` | The launcher's clocks (Home and the clock screensaver) in 12- or 24-hour time whatever the TV is set to; `system` (the default) follows the TV. Launcher settings' Clock row sets it too |
| `race_calendar` | list of races | F1 race-weekend mode: from 12 hours before a weekend's first session until 4 hours after the race starts, a panel under the clock shows the next session with a countdown (or the live one) and the weekend's session times in the TV's time zone. Write it with `tools/venv/bin/python -I tools/race_calendar.py <theme folder>`, which fetches the season from the free Jolpica API; the launcher itself never goes online |
| `home_idle_clock_minutes` | 0 to 1440 | Minutes Home may sit untouched before it shows the clock screensaver (a thin clock and date drifting over a slow glow, as the system "Clock" screensaver does). Any key returns to Home. It starts only from Home, never over Live TV or an app; 0 is off (default) |
| `clock_wallpaper` | bool | The clock screensaver over Home's wallpaper instead of black with a coloured glow; the clock still moves every minute (`false` by default) |