diff --git a/app/build.gradle b/app/build.gradle
index 6334c6ea8e..0ac69bb79d 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -124,7 +124,7 @@ dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
- standardImplementation 'com.google.firebase:firebase-core:11.8.0'
+ standardImplementation 'com.google.firebase:firebase-core:17.2.1'
// ReactiveX
implementation 'io.reactivex:rxandroid:1.2.1'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index b6b6e2b5ef..3861b81dac 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -47,6 +47,9 @@
+
0
|| v.rootWindowInsets.systemWindowInsetRight > 0) {
- v.context.getResourceColor(android.R.attr.colorBackground)
+ getResourceColor(android.R.attr.colorBackground)
}
// if in portrait with 2/3 button mode, translucent nav bar
else {
ColorUtils.setAlphaComponent(
- v.context.getResourceColor(android.R.attr.colorBackground), 179)
+ getResourceColor(android.R.attr.colorBackground), 179)
}
v.setPadding(insets.systemWindowInsetLeft, insets.systemWindowInsetTop,
insets.systemWindowInsetRight, 0)
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt
index 0d2cb9ec15..ee1cb9b8a6 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt
@@ -335,8 +335,9 @@ class MangaInfoController : NucleusController(),
return
}
- parentController?.router?.pushController(MangaWebViewController(source.id, url)
- .withFadeTransaction())
+ val activity = activity ?: return
+ val intent = WebViewActivity.newIntent(activity, source.id, url, presenter.manga.title)
+ startActivity(intent)
}
/**
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaWebViewController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaWebViewController.kt
deleted file mode 100644
index b119c3a56b..0000000000
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaWebViewController.kt
+++ /dev/null
@@ -1,72 +0,0 @@
-package eu.kanade.tachiyomi.ui.manga.info
-
-import android.os.Build
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.webkit.WebView
-import eu.kanade.tachiyomi.R
-import eu.kanade.tachiyomi.source.SourceManager
-import eu.kanade.tachiyomi.source.online.HttpSource
-import eu.kanade.tachiyomi.ui.base.controller.BaseController
-import eu.kanade.tachiyomi.util.RecyclerWindowInsetsListener
-import eu.kanade.tachiyomi.util.WebViewClientCompat
-import eu.kanade.tachiyomi.util.doOnApplyWindowInsets
-import eu.kanade.tachiyomi.util.marginBottom
-import eu.kanade.tachiyomi.util.updateLayoutParams
-import uy.kohesive.injekt.injectLazy
-
-class MangaWebViewController(bundle: Bundle? = null) : BaseController(bundle) {
-
- private val sourceManager by injectLazy()
-
- constructor(sourceId: Long, url: String) : this(Bundle().apply {
- putLong(SOURCE_KEY, sourceId)
- putString(URL_KEY, url)
- })
-
- override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
- return WebView(applicationContext)// inflater.inflate(R.layout.manga_info_web_controller, container,
- // false)
- }
-
- override fun onViewCreated(view: View) {
- super.onViewCreated(view)
- val source = sourceManager.get(args.getLong(SOURCE_KEY)) as? HttpSource ?: return
- val url = args.getString(URL_KEY) ?: return
- val headers = source.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }
-
- val web = view as WebView
- web.webViewClient = object : WebViewClientCompat() {
- override fun shouldOverrideUrlCompat(view: WebView, url: String): Boolean {
- view.loadUrl(url)
- return true
- }
- }
- val marginB = view.marginBottom
- view.doOnApplyWindowInsets{ v, insets, _ ->
- val bottomInset = if (Build.VERSION.SDK_INT >= 29) insets.tappableElementInsets.bottom
- else insets.systemWindowInsetBottom
- v.updateLayoutParams {
- bottomMargin = marginB + bottomInset
- }
- }
- web.settings.javaScriptEnabled = true
- web.settings.userAgentString = source.headers["User-Agent"]
- web.loadUrl(url, headers)
- }
-
- override fun onDestroyView(view: View) {
- val web = view as WebView
- web.stopLoading()
- web.destroy()
- super.onDestroyView(view)
- }
-
- private companion object {
- const val SOURCE_KEY = "source_key"
- const val URL_KEY = "url_key"
- }
-
-}
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/WebViewActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/WebViewActivity.kt
new file mode 100644
index 0000000000..0d70817881
--- /dev/null
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/WebViewActivity.kt
@@ -0,0 +1,216 @@
+package eu.kanade.tachiyomi.ui.manga.info
+
+import android.content.Context
+import android.content.Intent
+import android.content.res.Configuration
+import android.graphics.Bitmap
+import android.graphics.Color
+import android.os.Build
+import android.os.Bundle
+import android.view.Menu
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
+import android.webkit.WebView
+import android.widget.LinearLayout
+import androidx.core.graphics.ColorUtils
+import eu.kanade.tachiyomi.R
+import eu.kanade.tachiyomi.data.preference.PreferencesHelper
+import eu.kanade.tachiyomi.source.SourceManager
+import eu.kanade.tachiyomi.source.online.HttpSource
+import eu.kanade.tachiyomi.ui.base.activity.BaseActivity
+import eu.kanade.tachiyomi.util.WebViewClientCompat
+import eu.kanade.tachiyomi.util.doOnApplyWindowInsets
+import eu.kanade.tachiyomi.util.getResourceColor
+import eu.kanade.tachiyomi.util.marginBottom
+import eu.kanade.tachiyomi.util.updateLayoutParams
+import eu.kanade.tachiyomi.util.updatePadding
+import kotlinx.android.synthetic.main.webview_activity.*
+import uy.kohesive.injekt.injectLazy
+
+class WebViewActivity : BaseActivity() {
+
+ private val sourceManager by injectLazy()
+ private var bundle:Bundle? = null
+ val preferences: PreferencesHelper by injectLazy()
+
+ companion object {
+ const val SOURCE_KEY = "source_key"
+ const val URL_KEY = "url_key"
+ const val TITLE_KEY = "title_key"
+
+ fun newIntent(context: Context, sourceId: Long, url: String, title:String?): Intent {
+ val intent = Intent(context, WebViewActivity::class.java)
+ intent.putExtra(SOURCE_KEY, sourceId)
+ intent.putExtra(URL_KEY, url)
+ intent.putExtra(TITLE_KEY, title)
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
+ return intent
+ }
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ setTheme(when (preferences.theme()) {
+ 3, 6 -> R.style.Theme_Tachiyomi_Amoled
+ 4, 7 -> R.style.Theme_Tachiyomi_DarkBlue
+ else -> R.style.Theme_Tachiyomi
+ })
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.webview_activity)
+ title = intent.extras?.getString(TITLE_KEY)
+ setSupportActionBar(toolbar)
+ supportActionBar?.setDisplayHomeAsUpEnabled(true)
+ toolbar.setNavigationOnClickListener {
+ super.onBackPressed()
+ }
+
+ val container:ViewGroup = findViewById(R.id.web_view_layout)
+ val content: LinearLayout = findViewById(R.id.web_linear_layout)
+ container.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
+ View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
+ View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ content.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
+ View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
+ View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+
+ container.setOnApplyWindowInsetsListener { v, insets ->
+ val contextView = window?.decorView?.findViewById(R.id.action_mode_bar)
+ contextView?.updateLayoutParams {
+ leftMargin = insets.systemWindowInsetLeft
+ rightMargin = insets.systemWindowInsetRight
+ }
+ // Consume any horizontal insets and pad all content in. There's not much we can do
+ // with horizontal insets
+ v.updatePadding(
+ left = insets.systemWindowInsetLeft,
+ right = insets.systemWindowInsetRight
+ )
+ insets.replaceSystemWindowInsets(
+ 0, insets.systemWindowInsetTop,
+ 0, insets.systemWindowInsetBottom
+ )
+ }
+ window.statusBarColor = getResourceColor(R.attr.colorPrimary)
+
+ content.setOnApplyWindowInsetsListener { v, insets ->
+ window.navigationBarColor =
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+ v.context.getResourceColor(android.R.attr.colorPrimary)
+ }
+ // if the android q+ device has gesture nav, transparent nav bar
+ else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
+ && (v.rootWindowInsets.systemWindowInsetBottom != v.rootWindowInsets
+ .tappableElementInsets.bottom)) {
+ getColor(android.R.color.transparent)
+ } else {
+ v.context.getResourceColor(android.R.attr.colorBackground)
+ }
+ v.setPadding(insets.systemWindowInsetLeft, insets.systemWindowInsetTop,
+ insets.systemWindowInsetRight, 0)
+ insets
+ }
+ val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
+ if (Build.VERSION.SDK_INT >= 26 && currentNightMode == Configuration.UI_MODE_NIGHT_NO) {
+ content.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
+ }
+
+ if (bundle == null) {
+ val source = sourceManager.get(intent.extras!!.getLong(SOURCE_KEY)) as? HttpSource ?: return
+ val url = intent.extras!!.getString(URL_KEY) ?: return
+ val headers = source.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }
+ webview.webViewClient = object : WebViewClientCompat() {
+ override fun shouldOverrideUrlCompat(view: WebView, url: String): Boolean {
+ view.loadUrl(url)
+ return true
+ }
+
+ override fun onPageFinished(view: WebView?, url: String?) {
+ super.onPageFinished(view, url)
+ invalidateOptionsMenu()
+ title = view?.title
+ }
+
+ override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
+ super.onPageStarted(view, url, favicon)
+ invalidateOptionsMenu()
+ }
+ }
+ val marginB = webview.marginBottom
+ webview.doOnApplyWindowInsets { v, insets, _ ->
+ val bottomInset =
+ if (Build.VERSION.SDK_INT >= 29) insets.tappableElementInsets.bottom
+ else insets.systemWindowInsetBottom
+ v.updateLayoutParams {
+ bottomMargin = marginB + bottomInset
+ }
+ }
+ webview.settings.javaScriptEnabled = true
+ webview.settings.userAgentString = source.headers["User-Agent"]
+ webview.loadUrl(url, headers)
+ }
+ else {
+ webview.restoreState(bundle)
+ }
+ }
+
+ override fun onConfigurationChanged(newConfig: Configuration) {
+ super.onConfigurationChanged(newConfig)
+ window.statusBarColor = getResourceColor(R.attr.colorPrimary)
+ toolbar.setBackgroundColor(getResourceColor(R.attr.colorPrimary))
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
+ window.navigationBarColor = getResourceColor(android.R.attr.colorPrimary)
+ else if (window.navigationBarColor != getColor(android.R.color.transparent))
+ window.navigationBarColor = getResourceColor(android.R.attr.colorBackground)
+
+ val currentNightMode = newConfig.uiMode and Configuration.UI_MODE_NIGHT_MASK
+ if (Build.VERSION.SDK_INT >= 26) {
+ if (currentNightMode == Configuration.UI_MODE_NIGHT_NO) {
+ web_linear_layout.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
+ } else {
+ web_linear_layout.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
+ View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
+ View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ }
+ }
+ }
+
+ /**
+ * Called when the options menu of the toolbar is being created. It adds our custom menu.
+ */
+ override fun onCreateOptionsMenu(menu: Menu): Boolean {
+ menuInflater.inflate(R.menu.webview, menu)
+ return true
+ }
+
+ override fun onPrepareOptionsMenu(menu: Menu?): Boolean {
+ val backItem = toolbar.menu.findItem(R.id.action_web_back)
+ val forwardItem = toolbar.menu.findItem(R.id.action_web_forward)
+ backItem?.isEnabled = webview.canGoBack()
+ forwardItem?.isEnabled = webview.canGoForward()
+ val hasHistory = webview.canGoBack() || webview.canGoForward()
+ backItem?.isVisible = hasHistory
+ forwardItem?.isVisible = hasHistory
+ val translucentWhite = ColorUtils.setAlphaComponent(Color.WHITE, 127)
+ backItem.icon?.setTint(if (webview.canGoBack()) Color.WHITE else translucentWhite)
+ forwardItem?.icon?.setTint(if (webview.canGoForward()) Color.WHITE else translucentWhite)
+ return super.onPrepareOptionsMenu(menu)
+ }
+
+ override fun onBackPressed() {
+ if (webview.canGoBack()) webview.goBack()
+ else super.onBackPressed()
+ }
+
+ /**
+ * Called when an item of the options menu was clicked. Used to handle clicks on our menu
+ * entries.
+ */
+ override fun onOptionsItemSelected(item: MenuItem): Boolean {
+ when (item.itemId) {
+ R.id.action_web_back -> webview.goBack()
+ R.id.action_web_forward -> webview.goForward()
+ else -> return super.onOptionsItemSelected(item)
+ }
+ return true
+ }
+}
diff --git a/app/src/main/res/drawable-hdpi/baseline_arrow_back_white_24.png b/app/src/main/res/drawable-hdpi/baseline_arrow_back_white_24.png
new file mode 100644
index 0000000000..b3feb38665
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_arrow_back_white_24.png differ
diff --git a/app/src/main/res/drawable-hdpi/baseline_arrow_forward_white_24.png b/app/src/main/res/drawable-hdpi/baseline_arrow_forward_white_24.png
new file mode 100644
index 0000000000..b640301772
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_arrow_forward_white_24.png differ
diff --git a/app/src/main/res/drawable-hdpi/baseline_close_white_24.png b/app/src/main/res/drawable-hdpi/baseline_close_white_24.png
new file mode 100644
index 0000000000..c8598b6133
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_close_white_24.png differ
diff --git a/app/src/main/res/drawable-mdpi/baseline_arrow_back_white_24.png b/app/src/main/res/drawable-mdpi/baseline_arrow_back_white_24.png
new file mode 100644
index 0000000000..854124ef7e
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_arrow_back_white_24.png differ
diff --git a/app/src/main/res/drawable-mdpi/baseline_arrow_forward_white_24.png b/app/src/main/res/drawable-mdpi/baseline_arrow_forward_white_24.png
new file mode 100644
index 0000000000..01d3c16238
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_arrow_forward_white_24.png differ
diff --git a/app/src/main/res/drawable-mdpi/baseline_close_white_24.png b/app/src/main/res/drawable-mdpi/baseline_close_white_24.png
new file mode 100644
index 0000000000..08d8109923
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_close_white_24.png differ
diff --git a/app/src/main/res/drawable-xhdpi/baseline_arrow_back_white_24.png b/app/src/main/res/drawable-xhdpi/baseline_arrow_back_white_24.png
new file mode 100644
index 0000000000..04b039174c
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_arrow_back_white_24.png differ
diff --git a/app/src/main/res/drawable-xhdpi/baseline_arrow_forward_white_24.png b/app/src/main/res/drawable-xhdpi/baseline_arrow_forward_white_24.png
new file mode 100644
index 0000000000..57359a1e33
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_arrow_forward_white_24.png differ
diff --git a/app/src/main/res/drawable-xhdpi/baseline_close_white_24.png b/app/src/main/res/drawable-xhdpi/baseline_close_white_24.png
new file mode 100644
index 0000000000..4419c31ab3
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_close_white_24.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/baseline_arrow_back_white_24.png b/app/src/main/res/drawable-xxhdpi/baseline_arrow_back_white_24.png
new file mode 100644
index 0000000000..a40bc710b3
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_arrow_back_white_24.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/baseline_arrow_forward_white_24.png b/app/src/main/res/drawable-xxhdpi/baseline_arrow_forward_white_24.png
new file mode 100644
index 0000000000..b9d2f3c7c7
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_arrow_forward_white_24.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/baseline_close_white_24.png b/app/src/main/res/drawable-xxhdpi/baseline_close_white_24.png
new file mode 100644
index 0000000000..3af97b1df7
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_close_white_24.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_arrow_back_white_24.png b/app/src/main/res/drawable-xxxhdpi/baseline_arrow_back_white_24.png
new file mode 100644
index 0000000000..fdabf3f879
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_arrow_back_white_24.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_arrow_forward_white_24.png b/app/src/main/res/drawable-xxxhdpi/baseline_arrow_forward_white_24.png
new file mode 100644
index 0000000000..bbdf2117b2
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_arrow_forward_white_24.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_close_white_24.png b/app/src/main/res/drawable-xxxhdpi/baseline_close_white_24.png
new file mode 100644
index 0000000000..f5a903fd73
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_close_white_24.png differ
diff --git a/app/src/main/res/drawable/baseline_arrow_back_24.xml b/app/src/main/res/drawable/baseline_arrow_back_24.xml
new file mode 100644
index 0000000000..2989fdadae
--- /dev/null
+++ b/app/src/main/res/drawable/baseline_arrow_back_24.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/baseline_arrow_forward_24.xml b/app/src/main/res/drawable/baseline_arrow_forward_24.xml
new file mode 100644
index 0000000000..32393b8445
--- /dev/null
+++ b/app/src/main/res/drawable/baseline_arrow_forward_24.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/baseline_close_24.xml b/app/src/main/res/drawable/baseline_close_24.xml
new file mode 100644
index 0000000000..3f9973200c
--- /dev/null
+++ b/app/src/main/res/drawable/baseline_close_24.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/layout/manga_info_web_controller.xml b/app/src/main/res/layout/manga_info_web_controller.xml
deleted file mode 100644
index 6d52f5e22a..0000000000
--- a/app/src/main/res/layout/manga_info_web_controller.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
diff --git a/app/src/main/res/layout/webview_activity.xml b/app/src/main/res/layout/webview_activity.xml
new file mode 100644
index 0000000000..6b2bc7f3b7
--- /dev/null
+++ b/app/src/main/res/layout/webview_activity.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/webview.xml b/app/src/main/res/menu/webview.xml
new file mode 100644
index 0000000000..29b7063b5e
--- /dev/null
+++ b/app/src/main/res/menu/webview.xml
@@ -0,0 +1,16 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index cd9c659b00..f7d259bd40 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -98,6 +98,8 @@
Restore
Open
Log in
+ Back
+ Forward
Deleting…