From f343d0f04c9cbb210f2b56b4f0c534ac56aa76ef Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Wed, 8 Nov 2017 22:40:06 -0500 Subject: Translations Vietnamese (#99) * Add translations * Lint * Inline * Optimize imports * Replace ellipsis --- .../kotlin/ca/allanwang/kau/xml/ChangelogTest.kt | 3 - .../kau/ui/views/CollapsibleViewDelegate.kt | 2 +- .../kotlin/ca/allanwang/kau/utils/AnimUtils.kt | 2 +- .../kotlin/ca/allanwang/kau/utils/ColorUtils.kt | 20 +++---- .../kotlin/ca/allanwang/kau/utils/FileUtils.kt | 5 -- .../main/res-public/values-vi/strings_commons.xml | 67 ++++++++++++++++++++++ .../kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt | 1 - 7 files changed, 76 insertions(+), 24 deletions(-) create mode 100644 core/src/main/res-public/values-vi/strings_commons.xml (limited to 'core/src') 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 - 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 @@ + + + + + Giới thiệu + Giới thiệu về %s + Thêm tài khoản + Quay lại + Bỏ + Nhật ký thay đổi + Đóng + Liên hệ với chúng tôi + Sao chép + Khác + Tối + Mặc định + Không hiện lại + Xong + Lỗi + Thoát + Bạn chắc chắn muốn thoát? + Bạn chắc chắn muốn thoát %s? + Trong suốt + Được rồi + Tuyệt + Ẩn + Sáng + Đăng nhập + Đăng xuất + Bạn chắc chắn muốn đăng xuất %s? + Quản lý tài khoản + Có thể + Menu + Không + Không tìm thấy kết quả nào + Trống + OK + Cửa hàng Play + Đánh giá + Báo cáo lỗi + Tìm + Gửi phản hồi + Gửi bằng + Thiết lập + Chia sẻ + Đã chép vào bộ nhớ tạm. + Cảm ơn + Ồ… + Cảnh báo + + %d ngày + + + %d giờ + + + %d phút + + + %d giây + + Đồng ý + Quyền bị từ chối + 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 -- cgit v1.2.3