Skip to content

Commit

Permalink
Merge pull request #5 from Merseyside/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Merseyside authored Dec 29, 2021
2 parents cd89c79 + b13a353 commit 11215cd
Show file tree
Hide file tree
Showing 25 changed files with 53 additions and 375 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.merseyside.merseyLib.archy.core.presentation.model.BaseViewModel
import com.merseyside.merseyLib.archy.core.presentation.model.StateViewModel
import com.merseyside.merseyLib.archy.core.presentation.model.StateViewModel.Companion.INSTANCE_STATE_KEY
import com.merseyside.merseyLib.utils.core.SavedState
import com.merseyside.utils.ext.getSerialize
import com.merseyside.utils.ext.putSerialize
import com.merseyside.utils.reflection.ReflectionUtils
import com.merseyside.utils.requestPermissions
Expand Down Expand Up @@ -109,6 +110,22 @@ abstract class BaseVMFragment<B : ViewDataBinding, M : BaseViewModel>
}
}

override fun onViewStateRestored(savedInstanceState: Bundle?) {
val savedState = SavedState().apply {
savedInstanceState?.getSerialize(
INSTANCE_STATE_KEY, MapSerializer(String.serializer(), String.serializer())
)?.let {
addAll(
it
)
}
}
if (viewModel is StateViewModel) {
(viewModel as StateViewModel).onRestoreState(savedState)
}
super.onViewStateRestored(savedInstanceState)
}

override fun updateLanguage(context: Context) {
super.updateLanguage(context)
//viewModel.updateLanguage(context)
Expand Down Expand Up @@ -160,3 +177,4 @@ abstract class BaseVMFragment<B : ViewDataBinding, M : BaseViewModel>
).kotlin as KClass<M>
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ abstract class BaseViewModel protected constructor() : ViewModel() {
val isInProgress: LiveData<Boolean> = mutProgress

protected var progress: Boolean
get() { return mutProgress.value }
set(value) { mutProgress.value = value }
get() {
return mutProgress.value
}
set(value) {
mutProgress.value = value
}

private val mutProgressText = MutableSingleEvent<String?>(null)
val progressText: LiveData<String?> = mutProgressText
Expand All @@ -32,6 +36,9 @@ abstract class BaseViewModel protected constructor() : ViewModel() {
private val mutGrantPermissionLiveEvent = MutableSingleEvent<Pair<Array<String>, Int>?>(null)
val grantPermissionLiveEvent: LiveData<Pair<Array<String>, Int>?> = mutGrantPermissionLiveEvent

private val mutQueryRestoreEvent = MutableSingleEvent<String?>(null)
val queryRestoreEvent: LiveData<String?> = mutQueryRestoreEvent

data class TextMessage(
val isError: Boolean = false,
var msg: String = "",
Expand Down Expand Up @@ -182,7 +189,11 @@ abstract class BaseViewModel protected constructor() : ViewModel() {
)
}

open fun onBack() : Boolean {
fun restoreQuery(query: String) {
mutQueryRestoreEvent.value = query
}

open fun onBack(): Boolean {
return true
}
}
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/Modules.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ object Modules {
object MerseyLibs {
val archy = ":archy-core"
val utils = ":utils-core"
val kotlinExt = ":kotlin-ext"
}

val mppLibrary = ":mpp-library"
Expand Down
3 changes: 3 additions & 0 deletions buildSrc/src/main/kotlin/extensions/GradleExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ fun Project.isLocalDependencies(): Boolean =
fun Project.isLocalAndroidDependencies(): Boolean =
findTypedProperty("build.localAndroidDependencies")

fun Project.isLocalKotlinExtLibrary(): Boolean =
findTypedProperty("build.localKotlinExtLibrary")

inline fun <reified T: MinimalExternalModuleDependency> Any.toProvider(): Provider<T> {
return when (this) {
is Provider<*> -> this as Provider<T>
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/publication/Metadata.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Metadata {
const val groupId = "io.github.merseyside"
const val version = "1.4.4"
const val version = "1.4.5"
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ kotlin.code.style=official

build.localDependencies=false
build.localAndroidDependencies=false
build.localKotlinExtLibrary=false

#Enable commonizer
kotlin.mpp.enableGranularSourceSetsMetadata=true
Expand Down
Loading

0 comments on commit 11215cd

Please sign in to comment.