aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/utils/Extensions.kt
blob: 7c2a28c3e9974f3c3b1612a173b1bc3c8adef64f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package com.zeapo.pwdstore.utils

import android.content.Context
import android.util.TypedValue

fun String.splitLines(): Array<String> {
    return split("\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
}

fun Context.resolveAttribute(attr: Int): Int {
    val typedValue = TypedValue()
    this.theme.resolveAttribute(attr, typedValue, true)
    return typedValue.data
}