Compare commits

..
3 Commits
10 changed files with 30 additions and 18 deletions
+2 -2
View File
@@ -12,8 +12,8 @@ android {
applicationId = "ru.omni_devel.cards" applicationId = "ru.omni_devel.cards"
minSdk = 30 minSdk = 30
targetSdk = 36 targetSdk = 36
versionCode = 60 // 0 at end for mobile versionCode = 70 // 0 at end for mobile
versionName = "2.1.1" versionName = "2.2.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }
Binary file not shown.
Binary file not shown.
@@ -33,6 +33,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
@@ -82,9 +83,9 @@ fun CardEditable(
color: String?, color: String?,
onColorChange: (String?) -> Unit onColorChange: (String?) -> Unit
) { ) {
var isCodeTypeDropdownExpanded by remember { mutableStateOf(false) } var isCodeTypeDropdownExpanded by rememberSaveable { mutableStateOf(false) }
var isColorPickerExpanded by remember { mutableStateOf(false) } var isColorPickerExpanded by rememberSaveable { mutableStateOf(false) }
var isColorEnabled by remember { mutableStateOf(color != null) } var isColorEnabled by rememberSaveable { mutableStateOf(color != null) }
val colorPickerController = rememberColorPickerController() val colorPickerController = rememberColorPickerController()
@@ -210,10 +211,10 @@ fun CardEditable(
@Composable @Composable
fun AddCard(innerPadding: PaddingValues, getDbFun: () -> DbHelper) { fun AddCard(innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
var cardName by remember { mutableStateOf("") } var cardName by rememberSaveable { mutableStateOf("") }
var codeValue by remember { mutableStateOf("") } var codeValue by rememberSaveable { mutableStateOf("") }
var codeType by remember { mutableStateOf(BarcodeFormat.QR_CODE) } var codeType by rememberSaveable { mutableStateOf(BarcodeFormat.QR_CODE) }
var color by remember { mutableStateOf<String?>(null) } var color by rememberSaveable { mutableStateOf<String?>(null) }
val context = LocalActivity.current val context = LocalActivity.current
@@ -257,10 +258,10 @@ fun AddCard(innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
@Composable @Composable
fun EditCard(cardInfo: CardInfo, innerPadding: PaddingValues, getDbFun: () -> DbHelper) { fun EditCard(cardInfo: CardInfo, innerPadding: PaddingValues, getDbFun: () -> DbHelper) {
var cardName by remember { mutableStateOf(cardInfo.name) } var cardName by rememberSaveable { mutableStateOf(cardInfo.name) }
var codeValue by remember { mutableStateOf(cardInfo.codeValue) } var codeValue by rememberSaveable { mutableStateOf(cardInfo.codeValue) }
var codeType by remember { mutableStateOf(cardInfo.codeType) } var codeType by rememberSaveable { mutableStateOf(cardInfo.codeType) }
var color by remember { mutableStateOf(cardInfo.color) } var color by rememberSaveable { mutableStateOf(cardInfo.color) }
val context = LocalActivity.current val context = LocalActivity.current
@@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
@@ -42,6 +43,7 @@ fun Page(name: String, innerPadding: PaddingValues, content: @Composable () -> U
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxSize()
.padding(horizontal = 16.dp) .padding(horizontal = 16.dp)
.background(MaterialTheme.colorScheme.background) .background(MaterialTheme.colorScheme.background)
) { ) {
@@ -12,15 +12,18 @@ 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.padding
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import ru.omni_devel.cards.ui.theme.OmniCardsTheme import ru.omni_devel.cards.ui.theme.OmniCardsTheme
class ShowCardActivity : ComponentActivity() { class ShowCardActivity : ComponentActivity() {
@@ -82,14 +85,18 @@ fun ShowCardPage(innerPadding: PaddingValues, cardInfo: CardInfo) {
Page(cardInfo.name, innerPadding) { Page(cardInfo.name, innerPadding) {
Column( Column(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) { ) {
if (bitmap != null) { if (bitmap != null) {
Image( Image(
bitmap = bitmap, bitmap = bitmap,
contentDescription = cardInfo.codeValue, contentDescription = cardInfo.codeValue,
modifier = Modifier.fillMaxWidth(), modifier = Modifier
contentScale = ContentScale.FillWidth .padding(bottom = 8.dp)
.fillMaxWidth()
.weight(1f, fill = false),
contentScale = ContentScale.Fit
) )
Text( Text(
cardInfo.codeValue, cardInfo.codeValue,
+2 -2
View File
@@ -12,8 +12,8 @@ android {
applicationId = "ru.omni_devel.cards" applicationId = "ru.omni_devel.cards"
minSdk = 30 minSdk = 30
targetSdk = 36 targetSdk = 36
versionCode = 61 // 1 at end for WearOS versionCode = 71 // 1 at end for WearOS
versionName = "1.2.1" versionName = "1.3.0"
} }
buildTypes { buildTypes {
Binary file not shown.
Binary file not shown.
@@ -62,6 +62,8 @@ class ShowCardActivity : ComponentActivity() {
super.onPause() super.onPause()
setBrightness(WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE) setBrightness(WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE)
finish()
} }
private fun setBrightness(level: Float) { private fun setBrightness(level: Float) {