Skip to content

Commit

Permalink
Fix dialog height in horizontal mode
Browse files Browse the repository at this point in the history
This was affected by migrating to targetSDK = 15
  • Loading branch information
Taewan-P committed Nov 3, 2024
1 parent 0170ed6 commit e1a75ae
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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())) {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit e1a75ae

Please sign in to comment.