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