Improve dashboard

This commit is contained in:
世界
2023-08-04 21:04:45 +08:00
parent 3ccf4d6def
commit dd9db2599b
13 changed files with 1283 additions and 624 deletions

View File

@@ -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
}
}