From 5388aabf0b581a69405125ec0cdaf05ae2455133 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 31 Dec 2019 11:25:29 -0800 Subject: Add lazy ui --- .../src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt | 5 +++-- .../kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemBase.kt | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'kpref-activity/src/main') diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt index 90827d3..818a770 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt @@ -24,6 +24,7 @@ import ca.allanwang.kau.animators.KauAnimator import ca.allanwang.kau.animators.SlideAnimatorAdd import ca.allanwang.kau.animators.SlideAnimatorRemove import ca.allanwang.kau.internal.KauBaseActivity +import ca.allanwang.kau.kotlin.lazyUi import ca.allanwang.kau.kpref.activity.items.KPrefItemCore import ca.allanwang.kau.ui.views.RippleCanvas import ca.allanwang.kau.utils.KAU_LEFT @@ -53,13 +54,13 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { */ var animate: Boolean = true - private val recyclerAnimatorNext: KauAnimator by lazy { + private val recyclerAnimatorNext: KauAnimator by lazyUi { KauAnimator( SlideAnimatorAdd(KAU_RIGHT, itemDelayFactor = 0f), SlideAnimatorRemove(KAU_LEFT, itemDelayFactor = 0f) ) } - private val recyclerAnimatorPrev: KauAnimator by lazy { + private val recyclerAnimatorPrev: KauAnimator by lazyUi { KauAnimator( SlideAnimatorAdd(KAU_LEFT, itemDelayFactor = 0f), SlideAnimatorRemove(KAU_RIGHT, itemDelayFactor = 0f) diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemBase.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemBase.kt index 9197057..16363e2 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemBase.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemBase.kt @@ -17,6 +17,7 @@ package ca.allanwang.kau.kpref.activity.items import android.view.View import androidx.annotation.CallSuper +import ca.allanwang.kau.kotlin.lazyUi import ca.allanwang.kau.kpref.activity.GlobalOptions import ca.allanwang.kau.kpref.activity.KClick import ca.allanwang.kau.kpref.activity.KPrefItemActions @@ -59,7 +60,7 @@ abstract class KPrefItemBase(protected val base: BaseContract) : KPrefItem val kclick = object : KClick { override val context = itemView.context override val itemView = itemView - override val innerView: View? by lazy { itemView.findViewById(R.id.kau_pref_inner_content) } + override val innerView: View? by lazyUi { itemView.findViewById(R.id.kau_pref_inner_content) } override val item = this@KPrefItemBase } if (_enabled) { -- cgit v1.2.3