MB-43444 #10
|
|
@ -1,10 +1,10 @@
|
|||
apply plugin: 'kotlin-android'
|
||||
|
||||
rootProject.ext {
|
||||
compileSdk = 29
|
||||
compileSdk = 33
|
||||
|
||||
minSdk = 21
|
||||
targetSdk = 29
|
||||
targetSdk = 33
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
@ -16,12 +16,12 @@ android {
|
|||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||
jvmTarget = JavaVersion.VERSION_17.toString()
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
apply from: "../android-configs/lib-config.gradle"
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.templates.logansquare"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(":utils")
|
||||
implementation project(":logging")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
apply from: "../android-configs/lib-config.gradle"
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.extensions"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "androidx.recyclerview:recyclerview"
|
||||
implementation "androidx.fragment:fragment-ktx"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
apply from: "../android-configs/lib-config.gradle"
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.lifecycle.rx"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api project(":utils")
|
||||
api project(":logging")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
apply from: "../android-configs/lib-config.gradle"
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.lifecycle_viewcontroller"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(":lifecycle")
|
||||
implementation project(":navigation-viewcontroller")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
apply from: "../android-configs/lib-config.gradle"
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.lifecycle"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly "javax.inject:javax.inject:1"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,17 @@
|
|||
apply from: "../android-configs/lib-config.gradle"
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.livedata.location"
|
||||
}
|
||||
|
||||
configurations.configureEach {
|
||||
resolutionStrategy.eachDependency {
|
||||
if (requested.name == "agconnect-core") {
|
||||
useVersion(libs.versions.agconnectCore.get())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api project(":lifecycle")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
apply from: "../android-configs/lib-config.gradle"
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.roboswag.core.log"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "androidx.annotation:annotation"
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,20 @@ apply from: "../android-configs/lib-config.gradle"
|
|||
apply plugin: 'kotlin-kapt'
|
||||
|
||||
android {
|
||||
buildFeatures.viewBinding = true
|
||||
namespace "ru.touchin.roboswag.navigation_base"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_17.toString()
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
buildConfig true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,23 @@ apply from: "../android-configs/lib-config.gradle"
|
|||
|
||||
apply plugin: 'kotlin-kapt'
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.roboswag.navigation_viewcontroller"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_17.toString()
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
buildConfig true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(":utils")
|
||||
implementation project(":logging")
|
||||
|
|
@ -13,7 +30,7 @@ dependencies {
|
|||
constraints {
|
||||
implementation("androidx.appcompat:appcompat") {
|
||||
version {
|
||||
require '1.0.2'
|
||||
require '1.7.0-alpha03'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,21 @@ abstract class KeyboardResizeableViewController<TActivity : BaseActivity, TState
|
|||
lifecycle.addObserver(activity.keyboardBehaviorDetector as LifecycleObserver)
|
||||
}
|
||||
|
||||
private val onKeyboardHideListener = {
|
||||
if (isKeyboardVisible) {
|
||||
onKeyboardHide()
|
||||
}
|
||||
isKeyboardVisible = false
|
||||
}
|
||||
|
||||
private val onKeyboardShowListener = { diff: Int ->
|
||||
onKeyboardShow(diff)
|
||||
isKeyboardVisible = true
|
||||
}
|
||||
|
||||
private var isKeyboardVisible: Boolean = false
|
||||
|
||||
private val keyboardHideListener = OnBackPressedListener {
|
||||
private val keyboardHidingOnBackPressedListener = OnBackPressedListener {
|
||||
if (isKeyboardVisible) {
|
||||
UiUtils.OfViews.hideSoftInput(activity)
|
||||
true
|
||||
|
|
@ -46,39 +58,31 @@ abstract class KeyboardResizeableViewController<TActivity : BaseActivity, TState
|
|||
isHideKeyboardOnBackEnabled = true
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
activity.keyboardBehaviorDetector?.apply {
|
||||
addOnHideListener(onKeyboardHideListener)
|
||||
addOnShowListener(onKeyboardShowListener)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (isHideKeyboardOnBackEnabled) activity.addOnBackPressedListener(keyboardHideListener)
|
||||
if (isHideKeyboardOnBackEnabled) activity.addOnBackPressedListener(keyboardHidingOnBackPressedListener)
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
notifyKeyboardHidden()
|
||||
if (isHideKeyboardOnBackEnabled) activity.removeOnBackPressedListener(keyboardHideListener)
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
activity.keyboardBehaviorDetector?.apply {
|
||||
keyboardHideListener = {
|
||||
if (isKeyboardVisible) {
|
||||
onKeyboardHide()
|
||||
}
|
||||
isKeyboardVisible = false
|
||||
}
|
||||
keyboardShowListener = { diff ->
|
||||
onKeyboardShow(diff)
|
||||
isKeyboardVisible = true
|
||||
}
|
||||
}
|
||||
if (isHideKeyboardOnBackEnabled) activity.removeOnBackPressedListener(keyboardHidingOnBackPressedListener)
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
activity.keyboardBehaviorDetector?.apply {
|
||||
keyboardHideListener = null
|
||||
keyboardShowListener = null
|
||||
removeOnHideListener(onKeyboardHideListener)
|
||||
removeOnShowListener(onKeyboardShowListener)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,5 +90,4 @@ abstract class KeyboardResizeableViewController<TActivity : BaseActivity, TState
|
|||
if (isKeyboardVisible) onKeyboardHide()
|
||||
isKeyboardVisible = false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,12 +69,13 @@ open class ViewController<TActivity : FragmentActivity, TState : Parcelable>(
|
|||
|
||||
val view: View = creationContext.inflater.inflate(layoutRes, creationContext.container, false)
|
||||
|
||||
override val lifecycle: Lifecycle
|
||||
get() = fragment.viewLifecycleOwner.lifecycle
|
||||
|
||||
init {
|
||||
lifecycle.addObserver(LifecycleLoggingObserver(this))
|
||||
}
|
||||
|
||||
override fun getLifecycle(): Lifecycle = fragment.viewLifecycleOwner.lifecycle
|
||||
|
||||
/**
|
||||
* Look for a child view with the given id. If this view has the given id, return this view.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
apply from: "../android-configs/lib-config.gradle"
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.roboswag.recyclerview_adapters"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':kotlin-extensions')
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
apply from: "../android-configs/lib-config.gradle"
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.calendar"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(":logging")
|
||||
implementation 'net.danlew:android.joda'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
apply from: "../android-configs/lib-config.gradle"
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.extensions.rx"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(":utils")
|
||||
implementation project(":logging")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
apply from: "../android-configs/lib-config.gradle"
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.core.observables.storable"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(":utils")
|
||||
implementation project(":logging")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
apply from: "../android-configs/lib-config.gradle"
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.roboswag.core.utils"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':kotlin-extensions')
|
||||
implementation "androidx.core:core"
|
||||
|
|
|
|||
|
|
@ -2,8 +2,11 @@ apply from: "../android-configs/lib-config.gradle"
|
|||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
namespace "ru.touchin.roboswag.views"
|
||||
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
buildConfig true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,26 +36,27 @@ class LoadingContentView @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
private fun updateView(state: State) {
|
||||
if (state == State.ShowContent) {
|
||||
getChildAt(childCount - 1)?.let { showChild(it.id) }
|
||||
} else {
|
||||
when (state) {
|
||||
is State.Stub -> {
|
||||
setStubText(state.stubText)
|
||||
showChild(R.id.text_stub)
|
||||
when (state) {
|
||||
State.ShowContent -> {
|
||||
getChildAt(childCount - 1)?.let { showChild(it.id) }
|
||||
}
|
||||
|
||||
is State.Stub -> {
|
||||
setStubText(state.stubText)
|
||||
showChild(R.id.text_stub)
|
||||
}
|
||||
|
||||
State.Loading -> {
|
||||
showChild(R.id.progress_bar)
|
||||
}
|
||||
|
||||
is State.Error -> {
|
||||
binding.apply {
|
||||
errorText.text = state.errorText
|
||||
errorRepeatButton.setOnRippleClickListener { state.action.invoke() }
|
||||
errorRepeatButton.text = state.repeatButtonText
|
||||
showChild(R.id.error_with_repeat)
|
||||
}
|
||||
is State.Loading -> {
|
||||
showChild(R.id.progress_bar)
|
||||
}
|
||||
is State.Error -> {
|
||||
binding.apply {
|
||||
errorText.text = state.errorText
|
||||
errorRepeatButton.setOnRippleClickListener { state.action.invoke() }
|
||||
errorRepeatButton.text = state.repeatButtonText
|
||||
showChild(R.id.error_with_repeat)
|
||||
}
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue