From 789e92c6709427d1f917de81660dee56d8ca5731 Mon Sep 17 00:00:00 2001 From: Marcin Date: Sat, 16 Dec 2017 14:02:32 +0100 Subject: [PATCH] Fix recurrence error --- .../kotlinandroidviewbindings/BindToClick.kt | 18 +++++++------- .../BindToEditText.kt | 18 +++++++------- .../BindToEditorActions.kt | 24 +++++++++---------- .../BindToErrorId.kt | 18 +++++++------- .../BindToLoading.kt | 18 +++++++------- .../BindToLongClick.kt | 18 +++++++------- .../BindToRequestFocus.kt | 18 +++++++------- .../BindToSwipeRefresh.kt | 24 +++++++++---------- .../kotlinandroidviewbindings/BindToText.kt | 18 +++++++------- .../kotlinandroidviewbindings/BindToTextId.kt | 18 +++++++------- .../BindToVisibility.kt | 18 +++++++------- 11 files changed, 105 insertions(+), 105 deletions(-) diff --git a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToClick.kt b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToClick.kt index 5ee4444..45b1a80 100644 --- a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToClick.kt +++ b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToClick.kt @@ -11,32 +11,32 @@ import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty fun Activity.bindToClick(@IdRes viewId: Int): ReadWriteProperty Unit> - = bindToClick { findViewById(viewId) } + = bindToClickP { findViewById(viewId) } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToClick(@IdRes viewId: Int): ReadWriteProperty Unit> - = bindToClick { view.findViewById(viewId) } + = bindToClickP { view.findViewById(viewId) } fun android.support.v4.app.Fragment.bindToClick(@IdRes viewId: Int): ReadWriteProperty Unit> - = bindToClick { view!!.findViewById(viewId) } + = bindToClickP { view!!.findViewById(viewId) } fun FrameLayout.bindToClick(@IdRes viewId: Int): ReadWriteProperty Unit> - = bindToClick { findViewById(viewId) } + = bindToClickP { findViewById(viewId) } fun Activity.bindToClick(viewProvider: ()->View): ReadWriteProperty Unit> - = bindToClick { viewProvider() } + = bindToClickP { viewProvider() } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToClick(viewProvider: ()->View): ReadWriteProperty Unit> - = bindToClick { viewProvider() } + = bindToClickP { viewProvider() } fun android.support.v4.app.Fragment.bindToClick(viewProvider: ()->View): ReadWriteProperty Unit> - = bindToClick { viewProvider() } + = bindToClickP { viewProvider() } fun View.bindToClick(): ReadWriteProperty Unit> - = bindToClick { this } + = bindToClickP { this } -private fun bindToClick(viewProvider: () -> View): ReadWriteProperty Unit> +private fun bindToClickP(viewProvider: () -> View): ReadWriteProperty Unit> = OnClickBinding(lazy(viewProvider)) private class OnClickBinding(viewProvider: Lazy) : ReadWriteProperty Unit> { diff --git a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToEditText.kt b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToEditText.kt index 3c8ead4..59f1678 100644 --- a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToEditText.kt +++ b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToEditText.kt @@ -11,32 +11,32 @@ import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty fun Activity.bindToEditText(@IdRes editTextId: Int): ReadWriteProperty - = bindToEditText { findViewById(editTextId) as EditText } + = bindToEditTextP { findViewById(editTextId) as EditText } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToEditText(@IdRes viewId: Int): ReadWriteProperty - = bindToEditText { view.findViewById(viewId) as EditText } + = bindToEditTextP { view.findViewById(viewId) as EditText } fun android.support.v4.app.Fragment.bindToEditText(@IdRes viewId: Int): ReadWriteProperty - = bindToEditText { view!!.findViewById(viewId) as EditText } + = bindToEditTextP { view!!.findViewById(viewId) as EditText } fun FrameLayout.bindToEditText(@IdRes viewId: Int): ReadWriteProperty - = bindToEditText { findViewById(viewId) as EditText } + = bindToEditTextP { findViewById(viewId) as EditText } fun EditText.bindToEditText(): ReadWriteProperty - = bindToEditText { this } + = bindToEditTextP { this } fun Activity.bindToEditText(viewProvider: () -> EditText): ReadWriteProperty - = bindToEditText { viewProvider() } + = bindToEditTextP { viewProvider() } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToEditText(viewProvider: () -> EditText): ReadWriteProperty - = bindToEditText { viewProvider() } + = bindToEditTextP { viewProvider() } fun android.support.v4.app.Fragment.bindToEditText(viewProvider: () -> EditText): ReadWriteProperty - = bindToEditText { viewProvider() } + = bindToEditTextP { viewProvider() } -private fun bindToEditText(viewProvider: () -> EditText): ReadWriteProperty +private fun bindToEditTextP(viewProvider: () -> EditText): ReadWriteProperty = EditTextViewTextBinding(lazy(viewProvider)) private class EditTextViewTextBinding(lazyViewProvider: Lazy) : ReadWriteProperty { diff --git a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToEditorActions.kt b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToEditorActions.kt index e0149ec..7b0837a 100644 --- a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToEditorActions.kt +++ b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToEditorActions.kt @@ -12,32 +12,32 @@ import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty fun Activity.bindToEditorActions(@IdRes editTextId: Int, predicate: (Int?, Int?) -> Boolean): ReadWriteProperty Unit> - = bindToEditorActions(predicate, { findViewById(editTextId) as EditText }) + = bindToEditorActionsP(predicate, { findViewById(editTextId) as EditText }) @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToEditorActions(@IdRes viewId: Int, predicate: (Int?, Int?) -> Boolean): ReadWriteProperty Unit> - = bindToEditorActions(predicate) { view.findViewById(viewId) as EditText } + = bindToEditorActionsP(predicate) { view.findViewById(viewId) as EditText } fun android.support.v4.app.Fragment.bindToEditorActions(@IdRes viewId: Int, predicate: (Int?, Int?) -> Boolean): ReadWriteProperty Unit> - = bindToEditorActions(predicate) { view!!.findViewById(viewId) as EditText } + = bindToEditorActionsP(predicate) { view!!.findViewById(viewId) as EditText } fun FrameLayout.bindToEditorActions(@IdRes viewId: Int, predicate: (Int?, Int?) -> Boolean): ReadWriteProperty Unit> - = bindToEditorActions(predicate) { findViewById(viewId) as EditText } + = bindToEditorActionsP(predicate) { findViewById(viewId) as EditText } -fun Activity.bindToEditorActions(viewProvider: ()->EditText, predicate: (Int?, Int?) -> Boolean): ReadWriteProperty Unit> - = bindToEditorActions(predicate, { viewProvider() }) +fun Activity.bindToEditorActions(viewProvider: () -> EditText, predicate: (Int?, Int?) -> Boolean): ReadWriteProperty Unit> + = bindToEditorActionsP(predicate, { viewProvider() }) @RequiresApi(Build.VERSION_CODES.HONEYCOMB) -fun Fragment.bindToEditorActions(viewProvider: ()->EditText, predicate: (Int?, Int?) -> Boolean): ReadWriteProperty Unit> - = bindToEditorActions(predicate) { viewProvider() } +fun Fragment.bindToEditorActions(viewProvider: () -> EditText, predicate: (Int?, Int?) -> Boolean): ReadWriteProperty Unit> + = bindToEditorActionsP(predicate) { viewProvider() } -fun android.support.v4.app.Fragment.bindToEditorActions(viewProvider: ()->EditText, predicate: (Int?, Int?) -> Boolean): ReadWriteProperty Unit> - = bindToEditorActions(predicate) { viewProvider() } +fun android.support.v4.app.Fragment.bindToEditorActions(viewProvider: () -> EditText, predicate: (Int?, Int?) -> Boolean): ReadWriteProperty Unit> + = bindToEditorActionsP(predicate) { viewProvider() } fun EditText.bindToEditorActions(predicate: (Int?, Int?) -> Boolean): ReadWriteProperty Unit> - = bindToEditorActions(predicate) { this } + = bindToEditorActionsP(predicate) { this } -private fun bindToEditorActions(predicate: (Int?, Int?) -> Boolean, viewProvider: () -> EditText): ReadWriteProperty Unit> +private fun bindToEditorActionsP(predicate: (Int?, Int?) -> Boolean, viewProvider: () -> EditText): ReadWriteProperty Unit> = OnEditorActionBinding(predicate, lazy(viewProvider)) private class OnEditorActionBinding( diff --git a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToErrorId.kt b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToErrorId.kt index 9ab84dc..b2d6b37 100644 --- a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToErrorId.kt +++ b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToErrorId.kt @@ -11,32 +11,32 @@ import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty fun Activity.bindToErrorId(@IdRes editTextId: Int): ReadWriteProperty - = bindToErrorId { findViewById(editTextId) as EditText } + = bindToErrorIdP { findViewById(editTextId) as EditText } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToErrorId(@IdRes viewId: Int): ReadWriteProperty - = bindToErrorId { view.findViewById(viewId) as EditText } + = bindToErrorIdP { view.findViewById(viewId) as EditText } fun android.support.v4.app.Fragment.bindToErrorId(@IdRes viewId: Int): ReadWriteProperty - = bindToErrorId { view!!.findViewById(viewId) as EditText } + = bindToErrorIdP { view!!.findViewById(viewId) as EditText } fun FrameLayout.bindToErrorId(@IdRes viewId: Int): ReadWriteProperty - = bindToErrorId { findViewById(viewId) as EditText } + = bindToErrorIdP { findViewById(viewId) as EditText } fun Activity.bindToErrorId(viewProvider: () -> EditText): ReadWriteProperty - = bindToErrorId { viewProvider() } + = bindToErrorIdP { viewProvider() } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToErrorId(viewProvider: () -> EditText): ReadWriteProperty - = bindToErrorId { viewProvider() } + = bindToErrorIdP { viewProvider() } fun android.support.v4.app.Fragment.bindToErrorId(viewProvider: () -> EditText): ReadWriteProperty - = bindToErrorId { viewProvider() } + = bindToErrorIdP { viewProvider() } fun EditText.bindToErrorId(): ReadWriteProperty - = bindToErrorId { this } + = bindToErrorIdP { this } -private fun bindToErrorId(viewProvider: () -> EditText): ReadWriteProperty +private fun bindToErrorIdP(viewProvider: () -> EditText): ReadWriteProperty = EditTextViewErrorIdBinding(lazy(viewProvider)) private class EditTextViewErrorIdBinding(lazyViewProvider: Lazy) : ReadWriteProperty { diff --git a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToLoading.kt b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToLoading.kt index 7e375ab..d4bfd92 100644 --- a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToLoading.kt +++ b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToLoading.kt @@ -14,7 +14,7 @@ import kotlin.reflect.KProperty fun Activity.bindToLoading( @IdRes progressViewId: Int, @IdRes restViewHolderId: Int -): ReadWriteProperty = bindToLoading( +): ReadWriteProperty = bindToLoadingP( progressViewProvider = { findViewById(progressViewId) }, restViewHolderProvider = { findViewById(restViewHolderId) } ) @@ -23,7 +23,7 @@ fun Activity.bindToLoading( fun Fragment.bindToLoading( @IdRes progressViewId: Int, @IdRes restViewHolderId: Int -): ReadWriteProperty = bindToLoading( +): ReadWriteProperty = bindToLoadingP( progressViewProvider = { view.findViewById(progressViewId) }, restViewHolderProvider = { view.findViewById(restViewHolderId) } ) @@ -32,7 +32,7 @@ fun Fragment.bindToLoading( fun android.support.v4.app.Fragment.bindToLoading( @IdRes progressViewId: Int, @IdRes restViewHolderId: Int -): ReadWriteProperty = bindToLoading( +): ReadWriteProperty = bindToLoadingP( progressViewProvider = { view!!.findViewById(progressViewId) }, restViewHolderProvider = { view!!.findViewById(restViewHolderId) } ) @@ -40,7 +40,7 @@ fun android.support.v4.app.Fragment.bindToLoading( fun FrameLayout.bindToLoading( @IdRes progressViewId: Int, @IdRes restViewHolderId: Int -): ReadWriteProperty = bindToLoading( +): ReadWriteProperty = bindToLoadingP( progressViewProvider = { findViewById(progressViewId) }, restViewHolderProvider = { findViewById(restViewHolderId) } ) @@ -48,7 +48,7 @@ fun FrameLayout.bindToLoading( fun Activity.bindToLoading( progressViewProvider: () -> View, restViewProvider: () -> View -): ReadWriteProperty = bindToLoading( +): ReadWriteProperty = bindToLoadingP( progressViewProvider = { progressViewProvider() }, restViewHolderProvider = { restViewProvider() } ) @@ -57,7 +57,7 @@ fun Activity.bindToLoading( fun Fragment.bindToLoading( progressViewProvider: () -> View, restViewProvider: () -> View -): ReadWriteProperty = bindToLoading( +): ReadWriteProperty = bindToLoadingP( progressViewProvider = { progressViewProvider() }, restViewHolderProvider = { restViewProvider() } ) @@ -66,17 +66,17 @@ fun Fragment.bindToLoading( fun android.support.v4.app.Fragment.bindToLoading( progressViewProvider: () -> View, restViewProvider: () -> View -): ReadWriteProperty = bindToLoading( +): ReadWriteProperty = bindToLoadingP( progressViewProvider = { progressViewProvider() }, restViewHolderProvider = { restViewProvider() } ) -fun Pair.bindToLoading(): ReadWriteProperty = bindToLoading( +fun Pair.bindToLoading(): ReadWriteProperty = bindToLoadingP( progressViewProvider = { first }, restViewHolderProvider = { second } ) -private fun bindToLoading( +private fun bindToLoadingP( progressViewProvider: () -> View, restViewHolderProvider: () -> View ): ReadWriteProperty = LoadingBinding( diff --git a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToLongClick.kt b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToLongClick.kt index 31b343d..1d4f771 100644 --- a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToLongClick.kt +++ b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToLongClick.kt @@ -11,32 +11,32 @@ import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty fun Activity.bindToLongClick(@IdRes viewId: Int): ReadWriteProperty Unit> - = bindToLongClick { findViewById(viewId) } + = bindToLongClickP { findViewById(viewId) } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToLongClick(@IdRes viewId: Int): ReadWriteProperty Unit> - = bindToLongClick { view.findViewById(viewId) } + = bindToLongClickP { view.findViewById(viewId) } fun android.support.v4.app.Fragment.bindToLongClick(@IdRes viewId: Int): ReadWriteProperty Unit> - = bindToLongClick { view!!.findViewById(viewId) } + = bindToLongClickP { view!!.findViewById(viewId) } fun FrameLayout.bindToLongClick(@IdRes viewId: Int): ReadWriteProperty Unit> - = bindToLongClick { findViewById(viewId) } + = bindToLongClickP { findViewById(viewId) } fun Activity.bindToLongClick(viewProvider: () -> View): ReadWriteProperty Unit> - = bindToLongClick { viewProvider() } + = bindToLongClickP { viewProvider() } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToLongClick(viewProvider: () -> View): ReadWriteProperty Unit> - = bindToLongClick { viewProvider() } + = bindToLongClickP { viewProvider() } fun android.support.v4.app.Fragment.bindToLongClick(viewProvider: () -> View): ReadWriteProperty Unit> - = bindToLongClick { viewProvider() } + = bindToLongClickP { viewProvider() } fun View.bindToLongClick(): ReadWriteProperty Unit> - = bindToLongClick { this } + = bindToLongClickP { this } -private fun bindToLongClick(viewProvider: () -> View): ReadWriteProperty Unit> +private fun bindToLongClickP(viewProvider: () -> View): ReadWriteProperty Unit> = OnLongClickBinding(lazy(viewProvider)) private class OnLongClickBinding(viewProvider: Lazy) : ReadWriteProperty Unit> { diff --git a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToRequestFocus.kt b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToRequestFocus.kt index bba0bf8..aa218bc 100644 --- a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToRequestFocus.kt +++ b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToRequestFocus.kt @@ -11,32 +11,32 @@ import kotlin.properties.ReadOnlyProperty import kotlin.reflect.KProperty fun Activity.bindToRequestFocus(@IdRes editViewId: Int): ReadOnlyProperty Unit> - = bindToRequestFocus { findViewById(editViewId) } + = bindToRequestFocusP { findViewById(editViewId) } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToRequestFocus(@IdRes editViewId: Int): ReadOnlyProperty Unit> - = bindToRequestFocus { view.findViewById(editViewId) } + = bindToRequestFocusP { view.findViewById(editViewId) } fun android.support.v4.app.Fragment.bindToRequestFocus(@IdRes editViewId: Int): ReadOnlyProperty Unit> - = bindToRequestFocus { view!!.findViewById(editViewId) } + = bindToRequestFocusP { view!!.findViewById(editViewId) } fun FrameLayout.bindToRequestFocus(@IdRes editViewId: Int): ReadOnlyProperty Unit> - = bindToRequestFocus { findViewById(editViewId) } + = bindToRequestFocusP { findViewById(editViewId) } fun Activity.bindToRequestFocus(viewProvider: () -> View): ReadOnlyProperty Unit> - = bindToRequestFocus { viewProvider() } + = bindToRequestFocusP { viewProvider() } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToRequestFocus(viewProvider: () -> View): ReadOnlyProperty Unit> - = bindToRequestFocus { viewProvider() } + = bindToRequestFocusP { viewProvider() } fun android.support.v4.app.Fragment.bindToRequestFocus(viewProvider: () -> View): ReadOnlyProperty Unit> - = bindToRequestFocus { viewProvider() } + = bindToRequestFocusP { viewProvider() } fun View.bindToRequestFocus(): ReadOnlyProperty Unit> - = bindToRequestFocus { this } + = bindToRequestFocusP { this } -private fun bindToRequestFocus(viewProvider: () -> View): ReadOnlyProperty Unit> +private fun bindToRequestFocusP(viewProvider: () -> View): ReadOnlyProperty Unit> = RequestFocusBinding(lazy(viewProvider)) private class RequestFocusBinding(viewProvider: Lazy) : ReadOnlyProperty Unit> { diff --git a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToSwipeRefresh.kt b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToSwipeRefresh.kt index a66314e..ae2a1b5 100644 --- a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToSwipeRefresh.kt +++ b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToSwipeRefresh.kt @@ -11,32 +11,32 @@ import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty fun Activity.bindToSwipeRefresh(@IdRes swipeRefreshLayoutId: Int): ReadWriteProperty - = bindToSwipeRefresh { findViewById(swipeRefreshLayoutId) as SwipeRefreshLayout } + = bindToSwipeRefreshP { findViewById(swipeRefreshLayoutId) as SwipeRefreshLayout } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToSwipeRefresh(@IdRes swipeRefreshLayoutId: Int): ReadWriteProperty - = bindToSwipeRefresh { view.findViewById(swipeRefreshLayoutId) as SwipeRefreshLayout } + = bindToSwipeRefreshP { view.findViewById(swipeRefreshLayoutId) as SwipeRefreshLayout } fun android.support.v4.app.Fragment.bindToSwipeRefresh(@IdRes swipeRefreshLayoutId: Int): ReadWriteProperty - = bindToSwipeRefresh { view!!.findViewById(swipeRefreshLayoutId) as SwipeRefreshLayout } + = bindToSwipeRefreshP { view!!.findViewById(swipeRefreshLayoutId) as SwipeRefreshLayout } fun FrameLayout.bindToSwipeRefresh(@IdRes swipeRefreshLayoutId: Int): ReadWriteProperty - = bindToSwipeRefresh { findViewById(swipeRefreshLayoutId) as SwipeRefreshLayout } + = bindToSwipeRefreshP { findViewById(swipeRefreshLayoutId) as SwipeRefreshLayout } -fun Activity.bindToSwipeRefresh(swipeRefreshLayoutProvider: ()->SwipeRefreshLayout): ReadWriteProperty - = bindToSwipeRefresh { swipeRefreshLayoutProvider() } +fun Activity.bindToSwipeRefresh(swipeRefreshLayoutProvider: () -> SwipeRefreshLayout): ReadWriteProperty + = bindToSwipeRefreshP { swipeRefreshLayoutProvider() } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) -fun Fragment.bindToSwipeRefresh(viewProvider: ()->SwipeRefreshLayout): ReadWriteProperty - = bindToSwipeRefresh { viewProvider() } +fun Fragment.bindToSwipeRefresh(viewProvider: () -> SwipeRefreshLayout): ReadWriteProperty + = bindToSwipeRefreshP { viewProvider() } -fun android.support.v4.app.Fragment.bindToSwipeRefresh(viewProvider: ()->SwipeRefreshLayout): ReadWriteProperty - = bindToSwipeRefresh { viewProvider() } +fun android.support.v4.app.Fragment.bindToSwipeRefresh(viewProvider: () -> SwipeRefreshLayout): ReadWriteProperty + = bindToSwipeRefreshP { viewProvider() } fun SwipeRefreshLayout.bindToSwipeRefresh(): ReadWriteProperty - = bindToSwipeRefresh { this } + = bindToSwipeRefreshP { this } -private fun bindToSwipeRefresh(viewProvider: () -> SwipeRefreshLayout): ReadWriteProperty +private fun bindToSwipeRefreshP(viewProvider: () -> SwipeRefreshLayout): ReadWriteProperty = SwipeRefreshBinding(lazy(viewProvider)) private class SwipeRefreshBinding(viewProvider: Lazy) : ReadWriteProperty { diff --git a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToText.kt b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToText.kt index 01691c2..56e8767 100644 --- a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToText.kt +++ b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToText.kt @@ -11,32 +11,32 @@ import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty fun Activity.bindToText(@IdRes textViewId: Int): ReadWriteProperty - = bindToText { findViewById(textViewId) as TextView } + = bindToTextP { findViewById(textViewId) as TextView } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToText(@IdRes textViewId: Int): ReadWriteProperty - = bindToText { view.findViewById(textViewId) as TextView } + = bindToTextP { view.findViewById(textViewId) as TextView } fun android.support.v4.app.Fragment.bindToText(@IdRes textViewId: Int): ReadWriteProperty - = bindToText { view!!.findViewById(textViewId) as TextView } + = bindToTextP { view!!.findViewById(textViewId) as TextView } fun FrameLayout.bindToText(@IdRes textViewId: Int): ReadWriteProperty - = bindToText { findViewById(textViewId) as TextView } + = bindToTextP { findViewById(textViewId) as TextView } fun Activity.bindToText(viewProvider: () -> TextView): ReadWriteProperty - = bindToText { viewProvider() } + = bindToTextP { viewProvider() } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToText(viewProvider: () -> TextView): ReadWriteProperty - = bindToText { viewProvider() } + = bindToTextP { viewProvider() } fun android.support.v4.app.Fragment.bindToText(viewProvider: () -> TextView): ReadWriteProperty - = bindToText { viewProvider() } + = bindToTextP { viewProvider() } fun TextView.bindToText(): ReadWriteProperty - = bindToText { this } + = bindToTextP { this } -private fun bindToText(viewProvider: () -> TextView): ReadWriteProperty +private fun bindToTextP(viewProvider: () -> TextView): ReadWriteProperty = TextBinding(lazy(viewProvider)) private class TextBinding(lazyViewProvider: Lazy) : ReadWriteProperty { diff --git a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToTextId.kt b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToTextId.kt index 858ccf0..8f220b3 100644 --- a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToTextId.kt +++ b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToTextId.kt @@ -11,32 +11,32 @@ import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty fun Activity.bindToTextId(@IdRes textViewId: Int): ReadWriteProperty - = bindToTextId { findViewById(textViewId) as TextView } + = bindToTextIdP { findViewById(textViewId) as TextView } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToTextId(@IdRes textViewId: Int): ReadWriteProperty - = bindToTextId { view.findViewById(textViewId) as TextView } + = bindToTextIdP { view.findViewById(textViewId) as TextView } fun android.support.v4.app.Fragment.bindToTextId(@IdRes textViewId: Int): ReadWriteProperty - = bindToTextId { view!!.findViewById(textViewId) as TextView } + = bindToTextIdP { view!!.findViewById(textViewId) as TextView } fun FrameLayout.bindToTextId(@IdRes textViewId: Int): ReadWriteProperty - = bindToTextId { findViewById(textViewId) as TextView } + = bindToTextIdP { findViewById(textViewId) as TextView } fun Activity.bindToTextId(viewProvider: () -> TextView): ReadWriteProperty - = bindToTextId { viewProvider() } + = bindToTextIdP { viewProvider() } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToTextId(viewProvider: () -> TextView): ReadWriteProperty - = bindToTextId { viewProvider() } + = bindToTextIdP { viewProvider() } fun android.support.v4.app.Fragment.bindToTextId(viewProvider: () -> TextView): ReadWriteProperty - = bindToTextId { viewProvider() } + = bindToTextIdP { viewProvider() } fun TextView.bindToTextId(): ReadWriteProperty - = bindToTextId { this } + = bindToTextIdP { this } -private fun bindToTextId(viewProvider: () -> TextView): ReadWriteProperty +private fun bindToTextIdP(viewProvider: () -> TextView): ReadWriteProperty = TextIdBinding(lazy(viewProvider)) private class TextIdBinding(lazyViewProvider: Lazy) : ReadWriteProperty { diff --git a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToVisibility.kt b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToVisibility.kt index aaff4b3..e0d2c65 100644 --- a/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToVisibility.kt +++ b/kotlinandroidviewbindings/src/main/java/com/marcinmoskala/kotlinandroidviewbindings/BindToVisibility.kt @@ -11,32 +11,32 @@ import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty fun Activity.bindToVisibility(@IdRes editTextId: Int): ReadWriteProperty - = bindToVisibility { findViewById(editTextId) } + = bindToVisibilityP { findViewById(editTextId) } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToVisibility(@IdRes editTextId: Int): ReadWriteProperty - = bindToVisibility { view.findViewById(editTextId) } + = bindToVisibilityP { view.findViewById(editTextId) } fun android.support.v4.app.Fragment.bindToVisibility(@IdRes editTextId: Int): ReadWriteProperty - = bindToVisibility { view!!.findViewById(editTextId) } + = bindToVisibilityP { view!!.findViewById(editTextId) } fun FrameLayout.bindToVisibility(@IdRes editTextId: Int): ReadWriteProperty - = bindToVisibility { findViewById(editTextId) } + = bindToVisibilityP { findViewById(editTextId) } fun Activity.bindToVisibility(viewProvider: () -> View): ReadWriteProperty - = bindToVisibility { viewProvider() } + = bindToVisibilityP { viewProvider() } @RequiresApi(Build.VERSION_CODES.HONEYCOMB) fun Fragment.bindToVisibility(viewProvider: () -> View): ReadWriteProperty - = bindToVisibility { viewProvider() } + = bindToVisibilityP { viewProvider() } fun android.support.v4.app.Fragment.bindToVisibility(viewProvider: () -> View): ReadWriteProperty - = bindToVisibility { viewProvider() } + = bindToVisibilityP { viewProvider() } fun View.bindToVisibility(): ReadWriteProperty - = bindToVisibility { this } + = bindToVisibilityP { this } -private fun bindToVisibility(viewProvider: () -> View): ReadWriteProperty +private fun bindToVisibilityP(viewProvider: () -> View): ReadWriteProperty = ViewVisibilityBinding(lazy(viewProvider)) private class ViewVisibilityBinding(viewProvider: Lazy) : ReadWriteProperty {