aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-09-09 11:59:24 -0400
committerGitHub <noreply@github.com>2018-09-09 11:59:24 -0400
commitd540934915da26ab2cec4c897e973be35e0bfe24 (patch)
tree6f114d080c168381266a0d5d3a40b685e28b8e9a /core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
parent718a51ed00a0a5c3dc7a655e617308e82da65d1a (diff)
downloadkau-d540934915da26ab2cec4c897e973be35e0bfe24.tar.gz
kau-d540934915da26ab2cec4c897e973be35e0bfe24.tar.bz2
kau-d540934915da26ab2cec4c897e973be35e0bfe24.zip
Clean up kotterknife (#161)
* Remove bindview implementations internally * Remove more bindView calls * Make config private in ElasticRecyclerActivity * Fix recyclerview * Update adapter * Improve swipe destroy and add direction to swipe finish
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt115
1 files changed, 67 insertions, 48 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
index b0448d1..8c7c039 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
@@ -21,147 +21,133 @@ import kotlin.reflect.KProperty
import android.support.v4.app.DialogFragment as SupportDialogFragment
import android.support.v4.app.Fragment as SupportFragment
+private const val DEPRECATION_MESSAGE = "Kotterknife will be removed in favour of the kotlin_android_extensions plugin"
+
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> View.bindView(id: Int)
: ReadOnlyProperty<View, V> = required(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Activity.bindView(id: Int)
: ReadOnlyProperty<Activity, V> = required(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Dialog.bindView(id: Int)
: ReadOnlyProperty<Dialog, V> = required(id, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindViewResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindViewResettable<V>(id)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> DialogFragment.bindView(id: Int)
: ReadOnlyProperty<DialogFragment, V> = required(id, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindViewResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindViewResettable<V>(id)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportDialogFragment.bindView(id: Int)
: ReadOnlyProperty<android.support.v4.app.DialogFragment, V> = required(id, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindViewResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindViewResettable<V>(id)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Fragment.bindView(id: Int)
: ReadOnlyProperty<Fragment, V> = required(id, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindViewResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindViewResettable<V>(id)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportFragment.bindView(id: Int)
: ReadOnlyProperty<android.support.v4.app.Fragment, V> = required(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> ViewHolder.bindView(id: Int)
: ReadOnlyProperty<ViewHolder, V> = required(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> View.bindOptionalView(id: Int)
: ReadOnlyProperty<View, V?> = optional(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Activity.bindOptionalView(id: Int)
: ReadOnlyProperty<Activity, V?> = optional(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Dialog.bindOptionalView(id: Int)
: ReadOnlyProperty<Dialog, V?> = optional(id, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindOptionalViewResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindOptionalViewResettable<V>(id)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> DialogFragment.bindOptionalView(id: Int)
: ReadOnlyProperty<DialogFragment, V?> = optional(id, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindOptionalViewResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindOptionalViewResettable<V>(id)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportDialogFragment.bindOptionalView(id: Int)
: ReadOnlyProperty<android.support.v4.app.DialogFragment, V?> = optional(id, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindOptionalViewResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindOptionalViewResettable<V>(id)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Fragment.bindOptionalView(id: Int)
: ReadOnlyProperty<Fragment, V?> = optional(id, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindOptionalViewResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindOptionalViewResettable<V>(id)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportFragment.bindOptionalView(id: Int)
: ReadOnlyProperty<android.support.v4.app.Fragment, V?> = optional(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> ViewHolder.bindOptionalView(id: Int)
: ReadOnlyProperty<ViewHolder, V?> = optional(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> View.bindViews(vararg ids: Int)
: ReadOnlyProperty<View, List<V>> = required(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Activity.bindViews(vararg ids: Int)
: ReadOnlyProperty<Activity, List<V>> = required(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Dialog.bindViews(vararg ids: Int)
: ReadOnlyProperty<Dialog, List<V>> = required(ids, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindViewsResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindViewsResettable<V>(*ids)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> DialogFragment.bindViews(vararg ids: Int)
: ReadOnlyProperty<DialogFragment, List<V>> = required(ids, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindViewsResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindViewsResettable<V>(*ids)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportDialogFragment.bindViews(vararg ids: Int)
: ReadOnlyProperty<android.support.v4.app.DialogFragment, List<V>> = required(ids, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindViewsResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindViewsResettable<V>(*ids)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Fragment.bindViews(vararg ids: Int)
: ReadOnlyProperty<Fragment, List<V>> = required(ids, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindViewsResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindViewsResettable<V>(*ids)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportFragment.bindViews(vararg ids: Int)
: ReadOnlyProperty<android.support.v4.app.Fragment, List<V>> = required(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> ViewHolder.bindViews(vararg ids: Int)
: ReadOnlyProperty<ViewHolder, List<V>> = required(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> View.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<View, List<V>> = optional(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Activity.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<Activity, List<V>> = optional(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Dialog.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<Dialog, List<V>> = optional(ids, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindOptionalViewsResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindOptionalViewsResettable<V>(*ids)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> DialogFragment.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<DialogFragment, List<V>> = optional(ids, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindOptionalViewsResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindOptionalViewsResettable<V>(*ids)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportDialogFragment.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<android.support.v4.app.DialogFragment, List<V>> = optional(ids, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindOptionalViewsResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindOptionalViewsResettable<V>(*ids)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Fragment.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<Fragment, List<V>> = optional(ids, viewFinder)
-@Deprecated("Fragments operate on a different lifecycle. Consider using bindOptionalViewsResettable and resetting using KotterKnife.reset(this)",
- ReplaceWith("bindOptionalViewsResettable<V>(*ids)"),
- DeprecationLevel.WARNING)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportFragment.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<android.support.v4.app.Fragment, List<V>> = optional(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> ViewHolder.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<ViewHolder, List<V>> = optional(ids, viewFinder)
@@ -223,99 +209,131 @@ private open class Lazy<in T, out V>(private val initializer: (T, KProperty<*>)
* Credits to <a href="https://github.com/MichaelRocks">MichaelRocks</a>
*/
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> View.bindViewResettable(id: Int)
: ReadOnlyProperty<View, V> = requiredResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Activity.bindViewResettable(id: Int)
: ReadOnlyProperty<Activity, V> = requiredResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Dialog.bindViewResettable(id: Int)
: ReadOnlyProperty<Dialog, V> = requiredResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> DialogFragment.bindViewResettable(id: Int)
: ReadOnlyProperty<DialogFragment, V> = requiredResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportDialogFragment.bindViewResettable(id: Int)
: ReadOnlyProperty<android.support.v4.app.DialogFragment, V> = requiredResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Fragment.bindViewResettable(id: Int)
: ReadOnlyProperty<Fragment, V> = requiredResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportFragment.bindViewResettable(id: Int)
: ReadOnlyProperty<android.support.v4.app.Fragment, V> = requiredResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> ViewHolder.bindViewResettable(id: Int)
: ReadOnlyProperty<ViewHolder, V> = requiredResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> View.bindOptionalViewResettable(id: Int)
: ReadOnlyProperty<View, V?> = optionalResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Activity.bindOptionalViewResettable(id: Int)
: ReadOnlyProperty<Activity, V?> = optionalResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Dialog.bindOptionalViewResettable(id: Int)
: ReadOnlyProperty<Dialog, V?> = optionalResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> DialogFragment.bindOptionalViewResettable(id: Int)
: ReadOnlyProperty<DialogFragment, V?> = optionalResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportDialogFragment.bindOptionalViewResettable(id: Int)
: ReadOnlyProperty<android.support.v4.app.DialogFragment, V?> = optionalResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Fragment.bindOptionalViewResettable(id: Int)
: ReadOnlyProperty<Fragment, V?> = optionalResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportFragment.bindOptionalViewResettable(id: Int)
: ReadOnlyProperty<android.support.v4.app.Fragment, V?> = optionalResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> ViewHolder.bindOptionalViewResettable(id: Int)
: ReadOnlyProperty<ViewHolder, V?> = optionalResettable(id, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> View.bindViewsResettable(vararg ids: Int)
: ReadOnlyProperty<View, List<V>> = requiredResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Activity.bindViewsResettable(vararg ids: Int)
: ReadOnlyProperty<Activity, List<V>> = requiredResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Dialog.bindViewsResettable(vararg ids: Int)
: ReadOnlyProperty<Dialog, List<V>> = requiredResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> DialogFragment.bindViewsResettable(vararg ids: Int)
: ReadOnlyProperty<DialogFragment, List<V>> = requiredResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportDialogFragment.bindViewsResettable(vararg ids: Int)
: ReadOnlyProperty<android.support.v4.app.DialogFragment, List<V>> = requiredResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Fragment.bindViewsResettable(vararg ids: Int)
: ReadOnlyProperty<Fragment, List<V>> = requiredResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportFragment.bindViewsResettable(vararg ids: Int)
: ReadOnlyProperty<android.support.v4.app.Fragment, List<V>> = requiredResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> ViewHolder.bindViewsResettable(vararg ids: Int)
: ReadOnlyProperty<ViewHolder, List<V>> = requiredResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> View.bindOptionalViewsResettable(vararg ids: Int)
: ReadOnlyProperty<View, List<V>> = optionalResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Activity.bindOptionalViewsResettable(vararg ids: Int)
: ReadOnlyProperty<Activity, List<V>> = optionalResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Dialog.bindOptionalViewsResettable(vararg ids: Int)
: ReadOnlyProperty<Dialog, List<V>> = optionalResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> DialogFragment.bindOptionalViewsResettable(vararg ids: Int)
: ReadOnlyProperty<DialogFragment, List<V>> = optionalResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportDialogFragment.bindOptionalViewsResettable(vararg ids: Int)
: ReadOnlyProperty<android.support.v4.app.DialogFragment, List<V>> = optionalResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Fragment.bindOptionalViewsResettable(vararg ids: Int)
: ReadOnlyProperty<Fragment, List<V>> = optionalResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportFragment.bindOptionalViewsResettable(vararg ids: Int)
: ReadOnlyProperty<android.support.v4.app.Fragment, List<V>> = optionalResettable(ids, viewFinder)
+@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> ViewHolder.bindOptionalViewsResettable(vararg ids: Int)
: ReadOnlyProperty<ViewHolder, List<V>> = optionalResettable(ids, viewFinder)
@@ -345,6 +363,7 @@ private class LazyResettable<in T, out V>(initializer: (T, KProperty<*>) -> V) :
}
}
+@Deprecated(DEPRECATION_MESSAGE)
object Kotterknife {
fun reset(target: Any) {
KotterknifeRegistry.reset(target)