aboutsummaryrefslogtreecommitdiff
path: root/kpref-activity
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-23 13:13:36 -0700
committerGitHub <noreply@github.com>2017-07-23 13:13:36 -0700
commit4706b8f6a8d08a6961da6ab34d15881b63356d79 (patch)
tree3d1e611e43bd589a98a5f1840c5b6f52ff254468 /kpref-activity
parent61d87976e8b29ed25061ae98743a6cf4f4274542 (diff)
downloadkau-4706b8f6a8d08a6961da6ab34d15881b63356d79.tar.gz
kau-4706b8f6a8d08a6961da6ab34d15881b63356d79.tar.bz2
kau-4706b8f6a8d08a6961da6ab34d15881b63356d79.zip
Update kpref-activity's min-sdk and other minor changes (#11)3.1.0
* Move some resources to public * Lower kpref minsdk * Remove excess kauUtils annotations * Allow nullable throwable * Do not throw null throwable * Make image picker base abstract again * Migrate about strings to private * Update readme * Update readme * Update sample tagging * Update adapter readme
Diffstat (limited to 'kpref-activity')
-rw-r--r--kpref-activity/build.gradle2
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt2
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt3
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt4
-rw-r--r--kpref-activity/src/main/res-public/values/ids.xml (renamed from kpref-activity/src/main/res/values/ids.xml)0
-rw-r--r--kpref-activity/src/main/res-public/values/public.xml17
-rw-r--r--kpref-activity/src/main/res/layout/kau_pref_checkbox.xml2
-rw-r--r--kpref-activity/src/main/res/layout/kau_pref_core.xml8
-rw-r--r--kpref-activity/src/main/res/layout/kau_pref_header.xml4
-rw-r--r--kpref-activity/src/main/res/layout/kau_pref_seekbar.xml2
-rw-r--r--kpref-activity/src/main/res/layout/kau_pref_seekbar_text.xml2
-rw-r--r--kpref-activity/src/main/res/layout/kau_pref_text.xml2
12 files changed, 35 insertions, 13 deletions
diff --git a/kpref-activity/build.gradle b/kpref-activity/build.gradle
index 2ced0c2..fd1c992 100644
--- a/kpref-activity/build.gradle
+++ b/kpref-activity/build.gradle
@@ -1,3 +1,5 @@
+ext.kauSubModuleMinSdk = project.CORE_MIN_SDK
+
ext.kauSubModuleResourcePrefix = "kau_pref_"
apply from: '../android-lib.gradle'
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 b978a6e..91c0cf2 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,5 +1,6 @@
package ca.allanwang.kau.kpref.activity
+import android.annotation.SuppressLint
import android.os.Bundle
import android.support.annotation.StringRes
import android.support.constraint.ConstraintLayout
@@ -51,6 +52,7 @@ abstract class KPrefActivity : AppCompatActivity(), KPrefActivityContract {
*/
abstract fun kPrefCoreAttributes(): CoreAttributeContract.() -> Unit
+ @SuppressLint("NewApi")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
//setup layout
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 19bdb56..5738022 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,5 +1,6 @@
package ca.allanwang.kau.kpref.activity.items
+import android.support.v7.widget.AppCompatCheckBox
import android.view.View
import android.widget.CheckBox
import ca.allanwang.kau.kpref.activity.R
@@ -15,7 +16,7 @@ open class KPrefCheckbox(builder: BaseContract<Boolean>) : KPrefItemBase<Boolean
override fun defaultOnClick(itemView: View, innerContent: View?): Boolean {
pref = !pref
- (innerContent as CheckBox).isChecked = pref
+ (innerContent as AppCompatCheckBox).isChecked = pref
return true
}
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 908c139..bd245af 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,5 +1,6 @@
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
@@ -31,6 +32,7 @@ abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCor
override final fun getViewHolder(v: View) = ViewHolder(v)
+ @SuppressLint("NewApi")
@CallSuper
override fun bindView(viewHolder: ViewHolder, payloads: List<Any>) {
super.bindView(viewHolder, payloads)
@@ -50,7 +52,7 @@ abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCor
desc?.setTextColor(textColor)
}
val accentColor = core.globalOptions.accentColor?.invoke()
- if (accentColor != null) {
+ if (accentColor != null && buildIsLollipopAndUp) {
icon?.drawable?.setTint(accentColor)
}
onPostBindView(this, textColor, accentColor)
diff --git a/kpref-activity/src/main/res/values/ids.xml b/kpref-activity/src/main/res-public/values/ids.xml
index 3bd69ed..3bd69ed 100644
--- a/kpref-activity/src/main/res/values/ids.xml
+++ b/kpref-activity/src/main/res-public/values/ids.xml
diff --git a/kpref-activity/src/main/res-public/values/public.xml b/kpref-activity/src/main/res-public/values/public.xml
index cf14680..b5fb383 100644
--- a/kpref-activity/src/main/res-public/values/public.xml
+++ b/kpref-activity/src/main/res-public/values/public.xml
@@ -1,4 +1,19 @@
<resources xmlns:tools='http://schemas.android.com/tools' tools:ignore='ResourceName'>
<!-- AUTO-GENERATED FILE. DO NOT MODIFY. public.xml is generated by the generatepublicxml gradle task -->
- <public name='dummy' type='id' />
+ <public name='kau_pref_barrier' type='id' />
+ <public name='kau_pref_container' type='id' />
+ <public name='kau_pref_desc' type='id' />
+ <public name='kau_pref_icon' type='id' />
+ <public name='kau_pref_inner_content' type='id' />
+ <public name='kau_pref_inner_frame' type='id' />
+ <public name='kau_pref_item_checkbox' type='id' />
+ <public name='kau_pref_item_color_picker' type='id' />
+ <public name='kau_pref_item_header' type='id' />
+ <public name='kau_pref_item_plain_text' type='id' />
+ <public name='kau_pref_item_seekbar' type='id' />
+ <public name='kau_pref_item_sub_item' type='id' />
+ <public name='kau_pref_item_text' type='id' />
+ <public name='kau_pref_lower_content' type='id' />
+ <public name='kau_pref_lower_frame' type='id' />
+ <public name='kau_pref_title' type='id' />
</resources> \ No newline at end of file
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 016394f..1fecb4d 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 @@
-<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.v7.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 1a53726..4b5de56 100644
--- a/kpref-activity/src/main/res/layout/kau_pref_core.xml
+++ b/kpref-activity/src/main/res/layout/kau_pref_core.xml
@@ -22,7 +22,7 @@
<!--As per Android N, icons (24dp) are aligned to the left rather than centered-->
- <ImageView
+ <android.support.v7.widget.AppCompatImageView
android:id="@id/kau_pref_icon"
android:layout_width="56dp"
android:layout_height="56dp"
@@ -36,7 +36,7 @@
app:layout_constraintVertical_bias="0.5"
tools:layout_editor_absoluteX="0dp" />
- <TextView
+ <android.support.v7.widget.AppCompatTextView
android:id="@id/kau_pref_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
@@ -51,13 +51,13 @@
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="-175dp" />
- <TextView
+ <android.support.v7.widget.AppCompatTextView
android:id="@id/kau_pref_desc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="10"
- android:textAppearance="?android:attr/textAppearanceListItemSecondary"
+ android:textAppearance="?textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintBottom_toTopOf="@id/kau_pref_lower_frame"
app:layout_constraintEnd_toStartOf="@id/kau_pref_inner_frame"
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 5deece3..d802a14 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 @@
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.v7.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"
@@ -6,5 +6,5 @@
android:paddingEnd="?android:attr/listPreferredItemPaddingRight"
android:paddingStart="?android:attr/listPreferredItemPaddingLeft"
android:paddingTop="16dip"
- android:textColor="?android:attr/colorAccent"
+ android:textColor="?colorAccent"
android:textSize="14sp" /> \ No newline at end of file
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 8da4d5d..0b07e1c 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 @@
-<SeekBar xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.v7.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 6ba2543..dc11d2a 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-->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.v7.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 a4d901e..bae83f2 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 @@
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.v7.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"