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
On-TV wallpaper picker from the theme wallpapers/ collection
PatrickNoFilter33c26e508754
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/Config.java b/launcher/app/src/main/java/com/gathin/tvhome/Config.javaindex 96f18aae5..2b143dcd8 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/Config.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/Config.java@@ -32,6 +32,7 @@ final class Config {static final String FILE_NAME = "config.json";static final String WALLPAPER_NAME = "wallpaper.jpg";static final String SETTINGS_NAME = "launcher_settings";+ static final String WALLPAPER_CHOICE_KEY = "wallpaper_choice";private static final String THEME_REVISION_NAME = "theme_revision";private static final String THEME_SIGNATURE_KEY = "theme_signature";@@ -230,6 +231,25 @@ final class Config {wallpapers.addAll(WallpaperRotation.images(new File(dir, "wallpapers")));}if (wallpapers.isEmpty() && wallpaper != null) wallpapers.add(wallpaper);+ // An on-TV wallpaper pick overrides the theme: a filename from the wallpapers/+ // collection, or "none". Unset means the theme decides (off by default).+ String wallpaperChoice = choices.getString(WALLPAPER_CHOICE_KEY, null);+ if ("none".equals(wallpaperChoice)) {+ wallpapers.clear();+ wallpaper = null;+ wallpaperEnabled = false;+ } else if (wallpaperChoice != null && dir != null) {+ File picked = WallpaperRotation.find(+ WallpaperRotation.images(new File(dir, "wallpapers")), wallpaperChoice);+ if (picked == null && wallpaperChoice.equals(+ wallpaper != null ? wallpaper.getName() : "")) picked = wallpaper;+ if (picked != null) {+ wallpapers.clear();+ wallpapers.add(picked);+ wallpaper = picked;+ wallpaperEnabled = true;+ }+ }// A festive skin comes only from a theme; config.xml has no festival.Festival festival = json == null ? Festival.NONE : Festival.parse(string(json, "festival", ""),string(json, "festival_until", ""), string(json, "greeting", ""), string(json, "accent_color", ""));@@ -252,10 +272,11 @@ final class Config {// explicit theme push or reset by the updated tools.SharedPreferences.Editor editor = choices.edit();if (!"absent".equals(token)) editor.remove("columns").remove("animations")- .remove("advanced_effects");+ .remove("advanced_effects").remove(WALLPAPER_CHOICE_KEY);editor.putString(THEME_SIGNATURE_KEY, signature).commit();} else if (!seen.equals(signature)) {choices.edit().remove("columns").remove("animations").remove("advanced_effects")+ .remove(WALLPAPER_CHOICE_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.javaindex fe5b5e504..a573cbc3b 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/LauncherSettingsActivity.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/LauncherSettingsActivity.java@@ -11,10 +11,14 @@ import android.widget.LinearLayout;import android.widget.TextView;import android.widget.Toast;+import java.io.File;+import java.util.List;+/** Remote-friendly settings owned by the launcher; system settings stay one row away. */public final class LauncherSettingsActivity extends Activity {private SharedPreferences choices;private final TextView[] columnChoices = new TextView[4];+ private TextView wallpaperChoice;private TextView animationsChoice;private TextView advancedChoice;private TextView followThemeChoice;@@ -51,6 +55,8 @@ public final class LauncherSettingsActivity extends Activity {row.removeAllViews();for (int i = columnChoices.length - 1; i >= 0; i--) row.addView(columnChoices[i]);}+ wallpaperChoice = findViewById(R.id.wallpaperChoice);+ wallpaperChoice.setOnClickListener(v -> showWallpaperPicker());animationsChoice = findViewById(R.id.animationsChoice);animationsChoice.setOnClickListener(v -> {animations = !animations;@@ -76,7 +82,8 @@ public final class LauncherSettingsActivity extends Activity {followThemeChoice = findViewById(R.id.followThemeChoice);followThemeChoice.setOnClickListener(v -> {if (!hasOnTvChoices()) return;- choices.edit().remove("columns").remove("animations").remove("advanced_effects").commit();+ choices.edit().remove("columns").remove("animations").remove("advanced_effects")+ .remove(Config.WALLPAPER_CHOICE_KEY).commit();Config current = Config.load(this);columns = current.columns;animations = current.animations;@@ -94,6 +101,47 @@ public final class LauncherSettingsActivity extends Activity {columnChoices[Math.max(0, Math.min(columns - 4, 3))].requestFocus();}+ private void showWallpaperPicker() {+ File dir = Config.dir(this);+ List<File> images = WallpaperRotation.images(+ dir == null ? null : new File(dir, "wallpapers"));+ String[] labels = new String[images.size() + 1];+ for (int i = 0; i < images.size(); i++) labels[i] = images.get(i).getName();+ labels[images.size()] = getString(R.string.wallpaper_none);+ String current = choices.getString(Config.WALLPAPER_CHOICE_KEY, null);+ int checked = "none".equals(current) ? images.size()+ : indexOf(images, current);+ new AlertDialog.Builder(this)+ .setTitle(R.string.wallpaper_label)+ .setSingleChoiceItems(labels, checked, (dialog, which) -> {+ dialog.dismiss();+ if (which == images.size()) {+ choices.edit().putString(Config.WALLPAPER_CHOICE_KEY, "none").apply();+ } else {+ choices.edit().putString(Config.WALLPAPER_CHOICE_KEY,+ images.get(which).getName()).apply();+ }+ setResult(RESULT_OK);+ Toast.makeText(this, R.string.wallpaper_applied, Toast.LENGTH_SHORT).show();+ refresh();+ })+ .setNeutralButton(R.string.wallpaper_theme_default, (dialog, which) -> {+ choices.edit().remove(Config.WALLPAPER_CHOICE_KEY).apply();+ setResult(RESULT_OK);+ refresh();+ })+ .setNegativeButton(android.R.string.cancel, null)+ .show();+ }++ private static int indexOf(List<File> images, String name) {+ if (name == null) return -1;+ for (int i = 0; i < images.size(); i++) {+ if (images.get(i).getName().equals(name)) return i;+ }+ return -1;+ }+private void setAdvanced(boolean enabled) {advancedEffects = enabled;choices.edit().putBoolean("advanced_effects", enabled).apply();@@ -111,12 +159,18 @@ public final class LauncherSettingsActivity extends Activity {getString(advancedEffects ? R.string.on : R.string.off)));advancedChoice.setEnabled(animations);advancedChoice.setAlpha(animations ? 1f : 0.5f);+ String wallpaperCurrent = choices.getString(Config.WALLPAPER_CHOICE_KEY, null);+ wallpaperChoice.setText(getString(R.string.wallpaper_state,+ "none".equals(wallpaperCurrent) ? getString(R.string.wallpaper_none)+ : wallpaperCurrent != null ? wallpaperCurrent+ : getString(R.string.wallpaper_theme_default)));followThemeChoice.setSelected(!hasOnTvChoices());}private boolean hasOnTvChoices() {return choices.contains("columns") || choices.contains("animations")- || choices.contains("advanced_effects");+ || choices.contains("advanced_effects")+ || choices.contains(Config.WALLPAPER_CHOICE_KEY);}private void open(Intent intent) {diff --git a/launcher/app/src/main/res/layout/activity_launcher_settings.xml b/launcher/app/src/main/res/layout/activity_launcher_settings.xmlindex b78da53aa..063d27b28 100644--- a/launcher/app/src/main/res/layout/activity_launcher_settings.xml+++ b/launcher/app/src/main/res/layout/activity_launcher_settings.xml@@ -41,6 +41,11 @@<TextView android:id="@+id/columns7" style="@style/SettingsColumnChoice" android:text="7" /></LinearLayout>+ <TextView+ android:id="@+id/wallpaperChoice"+ style="@style/SettingsRow"+ android:layout_marginTop="28dp" />+<TextViewandroid:id="@+id/animationsChoice"style="@style/SettingsRow"diff --git a/launcher/app/src/main/res/values-iw/strings.xml b/launcher/app/src/main/res/values-iw/strings.xmlindex 82e6ddd43..b8d042705 100644--- a/launcher/app/src/main/res/values-iw/strings.xml+++ b/launcher/app/src/main/res/values-iw/strings.xml@@ -88,4 +88,9 @@<item quantity="other">%1$d אפליקציות</item></plurals><string name="greeting_with_name">%1$s, %2$s</string>+ <string name="wallpaper_label">טפט</string>+ <string name="wallpaper_state">טפט: %1$s</string>+ <string name="wallpaper_none">ללא</string>+ <string name="wallpaper_applied">הטפט שונה</string>+ <string name="wallpaper_theme_default">ברירת המחדל של ערכת הנושא</string></resources>diff --git a/launcher/app/src/main/res/values/strings.xml b/launcher/app/src/main/res/values/strings.xmlindex 454dba403..c55773db2 100644--- a/launcher/app/src/main/res/values/strings.xml+++ b/launcher/app/src/main/res/values/strings.xml@@ -31,6 +31,11 @@<string name="home_settings_help">Select your original home to stop using CleanYourTV as Home, or CleanYourTV to switch back. The original launcher must be enabled and your TV must provide a home picker; use the restore script first if it was disabled.</string><string name="launcher_settings">Launcher settings</string><string name="columns_label">Apps per row</string>+ <string name="wallpaper_label">Wallpaper</string>+ <string name="wallpaper_state">Wallpaper: %1$s</string>+ <string name="wallpaper_none">None</string>+ <string name="wallpaper_applied">Wallpaper changed</string>+ <string name="wallpaper_theme_default">Theme default</string><string name="animations_state">Animations: %1$s</string><string name="advanced_effects">Advanced effects</string><string name="advanced_effects_state">Advanced effects: %1$s</string>