mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 21:59:15 +01:00
Restore transparent status bars, allow WebView app bar to scroll away
This commit is contained in:
parent
81418a7712
commit
57595988f5
@ -14,6 +14,7 @@ import eu.kanade.tachiyomi.source.SourceManager
|
|||||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
import eu.kanade.tachiyomi.ui.base.activity.BaseActivity
|
import eu.kanade.tachiyomi.ui.base.activity.BaseActivity
|
||||||
import eu.kanade.tachiyomi.util.WebViewClientCompat
|
import eu.kanade.tachiyomi.util.WebViewClientCompat
|
||||||
|
import eu.kanade.tachiyomi.util.getResourceColor
|
||||||
import kotlinx.android.synthetic.main.webview_activity.toolbar
|
import kotlinx.android.synthetic.main.webview_activity.toolbar
|
||||||
import kotlinx.android.synthetic.main.webview_activity.webview
|
import kotlinx.android.synthetic.main.webview_activity.webview
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
@ -29,6 +30,10 @@ class WebViewActivity : BaseActivity() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.webview_activity)
|
setContentView(R.layout.webview_activity)
|
||||||
|
|
||||||
|
// Manually override status bar color since it's normally transparent with the app themes
|
||||||
|
// This is needed to hide the app bar when it scrolls up
|
||||||
|
window.statusBarColor = getResourceColor(R.attr.colorPrimaryDark)
|
||||||
|
|
||||||
title = intent.extras?.getString(TITLE_KEY)
|
title = intent.extras?.getString(TITLE_KEY)
|
||||||
setSupportActionBar(toolbar)
|
setSupportActionBar(toolbar)
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -17,13 +17,21 @@
|
|||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
android:theme="?attr/actionBarTheme"
|
android:theme="?attr/actionBarTheme"
|
||||||
app:navigationIcon="@drawable/ic_close_white_24dp" />
|
app:navigationIcon="@drawable/ic_close_white_24dp"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways|snap" />
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<WebView
|
<androidx.core.widget.NestedScrollView
|
||||||
android:id="@+id/webview"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
</LinearLayout>
|
<WebView
|
||||||
|
android:id="@+id/webview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
<!--===========-->
|
<!--===========-->
|
||||||
<style name="Theme.Tachiyomi" parent="Theme.Base">
|
<style name="Theme.Tachiyomi" parent="Theme.Base">
|
||||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||||
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
|
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@ -67,7 +67,7 @@
|
|||||||
<item name="android:listDivider">@drawable/line_divider_dark</item>
|
<item name="android:listDivider">@drawable/line_divider_dark</item>
|
||||||
|
|
||||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||||
<item name="android:statusBarColor">@color/colorDarkPrimaryDark</item>
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
<item name="android:navigationBarColor">@color/colorDarkPrimaryDark</item>
|
<item name="android:navigationBarColor">@color/colorDarkPrimaryDark</item>
|
||||||
|
|
||||||
<!-- Themes -->
|
<!-- Themes -->
|
||||||
@ -97,7 +97,7 @@
|
|||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
|
||||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||||
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
<item name="android:navigationBarColor">@color/colorDarkPrimaryDark</item>
|
<item name="android:navigationBarColor">@color/colorDarkPrimaryDark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user