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
addons: TV Hub plays a channel when the app opens, off by default
venuprasath39005a2b5765
diff --git a/addons/tv-hub/README.md b/addons/tv-hub/README.mdindex 849c543f9..e4c88d58f 100644--- a/addons/tv-hub/README.md+++ b/addons/tv-hub/README.md@@ -35,6 +35,7 @@ itself is missing from the player screenshots because the TV keeps it out of scr| Installed live-TV apps | Shortcuts that open the app (Pluto TV, Tubi, Plex, Kodi, Channels, HDHomeRun, YouTube TV, Sling, Philo, Haystack, Live Channels, TiviMate, or any TV app you pick) || Guide | Programme grid, now and next, categories, favourites, recently watched, search, programme details || Player | Media3: HLS and progressive streams (MPEG-TS, MP4 and the other containers Media3 reads), channel up/down, previous channel, number entry, audio and subtitle tracks, recovery and fallback |+| Play a channel when the app opens | Off by default. On, the app opens straight into the player on the last channel watched, or the lowest channel number the first time, the way a set-top box does. Back from the player returns to the hub || Merging | Channels with the same `tvg-id` in several sources show once; the player falls back between their streams. Can be turned off || CleanYourTV module card | Declared per spec 1 (`res/xml/module_card.xml`) |@@ -89,6 +90,8 @@ the hub. Later, go to **Sources > Add a source**.**Check** reads a source once without saving, so a wrong address shows up straight away.+**Settings > Play a channel when the app opens** turns the hub into a set-top box: the app opens on the player rather than Home, resuming the last channel watched, or the lowest channel number on a first run. Channel numbers come from `tvg-chno` in the playlist; without them the channels are still there in list order, only number entry has nothing to match.+## Remote control| Where | Key | Does |@@ -140,6 +143,11 @@ MOKA R8G (Android 14, 1080p, 2 GB RAM): sources, guide, playback, fallback, favoshortcuts; results and what is still untested in [docs/TESTING.md](docs/TESTING.md). The card itselfwas checked in the built APK but not yet on a TV running this launcher.+Hisense HiSmartTV A4 (xiaoyushan, MStar m7322, Android TV 9 / SDK 28, firmware PTMR.190127.037,+1.8 GB RAM, armeabi-v7a): an M3U playlist of 106 channels with `tvg-chno`, guide, playback,+channel up/down, number entry, and **Play a channel when the app opens** from a cold start. The+module card was offered by the launcher and declined ("Keep hidden"), so the normal tile was used.+## BuildJDK 17 and the Android SDK (platform 34), as for the launcher:diff --git a/addons/tv-hub/app/src/main/java/io/github/maxhayim/tvhub/data/Prefs.kt b/addons/tv-hub/app/src/main/java/io/github/maxhayim/tvhub/data/Prefs.ktindex efa4c3e79..1207adcc5 100644--- a/addons/tv-hub/app/src/main/java/io/github/maxhayim/tvhub/data/Prefs.kt+++ b/addons/tv-hub/app/src/main/java/io/github/maxhayim/tvhub/data/Prefs.kt@@ -24,6 +24,14 @@ class Prefs(context: Context) {get() = p.getInt("refresh_hours", 12)set(v) = p.edit().putInt("refresh_hours", v).apply()+ /**+ * Play a channel as soon as the app opens, the way a set-top box does: the last channel watched,+ * or the lowest-numbered one the first time. Off by default, so the app still opens on Home.+ */+ var autoPlay: Boolean+ get() = p.getBoolean("auto_play", false)+ set(v) = p.edit().putBoolean("auto_play", v).apply()+var animations: Booleanget() = p.getBoolean("animations", true)set(v) = p.edit().putBoolean("animations", v).apply()diff --git a/addons/tv-hub/app/src/main/java/io/github/maxhayim/tvhub/ui/MainActivity.kt b/addons/tv-hub/app/src/main/java/io/github/maxhayim/tvhub/ui/MainActivity.ktindex 8377830c2..df640674e 100644--- a/addons/tv-hub/app/src/main/java/io/github/maxhayim/tvhub/ui/MainActivity.kt+++ b/addons/tv-hub/app/src/main/java/io/github/maxhayim/tvhub/ui/MainActivity.kt@@ -15,6 +15,7 @@ import io.github.maxhayim.tvhub.model.Channelimport io.github.maxhayim.tvhub.player.PlayerActivityimport io.github.maxhayim.tvhub.ui.Ui.dpimport kotlinx.coroutines.MainScope+import kotlinx.coroutines.flow.firstimport kotlinx.coroutines.cancelimport kotlinx.coroutines.launch@@ -38,6 +39,8 @@ class MainActivity : Activity() {* item (when the view that had it was rebuilt meanwhile). That must not switch the page.*/private var restoring = false+ /** "Play a channel when the app opens" has already fired for this launch. */+ private var autoPlayed = falseoverride fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)@@ -86,7 +89,12 @@ class MainActivity : Activity() {show(start)if (!repo.prefs.onboarded) startActivity(Intent(this, OnboardingActivity::class.java))- else repo.refreshIfStale()+ else {+ repo.refreshIfStale()+ // savedInstanceState == null: a fresh launch, not Android rebuilding the window, so+ // coming back from the player with Back leaves you on the hub instead of looping.+ if (savedInstanceState == null && repo.prefs.autoPlay) autoPlayWhenReady()+ }}override fun onResume() {@@ -150,6 +158,22 @@ class MainActivity : Activity() {fun go(p: Page) { navItems.getValue(p).requestFocus(); show(p); content.post { focusContent() } }+ /**+ * Start the player once the channels are in: the last channel watched, or the first of the list,+ * which ChannelMerger has already ordered by channel number. Waits rather than giving up, because+ * on a cold start the channels are still being read from the database.+ */+ private fun autoPlayWhenReady() {+ scope.launch {+ val all = repo.channels.first { it.isNotEmpty() }+ if (autoPlayed || isFinishing || isDestroyed) return@launch+ autoPlayed = true+ val last = repo.recents().firstOrNull()+ val index = last?.let { l -> all.indexOfFirst { it.key == l.key } }?.takeIf { it >= 0 } ?: 0+ play(all, index)+ }+ }+fun play(list: List<Channel>, index: Int) {if (list.isEmpty()) returnPlayerActivity.start(this, list, index)diff --git a/addons/tv-hub/app/src/main/java/io/github/maxhayim/tvhub/ui/SettingsScreen.kt b/addons/tv-hub/app/src/main/java/io/github/maxhayim/tvhub/ui/SettingsScreen.ktindex 535179ca8..d71a0f091 100644--- a/addons/tv-hub/app/src/main/java/io/github/maxhayim/tvhub/ui/SettingsScreen.kt+++ b/addons/tv-hub/app/src/main/java/io/github/maxhayim/tvhub/ui/SettingsScreen.kt@@ -35,6 +35,11 @@ class SettingsScreen(host: MainActivity) : Screen(host) {row("Refresh when the app opens", if (p.refreshHours == 0) "Never on its own; use Refresh" else "If the last refresh is older than ${p.refreshHours} hours. Nothing runs in the background") {p.refreshHours = when (p.refreshHours) { 6 -> 12; 12 -> 24; 24 -> 0; else -> 6 }; build()}+ row("Play a channel when the app opens",+ if (p.autoPlay) "On: the last channel watched, or the lowest number"+ else "Off: the app opens on Home") {+ p.autoPlay = !p.autoPlay; build()+ }row("Animations", if (p.animations) "On" else "Off: no zoom on focus and no scrolling motion, for slow TVs") {p.animations = !p.animations; build()}