aboutsummaryrefslogtreecommitdiff
path: root/adapter/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'adapter/src/main/kotlin')
-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