Add shortcut to open extension package in system settings

This commit is contained in:
arkon 2020-06-20 10:43:35 -04:00
parent 361b0284fa
commit ce22b2c29a
3 changed files with 17 additions and 0 deletions

View File

@ -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()
}

View File

@ -11,4 +11,9 @@
android:title="@string/action_disable_all"
app:showAsAction="never" />
<item
android:id="@+id/action_open_in_settings"
android:title="@string/action_open_in_settings"
app:showAsAction="never" />
</menu>

View File

@ -81,6 +81,7 @@
<string name="action_move">Move</string>
<string name="action_open_in_browser">Open in browser</string>
<string name="action_open_in_web_view">Open in WebView</string>
<string name="action_open_in_settings">Open in Settings</string>
<string name="action_migrate">Migrate</string>
<string name="action_display_mode">Display mode</string>
<string name="action_display">Display</string>