diff options
author | Allan Wang <me@allanwang.ca> | 2021-11-18 14:45:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-18 14:45:22 -0800 |
commit | 4c06d0ae4a4b2c8450ec68dd9b64d472cdd0202d (patch) | |
tree | 859d3dc7021d31f807c5ad90ddea31f711fa793d /kpref-activity/src | |
parent | e2ac8e3e82b842ea05c8c7a2c92d566553d8ea91 (diff) | |
parent | a9b8b69ab5e053e9106a98564e3a4047628387d6 (diff) | |
download | kau-6.4.0.tar.gz kau-6.4.0.tar.bz2 kau-6.4.0.zip |
Merge pull request #270 from AllanWang/versions6.4.0
Diffstat (limited to 'kpref-activity/src')
4 files changed, 40 insertions, 23 deletions
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 70b40e7..15bb008 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 @@ -31,10 +31,10 @@ import ca.allanwang.kau.ui.views.RippleCanvas import ca.allanwang.kau.utils.* import com.mikepenz.fastadapter.adapters.FastItemAdapter import com.mikepenz.fastadapter.select.getSelectExtension -import java.util.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import java.util.* abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { @@ -52,14 +52,14 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { private val recyclerAnimatorNext: KauAnimator by lazyUi { KauAnimator( - SlideAnimatorAdd(KAU_RIGHT, itemDelayFactor = 0f), - SlideAnimatorRemove(KAU_LEFT, itemDelayFactor = 0f) + SlideAnimatorAdd(KAU_RIGHT, itemDelayFactor = 0f), + SlideAnimatorRemove(KAU_LEFT, itemDelayFactor = 0f) ) } private val recyclerAnimatorPrev: KauAnimator by lazyUi { KauAnimator( - SlideAnimatorAdd(KAU_LEFT, itemDelayFactor = 0f), - SlideAnimatorRemove(KAU_RIGHT, itemDelayFactor = 0f) + SlideAnimatorAdd(KAU_LEFT, itemDelayFactor = 0f), + SlideAnimatorRemove(KAU_RIGHT, itemDelayFactor = 0f) ) } @@ -94,7 +94,7 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { insets } window.decorView.systemUiVisibility = - View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN statusBarColor = 0x30000000 kauToolbarRipple.set(resolveColor(R.attr.colorPrimary)) kauRipple.set(resolveColor(android.R.attr.colorBackground)) @@ -115,7 +115,7 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { } override fun showNextPrefs(@StringRes toolbarTitleRes: Int, builder: KPrefAdapterBuilder.() -> Unit) = - binding.showNextPrefs(toolbarTitleRes, builder, false) + binding.showNextPrefs(toolbarTitleRes, builder, false) private fun KauPrefActivityBinding.showNextPrefs( @StringRes toolbarTitleRes: Int, diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt index 764831e..f349c33 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt @@ -86,8 +86,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) { setter: KPrefItemActions.(value: Boolean) -> Unit, builder: KPrefItemBase.BaseContract<Boolean>.() -> Unit = {} ) = list.add( - KPrefCheckbox(KPrefItemBase.BaseBuilder(globalOptions, title, getter, setter) - .apply { builder() }) + KPrefCheckbox( + KPrefItemBase.BaseBuilder(globalOptions, title, getter, setter) + .apply { builder() } + ) ) @KPrefMarker @@ -97,8 +99,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) { setter: KPrefItemActions.(value: Int) -> Unit, builder: KPrefColorPicker.KPrefColorContract.() -> Unit = {} ) = list.add( - KPrefColorPicker(KPrefColorPicker.KPrefColorBuilder(globalOptions, title, getter, setter) - .apply { builder() }) + KPrefColorPicker( + KPrefColorPicker.KPrefColorBuilder(globalOptions, title, getter, setter) + .apply { builder() } + ) ) @KPrefMarker @@ -108,8 +112,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) { setter: KPrefItemActions.(value: T) -> Unit, builder: KPrefText.KPrefTextContract<T>.() -> Unit = {} ) = list.add( - KPrefText(KPrefText.KPrefTextBuilder(globalOptions, title, getter, setter) - .apply { builder() }) + KPrefText( + KPrefText.KPrefTextBuilder(globalOptions, title, getter, setter) + .apply { builder() } + ) ) @KPrefMarker @@ -118,8 +124,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) { itemBuilder: KPrefAdapterBuilder.() -> Unit, builder: KPrefSubItems.KPrefSubItemsContract.() -> Unit ) = list.add( - KPrefSubItems(KPrefSubItems.KPrefSubItemsBuilder(globalOptions, title, itemBuilder) - .apply { builder() }) + KPrefSubItems( + KPrefSubItems.KPrefSubItemsBuilder(globalOptions, title, itemBuilder) + .apply { builder() } + ) ) @KPrefMarker @@ -127,8 +135,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) { @StringRes title: Int, builder: KPrefItemBase.BaseContract<Unit>.() -> Unit = {} ) = list.add( - KPrefPlainText(KPrefPlainText.KPrefPlainTextBuilder(globalOptions, title) - .apply { builder() }) + KPrefPlainText( + KPrefPlainText.KPrefPlainTextBuilder(globalOptions, title) + .apply { builder() } + ) ) @KPrefMarker @@ -138,8 +148,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) { setter: KPrefItemActions.(value: Int) -> Unit, builder: KPrefSeekbar.KPrefSeekbarContract.() -> Unit = {} ) = list.add( - KPrefSeekbar(KPrefSeekbar.KPrefSeekbarBuilder(globalOptions, title, getter, setter) - .apply { builder() }) + KPrefSeekbar( + KPrefSeekbar.KPrefSeekbarBuilder(globalOptions, title, getter, setter) + .apply { builder() } + ) ) @KPrefMarker @@ -149,8 +161,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) { setter: KPrefItemActions.(value: Int) -> Unit, builder: KPrefTimePicker.KPrefTimeContract.() -> Unit = {} ) = list.add( - KPrefTimePicker(KPrefTimePicker.KPrefTimeBuilder(globalOptions, title, getter, setter) - .apply { builder() }) + KPrefTimePicker( + KPrefTimePicker.KPrefTimeBuilder(globalOptions, title, getter, setter) + .apply { builder() } + ) ) @KPrefMarker diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt index 0aaa2d3..8e1d9db 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt @@ -48,7 +48,9 @@ import com.mikepenz.iconics.typeface.IIcon * Core class containing nothing but the view items */ -abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCore.ViewHolder>(), KPrefItemActions by core, +abstract class KPrefItemCore(val core: CoreContract) : + AbstractItem<KPrefItemCore.ViewHolder>(), + KPrefItemActions by core, ThemableIItem by ThemableIItemDelegate() { final override fun getViewHolder(v: View) = ViewHolder(v) diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt index 318b630..1270d78 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt @@ -33,7 +33,8 @@ import java.util.Locale */ open class KPrefTimePicker(override val builder: KPrefTimeContract) : KPrefText<Int>(builder) { - interface KPrefTimeContract : KPrefText.KPrefTextContract<Int>, + interface KPrefTimeContract : + KPrefText.KPrefTextContract<Int>, TimePickerDialog.OnTimeSetListener { var use24HourFormat: Boolean } |