From ce22b2c29a8f31fe005d1f832514de01dc8f3746 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 20 Jun 2020 10:43:35 -0400 Subject: [PATCH] Add shortcut to open extension package in system settings --- .../extension/details/ExtensionDetailsController.kt | 11 +++++++++++ app/src/main/res/menu/extension_details.xml | 5 +++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 17 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 e8fba01fb0..5a413d53d2 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 @@ -2,7 +2,10 @@ package eu.kanade.tachiyomi.ui.browse.extension.details import android.annotation.SuppressLint import android.content.Context +import android.content.Intent +import android.net.Uri import android.os.Bundle +import android.provider.Settings import android.util.TypedValue import android.view.LayoutInflater import android.view.Menu @@ -180,6 +183,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) : when (item.itemId) { R.id.action_enable_all -> toggleAllSources(true) R.id.action_disable_all -> toggleAllSources(false) + R.id.action_open_in_settings -> openInSettings() } return super.onOptionsItemSelected(item) } @@ -204,6 +208,13 @@ class ExtensionDetailsController(bundle: Bundle? = null) : ) } + private fun openInSettings() { + val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply { + data = Uri.fromParts("package", presenter.pkgName, null) + } + startActivity(intent) + } + private fun Source.isEnabled(): Boolean { return id.toString() !in preferences.disabledSources().get() } diff --git a/app/src/main/res/menu/extension_details.xml b/app/src/main/res/menu/extension_details.xml index f0eae214a8..4887cc6ee8 100644 --- a/app/src/main/res/menu/extension_details.xml +++ b/app/src/main/res/menu/extension_details.xml @@ -11,4 +11,9 @@ android:title="@string/action_disable_all" app:showAsAction="never" /> + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cd13cc1444..779ae9be0f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -81,6 +81,7 @@ Move Open in browser Open in WebView + Open in Settings Migrate Display mode Display