Share Button in WebView + Open in broswer moved there
This commit is contained in:
parent
f465785935
commit
a8d1999fc2
@ -41,7 +41,6 @@ import eu.kanade.tachiyomi.util.doOnApplyWindowInsets
|
|||||||
import eu.kanade.tachiyomi.util.gone
|
import eu.kanade.tachiyomi.util.gone
|
||||||
import eu.kanade.tachiyomi.util.inflate
|
import eu.kanade.tachiyomi.util.inflate
|
||||||
import eu.kanade.tachiyomi.util.marginTop
|
import eu.kanade.tachiyomi.util.marginTop
|
||||||
import eu.kanade.tachiyomi.util.openInBrowser
|
|
||||||
import eu.kanade.tachiyomi.util.snack
|
import eu.kanade.tachiyomi.util.snack
|
||||||
import eu.kanade.tachiyomi.util.updateLayoutParams
|
import eu.kanade.tachiyomi.util.updateLayoutParams
|
||||||
import eu.kanade.tachiyomi.util.updatePaddingRelative
|
import eu.kanade.tachiyomi.util.updatePaddingRelative
|
||||||
@ -319,7 +318,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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,19 +326,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
|
||||||
val activity = activity ?: return
|
val activity = activity ?: return
|
||||||
|
@ -64,7 +64,6 @@ import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
|||||||
import eu.kanade.tachiyomi.util.doOnApplyWindowInsets
|
import eu.kanade.tachiyomi.util.doOnApplyWindowInsets
|
||||||
import eu.kanade.tachiyomi.util.getUriCompat
|
import eu.kanade.tachiyomi.util.getUriCompat
|
||||||
import eu.kanade.tachiyomi.util.marginBottom
|
import eu.kanade.tachiyomi.util.marginBottom
|
||||||
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.updateLayoutParams
|
import eu.kanade.tachiyomi.util.updateLayoutParams
|
||||||
@ -229,13 +228,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_edit -> EditMangaDialog(this, presenter.manga).showDialog(router)
|
R.id.action_edit -> EditMangaDialog(this, presenter.manga).showDialog(router)
|
||||||
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 -> prepareToShareManga()
|
R.id.action_share -> prepareToShareManga()
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -384,16 +381,6 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
|||||||
presenter.toggleFavorite()
|
presenter.toggleFavorite()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ import eu.kanade.tachiyomi.util.doOnApplyWindowInsets
|
|||||||
import eu.kanade.tachiyomi.util.getResourceColor
|
import eu.kanade.tachiyomi.util.getResourceColor
|
||||||
import eu.kanade.tachiyomi.util.invisible
|
import eu.kanade.tachiyomi.util.invisible
|
||||||
import eu.kanade.tachiyomi.util.marginBottom
|
import eu.kanade.tachiyomi.util.marginBottom
|
||||||
|
import eu.kanade.tachiyomi.util.openInBrowser
|
||||||
|
import eu.kanade.tachiyomi.util.toast
|
||||||
import eu.kanade.tachiyomi.util.updateLayoutParams
|
import eu.kanade.tachiyomi.util.updateLayoutParams
|
||||||
import eu.kanade.tachiyomi.util.updatePadding
|
import eu.kanade.tachiyomi.util.updatePadding
|
||||||
import eu.kanade.tachiyomi.util.visible
|
import eu.kanade.tachiyomi.util.visible
|
||||||
@ -244,8 +246,25 @@ class WebViewActivity : BaseActivity() {
|
|||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.action_web_back -> webview.goBack()
|
R.id.action_web_back -> webview.goBack()
|
||||||
R.id.action_web_forward -> webview.goForward()
|
R.id.action_web_forward -> webview.goForward()
|
||||||
else -> return super.onOptionsItemSelected(item)
|
R.id.action_web_share -> shareWebpage()
|
||||||
|
R.id.action_web_browser -> openInBrowser()
|
||||||
}
|
}
|
||||||
return true
|
return super.onOptionsItemSelected(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun shareWebpage() {
|
||||||
|
try {
|
||||||
|
val intent = Intent(Intent.ACTION_SEND).apply {
|
||||||
|
type = "text/plain"
|
||||||
|
putExtra(Intent.EXTRA_TEXT, webview.url)
|
||||||
|
}
|
||||||
|
startActivity(Intent.createChooser(intent, getString(R.string.action_share)))
|
||||||
|
} catch (e: Exception) {
|
||||||
|
toast(e.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun openInBrowser() {
|
||||||
|
openInBrowser(webview.url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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>
|
||||||
|
@ -14,16 +14,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>
|
||||||
|
@ -11,6 +11,16 @@
|
|||||||
android:id="@+id/action_web_forward"
|
android:id="@+id/action_web_forward"
|
||||||
android:icon="@drawable/ic_arrow_forward_white_24dp"
|
android:icon="@drawable/ic_arrow_forward_white_24dp"
|
||||||
android:title="@string/action_webview_forward"
|
android:title="@string/action_webview_forward"
|
||||||
app:showAsAction="ifRoom"
|
app:showAsAction="ifRoom" />
|
||||||
/>
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_web_share"
|
||||||
|
android:title="@string/action_share"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_web_browser"
|
||||||
|
android:title="@string/action_open_in_browser"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
Loading…
x
Reference in New Issue
Block a user