aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ca
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin/ca')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/kotlin/LazyContext.kt4
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/swipe/ViewDragHelper.java4
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/ui/SimpleRippleDrawable.kt4
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt16
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/AnimHolder.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt12
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/Const.kt3
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt4
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/DrawableUtils.kt4
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/FragmentUtils.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt135
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/NotificationUtils.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/RecyclerUtils.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt14
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt20
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt8
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/xml/FAQ.kt2
26 files changed, 100 insertions, 156 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt b/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt
index dbdcf09..0184b9a 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt
@@ -6,7 +6,7 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
-import android.support.annotation.StringRes
+import androidx.annotation.StringRes
import android.util.DisplayMetrics
import ca.allanwang.kau.R
import ca.allanwang.kau.logging.KL
diff --git a/core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt b/core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt
index 87d94ce..c71761d 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt
@@ -1,6 +1,6 @@
package ca.allanwang.kau.internal
-import android.support.v7.app.AppCompatActivity
+import androidx.appcompat.app.AppCompatActivity
import ca.allanwang.kau.permissions.kauOnRequestPermissionsResult
/**
diff --git a/core/src/main/kotlin/ca/allanwang/kau/kotlin/LazyContext.kt b/core/src/main/kotlin/ca/allanwang/kau/kotlin/LazyContext.kt
index 0a45b65..3d98633 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/kotlin/LazyContext.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/kotlin/LazyContext.kt
@@ -1,8 +1,8 @@
package ca.allanwang.kau.kotlin
import android.content.Context
-import android.support.annotation.AnimRes
-import android.support.annotation.InterpolatorRes
+import androidx.annotation.AnimRes
+import androidx.annotation.InterpolatorRes
import android.view.animation.Animation
import android.view.animation.AnimationUtils
import android.view.animation.Interpolator
diff --git a/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt b/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt
index 36456ec..922dc09 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/permissions/PermissionManager.kt
@@ -3,7 +3,7 @@ package ca.allanwang.kau.permissions
import android.app.Activity
import android.content.Context
import android.content.pm.PackageManager
-import android.support.v4.app.ActivityCompat
+import androidx.core.app.ActivityCompat
import ca.allanwang.kau.kotlin.lazyContext
import ca.allanwang.kau.logging.KL
import ca.allanwang.kau.utils.KauException
diff --git a/core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt b/core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt
index 248e484..83cd2ed 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt
@@ -4,7 +4,7 @@ import android.Manifest
import android.app.Activity
import android.content.Context
import android.os.Build
-import android.support.annotation.RequiresApi
+import androidx.annotation.RequiresApi
/**
diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt
index a323e6c..4d7142c 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/SwipeBackLayout.kt
@@ -4,7 +4,7 @@ import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.graphics.Canvas
-import android.support.v4.view.ViewCompat
+import androidx.core.view.ViewCompat
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/ViewDragHelper.java b/core/src/main/kotlin/ca/allanwang/kau/swipe/ViewDragHelper.java
index 566e9e5..ac7fb7e 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/swipe/ViewDragHelper.java
+++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/ViewDragHelper.java
@@ -1,7 +1,7 @@
package ca.allanwang.kau.swipe;
import android.content.Context;
-import android.support.v4.view.ViewCompat;
+import androidx.core.view.ViewCompat;
import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;
@@ -25,7 +25,7 @@ import static ca.allanwang.kau.swipe.SwipeBackHelperKt.SWIPE_EDGE_TOP;
* of useful operations and state tracking for allowing a user to drag and reposition
* views within their parent ViewGroup.
* <p>
- * This is an extension of {@link android.support.v4.widget.ViewDragHelper}
+ * This is an extension of {@link androidx.core.widget.ViewDragHelper}
* Along with additional methods defined in {@link ViewDragHelperExtras}
*/
class ViewDragHelper implements ViewDragHelperExtras {
diff --git a/core/src/main/kotlin/ca/allanwang/kau/ui/SimpleRippleDrawable.kt b/core/src/main/kotlin/ca/allanwang/kau/ui/SimpleRippleDrawable.kt
index b92b222..4700162 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/ui/SimpleRippleDrawable.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/ui/SimpleRippleDrawable.kt
@@ -4,8 +4,8 @@ import android.content.res.ColorStateList
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.RippleDrawable
import android.os.Build
-import android.support.annotation.ColorInt
-import android.support.annotation.RequiresApi
+import androidx.annotation.ColorInt
+import androidx.annotation.RequiresApi
import ca.allanwang.kau.utils.adjustAlpha
/**
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt
index ab0e59f..eab9536 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ActivityUtils.kt
@@ -11,13 +11,13 @@ import android.content.Intent
import android.graphics.Color
import android.os.Build
import android.os.Bundle
-import android.support.annotation.ColorInt
-import android.support.annotation.RequiresApi
-import android.support.annotation.StringRes
-import android.support.design.widget.Snackbar
import android.view.Menu
import android.view.View
+import androidx.annotation.ColorInt
+import androidx.annotation.RequiresApi
+import androidx.annotation.StringRes
import ca.allanwang.kau.R
+import com.google.android.material.snackbar.Snackbar
import com.mikepenz.iconics.typeface.IIcon
import org.jetbrains.anko.contentView
@@ -135,9 +135,13 @@ fun Context.setMenuIcons(menu: Menu, @ColorInt color: Int = Color.WHITE, vararg
}
}
-inline fun Activity.hideKeyboard() = currentFocus.hideKeyboard()
+inline fun Activity.hideKeyboard() {
+ currentFocus?.hideKeyboard()
+}
-inline fun Activity.showKeyboard() = currentFocus.showKeyboard()
+inline fun Activity.showKeyboard() {
+ currentFocus?.showKeyboard()
+}
inline fun Activity.snackbar(text: String, duration: Int = Snackbar.LENGTH_LONG, noinline builder: Snackbar.() -> Unit = {}) = contentView!!.snackbar(text, duration, builder)
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/AnimHolder.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/AnimHolder.kt
index 2767f04..b988085 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/AnimHolder.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/AnimHolder.kt
@@ -1,7 +1,7 @@
package ca.allanwang.kau.utils
import android.os.Build
-import android.support.annotation.RequiresApi
+import androidx.annotation.RequiresApi
import ca.allanwang.kau.kotlin.lazyInterpolator
/**
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt
index a287cf2..d8e4681 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt
@@ -3,7 +3,7 @@ package ca.allanwang.kau.utils
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.annotation.SuppressLint
-import android.support.annotation.StringRes
+import androidx.annotation.StringRes
import android.view.View
import android.view.ViewAnimationUtils
import android.view.ViewPropertyAnimator
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt
index 82cd577..d628214 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt
@@ -5,7 +5,7 @@ import android.app.Activity
import android.app.ActivityOptions
import android.content.Context
import android.os.Bundle
-import android.support.annotation.AnimRes
+import androidx.annotation.AnimRes
import android.util.Pair
import android.view.View
import ca.allanwang.kau.R
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
index 236f2ca..f010c6f 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
@@ -7,12 +7,12 @@ import android.graphics.Color
import android.graphics.PorterDuff
import android.graphics.drawable.Drawable
import android.os.Build
-import android.support.annotation.ColorInt
-import android.support.annotation.FloatRange
-import android.support.annotation.IntRange
-import android.support.v4.graphics.drawable.DrawableCompat
-import android.support.v7.widget.AppCompatEditText
-import android.support.v7.widget.Toolbar
+import androidx.annotation.ColorInt
+import androidx.annotation.FloatRange
+import androidx.annotation.IntRange
+import androidx.core.graphics.drawable.DrawableCompat
+import androidx.appcompat.widget.AppCompatEditText
+import androidx.appcompat.widget.Toolbar
import android.widget.*
import com.afollestad.materialdialogs.R
import java.util.*
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/Const.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/Const.kt
index 1eeac1a..eb09093 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/Const.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/Const.kt
@@ -1,6 +1,7 @@
package ca.allanwang.kau.utils
-import android.support.v4.widget.ViewDragHelper
+import androidx.customview.widget.ViewDragHelper
+
/**
* Created by Allan Wang on 2017-06-08.
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
index 6568bf2..f6e9ac7 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
@@ -11,8 +11,8 @@ import android.content.pm.PackageManager
import android.graphics.drawable.Drawable
import android.net.Uri
import android.os.Bundle
-import android.support.annotation.*
-import android.support.v4.content.ContextCompat
+import androidx.annotation.*
+import androidx.core.content.ContextCompat
import android.util.TypedValue
import android.view.View
import android.view.animation.AnimationUtils
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/DrawableUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/DrawableUtils.kt
index dae3bff..59e684a 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/DrawableUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/DrawableUtils.kt
@@ -2,8 +2,8 @@ package ca.allanwang.kau.utils
import android.content.res.ColorStateList
import android.graphics.drawable.Drawable
-import android.support.annotation.ColorInt
-import android.support.v4.graphics.drawable.DrawableCompat
+import androidx.annotation.ColorInt
+import androidx.core.graphics.drawable.DrawableCompat
/**
* Wrap the color into a state and tint the drawable
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/FragmentUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/FragmentUtils.kt
index acc71f2..f99b342 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/FragmentUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/FragmentUtils.kt
@@ -1,6 +1,6 @@
package ca.allanwang.kau.utils
-import android.support.v4.app.Fragment
+import androidx.fragment.app.Fragment
import org.jetbrains.anko.bundleOf
/**
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt
index 51691af..66c56f8 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt
@@ -4,7 +4,7 @@ import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.drawable.Drawable
-import android.support.annotation.ColorInt
+import androidx.annotation.ColorInt
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.IIcon
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 8c7c039..3cbd93d 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
@@ -1,4 +1,4 @@
-@file:Suppress("UNCHECKED_CAST")
+@file:Suppress("UNCHECKED_CAST", "DEPRECATION")
package ca.allanwang.kau.utils
@@ -8,146 +8,118 @@ package ca.allanwang.kau.utils
* Courtesy of Jake Wharton
*
* https://github.com/JakeWharton/kotterknife/blob/master/src/main/kotlin/kotterknife/ButterKnife.kt
+ *
+ * Note that while this is useful for binding ids, there also exists other alternatives, such as
+ * `kotlin-android-extensions`.
+ *
+ * For fragments, make sure that the views are reset after the fragment lifecycle.
*/
import android.app.Activity
import android.app.Dialog
import android.app.DialogFragment
import android.app.Fragment
-import android.support.v7.widget.RecyclerView.ViewHolder
import android.view.View
+import androidx.recyclerview.widget.RecyclerView
+import androidx.recyclerview.widget.RecyclerView.ViewHolder
import java.util.*
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
-import android.support.v4.app.DialogFragment as SupportDialogFragment
-import android.support.v4.app.Fragment as SupportFragment
+import androidx.fragment.app.DialogFragment as SupportDialogFragment
+import androidx.fragment.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(DEPRECATION_MESSAGE)
fun <V : View> DialogFragment.bindView(id: Int)
: ReadOnlyProperty<DialogFragment, V> = required(id, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportDialogFragment.bindView(id: Int)
- : ReadOnlyProperty<android.support.v4.app.DialogFragment, V> = required(id, viewFinder)
+ : ReadOnlyProperty<SupportDialogFragment, V> = required(id, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Fragment.bindView(id: Int)
: ReadOnlyProperty<Fragment, V> = required(id, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportFragment.bindView(id: Int)
- : ReadOnlyProperty<android.support.v4.app.Fragment, V> = required(id, viewFinder)
+ : ReadOnlyProperty<SupportFragment, V> = required(id, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
-fun <V : View> ViewHolder.bindView(id: Int)
- : ReadOnlyProperty<ViewHolder, V> = required(id, viewFinder)
+fun <V : View> RecyclerView.ViewHolder.bindView(id: Int)
+ : ReadOnlyProperty<RecyclerView.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(DEPRECATION_MESSAGE)
fun <V : View> DialogFragment.bindOptionalView(id: Int)
: ReadOnlyProperty<DialogFragment, V?> = optional(id, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportDialogFragment.bindOptionalView(id: Int)
- : ReadOnlyProperty<android.support.v4.app.DialogFragment, V?> = optional(id, viewFinder)
+ : ReadOnlyProperty<SupportDialogFragment, V?> = optional(id, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Fragment.bindOptionalView(id: Int)
: ReadOnlyProperty<Fragment, V?> = optional(id, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportFragment.bindOptionalView(id: Int)
- : ReadOnlyProperty<android.support.v4.app.Fragment, V?> = optional(id, viewFinder)
+ : ReadOnlyProperty<SupportFragment, V?> = optional(id, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
-fun <V : View> ViewHolder.bindOptionalView(id: Int)
- : ReadOnlyProperty<ViewHolder, V?> = optional(id, viewFinder)
+fun <V : View> RecyclerView.ViewHolder.bindOptionalView(id: Int)
+ : ReadOnlyProperty<RecyclerView.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(DEPRECATION_MESSAGE)
fun <V : View> DialogFragment.bindViews(vararg ids: Int)
: ReadOnlyProperty<DialogFragment, List<V>> = required(ids, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportDialogFragment.bindViews(vararg ids: Int)
- : ReadOnlyProperty<android.support.v4.app.DialogFragment, List<V>> = required(ids, viewFinder)
+ : ReadOnlyProperty<SupportDialogFragment, List<V>> = required(ids, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Fragment.bindViews(vararg ids: Int)
: ReadOnlyProperty<Fragment, List<V>> = required(ids, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportFragment.bindViews(vararg ids: Int)
- : ReadOnlyProperty<android.support.v4.app.Fragment, List<V>> = required(ids, viewFinder)
+ : ReadOnlyProperty<SupportFragment, 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(DEPRECATION_MESSAGE)
fun <V : View> DialogFragment.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<DialogFragment, List<V>> = optional(ids, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportDialogFragment.bindOptionalViews(vararg ids: Int)
- : ReadOnlyProperty<android.support.v4.app.DialogFragment, List<V>> = optional(ids, viewFinder)
+ : ReadOnlyProperty<SupportDialogFragment, List<V>> = optional(ids, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> Fragment.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<Fragment, List<V>> = optional(ids, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> SupportFragment.bindOptionalViews(vararg ids: Int)
- : ReadOnlyProperty<android.support.v4.app.Fragment, List<V>> = optional(ids, viewFinder)
+ : ReadOnlyProperty<SupportFragment, List<V>> = optional(ids, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> ViewHolder.bindOptionalViews(vararg ids: Int)
: ReadOnlyProperty<ViewHolder, List<V>> = optional(ids, viewFinder)
@@ -189,13 +161,13 @@ private fun <T, V : View> optional(ids: IntArray, finder: T.(Int) -> View?) = La
private open class Lazy<in T, out V>(private val initializer: (T, KProperty<*>) -> V) : ReadOnlyProperty<T, V> {
protected object EMPTY
- protected var value: Any? = EMPTY
+protected var value: Any? = EMPTY
- override fun getValue(thisRef: T, property: KProperty<*>): V {
+override fun getValue(thisRef: T, property: KProperty<*>): V {
if (value == EMPTY)
value = initializer(thisRef, property)
- return value as V
+return value as V
}
}
@@ -209,133 +181,101 @@ 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)
+ : ReadOnlyProperty<SupportDialogFragment, 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)
+ : ReadOnlyProperty<SupportFragment, 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)
+ : ReadOnlyProperty<SupportDialogFragment, 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)
+ : ReadOnlyProperty<SupportFragment, 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)
+ : ReadOnlyProperty<SupportDialogFragment, 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)
+ : ReadOnlyProperty<SupportFragment, 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)
+ : ReadOnlyProperty<SupportDialogFragment, 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)
+ : ReadOnlyProperty<SupportFragment, List<V>> = optionalResettable(ids, viewFinder)
-@Deprecated(DEPRECATION_MESSAGE)
fun <V : View> ViewHolder.bindOptionalViewsResettable(vararg ids: Int)
- : ReadOnlyProperty<ViewHolder, List<V>> = optionalResettable(ids, viewFinder)
+ : ReadOnlyProperty<RecyclerView.ViewHolder, List<V>> = optionalResettable(ids, viewFinder)
private fun <T, V : View> requiredResettable(id: Int, finder: T.(Int) -> View?) = LazyResettable { t: T, desc ->
(t.finder(id) as V?)?.apply { } ?: viewNotFound(id, desc)
@@ -358,12 +298,11 @@ private class LazyResettable<in T, out V>(initializer: (T, KProperty<*>) -> V) :
return super.getValue(thisRef, property)
}
- fun reset() {
+fun reset() {
value = EMPTY
}
}
-@Deprecated(DEPRECATION_MESSAGE)
object Kotterknife {
fun reset(target: Any) {
KotterknifeRegistry.reset(target)
@@ -373,7 +312,7 @@ object Kotterknife {
private object KotterknifeRegistry {
private val lazyMap = WeakHashMap<Any, MutableCollection<LazyResettable<*, *>>>()
- fun register(target: Any, lazy: LazyResettable<*, *>) = lazyMap.getOrPut(target, { Collections.newSetFromMap(WeakHashMap()) }).add(lazy)
+fun register(target: Any, lazy: LazyResettable<*, *>) = lazyMap.getOrPut(target, { Collections.newSetFromMap(WeakHashMap()) }).add(lazy)
- fun reset(target: Any) = lazyMap[target]?.forEach(LazyResettable<*, *>::reset)
+fun reset(target: Any) = lazyMap[target]?.forEach(LazyResettable<*, *>::reset)
} \ No newline at end of file
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/NotificationUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/NotificationUtils.kt
index 1eb0076..016f3d2 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/NotificationUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/NotificationUtils.kt
@@ -1,7 +1,7 @@
package ca.allanwang.kau.utils
import android.content.Context
-import android.support.v4.app.NotificationManagerCompat
+import androidx.core.app.NotificationManagerCompat
/**
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/RecyclerUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/RecyclerUtils.kt
index 3a34db5..1c336f9 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/RecyclerUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/RecyclerUtils.kt
@@ -1,8 +1,8 @@
package ca.allanwang.kau.utils
import android.graphics.Rect
-import android.support.v7.widget.RecyclerView
import android.view.View
+import androidx.recyclerview.widget.RecyclerView
/**
* Created by Allan Wang on 2017-07-11.
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt
index ec206ee..1d12fd3 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt
@@ -1,14 +1,14 @@
package ca.allanwang.kau.utils
import android.os.Build
-import android.support.annotation.RequiresApi
-import android.support.annotation.TransitionRes
-import android.support.transition.AutoTransition
-import android.support.transition.TransitionInflater
-import android.support.transition.TransitionManager
+import androidx.annotation.RequiresApi
+import androidx.annotation.TransitionRes
+import androidx.transition.AutoTransition
+import androidx.transition.TransitionInflater
+import androidx.transition.TransitionManager
import android.transition.Transition
import android.view.ViewGroup
-import android.support.transition.Transition as SupportTransition
+import androidx.transition.Transition as SupportTransition
/**
* Created by Allan Wang on 2017-06-24.
@@ -52,7 +52,7 @@ fun ViewGroup.transitionAuto(builder: AutoTransition.() -> Unit = {}) {
}
@KauUtils
-fun ViewGroup.transitionDelayed(@TransitionRes id: Int, builder: android.support.transition.Transition.() -> Unit = {}) {
+fun ViewGroup.transitionDelayed(@TransitionRes id: Int, builder: androidx.transition.Transition.() -> Unit = {}) {
if (!buildIsLollipopAndUp) return
val transition = TransitionInflater.from(context).inflateTransition(id)
transition.builder()
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt
index 46e29b2..c8d5d2a 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt
@@ -8,7 +8,7 @@ import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import android.os.Handler
import android.os.Looper
-import android.support.annotation.IntRange
+import androidx.annotation.IntRange
import ca.allanwang.kau.R
import java.math.RoundingMode
import java.text.DecimalFormat
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
index 4e020bc..956df48 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
@@ -7,15 +7,10 @@ import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Color
import android.os.Build
-import android.support.annotation.ColorInt
-import android.support.annotation.ColorRes
-import android.support.annotation.RequiresApi
-import android.support.annotation.StringRes
-import android.support.design.widget.FloatingActionButton
-import android.support.design.widget.Snackbar
-import android.support.design.widget.TextInputEditText
-import android.support.v7.widget.LinearLayoutManager
-import android.support.v7.widget.RecyclerView
+import androidx.annotation.ColorInt
+import androidx.annotation.ColorRes
+import androidx.annotation.RequiresApi
+import androidx.annotation.StringRes
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
@@ -23,7 +18,12 @@ import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import android.widget.ImageView
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
import ca.allanwang.kau.ui.createSimpleRippleDrawable
+import com.google.android.material.floatingactionbutton.FloatingActionButton
+import com.google.android.material.snackbar.Snackbar
+import com.google.android.material.textfield.TextInputEditText
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.IIcon
@@ -291,7 +291,7 @@ fun FloatingActionButton.hideOnDownwardsScroll(recycler: RecyclerView) {
recycler.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
- if (newState == android.support.v7.widget.RecyclerView.SCROLL_STATE_IDLE && !isShown) show()
+ if (newState == RecyclerView.SCROLL_STATE_IDLE && !isShown) show()
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
diff --git a/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt b/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt
index 28d51a4..3955a77 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt
@@ -2,14 +2,14 @@ package ca.allanwang.kau.xml
import android.content.Context
import android.content.res.XmlResourceParser
-import android.support.annotation.ColorInt
-import android.support.annotation.LayoutRes
-import android.support.annotation.XmlRes
-import android.support.v7.widget.RecyclerView
+import androidx.annotation.ColorInt
+import androidx.annotation.LayoutRes
+import androidx.annotation.XmlRes
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
import ca.allanwang.kau.R
import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.use
diff --git a/core/src/main/kotlin/ca/allanwang/kau/xml/FAQ.kt b/core/src/main/kotlin/ca/allanwang/kau/xml/FAQ.kt
index 7caf5d6..bbe9425 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/xml/FAQ.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/xml/FAQ.kt
@@ -2,7 +2,7 @@ package ca.allanwang.kau.xml
import android.content.Context
import android.content.res.XmlResourceParser
-import android.support.annotation.XmlRes
+import androidx.annotation.XmlRes
import android.text.Html
import android.text.Spanned
import ca.allanwang.kau.utils.use