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