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
Launcher: build each font weight once, tint the glow instead of repainting it
leovvay4cc83ce1ecb3
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.javaindex 499018535..44b04b2d5 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java@@ -199,6 +199,9 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {if (cfg.wallpaper != null) showWallpaper(cfg.wallpaper);glass = findViewById(R.id.glass);ambient = findViewById(R.id.ambient);+ // The glow is one bitmap, so its alpha can be applied while drawing it. Otherwise every frame of+ // a fade renders it into a full-screen offscreen buffer first.+ ambient.forceHasOverlappingRendering(false);heroName = findViewById(R.id.heroName);greeting = findViewById(R.id.greeting);btnWifi = findViewById(R.id.btnWifi);@@ -599,26 +602,31 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {* The glow used to be a full-screen radial GradientDrawable. On Android 10 that drawable is* drawn on the CPU, so fading it for half a second redrew 1920×1080 every frame and the* highlight looked like it was running at a few frames per second. A small bitmap stretched- * over the screen is one texture; changing apps only uploads it once.+ * over the screen is one texture. It is painted once in white and tinted with the app's colour,+ * so changing apps neither repaints it on the CPU (about 11 ms) nor uploads it again.*/private void setAmbient(int color) {if (color == ambientColor && ambient.getBackground() != null) return;ambientColor = color;- int c = color & 0x00FFFFFF;- int w = 480;- int h = 270;- Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);- Canvas canvas = new Canvas(bmp);- Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);- paint.setShader(new RadialGradient(- w * 0.32f, h * 0.42f, w * 0.62f,- new int[]{0x5C000000 | c, 0x26000000 | c, 0x00000000 | c},- new float[]{0f, 0.45f, 1f},- Shader.TileMode.CLAMP));- canvas.drawRect(0, 0, w, h, paint);- BitmapDrawable drawable = new BitmapDrawable(getResources(), bmp);- drawable.setGravity(Gravity.FILL);- ambient.setBackground(drawable);+ BitmapDrawable glow = (BitmapDrawable) ambient.getBackground();+ if (glow == null) {+ int w = 480;+ int h = 270;+ Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);+ Canvas canvas = new Canvas(bmp);+ Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);+ paint.setShader(new RadialGradient(+ w * 0.32f, h * 0.42f, w * 0.62f,+ new int[]{0x5CFFFFFF, 0x26FFFFFF, 0x00FFFFFF},+ new float[]{0f, 0.45f, 1f},+ Shader.TileMode.CLAMP));+ canvas.drawRect(0, 0, w, h, paint);+ glow = new BitmapDrawable(getResources(), bmp);+ glow.setGravity(Gravity.FILL);+ ambient.setBackground(glow);+ }+ // The default tint mode, SRC_IN, keeps the mask's alpha and takes the colour from the tint.+ glow.setTint(0xFF000000 | color);}private void hideHero() {diff --git a/launcher/app/src/main/res/font/outfit_extralight.xml b/launcher/app/src/main/res/font/outfit_extralight.xmlnew file mode 100644index 000000000..397e29898--- /dev/null+++ b/launcher/app/src/main/res/font/outfit_extralight.xml@@ -0,0 +1,13 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Outfit at weight 200, built once per process. android:fontVariationSettings on each TextView rebuilt+ the variable font for every view (about 10 ms each on a TV CPU). Android 8 ignores the weight here, as+ it did on the views, and draws the default instance. -->+<font-family xmlns:android="http://schemas.android.com/apk/res/android"+ xmlns:tools="http://schemas.android.com/tools">+ <font+ android:font="@font/outfit"+ android:fontStyle="normal"+ android:fontWeight="200"+ android:fontVariationSettings="'wght' 200"+ tools:targetApi="28" />+</font-family>diff --git a/launcher/app/src/main/res/font/outfit_light.xml b/launcher/app/src/main/res/font/outfit_light.xmlnew file mode 100644index 000000000..36338658a--- /dev/null+++ b/launcher/app/src/main/res/font/outfit_light.xml@@ -0,0 +1,13 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Outfit at weight 300, built once per process. android:fontVariationSettings on each TextView rebuilt+ the variable font for every view (about 10 ms each on a TV CPU). Android 8 ignores the weight here, as+ it did on the views, and draws the default instance. -->+<font-family xmlns:android="http://schemas.android.com/apk/res/android"+ xmlns:tools="http://schemas.android.com/tools">+ <font+ android:font="@font/outfit"+ android:fontStyle="normal"+ android:fontWeight="300"+ android:fontVariationSettings="'wght' 300"+ tools:targetApi="28" />+</font-family>diff --git a/launcher/app/src/main/res/font/outfit_medium.xml b/launcher/app/src/main/res/font/outfit_medium.xmlnew file mode 100644index 000000000..18d769913--- /dev/null+++ b/launcher/app/src/main/res/font/outfit_medium.xml@@ -0,0 +1,13 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Outfit at weight 500, built once per process. android:fontVariationSettings on each TextView rebuilt+ the variable font for every view (about 10 ms each on a TV CPU). Android 8 ignores the weight here, as+ it did on the views, and draws the default instance. -->+<font-family xmlns:android="http://schemas.android.com/apk/res/android"+ xmlns:tools="http://schemas.android.com/tools">+ <font+ android:font="@font/outfit"+ android:fontStyle="normal"+ android:fontWeight="500"+ android:fontVariationSettings="'wght' 500"+ tools:targetApi="28" />+</font-family>diff --git a/launcher/app/src/main/res/font/outfit_regular.xml b/launcher/app/src/main/res/font/outfit_regular.xmlnew file mode 100644index 000000000..1550b02e6--- /dev/null+++ b/launcher/app/src/main/res/font/outfit_regular.xml@@ -0,0 +1,13 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Outfit at weight 400, built once per process. android:fontVariationSettings on each TextView rebuilt+ the variable font for every view (about 10 ms each on a TV CPU). Android 8 ignores the weight here, as+ it did on the views, and draws the default instance. -->+<font-family xmlns:android="http://schemas.android.com/apk/res/android"+ xmlns:tools="http://schemas.android.com/tools">+ <font+ android:font="@font/outfit"+ android:fontStyle="normal"+ android:fontWeight="400"+ android:fontVariationSettings="'wght' 400"+ tools:targetApi="28" />+</font-family>diff --git a/launcher/app/src/main/res/layout/activity_main.xml b/launcher/app/src/main/res/layout/activity_main.xmlindex 91346acf5..e4a507024 100644--- a/launcher/app/src/main/res/layout/activity_main.xml+++ b/launcher/app/src/main/res/layout/activity_main.xml@@ -21,8 +21,7 @@android:alpha="0"android:textColor="#FFFFFFFF"android:textSize="48sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 300"+ android:fontFamily="@font/outfit_light"android:letterSpacing="-0.02"android:includeFontPadding="false"android:singleLine="true" />@@ -61,8 +60,7 @@android:layout_marginStart="4dp"android:textColor="#8CFFFFFF"android:textSize="12sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 500"+ android:fontFamily="@font/outfit_medium"android:letterSpacing="0.22"android:textAllCaps="true" />@@ -80,8 +78,7 @@android:format24Hour="HH:mm"android:textColor="#FFFFFFFF"android:textSize="52sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 300"+ android:fontFamily="@font/outfit_light"android:letterSpacing="-0.04"android:includeFontPadding="false" />@@ -96,8 +93,7 @@android:format24Hour=""android:textColor="#B3FFFFFF"android:textSize="15sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 500"+ android:fontFamily="@font/outfit_medium"android:letterSpacing="0.08"android:textAllCaps="true" />@@ -128,8 +124,7 @@android:ellipsize="end"android:textColor="#E6FFFFFF"android:textSize="17sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 400"+ android:fontFamily="@font/outfit_regular"android:letterSpacing="0.02"android:includeFontPadding="false"android:visibility="gone" />@@ -145,8 +140,7 @@android:format24Hour="@string/date_format"android:textColor="#A6FFFFFF"android:textSize="14sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 400"+ android:fontFamily="@font/outfit_regular"android:letterSpacing="0.14"android:textAllCaps="true" /></LinearLayout>diff --git a/launcher/app/src/main/res/layout/dialog_card_prompt.xml b/launcher/app/src/main/res/layout/dialog_card_prompt.xmlindex 96a685d11..39ef5b13c 100644--- a/launcher/app/src/main/res/layout/dialog_card_prompt.xml+++ b/launcher/app/src/main/res/layout/dialog_card_prompt.xml@@ -20,8 +20,7 @@android:ellipsize="end"android:textColor="#FFFFFFFF"android:textSize="22sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 500"+ android:fontFamily="@font/outfit_medium"android:letterSpacing="-0.01" /><TextViewdiff --git a/launcher/app/src/main/res/layout/dream_clock.xml b/launcher/app/src/main/res/layout/dream_clock.xmlindex cee80d52f..bfa0f2100 100644--- a/launcher/app/src/main/res/layout/dream_clock.xml+++ b/launcher/app/src/main/res/layout/dream_clock.xml@@ -29,8 +29,7 @@android:format24Hour="HH:mm"android:textColor="#E6FFFFFF"android:textSize="120sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 200"+ android:fontFamily="@font/outfit_extralight"android:letterSpacing="-0.04"android:includeFontPadding="false" />@@ -42,8 +41,7 @@android:format24Hour=""android:textColor="#99FFFFFF"android:textSize="22sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 500"+ android:fontFamily="@font/outfit_medium"android:letterSpacing="0.08"android:textAllCaps="true" /></LinearLayout>@@ -57,8 +55,7 @@android:format24Hour="@string/date_format"android:textColor="#8CFFFFFF"android:textSize="18sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 400"+ android:fontFamily="@font/outfit_regular"android:letterSpacing="0.14"android:textAllCaps="true" /></LinearLayout>diff --git a/launcher/app/src/main/res/layout/item_app.xml b/launcher/app/src/main/res/layout/item_app.xmlindex 19642d6f1..d6f9a1a21 100644--- a/launcher/app/src/main/res/layout/item_app.xml+++ b/launcher/app/src/main/res/layout/item_app.xml@@ -62,7 +62,6 @@android:translationY="-6dp"android:textColor="#F2FFFFFF"android:textSize="14sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 500"+ android:fontFamily="@font/outfit_medium"android:letterSpacing="0.02" /></FrameLayout>diff --git a/launcher/app/src/main/res/layout/item_card_row.xml b/launcher/app/src/main/res/layout/item_card_row.xmlindex ae2ca6790..2a72debec 100644--- a/launcher/app/src/main/res/layout/item_card_row.xml+++ b/launcher/app/src/main/res/layout/item_card_row.xml@@ -28,8 +28,7 @@android:textColor="@drawable/pill_text"android:duplicateParentState="true"android:textSize="15sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 500"+ android:fontFamily="@font/outfit_medium"android:singleLine="true"android:ellipsize="end" />diff --git a/launcher/app/src/main/res/layout/item_input.xml b/launcher/app/src/main/res/layout/item_input.xmlindex 7de4d65c1..6dba0bafc 100644--- a/launcher/app/src/main/res/layout/item_input.xml+++ b/launcher/app/src/main/res/layout/item_input.xml@@ -28,8 +28,7 @@android:textColor="@drawable/pill_text"android:duplicateParentState="true"android:textSize="15sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 500"+ android:fontFamily="@font/outfit_medium"android:singleLine="true" /><Viewdiff --git a/launcher/app/src/main/res/layout/popup_cards.xml b/launcher/app/src/main/res/layout/popup_cards.xmlindex 2818a689b..f80e64494 100644--- a/launcher/app/src/main/res/layout/popup_cards.xml+++ b/launcher/app/src/main/res/layout/popup_cards.xml@@ -19,8 +19,7 @@android:text="@string/module_cards"android:textColor="#8CFFFFFF"android:textSize="11sp"- android:fontFamily="@font/outfit"- android:fontVariationSettings="'wght' 500"+ android:fontFamily="@font/outfit_medium"android:letterSpacing="0.18"android:textAllCaps="true" />diff --git a/launcher/app/src/main/res/values-v28/styles.xml b/launcher/app/src/main/res/values-v28/styles.xmldeleted file mode 100644index 6d77e6537..000000000--- a/launcher/app/src/main/res/values-v28/styles.xml+++ /dev/null@@ -1,7 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<resources>- <!-- Font variation settings are available from Android 9 (API 28). -->- <style name="TopButton" parent="TopButtonBase">- <item name="android:fontVariationSettings">\'wght\' 500</item>- </style>-</resources>diff --git a/launcher/app/src/main/res/values/styles.xml b/launcher/app/src/main/res/values/styles.xmlindex 05fcc97aa..51ee30cea 100644--- a/launcher/app/src/main/res/values/styles.xml+++ b/launcher/app/src/main/res/values/styles.xml@@ -17,7 +17,7 @@<item name="android:background">@drawable/pill_bg</item><item name="android:textColor">@drawable/pill_text</item><item name="android:textSize">15sp</item>- <item name="android:fontFamily">@font/outfit</item>+ <item name="android:fontFamily">@font/outfit_medium</item><item name="android:letterSpacing">0.01</item><item name="android:drawablePadding">9dp</item><item name="android:drawableTint">@drawable/pill_text</item>