Merge branch 'dev' of https://github.com/rebelonion/Dantotsu into dev
This commit is contained in:
commit
4838e69aea
4 changed files with 15 additions and 7 deletions
|
@ -167,6 +167,7 @@ fun initActivity(a: Activity) {
|
||||||
navBarHeight = insets.bottom
|
navBarHeight = insets.bottom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (a !is MainActivity) a.setNavigationTheme()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Activity.hideSystemBars() {
|
fun Activity.hideSystemBars() {
|
||||||
|
@ -178,11 +179,11 @@ fun Activity.hideSystemBars() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Activity.setNavigationTheme() {
|
fun Activity.setNavigationTheme() {
|
||||||
val a = TypedValue()
|
val tv = TypedValue()
|
||||||
theme.resolveAttribute(android.R.attr.colorBackground, a, true)
|
theme.resolveAttribute(android.R.attr.colorBackground, tv, true)
|
||||||
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && a.isColorType)
|
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && tv.isColorType)
|
||||||
|| (a.type >= TypedValue.TYPE_FIRST_COLOR_INT && a.type <= TypedValue.TYPE_LAST_COLOR_INT)) {
|
|| (tv.type >= TypedValue.TYPE_FIRST_COLOR_INT && tv.type <= TypedValue.TYPE_LAST_COLOR_INT)) {
|
||||||
window.navigationBarColor = a.data
|
window.navigationBarColor = tv.data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -559,6 +559,8 @@ class AnimeWatchFragment : Fragment() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
binding.mediaInfoProgressBar.visibility = progress
|
binding.mediaInfoProgressBar.visibility = progress
|
||||||
binding.animeSourceRecycler.layoutManager?.onRestoreInstanceState(state)
|
binding.animeSourceRecycler.layoutManager?.onRestoreInstanceState(state)
|
||||||
|
|
||||||
|
requireActivity().setNavigationTheme()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
|
|
@ -601,6 +601,7 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
binding.mediaInfoProgressBar.visibility = progress
|
binding.mediaInfoProgressBar.visibility = progress
|
||||||
binding.animeSourceRecycler.layoutManager?.onRestoreInstanceState(state)
|
binding.animeSourceRecycler.layoutManager?.onRestoreInstanceState(state)
|
||||||
|
|
||||||
requireActivity().setNavigationTheme()
|
requireActivity().setNavigationTheme()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
|
import android.os.Build
|
||||||
import android.view.Window
|
import android.view.Window
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import ani.dantotsu.R
|
import ani.dantotsu.R
|
||||||
|
@ -54,7 +55,10 @@ class ThemeManager(private val context: Activity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
val window = context.window
|
val window = context.window
|
||||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
|
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
||||||
|
}
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||||
window.statusBarColor = 0x00000000
|
window.statusBarColor = 0x00000000
|
||||||
context.setTheme(themeToApply)
|
context.setTheme(themeToApply)
|
||||||
|
@ -137,7 +141,7 @@ class ThemeManager(private val context: Activity) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun fromString(value: String): Theme {
|
fun fromString(value: String): Theme {
|
||||||
return values().find { it.theme == value } ?: PURPLE
|
return entries.find { it.theme == value } ?: PURPLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue