2018-07-28 22:52:40 +08:00
|
|
|
package com.topjohnwu.magisk.components;
|
|
|
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
2018-07-31 17:41:54 +08:00
|
|
|
import com.topjohnwu.magisk.Data;
|
2018-07-28 22:52:40 +08:00
|
|
|
import com.topjohnwu.magisk.MagiskManager;
|
|
|
|
import com.topjohnwu.magisk.R;
|
|
|
|
import com.topjohnwu.magisk.asyncs.MarkDownWindow;
|
2018-12-02 04:47:57 -05:00
|
|
|
import com.topjohnwu.magisk.utils.DlInstallManager;
|
2018-07-28 22:52:40 +08:00
|
|
|
import com.topjohnwu.magisk.utils.Utils;
|
|
|
|
|
2018-09-10 02:27:45 -04:00
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
|
2018-07-28 22:52:40 +08:00
|
|
|
public class ManagerInstallDialog extends CustomAlertDialog {
|
|
|
|
|
2018-08-01 17:57:11 +08:00
|
|
|
public ManagerInstallDialog(@NonNull BaseActivity activity) {
|
2018-07-28 22:52:40 +08:00
|
|
|
super(activity);
|
2018-08-01 14:30:59 +08:00
|
|
|
MagiskManager mm = Data.MM();
|
2018-12-02 04:47:57 -05:00
|
|
|
String name = Utils.fmt("MagiskManager v%s(%d)",
|
2018-07-31 17:41:54 +08:00
|
|
|
Data.remoteManagerVersionString, Data.remoteManagerVersionCode);
|
2018-07-28 22:52:40 +08:00
|
|
|
setTitle(mm.getString(R.string.repo_install_title, mm.getString(R.string.app_name)));
|
2018-12-02 04:47:57 -05:00
|
|
|
setMessage(mm.getString(R.string.repo_install_msg, name));
|
2018-07-28 22:52:40 +08:00
|
|
|
setCancelable(true);
|
2018-12-02 04:47:57 -05:00
|
|
|
setPositiveButton(R.string.install, (d, i) -> DlInstallManager.upgrade(name));
|
|
|
|
setNegativeButton(R.string.no_thanks, null);
|
2018-07-31 17:41:54 +08:00
|
|
|
if (!TextUtils.isEmpty(Data.managerNoteLink)) {
|
2018-07-28 22:52:40 +08:00
|
|
|
setNeutralButton(R.string.app_changelog, (d, i) ->
|
2018-07-31 17:41:54 +08:00
|
|
|
new MarkDownWindow(activity, null, Data.managerNoteLink).exec());
|
2018-07-28 22:52:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|