From 4044427d931f1e973492583aa9ca673f5d36fcfa Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 17 Jan 2021 15:57:19 -0500 Subject: [PATCH] Add shortcut to see commit history for official extensions --- .../extension/details/ExtensionDetailsController.kt | 11 +++++++++++ app/src/main/res/menu/extension_details.xml | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt index a1cc1572f..9d7043810 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt @@ -14,6 +14,7 @@ import android.view.MenuItem import android.view.View import android.view.ViewGroup import androidx.appcompat.view.ContextThemeWrapper +import androidx.core.net.toUri import androidx.core.os.bundleOf import androidx.preference.Preference import androidx.preference.PreferenceGroupAdapter @@ -175,10 +176,13 @@ class ExtensionDetailsController(bundle: Bundle? = null) : override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { inflater.inflate(R.menu.extension_details, menu) + + menu.findItem(R.id.action_history).isVisible = presenter.extension?.isUnofficial == false } override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { + R.id.action_history -> openCommitHistory() R.id.action_enable_all -> toggleAllSources(true) R.id.action_disable_all -> toggleAllSources(false) R.id.action_open_in_settings -> openInSettings() @@ -202,6 +206,13 @@ class ExtensionDetailsController(bundle: Bundle? = null) : } } + private fun openCommitHistory() { + val pkgName = presenter.extension!!.pkgName.substringAfter("eu.kanade.tachiyomi.extension.") + val url = "https://github.com/tachiyomiorg/tachiyomi-extensions/commits/master/src/${pkgName.replace(".", "/")}" + val intent = Intent(Intent.ACTION_VIEW, url.toUri()) + startActivity(intent) + } + private fun openInSettings() { val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply { data = Uri.fromParts("package", presenter.pkgName, null) diff --git a/app/src/main/res/menu/extension_details.xml b/app/src/main/res/menu/extension_details.xml index 4887cc6ee..dcdbdef1c 100644 --- a/app/src/main/res/menu/extension_details.xml +++ b/app/src/main/res/menu/extension_details.xml @@ -1,6 +1,13 @@ + +