You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Updated flash screen so it's a fragment
The FlashActivity has been removed and all of it's functionality has been transferred to the FlashFragment. The FlashFragment needs to be however launched in a different way than the activity using the MainActivity's stub and so seemingly massive changes had to be made. Notably the RemoteFileService didn't seem to be calling Service.startForeground(), which has been crashing the application due to the system requirements, so that's been fixed.
This commit is contained in:
committed by
John Wu
parent
fc2d0246e6
commit
6907651756
@@ -2,13 +2,12 @@ package com.topjohnwu.magisk.model.events
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.annotation.RequiresPermission
|
||||
import androidx.navigation.NavDirections
|
||||
import com.topjohnwu.magisk.MainDirections
|
||||
import com.topjohnwu.magisk.core.Const
|
||||
import com.topjohnwu.magisk.core.base.BaseActivity
|
||||
import com.topjohnwu.magisk.core.intent
|
||||
import com.topjohnwu.magisk.legacy.flash.FlashActivity
|
||||
|
||||
class InstallExternalModuleEvent : ViewEvent(), ActivityExecutor {
|
||||
|
||||
@@ -21,13 +20,14 @@ class InstallExternalModuleEvent : ViewEvent(), ActivityExecutor {
|
||||
|
||||
companion object {
|
||||
|
||||
fun onActivityResult(context: Context, requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): NavDirections? {
|
||||
if (requestCode == Const.ID.FETCH_ZIP && resultCode == Activity.RESULT_OK && data != null) {
|
||||
// Get the URI of the selected file
|
||||
val intent = context.intent<FlashActivity>()
|
||||
intent.setData(data.data).putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_ZIP)
|
||||
context.startActivity(intent)
|
||||
val data = data.data
|
||||
if (data != null) {
|
||||
return MainDirections.actionFlashFragment(data, Const.Key.FLASH_ACTION)
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user