aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/androidTest/kotlin/ca/allanwang/kau/xml/ChangelogTest.kt3
-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
-rw-r--r--core/src/main/res-public/values-vi/strings_commons.xml67
-rw-r--r--core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt1
7 files changed, 76 insertions, 24 deletions
diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/xml/ChangelogTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/xml/ChangelogTest.kt
index a3c9ff1..e3b3170 100644
--- a/core/src/androidTest/kotlin/ca/allanwang/kau/xml/ChangelogTest.kt
+++ b/core/src/androidTest/kotlin/ca/allanwang/kau/xml/ChangelogTest.kt
@@ -1,10 +1,7 @@
package ca.allanwang.kau.xml
-import android.support.test.InstrumentationRegistry
import android.support.test.filters.MediumTest
import android.support.test.runner.AndroidJUnit4
-import ca.allanwang.kau.test.R
-import org.junit.Test
import org.junit.runner.RunWith
/**
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.
diff --git a/core/src/main/res-public/values-vi/strings_commons.xml b/core/src/main/res-public/values-vi/strings_commons.xml
new file mode 100644
index 0000000..e42087d
--- /dev/null
+++ b/core/src/main/res-public/values-vi/strings_commons.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!--Generated by crowdin.com-->
+<!--
+A collection of common string values
+Most resources are verbatim and x represents a formatted item
+-->
+<resources>
+ <string name="kau_about_app">Giới thiệu</string>
+ <string name="kau_about_x">Giới thiệu về %s</string>
+ <string name="kau_add_account">Thêm tài khoản</string>
+ <string name="kau_back">Quay lại</string>
+ <string name="kau_cancel">Bỏ</string>
+ <string name="kau_changelog">Nhật ký thay đổi</string>
+ <string name="kau_close">Đóng</string>
+ <string name="kau_contact_us">Liên hệ với chúng tôi</string>
+ <string name="kau_copy">Sao chép</string>
+ <string name="kau_custom">Khác</string>
+ <string name="kau_dark">Tối</string>
+ <string name="kau_default">Mặc định</string>
+ <string name="kau_do_not_show_again">Không hiện lại</string>
+ <string name="kau_done">Xong</string>
+ <string name="kau_error">Lỗi</string>
+ <string name="kau_exit">Thoát</string>
+ <string name="kau_exit_confirmation">Bạn chắc chắn muốn thoát?</string>
+ <string name="kau_exit_confirmation_x">Bạn chắc chắn muốn thoát %s?</string>
+ <string name="kau_glass">Trong suốt</string>
+ <string name="kau_got_it">Được rồi</string>
+ <string name="kau_great">Tuyệt</string>
+ <string name="kau_hide">Ẩn</string>
+ <string name="kau_light">Sáng</string>
+ <string name="kau_login">Đăng nhập</string>
+ <string name="kau_logout">Đăng xuất</string>
+ <string name="kau_logout_confirm_as_x">Bạn chắc chắn muốn đăng xuất %s?</string>
+ <string name="kau_manage_account">Quản lý tài khoản</string>
+ <string name="kau_maybe">Có thể</string>
+ <string name="kau_menu">Menu</string>
+ <string name="kau_no">Không</string>
+ <string name="kau_no_results_found">Không tìm thấy kết quả nào</string>
+ <string name="kau_none">Trống</string>
+ <string name="kau_ok">OK</string>
+ <string name="kau_play_store">Cửa hàng Play</string>
+ <string name="kau_rate">Đánh giá</string>
+ <string name="kau_report_bug">Báo cáo lỗi</string>
+ <string name="kau_search">Tìm</string>
+ <string name="kau_send_feedback">Gửi phản hồi</string>
+ <string name="kau_send_via">Gửi bằng</string>
+ <string name="kau_settings">Thiết lập</string>
+ <string name="kau_share">Chia sẻ</string>
+ <string name="kau_text_copied">Đã chép vào bộ nhớ tạm.</string>
+ <string name="kau_thank_you">Cảm ơn</string>
+ <string name="kau_uh_oh">Ồ…</string>
+ <string name="kau_warning">Cảnh báo</string>
+ <plurals name="kau_x_days">
+ <item quantity="other">%d ngày</item>
+ </plurals>
+ <plurals name="kau_x_hours">
+ <item quantity="other">%d giờ</item>
+ </plurals>
+ <plurals name="kau_x_minutes">
+ <item quantity="other">%d phút</item>
+ </plurals>
+ <plurals name="kau_x_seconds">
+ <item quantity="other">%d giây</item>
+ </plurals>
+ <string name="kau_yes">Đồng ý</string>
+ <string name="kau_permission_denied">Quyền bị từ chối</string>
+</resources>
diff --git a/core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt b/core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt
index 12bc5a4..05345bd 100644
--- a/core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt
+++ b/core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt
@@ -1,6 +1,5 @@
package ca.allanwang.kau.kotlin
-import org.jetbrains.anko.doAsync
import org.junit.Test
import kotlin.test.assertEquals