Several refinements

This commit is contained in:
topjohnwu 2017-02-17 14:07:15 +08:00
parent 430f2cafc1
commit f615ed40cd
6 changed files with 17 additions and 9 deletions

View File

@ -98,8 +98,8 @@ public class InstallFragment extends Fragment implements CallbackEvent.Listener<
} else { } else {
uninstallButton.setOnClickListener(vi -> { uninstallButton.setOnClickListener(vi -> {
new AlertDialogBuilder(getActivity()) new AlertDialogBuilder(getActivity())
.setTitle("Uninstall Magisk") .setTitle(R.string.uninstall_magisk_title)
.setMessage("This will remove all modules, MagiskSU, and potentially re-encrypt your device\nAre you sure to process?") .setMessage(R.string.uninstall_magisk_msg)
.setPositiveButton(R.string.yes, (dialogInterface, i) -> { .setPositiveButton(R.string.yes, (dialogInterface, i) -> {
try { try {
InputStream in = getActivity().getAssets().open(UNINSTALLER); InputStream in = getActivity().getAssets().open(UNINSTALLER);

View File

@ -78,9 +78,7 @@ public class MainActivity extends Activity
drawer.addDrawerListener(toggle); drawer.addDrawerListener(toggle);
toggle.syncState(); toggle.syncState();
if (savedInstanceState != null) if (savedInstanceState == null)
navigate(savedInstanceState.getInt(SECTION, R.id.status));
else
navigate(getIntent().getStringExtra(SECTION)); navigate(getIntent().getStringExtra(SECTION));
navigationView.setNavigationItemSelectedListener(this); navigationView.setNavigationItemSelectedListener(this);
@ -94,6 +92,12 @@ public class MainActivity extends Activity
checkHideSection(); checkHideSection();
} }
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
navigate(savedInstanceState.getInt(SECTION, R.id.status));
}
@Override @Override
protected void onSaveInstanceState(Bundle outState) { protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);

View File

@ -64,7 +64,7 @@ public class SplashActivity extends Activity{
} }
}.exec(); }.exec();
new LoadApps(this).exec(); new LoadApps(this).exec();
new CheckUpdates(this, !"install".equals(getIntent().getStringExtra(MainActivity.SECTION))){ new CheckUpdates(this, false){
@Override @Override
protected void onPostExecute(Void v) { protected void onPostExecute(Void v) {
super.onPostExecute(v); super.onPostExecute(v);

View File

@ -58,7 +58,7 @@ public class CheckUpdates extends ParallelTask<Void, Void, Void> {
Intent intent = new Intent(magiskManager, SplashActivity.class); Intent intent = new Intent(magiskManager, SplashActivity.class);
intent.putExtra(MainActivity.SECTION, "install"); intent.putExtra(MainActivity.SECTION, "install");
TaskStackBuilder stackBuilder = TaskStackBuilder.create(magiskManager); TaskStackBuilder stackBuilder = TaskStackBuilder.create(magiskManager);
stackBuilder.addParentStack(MainActivity.class); stackBuilder.addParentStack(SplashActivity.class);
stackBuilder.addNextIntent(intent); stackBuilder.addNextIntent(intent);
PendingIntent pendingIntent = stackBuilder.getPendingIntent(NOTIFICATION_ID, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent pendingIntent = stackBuilder.getPendingIntent(NOTIFICATION_ID, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pendingIntent); builder.setContentIntent(pendingIntent);

View File

@ -42,7 +42,7 @@
<string name="keep_dm_verity">保留 dm-verity</string> <string name="keep_dm_verity">保留 dm-verity</string>
<string name="current_magisk_title">已安裝 Magisk 版本v%1$s</string> <string name="current_magisk_title">已安裝 Magisk 版本v%1$s</string>
<string name="install_magisk_title">最新的 Magisk 版本v%1$.1f</string> <string name="install_magisk_title">最新的 Magisk 版本v%1$.1f</string>
<string name="uninstall">卸載</string> <string name="uninstall">解除安裝</string>
<string name="reboot_countdown">將在 %1$d 後重啟</string> <string name="reboot_countdown">將在 %1$d 後重啟</string>
<!--Module Fragment--> <!--Module Fragment-->
@ -104,7 +104,7 @@
<string name="no_magisk_msg">你想要下載並安裝 Magisk 嗎?</string> <string name="no_magisk_msg">你想要下載並安裝 Magisk 嗎?</string>
<string name="downloading_toast">正在下載 %1$s</string> <string name="downloading_toast">正在下載 %1$s</string>
<string name="magisk_update_title">Magisk 可更新!</string> <string name="magisk_update_title">Magisk 可更新!</string>
<string name="settings_reboot_toast">勾選此項以啟用對所有 shell 命令及輸出的日誌記錄</string> <string name="settings_reboot_toast">重啟以完成設定</string>
<string name="release_notes">發布說明</string> <string name="release_notes">發布說明</string>
<string name="repo_cache_cleared">資源庫暫存已清除</string> <string name="repo_cache_cleared">資源庫暫存已清除</string>
<string name="safetyNet_hide_notice">此應用使用了 SafetyNet\n已默認由 MagiskHide 處理</string> <string name="safetyNet_hide_notice">此應用使用了 SafetyNet\n已默認由 MagiskHide 處理</string>
@ -186,5 +186,7 @@
<string name="process_error">處裡失敗</string> <string name="process_error">處裡失敗</string>
<string name="download">下載</string> <string name="download">下載</string>
<string name="zip_process_title">處理中</string> <string name="zip_process_title">處理中</string>
<string name="uninstall_magisk_title">解除安裝 Magisk</string>
<string name="uninstall_magisk_msg">這將會刪除所有模組MagiskSU並有可能在目前未加密的情況下加密的的資料\n你確定要繼續嗎</string>
</resources> </resources>

View File

@ -47,6 +47,8 @@
<string name="install_magisk_title">Latest Magisk Version: v%1$.1f</string> <string name="install_magisk_title">Latest Magisk Version: v%1$.1f</string>
<string name="uninstall">Uninstall</string> <string name="uninstall">Uninstall</string>
<string name="reboot_countdown">Rebooting in %1$d</string> <string name="reboot_countdown">Rebooting in %1$d</string>
<string name="uninstall_magisk_title">Uninstall Magisk</string>
<string name="uninstall_magisk_msg">This will remove all modules, MagiskSU, and potentially encrypt your data if not encrypted\nAre you sure to continue?</string>
<!--Module Fragment--> <!--Module Fragment-->
<string name="no_info_provided">(No info provided)</string> <string name="no_info_provided">(No info provided)</string>