fix: fixed UI
This commit is contained in:
@@ -11,7 +11,6 @@ import androidx.activity.enableEdgeToEdge
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
@@ -134,7 +133,6 @@ fun BackupPage(innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
|
||||
|
||||
Page(stringResource(R.string.backup), innerPadding) {
|
||||
AdaptiveButton(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
onClick = {
|
||||
createBackupLauncher.launch("omnicards-backup.json")
|
||||
}
|
||||
@@ -142,7 +140,6 @@ fun BackupPage(innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
|
||||
Text(stringResource(R.string.do_backup))
|
||||
}
|
||||
AdaptiveButton(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
onClick = {
|
||||
restoreFromBackupLauncher.launch("application/json")
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ fun FillTemplatePage(template: Template, innerPadding: PaddingValues) {
|
||||
}
|
||||
},
|
||||
modifier = fieldModifier,
|
||||
label = { Text((if (field.maybeEmpty) "" else "* ") + field.name) }
|
||||
label = { Text((if (field.maybeEmpty) "" else "*") + field.name) }
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.Scaffold
|
||||
@@ -99,17 +100,20 @@ fun MainPage(
|
||||
},
|
||||
)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.verticalScroll(rememberScrollState()).padding(bottom = 64.dp).background(Color.Transparent),
|
||||
LazyColumn(
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
if (cards.isEmpty()) {
|
||||
Text(
|
||||
stringResource(R.string.add_card_to_get_started)
|
||||
)
|
||||
item {
|
||||
Text(
|
||||
stringResource(R.string.add_card_to_get_started)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
for (card in cards) {
|
||||
CardButton(card, onDeleteCard)
|
||||
item {
|
||||
CardButton(card, onDeleteCard)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user