fix: fixed UI
This commit is contained in:
@@ -11,7 +11,6 @@ import androidx.activity.enableEdgeToEdge
|
|||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
@@ -134,7 +133,6 @@ fun BackupPage(innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
|
|||||||
|
|
||||||
Page(stringResource(R.string.backup), innerPadding) {
|
Page(stringResource(R.string.backup), innerPadding) {
|
||||||
AdaptiveButton(
|
AdaptiveButton(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
onClick = {
|
onClick = {
|
||||||
createBackupLauncher.launch("omnicards-backup.json")
|
createBackupLauncher.launch("omnicards-backup.json")
|
||||||
}
|
}
|
||||||
@@ -142,7 +140,6 @@ fun BackupPage(innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
|
|||||||
Text(stringResource(R.string.do_backup))
|
Text(stringResource(R.string.do_backup))
|
||||||
}
|
}
|
||||||
AdaptiveButton(
|
AdaptiveButton(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
onClick = {
|
onClick = {
|
||||||
restoreFromBackupLauncher.launch("application/json")
|
restoreFromBackupLauncher.launch("application/json")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ fun FillTemplatePage(template: Template, innerPadding: PaddingValues) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = fieldModifier,
|
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.PaddingValues
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
@@ -99,20 +100,23 @@ fun MainPage(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
Column(
|
LazyColumn(
|
||||||
modifier = Modifier.verticalScroll(rememberScrollState()).padding(bottom = 64.dp).background(Color.Transparent),
|
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
) {
|
) {
|
||||||
if (cards.isEmpty()) {
|
if (cards.isEmpty()) {
|
||||||
|
item {
|
||||||
Text(
|
Text(
|
||||||
stringResource(R.string.add_card_to_get_started)
|
stringResource(R.string.add_card_to_get_started)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for (card in cards) {
|
for (card in cards) {
|
||||||
|
item {
|
||||||
CardButton(card, onDeleteCard)
|
CardButton(card, onDeleteCard)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ import androidx.activity.compose.setContent
|
|||||||
import androidx.activity.enableEdgeToEdge
|
import androidx.activity.enableEdgeToEdge
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
@@ -96,19 +98,32 @@ fun SelectTemplatePage(innerPadding: PaddingValues) {
|
|||||||
stringResource(R.string.choosing_template),
|
stringResource(R.string.choosing_template),
|
||||||
innerPadding
|
innerPadding
|
||||||
) {
|
) {
|
||||||
Column(
|
LazyColumn(
|
||||||
modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
if (loadingError != null) {
|
if (loadingError != null) {
|
||||||
|
item {
|
||||||
Text(loadingError!!)
|
Text(loadingError!!)
|
||||||
|
}
|
||||||
} else if (templates == null) {
|
} else if (templates == null) {
|
||||||
|
item {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
CircularProgressIndicator(
|
CircularProgressIndicator(
|
||||||
modifier = Modifier.size(48.dp),
|
modifier = Modifier.size(48.dp),
|
||||||
color = MaterialTheme.colorScheme.primary
|
color = MaterialTheme.colorScheme.primary
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (templates!!.isEmpty()) {
|
||||||
|
item {
|
||||||
|
Text(stringResource(R.string.templates_not_found))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for (template in templates) {
|
for (template in templates) {
|
||||||
|
item {
|
||||||
AdaptiveButton(
|
AdaptiveButton(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
onClick = {
|
onClick = {
|
||||||
@@ -125,4 +140,6 @@ fun SelectTemplatePage(innerPadding: PaddingValues) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
<string name="choosing_color">Выбор цвета</string>
|
<string name="choosing_color">Выбор цвета</string>
|
||||||
<string name="choosing_template">Выбор шаблона</string>
|
<string name="choosing_template">Выбор шаблона</string>
|
||||||
<string name="error_in_data">Ошибка в данных. Пожалуйста, заполните все необходимые (*) поля</string>
|
<string name="error_in_data">Ошибка в данных. Пожалуйста, заполните все необходимые (*) поля</string>
|
||||||
|
<string name="templates_not_found">Шаблоны не найдены</string>
|
||||||
<string name="card_name_should_not_be_empty">Имя карты не должно быть пустым</string>
|
<string name="card_name_should_not_be_empty">Имя карты не должно быть пустым</string>
|
||||||
<string name="card_value_should_not_be_empty">Значение карты не должно быть пустым</string>
|
<string name="card_value_should_not_be_empty">Значение карты не должно быть пустым</string>
|
||||||
<string name="name_must_be_shorter_than_32_symbols">Имя карты должно быть короче 32 символов</string>
|
<string name="name_must_be_shorter_than_32_symbols">Имя карты должно быть короче 32 символов</string>
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
<string name="choosing_color">Choosing color</string>
|
<string name="choosing_color">Choosing color</string>
|
||||||
<string name="choosing_template">Choosing template</string>
|
<string name="choosing_template">Choosing template</string>
|
||||||
<string name="error_in_data">Error in data. Please, fill all required (*) fields</string>
|
<string name="error_in_data">Error in data. Please, fill all required (*) fields</string>
|
||||||
|
<string name="templates_not_found">Templates not found</string>
|
||||||
<string name="card_name_should_not_be_empty">Card name must not be empty</string>
|
<string name="card_name_should_not_be_empty">Card name must not be empty</string>
|
||||||
<string name="card_value_should_not_be_empty">Card value must not be empty</string>
|
<string name="card_value_should_not_be_empty">Card value must not be empty</string>
|
||||||
<string name="name_must_be_shorter_than_32_symbols">Card name must be shorter than 32 characters</string>
|
<string name="name_must_be_shorter_than_32_symbols">Card name must be shorter than 32 characters</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user