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 ea7a6daf1..3814dc9ca 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,10 +2,7 @@ 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 @@ -68,7 +65,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) : } override fun createPresenter(): ExtensionDetailsPresenter { - return ExtensionDetailsPresenter(args.getString(PKGNAME_KEY)!!) + return ExtensionDetailsPresenter(this, args.getString(PKGNAME_KEY)!!) } override fun getTitle(): String? { @@ -188,7 +185,6 @@ class ExtensionDetailsController(bundle: Bundle? = null) : 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() } return super.onOptionsItemSelected(item) } @@ -219,13 +215,6 @@ class ExtensionDetailsController(bundle: Bundle? = null) : openInBrowser(url) } - 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/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsHeaderAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsHeaderAdapter.kt index b65d74ade..897e05c95 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsHeaderAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsHeaderAdapter.kt @@ -44,6 +44,9 @@ class ExtensionDetailsHeaderAdapter(private val presenter: ExtensionDetailsPrese binding.btnUninstall.clicks() .onEach { presenter.uninstallExtension() } .launchIn(presenter.presenterScope) + binding.btnAppInfo.clicks() + .onEach { presenter.openInSettings() } + .launchIn(presenter.presenterScope) if (extension.isObsolete) { binding.warningBanner.isVisible = true diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsPresenter.kt index 149de4b11..9a18a597f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsPresenter.kt @@ -1,17 +1,21 @@ package eu.kanade.tachiyomi.ui.browse.extension.details +import android.content.Intent +import android.net.Uri import android.os.Bundle +import android.provider.Settings import eu.kanade.tachiyomi.extension.ExtensionManager import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter import rx.android.schedulers.AndroidSchedulers -import uy.kohesive.injekt.Injekt -import uy.kohesive.injekt.api.get +import uy.kohesive.injekt.injectLazy class ExtensionDetailsPresenter( - val pkgName: String, - private val extensionManager: ExtensionManager = Injekt.get() + private val controller: ExtensionDetailsController, + private val pkgName: String, ) : BasePresenter() { + private val extensionManager: ExtensionManager by injectLazy() + val extension = extensionManager.installedExtensions.find { it.pkgName == pkgName } override fun onCreate(savedState: Bundle?) { @@ -36,4 +40,11 @@ class ExtensionDetailsPresenter( val extension = extension ?: return extensionManager.uninstallExtension(extension.pkgName) } + + fun openInSettings() { + val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply { + data = Uri.fromParts("package", pkgName, null) + } + controller.startActivity(intent) + } } diff --git a/app/src/main/res/layout/extension_detail_header.xml b/app/src/main/res/layout/extension_detail_header.xml index 8abf18b1e..2dd068866 100644 --- a/app/src/main/res/layout/extension_detail_header.xml +++ b/app/src/main/res/layout/extension_detail_header.xml @@ -98,11 +98,24 @@