diff options
author | Allan Wang <me@allanwang.ca> | 2017-11-08 22:15:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-08 22:15:03 -0500 |
commit | 3b1cbd2f2cf211b804784bef33de85b8a889677e (patch) | |
tree | e11fa8cf0081c117ee3c60b419dd02473ef6dd8d /core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt | |
parent | a0587e8877f35ac2dc149a64e06665dff424b469 (diff) | |
download | kau-3b1cbd2f2cf211b804784bef33de85b8a889677e.tar.gz kau-3b1cbd2f2cf211b804784bef33de85b8a889677e.tar.bz2 kau-3b1cbd2f2cf211b804784bef33de85b8a889677e.zip |
Translations Italian (#98)
* Add translations
* Update dependencies
* Show lint output
* Fix type inference
* Add annotation
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt')
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt | 5 |
1 files changed, 3 insertions, 2 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 }) |