Start moving things outside of top Application class

This commit is contained in:
topjohnwu
2018-07-31 03:51:11 +08:00
parent e39f83edbf
commit 914b7ee056
32 changed files with 237 additions and 214 deletions

View File

@@ -5,6 +5,7 @@ import android.content.Intent;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import com.topjohnwu.magisk.Global;
import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.asyncs.MarkDownWindow;
@@ -18,21 +19,21 @@ public class ManagerInstallDialog extends CustomAlertDialog {
super(activity);
MagiskManager mm = Utils.getMagiskManager(activity);
String filename = Utils.fmt("MagiskManager-v%s(%d).apk",
mm.remoteManagerVersionString, mm.remoteManagerVersionCode);
Global.remoteManagerVersionString, Global.remoteManagerVersionCode);
setTitle(mm.getString(R.string.repo_install_title, mm.getString(R.string.app_name)));
setMessage(mm.getString(R.string.repo_install_msg, filename));
setCancelable(true);
setPositiveButton(R.string.install, (d, i) -> activity.runWithPermission(
new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, () -> {
Intent intent = new Intent(mm, ManagerUpdate.class);
intent.putExtra(Const.Key.INTENT_SET_LINK, mm.managerLink);
intent.putExtra(Const.Key.INTENT_SET_LINK, Global.managerLink);
intent.putExtra(Const.Key.INTENT_SET_FILENAME, filename);
mm.sendBroadcast(intent);
}))
.setNegativeButton(R.string.no_thanks, null);
if (!TextUtils.isEmpty(mm.managerNoteLink)) {
if (!TextUtils.isEmpty(Global.managerNoteLink)) {
setNeutralButton(R.string.app_changelog, (d, i) ->
new MarkDownWindow(activity, null, mm.managerNoteLink).exec());
new MarkDownWindow(activity, null, Global.managerNoteLink).exec());
}
}
}