Skip to content

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

feat(launcher): show custom input names and skip hidden inputs

Erick Mwamodo87d410f00912
diff --git a/README.md b/README.md
index 4da7c5a66..030a13e4b 100644
--- a/README.md
+++ b/README.md
@@ -87,7 +87,7 @@ screenshots pulled from the TV. With this repo as context it takes about fifteen
- **A top shelf** naming the focused app in large type, with an ambient glow in a colour taken from its artwork.
- **The rest of your apps in a grid** that slides up when you press Down.
- **One floating glass highlight** that springs from tile to tile. The focused tile lifts and shows its name.
-- **Three frosted buttons**: Inputs (HDMI ports, AV, Live TV), Wi-Fi or Ethernet with the network name, Settings.
+- **Three frosted buttons**: Inputs (HDMI ports under the names you gave them in the TV's settings, AV, Live TV), Wi-Fi or Ethernet with the network name, Settings.
- **A greeting, a thin clock and the date** in [Outfit](https://fonts.google.com/specimen/Outfit), and a matching Clock screensaver.
- **Themes** that change colours, wallpaper, dock and columns without a rebuild, and **module cards** that let other apps plug a tile in, only with your say-so.
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 d7c86c17d..c41635f88 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@ -1166,11 +1166,17 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {
tunerIsHw = hw;
}
}
- if (!info.isPassthroughInput()) continue;
+ // Inputs hidden in the TV's Settings > Inputs stay out of the menu too.
+ if (!info.isPassthroughInput() || info.isHidden(this)) continue;
CharSequence l = info.loadLabel(this);
String label = l == null ? info.getId() : l.toString();
boolean hdmi = info.getType() == TvInputInfo.TYPE_HDMI;
if (hdmi && !label.toUpperCase(Locale.ROOT).contains("HDMI")) label = "HDMI " + label;
+ // The name given in Settings > Inputs (e.g. "MacBook Pro") goes first, the port after it.
+ CharSequence custom = info.loadCustomLabel(this);
+ if (custom != null && custom.length() > 0 && !custom.toString().equals(label)) {
+ label = custom + " \u00B7 " + label;
+ }
final String id = info.getId();
int state = hdmi && hdmiStateBogus ? -1 : tim.getInputState(id);
if (!hdmi && rows.getChildCount() > 0 && !sawNonHdmi) addSeparator(rows);