mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 05:46:03 +00:00
feat(session): manual pause button in the session menu for every suspend policy
This commit is contained in:
1 parent
4ef6b53eb0
commit
c5cd52b5c9
5 files changed
+67
-14
No files matched your search
@@ -38,6 +38,7 @@ import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.material.icons.outlined.DesktopWindows
|
||||
import androidx.compose.material.icons.outlined.Layers
|
||||
import androidx.compose.material.icons.outlined.ScreenShare
|
||||
import androidx.compose.material.icons.outlined.Pause
|
||||
import androidx.compose.material.icons.outlined.PictureInPictureAlt
|
||||
import androidx.compose.material.icons.automirrored.outlined.ExitToApp
|
||||
import androidx.compose.material.icons.outlined.Settings
|
||||
@@ -285,6 +286,7 @@ class DrawerActions(
|
||||
val pipSupported: Boolean = false,
|
||||
val pipAutoEnter: Boolean = false,
|
||||
val onPip: () -> Unit = {},
|
||||
val onPause: () -> Unit = {},
|
||||
val onPipAutoEnter: (Boolean) -> Unit = {},
|
||||
val unfoldedControls: Boolean? = null,
|
||||
val onUnfoldedControls: (Boolean) -> Unit = {},
|
||||
@@ -427,17 +429,15 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
}
|
||||
.padding(12.dp),
|
||||
) {
|
||||
val title = a.title ?: if (a.steam) stringResource(R.string.drawer_steam) else stringResource(R.string.drawer_desktop)
|
||||
if (narrow) Text(title, fontSize = 18.sp, fontWeight = FontWeight.Bold,
|
||||
color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.fillMaxWidth().padding(bottom = 6.dp))
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
modifier = Modifier.fillMaxWidth().heightIn(min = 44.dp),
|
||||
) {
|
||||
if (narrow) Spacer(Modifier.weight(1f)) else Text(title, fontSize = 18.sp, fontWeight = FontWeight.Bold,
|
||||
color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))
|
||||
Spacer(Modifier.weight(1f))
|
||||
SteamActionPill(
|
||||
stringResource(R.string.stores_dl_pause), Icons.Outlined.Pause, focus.track(page, "pause"),
|
||||
) { host.open = null; a.onPause() }
|
||||
if (a.pipSupported) SteamActionPill(
|
||||
stringResource(R.string.pip_title), Icons.Outlined.PictureInPictureAlt, focus.track(page, "pip"),
|
||||
) { host.open = null; a.onPip() }
|
||||
|
||||
@@ -77,6 +77,7 @@ class PausedFrame(val image: ImageBitmap, val bounds: android.graphics.Rect)
|
||||
|
||||
private const val CARD_SCALE = 0.82f
|
||||
private const val FRAME_WAIT_MS = 600L
|
||||
private val PopEasing = CubicBezierEasing(0.3f, 1.5f, 0.4f, 1f)
|
||||
|
||||
private fun tone(saturation: Float, brightness: Float): ColorMatrix =
|
||||
ColorMatrix().apply {
|
||||
@@ -90,6 +91,7 @@ fun SessionPausedOverlay(
|
||||
engaged: Boolean,
|
||||
failures: Int,
|
||||
frame: PausedFrame?,
|
||||
animateIn: Boolean,
|
||||
title: String,
|
||||
onResume: () -> Unit,
|
||||
onFrameNeeded: () -> Unit,
|
||||
@@ -106,6 +108,14 @@ fun SessionPausedOverlay(
|
||||
LaunchedEffect(suspended, engaged) {
|
||||
when {
|
||||
suspended && !engaged -> {
|
||||
if (!shown && animateIn) {
|
||||
shown = true
|
||||
launch { press.animateTo(1f, Motion.sp(0.5f, Spring.StiffnessMedium)) }
|
||||
launch { ring.animateTo(0f, Motion.tw(200)) }
|
||||
launch { lift.animateTo(1f, Motion.tw(520)) }
|
||||
orb.animateTo(1f, Motion.tw(380, delay = if (orb.value < 0.5f) 260 else 0, easing = PopEasing))
|
||||
return@LaunchedEffect
|
||||
}
|
||||
if (!shown) {
|
||||
if (currentFrame == null) {
|
||||
onFrameNeeded()
|
||||
|
||||
Reference in new issue
Block a user