Bump dependencies, remove unused resources

This commit is contained in:
len
2016-09-29 19:53:59 +02:00
parent d352405ba6
commit 11ac4df5d7
8 changed files with 31 additions and 30 deletions

View File

@@ -2,18 +2,26 @@ package eu.kanade.tachiyomi.util
import android.content.res.Resources
import android.graphics.drawable.Drawable
import android.support.annotation.AttrRes
import android.support.annotation.StringRes
fun Resources.Theme.getResourceColor(@StringRes resource: Int) : Int {
val typedArray = this.obtainStyledAttributes(intArrayOf(resource))
fun Resources.Theme.getResourceColor(@StringRes resource: Int): Int {
val typedArray = obtainStyledAttributes(intArrayOf(resource))
val attrValue = typedArray.getColor(0, 0)
typedArray.recycle()
return attrValue
}
fun Resources.Theme.getResourceDrawable(@StringRes resource: Int) : Drawable {
val typedArray = this.obtainStyledAttributes(intArrayOf(resource))
fun Resources.Theme.getResourceDrawable(@StringRes resource: Int): Drawable {
val typedArray = obtainStyledAttributes(intArrayOf(resource))
val attrValue = typedArray.getDrawable(0)
typedArray.recycle()
return attrValue
}
fun Resources.Theme.getResourceId(@AttrRes resource: Int, fallback: Int): Int {
val typedArray = obtainStyledAttributes(intArrayOf(resource))
val attrValue = typedArray.getResourceId(0, fallback)
typedArray.recycle()
return attrValue
}