Fix FlashActivity crash

This commit is contained in:
topjohnwu 2018-09-15 01:45:10 -04:00
parent 78534deab6
commit af7c6f9fce
5 changed files with 7 additions and 10 deletions

View File

@ -50,6 +50,7 @@ public class ViewBinder {
target.toolbar = target.findViewById(R.id.toolbar); target.toolbar = target.findViewById(R.id.toolbar);
target.flashLogs = target.findViewById(R.id.txtLog); target.flashLogs = target.findViewById(R.id.txtLog);
target.buttonPanel = target.findViewById(R.id.button_panel); target.buttonPanel = target.findViewById(R.id.button_panel);
target.sv = target.findViewById(R.id.scrollView);
target.findViewById(R.id.no_thanks).setOnClickListener(v -> target.finish()); target.findViewById(R.id.no_thanks).setOnClickListener(v -> target.finish());
target.findViewById(R.id.reboot).setOnClickListener(v -> target.reboot()); target.findViewById(R.id.reboot).setOnClickListener(v -> target.reboot());
target.findViewById(R.id.save_logs).setOnClickListener(v -> target.saveLogs()); target.findViewById(R.id.save_logs).setOnClickListener(v -> target.saveLogs());

View File

@ -8,7 +8,6 @@ import android.widget.Toast;
import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.Data; import com.topjohnwu.magisk.Data;
import com.topjohnwu.magisk.FlashActivity;
import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.components.BaseActivity; import com.topjohnwu.magisk.components.BaseActivity;
import com.topjohnwu.magisk.components.SnackbarMaker; import com.topjohnwu.magisk.components.SnackbarMaker;
@ -141,7 +140,7 @@ public class ProcessRepoZip extends ParallelTask<Void, Object, Boolean> {
if (result) { if (result) {
Uri uri = Uri.fromFile(mFile); Uri uri = Uri.fromFile(mFile);
if (mInstall) { if (mInstall) {
Intent intent = new Intent(activity, FlashActivity.class); Intent intent = new Intent(activity, a.f.class);
intent.setData(uri).putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_ZIP); intent.setData(uri).putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_ZIP);
activity.startActivity(intent); activity.startActivity(intent);
} else { } else {

View File

@ -8,7 +8,6 @@ import android.widget.Toast;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.Data; import com.topjohnwu.magisk.Data;
import com.topjohnwu.magisk.FlashActivity;
import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.receivers.DownloadReceiver; import com.topjohnwu.magisk.receivers.DownloadReceiver;
import com.topjohnwu.magisk.utils.Download; import com.topjohnwu.magisk.utils.Download;
@ -38,7 +37,7 @@ class InstallMethodDialog extends AlertDialog.Builder {
(requestCode, resultCode, data) -> { (requestCode, resultCode, data) -> {
if (requestCode == Const.ID.SELECT_BOOT && if (requestCode == Const.ID.SELECT_BOOT &&
resultCode == BaseActivity.RESULT_OK && data != null) { resultCode == BaseActivity.RESULT_OK && data != null) {
Intent i = new Intent(activity, FlashActivity.class) Intent i = new Intent(activity, a.f.class)
.putExtra(Const.Key.FLASH_SET_BOOT, data.getData()) .putExtra(Const.Key.FLASH_SET_BOOT, data.getData())
.putExtra(Const.Key.FLASH_ACTION, Const.Value.PATCH_BOOT); .putExtra(Const.Key.FLASH_ACTION, Const.Value.PATCH_BOOT);
activity.startActivity(i); activity.startActivity(i);
@ -56,7 +55,7 @@ class InstallMethodDialog extends AlertDialog.Builder {
}, Data.magiskLink, filename); }, Data.magiskLink, filename);
break; break;
case 2: case 2:
intent = new Intent(activity, FlashActivity.class) intent = new Intent(activity, a.f.class)
.putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_MAGISK); .putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_MAGISK);
activity.startActivity(intent); activity.startActivity(intent);
break; break;
@ -66,7 +65,7 @@ class InstallMethodDialog extends AlertDialog.Builder {
.setMessage(R.string.install_inactive_slot_msg) .setMessage(R.string.install_inactive_slot_msg)
.setCancelable(true) .setCancelable(true)
.setPositiveButton(R.string.yes, (d, i) -> { .setPositiveButton(R.string.yes, (d, i) -> {
Intent it = new Intent(activity, FlashActivity.class) Intent it = new Intent(activity, a.f.class)
.putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_INACTIVE_SLOT); .putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_INACTIVE_SLOT);
activity.startActivity(it); activity.startActivity(it);
}) })

View File

@ -10,7 +10,6 @@ import android.widget.Toast;
import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.Data; import com.topjohnwu.magisk.Data;
import com.topjohnwu.magisk.FlashActivity;
import com.topjohnwu.magisk.MagiskManager; import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.receivers.DownloadReceiver; import com.topjohnwu.magisk.receivers.DownloadReceiver;
@ -45,7 +44,7 @@ public class UninstallDialog extends CustomAlertDialog {
Download.receive(activity, new DownloadReceiver() { Download.receive(activity, new DownloadReceiver() {
@Override @Override
public void onDownloadDone(Context context, Uri uri) { public void onDownloadDone(Context context, Uri uri) {
Intent intent = new Intent(context, FlashActivity.class) Intent intent = new Intent(context, a.f.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.setData(uri) .setData(uri)
.putExtra(Const.Key.FLASH_ACTION, Const.Value.UNINSTALL); .putExtra(Const.Key.FLASH_ACTION, Const.Value.UNINSTALL);

View File

@ -13,7 +13,6 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.FlashActivity;
import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.ViewBinder; import com.topjohnwu.magisk.ViewBinder;
import com.topjohnwu.magisk.adapters.ModulesAdapter; import com.topjohnwu.magisk.adapters.ModulesAdapter;
@ -91,7 +90,7 @@ public class ModulesFragment extends BaseFragment implements Topic.Subscriber {
public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == Const.ID.FETCH_ZIP && resultCode == Activity.RESULT_OK && data != null) { if (requestCode == Const.ID.FETCH_ZIP && resultCode == Activity.RESULT_OK && data != null) {
// Get the URI of the selected file // Get the URI of the selected file
Intent intent = new Intent(getActivity(), FlashActivity.class); Intent intent = new Intent(getActivity(), a.f.class);
intent.setData(data.getData()).putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_ZIP); intent.setData(data.getData()).putExtra(Const.Key.FLASH_ACTION, Const.Value.FLASH_ZIP);
startActivity(intent); startActivity(intent);
} }