mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Move extension app info button
Aligns with TachiyomiJ2K.
This commit is contained in:
		| @@ -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() | ||||
|     } | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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<ExtensionDetailsController>() { | ||||
|  | ||||
|     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) | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user