From 3b1cbd2f2cf211b804784bef33de85b8a889677e Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Wed, 8 Nov 2017 22:15:03 -0500 Subject: Translations Italian (#98) * Add translations * Update dependencies * Show lint output * Fix type inference * Add annotation --- core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt') 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 = Array(2, { - val drawable = ContextCompat.getDrawable(context, mCursorDrawableRes) + val drawable = context.drawable(mCursorDrawableRes) drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN) drawable }) -- cgit v1.2.3