aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle1
-rw-r--r--gradle.properties12
-rw-r--r--library/build.gradle2
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt2
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefItemCore.kt2
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt3
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt9
-rw-r--r--library/src/main/res/layout/kau_preference.xml55
-rw-r--r--sample/build.gradle1
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt4
-rw-r--r--sample/src/main/res/values/strings.xml2
11 files changed, 54 insertions, 39 deletions
diff --git a/build.gradle b/build.gradle
index e922f4f..a166712 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,6 +19,7 @@ allprojects {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
+ maven { url "https://maven.google.com" }
}
}
diff --git a/gradle.properties b/gradle.properties
index 1ea34fe..ac10513 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -18,16 +18,18 @@ org.gradle.jvmargs=-Xmx1536m
APP_ID=KPrefs
APP_GROUP=ca.allanwang
MIN_SDK=21
-TARGET_SDK=25
-BUILD_TOOLS=25.0.2
+TARGET_SDK=26
+BUILD_TOOLS=26.0.0
VERSION_CODE=1
VERSION_NAME=0.1
-ANDROID_SUPPORT_LIBS=25.3.1
+ANDROID_SUPPORT_LIBS=26.0.0-alpha1
MATERIAL_DIALOG=0.9.4.3
ICONICS=2.8.5
+IICON_GOOGLE=3.0.1.0
TIMBER=4.5.1
-CONSTRAINT_LAYOUT=1.0.2
-FAST_ADAPTER=2.6.0
+CONSTRAINT_LAYOUT=1.1.0-beta1
+FAST_ADAPTER=2.6.2
+FAST_ADAPTER_COMMONS=2.6.0
BUTTERKNIFE=8.6.0
diff --git a/library/build.gradle b/library/build.gradle
index 8e5b674..44f22cf 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -50,7 +50,7 @@ dependencies {
compile "com.android.support.constraint:constraint-layout:${CONSTRAINT_LAYOUT}"
compile "com.mikepenz:fastadapter:${FAST_ADAPTER}@aar"
- compile "com.mikepenz:fastadapter-commons:${FAST_ADAPTER}@aar"
+ compile "com.mikepenz:fastadapter-commons:${FAST_ADAPTER_COMMONS}@aar"
compile "com.afollestad.material-dialogs:core:${MATERIAL_DIALOG}"
compile "com.afollestad.material-dialogs:commons:${MATERIAL_DIALOG}"
diff --git a/library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt b/library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt
index 14b8c4e..7f71195 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt
@@ -34,7 +34,7 @@ internal class ChangelogAdapter(val items: List<Pair<String, ChangelogType>>) :
override fun getItemCount() = items.size
internal class ChangelogVH(itemView: View) : RecyclerView.ViewHolder(itemView) {
- val text: TextView = itemView.findViewById(R.id.kau_changelog_text) as TextView
+ val text: TextView = itemView.findViewById<TextView>(R.id.kau_changelog_text)
}
}
diff --git a/library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefItemCore.kt b/library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefItemCore.kt
index dcb9dc5..8d5eca2 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefItemCore.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefItemCore.kt
@@ -42,7 +42,7 @@ abstract class KPrefItemCore(val builder: KPrefAdapterBuilder,
desc?.visible()?.setText(description)
else
desc?.gone()
- if (iicon != null) icon?.visible()?.setIcon(iicon, 48)
+ if (iicon != null) icon?.visible()?.setIcon(iicon, 24)
else icon?.gone()
innerFrame?.removeAllViews()
val textColor = builder.textColor?.invoke()
diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt
index d47d133..4bb72a8 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt
@@ -11,9 +11,10 @@ import com.mikepenz.iconics.typeface.IIcon
/**
* Created by Allan Wang on 2017-05-29.
*/
-fun IIcon.toDrawable(c: Context, sizeDp: Int = 24, @ColorInt color: Int = Color.WHITE): Drawable {
+fun IIcon.toDrawable(c: Context, sizeDp: Int = 24, @ColorInt color: Int = Color.WHITE, builder: IconicsDrawable.() -> Unit = {}): Drawable {
val state = ColorStateList.valueOf(color)
val icon = IconicsDrawable(c).icon(this).sizeDp(sizeDp)
icon.setTintList(state)
+ icon.builder()
return icon
} \ No newline at end of file
diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
index bd8478d..72b8573 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
@@ -1,17 +1,14 @@
package ca.allanwang.kau.utils
-import android.content.res.ColorStateList
import android.graphics.Color
import android.support.annotation.ColorInt
-import android.support.annotation.ColorRes
import android.support.annotation.StringRes
import android.support.design.widget.Snackbar
-import android.support.v4.content.ContextCompat
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
-import android.widget.ProgressBar
import android.widget.TextView
+import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.IIcon
@@ -57,8 +54,8 @@ fun TextView.setTextIfValid(@StringRes id: Int) {
if (id > 0) text = context.string(id)
}
-fun ImageView.setIcon(icon: IIcon?, sizeDp: Int = 24, @ColorInt color: Int = Color.WHITE) {
+fun ImageView.setIcon(icon: IIcon?, sizeDp: Int = 24, @ColorInt color: Int = Color.WHITE, builder: IconicsDrawable.() -> Unit = {}) {
if (icon == null) return
- setImageDrawable(icon.toDrawable(context, sizeDp, color))
+ setImageDrawable(icon.toDrawable(context, sizeDp = sizeDp, color = color, builder = builder))
}
diff --git a/library/src/main/res/layout/kau_preference.xml b/library/src/main/res/layout/kau_preference.xml
index 4401145..677b0dc 100644
--- a/library/src/main/res/layout/kau_preference.xml
+++ b/library/src/main/res/layout/kau_preference.xml
@@ -20,45 +20,32 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
+ <!--As per Android N, icons (24dp) are aligned to the left rather than centered-->
+
<ImageView
android:id="@+id/kau_pref_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="56dp"
+ android:layout_height="56dp"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:contentDescription="@string/kau_pref_icon"
- android:maxHeight="48dp"
- android:maxWidth="48dp"
+ android:paddingEnd="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5"
tools:layout_editor_absoluteX="0dp" />
- <LinearLayout
- android:id="@+id/kau_pref_inner_frame"
- android:layout_width="wrap_content"
- android:layout_height="0dp"
- android:layout_marginStart="16dp"
- android:gravity="center_vertical|end"
- android:orientation="horizontal"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="1.0"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.5"
- tools:layout_editor_absoluteX="1dp" />
-
<TextView
android:id="@+id/kau_pref_title"
- android:layout_width="wrap_content"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintBottom_toTopOf="@+id/kau_pref_desc"
- app:layout_constraintEnd_toStartOf="@id/kau_pref_inner_frame"
+ app:layout_constraintEnd_toStartOf="@+id/kau_pref_inner_frame"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toEndOf="@id/kau_pref_icon"
app:layout_constraintTop_toTopOf="parent"
@@ -67,7 +54,7 @@
<TextView
android:id="@id/kau_pref_desc"
- android:layout_width="wrap_content"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:ellipsize="end"
@@ -78,9 +65,33 @@
app:layout_constraintEnd_toStartOf="@id/kau_pref_inner_frame"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toEndOf="@id/kau_pref_icon"
- app:layout_constraintTop_toBottomOf="@+id/kau_pref_title"
+ app:layout_constraintTop_toBottomOf="@id/kau_pref_title"
tools:layout_editor_absoluteX="-175dp" />
+ <android.support.constraint.Barrier
+ android:id="@+id/kau_pref_barrier"
+ android:layout_width="1dp"
+ android:layout_height="wrap_content"
+ app:constraint_referenced_ids="kau_pref_title,kau_pref_desc"
+ app:barrierDirection="end"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent" />
+
+ <LinearLayout
+ android:id="@id/kau_pref_inner_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="0dp"
+ android:gravity="center_vertical|end"
+ android:orientation="horizontal"
+ android:paddingStart="16dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="1.0"
+ app:layout_constraintStart_toEndOf="@id/kau_pref_barrier"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0.5"
+ tools:layout_editor_absoluteX="1dp" />
+
</android.support.constraint.ConstraintLayout>
</LinearLayout> \ No newline at end of file
diff --git a/sample/build.gradle b/sample/build.gradle
index 9a349e6..9f4b555 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -35,4 +35,5 @@ dependencies {
testCompile 'junit:junit:4.12'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
+ compile "com.mikepenz:google-material-typeface:${IICON_GOOGLE}.original@aar"
}
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
index 98285d8..ac80fc6 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
@@ -9,6 +9,7 @@ import ca.allanwang.kau.utils.darken
import ca.allanwang.kau.utils.navigationBarColor
import ca.allanwang.kau.utils.showChangelog
import ca.allanwang.kau.views.RippleCanvas
+import com.mikepenz.google_material_typeface_library.GoogleMaterial
class MainActivity : KPrefActivity() {
@@ -39,7 +40,8 @@ class MainActivity : KPrefActivity() {
configs = {
allowCustom = false
})
- colorPicker(title = R.string.background_color, description = R.string.color_custom_alpha,
+ colorPicker(iicon = GoogleMaterial.Icon.gmd_colorize,
+ title = R.string.background_color, description = R.string.color_custom_alpha,
getter = { KPrefSample.bgColor }, setter = { KPrefSample.bgColor = it; bgCanvas.ripple(it, duration = 500L) },
configs = {
allowCustomAlpha = true
diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml
index d76a9e6..56addfd 100644
--- a/sample/src/main/res/values/strings.xml
+++ b/sample/src/main/res/values/strings.xml
@@ -12,5 +12,5 @@
<string name="background_color">Background Color</string>
<string name="color_custom">This selector allows custom colors</string>
<string name="color_no_custom">This selector does not allow custom colors</string>
- <string name="color_custom_alpha">This selector allows for custom colors with alpha values kjljkjljk ljl lijl ijlijl</string>
+ <string name="color_custom_alpha">This selector allows for custom colors with alpha values</string>
</resources>