Compare commits

..

1 Commits

Author SHA1 Message Date
rybakoff888ilia@gmail.com 78b0715f51 change repos to nspk 2024-05-13 18:23:22 +03:00
9 changed files with 57 additions and 72 deletions

View File

@ -1,8 +1,8 @@
buildscript { buildscript {
repositories { repositories {
google() maven {
jcenter() url = uri("https://nexus.mir/repository/maven-proxy-group/")
maven { url "https://plugins.gradle.org/m2/" } }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.0.0' classpath 'com.android.tools.build:gradle:4.0.0'
@ -14,10 +14,8 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
google()
jcenter()
maven { maven {
url "https://maven.dev.touchin.ru/" url = uri("https://nexus.mir/repository/maven-proxy-group/")
metadataSources { metadataSources {
artifact() artifact()
} }

View File

@ -12,7 +12,7 @@ dependencies {
constraints { constraints {
implementation("androidx.appcompat:appcompat") { implementation("androidx.appcompat:appcompat") {
version { version {
require '1.7.0-alpha03' require '1.0.2'
} }
} }
} }

View File

@ -25,21 +25,9 @@ abstract class KeyboardResizeableViewController<TActivity : BaseActivity, TState
lifecycle.addObserver(activity.keyboardBehaviorDetector as LifecycleObserver) 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 var isKeyboardVisible: Boolean = false
private val keyboardHidingOnBackPressedListener = OnBackPressedListener { private val keyboardHideListener = OnBackPressedListener {
if (isKeyboardVisible) { if (isKeyboardVisible) {
UiUtils.OfViews.hideSoftInput(activity) UiUtils.OfViews.hideSoftInput(activity)
true true
@ -58,31 +46,39 @@ abstract class KeyboardResizeableViewController<TActivity : BaseActivity, TState
isHideKeyboardOnBackEnabled = true isHideKeyboardOnBackEnabled = true
} }
@CallSuper
override fun onStart() {
super.onStart()
activity.keyboardBehaviorDetector?.apply {
addOnHideListener(onKeyboardHideListener)
addOnShowListener(onKeyboardShowListener)
}
}
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
if (isHideKeyboardOnBackEnabled) activity.addOnBackPressedListener(keyboardHidingOnBackPressedListener) if (isHideKeyboardOnBackEnabled) activity.addOnBackPressedListener(keyboardHideListener)
} }
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
notifyKeyboardHidden() notifyKeyboardHidden()
if (isHideKeyboardOnBackEnabled) activity.removeOnBackPressedListener(keyboardHidingOnBackPressedListener) 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
}
}
} }
override fun onStop() { override fun onStop() {
super.onStop() super.onStop()
activity.keyboardBehaviorDetector?.apply { activity.keyboardBehaviorDetector?.apply {
removeOnHideListener(onKeyboardHideListener) keyboardHideListener = null
removeOnShowListener(onKeyboardShowListener) keyboardShowListener = null
} }
} }
@ -90,4 +86,5 @@ abstract class KeyboardResizeableViewController<TActivity : BaseActivity, TState
if (isKeyboardVisible) onKeyboardHide() if (isKeyboardVisible) onKeyboardHide()
isKeyboardVisible = false isKeyboardVisible = false
} }
} }

View File

@ -69,13 +69,12 @@ open class ViewController<TActivity : FragmentActivity, TState : Parcelable>(
val view: View = creationContext.inflater.inflate(layoutRes, creationContext.container, false) val view: View = creationContext.inflater.inflate(layoutRes, creationContext.container, false)
override val lifecycle: Lifecycle
get() = fragment.viewLifecycleOwner.lifecycle
init { init {
lifecycle.addObserver(LifecycleLoggingObserver(this)) 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. * Look for a child view with the given id. If this view has the given id, return this view.
* *

View File

@ -71,19 +71,6 @@ open class DelegationListAdapter<TItem>(config: AsyncDifferConfig<TItem>) : Recy
*/ */
fun submitList(list: List<TItem>) = differ.submitList(list) fun submitList(list: List<TItem>) = differ.submitList(list)
/**
* Submits a new list to be diffed, and displayed.
*
* The commit callback can be used to know when the List is committed, but note that it
* may not be executed. If List B is submitted immediately after List A, and is
* committed directly, the callback associated with List A will not be run.
*
* @param newList The new List.
* @param commitCallback Optional runnable that is executed when the List is committed, if
* it is committed.
*/
fun submitList(list: List<TItem>?, commitCallback: (() -> Unit)?) = differ.submitList(list, commitCallback)
/** /**
* Get the current List - any diffing to present this list has already been computed and * Get the current List - any diffing to present this list has already been computed and
* dispatched via the ListUpdateCallback. * dispatched via the ListUpdateCallback.

View File

@ -28,5 +28,7 @@ dependencies {
} }
repositories { repositories {
mavenCentral() maven {
url = uri("https://nexus.mir/repository/maven-proxy-group/")
}
} }

View File

@ -35,5 +35,7 @@ dependencies {
} }
repositories { repositories {
mavenCentral() maven {
url = uri("https://nexus.mir/repository/maven-proxy-group/")
}
} }

View File

@ -36,26 +36,24 @@ class LoadingContentView @JvmOverloads constructor(
} }
private fun updateView(state: State) { private fun updateView(state: State) {
when (state) { if (state == State.ShowContent) {
State.ShowContent -> { getChildAt(childCount - 1)?.let { showChild(it.id) }
getChildAt(childCount - 1)?.let { showChild(it.id) } } else {
} when (state) {
is State.Stub -> {
is State.Stub -> { setStubText(state.stubText)
setStubText(state.stubText) showChild(R.id.text_stub)
showChild(R.id.text_stub) }
} is State.Loading -> {
showChild(R.id.progress_bar)
State.Loading -> { }
showChild(R.id.progress_bar) is State.Error -> {
} binding.apply {
errorText.text = state.errorText
is State.Error -> { errorRepeatButton.setOnRippleClickListener { state.action.invoke() }
binding.apply { errorRepeatButton.text = state.repeatButtonText
errorText.text = state.errorText showChild(R.id.error_with_repeat)
errorRepeatButton.setOnRippleClickListener { state.action.invoke() } }
errorRepeatButton.text = state.repeatButtonText
showChild(R.id.error_with_repeat)
} }
} }
} }

View File

@ -46,5 +46,7 @@ dependencies {
} }
repositories { repositories {
mavenCentral() maven {
url = uri("https://nexus.mir/repository/maven-proxy-group/")
}
} }