aboutsummaryrefslogtreecommitdiff
path: root/adapter/src/main
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-10-08 01:54:30 -0400
committerAllan Wang <me@allanwang.ca>2018-10-08 01:54:30 -0400
commit22fe1f537f4c17e145334bbed324558ebf2e4e91 (patch)
tree79c6509449a11b352cbcc3a86cbf3af59cf7a94b /adapter/src/main
parent5b3762b3e04042447b9bf2758c37237d0c8af1b6 (diff)
parent19020070cc073c81bfe397454f2314d37a78ed31 (diff)
downloadkau-22fe1f537f4c17e145334bbed324558ebf2e4e91.tar.gz
kau-22fe1f537f4c17e145334bbed324558ebf2e4e91.tar.bz2
kau-22fe1f537f4c17e145334bbed324558ebf2e4e91.zip
Update to match master
Diffstat (limited to 'adapter/src/main')
-rw-r--r--adapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt3
-rw-r--r--adapter/src/main/kotlin/ca/allanwang/kau/animators/KauAnimator.kt9
-rw-r--r--adapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt1
3 files changed, 6 insertions, 7 deletions
diff --git a/adapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt b/adapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt
index c3a1c61..870861d 100644
--- a/adapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt
+++ b/adapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt
@@ -172,7 +172,8 @@ class ThemableIItemDelegate : ThemableIItem, ThemableIItemColors by ThemableIIte
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
override fun bindBackgroundRipple(vararg views: View?) {
val background = backgroundColor ?: return
- val foreground = accentColor ?: textColor ?: backgroundColor ?: return //default to normal background
+ val foreground = accentColor ?: textColor ?: backgroundColor
+ ?: return //default to normal background
val ripple = createSimpleRippleDrawable(foreground, background)
views.forEach { it?.background = ripple }
}
diff --git a/adapter/src/main/kotlin/ca/allanwang/kau/animators/KauAnimator.kt b/adapter/src/main/kotlin/ca/allanwang/kau/animators/KauAnimator.kt
index 9e52aac..7b9b732 100644
--- a/adapter/src/main/kotlin/ca/allanwang/kau/animators/KauAnimator.kt
+++ b/adapter/src/main/kotlin/ca/allanwang/kau/animators/KauAnimator.kt
@@ -14,8 +14,7 @@ open class KauAnimator(
val changeAnimator: KauAnimatorChange = FadeAnimatorChange()
) : BaseItemAnimator() {
- open fun startDelay(holder: RecyclerView.ViewHolder, duration: Long, factor: Float)
- = Math.max(0L, (holder.adapterPosition * duration * factor).toLong())
+ open fun startDelay(holder: RecyclerView.ViewHolder, duration: Long, factor: Float) = Math.max(0L, (holder.adapterPosition * duration * factor).toLong())
override fun removeAnimation(holder: RecyclerView.ViewHolder): ViewPropertyAnimator {
return holder.itemView.animate().apply {
@@ -30,8 +29,7 @@ open class KauAnimator(
holder.itemView.apply { removeAnimator.animationCleanup(holder)() }
}
- override fun getRemoveDelay(remove: Long, move: Long, change: Long): Long
- = removeAnimator.getDelay(remove, move, change)
+ override fun getRemoveDelay(remove: Long, move: Long, change: Long): Long = removeAnimator.getDelay(remove, move, change)
override fun addAnimationPrepare(holder: RecyclerView.ViewHolder) {
holder.itemView.apply { addAnimator.animationPrepare(holder)() }
@@ -50,8 +48,7 @@ open class KauAnimator(
holder.itemView.apply { addAnimator.animationCleanup(holder)() }
}
- override fun getAddDelay(remove: Long, move: Long, change: Long): Long
- = addAnimator.getDelay(remove, move, change)
+ override fun getAddDelay(remove: Long, move: Long, change: Long): Long = addAnimator.getDelay(remove, move, change)
override fun changeOldAnimation(holder: RecyclerView.ViewHolder, changeInfo: ChangeInfo): ViewPropertyAnimator {
return holder.itemView.animate().apply {
diff --git a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt
index 196959c..5174503 100644
--- a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt
+++ b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt
@@ -21,6 +21,7 @@ open class KauIItem<Item, VH : RecyclerView.ViewHolder>(
) : AbstractItem<Item, VH>() where Item : IItem<*, *>, Item : IClickable<*> {
@SuppressLint("ResourceType")
final override fun getType(): Int = type
+
final override fun getViewHolder(v: View): VH = viewHolder(v)
final override fun getLayoutRes(): Int = layoutRes
} \ No newline at end of file