Fix theme changing glitch

This commit is contained in:
topjohnwu 2017-05-24 00:37:15 +08:00
parent 31cc008249
commit 67c139a04b
2 changed files with 28 additions and 36 deletions

View File

@ -47,7 +47,8 @@ import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
public class MagiskFragment extends Fragment implements CallbackEvent.Listener<Void> {
public class MagiskFragment extends Fragment
implements CallbackEvent.Listener<Void>, SwipeRefreshLayout.OnRefreshListener {
private static boolean noDialog = false;
private static int expandHeight = 0;
@ -226,7 +227,26 @@ public class MagiskFragment extends Fragment implements CallbackEvent.Listener<V
});
mSwipeRefreshLayout.setOnRefreshListener(() -> {
mSwipeRefreshLayout.setOnRefreshListener(this);
if (magiskManager.magiskVersionCode < 0 && Shell.rootAccess() && !noDialog) {
noDialog = true;
new AlertDialogBuilder(getActivity())
.setTitle(R.string.no_magisk_title)
.setMessage(R.string.no_magisk_msg)
.setCancelable(true)
.setPositiveButton(R.string.goto_install, (d, i) -> {})
.setNegativeButton(R.string.no_thanks, null)
.show();
}
updateUI();
return v;
}
@Override
public void onRefresh() {
updateUI();
magiskUpdateText.setText(R.string.checking_for_updates);
@ -248,22 +268,6 @@ public class MagiskFragment extends Fragment implements CallbackEvent.Listener<V
} else {
mSwipeRefreshLayout.setRefreshing(false);
}
});
if (magiskManager.magiskVersionCode < 0 && Shell.rootAccess() && !noDialog) {
noDialog = true;
new AlertDialogBuilder(getActivity())
.setTitle(R.string.no_magisk_title)
.setMessage(R.string.no_magisk_msg)
.setCancelable(true)
.setPositiveButton(R.string.goto_install, (d, i) -> {})
.setNegativeButton(R.string.no_thanks, null)
.show();
}
updateUI();
return v;
}
@Override

View File

@ -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);