mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 06:15:58 +00:00
fix(session): let the portrait custom resolution dialog accept tall sizes
This commit is contained in:
4 files changed
+13
-4
No files matched your search
@@ -1313,7 +1313,7 @@ object SessionPrefs {
|
||||
return parseOrientedResolution(value)?.let { "${it.first}x${it.second}" } ?: SessionDisplay.LINK_LANDSCAPE
|
||||
}
|
||||
|
||||
private fun parseOrientedResolution(text: String): Pair<Int, Int>? =
|
||||
fun parseOrientedResolution(text: String): Pair<Int, Int>? =
|
||||
parseResolution(text) ?: text.trim().split('x', 'X', '×', '*').takeIf { it.size == 2 }
|
||||
?.let { parseResolution("${it[1]}x${it[0]}") }?.let { it.second to it.first }
|
||||
|
||||
|
||||
@@ -720,10 +720,10 @@ internal fun SgdbKeyDialog(hasKey: Boolean, onSave: (String) -> Unit, onDismiss:
|
||||
|
||||
@OptIn(androidx.compose.foundation.layout.ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
internal fun CustomResolutionDialog(initial: Pair<Int, Int>?, onSave: (Pair<Int, Int>) -> Unit, onDismiss: () -> Unit) {
|
||||
internal fun CustomResolutionDialog(initial: Pair<Int, Int>?, onSave: (Pair<Int, Int>) -> Unit, onDismiss: () -> Unit, portrait: Boolean = false) {
|
||||
var w by remember { mutableStateOf(initial?.first?.toString() ?: "") }
|
||||
var h by remember { mutableStateOf(initial?.second?.toString() ?: "") }
|
||||
val parsed = SessionPrefs.parseResolution("${w}x$h")
|
||||
val parsed = if (portrait) SessionPrefs.parseOrientedResolution("${w}x$h") else SessionPrefs.parseResolution("${w}x$h")
|
||||
com.droiddeck.launcher.ui.GlideAlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = { Text(stringResource(R.string.mode_custom_res_title)) },
|
||||
|
||||
@@ -51,7 +51,7 @@ fun ResolutionRow(
|
||||
else onPick(value) })
|
||||
if (editCustom) CustomResolutionDialog(size,
|
||||
onSave = { value -> editCustom = false; onPick("${value.first}x${value.second}") },
|
||||
onDismiss = { editCustom = false })
|
||||
onDismiss = { editCustom = false }, portrait = portrait)
|
||||
if (editFollow) CustomFollowScaleDialog(SessionDisplay.followScale(choice)?.takeIf { it > 1f },
|
||||
onSave = { value -> editFollow = false; onPick(SessionDisplay.followScaled(value)) },
|
||||
onDismiss = { editFollow = false })
|
||||
|
||||
Reference in new issue
Block a user