fix: fixed UI

This commit is contained in:
2026-06-21 20:40:44 +03:00
parent 576642a920
commit 12b64766ef
6 changed files with 48 additions and 28 deletions
@@ -10,11 +10,13 @@ import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
@@ -96,30 +98,45 @@ fun SelectTemplatePage(innerPadding: PaddingValues) {
stringResource(R.string.choosing_template),
innerPadding
) {
Column(
modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()),
LazyColumn(
horizontalAlignment = Alignment.CenterHorizontally
) {
if (loadingError != null) {
Text(loadingError!!)
item {
Text(loadingError!!)
}
} else if (templates == null) {
CircularProgressIndicator(
modifier = Modifier.size(48.dp),
color = MaterialTheme.colorScheme.primary
)
} else {
for (template in templates) {
AdaptiveButton(
item {
Column(
modifier = Modifier.fillMaxWidth(),
onClick = {
val intent = Intent(context, FillTemplateActivity::class.java)
intent.putExtra("templateJson", Json.encodeToString(template))
fillTemplateLauncher.launch(intent)
}
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(template.name)
CircularProgressIndicator(
modifier = Modifier.size(48.dp),
color = MaterialTheme.colorScheme.primary
)
}
}
} else if (templates!!.isEmpty()) {
item {
Text(stringResource(R.string.templates_not_found))
}
} else {
for (template in templates) {
item {
AdaptiveButton(
modifier = Modifier.fillMaxWidth(),
onClick = {
val intent = Intent(context, FillTemplateActivity::class.java)
intent.putExtra("templateJson", Json.encodeToString(template))
fillTemplateLauncher.launch(intent)
}
) {
Text(template.name)
}
}
}
}
}