mirror of https://github.com/tasks/tasks
Add ResourcesExtensions
parent
8278058fa6
commit
9358dfaca5
@ -0,0 +1,16 @@
|
||||
package org.tasks.extensions
|
||||
|
||||
import android.content.res.Resources
|
||||
|
||||
fun Resources.getMutableStringList(id: Int): MutableList<String> =
|
||||
getStringArray(id).toMutableList()
|
||||
|
||||
fun Resources.getMutableIntList(id: Int): MutableList<Int> {
|
||||
val typedArray = obtainTypedArray(id)
|
||||
val result = IntArray(typedArray.length())
|
||||
for (i in result.indices) {
|
||||
result[i] = typedArray.getResourceId(i, 0)
|
||||
}
|
||||
typedArray.recycle()
|
||||
return result.toMutableList()
|
||||
}
|
||||
Loading…
Reference in New Issue