浏览代码

Move share manga button to toolbar menu

arkon 4 年之前
父节点
当前提交
8bedc8f456

+ 3 - 1
app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt

@@ -343,7 +343,8 @@ class MangaController :
     }
 
     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
 
         // Hide options for non-library manga
@@ -354,6 +355,7 @@ class MangaController :
 
     override fun onOptionsItemSelected(item: MenuItem): Boolean {
         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_custom, R.id.download_unread, R.id.download_all
             -> downloadChapters(item.itemId)

+ 0 - 6
app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt

@@ -128,12 +128,6 @@ class MangaInfoHeaderAdapter(
                     .onEach { controller.openMangaInWebView() }
                     .launchIn(scope)
                 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()

+ 0 - 11
app/src/main/res/layout/manga_info_header.xml

@@ -144,17 +144,6 @@
                     app:icon="@drawable/ic_sync_24dp"
                     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
                     android:id="@+id/btn_webview"
                     style="@style/Theme.Widget.Button.Icon.Textless"

+ 7 - 0
app/src/main/res/menu/manga.xml

@@ -2,6 +2,13 @@
 <menu xmlns:android="http://schemas.android.com/apk/res/android"
     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
         android:id="@+id/download_group"
         android:icon="@drawable/ic_get_app_24dp"