修复MIUI13阅读界面切换日夜间闪退的问题

master
fengyuecanzhu 3 years ago
parent 5eb19128c9
commit 6c723feb27
  1. 9
      app/src/main/java/xyz/fycz/myreader/base/BaseActivity.java
  2. 20
      app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java

@ -41,7 +41,6 @@ public abstract class BaseActivity extends SwipeBackActivity {
protected Toolbar mToolbar;
private int curNightMode;
/****************************abstract area*************************************/
/**
* 绑定视图
@ -154,9 +153,6 @@ public abstract class BaseActivity extends SwipeBackActivity {
@Override
protected void onResume() {
super.onResume();
if (isThemeChange()) {
recreate();
}
}
@Override
@ -174,17 +170,12 @@ public abstract class BaseActivity extends SwipeBackActivity {
public void initTheme() {
//if (isNightTheme()) {
//setTheme(R.style.AppNightTheme);
curNightMode = AppCompatDelegate.getDefaultNightMode();
/*} else {
//curNightMode = false;
//setTheme(R.style.AppDayTheme);
}*/
}
protected boolean isThemeChange() {
return curNightMode != AppCompatDelegate.getDefaultNightMode();
}
/**************************used method area*******************************************/
protected void startActivity(Class<? extends AppCompatActivity> activity) {

@ -653,6 +653,7 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
}
}
, (dialog, which) -> {
isCollected = false;
mBookService.deleteBookById(mBook.getId());
exit();
});
@ -1392,13 +1393,28 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
private void changeNightAndDaySetting(boolean isNight) {
mSetting.setDayStyle(!isNight);
SysManager.saveSetting(mSetting);
App.getApplication().setNightTheme(isNight);
toggleMenu(true);
mHandler.postDelayed(() -> {
Intent intent = new Intent(this, ReadActivity.class);
if (aBooks != null) {
intent.putExtra(APPCONST.SOURCE_INDEX, mSourceDialog.getSourceIndex());
BitIntentDataManager.getInstance().putData(intent, aBooks);
} else {
BitIntentDataManager.getInstance().putData(intent, mBook);
}
if (!isCollected) {
intent.putExtra("isCollected", false);
}
exit();
App.getApplication().setNightTheme(isNight);
startActivity(intent);
}, mBottomOutAnim.getDuration());
/*mHandler.postDelayed(() -> {
AppCompatActivity activity = ActivityManage.getByClass(this.getClass());
if (activity != null) {
BaseDialog.initActivityContext(activity);
}
}, 1000);
}, 1000);*/
//mPageLoader.setPageStyle(!isCurDayStyle);
}

Loading…
Cancel
Save