Skip to content

Commit

Permalink
Get rid of the Fragment. extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
AChep committed Feb 27, 2021
1 parent 9af4c8c commit 357788f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
21 changes: 0 additions & 21 deletions library/src/main/java/com/artemchep/bindin/BindIn.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.artemchep.bindin

import androidx.annotation.UiThread
import androidx.fragment.app.Fragment
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
Expand All @@ -28,13 +27,6 @@ fun <T> LifecycleOwner.bindIn(
},
)

@UiThread
fun <T> Fragment.bindIn(
flow: Flow<T>,
minimumLifecycleState: Lifecycle.State = DEFAULT_MIN_LIFECYCLE_STATE,
pipe: (T) -> Unit,
) = viewLifecycleOwner.bindIn(flow, minimumLifecycleState, pipe)

@UiThread
fun <T> LifecycleOwner.bindInSuspending(
flow: Flow<T>,
Expand All @@ -50,13 +42,6 @@ fun <T> LifecycleOwner.bindInSuspending(
},
)

@UiThread
fun <T> Fragment.bindIn(
flow: Flow<T>,
minimumLifecycleState: Lifecycle.State = DEFAULT_MIN_LIFECYCLE_STATE,
pipe: suspend (T) -> Unit,
) = viewLifecycleOwner.bindInSuspending(flow, minimumLifecycleState, pipe)

@Suppress("FunctionName")
@UiThread
private inline fun <T> LifecycleOwner._bindIn(
Expand Down Expand Up @@ -125,9 +110,3 @@ fun LifecycleOwner.bindBlock(

return registration
}

@UiThread
fun <T> Fragment.bindBlock(
minimumLifecycleState: Lifecycle.State = Lifecycle.State.STARTED,
block: suspend () -> Unit,
) = viewLifecycleOwner.bindBlock(minimumLifecycleState, block)
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.artemchep.bindin.common

import android.widget.CompoundButton
import androidx.fragment.app.Fragment
import androidx.lifecycle.LifecycleOwner
import com.artemchep.bindin.InBinding
import com.artemchep.bindin.bindIn
import com.artemchep.bindin.bindOut
import kotlinx.coroutines.flow.Flow

fun Fragment.bind(
fun LifecycleOwner.bind(
flow: Flow<Boolean>,
view: CompoundButton,
pipe: (Boolean) -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package com.artemchep.bindin.common
import android.widget.EditText
import androidx.annotation.UiThread
import androidx.core.widget.addTextChangedListener
import androidx.fragment.app.Fragment
import androidx.lifecycle.LifecycleOwner
import com.artemchep.bindin.InBinding
import com.artemchep.bindin.bindIn
import com.artemchep.bindin.bindOut
import kotlinx.coroutines.flow.Flow

@UiThread
fun Fragment.bind(
fun LifecycleOwner.bind(
flow: Flow<String>,
view: EditText,
pipe: (String) -> Unit,
Expand Down

0 comments on commit 357788f

Please sign in to comment.