Skip to content

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

launcher: less overdraw, no window background and no card fill under opaque banners

simea658e1da97c
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 5b9d07153..11693851d 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java
@@ -12,6 +12,7 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Outline;
+import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
@@ -405,6 +406,9 @@ public class AppAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
h.card.setTranslationZ(focused && advancedEffects ? 8f * ctx.getResources().getDisplayMetrics().density : 0f);
h.banner.setScaleX(focused && advancedEffects ? 1.035f : 1f);
h.banner.setScaleY(focused && advancedEffects ? 1.035f : 1f);
+ // A fully opaque banner covers the whole card (centerCrop), so the card's own fill under it is drawn for
+ // nothing on every frame; keep it under banners with transparent parts and under icon tiles.
+ h.card.setBackground(e.banner != null && e.banner.getOpacity() == PixelFormat.OPAQUE ? null : h.cardBackground);
if (e.banner != null) {
h.banner.setImageDrawable(e.banner);
h.banner.setVisibility(View.VISIBLE);
@@ -626,6 +630,8 @@ public class AppAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
static final class Holder extends RecyclerView.ViewHolder {
final View card;
+ /** item_app.xml's tile_bg: the dark card behind an icon tile, or behind a banner that has transparent parts. */
+ final Drawable cardBackground;
final ImageView banner;
final ImageView icon;
final TextView label;
@@ -638,6 +644,7 @@ public class AppAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
boolean reducedMotion) {
super(v);
card = v.findViewById(R.id.card);
+ cardBackground = card.getBackground();
banner = v.findViewById(R.id.banner);
icon = v.findViewById(R.id.icon);
label = v.findViewById(R.id.label);
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 c38133eec..a192ba00b 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -292,6 +292,10 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
root = findViewById(R.id.root);
root.setBackgroundColor(cfg.backgroundColor);
+ // root fills the window with an opaque colour (Config keeps background_color opaque), so the window's own
+ // black under it is a second full-screen fill on every frame for nothing. The starting window still uses
+ // the theme's background, so launch looks the same.
+ getWindow().setBackgroundDrawable(null);
wallpaperPlayer = new WallpaperPlayer(this, root, cfg);
sky = findViewById(R.id.sky);
sky.setIntensity(cfg.skyIntensity);