aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ca
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-11-08 22:40:06 -0500
committerGitHub <noreply@github.com>2017-11-08 22:40:06 -0500
commitf343d0f04c9cbb210f2b56b4f0c534ac56aa76ef (patch)
tree2a261a6ed4af0c17233714af7673d5370f19edbf /core/src/main/kotlin/ca
parent3b1cbd2f2cf211b804784bef33de85b8a889677e (diff)
downloadkau-f343d0f04c9cbb210f2b56b4f0c534ac56aa76ef.tar.gz
kau-f343d0f04c9cbb210f2b56b4f0c534ac56aa76ef.tar.bz2
kau-f343d0f04c9cbb210f2b56b4f0c534ac56aa76ef.zip
Translations Vietnamese (#99)
* Add translations * Lint * Inline * Optimize imports * Replace ellipsis
Diffstat (limited to 'core/src/main/kotlin/ca')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/ui/views/CollapsibleViewDelegate.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt20
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt5
4 files changed, 9 insertions, 20 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/ui/views/CollapsibleViewDelegate.kt b/core/src/main/kotlin/ca/allanwang/kau/ui/views/CollapsibleViewDelegate.kt
index 6994ca2..514b483 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/ui/views/CollapsibleViewDelegate.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/ui/views/CollapsibleViewDelegate.kt
@@ -37,7 +37,7 @@ interface CollapsibleView {
class CollapsibleViewDelegate : CollapsibleView {
private lateinit var viewRef: WeakReference<View>
- private val view
+ private inline val view
get() = viewRef.get()
private var animator: ValueAnimator? = null
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt
index 5da21bb..5cef0ac 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt
@@ -126,4 +126,4 @@ import android.widget.TextView
@KauUtils fun TextView.setTextWithFade(@StringRes textId: Int, duration: Long = 200, onFinish: (() -> Unit)? = null) = setTextWithFade(context.getString(textId), duration, onFinish)
-@KauUtils inline fun ViewPropertyAnimator.scaleXY(value: Float) = scaleX(value).scaleY(value) \ No newline at end of file
+@KauUtils fun ViewPropertyAnimator.scaleXY(value: Float) = scaleX(value).scaleY(value) \ No newline at end of file
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
index 16d1d01..d0e1f8f 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
@@ -149,6 +149,7 @@ fun Context.colorStateList(@ColorInt color: Int): ColorStateList {
* Largely based on MDTintHelper
* https://github.com/afollestad/material-dialogs/blob/master/core/src/main/java/com/afollestad/materialdialogs/internal/MDTintHelper.java
*/
+@SuppressLint("PrivateResource")
fun RadioButton.tint(colors: ColorStateList) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
buttonTintList = colors
@@ -162,6 +163,7 @@ fun RadioButton.tint(colors: ColorStateList) {
fun RadioButton.tint(@ColorInt color: Int) = tint(context.colorStateList(color))
+@SuppressLint("PrivateResource")
fun CheckBox.tint(colors: ColorStateList) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
buttonTintList = colors
@@ -180,20 +182,13 @@ fun SeekBar.tint(@ColorInt color: Int) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
thumbTintList = s1
progressTintList = s1
- } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
+ } else {
val progressDrawable = DrawableCompat.wrap(progressDrawable)
this.progressDrawable = progressDrawable
DrawableCompat.setTintList(progressDrawable, s1)
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- val thumbDrawable = DrawableCompat.wrap(thumb)
- DrawableCompat.setTintList(thumbDrawable, s1)
- thumb = thumbDrawable
- }
- } else {
- val mode: PorterDuff.Mode = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1)
- PorterDuff.Mode.MULTIPLY else PorterDuff.Mode.SRC_IN
- indeterminateDrawable?.setColorFilter(color, mode)
- progressDrawable?.setColorFilter(color, mode)
+ val thumbDrawable = DrawableCompat.wrap(thumb)
+ DrawableCompat.setTintList(thumbDrawable, s1)
+ thumb = thumbDrawable
}
}
@@ -204,8 +199,7 @@ fun ProgressBar.tint(@ColorInt color: Int, skipIndeterminate: Boolean = false) {
secondaryProgressTintList = sl
if (!skipIndeterminate) indeterminateTintList = sl
} else {
- val mode: PorterDuff.Mode = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1)
- PorterDuff.Mode.MULTIPLY else PorterDuff.Mode.SRC_IN
+ val mode: PorterDuff.Mode = PorterDuff.Mode.SRC_IN
indeterminateDrawable?.setColorFilter(color, mode)
progressDrawable?.setColorFilter(color, mode)
}
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt
index b03707d..b97f4aa 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt
@@ -1,12 +1,7 @@
package ca.allanwang.kau.utils
-import android.content.Context
-import android.os.Environment
import java.io.File
-import java.io.IOException
import java.io.InputStream
-import java.text.SimpleDateFormat
-import java.util.*
/**
* Created by Allan Wang on 2017-08-04.