Move share manga button to toolbar menu

This commit is contained in:
arkon 2020-08-29 17:13:02 -04:00
parent d9000f6fd1
commit 8bedc8f456
4 changed files with 10 additions and 18 deletions

View File

@ -343,7 +343,8 @@ class MangaController :
} }
override fun onPrepareOptionsMenu(menu: Menu) { override fun onPrepareOptionsMenu(menu: Menu) {
// Hide download options for local manga // Hide options for local manga
menu.findItem(R.id.action_share).isVisible = !isLocalSource
menu.findItem(R.id.download_group).isVisible = !isLocalSource menu.findItem(R.id.download_group).isVisible = !isLocalSource
// Hide options for non-library manga // Hide options for non-library manga
@ -354,6 +355,7 @@ class MangaController :
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
R.id.action_share -> shareManga()
R.id.download_next, R.id.download_next_5, R.id.download_next_10, R.id.download_next, R.id.download_next_5, R.id.download_next_10,
R.id.download_custom, R.id.download_unread, R.id.download_all R.id.download_custom, R.id.download_unread, R.id.download_all
-> downloadChapters(item.itemId) -> downloadChapters(item.itemId)

View File

@ -128,12 +128,6 @@ class MangaInfoHeaderAdapter(
.onEach { controller.openMangaInWebView() } .onEach { controller.openMangaInWebView() }
.launchIn(scope) .launchIn(scope)
binding.btnWebview.setTooltip(R.string.action_open_in_web_view) binding.btnWebview.setTooltip(R.string.action_open_in_web_view)
binding.btnShare.isVisible = true
binding.btnShare.clicks()
.onEach { controller.shareManga() }
.launchIn(scope)
binding.btnShare.setTooltip(R.string.action_share)
} }
binding.mangaFullTitle.longClicks() binding.mangaFullTitle.longClicks()

View File

@ -144,17 +144,6 @@
app:icon="@drawable/ic_sync_24dp" app:icon="@drawable/ic_sync_24dp"
tools:visibility="visible" /> tools:visibility="visible" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_share"
style="@style/Theme.Widget.Button.Icon.Textless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:contentDescription="@string/action_share"
android:visibility="gone"
app:icon="@drawable/ic_share_24dp"
tools:visibility="visible" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/btn_webview" android:id="@+id/btn_webview"
style="@style/Theme.Widget.Button.Icon.Textless" style="@style/Theme.Widget.Button.Icon.Textless"

View File

@ -2,6 +2,13 @@
<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">
<item
android:id="@+id/action_share"
android:icon="@drawable/ic_share_24dp"
android:title="@string/action_share"
app:iconTint="?attr/colorOnPrimary"
app:showAsAction="ifRoom" />
<item <item
android:id="@+id/download_group" android:id="@+id/download_group"
android:icon="@drawable/ic_get_app_24dp" android:icon="@drawable/ic_get_app_24dp"