Skip to content

Commit

Permalink
Merge pull request #129 from icerockdev/cancelable
Browse files Browse the repository at this point in the history
Release 0.10.1
  • Loading branch information
Alex009 committed Apr 30, 2021
2 parents 7c92e79 + b757290 commit cb57f61
Show file tree
Hide file tree
Showing 39 changed files with 393 additions and 223 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ This is a Kotlin Multiplatform library that provides architecture components of
- kotlin 1.4.31
- 0.9.2
- 0.10.0
- 0.10.1

## Installation
root build.gradle
Expand All @@ -67,15 +68,15 @@ allprojects {
project build.gradle
```groovy
dependencies {
commonMainApi("dev.icerock.moko:mvvm-core:0.10.0") // only ViewModel, EventsDispatcher, Dispatchers.UI
commonMainApi("dev.icerock.moko:mvvm-livedata:0.10.0") // api mvvm-core, LiveData and extensions
androidMainApi("dev.icerock.moko:mvvm-livedata-material:0.10.0") // api mvvm-livedata, Material library android extensions
androidMainApi("dev.icerock.moko:mvvm-livedata-glide:0.10.0") // api mvvm-livedata, Glide library android extensions
androidMainApi("dev.icerock.moko:mvvm-livedata-swiperefresh:0.10.0") // api mvvm-livedata, SwipeRefreshLayout library android extensions
commonMainApi("dev.icerock.moko:mvvm-state:0.10.0") // api mvvm-livedata, ResourceState class and extensions
androidMainApi("dev.icerock.moko:mvvm-databinding:0.10.0") // api mvvm-livedata, DataBinding support for Android
androidMainApi("dev.icerock.moko:mvvm-viewbinding:0.10.0") // api mvvm-livedata, ViewBinding support for Android
commonTestImplementation("dev.icerock.moko:mvvm-test:0.10.0") // test utilities
commonMainApi("dev.icerock.moko:mvvm-core:0.10.1") // only ViewModel, EventsDispatcher, Dispatchers.UI
commonMainApi("dev.icerock.moko:mvvm-livedata:0.10.1") // api mvvm-core, LiveData and extensions
androidMainApi("dev.icerock.moko:mvvm-livedata-material:0.10.1") // api mvvm-livedata, Material library android extensions
androidMainApi("dev.icerock.moko:mvvm-livedata-glide:0.10.1") // api mvvm-livedata, Glide library android extensions
androidMainApi("dev.icerock.moko:mvvm-livedata-swiperefresh:0.10.1") // api mvvm-livedata, SwipeRefreshLayout library android extensions
commonMainApi("dev.icerock.moko:mvvm-state:0.10.1") // api mvvm-livedata, ResourceState class and extensions
androidMainApi("dev.icerock.moko:mvvm-databinding:0.10.1") // api mvvm-livedata, DataBinding support for Android
androidMainApi("dev.icerock.moko:mvvm-viewbinding:0.10.1") // api mvvm-livedata, ViewBinding support for Android
commonTestImplementation("dev.icerock.moko:mvvm-test:0.10.1") // test utilities
}
```

Expand All @@ -90,15 +91,15 @@ kotlin {
else -> throw IllegalArgumentException()
}
binaries.withType(org.jetbrains.kotlin.gradle.plugin.mpp.Framework::class.java).all {
export("dev.icerock.moko:mvvm-$arch:0.10.0")
export("dev.icerock.moko:mvvm-$arch:0.10.1")
}
}
}
```

On iOS, in addition to the Kotlin library add in Podfile
```ruby
pod 'MultiPlatformLibraryMvvm', :git => 'https://github.com/icerockdev/moko-mvvm.git', :tag => 'release/0.10.0'
pod 'MultiPlatformLibraryMvvm', :git => 'https://github.com/icerockdev/moko-mvvm.git', :tag => 'release/0.10.1'
```
**`MultiPlatformLibraryMvvm` CocoaPod requires that the framework compiled from Kotlin be named
`MultiPlatformLibrary` and be connected as a CocoaPod `MultiPlatformLibrary`.
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object Deps {
private const val coroutinesVersion = "1.4.2"
private const val mokoResourcesVersion = "0.15.1"
private const val mokoTestVersion = "0.2.1"
const val mokoMvvmVersion = "0.10.0"
const val mokoMvvmVersion = "0.10.1"

object Android {
const val compileSdk = 29
Expand Down
8 changes: 4 additions & 4 deletions mvvm-livedata-glide/api/mvvm-livedata-glide.api
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ public final class dev/icerock/moko/mvvm/livedata/glide/BuildConfig {
}

public final class dev/icerock/moko/mvvm/livedata/glide/GlideImageViewBindingsKt {
public static final fun bindToImageViewSrc (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/ImageView;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;)V
public static final fun bindToImageViewSrc (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/ImageView;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V
public static synthetic fun bindToImageViewSrc$default (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/ImageView;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;ILjava/lang/Object;)V
public static synthetic fun bindToImageViewSrc$default (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/ImageView;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
public static final fun bindToImageViewSrc (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/ImageView;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;)Ldev/icerock/moko/mvvm/livedata/Closeable;
public static final fun bindToImageViewSrc (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/ImageView;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ldev/icerock/moko/mvvm/livedata/Closeable;
public static synthetic fun bindToImageViewSrc$default (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/ImageView;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;ILjava/lang/Object;)Ldev/icerock/moko/mvvm/livedata/Closeable;
public static synthetic fun bindToImageViewSrc$default (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/ImageView;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/icerock/moko/mvvm/livedata/Closeable;
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.lifecycle.LifecycleOwner
import com.bumptech.glide.Glide
import com.bumptech.glide.RequestBuilder
import com.bumptech.glide.RequestManager
import dev.icerock.moko.mvvm.livedata.Closeable
import dev.icerock.moko.mvvm.livedata.LiveData
import dev.icerock.moko.mvvm.utils.bindNotNull

Expand All @@ -18,8 +19,8 @@ fun LiveData<String>.bindToImageViewSrc(
imageView: ImageView,
requestManager: (RequestManager.() -> Unit)? = null,
requestBuilder: (RequestBuilder<Drawable>.() -> Unit)? = null
) {
bindNotNull(lifecycleOwner) { url ->
): Closeable {
return bindNotNull(lifecycleOwner) { url ->
Glide.with(imageView)
.also { requestManager?.invoke(it) }
.load(url)
Expand All @@ -33,8 +34,8 @@ fun LiveData<String>.bindToImageViewSrc(
imageView: ImageView,
loadingPlaceholder: Drawable? = null,
errorPlaceholder: Drawable? = null
) {
bindToImageViewSrc(
): Closeable {
return bindToImageViewSrc(
lifecycleOwner = lifecycleOwner,
imageView = imageView,
requestBuilder = {
Expand Down
4 changes: 2 additions & 2 deletions mvvm-livedata-material/api/mvvm-livedata-material.api
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public final class dev/icerock/moko/mvvm/livedata/material/BuildConfig {
}

public final class dev/icerock/moko/mvvm/livedata/material/TextInputLayoutBindingsKt {
public static final fun bindToTextInputLayoutErrorString (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Lcom/google/android/material/textfield/TextInputLayout;)V
public static final fun bindToTextInputLayoutErrorStringDesc (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Lcom/google/android/material/textfield/TextInputLayout;)V
public static final fun bindToTextInputLayoutErrorString (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Lcom/google/android/material/textfield/TextInputLayout;)Ldev/icerock/moko/mvvm/livedata/Closeable;
public static final fun bindToTextInputLayoutErrorStringDesc (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Lcom/google/android/material/textfield/TextInputLayout;)Ldev/icerock/moko/mvvm/livedata/Closeable;
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package dev.icerock.moko.mvvm.livedata.material

import androidx.lifecycle.LifecycleOwner
import com.google.android.material.textfield.TextInputLayout
import dev.icerock.moko.mvvm.livedata.Closeable
import dev.icerock.moko.mvvm.livedata.LiveData
import dev.icerock.moko.mvvm.utils.bindNotNull
import dev.icerock.moko.resources.desc.StringDesc
Expand All @@ -14,15 +15,15 @@ import dev.icerock.moko.resources.desc.StringDesc
fun LiveData<String>.bindToTextInputLayoutError(
lifecycleOwner: LifecycleOwner,
textInputLayout: TextInputLayout
) {
bindNotNull(lifecycleOwner) { textInputLayout.error = it }
): Closeable {
return bindNotNull(lifecycleOwner) { textInputLayout.error = it }
}

@JvmName("bindToTextInputLayoutErrorStringDesc")
fun LiveData<StringDesc>.bindToTextInputLayoutError(
lifecycleOwner: LifecycleOwner,
textInputLayout: TextInputLayout
) {
): Closeable {
val context = textInputLayout.context
bindNotNull(lifecycleOwner) { textInputLayout.error = it.toString(context) }
return bindNotNull(lifecycleOwner) { textInputLayout.error = it.toString(context) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public final class dev/icerock/moko/mvvm/livedata/swiperefresh/BuildConfig {
}

public final class dev/icerock/moko/mvvm/livedata/swiperefresh/SwipeRefreshBindingsKt {
public static final fun bindToSwipeRefreshLayoutRefreshing (Ldev/icerock/moko/mvvm/livedata/MutableLiveData;Landroidx/lifecycle/LifecycleOwner;Landroidx/swiperefreshlayout/widget/SwipeRefreshLayout;)V
public static final fun bindToSwipeRefreshLayoutRefreshing (Ldev/icerock/moko/mvvm/livedata/MutableLiveData;Landroidx/lifecycle/LifecycleOwner;Landroidx/swiperefreshlayout/widget/SwipeRefreshLayout;)Ldev/icerock/moko/mvvm/livedata/Closeable;
public static final fun setRefreshAction (Landroidx/swiperefreshlayout/widget/SwipeRefreshLayout;Lkotlin/jvm/functions/Function1;)V
public static final fun setRefreshAction (Landroidx/swiperefreshlayout/widget/SwipeRefreshLayout;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function1;)V
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package dev.icerock.moko.mvvm.livedata.swiperefresh

import androidx.lifecycle.LifecycleOwner
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import dev.icerock.moko.mvvm.livedata.Closeable
import dev.icerock.moko.mvvm.livedata.MutableLiveData
import dev.icerock.moko.mvvm.utils.bindNotNull
import kotlinx.coroutines.CoroutineScope
Expand All @@ -14,10 +15,16 @@ import kotlinx.coroutines.launch
fun MutableLiveData<Boolean>.bindToSwipeRefreshLayoutRefreshing(
lifecycleOwner: LifecycleOwner,
swipeRefreshLayout: SwipeRefreshLayout
) {
bindNotNull(lifecycleOwner) { swipeRefreshLayout.isRefreshing = it }
): Closeable {
val readCloseable = bindNotNull(lifecycleOwner) { swipeRefreshLayout.isRefreshing = it }

swipeRefreshLayout.setOnRefreshListener { value = true }

val writeCloseable = Closeable {
swipeRefreshLayout.setOnRefreshListener(null)
}

return readCloseable + writeCloseable
}

fun SwipeRefreshLayout.setRefreshAction(
Expand Down
38 changes: 28 additions & 10 deletions mvvm-livedata/api/mvvm-livedata.api
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,30 @@ public final class dev/icerock/moko/mvvm/livedata/BuildConfig {
}

public final class dev/icerock/moko/mvvm/livedata/CheckBoxBindingsKt {
public static final fun bindToCheckBoxChecked (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/CheckBox;)V
public static final fun bindTwoWayToCheckBoxChecked (Ldev/icerock/moko/mvvm/livedata/MutableLiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/CheckBox;)V
public static final fun bindToCheckBoxChecked (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/CheckBox;)Ldev/icerock/moko/mvvm/livedata/Closeable;
public static final fun bindTwoWayToCheckBoxChecked (Ldev/icerock/moko/mvvm/livedata/MutableLiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/CheckBox;)Ldev/icerock/moko/mvvm/livedata/Closeable;
}

public abstract interface class dev/icerock/moko/mvvm/livedata/Closeable {
public static final field Companion Ldev/icerock/moko/mvvm/livedata/Closeable$Companion;
public abstract fun close ()V
public abstract fun plus (Ldev/icerock/moko/mvvm/livedata/Closeable;)Ldev/icerock/moko/mvvm/livedata/Closeable;
}

public final class dev/icerock/moko/mvvm/livedata/Closeable$Companion {
public final fun invoke (Lkotlin/jvm/functions/Function0;)Ldev/icerock/moko/mvvm/livedata/Closeable;
}

public final class dev/icerock/moko/mvvm/livedata/Closeable$DefaultImpls {
public static fun plus (Ldev/icerock/moko/mvvm/livedata/Closeable;Ldev/icerock/moko/mvvm/livedata/Closeable;)Ldev/icerock/moko/mvvm/livedata/Closeable;
}

public final class dev/icerock/moko/mvvm/livedata/DebounceLiveDataKt {
public static final fun debounce (Ldev/icerock/moko/mvvm/livedata/LiveData;Lkotlinx/coroutines/CoroutineScope;J)Ldev/icerock/moko/mvvm/livedata/LiveData;
}

public final class dev/icerock/moko/mvvm/livedata/EditTextBindingsKt {
public static final fun bindTwoWayToEditTextText (Ldev/icerock/moko/mvvm/livedata/MutableLiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/EditText;)V
public static final fun bindTwoWayToEditTextText (Ldev/icerock/moko/mvvm/livedata/MutableLiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/EditText;)Ldev/icerock/moko/mvvm/livedata/Closeable;
}

public class dev/icerock/moko/mvvm/livedata/LiveData {
Expand Down Expand Up @@ -49,6 +63,10 @@ public final class dev/icerock/moko/mvvm/livedata/LiveDataExtKt {
public static final fun revert (Ldev/icerock/moko/mvvm/livedata/LiveData;)Ldev/icerock/moko/mvvm/livedata/LiveData;
}

public final class dev/icerock/moko/mvvm/livedata/LiveDataKt {
public static final fun addCloseableObserver (Ldev/icerock/moko/mvvm/livedata/LiveData;Lkotlin/jvm/functions/Function1;)Ldev/icerock/moko/mvvm/livedata/Closeable;
}

public final class dev/icerock/moko/mvvm/livedata/LiveDataTransformsKt {
public static final fun flatMap (Ldev/icerock/moko/mvvm/livedata/LiveData;Lkotlin/jvm/functions/Function1;)Ldev/icerock/moko/mvvm/livedata/LiveData;
public static final fun flatMapBuffered (Ldev/icerock/moko/mvvm/livedata/LiveData;Lkotlin/jvm/functions/Function2;)Ldev/icerock/moko/mvvm/livedata/LiveData;
Expand Down Expand Up @@ -86,8 +104,8 @@ public final class dev/icerock/moko/mvvm/livedata/MutableLiveDataExtKt {
}

public final class dev/icerock/moko/mvvm/livedata/TextViewBindingsKt {
public static final fun bindToTextViewTextString (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/TextView;)V
public static final fun bindToTextViewTextStringDesc (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/TextView;)V
public static final fun bindToTextViewTextString (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/TextView;)Ldev/icerock/moko/mvvm/livedata/Closeable;
public static final fun bindToTextViewTextStringDesc (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/widget/TextView;)Ldev/icerock/moko/mvvm/livedata/Closeable;
}

public final class dev/icerock/moko/mvvm/livedata/ThrowableLiveDataExtKt {
Expand All @@ -96,13 +114,13 @@ public final class dev/icerock/moko/mvvm/livedata/ThrowableLiveDataExtKt {
}

public final class dev/icerock/moko/mvvm/livedata/ViewBindingsKt {
public static final fun bindToViewEnabled (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/view/View;)V
public static final fun bindToViewVisibleOrGone (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/view/View;)V
public static final fun bindToViewVisibleOrInvisible (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/view/View;)V
public static final fun bindToViewEnabled (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/view/View;)Ldev/icerock/moko/mvvm/livedata/Closeable;
public static final fun bindToViewVisibleOrGone (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/view/View;)Ldev/icerock/moko/mvvm/livedata/Closeable;
public static final fun bindToViewVisibleOrInvisible (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Landroid/view/View;)Ldev/icerock/moko/mvvm/livedata/Closeable;
}

public final class dev/icerock/moko/mvvm/utils/LiveDataExtKt {
public static final fun bind (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Lkotlin/jvm/functions/Function1;)V
public static final fun bindNotNull (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Lkotlin/jvm/functions/Function1;)V
public static final fun bind (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Lkotlin/jvm/functions/Function1;)Ldev/icerock/moko/mvvm/livedata/Closeable;
public static final fun bindNotNull (Ldev/icerock/moko/mvvm/livedata/LiveData;Landroidx/lifecycle/LifecycleOwner;Lkotlin/jvm/functions/Function1;)Ldev/icerock/moko/mvvm/livedata/Closeable;
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,37 @@
package dev.icerock.moko.mvvm.livedata

import android.widget.CheckBox
import android.widget.CompoundButton
import androidx.lifecycle.LifecycleOwner
import dev.icerock.moko.mvvm.utils.bindNotNull

fun LiveData<Boolean>.bindToCheckBoxChecked(lifecycleOwner: LifecycleOwner, checkBox: CheckBox) {
bindNotNull(lifecycleOwner) { checkBox.isChecked = it }
fun LiveData<Boolean>.bindToCheckBoxChecked(
lifecycleOwner: LifecycleOwner,
checkBox: CheckBox
): Closeable {
return bindNotNull(lifecycleOwner) { checkBox.isChecked = it }
}

fun MutableLiveData<Boolean>.bindTwoWayToCheckBoxChecked(
lifecycleOwner: LifecycleOwner,
checkBox: CheckBox
) {
bindNotNull(lifecycleOwner) { value ->
): Closeable {
val readCloseable = bindNotNull(lifecycleOwner) { value ->
if (checkBox.isChecked == value) return@bindNotNull

checkBox.isChecked = value
}

checkBox.setOnCheckedChangeListener { _, isChecked ->
if (value == isChecked) return@setOnCheckedChangeListener
val checkListener = CompoundButton.OnCheckedChangeListener { _, isChecked ->
if (value == isChecked) return@OnCheckedChangeListener

value = isChecked
}
checkBox.setOnCheckedChangeListener(checkListener)

val writeCloseable = Closeable {
checkBox.setOnCheckedChangeListener(null)
}

return readCloseable + writeCloseable
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import dev.icerock.moko.mvvm.utils.bindNotNull
fun MutableLiveData<String>.bindTwoWayToEditTextText(
lifecycleOwner: LifecycleOwner,
editText: EditText
) {
bindNotNull(lifecycleOwner) {
): Closeable {
val readCloseable = bindNotNull(lifecycleOwner) {
if (editText.text.toString() == it) return@bindNotNull

editText.setText(it)
Expand All @@ -34,4 +34,10 @@ fun MutableLiveData<String>.bindTwoWayToEditTextText(
override fun afterTextChanged(s: Editable?) = Unit
}
editText.addTextChangedListener(watcher)

val writeCloseable = Closeable {
editText.removeTextChangedListener(watcher)
}

return readCloseable + writeCloseable
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ import dev.icerock.moko.mvvm.utils.bindNotNull
import dev.icerock.moko.resources.desc.StringDesc

@JvmName("bindToTextViewTextString")
fun LiveData<String>.bindToTextViewText(lifecycleOwner: LifecycleOwner, textView: TextView) {
bindNotNull(lifecycleOwner) { textView.text = it }
fun LiveData<String>.bindToTextViewText(
lifecycleOwner: LifecycleOwner,
textView: TextView
): Closeable {
return bindNotNull(lifecycleOwner) { textView.text = it }
}

@JvmName("bindToTextViewTextStringDesc")
fun LiveData<StringDesc>.bindToTextViewText(lifecycleOwner: LifecycleOwner, textView: TextView) {
fun LiveData<StringDesc>.bindToTextViewText(
lifecycleOwner: LifecycleOwner,
textView: TextView
): Closeable {
val context = textView.context
bindNotNull(lifecycleOwner) { textView.text = it.toString(context) }
return bindNotNull(lifecycleOwner) { textView.text = it.toString(context) }
}
Loading

0 comments on commit cb57f61

Please sign in to comment.