Cleanup ActivityResult callbacks

This commit is contained in:
topjohnwu
2020-10-06 02:04:19 -07:00
parent 333fe6da0e
commit fc19b50290
11 changed files with 58 additions and 106 deletions
@@ -1,6 +1,5 @@
package com.topjohnwu.magisk.ui.module
import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
@@ -14,7 +13,6 @@ import com.topjohnwu.magisk.arch.ReselectionTarget
import com.topjohnwu.magisk.arch.ViewEvent
import com.topjohnwu.magisk.core.download.BaseDownloader
import com.topjohnwu.magisk.databinding.FragmentModuleMd2Binding
import com.topjohnwu.magisk.events.InstallExternalModuleEvent
import com.topjohnwu.magisk.ktx.hideKeyboard
import com.topjohnwu.magisk.ui.MainActivity
import com.topjohnwu.magisk.utils.EndlessRecyclerScrollListener
@@ -40,13 +38,6 @@ class ModuleFragment : BaseUIFragment<ModuleViewModel, FragmentModuleMd2Binding>
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
InstallExternalModuleEvent.onActivityResult(requestCode, resultCode, data)?.also {
it.navigate()
}
}
override fun onStart() {
super.onStart()
setHasOptionsMenu(true)
@@ -14,7 +14,7 @@ import com.topjohnwu.magisk.core.tasks.RepoUpdater
import com.topjohnwu.magisk.data.database.RepoByNameDao
import com.topjohnwu.magisk.data.database.RepoByUpdatedDao
import com.topjohnwu.magisk.databinding.RvItem
import com.topjohnwu.magisk.events.InstallExternalModuleEvent
import com.topjohnwu.magisk.events.SelectModuleEvent
import com.topjohnwu.magisk.events.OpenChangelogEvent
import com.topjohnwu.magisk.events.SnackbarEvent
import com.topjohnwu.magisk.events.dialog.ModuleInstallDialog
@@ -311,7 +311,7 @@ class ModuleViewModel(
}
fun installPressed() = withExternalRW {
InstallExternalModuleEvent().publish()
SelectModuleEvent().publish()
}
fun infoPressed(item: RepoItem) =