|
|
@ -8,7 +8,6 @@ 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 |
|
|
|
import android.view.Window |
|
|
|
|
|
|
|
import android.widget.EdgeEffect |
|
|
|
import android.widget.EdgeEffect |
|
|
|
import android.widget.ScrollView |
|
|
|
import android.widget.ScrollView |
|
|
|
import androidx.annotation.ColorInt |
|
|
|
import androidx.annotation.ColorInt |
|
|
@ -16,7 +15,6 @@ import androidx.appcompat.app.AlertDialog |
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
import androidx.viewpager.widget.ViewPager |
|
|
|
import androidx.viewpager.widget.ViewPager |
|
|
|
import com.google.android.material.bottomnavigation.BottomNavigationView |
|
|
|
import com.google.android.material.bottomnavigation.BottomNavigationView |
|
|
|
import io.legado.app.App |
|
|
|
|
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.utils.getCompatColor |
|
|
|
import io.legado.app.utils.getCompatColor |
|
|
|
import io.legado.app.utils.isNightTheme |
|
|
|
import io.legado.app.utils.isNightTheme |
|
|
@ -38,36 +36,36 @@ object ATH { |
|
|
|
) > since |
|
|
|
) > since |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setStatusBarColorAuto(window: Window, fullScreen: Boolean) { |
|
|
|
fun setStatusBarColorAuto(activity: Activity, fullScreen: Boolean) { |
|
|
|
val isTransparentStatusBar = App.INSTANCE.isTransparentStatusBar |
|
|
|
val isTransparentStatusBar = activity.isTransparentStatusBar |
|
|
|
setStatusBarColor( |
|
|
|
setStatusBarColor( |
|
|
|
window, |
|
|
|
activity, |
|
|
|
ThemeStore.statusBarColor(App.INSTANCE, isTransparentStatusBar), |
|
|
|
ThemeStore.statusBarColor(activity, isTransparentStatusBar), |
|
|
|
isTransparentStatusBar, fullScreen |
|
|
|
isTransparentStatusBar, fullScreen |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setStatusBarColor( |
|
|
|
fun setStatusBarColor( |
|
|
|
window: Window, |
|
|
|
activity: Activity, |
|
|
|
color: Int, |
|
|
|
color: Int, |
|
|
|
isTransparentStatusBar: Boolean, |
|
|
|
isTransparentStatusBar: Boolean, |
|
|
|
fullScreen: Boolean |
|
|
|
fullScreen: Boolean |
|
|
|
) { |
|
|
|
) { |
|
|
|
if (fullScreen && isTransparentStatusBar) { |
|
|
|
if (fullScreen && isTransparentStatusBar) { |
|
|
|
window.statusBarColor = Color.TRANSPARENT |
|
|
|
activity.window.statusBarColor = Color.TRANSPARENT |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
window.statusBarColor = color |
|
|
|
activity.window.statusBarColor = color |
|
|
|
} |
|
|
|
} |
|
|
|
setLightStatusBarAuto(window, color) |
|
|
|
setLightStatusBarAuto(activity, color) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setLightStatusBarAuto(window: Window, bgColor: Int) { |
|
|
|
fun setLightStatusBarAuto(activity: Activity, bgColor: Int) { |
|
|
|
setLightStatusBar(window, ColorUtils.isColorLight(bgColor)) |
|
|
|
setLightStatusBar(activity, ColorUtils.isColorLight(bgColor)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setLightStatusBar(window: Window, enabled: Boolean) { |
|
|
|
fun setLightStatusBar(activity: Activity, enabled: Boolean) { |
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { |
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { |
|
|
|
val decorView = window.decorView |
|
|
|
val decorView = activity.window.decorView |
|
|
|
val systemUiVisibility = decorView.systemUiVisibility |
|
|
|
val systemUiVisibility = decorView.systemUiVisibility |
|
|
|
if (enabled) { |
|
|
|
if (enabled) { |
|
|
|
decorView.systemUiVisibility = |
|
|
|
decorView.systemUiVisibility = |
|
|
|