mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-25 05:51:02 +00:00
feat: match theme color with navbar
This commit is contained in:
@@ -184,6 +184,15 @@ fun Activity.hideSystemBars() {
|
||||
}
|
||||
}
|
||||
|
||||
fun Activity.setNavigationTheme() {
|
||||
val a = TypedValue()
|
||||
theme.resolveAttribute(android.R.attr.colorBackground, a, true)
|
||||
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && a.isColorType)
|
||||
|| (a.type >= TypedValue.TYPE_FIRST_COLOR_INT && a.type <= TypedValue.TYPE_LAST_COLOR_INT)) {
|
||||
window.navigationBarColor = a.data
|
||||
}
|
||||
}
|
||||
|
||||
open class BottomSheetDialogFragment : BottomSheetDialogFragment() {
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
|
||||
@@ -357,6 +357,11 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
window.navigationBarColor = getColor(android.R.color.transparent)
|
||||
}
|
||||
|
||||
//ViewPager
|
||||
private class ViewPagerAdapter(fragmentManager: FragmentManager, lifecycle: Lifecycle) :
|
||||
FragmentStateAdapter(fragmentManager, lifecycle) {
|
||||
|
||||
@@ -601,6 +601,7 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
||||
super.onResume()
|
||||
binding.mediaInfoProgressBar.visibility = progress
|
||||
binding.animeSourceRecycler.layoutManager?.onRestoreInstanceState(state)
|
||||
requireActivity().setNavigationTheme()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<style name="Theme.Base" parent="Theme.Material3.DayNight">
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:navigationBarColor">?android:colorBackground</item>
|
||||
<item name="android:windowTranslucentStatus">false</item>
|
||||
<item name="android:windowTranslucentNavigation">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="elevationOverlayEnabled">false</item>
|
||||
<item name="windowActionBar">false</item>
|
||||
|
||||
Reference in New Issue
Block a user