Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
edcaf6e02c | ||
|
|
da33a6813b | ||
|
|
ca355f4135 | ||
|
|
4a5355e633 |
@@ -23,7 +23,7 @@ android {
|
||||
minSdk = 30
|
||||
targetSdk = 36
|
||||
versionCode = generateVersionCode()
|
||||
versionName = "2.3.1"
|
||||
versionName = "2.5.0"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -4,9 +4,19 @@ import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.scaleIn
|
||||
import androidx.compose.animation.scaleOut
|
||||
import androidx.compose.animation.slideInVertically
|
||||
import androidx.compose.animation.slideOutVertically
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
@@ -28,15 +38,20 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.serialization.json.Json
|
||||
import ru.omni_devel.cards.ui.theme.OmniCardsTheme
|
||||
|
||||
private const val ANIMATION_DELAY = 300L
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
private lateinit var db: DbHelper
|
||||
|
||||
@@ -81,12 +96,19 @@ fun MainPage(
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val uriHandler = LocalUriHandler.current
|
||||
val scope = rememberCoroutineScope()
|
||||
|
||||
var isActionBarShowed by remember { mutableStateOf(false) }
|
||||
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
BackHandler(
|
||||
enabled = isActionBarShowed,
|
||||
) {
|
||||
isActionBarShowed = false
|
||||
}
|
||||
|
||||
Page(
|
||||
stringResource(R.string.app_name),
|
||||
innerPadding
|
||||
@@ -108,11 +130,33 @@ fun MainPage(
|
||||
}
|
||||
|
||||
if (isActionBarShowed) {
|
||||
Column(
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.clickable(
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
indication = null
|
||||
) {
|
||||
isActionBarShowed = false
|
||||
}
|
||||
) { }
|
||||
}
|
||||
|
||||
AnimatedVisibility(
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomEnd)
|
||||
.padding(innerPadding)
|
||||
.padding(16.dp)
|
||||
.padding(16.dp),
|
||||
visible = isActionBarShowed,
|
||||
enter = slideInVertically(initialOffsetY = { it }) + fadeIn(),
|
||||
exit = slideOutVertically(targetOffsetY = { it }) + fadeOut()
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.clickable(
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
indication = null
|
||||
) {}
|
||||
.background(
|
||||
MaterialTheme.colorScheme.inversePrimary,
|
||||
RoundedCornerShape(24.dp)
|
||||
@@ -124,10 +168,14 @@ fun MainPage(
|
||||
onClick = {
|
||||
isActionBarShowed = false
|
||||
|
||||
scope.launch {
|
||||
delay(ANIMATION_DELAY)
|
||||
|
||||
val intent = Intent(context, EditCardActivity::class.java)
|
||||
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
) {
|
||||
Text(stringResource(R.string.do_add_card))
|
||||
}
|
||||
@@ -150,11 +198,15 @@ fun MainPage(
|
||||
}
|
||||
FullWidthButton(
|
||||
onClick = {
|
||||
isActionBarShowed = false
|
||||
|
||||
scope.launch {
|
||||
delay(ANIMATION_DELAY)
|
||||
|
||||
val intent = Intent(context, BackupActivity::class.java)
|
||||
|
||||
context.startActivity(intent)
|
||||
|
||||
isActionBarShowed = false
|
||||
}
|
||||
}
|
||||
) {
|
||||
Text(stringResource(R.string.open_backup_menu))
|
||||
@@ -176,11 +228,19 @@ fun MainPage(
|
||||
Text(">")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Button(
|
||||
}
|
||||
|
||||
AnimatedVisibility(
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomEnd)
|
||||
.padding(innerPadding).padding(32.dp),
|
||||
.padding(innerPadding)
|
||||
.padding(32.dp),
|
||||
visible = !isActionBarShowed,
|
||||
enter = fadeIn() + scaleIn(),
|
||||
exit = fadeOut() + scaleOut()
|
||||
){
|
||||
Button(
|
||||
modifier = Modifier,
|
||||
onClick = {
|
||||
isActionBarShowed = true
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ android {
|
||||
minSdk = 30
|
||||
targetSdk = 36
|
||||
versionCode = generateVersionCode()
|
||||
versionName = "1.3.0"
|
||||
versionName = "1.4.0"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user