Design tweaks for app icon switching.

This commit is contained in:
Nicholas Tinsley 2023-05-19 15:51:13 -04:00 committed by Greyson Parrelli
parent 77ccbdd322
commit f8529adfcf
2 changed files with 16 additions and 3 deletions

View file

@ -6,7 +6,9 @@
package org.thoughtcrime.securesms.components.settings.app.appearance.appicon
import android.content.Context
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
@ -240,7 +242,11 @@ fun IconGridElement(preset: AppIconPreset, isSelected: Boolean, onClickHandler:
*/
@Composable
fun AppIcon(preset: AppIconPreset, isSelected: Boolean, onClick: () -> Unit, modifier: Modifier = Modifier) {
val bitmapSize by animateFloatAsState(if (isSelected) 48f else 64f, label = "Icon Size")
val bitmapSize by animateFloatAsState(
targetValue = if (isSelected) 48f else 64f,
label = "Icon Size",
animationSpec = tween(durationMillis = 150, easing = CubicBezierEasing(0.17f, 0.17f, 0f, 1f))
)
val imageModifier = modifier
.size(bitmapSize.dp)
.graphicsLayer(

View file

@ -25,6 +25,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.fragment.findNavController
@ -65,7 +66,10 @@ class AppIconTutorialFragment : ComposeFragment() {
text = stringResource(R.string.preferences__app_icon_warning),
style = MaterialTheme.typography.bodyLarge,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(vertical = 20.dp)
textAlign = TextAlign.Start,
modifier = Modifier
.padding(vertical = 20.dp)
.fillMaxWidth()
)
Box(
contentAlignment = Alignment.Center,
@ -86,7 +90,10 @@ class AppIconTutorialFragment : ComposeFragment() {
text = stringResource(id = R.string.preferences__app_icon_notification_warning),
style = MaterialTheme.typography.bodyLarge,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(vertical = 20.dp)
textAlign = TextAlign.Start,
modifier = Modifier
.padding(vertical = 20.dp)
.fillMaxWidth()
)
Box(
contentAlignment = Alignment.Center,