Improve dashboard
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package io.nekohasekai.sfa.ktx
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.TypedValue
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.annotation.ColorInt
|
||||
@@ -15,3 +16,16 @@ fun Context.getAttrColor(
|
||||
theme.resolveAttribute(attrColor, typedValue, resolveRefs)
|
||||
return typedValue.data
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
fun colorForURLTestDelay(urlTestDelay: Int): Int {
|
||||
return if (urlTestDelay <= 0) {
|
||||
Color.GRAY
|
||||
} else if (urlTestDelay <= 800) {
|
||||
Color.GREEN
|
||||
} else if (urlTestDelay <= 1500) {
|
||||
Color.YELLOW
|
||||
} else {
|
||||
Color.RED
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user