mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
feat: language fragment to jetpack compose
- improved animations
This commit is contained in:
parent
0c47337512
commit
583cc7241e
@ -29,14 +29,17 @@ import androidx.compose.ui.unit.sp
|
||||
import org.kiwix.kiwixmobile.core.R
|
||||
|
||||
@Composable
|
||||
fun HeaderText(item: LanguageListItem.HeaderItem) {
|
||||
fun HeaderText(
|
||||
modifier: Modifier,
|
||||
item: LanguageListItem.HeaderItem
|
||||
) {
|
||||
Text(
|
||||
text = when (item.id) {
|
||||
LanguageListItem.HeaderItem.SELECTED -> stringResource(R.string.your_languages)
|
||||
LanguageListItem.HeaderItem.OTHER -> stringResource(R.string.other_languages)
|
||||
else -> ""
|
||||
},
|
||||
modifier = Modifier
|
||||
modifier = modifier
|
||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||
fontSize = 16.sp,
|
||||
style = MaterialTheme.typography.headlineMedium,
|
||||
|
@ -19,9 +19,6 @@
|
||||
package org.kiwix.kiwixmobile.language.composables
|
||||
|
||||
import android.content.Context
|
||||
import androidx.compose.animation.core.Spring
|
||||
import androidx.compose.animation.core.spring
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
@ -57,18 +54,16 @@ fun LanguageList(
|
||||
}
|
||||
) { item ->
|
||||
when (item) {
|
||||
is HeaderItem -> HeaderText(item)
|
||||
is HeaderItem -> HeaderText(
|
||||
item = item,
|
||||
modifier = Modifier
|
||||
.animateItem()
|
||||
)
|
||||
|
||||
is LanguageItem -> LanguageItemRow(
|
||||
context = context,
|
||||
modifier = Modifier
|
||||
.animateItem(
|
||||
fadeInSpec = tween(durationMillis = 250),
|
||||
fadeOutSpec = tween(durationMillis = 100),
|
||||
placementSpec = spring(
|
||||
stiffness = Spring.StiffnessLow,
|
||||
dampingRatio = Spring.DampingRatioLowBouncy
|
||||
)
|
||||
)
|
||||
.animateItem()
|
||||
.fillMaxWidth()
|
||||
.height(64.dp)
|
||||
.semantics {
|
||||
|
Loading…
x
Reference in New Issue
Block a user