Support showing supported channels
This commit is contained in:
@@ -7,7 +7,7 @@ import be.mygod.vpnhotspot.App.Companion.app
|
||||
import be.mygod.vpnhotspot.R
|
||||
import timber.log.Timber
|
||||
|
||||
class ConstantLookup(private val prefix: String, private val lookup29: Array<out String>,
|
||||
class ConstantLookup(private val prefix: String, private val lookup29: Array<out String?>,
|
||||
private val clazz: () -> Class<*>) {
|
||||
private val lookup by lazy {
|
||||
SparseArrayCompat<String>().apply {
|
||||
@@ -25,16 +25,16 @@ class ConstantLookup(private val prefix: String, private val lookup29: Array<out
|
||||
} catch (e: ReflectiveOperationException) {
|
||||
Timber.w(e)
|
||||
}
|
||||
return lookup29.getOrNull(reason)?.let { if (trimPrefix) it.substring(prefix.length) else it }
|
||||
return lookup29.getOrNull(reason)?.let { if (trimPrefix) it else prefix + it }
|
||||
?: app.getString(R.string.failure_reason_unknown, reason)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("FunctionName")
|
||||
fun ConstantLookup(prefix: String, vararg lookup29: String, clazz: () -> Class<*>) =
|
||||
fun ConstantLookup(prefix: String, vararg lookup29: String?, clazz: () -> Class<*>) =
|
||||
ConstantLookup(prefix, lookup29, clazz)
|
||||
@Suppress("FunctionName")
|
||||
inline fun <reified T> ConstantLookup(prefix: String, vararg lookup29: String) =
|
||||
inline fun <reified T> ConstantLookup(prefix: String, vararg lookup29: String?) =
|
||||
ConstantLookup(prefix, lookup29) { T::class.java }
|
||||
|
||||
class LongConstantLookup(private val clazz: Class<*>, private val prefix: String) {
|
||||
|
||||
Reference in New Issue
Block a user