mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-12 19:41:10 +00:00
Merge pull request #19 from The412Banner/remove-shade-default-home
This commit is contained in:
commit
45dd582a2c
2 files changed
-22
No files matched your search
@@ -20,7 +20,6 @@ import android.widget.FrameLayout
|
||||
import android.widget.Toast
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
@@ -107,11 +106,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
override fun onDisplayChanged(displayId: Int) = refreshSecondScreenDisplays()
|
||||
}
|
||||
private var isHomeApp by mutableStateOf(false)
|
||||
private var defaultHomeLabel by mutableStateOf<String?>(null)
|
||||
private var androidApps by mutableStateOf<List<HomeApp.LaunchableApp>>(emptyList())
|
||||
private val homeRoleRequest = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
||||
refreshHomeApp()
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the on-screen pad when nothing is plugged in and takes it away the moment something
|
||||
@@ -187,7 +182,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
SessionDrawer(drawerOpen, DrawerActions(
|
||||
steam = SessionState.mode == SessionService.MODE_STEAM,
|
||||
isHomeApp = isHomeApp,
|
||||
defaultHomeLabel = defaultHomeLabel,
|
||||
androidApps = androidApps,
|
||||
hudOn = hudOn,
|
||||
frameGenEngine = frameGenEngine, frameGenMultiplier = frameGenMultiplier,
|
||||
@@ -216,7 +210,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
onFexPreset = { v -> SessionPrefs.setFexPreset(this@SessionActivity, v); readPrefs() },
|
||||
onSecondScreenMode = ::selectSecondScreenMode,
|
||||
onSecondScreenDisplay = ::selectSecondScreenDisplay,
|
||||
onHomeApp = ::manageHomeApp,
|
||||
onLaunchAndroidApp = { app ->
|
||||
drawerOpen = false
|
||||
try {
|
||||
@@ -260,16 +253,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
|
||||
private fun refreshHomeApp() {
|
||||
isHomeApp = HomeApp.isDefault(this)
|
||||
defaultHomeLabel = HomeApp.defaultLabel(this)
|
||||
androidApps = if (isHomeApp) HomeApp.launchableApps(this) else emptyList()
|
||||
}
|
||||
|
||||
private fun manageHomeApp() {
|
||||
val request = HomeApp.roleRequestIntent(this)
|
||||
if (request != null) homeRoleRequest.launch(request)
|
||||
else HomeApp.openSystemHomeSettings(this)
|
||||
}
|
||||
|
||||
private fun sendSteamGuide() {
|
||||
drawerOpen = false
|
||||
padBridge?.applyTouch { state -> state.press(com.steamdeck.launcher.input.PadState.GUIDE, true) }
|
||||
|
||||
@@ -140,7 +140,6 @@ fun SessionPausedOverlay(onResume: () -> Unit) {
|
||||
class DrawerActions(
|
||||
val steam: Boolean,
|
||||
val isHomeApp: Boolean,
|
||||
val defaultHomeLabel: String?,
|
||||
val androidApps: List<HomeApp.LaunchableApp>,
|
||||
val hudOn: Boolean,
|
||||
val frameGenEngine: String,
|
||||
@@ -165,7 +164,6 @@ class DrawerActions(
|
||||
val onFexPreset: (String) -> Unit,
|
||||
val onSecondScreenMode: (SecondScreenMode) -> Unit,
|
||||
val onSecondScreenDisplay: (Int) -> Unit,
|
||||
val onHomeApp: () -> Unit,
|
||||
val onLaunchAndroidApp: (HomeApp.LaunchableApp) -> Unit,
|
||||
val onBackground: () -> Unit,
|
||||
val onStop: () -> Unit,
|
||||
@@ -269,12 +267,6 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
|
||||
}
|
||||
}
|
||||
|
||||
if (a.isHomeApp) {
|
||||
SettingsGroup("Home screen") {
|
||||
ActionRow("Default Home app", a.defaultHomeLabel?.let { "Currently using $it" }, "Change") { a.onHomeApp() }
|
||||
}
|
||||
}
|
||||
|
||||
SettingsGroup("Now") {
|
||||
ToggleRow(host, "hud", "Performance HUD", null, a.hudOn, onChange = a.onHud)
|
||||
val fgOpen = host.open == "fg"
|
||||
|
||||
Reference in new issue
Block a user