From d60df4e5fffc5817431e4c99c70504ac081d18a9 Mon Sep 17 00:00:00 2001 From: Eric Ampire Date: Sat, 4 Sep 2021 17:58:34 +0200 Subject: [PATCH] Setup LottieFileItem --- app/build.gradle.kts | 2 + app/src/main/AndroidManifest.xml | 2 + .../android/androidstudycase/MainActivity.kt | 2 + .../androidstudycase/app/AppNavigation.kt | 2 + .../presentation/custom/CustomImageView.kt | 25 +++ .../presentation/custom/TopActionBar.kt | 40 ++++ .../screen/explore/business/ExploreEffect.kt | 1 + .../screen/explore/ui/ExploreScreen.kt | 125 ++++++++++- .../screen/explore/ui/LottieFileItem.kt | 201 ++++++++++++++++++ .../presentation/screen/main/ui/MainScreen.kt | 13 +- .../presentation/theme/Color.kt | 5 +- .../presentation/theme/Theme.kt | 4 +- .../androidstudycase/util/PreviewData.kt | 97 +++++++++ .../androidstudycase/util/PreviewParameter.kt | 24 +++ .../main/res/drawable/ic_lottiefiles_logo.xml | 30 +++ app/src/main/res/values-night/themes.xml | 16 -- app/src/main/res/values/themes.xml | 8 +- i18n/src/main/res/values/arrays.xml | 36 +--- i18n/src/main/res/values/strings.xml | 1 + versions.properties | 1 + 20 files changed, 574 insertions(+), 61 deletions(-) create mode 100644 app/src/main/java/com/ericampire/android/androidstudycase/presentation/custom/CustomImageView.kt create mode 100644 app/src/main/java/com/ericampire/android/androidstudycase/presentation/custom/TopActionBar.kt create mode 100644 app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/explore/ui/LottieFileItem.kt create mode 100644 app/src/main/java/com/ericampire/android/androidstudycase/util/PreviewData.kt create mode 100644 app/src/main/java/com/ericampire/android/androidstudycase/util/PreviewParameter.kt create mode 100644 app/src/main/res/drawable/ic_lottiefiles_logo.xml delete mode 100644 app/src/main/res/values-night/themes.xml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index da78bbb..32aa740 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -117,6 +117,8 @@ dependencies { implementation(Libs.ksp_api) + implementation(Libs.lottie_compose) + implementation(Libs.orbit_mvi_core) implementation(Libs.orbit_mvi_viewmodel) testImplementation(Libs.orbit_mvi_test) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9b09126..123afba 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,6 +2,8 @@ + + diff --git a/app/src/main/java/com/ericampire/android/androidstudycase/MainActivity.kt b/app/src/main/java/com/ericampire/android/androidstudycase/MainActivity.kt index 5e63be9..3a41ced 100644 --- a/app/src/main/java/com/ericampire/android/androidstudycase/MainActivity.kt +++ b/app/src/main/java/com/ericampire/android/androidstudycase/MainActivity.kt @@ -10,10 +10,12 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.Preview import com.ericampire.android.androidstudycase.presentation.screen.main.ui.MainScreen import com.ericampire.android.androidstudycase.presentation.theme.AndroidStudyCaseTheme +import com.google.accompanist.pager.ExperimentalPagerApi import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint class MainActivity : ComponentActivity() { + @ExperimentalPagerApi override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { diff --git a/app/src/main/java/com/ericampire/android/androidstudycase/app/AppNavigation.kt b/app/src/main/java/com/ericampire/android/androidstudycase/app/AppNavigation.kt index c87680e..acb36c9 100644 --- a/app/src/main/java/com/ericampire/android/androidstudycase/app/AppNavigation.kt +++ b/app/src/main/java/com/ericampire/android/androidstudycase/app/AppNavigation.kt @@ -9,6 +9,7 @@ import com.ericampire.android.androidstudycase.presentation.screen.home.business import com.ericampire.android.androidstudycase.presentation.screen.home.ui.HomeScreen import com.ericampire.android.androidstudycase.presentation.screen.preview.ui.PreviewScreen import com.ericampire.android.androidstudycase.util.Destination +import com.google.accompanist.pager.ExperimentalPagerApi fun NavGraphBuilder.addHomeScreen(navController: NavController) { composable(Destination.Home.route) { @@ -19,6 +20,7 @@ fun NavGraphBuilder.addHomeScreen(navController: NavController) { } } +@ExperimentalPagerApi fun NavGraphBuilder.addExploreScreen(navController: NavController) { composable(Destination.Explore.route) { ExploreScreen( diff --git a/app/src/main/java/com/ericampire/android/androidstudycase/presentation/custom/CustomImageView.kt b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/custom/CustomImageView.kt new file mode 100644 index 0000000..31c8e1a --- /dev/null +++ b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/custom/CustomImageView.kt @@ -0,0 +1,25 @@ +package com.ericampire.android.androidstudycase.presentation.custom + +import androidx.compose.foundation.Image +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.res.stringResource +import com.google.accompanist.glide.rememberGlidePainter +import com.ericampire.android.androidstudycase.R + +@Composable +fun CustomImageView( + modifier: Modifier = Modifier, + data: String, +) { + Image( + modifier = modifier, + painter = rememberGlidePainter( + request = data, + fadeIn = true + ), + contentScale = ContentScale.Crop, + contentDescription = null, + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/ericampire/android/androidstudycase/presentation/custom/TopActionBar.kt b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/custom/TopActionBar.kt new file mode 100644 index 0000000..7da2ede --- /dev/null +++ b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/custom/TopActionBar.kt @@ -0,0 +1,40 @@ +package com.ericampire.android.androidstudycase.presentation.custom + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.material.MaterialTheme +import androidx.compose.material.TopAppBar +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import com.ericampire.android.androidstudycase.R + +@Composable +fun TopActionBar(modifier: Modifier = Modifier) { + TopAppBar( + elevation = 0.dp, + modifier = modifier, + backgroundColor = Color.Transparent, + title = { + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.Center, + verticalAlignment = Alignment.CenterVertically, + content = { + Image( + modifier = Modifier.height(23.dp), + painter = painterResource(id = R.drawable.ic_lottiefiles_logo), + contentDescription = stringResource(id = R.string.txt_lottie_logo) + ) + } + ) + }, + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/explore/business/ExploreEffect.kt b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/explore/business/ExploreEffect.kt index c491e86..87724ba 100644 --- a/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/explore/business/ExploreEffect.kt +++ b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/explore/business/ExploreEffect.kt @@ -4,4 +4,5 @@ sealed interface ExploreEffect { data class ShowErrorMessage(val message: String) : ExploreEffect object Loading : ExploreEffect object Success : ExploreEffect + object Idle : ExploreEffect } \ No newline at end of file diff --git a/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/explore/ui/ExploreScreen.kt b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/explore/ui/ExploreScreen.kt index cb196ae..1345bc4 100644 --- a/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/explore/ui/ExploreScreen.kt +++ b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/explore/ui/ExploreScreen.kt @@ -1,13 +1,136 @@ package com.ericampire.android.androidstudycase.presentation.screen.explore.ui -import androidx.compose.runtime.Composable +import androidx.compose.animation.Crossfade +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.* +import androidx.compose.runtime.* +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringArrayResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp import androidx.navigation.NavController +import com.ericampire.android.androidstudycase.R +import com.ericampire.android.androidstudycase.presentation.custom.TopActionBar +import com.ericampire.android.androidstudycase.presentation.screen.explore.business.ExploreAction +import com.ericampire.android.androidstudycase.presentation.screen.explore.business.ExploreEffect import com.ericampire.android.androidstudycase.presentation.screen.explore.business.ExploreViewModel +import com.ericampire.android.androidstudycase.presentation.theme.AppColor +import com.google.accompanist.insets.navigationBarsPadding +import com.google.accompanist.insets.statusBarsPadding +import com.google.accompanist.pager.ExperimentalPagerApi +import com.google.accompanist.pager.pagerTabIndicatorOffset +import com.google.accompanist.pager.rememberPagerState +import kotlinx.coroutines.flow.collect +import kotlinx.coroutines.launch +import timber.log.Timber +@ExperimentalPagerApi @Composable fun ExploreScreen( navController: NavController, viewModel: ExploreViewModel ) { + val effects by viewModel.container.sideEffectFlow.collectAsState(ExploreEffect.Idle) + val state by viewModel.container.stateFlow.collectAsState() + + val tabItems = stringArrayResource(id = R.array.explore_item) + val pagerState = rememberPagerState(pageCount = tabItems.size) + val coroutineScope = rememberCoroutineScope() + + LaunchedEffect(viewModel) { + viewModel.submitAction(ExploreAction.FindRecentFile) + } + + LaunchedEffect(viewModel) { + snapshotFlow { pagerState.currentPage }.collect { page -> + when (page) { + 0 -> viewModel.submitAction(ExploreAction.FindRecentFile) + 1 -> viewModel.submitAction(ExploreAction.FindFeaturedFile) + else -> viewModel.submitAction(ExploreAction.FindPopularFile) + } + } + } + + Scaffold( + topBar = { + Column( + modifier = Modifier.fillMaxWidth().background(color = AppColor.Black001), + content = { + TopActionBar() + TabRow( + modifier = Modifier.fillMaxWidth(), + selectedTabIndex = pagerState.currentPage, + backgroundColor = Color.Transparent, + indicator = { tabPositions -> + TabRowDefaults.Indicator( + modifier = Modifier + .pagerTabIndicatorOffset(pagerState, tabPositions) + .padding(horizontal = 32.dp) + .clip(RoundedCornerShape(topStart = 12.dp, topEnd = 12.dp)), + height = 3.dp, + color = MaterialTheme.colors.primary + ) + }, + tabs = { + tabItems.forEachIndexed { index, title -> + Tab( + selected = index == pagerState.currentPage, + selectedContentColor = MaterialTheme.colors.primary, + unselectedContentColor = Color.White, + onClick = { + coroutineScope.launch { + pagerState.animateScrollToPage(index) + } + }, + content = { + Text( + modifier = Modifier.padding(vertical = 12.dp), + text = title, + style = MaterialTheme.typography.h6.copy( + fontWeight = FontWeight.Normal + ), + textAlign = TextAlign.Center, + ) + } + ) + } + } + ) + } + ) + }, + content = { contentPadding -> + Crossfade(modifier = Modifier.padding(contentPadding), targetState = effects) { + Box( + modifier = Modifier.fillMaxSize(), + contentAlignment = Alignment.Center, + content = { + when(it) { + ExploreEffect.Idle -> { + Timber.e("Idel") + } + ExploreEffect.Loading -> { + + } + is ExploreEffect.ShowErrorMessage -> { + + } + ExploreEffect.Success -> { + val data = state.files + Timber.e(data.toString()) + } + } + } + ) + } + } + ) } \ No newline at end of file diff --git a/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/explore/ui/LottieFileItem.kt b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/explore/ui/LottieFileItem.kt new file mode 100644 index 0000000..8c00fee --- /dev/null +++ b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/explore/ui/LottieFileItem.kt @@ -0,0 +1,201 @@ +package com.ericampire.android.androidstudycase.presentation.screen.explore.ui + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.CornerSize +import androidx.compose.material.* +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.rounded.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.tooling.preview.PreviewParameter +import androidx.compose.ui.unit.dp +import com.airbnb.lottie.compose.* +import com.ericampire.android.androidstudycase.domain.entity.Lottiefile +import com.ericampire.android.androidstudycase.presentation.custom.CustomImageView +import com.ericampire.android.androidstudycase.presentation.theme.AndroidStudyCaseTheme +import com.ericampire.android.androidstudycase.presentation.theme.AppColor +import com.ericampire.android.androidstudycase.util.LottieFileProvider + +@ExperimentalMaterialApi +@Composable +fun LottieFileItemView( + modifier: Modifier = Modifier, + lottiefile: Lottiefile, + onClick: (Lottiefile) -> Unit +) { + Card( + modifier = modifier, + elevation = 0.dp, + onClick = { onClick(lottiefile) }, + shape = MaterialTheme.shapes.large.copy(all = CornerSize(0.dp)), + content = { + Column( + modifier = Modifier.fillMaxWidth(), + horizontalAlignment = Alignment.CenterHorizontally, + content = { + Row( + modifier = Modifier + .background(AppColor.Black001) + .padding(12.dp) + .fillMaxWidth(), + horizontalArrangement = Arrangement.spacedBy(12.dp), + verticalAlignment = Alignment.CenterVertically, + content = { + CustomImageView( + modifier = Modifier + .size(44.dp) + .clip(CircleShape), + data = lottiefile.createdBy?.avatarUrl ?: "null", + ) + + Column( + verticalArrangement = Arrangement.spacedBy(4.dp), + content = { + Text( + text = lottiefile.name, + style = MaterialTheme.typography.h6, + textAlign = TextAlign.Center, + ) + Text( + text = lottiefile.createdBy?.name ?: "", + style = MaterialTheme.typography.caption, + textAlign = TextAlign.Center, + ) + } + ) + } + ) + LottieFileContentView(lottiefile = lottiefile) + + ActionButton( + onLikeClick = { /*TODO*/ }, + onCommentClick = { /*TODO*/ }, + onAddCollectionClick = { /*TODO*/ }, + onShareClick = { } + ) + } + ) + } + ) +} + + +@Composable +fun LottieFileContentView( + modifier: Modifier = Modifier, + lottiefile: Lottiefile +) { + + val composition by rememberLottieComposition( + spec = LottieCompositionSpec.Url(lottiefile.lottieUrl) + ) + val progress by animateLottieCompositionAsState( + composition = composition, + iterations = LottieConstants.IterateForever, + ) + + Box( + modifier = modifier.background(Color.White), + content = { + LottieAnimation( + modifier = Modifier + .fillMaxWidth() + .height(400.dp), + composition = composition, + progress = progress, + ) + } + ) +} + +@Composable +private fun ActionButton( + modifier: Modifier = Modifier, + onLikeClick: () -> Unit, + onCommentClick: () -> Unit, + onAddCollectionClick: () -> Unit, + onShareClick: () -> Unit, +) { + Row( + modifier = modifier + .background(AppColor.Black001) + .padding(12.dp) + .fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically, + content = { + Row( + horizontalArrangement = Arrangement.spacedBy(20.dp), + verticalAlignment = Alignment.CenterVertically, + content = { + IconButton( + modifier = Modifier.size(20.dp), + onClick = onLikeClick, + content = { + Icon( + imageVector = Icons.Rounded.Favorite, + contentDescription = null + ) + } + ) + IconButton( + modifier = Modifier.size(20.dp), + onClick = onCommentClick, + content = { + Icon( + imageVector = Icons.Rounded.ChatBubble, + contentDescription = null + ) + } + ) + IconButton( + modifier = Modifier.size(20.dp), + onClick = onAddCollectionClick, + content = { + Icon( + imageVector = Icons.Rounded.CreateNewFolder, + contentDescription = null + ) + } + ) + } + ) + IconButton( + modifier = Modifier.size(20.dp), + onClick = onShareClick, + content = { + Icon( + imageVector = Icons.Rounded.Share, + contentDescription = null + ) + } + ) + } + ) +} + +@ExperimentalMaterialApi +@Preview() +@Composable +fun LottiefileItemViewPreview(@PreviewParameter(LottieFileProvider::class) data: Lottiefile) { + AndroidStudyCaseTheme(darkTheme = true) { + Box( + modifier = Modifier.fillMaxSize(), + contentAlignment = Alignment.Center, + content = { + LottieFileItemView( + lottiefile = data, + onClick = {} + ) + } + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/main/ui/MainScreen.kt b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/main/ui/MainScreen.kt index 5ca0dfa..45d415e 100644 --- a/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/main/ui/MainScreen.kt +++ b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/screen/main/ui/MainScreen.kt @@ -8,9 +8,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material.* import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.rounded.Explore -import androidx.compose.material.icons.rounded.Home -import androidx.compose.material.icons.rounded.Scanner +import androidx.compose.material.icons.rounded.* import androidx.compose.runtime.* import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -24,7 +22,11 @@ import com.ericampire.android.androidstudycase.app.addExploreScreen import com.ericampire.android.androidstudycase.app.addHomeScreen import com.ericampire.android.androidstudycase.app.addPreviewScreen import com.ericampire.android.androidstudycase.util.Destination +import com.google.accompanist.insets.navigationBarsPadding +import com.google.accompanist.insets.statusBarsPadding +import com.google.accompanist.pager.ExperimentalPagerApi +@ExperimentalPagerApi @Composable fun MainScreen() { val navController = rememberNavController() @@ -36,6 +38,7 @@ fun MainScreen() { ) Scaffold( + modifier = Modifier.statusBarsPadding().navigationBarsPadding(), bottomBar = { BottomNavigation( backgroundColor = MaterialTheme.colors.background, @@ -85,8 +88,8 @@ fun MainScreen() { fun getIconByIndex(index: Int): ImageVector { return when (index) { 0 -> Icons.Rounded.Home - 1 -> Icons.Rounded.Scanner - 2 -> Icons.Rounded.Explore + 1 -> Icons.Rounded.QrCodeScanner + 2 -> Icons.Rounded.Escalator else -> Icons.Rounded.Home } } \ No newline at end of file diff --git a/app/src/main/java/com/ericampire/android/androidstudycase/presentation/theme/Color.kt b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/theme/Color.kt index 584e942..d5d2811 100644 --- a/app/src/main/java/com/ericampire/android/androidstudycase/presentation/theme/Color.kt +++ b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/theme/Color.kt @@ -5,8 +5,9 @@ import androidx.compose.ui.graphics.Color object AppColor { - val Purple200 = Color(0xFFBB86FC) - val Purple500 = Color(0xFF6200EE) + val PrimaryColor = Color(0xFF2BEAED) + val PrimaryColorDark = Color(0xFF006B78) val Purple700 = Color(0xFF3700B3) val Teal200 = Color(0xFF03DAC5) + val Black001 = Color(0xFF222222) } \ No newline at end of file diff --git a/app/src/main/java/com/ericampire/android/androidstudycase/presentation/theme/Theme.kt b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/theme/Theme.kt index 39b8c7e..31df401 100644 --- a/app/src/main/java/com/ericampire/android/androidstudycase/presentation/theme/Theme.kt +++ b/app/src/main/java/com/ericampire/android/androidstudycase/presentation/theme/Theme.kt @@ -9,7 +9,7 @@ import androidx.compose.ui.graphics.Color import com.google.accompanist.insets.ProvideWindowInsets private val DarkColorPalette = darkColors( - primary = AppColor.Purple200, + primary = AppColor.PrimaryColor, primaryVariant = AppColor.Purple700, secondary = AppColor.Teal200, background = Color.Black, @@ -21,7 +21,7 @@ private val DarkColorPalette = darkColors( ) private val LightColorPalette = lightColors( - primary = AppColor.Purple500, + primary = AppColor.PrimaryColorDark, primaryVariant = AppColor.Purple700, secondary = AppColor.Teal200, background = Color.White, diff --git a/app/src/main/java/com/ericampire/android/androidstudycase/util/PreviewData.kt b/app/src/main/java/com/ericampire/android/androidstudycase/util/PreviewData.kt new file mode 100644 index 0000000..de0e03a --- /dev/null +++ b/app/src/main/java/com/ericampire/android/androidstudycase/util/PreviewData.kt @@ -0,0 +1,97 @@ +package com.ericampire.android.androidstudycase.util + +import com.ericampire.android.androidstudycase.domain.entity.Animator +import com.ericampire.android.androidstudycase.domain.entity.Blog +import com.ericampire.android.androidstudycase.domain.entity.Lottiefile + +object PreviewData { + object Blog { + val data = listOf( + Blog( + postedAt = "2021-07-08T00:00:00.000Z", + imageUrl = "https://d3jl769oy69y7b.cloudfront.net/2021/07/Blog-Visual---The-Key-to-An-Immersive-UX_-Animation.png", + title = "The Key to An Immersive UX: Animation" + ), + Blog( + title = "LottieFiles Animations are accessible across 25,000+ everyday tools with the embed feature", + postedAt = "2021-06-18T00:00:00.000Z", + imageUrl = "https://d3jl769oy69y7b.cloudfront.net/2021/06/Embed-Blog-OG.png" + ), + Blog( + postedAt = "2021-07-08T00:00:00.000Z", + imageUrl = "https://d3jl769oy69y7b.cloudfront.net/2021/07/Blog-Visual---The-Key-to-An-Immersive-UX_-Animation.png", + title = "The Key to An Immersive UX: Animation" + ), + Blog( + title = "LottieFiles Animations are accessible across 25,000+ everyday tools with the embed feature", + postedAt = "2021-06-18T00:00:00.000Z", + imageUrl = "https://d3jl769oy69y7b.cloudfront.net/2021/06/Embed-Blog-OG.png" + ), + ) + } + object Lottiefile { + val data = listOf( + Lottiefile( + id = 1370, + bgColor = "#ffffff", + lottieUrl = "https://assets4.lottiefiles.com/datafiles/U1I3rWEyksM9cCH/data.json", + gifUrl = "https://assets3.lottiefiles.com/render/julivspr.gif", + videoUrl = "https://assets3.lottiefiles.com/render/julivspr.mp4", + imageUrl = "https://assets8.lottiefiles.com/render/julivspr.png", + createdAt = "2018-02-02T15:53:12.000Z", + name = "confetti", + createdBy = PreviewData.Animator.data.first() + ), + Lottiefile( + id = 427, + bgColor = "#ffffff", + lottieUrl = "https://assets8.lottiefiles.com/datafiles/zc3XRzudyWE36ZBJr7PIkkqq0PFIrIBgp4ojqShI/newAnimation.json", + gifUrl = "https://assets10.lottiefiles.com/render/juml9ngj.gif", + videoUrl = "https://assets10.lottiefiles.com/render/juml9ngj.mp4", + imageUrl = "https://assets4.lottiefiles.com/render/juml9ngj.png", + createdAt = "2017-07-28T14:25:49.000Z", + name = "Happy Birthday!", + createdBy = PreviewData.Animator.data[1] + ), + Lottiefile( + id = 782, + bgColor = "#ffffff", + lottieUrl = "https://assets5.lottiefiles.com/datafiles/8UjWgBkqvEF5jNoFcXV4sdJ6PXpS6DwF7cK4tzpi/Check Mark Success/Check Mark Success Data.json", + gifUrl = "https://assets2.lottiefiles.com/render/jum1r6it.gif", + videoUrl = "https://assets2.lottiefiles.com/render/jum1r6it.mp4", + imageUrl = "https://assets1.lottiefiles.com/render/jum1r6it.png", + createdAt = "2017-10-04T18:16:21.000Z", + name = "Check Mark - Success", + createdBy = PreviewData.Animator.data[2] + ), + ) + } + object Animator { + val data = listOf( + Animator( + name = "Kevin Correa", + avatarUrl = "https://assets4.lottiefiles.com/avatars/300_60abcb0579641.jpg" + ), + Animator( + name = "Alexander Plaksin", + avatarUrl = "https://assets5.lottiefiles.com/avatars/300_487756-994436705.jpg" + ), + Animator( + name = "Vanessa Urrunaga", + avatarUrl = "https://assets2.lottiefiles.com/avatars/300_60df0a5dbd4f5.jpg" + ), + Animator( + name = "Kevin Correa", + avatarUrl = "https://assets4.lottiefiles.com/avatars/300_60abcb0579641.jpg" + ), + Animator( + name = "Alexander Plaksin", + avatarUrl = "https://assets5.lottiefiles.com/avatars/300_487756-994436705.jpg" + ), + Animator( + name = "Vanessa Urrunaga", + avatarUrl = "https://assets2.lottiefiles.com/avatars/300_60df0a5dbd4f5.jpg" + ), + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/ericampire/android/androidstudycase/util/PreviewParameter.kt b/app/src/main/java/com/ericampire/android/androidstudycase/util/PreviewParameter.kt new file mode 100644 index 0000000..c0a4765 --- /dev/null +++ b/app/src/main/java/com/ericampire/android/androidstudycase/util/PreviewParameter.kt @@ -0,0 +1,24 @@ +package com.ericampire.android.androidstudycase.util + +import androidx.compose.ui.tooling.preview.PreviewParameterProvider +import com.ericampire.android.androidstudycase.domain.entity.Animator +import com.ericampire.android.androidstudycase.domain.entity.Blog +import com.ericampire.android.androidstudycase.domain.entity.Lottiefile + + +class BlogProvider : PreviewParameterProvider { + override val values: Sequence + get() = PreviewData.Blog.data.asSequence() +} + + +class AnimatorProvider : PreviewParameterProvider { + override val values: Sequence + get() = PreviewData.Animator.data.asSequence() +} + + +class LottieFileProvider : PreviewParameterProvider { + override val values: Sequence + get() = PreviewData.Lottiefile.data.asSequence() +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_lottiefiles_logo.xml b/app/src/main/res/drawable/ic_lottiefiles_logo.xml new file mode 100644 index 0000000..332fa03 --- /dev/null +++ b/app/src/main/res/drawable/ic_lottiefiles_logo.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml deleted file mode 100644 index bd99ff3..0000000 --- a/app/src/main/res/values-night/themes.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 815c006..5e4fa24 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -2,14 +2,16 @@ diff --git a/i18n/src/main/res/values/arrays.xml b/i18n/src/main/res/values/arrays.xml index 7ce23a6..7591027 100644 --- a/i18n/src/main/res/values/arrays.xml +++ b/i18n/src/main/res/values/arrays.xml @@ -1,37 +1,9 @@ - - Commandes - Tout - - - Nouveau fournisseur - Promotions - Commandes - Nouvelle mise à jour - Globale - - - - stores - products - orders - global - default - - - - Être notifié lorsqu\'un nouveau fournisseur est disponible sur Be Served. - Être notifié lorsqu\'il y a de nouvelles promotions. - Être notifié lorsque l\'état de votre commande change. - Être notifié lorsqu\'une nouvelle version de l\'application est disponible. - Autres notifications. - - - - En cours - Refusée - Historique + + Recent + Featured + Popular \ No newline at end of file diff --git a/i18n/src/main/res/values/strings.xml b/i18n/src/main/res/values/strings.xml index dc14493..a713ae7 100644 --- a/i18n/src/main/res/values/strings.xml +++ b/i18n/src/main/res/values/strings.xml @@ -8,4 +8,5 @@ Featured Recent Popular + Lottie Logo \ No newline at end of file diff --git a/versions.properties b/versions.properties index 5c5203b..b8b7605 100644 --- a/versions.properties +++ b/versions.properties @@ -59,3 +59,4 @@ version.io.insert-koin..koin-android=3.1.2 version.io.insert-koin..koin-androidx-viewmodel=3.1.2 version.io.insert-koin..koin-androidx-compose=3.1.2 version.io.insert-koin..koin-androidx-workmanager=3.1.2 +version.com.airbnb.android..lottie-compose=4.1.0