Skip to content

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

Launcher: icon_tiles, apps drawn from their icon when their banner crops badly

Mahmoud Khalifa316471518fe2
diff --git a/docs/switches.md b/docs/switches.md
index 4bd483244..acdf98780 100644
--- a/docs/switches.md
+++ b/docs/switches.md
@@ -54,3 +54,4 @@ fits the rules; keys from before the rule sit on its wanted list until a screens
| `home_long_press_home` | <img src="switches/home_long_press_home.jpg" width="320" alt="home_long_press_home on a TV"> |
| `vpn_pill` | <img src="switches/vpn_pill.jpg" width="320" alt="vpn_pill on a TV"> |
| `power_on_home_always` | <img src="switches/power_on_home_always.jpg" width="320" alt="power_on_home_always 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"> |
diff --git a/docs/switches/icon_tiles.jpg b/docs/switches/icon_tiles.jpg
new file mode 100644
index 000000000..301343254
Binary files /dev/null and b/docs/switches/icon_tiles.jpg differ
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java b/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java
index 3632d74b0..41825a1af 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java
@@ -216,6 +216,8 @@ public class AppAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Map<String, String> appLabels, appBanners;
/** Every app tile is its icon on a card tinted from that icon, never its banner (config.xml, uniform_tiles). */
private final boolean uniformTiles;
+ /** Packages drawn from their icon and name even when they have a banner (config.xml icon_tiles). */
+ private final Set<String> iconTiles;
private final List<Entry> items = new ArrayList<>();
AppAdapter(Context ctx, TileListener listener, int dockSize, Config cfg) {
@@ -239,6 +241,7 @@ public class AppAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
this.restNameAlpha = cfg.alwaysShowNames ? 0.75f : 0f;
this.cinematic = cfg.cinematicHome;
this.launchActions = cfg.launchActions;
+ this.iconTiles = new HashSet<>(Arrays.asList(ctx.getResources().getStringArray(R.array.icon_tiles)));
this.tileMenu = cfg.tileMenu;
this.appLabels = cfg.appLabels;
this.appBanners = cfg.appBanners;
@@ -295,7 +298,7 @@ public class AppAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
// uniform_tiles draws the icon, so an app's banner is never loaded. A module card keeps its banner.
if (!(uniformTiles && card == null)) {
banner = bundledBanner(appBanners.get(pkg));
- if (banner == null) banner = loadBanner(pm, ri);
+ if (banner == null) banner = iconTiles.contains(pkg) ? iconBanner(ri.loadIcon(pm)) : loadBanner(pm, ri);
}
// The icon is only drawn (and sampled for the glow) when there is no banner, so a tile with a
// banner skips loading and decoding it.
@@ -340,6 +343,17 @@ public class AppAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
notifyDataSetChanged();
}
+ /** icon_tiles: the app's icon centred on a dark banner-shaped tile, for apps whose own banner crops badly. */
+ private Drawable iconBanner(Drawable icon) {
+ int w = 320, h = 180, side = 104;
+ android.graphics.Bitmap bmp = android.graphics.Bitmap.createBitmap(w, h, android.graphics.Bitmap.Config.ARGB_8888);
+ android.graphics.Canvas canvas = new android.graphics.Canvas(bmp);
+ canvas.drawColor(0xFF15202B);
+ icon.setBounds((w - side) / 2, (h - side) / 2, (w + side) / 2, (h + side) / 2);
+ icon.draw(canvas);
+ return new android.graphics.drawable.BitmapDrawable(ctx.getResources(), bmp);
+ }
+
/** A banner_* drawable bundled with the launcher, or null for none or a name that is not one. */
private Drawable bundledBanner(String name) {
if (name == null || !name.startsWith("banner_")) return null;
diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xml
index a9987423b..110671aa1 100644
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@ -468,4 +468,8 @@
faint outer glow), rim (the crisp rim alone, no sheen, fill or glow, for a quiet focus over a wallpaper) or
halo (the rim with a lighter outer glow). Can also be set with "glass_style": "rim" in a theme's config.json. -->
<string name="glass_style" translatable="false">glass</string>
+
+ <!-- Tiles drawn from the app's icon and name instead of its banner (for banners that crop badly). -->
+ <string-array name="icon_tiles" translatable="false">
+ </string-array>
</resources>
diff --git a/themes/README.md b/themes/README.md
index 0b416c67a..d5fd05fea 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -78,6 +78,7 @@ A new key needs one there in the same pull request.
| `wallpaper_true_color` | bool | Decode wallpapers in 32-bit colour (8 MB at 1080p) instead of RGB_565 (4 MB), which bands dark gradients such as a night sky; for TVs with 2 GB or more (`false` by default) |
| `app_library` | bool | An App library pill after the last Home row: every installed app, add one to Home or take it off (`false` by default). The choices stay on the TV when a theme is pushed or reset; see [docs/app-library.md](../docs/app-library.md) |
| `uniform_tiles` | bool | Each app tile is its icon on a card tinted from that icon, with the name only under the focused tile, instead of the app's own banner (`false` by default) |
+| `icon_tiles` | list of package names, `config.xml` only | Apps drawn from their icon and name instead of their banner, for banners that crop badly; empty by default. Not read from a theme |
| `app_library_selection` | bool | OK toggles Home checkmarks in the library; checked apps first, both groups alphabetized. Hiding keeps focus on the adjacent next app (previous at the end). Requires `app_library`; `false` preserves the standard open/long-press behavior |
| `library_ok_opens` | bool | OK opens every app in the library, not only the ones on Home, for a library that holds the apps `hidden_apps` keeps off Home; holding OK still offers Add to Home, and cards drop their "Add to Home" line. Requires `app_library`; `app_library_selection` wins when both are on; `false` by default |
| `library_apps` | list of package names | Packages pre-seeded into the App library's "added" set at startup (config.xml `library_apps`, or a theme's `config.json`). They show on Home as if the owner had added them in the App library UI, and stay removable there (a removed one stays hidden); empty (off) by default |