aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt5
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt2
-rw-r--r--core/src/main/res-public/values-it/strings_commons.xml71
3 files changed, 75 insertions, 3 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 8537185..16d1d01 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
@@ -1,5 +1,6 @@
package ca.allanwang.kau.utils
+import android.annotation.SuppressLint
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
@@ -9,7 +10,6 @@ import android.os.Build
import android.support.annotation.ColorInt
import android.support.annotation.FloatRange
import android.support.annotation.IntRange
-import android.support.v4.content.ContextCompat
import android.support.v4.graphics.drawable.DrawableCompat
import android.support.v7.widget.AppCompatEditText
import android.support.v7.widget.Toolbar
@@ -225,6 +225,7 @@ fun Context.textColorStateList(@ColorInt color: Int): ColorStateList {
return ColorStateList(states, colors)
}
+@SuppressLint("RestrictedApi")
fun EditText.tint(@ColorInt color: Int) {
val editTextColorStateList = context.textColorStateList(color)
if (this is AppCompatEditText) {
@@ -247,7 +248,7 @@ fun EditText.tintCursor(@ColorInt color: Int) {
val fCursorDrawable = clazz.getDeclaredField("mCursorDrawable")
fCursorDrawable.isAccessible = true
val drawables: Array<Drawable> = Array(2, {
- val drawable = ContextCompat.getDrawable(context, mCursorDrawableRes)
+ val drawable = context.drawable(mCursorDrawableRes)
drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN)
drawable
})
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
index 0664dc6..545a3f0 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
@@ -121,7 +121,7 @@ inline fun Context.color(@ColorRes id: Int): Int = ContextCompat.getColor(this,
inline fun Context.integer(@IntegerRes id: Int): Int = resources.getInteger(id)
inline fun Context.dimen(@DimenRes id: Int): Float = resources.getDimension(id)
inline fun Context.dimenPixelSize(@DimenRes id: Int): Int = resources.getDimensionPixelSize(id)
-inline fun Context.drawable(@DrawableRes id: Int): Drawable = ContextCompat.getDrawable(this, id)
+inline fun Context.drawable(@DrawableRes id: Int): Drawable = ContextCompat.getDrawable(this, id) ?: throw KauException("Drawable with id $id not found")
inline fun Context.drawable(@DrawableRes id: Int, fallback: Drawable?): Drawable? = if (id > 0) drawable(id) else fallback
inline fun Context.interpolator(@InterpolatorRes id: Int) = AnimationUtils.loadInterpolator(this, id)
inline fun Context.animation(@AnimRes id: Int) = AnimationUtils.loadAnimation(this, id)
diff --git a/core/src/main/res-public/values-it/strings_commons.xml b/core/src/main/res-public/values-it/strings_commons.xml
new file mode 100644
index 0000000..054fcf9
--- /dev/null
+++ b/core/src/main/res-public/values-it/strings_commons.xml
@@ -0,0 +1,71 @@
+<?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">Info sull\'app</string>
+ <string name="kau_about_x">Informazioni su %s</string>
+ <string name="kau_add_account">Aggiungi Account</string>
+ <string name="kau_back">Indietro</string>
+ <string name="kau_cancel">Annulla</string>
+ <string name="kau_changelog">Novità</string>
+ <string name="kau_close">Chiudi</string>
+ <string name="kau_contact_us">Contattaci</string>
+ <string name="kau_copy">Copia</string>
+ <string name="kau_custom">Personalizzato</string>
+ <string name="kau_dark">Scuro</string>
+ <string name="kau_default">Predefinito</string>
+ <string name="kau_do_not_show_again">Non mostrare più</string>
+ <string name="kau_done">Fatto</string>
+ <string name="kau_error">Errore</string>
+ <string name="kau_exit">Esci</string>
+ <string name="kau_exit_confirmation">Confermi di voler uscire?</string>
+ <string name="kau_exit_confirmation_x">Confermi di voler uscire da %s?</string>
+ <string name="kau_glass">Vetro</string>
+ <string name="kau_got_it">Tutto chiaro</string>
+ <string name="kau_great">Ottimo</string>
+ <string name="kau_hide">Nascondi</string>
+ <string name="kau_light">Chiaro</string>
+ <string name="kau_login">Accedi</string>
+ <string name="kau_logout">Disconnetti</string>
+ <string name="kau_logout_confirm_as_x">Confermi di voler disconnettere %s?</string>
+ <string name="kau_manage_account">Gestisci Account</string>
+ <string name="kau_maybe">Forse</string>
+ <string name="kau_menu">Menu</string>
+ <string name="kau_no">No</string>
+ <string name="kau_no_results_found">Nessun risultato trovato</string>
+ <string name="kau_none">Nulla</string>
+ <string name="kau_ok">OK</string>
+ <string name="kau_play_store">Play Store</string>
+ <string name="kau_rate">Recensisci</string>
+ <string name="kau_report_bug">Segnala un malfunzionamento</string>
+ <string name="kau_search">Cerca</string>
+ <string name="kau_send_feedback">Invia feedback</string>
+ <string name="kau_send_via">Invia tramite</string>
+ <string name="kau_settings">Impostazioni</string>
+ <string name="kau_share">Condividi</string>
+ <string name="kau_text_copied">Testo copiato negli appunti.</string>
+ <string name="kau_thank_you">Grazie</string>
+ <string name="kau_uh_oh">Uh Oh</string>
+ <string name="kau_warning">Attenzione</string>
+ <plurals name="kau_x_days">
+ <item quantity="one">%d giorno</item>
+ <item quantity="other">%d giorni</item>
+ </plurals>
+ <plurals name="kau_x_hours">
+ <item quantity="one">%d ora</item>
+ <item quantity="other">%d ore</item>
+ </plurals>
+ <plurals name="kau_x_minutes">
+ <item quantity="one">%d minuto</item>
+ <item quantity="other">%d minuti</item>
+ </plurals>
+ <plurals name="kau_x_seconds">
+ <item quantity="one">%d secondo</item>
+ <item quantity="other">%d secondi</item>
+ </plurals>
+ <string name="kau_yes">Sì</string>
+ <string name="kau_permission_denied">Permesso negato</string>
+</resources>