Selaa lähdekoodia

Add shortcut to tracking guide on website

arkon 3 vuotta sitten
vanhempi
commit
a1e31549a2

+ 2 - 4
app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt

@@ -72,8 +72,6 @@ class MigrationSourcesController :
         parentController!!.router.pushController(controller.withFadeTransaction())
         return false
     }
-
-    companion object {
-        const val HELP_URL = "https://tachiyomi.org/help/guides/source-migration/"
-    }
 }
+
+private const val HELP_URL = "https://tachiyomi.org/help/guides/source-migration/"

+ 16 - 0
app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsTrackingController.kt

@@ -1,6 +1,9 @@
 package eu.kanade.tachiyomi.ui.setting
 
 import android.app.Activity
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
 import androidx.preference.PreferenceScreen
 import eu.kanade.tachiyomi.R
 import eu.kanade.tachiyomi.data.track.NoLoginTrackService
@@ -112,6 +115,17 @@ class SettingsTrackingController :
         updatePreference(trackManager.bangumi.id)
     }
 
+    override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
+        inflater.inflate(R.menu.settings_tracking, menu)
+    }
+
+    override fun onOptionsItemSelected(item: MenuItem): Boolean {
+        when (item.itemId) {
+            R.id.action_tracking_help -> activity?.openInBrowser(HELP_URL)
+        }
+        return super.onOptionsItemSelected(item)
+    }
+
     private fun updatePreference(id: Int) {
         val pref = findPreference(Keys.trackUsername(id)) as? LoginPreference
         pref?.notifyChanged()
@@ -125,3 +139,5 @@ class SettingsTrackingController :
         updatePreference(service.id)
     }
 }
+
+private const val HELP_URL = "https://tachiyomi.org/help/guides/tracking/"

+ 11 - 0
app/src/main/res/menu/settings_tracking.xml

@@ -0,0 +1,11 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <item
+        android:id="@+id/action_tracking_help"
+        android:icon="@drawable/ic_help_24dp"
+        android:title="@string/tracking_guide"
+        app:iconTint="?attr/colorOnPrimary"
+        app:showAsAction="ifRoom" />
+
+</menu>

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -378,6 +378,7 @@
     <string name="pref_download_new_categories_details">Manga in excluded categories will not be downloaded even if they are also in included categories.</string>
 
       <!-- Tracking section -->
+    <string name="tracking_guide">Tracking guide</string>
     <string name="pref_auto_update_manga_sync">Update chapter progress after reading</string>
     <string name="pref_auto_add_track">Track silently when adding manga to library</string>
     <string name="services">Services</string>