mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 21:11:52 +01:00
Move "Open in browser" option to webview only
This commit is contained in:
parent
5ca23b5363
commit
09e7d56ff2
@ -2,17 +2,17 @@ package eu.kanade.tachiyomi.ui.catalogue.browse
|
|||||||
|
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import com.google.android.material.snackbar.Snackbar
|
|
||||||
import androidx.drawerlayout.widget.DrawerLayout
|
|
||||||
import androidx.appcompat.widget.*
|
|
||||||
import android.view.*
|
import android.view.*
|
||||||
|
import androidx.appcompat.widget.SearchView
|
||||||
import androidx.core.view.GravityCompat
|
import androidx.core.view.GravityCompat
|
||||||
|
import androidx.drawerlayout.widget.DrawerLayout
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration
|
import androidx.recyclerview.widget.DividerItemDecoration
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
import com.f2prateek.rx.preferences.Preference
|
import com.f2prateek.rx.preferences.Preference
|
||||||
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.jakewharton.rxbinding.support.v7.widget.queryTextChangeEvents
|
import com.jakewharton.rxbinding.support.v7.widget.queryTextChangeEvents
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
import eu.davidea.flexibleadapter.items.IFlexible
|
import eu.davidea.flexibleadapter.items.IFlexible
|
||||||
@ -31,8 +31,9 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
|
|||||||
import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
||||||
import eu.kanade.tachiyomi.util.*
|
import eu.kanade.tachiyomi.util.*
|
||||||
import eu.kanade.tachiyomi.widget.AutofitRecyclerView
|
import eu.kanade.tachiyomi.widget.AutofitRecyclerView
|
||||||
import kotlinx.android.synthetic.main.catalogue_controller.*
|
import kotlinx.android.synthetic.main.catalogue_controller.catalogue_view
|
||||||
import kotlinx.android.synthetic.main.main_activity.*
|
import kotlinx.android.synthetic.main.catalogue_controller.progress
|
||||||
|
import kotlinx.android.synthetic.main.main_activity.drawer
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.Subscription
|
import rx.Subscription
|
||||||
import rx.android.schedulers.AndroidSchedulers
|
import rx.android.schedulers.AndroidSchedulers
|
||||||
@ -274,7 +275,6 @@ open class BrowseCatalogueController(bundle: Bundle) :
|
|||||||
super.onPrepareOptionsMenu(menu)
|
super.onPrepareOptionsMenu(menu)
|
||||||
|
|
||||||
val isHttpSource = presenter.source is HttpSource
|
val isHttpSource = presenter.source is HttpSource
|
||||||
menu.findItem(R.id.action_open_in_browser).isVisible = isHttpSource
|
|
||||||
menu.findItem(R.id.action_open_in_web_view).isVisible = isHttpSource
|
menu.findItem(R.id.action_open_in_web_view).isVisible = isHttpSource
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,19 +283,12 @@ open class BrowseCatalogueController(bundle: Bundle) :
|
|||||||
R.id.action_search -> expandActionViewFromInteraction = true
|
R.id.action_search -> expandActionViewFromInteraction = true
|
||||||
R.id.action_display_mode -> swapDisplayMode()
|
R.id.action_display_mode -> swapDisplayMode()
|
||||||
R.id.action_set_filter -> navView?.let { activity?.drawer?.openDrawer(GravityCompat.END) }
|
R.id.action_set_filter -> navView?.let { activity?.drawer?.openDrawer(GravityCompat.END) }
|
||||||
R.id.action_open_in_browser -> openInBrowser()
|
|
||||||
R.id.action_open_in_web_view -> openInWebView()
|
R.id.action_open_in_web_view -> openInWebView()
|
||||||
else -> return super.onOptionsItemSelected(item)
|
else -> return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openInBrowser() {
|
|
||||||
val source = presenter.source as? HttpSource ?: return
|
|
||||||
|
|
||||||
activity?.openInBrowser(source.baseUrl)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun openInWebView() {
|
private fun openInWebView() {
|
||||||
val source = presenter.source as? HttpSource ?: return
|
val source = presenter.source as? HttpSource ?: return
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ import eu.kanade.tachiyomi.ui.library.LibraryController
|
|||||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||||
import eu.kanade.tachiyomi.ui.manga.MangaController
|
import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||||
import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
||||||
import eu.kanade.tachiyomi.util.openInBrowser
|
|
||||||
import eu.kanade.tachiyomi.util.snack
|
import eu.kanade.tachiyomi.util.snack
|
||||||
import eu.kanade.tachiyomi.util.toast
|
import eu.kanade.tachiyomi.util.toast
|
||||||
import eu.kanade.tachiyomi.util.truncateCenter
|
import eu.kanade.tachiyomi.util.truncateCenter
|
||||||
@ -134,13 +133,11 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
|||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.action_open_in_browser -> openInBrowser()
|
|
||||||
R.id.action_open_in_web_view -> openInWebView()
|
R.id.action_open_in_web_view -> openInWebView()
|
||||||
R.id.action_share -> shareManga()
|
R.id.action_share -> shareManga()
|
||||||
R.id.action_add_to_home_screen -> addToHomeScreen()
|
R.id.action_add_to_home_screen -> addToHomeScreen()
|
||||||
else -> return super.onOptionsItemSelected(item)
|
|
||||||
}
|
}
|
||||||
return true
|
return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -278,16 +275,6 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Open the manga in browser.
|
|
||||||
*/
|
|
||||||
private fun openInBrowser() {
|
|
||||||
val context = view?.context ?: return
|
|
||||||
val source = presenter.source as? HttpSource ?: return
|
|
||||||
|
|
||||||
context.openInBrowser(source.mangaDetailsRequest(presenter.manga).url.toString())
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun openInWebView() {
|
private fun openInWebView() {
|
||||||
val source = presenter.source as? HttpSource ?: return
|
val source = presenter.source as? HttpSource ?: return
|
||||||
|
|
||||||
|
@ -123,6 +123,7 @@ class WebViewActivity : BaseActivity() {
|
|||||||
R.id.action_web_forward -> webview.goForward()
|
R.id.action_web_forward -> webview.goForward()
|
||||||
R.id.action_web_refresh -> refreshPage()
|
R.id.action_web_refresh -> refreshPage()
|
||||||
R.id.action_web_share -> shareWebpage()
|
R.id.action_web_share -> shareWebpage()
|
||||||
|
R.id.action_web_browser -> openInBrowser()
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item)
|
return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
@ -144,6 +145,10 @@ class WebViewActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun openInBrowser() {
|
||||||
|
openInBrowser(webview.url)
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val SOURCE_KEY = "source_key"
|
private const val SOURCE_KEY = "source_key"
|
||||||
private const val URL_KEY = "url_key"
|
private const val URL_KEY = "url_key"
|
||||||
|
@ -1,33 +1,29 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu 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"
|
||||||
xmlns:tools="http://schemas.android.com/tools" tools:context=".CatalogueListActivity">
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context=".CatalogueListActivity">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_search"
|
android:id="@+id/action_search"
|
||||||
android:title="@string/action_search"
|
|
||||||
android:icon="@drawable/ic_search_white_24dp"
|
android:icon="@drawable/ic_search_white_24dp"
|
||||||
app:showAsAction="collapseActionView|ifRoom"
|
android:title="@string/action_search"
|
||||||
app:actionViewClass="androidx.appcompat.widget.SearchView"/>
|
app:actionViewClass="androidx.appcompat.widget.SearchView"
|
||||||
|
app:showAsAction="collapseActionView|ifRoom" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_set_filter"
|
android:id="@+id/action_set_filter"
|
||||||
android:title="@string/action_set_filter"
|
|
||||||
android:icon="@drawable/ic_filter_list_white_24dp"
|
android:icon="@drawable/ic_filter_list_white_24dp"
|
||||||
app:showAsAction="ifRoom"/>
|
android:title="@string/action_set_filter"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_display_mode"
|
android:id="@+id/action_display_mode"
|
||||||
android:title="@string/action_display_mode"
|
android:title="@string/action_display_mode"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom" />
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_open_in_browser"
|
|
||||||
android:title="@string/action_open_in_browser"
|
|
||||||
app:showAsAction="never"/>
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_open_in_web_view"
|
android:id="@+id/action_open_in_web_view"
|
||||||
android:title="@string/action_open_in_web_view"
|
android:title="@string/action_open_in_web_view"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -8,16 +8,14 @@
|
|||||||
android:title="@string/action_share"
|
android:title="@string/action_share"
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="ifRoom" />
|
||||||
|
|
||||||
<item android:id="@+id/action_open_in_browser"
|
<item
|
||||||
android:title="@string/action_open_in_browser"
|
android:id="@+id/action_open_in_web_view"
|
||||||
app:showAsAction="never"/>
|
|
||||||
|
|
||||||
<item android:id="@+id/action_open_in_web_view"
|
|
||||||
android:title="@string/action_open_in_web_view"
|
android:title="@string/action_open_in_web_view"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never" />
|
||||||
|
|
||||||
<item android:id="@+id/action_add_to_home_screen"
|
<item
|
||||||
|
android:id="@+id/action_add_to_home_screen"
|
||||||
android:title="@string/action_add_to_home_screen"
|
android:title="@string/action_add_to_home_screen"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -24,4 +24,9 @@
|
|||||||
android:title="@string/action_share"
|
android:title="@string/action_share"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_web_browser"
|
||||||
|
android:title="@string/action_open_in_browser"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
Loading…
Reference in New Issue
Block a user