From e1a75ae9e7ae43ca2ace79c129689eb978960b26 Mon Sep 17 00:00:00 2001 From: Taewan Park Date: Sun, 3 Nov 2024 18:20:25 +0900 Subject: [PATCH] Fix dialog height in horizontal mode This was affected by migrating to targetSDK = 15 --- .../presentation/ui/home/HomeScreen.kt | 9 +++++-- .../ui/setting/PlatformSettingDialogs.kt | 25 ++++++++++++++----- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/home/HomeScreen.kt b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/home/HomeScreen.kt index 6effb64..fdc8204 100644 --- a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/home/HomeScreen.kt +++ b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/home/HomeScreen.kt @@ -8,6 +8,7 @@ import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.systemBarsPadding import androidx.compose.foundation.layout.width @@ -340,7 +341,9 @@ fun SelectPlatformDialog( AlertDialog( properties = DialogProperties(usePlatformDefaultWidth = false), - modifier = Modifier.widthIn(max = configuration.screenWidthDp.dp - 40.dp), + modifier = Modifier + .widthIn(max = configuration.screenWidthDp.dp - 40.dp) + .heightIn(max = configuration.screenHeightDp.dp - 80.dp), onDismissRequest = onDismissRequest, title = { Column { @@ -433,7 +436,9 @@ fun DeleteWarningDialog( val configuration = LocalConfiguration.current AlertDialog( properties = DialogProperties(usePlatformDefaultWidth = false), - modifier = Modifier.width(configuration.screenWidthDp.dp - 40.dp), + modifier = Modifier + .width(configuration.screenWidthDp.dp - 40.dp) + .heightIn(max = configuration.screenHeightDp.dp - 80.dp), title = { Text( text = stringResource(R.string.delete_selected_chats), diff --git a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/setting/PlatformSettingDialogs.kt b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/setting/PlatformSettingDialogs.kt index 9ae1a34..926bc86 100644 --- a/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/setting/PlatformSettingDialogs.kt +++ b/app/src/main/kotlin/dev/chungjungsoo/gptmobile/presentation/ui/setting/PlatformSettingDialogs.kt @@ -3,6 +3,7 @@ package dev.chungjungsoo.gptmobile.presentation.ui.setting import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.rememberScrollState @@ -180,7 +181,9 @@ private fun APIUrlDialog( AlertDialog( properties = DialogProperties(usePlatformDefaultWidth = false), - modifier = Modifier.widthIn(max = configuration.screenWidthDp.dp - 40.dp), + modifier = Modifier + .widthIn(max = configuration.screenWidthDp.dp - 40.dp) + .heightIn(max = configuration.screenHeightDp.dp - 80.dp), title = { Text(text = stringResource(R.string.api_url)) }, text = { Column { @@ -242,7 +245,9 @@ private fun APIKeyDialog( AlertDialog( properties = DialogProperties(usePlatformDefaultWidth = false), - modifier = Modifier.widthIn(max = configuration.screenWidthDp.dp - 40.dp), + modifier = Modifier + .widthIn(max = configuration.screenWidthDp.dp - 40.dp) + .heightIn(max = configuration.screenHeightDp.dp - 80.dp), title = { Text(text = getPlatformAPILabelResources()[apiType]!!) }, text = { TokenInputField( @@ -301,7 +306,9 @@ private fun ModelDialog( AlertDialog( properties = DialogProperties(usePlatformDefaultWidth = false), - modifier = Modifier.widthIn(max = configuration.screenWidthDp.dp - 40.dp), + modifier = Modifier + .widthIn(max = configuration.screenWidthDp.dp - 40.dp) + .heightIn(max = configuration.screenHeightDp.dp - 80.dp), title = { Text(text = stringResource(R.string.api_model)) }, text = { Column(modifier = Modifier.verticalScroll(rememberScrollState())) { @@ -387,7 +394,9 @@ private fun TemperatureDialog( AlertDialog( properties = DialogProperties(usePlatformDefaultWidth = false), - modifier = Modifier.widthIn(max = configuration.screenWidthDp.dp - 40.dp), + modifier = Modifier + .widthIn(max = configuration.screenWidthDp.dp - 40.dp) + .heightIn(max = configuration.screenHeightDp.dp - 80.dp), title = { Text(text = stringResource(R.string.temperature_setting)) }, text = { Column( @@ -464,7 +473,9 @@ private fun TopPDialog( AlertDialog( properties = DialogProperties(usePlatformDefaultWidth = false), - modifier = Modifier.widthIn(max = configuration.screenWidthDp.dp - 40.dp), + modifier = Modifier + .widthIn(max = configuration.screenWidthDp.dp - 40.dp) + .heightIn(max = configuration.screenHeightDp.dp - 80.dp), title = { Text(text = stringResource(R.string.top_p_setting)) }, text = { Column( @@ -532,7 +543,9 @@ private fun SystemPromptDialog( AlertDialog( properties = DialogProperties(usePlatformDefaultWidth = false), - modifier = Modifier.widthIn(max = configuration.screenWidthDp.dp - 40.dp), + modifier = Modifier + .widthIn(max = configuration.screenWidthDp.dp - 40.dp) + .heightIn(max = configuration.screenHeightDp.dp - 80.dp), title = { Text(text = stringResource(R.string.system_prompt_setting)) }, text = { Column(