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
|
import org.kiwix.kiwixmobile.core.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HeaderText(item: LanguageListItem.HeaderItem) {
|
fun HeaderText(
|
||||||
|
modifier: Modifier,
|
||||||
|
item: LanguageListItem.HeaderItem
|
||||||
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = when (item.id) {
|
text = when (item.id) {
|
||||||
LanguageListItem.HeaderItem.SELECTED -> stringResource(R.string.your_languages)
|
LanguageListItem.HeaderItem.SELECTED -> stringResource(R.string.your_languages)
|
||||||
LanguageListItem.HeaderItem.OTHER -> stringResource(R.string.other_languages)
|
LanguageListItem.HeaderItem.OTHER -> stringResource(R.string.other_languages)
|
||||||
else -> ""
|
else -> ""
|
||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
style = MaterialTheme.typography.headlineMedium,
|
style = MaterialTheme.typography.headlineMedium,
|
||||||
|
@ -19,9 +19,6 @@
|
|||||||
package org.kiwix.kiwixmobile.language.composables
|
package org.kiwix.kiwixmobile.language.composables
|
||||||
|
|
||||||
import android.content.Context
|
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.clickable
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
@ -57,18 +54,16 @@ fun LanguageList(
|
|||||||
}
|
}
|
||||||
) { item ->
|
) { item ->
|
||||||
when (item) {
|
when (item) {
|
||||||
is HeaderItem -> HeaderText(item)
|
is HeaderItem -> HeaderText(
|
||||||
|
item = item,
|
||||||
|
modifier = Modifier
|
||||||
|
.animateItem()
|
||||||
|
)
|
||||||
|
|
||||||
is LanguageItem -> LanguageItemRow(
|
is LanguageItem -> LanguageItemRow(
|
||||||
context = context,
|
context = context,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.animateItem(
|
.animateItem()
|
||||||
fadeInSpec = tween(durationMillis = 250),
|
|
||||||
fadeOutSpec = tween(durationMillis = 100),
|
|
||||||
placementSpec = spring(
|
|
||||||
stiffness = Spring.StiffnessLow,
|
|
||||||
dampingRatio = Spring.DampingRatioLowBouncy
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(64.dp)
|
.height(64.dp)
|
||||||
.semantics {
|
.semantics {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user