diff options
author | Allan Wang <me@allanwang.ca> | 2018-10-08 01:06:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-08 01:06:44 -0400 |
commit | 81518f74fa76b6c2274a0e02ad4169f5d7f61e59 (patch) | |
tree | 8af3ed7f0fecad644a4a3c485cac760968ae8b2b /core/src/main/kotlin/ca/allanwang/kau/utils | |
parent | 4029fb9ab284f56f5dc838399fe38c42cb93c708 (diff) | |
download | kau-81518f74fa76b6c2274a0e02ad4169f5d7f61e59.tar.gz kau-81518f74fa76b6c2274a0e02ad4169f5d7f61e59.tar.bz2 kau-81518f74fa76b6c2274a0e02ad4169f5d7f61e59.zip |
Update translations (#169)
* New translations strings_about.xml (Polish)
* New translations strings_commons.xml (Hebrew)
* New translations strings_commons.xml (Tagalog)
* New translations strings_commons.xml (Swedish)
* New translations strings_commons.xml (Serbian (Cyrillic))
* New translations strings_commons.xml (Russian)
* New translations strings_commons.xml (Romanian)
* New translations strings_commons.xml (Portuguese, Brazilian)
* New translations strings_commons.xml (Portuguese)
* New translations strings_commons.xml (Norwegian)
* New translations strings_commons.xml (Korean)
* New translations strings_commons.xml (Japanese)
* New translations strings_commons.xml (Italian)
* New translations strings_commons.xml (Hungarian)
* New translations strings_commons.xml (Greek)
* New translations strings_commons.xml (German)
* New translations strings_commons.xml (Galician)
* New translations strings_commons.xml (French)
* New translations strings_commons.xml (Finnish)
* New translations strings_commons.xml (English)
* New translations strings_commons.xml (Dutch)
* New translations strings_commons.xml (Czech)
* New translations strings_commons.xml (Chinese Traditional)
* New translations strings_commons.xml (Chinese Simplified)
* New translations strings_commons.xml (Catalan)
* New translations strings_commons.xml (Arabic)
* New translations strings_commons.xml (Afrikaans)
* New translations strings_colorpicker.xml (Ukrainian)
* New translations strings_commons.xml (Ukrainian)
* New translations strings_mediapicker.xml (Ukrainian)
* New translations strings_mediapicker.xml (Tagalog)
* New translations strings_mediapicker.xml (Swedish)
* New translations strings_mediapicker.xml (Serbian (Cyrillic))
* New translations strings_mediapicker.xml (Russian)
* New translations strings_mediapicker.xml (Romanian)
* New translations strings_mediapicker.xml (Portuguese, Brazilian)
* New translations strings_mediapicker.xml (Portuguese)
* New translations strings_mediapicker.xml (Norwegian)
* New translations strings_mediapicker.xml (Korean)
* New translations strings_mediapicker.xml (Japanese)
* New translations strings_mediapicker.xml (Italian)
* New translations strings_mediapicker.xml (Hungarian)
* New translations strings_commons.xml (Vietnamese)
* New translations strings_mediapicker.xml (Hebrew)
* New translations strings_mediapicker.xml (Greek)
* New translations strings_mediapicker.xml (German)
* New translations strings_mediapicker.xml (Galician)
* New translations strings_mediapicker.xml (French)
* New translations strings_mediapicker.xml (Finnish)
* New translations strings_mediapicker.xml (English)
* New translations strings_mediapicker.xml (Dutch)
* New translations strings_mediapicker.xml (Czech)
* New translations strings_mediapicker.xml (Chinese Traditional)
* New translations strings_mediapicker.xml (Chinese Simplified)
* New translations strings_mediapicker.xml (Catalan)
* New translations strings_mediapicker.xml (Arabic)
* New translations strings_mediapicker.xml (Afrikaans)
* New translations strings_colorpicker.xml (Tagalog)
* New translations strings_mediapicker.xml (Polish)
* New translations strings_about.xml (English)
* New translations strings_about.xml (Portuguese, Brazilian)
* New translations strings_about.xml (Portuguese)
* New translations strings_about.xml (Norwegian)
* New translations strings_about.xml (Korean)
* New translations strings_about.xml (Japanese)
* New translations strings_about.xml (Italian)
* New translations strings_about.xml (Hungarian)
* New translations strings_about.xml (Hebrew)
* New translations strings_about.xml (Greek)
* New translations strings_about.xml (German)
* New translations strings_about.xml (Galician)
* New translations strings_about.xml (French)
* New translations strings_about.xml (Finnish)
* New translations strings_about.xml (Dutch)
* New translations strings_about.xml (Russian)
* New translations strings_about.xml (Czech)
* New translations strings_about.xml (Chinese Simplified)
* New translations strings_about.xml (Catalan)
* New translations strings_about.xml (Arabic)
* New translations strings_about.xml (Afrikaans)
* New translations strings_mediapicker.xml (Danish)
* New translations strings_commons.xml (Danish)
* New translations strings_colorpicker.xml (Danish)
* New translations strings_about.xml (Danish)
* New translations strings_mediapicker.xml (Spanish)
* New translations strings_commons.xml (Spanish)
* New translations strings_about.xml (Spanish)
* New translations strings_about.xml (Chinese Traditional)
* New translations strings_about.xml (Romanian)
* New translations strings_about.xml (Serbian (Cyrillic))
* New translations strings_colorpicker.xml (Swedish)
* New translations strings_colorpicker.xml (Serbian (Cyrillic))
* New translations strings_colorpicker.xml (Russian)
* New translations strings_colorpicker.xml (Romanian)
* New translations strings_colorpicker.xml (Portuguese)
* New translations strings_colorpicker.xml (Japanese)
* New translations strings_colorpicker.xml (Hebrew)
* New translations strings_colorpicker.xml (Greek)
* New translations strings_about.xml (Swedish)
* New translations strings_colorpicker.xml (Arabic)
* New translations strings_about.xml (Tagalog)
* New translations strings_about.xml (Ukrainian)
* New translations strings_about.xml (Vietnamese)
* New translations strings_colorpicker.xml (Afrikaans)
* New translations strings_colorpicker.xml (Catalan)
* New translations strings_colorpicker.xml (Chinese Traditional)
* New translations strings_colorpicker.xml (Czech)
* New translations strings_colorpicker.xml (Dutch)
* New translations strings_colorpicker.xml (English)
* New translations strings_colorpicker.xml (Finnish)
* New translations strings_mediapicker.xml (Vietnamese)
* New translations strings_commons.xml (Danish)
* New translations strings_about.xml (Swedish)
* New translations strings_about.xml (Ukrainian)
* New translations strings_colorpicker.xml (Swedish)
* New translations strings_colorpicker.xml (Ukrainian)
* New translations strings_commons.xml (Swedish)
* New translations strings_commons.xml (Ukrainian)
* New translations strings_mediapicker.xml (Swedish)
* New translations strings_mediapicker.xml (Ukrainian)
* Delete empty files
* Optimize all source files
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/utils')
5 files changed, 42 insertions, 30 deletions
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 d0e1f8f..236f2ca 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt @@ -94,12 +94,10 @@ fun Int.blendWith(@ColorInt color: Int, @FloatRange(from = 0.0, to = 1.0) ratio: } @ColorInt -fun Int.withAlpha(@IntRange(from = 0L, to = 255L) alpha: Int): Int - = Color.argb(alpha, Color.red(this), Color.green(this), Color.blue(this)) +fun Int.withAlpha(@IntRange(from = 0L, to = 255L) alpha: Int): Int = Color.argb(alpha, Color.red(this), Color.green(this), Color.blue(this)) @ColorInt -fun Int.withMinAlpha(@IntRange(from = 0L, to = 255L) alpha: Int): Int - = Color.argb(Math.max(alpha, Color.alpha(this)), Color.red(this), Color.green(this), Color.blue(this)) +fun Int.withMinAlpha(@IntRange(from = 0L, to = 255L) alpha: Int): Int = Color.argb(Math.max(alpha, Color.alpha(this)), Color.red(this), Color.green(this), Color.blue(this)) @ColorInt fun Int.lighten(@FloatRange(from = 0.0, to = 1.0) factor: Float = 0.1f): Int { @@ -116,12 +114,10 @@ fun Int.darken(@FloatRange(from = 0.0, to = 1.0) factor: Float = 0.1f): Int { } @ColorInt -fun Int.colorToBackground(@FloatRange(from = 0.0, to = 1.0) factor: Float = 0.1f): Int - = if (isColorDark) darken(factor) else lighten(factor) +fun Int.colorToBackground(@FloatRange(from = 0.0, to = 1.0) factor: Float = 0.1f): Int = if (isColorDark) darken(factor) else lighten(factor) @ColorInt -fun Int.colorToForeground(@FloatRange(from = 0.0, to = 1.0) factor: Float = 0.1f): Int - = if (isColorDark) lighten(factor) else darken(factor) +fun Int.colorToForeground(@FloatRange(from = 0.0, to = 1.0) factor: Float = 0.1f): Int = if (isColorDark) lighten(factor) else darken(factor) @Throws(IllegalArgumentException::class) fun String.toColor(): Int { 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 b97f4aa..bfbc009 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt @@ -6,5 +6,4 @@ import java.io.InputStream /** * Created by Allan Wang on 2017-08-04. */ -fun File.copyFromInputStream(inputStream: InputStream) - = inputStream.use { input -> outputStream().use { output -> input.copyTo(output) } }
\ No newline at end of file +fun File.copyFromInputStream(inputStream: InputStream) = inputStream.use { input -> outputStream().use { output -> input.copyTo(output) } }
\ No newline at end of file diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/FontUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/FontUtils.kt index 05073c7..1db7694 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/FontUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/FontUtils.kt @@ -17,7 +17,8 @@ object FontUtils { context.applicationContext.assets, "fonts/$font.ttf") sTypefaceCache.put(font, tf) } - return sTypefaceCache.get(font) ?: throw IllegalArgumentException("Font error; typeface does not exist at assets/fonts$font.ttf") + return sTypefaceCache.get(font) + ?: throw IllegalArgumentException("Font error; typeface does not exist at assets/fonts$font.ttf") } } diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/NotificationUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/NotificationUtils.kt index 23a8370..1eb0076 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/NotificationUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/NotificationUtils.kt @@ -7,5 +7,4 @@ import android.support.v4.app.NotificationManagerCompat /** * Created by Allan Wang on 2017-08-04. */ -fun Context.cancelNotification(notifId: Int) - = NotificationManagerCompat.from(this).cancel(notifId)
\ No newline at end of file +fun Context.cancelNotification(notifId: Int) = NotificationManagerCompat.from(this).cancel(notifId)
\ No newline at end of file diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt index 9a1e9b0..4e020bc 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt @@ -23,7 +23,6 @@ import android.view.ViewGroup import android.view.inputmethod.InputMethodManager import android.widget.EditText import android.widget.ImageView -import android.widget.TextView import ca.allanwang.kau.ui.createSimpleRippleDrawable import com.mikepenz.iconics.IconicsDrawable import com.mikepenz.iconics.typeface.IIcon @@ -33,34 +32,47 @@ import com.mikepenz.iconics.typeface.IIcon * Created by Allan Wang on 2017-05-31. */ -@KauUtils inline fun <T : View> T.visible(): T { +@KauUtils +inline fun <T : View> T.visible(): T { visibility = View.VISIBLE return this } -@KauUtils inline fun <T : View> T.invisible(): T { +@KauUtils +inline fun <T : View> T.invisible(): T { visibility = View.INVISIBLE return this } -@KauUtils inline fun <T : View> T.gone(): T { +@KauUtils +inline fun <T : View> T.gone(): T { visibility = View.GONE return this } -@KauUtils inline fun <T : View> T.invisibleIf(invisible: Boolean): T = if (invisible) invisible() else visible() +@KauUtils +inline fun <T : View> T.invisibleIf(invisible: Boolean): T = if (invisible) invisible() else visible() -@KauUtils inline fun <T : View> T.visibleIf(visible: Boolean): T = if (visible) visible() else gone() +@KauUtils +inline fun <T : View> T.visibleIf(visible: Boolean): T = if (visible) visible() else gone() -@KauUtils inline fun <T : View> T.goneIf(gone: Boolean): T = visibleIf(!gone) +@KauUtils +inline fun <T : View> T.goneIf(gone: Boolean): T = visibleIf(!gone) -@KauUtils inline val View.isVisible: Boolean get() = visibility == View.VISIBLE +@KauUtils +inline val View.isVisible: Boolean + get() = visibility == View.VISIBLE -@KauUtils inline val View.isInvisible: Boolean get() = visibility == View.INVISIBLE +@KauUtils +inline val View.isInvisible: Boolean + get() = visibility == View.INVISIBLE -@KauUtils inline val View.isGone: Boolean get() = visibility == View.GONE +@KauUtils +inline val View.isGone: Boolean + get() = visibility == View.GONE -@KauUtils inline fun View.setBackgroundColorRes(@ColorRes color: Int) = setBackgroundColor(context.color(color)) +@KauUtils +inline fun View.setBackgroundColorRes(@ColorRes color: Int) = setBackgroundColor(context.color(color)) fun View.snackbar(text: String, duration: Int = Snackbar.LENGTH_LONG, builder: Snackbar.() -> Unit = {}): Snackbar { val snackbar = Snackbar.make(this, text, duration) @@ -69,8 +81,7 @@ fun View.snackbar(text: String, duration: Int = Snackbar.LENGTH_LONG, builder: S return snackbar } -fun View.snackbar(@StringRes textId: Int, duration: Int = Snackbar.LENGTH_LONG, builder: Snackbar.() -> Unit = {}) - = snackbar(context.string(textId), duration, builder) +fun View.snackbar(@StringRes textId: Int, duration: Int = Snackbar.LENGTH_LONG, builder: Snackbar.() -> Unit = {}) = snackbar(context.string(textId), duration, builder) @KauUtils fun ImageView.setIcon(icon: IIcon?, sizeDp: Int = 24, @ColorInt color: Int = Color.WHITE, builder: IconicsDrawable.() -> Unit = {}) { @@ -78,7 +89,9 @@ fun ImageView.setIcon(icon: IIcon?, sizeDp: Int = 24, @ColorInt color: Int = Col setImageDrawable(icon.toDrawable(context, sizeDp = sizeDp, color = color, builder = builder)) } -@KauUtils inline val FloatingActionButton.isHidden get() = !isShown +@KauUtils +inline val FloatingActionButton.isHidden + get() = !isShown fun FloatingActionButton.showIf(show: Boolean) = if (show) show() else hide() @@ -133,7 +146,8 @@ fun View.setMargin(margin: Int) = setMargins(margin, KAU_ALL) * Base margin setter * returns true if setting is successful, false otherwise */ -@KauUtils private fun View.setMargins(margin: Int, flag: Int): Boolean { +@KauUtils +private fun View.setMargins(margin: Int, flag: Int): Boolean { val p = (layoutParams as? ViewGroup.MarginLayoutParams) ?: return false p.setMargins( if (flag and KAU_LEFT > 0) margin else p.leftMargin, @@ -189,7 +203,8 @@ fun View.setPadding(padding: Int) = setPadding(padding, KAU_ALL) /** * Base padding setter */ -@KauUtils private fun View.setPadding(padding: Int, flag: Int) { +@KauUtils +private fun View.setPadding(padding: Int, flag: Int) { setPadding( if (flag and KAU_LEFT > 0) padding else paddingLeft, if (flag and KAU_TOP > 0) padding else paddingTop, @@ -217,7 +232,9 @@ fun View.setRippleBackground(@ColorInt foregroundColor: Int, @ColorInt backgroun background = createSimpleRippleDrawable(foregroundColor, backgroundColor) } -@KauUtils inline val View.parentViewGroup: ViewGroup get() = parent as ViewGroup +@KauUtils +inline val View.parentViewGroup: ViewGroup + get() = parent as ViewGroup inline val EditText.value: String get() = text.toString().trim() |