diff options
Diffstat (limited to 'kpref-activity')
22 files changed, 437 insertions, 173 deletions
diff --git a/kpref-activity/build.gradle b/kpref-activity/build.gradle index 8b2d12d..ef91e2b 100644 --- a/kpref-activity/build.gradle +++ b/kpref-activity/build.gradle @@ -6,8 +6,8 @@ apply from: '../android-lib.gradle' dependencies { implementation project(':core') - implementation project(':adapter') implementation project(':colorpicker') + implementation project(':adapter') } apply from: '../artifacts.gradle' diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KClick.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KClick.kt index c02b024..119f5eb 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KClick.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KClick.kt @@ -1,3 +1,18 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.kpref.activity import android.content.Context @@ -24,4 +39,4 @@ interface KClick<T> { * The item holding the data */ val item: KPrefItemBase<T> -}
\ No newline at end of file +} 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 b9681e9..edaf347 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 @@ -1,22 +1,42 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.kpref.activity import android.annotation.SuppressLint import android.os.Bundle -import android.support.annotation.StringRes -import android.support.v7.widget.Toolbar import android.view.View +import androidx.annotation.StringRes +import androidx.appcompat.widget.Toolbar 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.kpref.activity.items.KPrefItemCore import ca.allanwang.kau.ui.views.RippleCanvas -import ca.allanwang.kau.utils.* +import ca.allanwang.kau.utils.KAU_LEFT +import ca.allanwang.kau.utils.KAU_RIGHT +import ca.allanwang.kau.utils.resolveColor +import ca.allanwang.kau.utils.statusBarColor +import ca.allanwang.kau.utils.withLinearAdapter import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter import kotlinx.android.synthetic.main.kau_pref_activity.* -import org.jetbrains.anko.doAsync -import org.jetbrains.anko.uiThread -import java.util.* +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import java.util.Stack abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { @@ -32,12 +52,16 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { var animate: Boolean = true private val recyclerAnimatorNext: KauAnimator by lazy { - KauAnimator(SlideAnimatorAdd(KAU_RIGHT, itemDelayFactor = 0f), - SlideAnimatorRemove(KAU_LEFT, itemDelayFactor = 0f)) + KauAnimator( + SlideAnimatorAdd(KAU_RIGHT, itemDelayFactor = 0f), + SlideAnimatorRemove(KAU_LEFT, itemDelayFactor = 0f) + ) } private val recyclerAnimatorPrev: KauAnimator by lazy { - KauAnimator(SlideAnimatorAdd(KAU_LEFT, itemDelayFactor = 0f), - SlideAnimatorRemove(KAU_RIGHT, itemDelayFactor = 0f)) + KauAnimator( + SlideAnimatorAdd(KAU_LEFT, itemDelayFactor = 0f), + SlideAnimatorRemove(KAU_RIGHT, itemDelayFactor = 0f) + ) } /** @@ -69,26 +93,36 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { globalOptions = GlobalOptions(core, this) kau_recycler.withLinearAdapter(adapter) adapter.withSelectable(false) - .withOnClickListener { v, _, item, _ -> item.onClick(v!!); true } + .withOnClickListener { v, _, item, _ -> item.onClick(v!!); true } showNextPrefs(R.string.kau_settings, onCreateKPrefs(savedInstanceState), true) } - override fun showNextPrefs(@StringRes toolbarTitleRes: Int, builder: KPrefAdapterBuilder.() -> Unit) = showNextPrefs(toolbarTitleRes, builder, false) - - private fun showNextPrefs(@StringRes toolbarTitleRes: Int, builder: KPrefAdapterBuilder.() -> Unit, first: Boolean) { - doAsync { - val items = KPrefAdapterBuilder(globalOptions) - builder(items) - kprefStack.push(toolbarTitleRes to items.list) - kau_recycler.itemAnimator = if (animate && !first) recyclerAnimatorNext else null - uiThread { - adapter.clear() - adapter.add(items.list.filter { it.core.visible() }) - toolbar.setTitle(toolbarTitleRes) + override fun showNextPrefs(@StringRes toolbarTitleRes: Int, builder: KPrefAdapterBuilder.() -> Unit) = + showNextPrefs(toolbarTitleRes, builder, false) + + private fun showNextPrefs( + @StringRes toolbarTitleRes: Int, + builder: KPrefAdapterBuilder.() -> Unit, + first: Boolean + ) { + launch { + val items = withContext(Dispatchers.Default) { + val items = KPrefAdapterBuilder(globalOptions) + builder(items) + kprefStack.push(toolbarTitleRes to items.list) + items.list } + kau_recycler.itemAnimator = if (animate && !first) recyclerAnimatorNext else null + show(toolbarTitleRes, items) } } + private fun show(@StringRes toolbarTitleRes: Int, items: List<KPrefItemCore>) { + toolbar.setTitle(toolbarTitleRes) + adapter.clear() + adapter.add(items.filter { it.core.visible() }) + } + /** * Pops the stack and loads the next kpref list * Indices are not checked so ensure that this is possible first @@ -97,9 +131,7 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { kprefStack.pop() val (title, list) = kprefStack.peek() kau_recycler.itemAnimator = if (animate) recyclerAnimatorPrev else null - adapter.clear() - adapter.add(list.filter { it.core.visible() }) - toolbar.setTitle(title) + show(title, list) } /** @@ -162,4 +194,3 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract { return false } } - 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 2cdeae2..764831e 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 @@ -1,7 +1,31 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.kpref.activity -import android.support.annotation.StringRes -import ca.allanwang.kau.kpref.activity.items.* +import androidx.annotation.StringRes +import ca.allanwang.kau.kpref.activity.items.KPrefCheckbox +import ca.allanwang.kau.kpref.activity.items.KPrefColorPicker +import ca.allanwang.kau.kpref.activity.items.KPrefHeader +import ca.allanwang.kau.kpref.activity.items.KPrefItemBase +import ca.allanwang.kau.kpref.activity.items.KPrefItemCore +import ca.allanwang.kau.kpref.activity.items.KPrefPlainText +import ca.allanwang.kau.kpref.activity.items.KPrefSeekbar +import ca.allanwang.kau.kpref.activity.items.KPrefSubItems +import ca.allanwang.kau.kpref.activity.items.KPrefText +import ca.allanwang.kau.kpref.activity.items.KPrefTimePicker /** * Created by Allan Wang on 2017-06-08. @@ -35,11 +59,11 @@ interface KPrefActivityContract { fun reloadByTitle(@StringRes vararg title: Int) } - -class GlobalOptions(core: CoreAttributeContract, activity: KPrefActivityContract +class GlobalOptions( + core: CoreAttributeContract, + activity: KPrefActivityContract ) : CoreAttributeContract by core, KPrefActivityContract by activity - /** * Builder for kpref items * Contains DSLs for every possible item @@ -56,51 +80,79 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) { fun header(@StringRes title: Int) = list.add(KPrefHeader(KPrefItemCore.CoreBuilder(globalOptions, title))) @KPrefMarker - fun checkbox(@StringRes title: Int, - getter: (() -> Boolean), - setter: ((value: Boolean) -> Unit), - builder: KPrefItemBase.BaseContract<Boolean>.() -> Unit = {}) = list.add(KPrefCheckbox(KPrefItemBase.BaseBuilder(globalOptions, title, getter, setter) - .apply { builder() })) + fun checkbox( + @StringRes title: Int, + getter: () -> Boolean, + setter: KPrefItemActions.(value: Boolean) -> Unit, + builder: KPrefItemBase.BaseContract<Boolean>.() -> Unit = {} + ) = list.add( + KPrefCheckbox(KPrefItemBase.BaseBuilder(globalOptions, title, getter, setter) + .apply { builder() }) + ) @KPrefMarker - fun colorPicker(@StringRes title: Int, - getter: (() -> Int), - setter: ((value: Int) -> Unit), - builder: KPrefColorPicker.KPrefColorContract.() -> Unit = {}) = list.add(KPrefColorPicker(KPrefColorPicker.KPrefColorBuilder(globalOptions, title, getter, setter) - .apply { builder() })) + fun colorPicker( + @StringRes title: Int, + getter: () -> Int, + setter: KPrefItemActions.(value: Int) -> Unit, + builder: KPrefColorPicker.KPrefColorContract.() -> Unit = {} + ) = list.add( + KPrefColorPicker(KPrefColorPicker.KPrefColorBuilder(globalOptions, title, getter, setter) + .apply { builder() }) + ) @KPrefMarker - fun <T> text(@StringRes title: Int, - getter: (() -> T), - setter: ((value: T) -> Unit), - builder: KPrefText.KPrefTextContract<T>.() -> Unit = {}) = list.add(KPrefText(KPrefText.KPrefTextBuilder(globalOptions, title, getter, setter) - .apply { builder() })) + fun <T> text( + @StringRes title: Int, + getter: () -> T, + setter: KPrefItemActions.(value: T) -> Unit, + builder: KPrefText.KPrefTextContract<T>.() -> Unit = {} + ) = list.add( + KPrefText(KPrefText.KPrefTextBuilder(globalOptions, title, getter, setter) + .apply { builder() }) + ) @KPrefMarker - fun subItems(@StringRes title: Int, - itemBuilder: KPrefAdapterBuilder.() -> Unit, - builder: KPrefSubItems.KPrefSubItemsContract.() -> Unit) = list.add(KPrefSubItems(KPrefSubItems.KPrefSubItemsBuilder(globalOptions, title, itemBuilder) - .apply { builder() })) + fun subItems( + @StringRes title: Int, + itemBuilder: KPrefAdapterBuilder.() -> Unit, + builder: KPrefSubItems.KPrefSubItemsContract.() -> Unit + ) = list.add( + KPrefSubItems(KPrefSubItems.KPrefSubItemsBuilder(globalOptions, title, itemBuilder) + .apply { builder() }) + ) @KPrefMarker - fun plainText(@StringRes title: Int, - builder: KPrefItemBase.BaseContract<Unit>.() -> Unit = {}) = list.add(KPrefPlainText(KPrefPlainText.KPrefPlainTextBuilder(globalOptions, title) - .apply { builder() })) + fun plainText( + @StringRes title: Int, + builder: KPrefItemBase.BaseContract<Unit>.() -> Unit = {} + ) = list.add( + KPrefPlainText(KPrefPlainText.KPrefPlainTextBuilder(globalOptions, title) + .apply { builder() }) + ) @KPrefMarker - fun seekbar(@StringRes title: Int, - getter: (() -> Int), - setter: ((value: Int) -> Unit), - builder: KPrefSeekbar.KPrefSeekbarContract.() -> Unit = {}) = list.add(KPrefSeekbar(KPrefSeekbar.KPrefSeekbarBuilder(globalOptions, title, getter, setter) - .apply { builder() })) + fun seekbar( + @StringRes title: Int, + getter: () -> Int, + setter: KPrefItemActions.(value: Int) -> Unit, + builder: KPrefSeekbar.KPrefSeekbarContract.() -> Unit = {} + ) = list.add( + KPrefSeekbar(KPrefSeekbar.KPrefSeekbarBuilder(globalOptions, title, getter, setter) + .apply { builder() }) + ) @KPrefMarker - fun timePicker(@StringRes title: Int, - getter: (() -> Int), - setter: ((value: Int) -> Unit), - builder: KPrefTimePicker.KPrefTimeContract.() -> Unit = {}) = list.add(KPrefTimePicker(KPrefTimePicker.KPrefTimeBuilder(globalOptions, title, getter, setter) - .apply { builder() })) + fun timePicker( + @StringRes title: Int, + getter: () -> Int, + setter: KPrefItemActions.(value: Int) -> Unit, + builder: KPrefTimePicker.KPrefTimeContract.() -> Unit = {} + ) = list.add( + KPrefTimePicker(KPrefTimePicker.KPrefTimeBuilder(globalOptions, title, getter, setter) + .apply { builder() }) + ) @KPrefMarker val list: MutableList<KPrefItemCore> = mutableListOf() -}
\ No newline at end of file +} diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefItemActions.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefItemActions.kt new file mode 100644 index 0000000..e28bac6 --- /dev/null +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefItemActions.kt @@ -0,0 +1,11 @@ +package ca.allanwang.kau.kpref.activity + +/** + * Applicable actions + */ +interface KPrefItemActions { + /** + * Attempts to reload current item by identifying it with its titleId + */ + fun reloadSelf() +}
\ No newline at end of file diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt index f391747..0f025a6 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt @@ -1,7 +1,22 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.kpref.activity.items -import android.support.v7.widget.AppCompatCheckBox import android.widget.CheckBox +import androidx.appcompat.widget.AppCompatCheckBox import ca.allanwang.kau.kpref.activity.KClick import ca.allanwang.kau.kpref.activity.R import ca.allanwang.kau.utils.tint @@ -28,5 +43,4 @@ open class KPrefCheckbox(builder: BaseContract<Boolean>) : KPrefItemBase<Boolean } override fun getType(): Int = R.id.kau_item_pref_checkbox - -}
\ No newline at end of file +} diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefColorPicker.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefColorPicker.kt index 3201fbd..8b051c5 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefColorPicker.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefColorPicker.kt @@ -1,12 +1,29 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.kpref.activity.items import ca.allanwang.kau.colorpicker.CircleView import ca.allanwang.kau.colorpicker.ColorBuilder import ca.allanwang.kau.colorpicker.ColorContract -import ca.allanwang.kau.colorpicker.colorPickerDialog +import ca.allanwang.kau.colorpicker.kauColorChooser import ca.allanwang.kau.kpref.activity.GlobalOptions import ca.allanwang.kau.kpref.activity.KClick +import ca.allanwang.kau.kpref.activity.KPrefItemActions import ca.allanwang.kau.kpref.activity.R +import com.afollestad.materialdialogs.MaterialDialog /** * Created by Allan Wang on 2017-06-07. @@ -18,50 +35,52 @@ open class KPrefColorPicker(open val builder: KPrefColorContract) : KPrefItemBas override fun bindView(holder: ViewHolder, payloads: List<Any>) { super.bindView(holder, payloads) - builder.apply { - titleRes = core.titleFun() - colorCallback = { pref = it } - } if (builder.showPreview) { val preview = holder.bindInnerView<CircleView>(R.layout.kau_pref_color) preview.setBackgroundColor(pref) preview.withBorder = true - builder.apply { - colorCallback = { - pref = it - if (builder.showPreview) - preview.setBackgroundColor(it) - holder.updateTitle() - holder.updateDesc() - } + builder.callback = { _, color -> + pref = color + if (builder.showPreview) + preview.setBackgroundColor(color) + holder.updateTitle() + holder.updateDesc() } + } else { + builder.callback = { _, color -> pref = color } } } override fun KClick<Int>.defaultOnClick() { builder.defaultColor = pref - context.colorPickerDialog(builder).show() + MaterialDialog(context).show { + kauColorChooser(builder) + builder.dialogBuilder(this) + title(core.titleFun()) + } } /** * Extension of the base contract and [ColorContract] along with a showPreview option */ - interface KPrefColorContract : BaseContract<Int>, ColorContract { + interface KPrefColorContract : KPrefItemBase.BaseContract<Int>, ColorContract { var showPreview: Boolean + var dialogBuilder: MaterialDialog.() -> Unit } /** * Default implementation of [KPrefColorContract] */ - class KPrefColorBuilder(globalOptions: GlobalOptions, - titleId: Int, - getter: () -> Int, - setter: (value: Int) -> Unit - ) : KPrefColorContract, BaseContract<Int> by BaseBuilder(globalOptions, titleId, getter, setter), - ColorContract by ColorBuilder() { + class KPrefColorBuilder( + globalOptions: GlobalOptions, + titleId: Int, + getter: () -> Int, + setter: KPrefItemActions.(value: Int) -> Unit + ) : KPrefColorContract, KPrefItemBase.BaseContract<Int> by BaseBuilder(globalOptions, titleId, getter, setter), + ColorContract by ColorBuilder() { override var showPreview: Boolean = true + override var dialogBuilder: MaterialDialog.() -> Unit = {} } override fun getType(): Int = R.id.kau_item_pref_color_picker - -}
\ No newline at end of file +} diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefHeader.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefHeader.kt index 9b63a52..7d73322 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefHeader.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefHeader.kt @@ -1,3 +1,18 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.kpref.activity.items import ca.allanwang.kau.kpref.activity.R @@ -18,5 +33,4 @@ open class KPrefHeader(builder: CoreContract) : KPrefItemCore(builder) { } override fun getType() = R.id.kau_item_pref_header - -}
\ No newline at end of file +} 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 5081f50..c597b63 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 @@ -1,9 +1,25 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.kpref.activity.items -import android.support.annotation.CallSuper import android.view.View +import androidx.annotation.CallSuper import ca.allanwang.kau.kpref.activity.GlobalOptions import ca.allanwang.kau.kpref.activity.KClick +import ca.allanwang.kau.kpref.activity.KPrefItemActions import ca.allanwang.kau.kpref.activity.R import ca.allanwang.kau.utils.resolveDrawable @@ -17,7 +33,7 @@ abstract class KPrefItemBase<T>(protected val base: BaseContract<T>) : KPrefItem open var pref: T get() = base.getter() set(value) { - base.setter(value) + base.setter(this, value) } private var _enabled: Boolean = true @@ -78,20 +94,20 @@ abstract class KPrefItemBase<T>(protected val base: BaseContract<T>) : KPrefItem var onClick: (KClick<T>.() -> Unit)? var onDisabledClick: (KClick<T>.() -> Unit)? val getter: () -> T - val setter: (value: T) -> Unit + val setter: KPrefItemActions.(value: T) -> Unit } /** * Default implementation of [BaseContract] */ - class BaseBuilder<T>(globalOptions: GlobalOptions, - titleId: Int, - override val getter: () -> T, - override val setter: (value: T) -> Unit + class BaseBuilder<T>( + globalOptions: GlobalOptions, + titleId: Int, + override val getter: () -> T, + override val setter: KPrefItemActions.(value: T) -> Unit ) : CoreContract by CoreBuilder(globalOptions, titleId), BaseContract<T> { override var enabler: () -> Boolean = { true } override var onClick: (KClick<T>.() -> Unit)? = null override var onDisabledClick: (KClick<T>.() -> Unit)? = null } - -}
\ No newline at end of file +} 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 fcc13ba..36bf670 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 @@ -1,23 +1,44 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.kpref.activity.items import android.annotation.SuppressLint -import android.support.annotation.CallSuper -import android.support.annotation.IdRes -import android.support.annotation.LayoutRes -import android.support.annotation.StringRes -import android.support.v7.widget.RecyclerView import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.LinearLayout import android.widget.TextView +import androidx.annotation.CallSuper +import androidx.annotation.IdRes +import androidx.annotation.LayoutRes +import androidx.annotation.StringRes +import androidx.recyclerview.widget.RecyclerView import ca.allanwang.kau.adapters.ThemableIItem import ca.allanwang.kau.adapters.ThemableIItemDelegate import ca.allanwang.kau.kpref.activity.GlobalOptions +import ca.allanwang.kau.kpref.activity.KPrefItemActions import ca.allanwang.kau.kpref.activity.KPrefMarker import ca.allanwang.kau.kpref.activity.R -import ca.allanwang.kau.utils.* +import ca.allanwang.kau.utils.INVALID_ID +import ca.allanwang.kau.utils.adjustAlpha +import ca.allanwang.kau.utils.buildIsLollipopAndUp +import ca.allanwang.kau.utils.gone +import ca.allanwang.kau.utils.setIcon +import ca.allanwang.kau.utils.visible import com.mikepenz.fastadapter.items.AbstractItem import com.mikepenz.iconics.typeface.IIcon @@ -27,8 +48,8 @@ import com.mikepenz.iconics.typeface.IIcon * Core class containing nothing but the view items */ -abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCore, KPrefItemCore.ViewHolder>(), - ThemableIItem by ThemableIItemDelegate() { +abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCore, KPrefItemCore.ViewHolder>(), KPrefItemActions by core, + ThemableIItem by ThemableIItemDelegate() { final override fun getViewHolder(v: View) = ViewHolder(v) @@ -69,13 +90,15 @@ abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCor } protected inline fun withAccentColor(action: (color: Int) -> Unit) = - withColor(core.globalOptions.accentColor, action) + withColor(core.globalOptions.accentColor, action) protected inline fun withTextColor(action: (color: Int) -> Unit) = - withColor(core.globalOptions.textColor, action) + withColor(core.globalOptions.textColor, action) - protected inline fun withColor(noinline supplier: (() -> Int)?, - action: (color: Int) -> Unit) { + protected inline fun withColor( + noinline supplier: (() -> Int)?, + action: (color: Int) -> Unit + ) { val color = supplier?.invoke() ?: return action(color) } @@ -97,7 +120,7 @@ abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCor * Core values for all kpref items */ @KPrefMarker - interface CoreContract { + interface CoreContract : KPrefItemActions { val globalOptions: GlobalOptions val titleId: Int var titleFun: () -> Int @@ -106,18 +129,15 @@ abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCor var descFun: () -> Int var iicon: IIcon? var visible: () -> Boolean - - /** - * Attempts to reload current item by identifying it with its [id] - */ - fun reloadSelf() } /** * Default implementation of [CoreContract] */ - class CoreBuilder(override val globalOptions: GlobalOptions, - override val titleId: Int) : CoreContract { + class CoreBuilder( + override val globalOptions: GlobalOptions, + override val titleId: Int + ) : CoreContract { override var descRes: Int = INVALID_ID set(value) { field = value @@ -149,7 +169,7 @@ abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCor inline fun <reified T : View> bindInnerView(@LayoutRes id: Int, onFirstBind: (T) -> Unit): T { val innerFrame = this.innerFrame - ?: throw IllegalStateException("Cannot bind inner view when innerFrame does not exist") + ?: throw IllegalStateException("Cannot bind inner view when innerFrame does not exist") if (innerView !is T) { innerFrame.removeAllViews() LayoutInflater.from(innerFrame.context).inflate(id, innerFrame) @@ -162,7 +182,7 @@ abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCor inline fun <reified T : View> bindLowerView(@LayoutRes id: Int, onFirstBind: (T) -> Unit): T { val lowerFrame = this.lowerFrame - ?: throw IllegalStateException("Cannot bind inner view when lowerContent does not exist") + ?: throw IllegalStateException("Cannot bind inner view when lowerContent does not exist") if (lowerContent !is T) { lowerFrame.removeAllViews() LayoutInflater.from(lowerFrame.context).inflate(id, lowerFrame) @@ -173,4 +193,4 @@ abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCor operator fun get(@IdRes id: Int): View = itemView.findViewById(id) } -}
\ No newline at end of file +} diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefPlainText.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefPlainText.kt index 40bf284..6a0aaf5 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefPlainText.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefPlainText.kt @@ -1,3 +1,18 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.kpref.activity.items import ca.allanwang.kau.kpref.activity.GlobalOptions @@ -17,10 +32,9 @@ open class KPrefPlainText(open val builder: KPrefPlainTextBuilder) : KPrefItemBa override fun KClick<Unit>.defaultOnClick() = Unit class KPrefPlainTextBuilder( - globalOptions: GlobalOptions, - titleId: Int + globalOptions: GlobalOptions, + titleId: Int ) : BaseContract<Unit> by BaseBuilder(globalOptions, titleId, {}, {}) override fun getType(): Int = R.id.kau_item_pref_plain_text - -}
\ No newline at end of file +} diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt index ce61e8f..a582ec4 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt @@ -1,9 +1,25 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.kpref.activity.items import android.widget.SeekBar import android.widget.TextView import ca.allanwang.kau.kpref.activity.GlobalOptions import ca.allanwang.kau.kpref.activity.KClick +import ca.allanwang.kau.kpref.activity.KPrefItemActions import ca.allanwang.kau.kpref.activity.R import ca.allanwang.kau.utils.tint @@ -67,10 +83,10 @@ open class KPrefSeekbar(val builder: KPrefSeekbarContract) : KPrefItemBase<Int>( * Default implementation of [KPrefSeekbarContract] */ class KPrefSeekbarBuilder( - globalOptions: GlobalOptions, - titleId: Int, - getter: () -> Int, - setter: (value: Int) -> Unit + globalOptions: GlobalOptions, + titleId: Int, + getter: () -> Int, + setter: KPrefItemActions.(value: Int) -> Unit ) : KPrefSeekbarContract, BaseContract<Int> by BaseBuilder(globalOptions, titleId, getter, setter) { override var min: Int = 0 @@ -103,5 +119,4 @@ open class KPrefSeekbar(val builder: KPrefSeekbarContract) : KPrefItemBase<Int>( get() = this * increment + min override fun getType(): Int = R.id.kau_item_pref_seekbar - -}
\ No newline at end of file +} diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSubItems.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSubItems.kt index 6753142..1fa528b 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSubItems.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSubItems.kt @@ -1,3 +1,18 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.kpref.activity.items import android.view.View @@ -31,11 +46,10 @@ open class KPrefSubItems(open val builder: KPrefSubItemsContract) : KPrefItemCor * Default implementation of [KPrefTextContract] */ class KPrefSubItemsBuilder( - globalOptions: GlobalOptions, - titleId: Int, - override val itemBuilder: KPrefAdapterBuilder.() -> Unit + globalOptions: GlobalOptions, + titleId: Int, + override val itemBuilder: KPrefAdapterBuilder.() -> Unit ) : KPrefSubItemsContract, CoreContract by CoreBuilder(globalOptions, titleId) override fun getType(): Int = R.id.kau_item_pref_sub_item - -}
\ No newline at end of file +} diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefText.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefText.kt index 2ab911b..76c9e20 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefText.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefText.kt @@ -1,8 +1,24 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.kpref.activity.items import android.widget.TextView import ca.allanwang.kau.kpref.activity.GlobalOptions import ca.allanwang.kau.kpref.activity.KClick +import ca.allanwang.kau.kpref.activity.KPrefItemActions import ca.allanwang.kau.kpref.activity.R import ca.allanwang.kau.utils.toast @@ -22,7 +38,7 @@ open class KPrefText<T>(open val builder: KPrefTextContract<T>) : KPrefItemBase< override var pref: T get() = base.getter() set(value) { - base.setter(value) + base.setter(this, value) builder.reloadSelf() } @@ -48,14 +64,13 @@ open class KPrefText<T>(open val builder: KPrefTextContract<T>) : KPrefItemBase< * Default implementation of [KPrefTextContract] */ class KPrefTextBuilder<T>( - globalOptions: GlobalOptions, - titleId: Int, - getter: () -> T, - setter: (value: T) -> Unit + globalOptions: GlobalOptions, + titleId: Int, + getter: () -> T, + setter: KPrefItemActions.(value: T) -> Unit ) : KPrefTextContract<T>, BaseContract<T> by BaseBuilder<T>(globalOptions, titleId, getter, setter) { override var textGetter: (T) -> String? = { it?.toString() } } override fun getType(): Int = R.id.kau_item_pref_text - -}
\ No newline at end of file +} 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 f6fc40a..f50397c 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 @@ -1,11 +1,27 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.kpref.activity.items import android.app.TimePickerDialog import android.widget.TimePicker import ca.allanwang.kau.kpref.activity.GlobalOptions import ca.allanwang.kau.kpref.activity.KClick +import ca.allanwang.kau.kpref.activity.KPrefItemActions import ca.allanwang.kau.kpref.activity.R -import java.util.* +import java.util.Locale /** * Created by Allan Wang on 2017-06-14. @@ -30,11 +46,11 @@ open class KPrefTimePicker(override val builder: KPrefTimeContract) : KPrefText< * Default implementation of [KPrefTimeContract] */ class KPrefTimeBuilder( - globalOptions: GlobalOptions, - titleId: Int, - getter: () -> Int, - setter: (value: Int) -> Unit - ) : KPrefTimeContract, BaseContract<Int> by BaseBuilder<Int>(globalOptions, titleId, getter, setter) { + globalOptions: GlobalOptions, + titleId: Int, + getter: () -> Int, + setter: KPrefItemActions.(value: Int) -> Unit + ) : KPrefTimeContract, BaseContract<Int> by BaseBuilder(globalOptions, titleId, getter, setter) { override var use24HourFormat: Boolean = false @@ -50,15 +66,13 @@ open class KPrefTimePicker(override val builder: KPrefTimeContract) : KPrefText< else String.format(Locale.CANADA, "%d:%02d %s", hour % 12, min, if (hour >= 12) "PM" else "AM") } - } override fun getType(): Int = R.id.kau_item_pref_time_picker - } private val Int.splitTime: Pair<Int, Int> get() = Pair(this / 100, this % 100) private val Pair<Int, Int>.mergeTime: Int - get() = first * 100 + second
\ No newline at end of file + get() = first * 100 + second diff --git a/kpref-activity/src/main/res/layout/kau_pref_activity.xml b/kpref-activity/src/main/res/layout/kau_pref_activity.xml index 7651e5a..d6ea6e6 100644 --- a/kpref-activity/src/main/res/layout/kau_pref_activity.xml +++ b/kpref-activity/src/main/res/layout/kau_pref_activity.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> @@ -13,7 +13,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - <android.support.v7.widget.Toolbar + <androidx.appcompat.widget.Toolbar android:id="@id/kau_toolbar" android:layout_width="0dp" android:layout_height="?attr/actionBarSize" @@ -32,7 +32,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/kau_toolbar" /> - <android.support.v7.widget.RecyclerView + <androidx.recyclerview.widget.RecyclerView android:id="@+id/kau_recycler" android:layout_width="0dp" android:layout_height="0dp" @@ -41,4 +41,4 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/kau_toolbar" /> -</android.support.constraint.ConstraintLayout> +</androidx.constraintlayout.widget.ConstraintLayout> diff --git a/kpref-activity/src/main/res/layout/kau_pref_checkbox.xml b/kpref-activity/src/main/res/layout/kau_pref_checkbox.xml index 1fecb4d..6c52b52 100644 --- a/kpref-activity/src/main/res/layout/kau_pref_checkbox.xml +++ b/kpref-activity/src/main/res/layout/kau_pref_checkbox.xml @@ -1,4 +1,4 @@ -<android.support.v7.widget.AppCompatCheckBox xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.appcompat.widget.AppCompatCheckBox xmlns:android="http://schemas.android.com/apk/res/android" android:id="@id/kau_pref_inner_content" android:layout_width="wrap_content" android:layout_height="wrap_content" diff --git a/kpref-activity/src/main/res/layout/kau_pref_core.xml b/kpref-activity/src/main/res/layout/kau_pref_core.xml index 72f26d9..2571dd3 100644 --- a/kpref-activity/src/main/res/layout/kau_pref_core.xml +++ b/kpref-activity/src/main/res/layout/kau_pref_core.xml @@ -12,7 +12,7 @@ android:minHeight="?android:attr/listPreferredItemHeightSmall" android:orientation="horizontal"> - <android.support.constraint.ConstraintLayout + <androidx.constraintlayout.widget.ConstraintLayout android:id="@id/kau_pref_container" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -22,7 +22,7 @@ <!--As per Android N, icons (24dp) are aligned to the left rather than centered--> - <android.support.v7.widget.AppCompatImageView + <androidx.appcompat.widget.AppCompatImageView android:id="@id/kau_pref_icon" android:layout_width="56dp" android:layout_height="56dp" @@ -37,7 +37,7 @@ tools:ignore="RtlSymmetry" tools:layout_editor_absoluteX="0dp" /> - <android.support.v7.widget.AppCompatTextView + <androidx.appcompat.widget.AppCompatTextView android:id="@id/kau_pref_title" android:layout_width="0dp" android:layout_height="wrap_content" @@ -52,7 +52,7 @@ app:layout_constraintTop_toTopOf="parent" tools:layout_editor_absoluteX="-175dp" /> - <android.support.v7.widget.AppCompatTextView + <androidx.appcompat.widget.AppCompatTextView android:id="@id/kau_pref_desc" android:layout_width="0dp" android:layout_height="wrap_content" @@ -80,7 +80,7 @@ app:layout_constraintTop_toBottomOf="@id/kau_pref_desc" tools:layout_editor_absoluteX="-175dp" /> - <android.support.constraint.Barrier + <androidx.constraintlayout.widget.Barrier android:id="@id/kau_pref_barrier" android:layout_width="0dp" android:layout_height="0dp" @@ -105,6 +105,6 @@ app:layout_constraintVertical_bias="0.5" tools:layout_editor_absoluteX="1dp" /> - </android.support.constraint.ConstraintLayout> + </androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout>
\ No newline at end of file diff --git a/kpref-activity/src/main/res/layout/kau_pref_header.xml b/kpref-activity/src/main/res/layout/kau_pref_header.xml index d802a14..65504a3 100644 --- a/kpref-activity/src/main/res/layout/kau_pref_header.xml +++ b/kpref-activity/src/main/res/layout/kau_pref_header.xml @@ -1,4 +1,4 @@ -<android.support.v7.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.appcompat.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/kau_pref_title" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/kpref-activity/src/main/res/layout/kau_pref_seekbar.xml b/kpref-activity/src/main/res/layout/kau_pref_seekbar.xml index 0b07e1c..5ff6351 100644 --- a/kpref-activity/src/main/res/layout/kau_pref_seekbar.xml +++ b/kpref-activity/src/main/res/layout/kau_pref_seekbar.xml @@ -1,4 +1,4 @@ -<android.support.v7.widget.AppCompatSeekBar xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.appcompat.widget.AppCompatSeekBar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@id/kau_pref_lower_content" android:layout_width="match_parent" android:paddingTop="@dimen/kau_padding_normal" diff --git a/kpref-activity/src/main/res/layout/kau_pref_seekbar_text.xml b/kpref-activity/src/main/res/layout/kau_pref_seekbar_text.xml index dc11d2a..5834820 100644 --- a/kpref-activity/src/main/res/layout/kau_pref_seekbar_text.xml +++ b/kpref-activity/src/main/res/layout/kau_pref_seekbar_text.xml @@ -1,6 +1,6 @@ <!--TextView that aligns to the bottom--> -<android.support.v7.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.appcompat.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@id/kau_pref_inner_content" android:layout_width="wrap_content" android:layout_height="wrap_content" diff --git a/kpref-activity/src/main/res/layout/kau_pref_text.xml b/kpref-activity/src/main/res/layout/kau_pref_text.xml index 40fed2a..b873eaf 100644 --- a/kpref-activity/src/main/res/layout/kau_pref_text.xml +++ b/kpref-activity/src/main/res/layout/kau_pref_text.xml @@ -1,4 +1,4 @@ -<android.support.v7.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.appcompat.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@id/kau_pref_inner_content" android:layout_width="wrap_content" android:layout_height="wrap_content" |