Replace AboutLibraries activity with custom controller

This commit is contained in:
arkon
2021-08-07 11:32:44 -04:00
parent 9b00e91773
commit 1d10d29fa9
16 changed files with 193 additions and 17 deletions

View File

@@ -18,6 +18,7 @@ import android.net.ConnectivityManager
import android.net.Uri
import android.os.Build
import android.os.PowerManager
import android.util.TypedValue
import android.view.Display
import android.view.View
import android.view.WindowManager
@@ -140,6 +141,19 @@ fun Context.hasPermission(permission: String) = ContextCompat.checkSelfPermissio
return color
}
@ColorInt fun Context.getThemeColor(attr: Int): Int {
val tv = TypedValue()
return if (this.theme.resolveAttribute(attr, tv, true)) {
if (tv.resourceId != 0) {
ContextCompat.getColor(this, tv.resourceId)
} else {
tv.data
}
} else {
0
}
}
/**
* Converts to dp.
*/