Skip to content

Commit

Permalink
Bump libs and start working on application wide settings
Browse files Browse the repository at this point in the history
  • Loading branch information
T8RIN committed Dec 3, 2024
1 parent f7a75d8 commit 027f610
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,17 @@ fun MainContent(
}
}

val snowFallList = Screen.entries.mapNotNull { screen ->
screen.icon?.let { rememberVectorPainter(image = it) }
}
val color = MaterialTheme.colorScheme.onSecondaryContainer.copy(0.5f)
AnimatedVisibility(
visible = showSnowfall,
modifier = Modifier
.fillMaxSize(),
enter = fadeIn(tween(1000)) + slideInVertically(tween(1000)) { -it / 4 },
exit = fadeOut(tween(1000)) + slideOutVertically(tween(1000)) { it / 4 }
) {
val snowFallList = Screen.entries.mapNotNull { screen ->
screen.icon?.let { rememberVectorPainter(image = it) }
}
val color = MaterialTheme.colorScheme.onSecondaryContainer.copy(0.5f)
Box(
modifier = Modifier
.fillMaxSize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,40 @@

package ru.tech.imageresizershrinker.feature.root.presentation.components

import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.BackdropScaffold
import androidx.compose.material.BackdropValue
import androidx.compose.material.rememberBackdropScaffoldState
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.dp
import com.arkivanov.decompose.extensions.compose.stack.Children
import com.arkivanov.decompose.extensions.compose.subscribeAsState
import kotlinx.coroutines.launch
import ru.tech.imageresizershrinker.core.ui.utils.animation.toolboxPredictiveBackAnimation
import ru.tech.imageresizershrinker.core.ui.widget.modifier.toShape
import ru.tech.imageresizershrinker.core.ui.widget.modifier.withLayoutCorners
import ru.tech.imageresizershrinker.feature.root.presentation.components.utils.ResetThemeOnGoBack
import ru.tech.imageresizershrinker.feature.root.presentation.components.utils.ScreenBasedMaxBrightnessEnforcement
import ru.tech.imageresizershrinker.feature.root.presentation.screenLogic.RootComponent
import kotlin.random.Random

@Composable
internal fun ScreenSelector(
Expand All @@ -35,18 +59,74 @@ internal fun ScreenSelector(
ResetThemeOnGoBack(component)

val childStack by component.childStack.subscribeAsState()
val currentScreen = childStack.items.lastOrNull()?.configuration
var shape by remember { mutableStateOf<Shape>(RectangleShape) }
val scaffoldState = rememberBackdropScaffoldState(BackdropValue.Concealed)
val canExpandSettings = (currentScreen?.id ?: -1) >= 0

Children(
stack = childStack,
modifier = Modifier.fillMaxSize(),
animation = toolboxPredictiveBackAnimation(
backHandler = component.backHandler,
onBack = component::navigateBack
),
content = { child ->
child.instance.Content()
LaunchedEffect(canExpandSettings) {
if (!canExpandSettings) {
scaffoldState.conceal()
}
}

BackdropScaffold(
scaffoldState = scaffoldState,
modifier = Modifier.withLayoutCorners {
shape = it.toShape(1f)
this
},
appBar = {},
frontLayerContent = {
Children(
stack = childStack,
modifier = Modifier.fillMaxSize(),
animation = toolboxPredictiveBackAnimation(
backHandler = component.backHandler,
onBack = component::navigateBack
),
content = { child ->
child.instance.Content()
}
)
},
backLayerContent = {
val scope = rememberCoroutineScope()
BackHandler(
enabled = scaffoldState.isRevealed
) {
scope.launch {
scaffoldState.conceal()
}
}
LazyColumn(
modifier = Modifier.clip(shape)
) {
items(100) {
Spacer(
modifier = Modifier
.fillMaxWidth()
.height(24.dp)
.background(
remember {
Color(Random.nextInt())
}
)
)
}
}
},
peekHeight = 0.dp,
headerHeight = 64.dp,
persistentAppBar = false,
backLayerBackgroundColor = MaterialTheme.colorScheme.surfaceContainerHigh,
frontLayerBackgroundColor = MaterialTheme.colorScheme.surface,
frontLayerScrimColor = MaterialTheme.colorScheme.scrim.copy(0.5f),
frontLayerShape = shape,
gesturesEnabled = canExpandSettings
)

ScreenBasedMaxBrightnessEnforcement(childStack.items.lastOrNull()?.configuration)
//TODO: How to add settings on each screen

ScreenBasedMaxBrightnessEnforcement(currentScreen)
}
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jvmTarget = "17"
imageToolboxLibs = "3.2.5"
trickle = "1.2.2"

avifCoder = "2.0.9"
avifCoderCoil = "2.0.9.1"
avifCoder = "2.0.10"
avifCoderCoil = "2.0.10"
aire = "0.15.5"
jxlCoder = "2.4.0.5"
jxlCoderCoil = "2.4.0.6"
Expand Down Expand Up @@ -40,7 +40,7 @@ detektCompose = "0.4.19"
decompose = "3.2.2"

kotlin = "2.0.21"
agp = "8.7.2"
agp = "8.7.3"
hilt = "2.53"
gms = "4.4.2"

Expand Down

0 comments on commit 027f610

Please sign in to comment.