Improving build speed
This commit is contained in:
+1
-1
@@ -45,7 +45,7 @@ fun CustomGoogleButton(
|
||||
Text(
|
||||
style = MaterialTheme.typography.h5,
|
||||
color = MaterialTheme.colors.surface,
|
||||
text = stringResource(R.string.txt_connect_with_google)
|
||||
text = stringResource(org.zxconnect.android.beserve.i18n.R.string.txt_connect_with_google)
|
||||
)
|
||||
Icon(
|
||||
tint = Color.Transparent,
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ fun TopActionBar(modifier: Modifier = Modifier) {
|
||||
Image(
|
||||
modifier = Modifier.height(23.dp),
|
||||
painter = painterResource(id = R.drawable.ic_lottiefiles_logo),
|
||||
contentDescription = stringResource(id = R.string.txt_lottie_logo)
|
||||
contentDescription = stringResource(id = org.zxconnect.android.beserve.i18n.R.string.txt_lottie_logo)
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import com.ericampire.android.androidstudycase.domain.usecase.FindPopularLottieF
|
||||
import com.ericampire.android.androidstudycase.domain.usecase.FindRecentLottieFileUseCase
|
||||
import com.ericampire.android.androidstudycase.util.Result
|
||||
import com.ericampire.android.androidstudycase.util.data
|
||||
import com.ericampire.android.androidstudycase.util.mvi.BaseViewModel
|
||||
import com.ericampire.android.androidstudycase.util.mvi.BViewModel
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
import dagger.assisted.AssistedInject
|
||||
@@ -23,7 +23,7 @@ class ExploreViewModel @AssistedInject constructor(
|
||||
private val findPopularLottieFileUseCase: FindPopularLottieFileUseCase,
|
||||
private val findRecentLottieFileUseCase: FindRecentLottieFileUseCase,
|
||||
private val findFeaturedLottieFileUseCase: FindFeaturedLottieFileUseCase
|
||||
) : BaseViewModel<ExploreViewState, ExploreAction>(initialState) {
|
||||
) : BViewModel<ExploreViewState, ExploreAction>(initialState) {
|
||||
|
||||
init {
|
||||
viewModelScope.launch {
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ fun ExploreScreen(
|
||||
val state by viewModel.collectAsState(ExploreViewState::files)
|
||||
val context = LocalContext.current
|
||||
|
||||
val tabItems = stringArrayResource(id = R.array.explore_item)
|
||||
val tabItems = stringArrayResource(id = org.zxconnect.android.beserve.i18n.R.array.explore_item)
|
||||
val pagerState = rememberPagerState()
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import com.ericampire.android.androidstudycase.app.hilt.hiltMavericksViewModelFa
|
||||
import com.ericampire.android.androidstudycase.domain.usecase.*
|
||||
import com.ericampire.android.androidstudycase.util.PreviewData
|
||||
import com.ericampire.android.androidstudycase.util.data
|
||||
import com.ericampire.android.androidstudycase.util.mvi.BaseViewModel
|
||||
import com.ericampire.android.androidstudycase.util.mvi.BViewModel
|
||||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedFactory
|
||||
import dagger.assisted.AssistedInject
|
||||
@@ -23,7 +23,7 @@ class HomeViewModel @AssistedInject constructor(
|
||||
private val findUsersUseCase: FindUsersUseCase,
|
||||
private val findFeaturedLottieFileUseCase: FindFeaturedLottieFileUseCase,
|
||||
private val saveUserUseCase: SaveUserUseCase
|
||||
) : BaseViewModel<HomeViewState, HomeAction>(initialState) {
|
||||
) : BViewModel<HomeViewState, HomeAction>(initialState) {
|
||||
|
||||
|
||||
init {
|
||||
|
||||
+3
-3
@@ -47,14 +47,14 @@ fun BrowseAllItemView(modifier: Modifier = Modifier) {
|
||||
modifier = Modifier.padding(end = 12.dp)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.txt_browse_all),
|
||||
text = stringResource(org.zxconnect.android.beserve.i18n.R.string.txt_browse_all),
|
||||
style = MaterialTheme.typography.h4.copy(
|
||||
color = MaterialTheme.colors.onSurface
|
||||
),
|
||||
)
|
||||
|
||||
Text(
|
||||
text = stringResource(R.string.txt_browse_all_desc),
|
||||
text = stringResource(org.zxconnect.android.beserve.i18n.R.string.txt_browse_all_desc),
|
||||
style = MaterialTheme.typography.body1.copy(
|
||||
color = MaterialTheme.colors.onSurface
|
||||
),
|
||||
@@ -63,7 +63,7 @@ fun BrowseAllItemView(modifier: Modifier = Modifier) {
|
||||
|
||||
TextButton(onClick = { /*TODO*/ }) {
|
||||
Text(
|
||||
text = stringResource(R.string.txt_go_to_explore),
|
||||
text = stringResource(org.zxconnect.android.beserve.i18n.R.string.txt_go_to_explore),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -191,7 +191,7 @@ fun HomeContent(
|
||||
Text(
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
maxLines = 1,
|
||||
text = stringResource(id = R.string.txt_featured_animator),
|
||||
text = stringResource(id = org.zxconnect.android.beserve.i18n.R.string.txt_featured_animator),
|
||||
style = MaterialTheme.typography.h4.copy(
|
||||
color = MaterialTheme.colors.onSurface
|
||||
),
|
||||
@@ -219,7 +219,7 @@ fun HomeContent(
|
||||
Text(
|
||||
modifier = Modifier.padding(horizontal = 16.dp),
|
||||
maxLines = 1,
|
||||
text = stringResource(id = R.string.txt_latest_story),
|
||||
text = stringResource(id = org.zxconnect.android.beserve.i18n.R.string.txt_latest_story),
|
||||
style = MaterialTheme.typography.h4.copy(
|
||||
color = MaterialTheme.colors.onSurface
|
||||
),
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ fun LoginBottomSheet(
|
||||
)
|
||||
Text(
|
||||
textAlign = TextAlign.Center,
|
||||
text = stringResource(id = R.string.txt_get_started),
|
||||
text = stringResource(id = org.zxconnect.android.beserve.i18n.R.string.txt_get_started),
|
||||
style = MaterialTheme.typography.body1.copy(
|
||||
color = MaterialTheme.colors.onSurface
|
||||
),
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ fun UnLoggedUserHeaderView(
|
||||
.size(57.dp)
|
||||
.clip(CircleShape),
|
||||
painter = painterResource(id = R.drawable.lottiefiles_circle_logo),
|
||||
contentDescription = stringResource(id = R.string.txt_lottie_logo)
|
||||
contentDescription = stringResource(id = org.zxconnect.android.beserve.i18n.R.string.txt_lottie_logo)
|
||||
)
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
@@ -51,7 +51,7 @@ fun UnLoggedUserHeaderView(
|
||||
)
|
||||
Text(
|
||||
maxLines = 1,
|
||||
text = stringResource(R.string.txt_hello_stranger),
|
||||
text = stringResource(org.zxconnect.android.beserve.i18n.R.string.txt_hello_stranger),
|
||||
style = MaterialTheme.typography.h3.copy(
|
||||
color = AppColor.PaleBlue
|
||||
),
|
||||
@@ -59,7 +59,7 @@ fun UnLoggedUserHeaderView(
|
||||
Text(
|
||||
modifier = Modifier.clickable(onClick = onLoginClick),
|
||||
maxLines = 1,
|
||||
text = stringResource(R.string.txt_login),
|
||||
text = stringResource(org.zxconnect.android.beserve.i18n.R.string.txt_login),
|
||||
style = MaterialTheme.typography.body1.copy(
|
||||
color = AppColor.Teal
|
||||
),
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ fun PreviewScreen(navController: NavController) {
|
||||
permissionState = cameraPermissionState,
|
||||
permissionNotGrantedContent = {
|
||||
PermissionNotAvailableContent(
|
||||
descriptionMessage = stringResource(R.string.txt_camera_permssion_required),
|
||||
descriptionMessage = stringResource(org.zxconnect.android.beserve.i18n.R.string.txt_camera_permssion_required),
|
||||
onPermissionRequest = {
|
||||
cameraPermissionState.launchPermissionRequest()
|
||||
}
|
||||
@@ -74,7 +74,7 @@ fun PreviewScreen(navController: NavController) {
|
||||
},
|
||||
permissionNotAvailableContent = {
|
||||
PermissionNotAvailableContent(
|
||||
descriptionMessage = stringResource(R.string.txt_permission_denied),
|
||||
descriptionMessage = stringResource(org.zxconnect.android.beserve.i18n.R.string.txt_permission_denied),
|
||||
onPermissionRequest = {
|
||||
cameraPermissionState.launchPermissionRequest()
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import androidx.annotation.StringRes
|
||||
import com.ericampire.android.androidstudycase.R
|
||||
|
||||
sealed class Destination(val route: String, @StringRes val resourceId: Int) {
|
||||
object Home : Destination("home", R.string.txt_home)
|
||||
object Explore : Destination("explore", R.string.txt_explore)
|
||||
object Preview : Destination("preview", R.string.txt_preview)
|
||||
object Login : Destination("login", R.string.txt_login)
|
||||
object Home : Destination("home", org.zxconnect.android.beserve.i18n.R.string.txt_home)
|
||||
object Explore : Destination("explore", org.zxconnect.android.beserve.i18n.R.string.txt_explore)
|
||||
object Preview : Destination("preview", org.zxconnect.android.beserve.i18n.R.string.txt_preview)
|
||||
object Login : Destination("login", org.zxconnect.android.beserve.i18n.R.string.txt_login)
|
||||
}
|
||||
@@ -163,4 +163,9 @@ object Libs {
|
||||
|
||||
const val junit5_android_test_core = "de.mannodermaus.junit5:android-test-core:_"
|
||||
const val junit5_android_test_runner = "de.mannodermaus.junit5:android-test-runner:_"
|
||||
|
||||
const val mvi_kotlin_core = "com.arkivanov.mvikotlin:mvikotlin:_"
|
||||
const val mvi_kotlin_main = "com.arkivanov.mvikotlin:mvikotlin-main:_"
|
||||
const val mvi_kotlin_logging = "com.arkivanov.mvikotlin:mvikotlin-logging:_"
|
||||
const val mvi_kotlin_extension_coroutine = "com.arkivanov.mvikotlin:mvikotlin-extensions-coroutines:_"
|
||||
}
|
||||
|
||||
@@ -18,4 +18,11 @@ android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
org.gradle.unsafe.configuration-cache=true
|
||||
org.gradle.unsafe.configuration-cache-problems=warn
|
||||
android.nonTransitiveRClass=true
|
||||
kotlin.code.style=official
|
||||
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" -Dfile.encoding\=UTF-8 -XX:+UseParallelGC
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
kapt.incremental.apt=true
|
||||
+2
-5
@@ -1,8 +1,5 @@
|
||||
plugins {
|
||||
id("de.fayard.refreshVersions") version "0.20.0"
|
||||
//// # available:"0.21.0"
|
||||
//// # available:"0.22.0"
|
||||
//// # available:"0.23.0"
|
||||
id("de.fayard.refreshVersions") version "0.23.0"
|
||||
}
|
||||
|
||||
refreshVersions {
|
||||
@@ -17,7 +14,7 @@ dependencyResolutionManagement {
|
||||
jcenter() // Todo: Warning this repository is going to shut down soon
|
||||
}
|
||||
}
|
||||
rootProject.name = "lottiefiles"
|
||||
rootProject.name = "lottiefiles-app"
|
||||
include(":app")
|
||||
include(":util")
|
||||
include(":i18n")
|
||||
|
||||
@@ -31,6 +31,8 @@ android {
|
||||
dependencies {
|
||||
|
||||
api(project(":i18n"))
|
||||
api("org.reduxkotlin:redux-kotlin-threadsafe:0.5.5")
|
||||
|
||||
implementation(Libs.core_ktx)
|
||||
api(Libs.androidx_lifecycle_viewmodel_ktx)
|
||||
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ private fun Context.shareFile(filePath: String) {
|
||||
)
|
||||
|
||||
val shareIntent = ShareCompat.IntentBuilder(this)
|
||||
.setChooserTitle(getString(R.string.txt_share_lottie_file))
|
||||
.setChooserTitle(getString(org.zxconnect.android.beserve.i18n.R.string.txt_share_lottie_file))
|
||||
.setStream(fileUri)
|
||||
.setType("application/pdf")
|
||||
.createChooserIntent()
|
||||
|
||||
+4
-1
@@ -4,8 +4,11 @@ import com.airbnb.mvrx.MavericksState
|
||||
import com.airbnb.mvrx.MavericksViewModel
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import org.reduxkotlin.Reducer
|
||||
import org.reduxkotlin.Store
|
||||
import org.reduxkotlin.createThreadSafeStore
|
||||
|
||||
abstract class BaseViewModel<S : MavericksState, A>(
|
||||
abstract class BViewModel<S : MavericksState, A>(
|
||||
initialState: S
|
||||
) : MavericksViewModel<S>(initialState) {
|
||||
protected val pendingAction = MutableSharedFlow<A>()
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.ericampire.android.androidstudycase.util.mvi.core
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
interface Action
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ericampire.android.androidstudycase.util.mvi.core
|
||||
|
||||
|
||||
|
||||
interface Reducer<S: State, A: Action> {
|
||||
|
||||
/**
|
||||
* Given a [currentState] and some [action] that user took, produce a new [State].
|
||||
*
|
||||
* This will give us and predictable state management, that ensures each state is associated
|
||||
* with some specific user intent or action
|
||||
*/
|
||||
fun reduce(currentState: S, action: A): S
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.ericampire.android.androidstudycase.util.mvi.core
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
interface State
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ericampire.android.androidstudycase.util.mvi.core
|
||||
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
|
||||
/**
|
||||
* A [Store] is our state container for a given screen
|
||||
*
|
||||
* @param[initialState] this is the initial state of the screen when it is first creates
|
||||
* @param[reducer] A system for taking in the current state, and a new action, and outputting the
|
||||
* updated state
|
||||
*/
|
||||
abstract class Store<S: State, A: Action>(
|
||||
initialState: S,
|
||||
private val reducer: Reducer<S, A>
|
||||
) {
|
||||
private val _state = MutableStateFlow(initialState)
|
||||
val state: StateFlow<S> = _state
|
||||
|
||||
fun dispatch(action: A) {
|
||||
val currentState = _state.value
|
||||
_state.value = reducer.reduce(currentState, action)
|
||||
}
|
||||
}
|
||||
+18
-6
@@ -34,25 +34,25 @@ version.androidx.preference=1.1.1
|
||||
version.androidx.appcompat=1.3.0
|
||||
|
||||
## unused
|
||||
version.androidx.compose.compiler=1.0.4
|
||||
version.androidx.compose.compiler=1.1.0-beta01
|
||||
|
||||
## unused
|
||||
version.androidx.compose.material-icons-extended=1.0.4
|
||||
version.androidx.compose.material-icons-extended=1.1.0-beta01
|
||||
|
||||
## unused
|
||||
version.androidx.compose.material=1.0.4
|
||||
version.androidx.compose.material=1.1.0-beta01
|
||||
|
||||
## unused
|
||||
version.androidx.compose.runtime=1.0.4
|
||||
version.androidx.compose.runtime=1.1.0-beta01
|
||||
|
||||
## unused
|
||||
version.google.accompanist=0.20.0
|
||||
|
||||
## unused
|
||||
version.androidx.compose.ui=1.0.4
|
||||
version.androidx.compose.ui=1.1.0-beta01
|
||||
|
||||
## unused
|
||||
version.androidx.compose.ui-viewbinding=1.0.4
|
||||
version.androidx.compose.ui-viewbinding=1.1.0-beta01
|
||||
|
||||
## unused
|
||||
version.androidx.core=1.5.0
|
||||
@@ -195,3 +195,15 @@ version.de.mannodermaus.junit5..android-test-runner=1.2.2
|
||||
|
||||
## unused
|
||||
version.de.mannodermaus.junit5..android-test-core=1.2.2
|
||||
|
||||
## unused
|
||||
version.com.arkivanov.mvikotlin..mvikotlin=2.0.4
|
||||
|
||||
## unused
|
||||
version.com.arkivanov.mvikotlin..mvikotlin-main=2.0.4
|
||||
|
||||
## unused
|
||||
version.com.arkivanov.mvikotlin..mvikotlin-logging=2.0.4
|
||||
|
||||
## unused
|
||||
version.com.arkivanov.mvikotlin..mvikotlin-extensions-coroutines=2.0.4
|
||||
|
||||
Reference in New Issue
Block a user