|
|
@ -4,6 +4,7 @@ import android.annotation.SuppressLint |
|
|
|
import android.app.Activity |
|
|
|
import android.app.Activity |
|
|
|
import android.app.ActivityManager |
|
|
|
import android.app.ActivityManager |
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
|
|
|
|
import android.graphics.Color |
|
|
|
import android.os.Build |
|
|
|
import android.os.Build |
|
|
|
import android.view.View |
|
|
|
import android.view.View |
|
|
|
import android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR |
|
|
|
import android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR |
|
|
@ -34,18 +35,27 @@ object ATH { |
|
|
|
) > since |
|
|
|
) > since |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setStatusbarColorAuto(activity: Activity) { |
|
|
|
fun setStatusbarColorAuto(activity: Activity, fullScreen: Boolean) { |
|
|
|
|
|
|
|
val isTransparentStatusBar = activity.isTransparentStatusBar |
|
|
|
setStatusbarColor( |
|
|
|
setStatusbarColor( |
|
|
|
activity, |
|
|
|
activity, |
|
|
|
ThemeStore.statusBarColor(activity, activity.isTransparentStatusBar) |
|
|
|
ThemeStore.statusBarColor(activity, isTransparentStatusBar), |
|
|
|
|
|
|
|
isTransparentStatusBar, fullScreen |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setStatusbarColor(activity: Activity, color: Int) { |
|
|
|
fun setStatusbarColor( |
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
|
|
|
activity: Activity, |
|
|
|
|
|
|
|
color: Int, |
|
|
|
|
|
|
|
isTransparentStatusBar: Boolean, |
|
|
|
|
|
|
|
fullScreen: Boolean |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
if (fullScreen && isTransparentStatusBar) { |
|
|
|
|
|
|
|
activity.window.statusBarColor = Color.TRANSPARENT |
|
|
|
|
|
|
|
} else { |
|
|
|
activity.window.statusBarColor = color |
|
|
|
activity.window.statusBarColor = color |
|
|
|
setLightStatusbarAuto(activity, color) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
setLightStatusbarAuto(activity, color) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setLightStatusbarAuto(activity: Activity, bgColor: Int) { |
|
|
|
fun setLightStatusbarAuto(activity: Activity, bgColor: Int) { |
|
|
@ -68,10 +78,10 @@ object ATH { |
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
|
|
|
val decorView = activity.window.decorView |
|
|
|
val decorView = activity.window.decorView |
|
|
|
var systemUiVisibility = decorView.systemUiVisibility |
|
|
|
var systemUiVisibility = decorView.systemUiVisibility |
|
|
|
if (enabled) { |
|
|
|
systemUiVisibility = if (enabled) { |
|
|
|
systemUiVisibility = systemUiVisibility or SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR |
|
|
|
systemUiVisibility or SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
systemUiVisibility = systemUiVisibility and SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR.inv() |
|
|
|
systemUiVisibility and SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR.inv() |
|
|
|
} |
|
|
|
} |
|
|
|
decorView.systemUiVisibility = systemUiVisibility |
|
|
|
decorView.systemUiVisibility = systemUiVisibility |
|
|
|
} |
|
|
|
} |
|
|
|