mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-11-10 16:02:25 +01:00
launcher: a POI or other non-media car app gets its own tile, not a Browse tile under Music
RF Sentinel ships a POI car screen plus a media service for its sound, and only showed up as a music app.
This commit is contained in:
1 parent
0afe857420
commit
e54fb08fc9
2 files changed
+12
-3
No files matched your search
@@ -125,7 +125,11 @@ internal object LauncherCache {
|
|||||||
// MediaBrowserService, which otherwise land as two identically-labeled tiles with no
|
// MediaBrowserService, which otherwise land as two identically-labeled tiles with no
|
||||||
// way to tell them apart. They're genuinely different screens - browsing versus Now
|
// way to tell them apart. They're genuinely different screens - browsing versus Now
|
||||||
// Playing - so only the label needs disambiguating, not the tile itself.
|
// Playing - so only the label needs disambiguating, not the tile itself.
|
||||||
val mediaPackages = mediaApps.map { it.component.packageName }.toSet()
|
// An app whose car screen is something else (RF Sentinel is a POI app) only uses its media
|
||||||
|
// service for sound: its car screen gets the tile, under its own name, and no player tile.
|
||||||
|
val otherScreens = navApps.filter { !it.isMediaScreen }.map { it.component.packageName }.toSet()
|
||||||
|
val allMedia = mediaApps.map { it.component.packageName }.toSet()
|
||||||
|
val mediaPackages = allMedia - otherScreens
|
||||||
|
|
||||||
val messagingApps = MessagingCatalog.installed(context)
|
val messagingApps = MessagingCatalog.installed(context)
|
||||||
// Google Messages ships its own car app, which won't start under Gearslip. Gearslip's
|
// Google Messages ships its own car app, which won't start under Gearslip. Gearslip's
|
||||||
@@ -142,10 +146,12 @@ internal object LauncherCache {
|
|||||||
val label = if (it.component.packageName in mediaPackages) "${it.label} · Browse" else it.label
|
val label = if (it.component.packageName in mediaPackages) "${it.label} · Browse" else it.label
|
||||||
Entry(label, iconOf(it.component.packageName), template = it)
|
Entry(label, iconOf(it.component.packageName), template = it)
|
||||||
}
|
}
|
||||||
val media = mediaApps.map { Entry(it.label, iconOf(it.component.packageName), media = it) }
|
val media = mediaApps
|
||||||
|
.filter { it.component.packageName !in otherScreens }
|
||||||
|
.map { Entry(it.label, iconOf(it.component.packageName), media = it) }
|
||||||
// A messenger that is also a car media app keeps only its player tile.
|
// A messenger that is also a car media app keeps only its player tile.
|
||||||
val messaging = messagingApps
|
val messaging = messagingApps
|
||||||
.filter { it.packageName !in mediaPackages }
|
.filter { it.packageName !in allMedia }
|
||||||
.map { Entry(it.label, iconOf(it.packageName), messaging = it) }
|
.map { Entry(it.label, iconOf(it.packageName), messaging = it) }
|
||||||
return (nav + media + messaging).sortedBy { it.label.lowercase() }.also { flow.value = it }
|
return (nav + media + messaging).sortedBy { it.label.lowercase() }.also { flow.value = it }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ class TemplateApp(
|
|||||||
) {
|
) {
|
||||||
val isNavigation: Boolean get() = CarAppService.CATEGORY_NAVIGATION_APP in categories
|
val isNavigation: Boolean get() = CarAppService.CATEGORY_NAVIGATION_APP in categories
|
||||||
|
|
||||||
|
/** A media car screen, or one that names no category (older media apps). */
|
||||||
|
val isMediaScreen: Boolean get() = kind == "media" || kind == "app"
|
||||||
|
|
||||||
/** "navigation", "media", ... - what the app told the system it is. */
|
/** "navigation", "media", ... - what the app told the system it is. */
|
||||||
val kind: String
|
val kind: String
|
||||||
get() = categories.firstOrNull { it.startsWith(CATEGORY_PREFIX) }
|
get() = categories.firstOrNull { it.startsWith(CATEGORY_PREFIX) }
|
||||||
|
|||||||
Reference in new issue
Block a user