refactor
This commit is contained in:
parent
5feb228ddc
commit
d2348ac59a
|
@ -695,12 +695,8 @@ class App1 : Application() {
|
||||||
statusBarColor = c or Color.BLACK
|
statusBarColor = c or Color.BLACK
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT >= 23) {
|
if(Build.VERSION.SDK_INT >= 23) {
|
||||||
val min = rgbToLab(Color.BLACK)
|
|
||||||
val max = rgbToLab(Color.WHITE)
|
|
||||||
val current = rgbToLab(c)
|
|
||||||
|
|
||||||
decorView.systemUiVisibility =
|
decorView.systemUiVisibility =
|
||||||
if(current.first >= (min.first + max.first) / 2f) {
|
if( rgbToLab(c).first >= 50f) {
|
||||||
//Dark Text to show up on your light status bar
|
//Dark Text to show up on your light status bar
|
||||||
decorView.systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
decorView.systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||||
} else {
|
} else {
|
||||||
|
@ -713,11 +709,9 @@ class App1 : Application() {
|
||||||
if(c != 0) {
|
if(c != 0) {
|
||||||
navigationBarColor = c or Color.BLACK
|
navigationBarColor = c or Color.BLACK
|
||||||
|
|
||||||
if( Build.VERSION.SDK_INT >= 26){
|
if(Build.VERSION.SDK_INT >= 26) {
|
||||||
val current = rgbToLab(c)
|
|
||||||
|
|
||||||
decorView.systemUiVisibility =
|
decorView.systemUiVisibility =
|
||||||
if(current.first >= 50) {
|
if(rgbToLab(c).first >= 50f) {
|
||||||
//Dark Text to show up on your light status bar
|
//Dark Text to show up on your light status bar
|
||||||
decorView.systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
|
decorView.systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
|
||||||
} else {
|
} else {
|
||||||
|
@ -726,7 +720,6 @@ class App1 : Application() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // else: need restart app.
|
} // else: need restart app.
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue