From 67c139a04b0f527a49a6bb42f42014cc0f862352 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 24 May 2017 00:37:15 +0800 Subject: [PATCH] Fix theme changing glitch --- .../com/topjohnwu/magisk/MagiskFragment.java | 52 ++++++++++--------- .../com/topjohnwu/magisk/MainActivity.java | 12 ----- 2 files changed, 28 insertions(+), 36 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java b/app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java index b364161ed..ec3389afa 100644 --- a/app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java @@ -47,7 +47,8 @@ import butterknife.ButterKnife; import butterknife.OnClick; import butterknife.Unbinder; -public class MagiskFragment extends Fragment implements CallbackEvent.Listener { +public class MagiskFragment extends Fragment + implements CallbackEvent.Listener, SwipeRefreshLayout.OnRefreshListener { private static boolean noDialog = false; private static int expandHeight = 0; @@ -226,29 +227,7 @@ public class MagiskFragment extends Fragment implements CallbackEvent.Listener { - updateUI(); - - magiskUpdateText.setText(R.string.checking_for_updates); - magiskUpdateProgress.setVisibility(View.VISIBLE); - magiskUpdateIcon.setVisibility(View.GONE); - - safetyNetStatusText.setText(R.string.safetyNet_check_text); - - magiskManager.safetyNetDone.isTriggered = false; - magiskManager.updateCheckDone.isTriggered = false; - magiskManager.remoteMagiskVersionString = null; - magiskManager.remoteMagiskVersionCode = -1; - collapse(); - noDialog = false; - - // Trigger state check - if (Utils.checkNetworkStatus(magiskManager)) { - new CheckUpdates(getActivity()).exec(); - } else { - mSwipeRefreshLayout.setRefreshing(false); - } - }); + mSwipeRefreshLayout.setOnRefreshListener(this); if (magiskManager.magiskVersionCode < 0 && Shell.rootAccess() && !noDialog) { noDialog = true; @@ -266,6 +245,31 @@ public class MagiskFragment extends Fragment implements CallbackEvent.Listener event) { if (event == magiskManager.updateCheckDone) { diff --git a/app/src/main/java/com/topjohnwu/magisk/MainActivity.java b/app/src/main/java/com/topjohnwu/magisk/MainActivity.java index 06afeb1e2..edbb1de62 100644 --- a/app/src/main/java/com/topjohnwu/magisk/MainActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/MainActivity.java @@ -91,18 +91,6 @@ public class MainActivity extends Activity checkHideSection(); } - @Override - protected void onRestoreInstanceState(Bundle savedInstanceState) { - super.onRestoreInstanceState(savedInstanceState); - navigate(savedInstanceState.getInt(MagiskManager.INTENT_SECTION, R.id.magisk)); - } - - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putInt(MagiskManager.INTENT_SECTION, mDrawerItem); - } - @Override protected void onDestroy() { getApplicationContext().reloadMainActivity.unRegister(this);