Removed exclusive usage of 29 level API

This commit is contained in:
Viktor De Pasquale 2019-12-13 14:41:49 +01:00
parent 85a350b6c8
commit 3bda7cb26b
3 changed files with 4 additions and 25 deletions

View File

@ -82,12 +82,8 @@ class HideViewModel(
// ---
override fun submitQuery() {
if (!queryHandler.hasCallbacks(queryRunnable)) {
queryHandler.post(queryRunnable)
} else {
queryHandler.removeCallbacks(queryRunnable)
queryHandler.postDelayed(queryRunnable, queryDelay)
}
queryHandler.removeCallbacks(queryRunnable)
queryHandler.postDelayed(queryRunnable, queryDelay)
}
private fun query(

View File

@ -165,12 +165,8 @@ class ModuleViewModel(
// ---
override fun submitQuery() {
if (!queryHandler.hasCallbacks(queryRunnable)) {
queryHandler.post(queryRunnable)
} else {
queryHandler.removeCallbacks(queryRunnable)
queryHandler.postDelayed(queryRunnable, queryDelay)
}
queryHandler.removeCallbacks(queryRunnable)
queryHandler.postDelayed(queryRunnable, queryDelay)
}
private fun queryInternal(query: String, offset: Int): Single<List<RepoItem>> {

View File

@ -17,7 +17,6 @@ import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.Toolbar
import androidx.core.animation.doOnEnd
import androidx.core.view.*
import androidx.core.widget.NestedScrollView
import androidx.databinding.BindingAdapter
import androidx.databinding.InverseBindingAdapter
import androidx.databinding.InverseBindingListener
@ -427,18 +426,6 @@ fun Chip.setOnCloseClickedListenerBinding(listener: View.OnClickListener) {
setOnCloseIconClickListener(listener)
}
@BindingAdapter("onScrollStateChanged")
fun NestedScrollView.setOnScrollStateChangeListener(listener: Runnable) {
setOnScrollChangeListener { _: NestedScrollView?, _: Int, _: Int, _: Int, _: Int ->
if (!handler.hasCallbacks(listener)) {
listener.run()
} else {
handler.removeCallbacksAndMessages(null)
}
handler.postDelayed(listener, 1000)
}
}
@BindingAdapter("progressAnimated")
fun ProgressBar.setProgressAnimated(newProgress: Int) {
val animator = tag as? ValueAnimator