diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java index 7064b1e..f2e1ad5 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java @@ -419,8 +419,10 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe pagePos = pos; saveLastChapterReadPosition(); } - screenOffTimerStart(); - initMenu(); + mHandler.post(()->{ + screenOffTimerStart(); + initMenu(); + }); recordReadTime(); if (ReadAloudService.running) { if (mPageLoader.hasChapterData(mChapters.get(mPageLoader.getChapterPos()))) { diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java index 6dccc43..9baa6d9 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.java @@ -114,6 +114,7 @@ public class SearchBookActivity extends BaseActivity { private boolean foldBookcase; private boolean foldSuggest; private boolean foldHistory; + private boolean needReGetHistory; @Override protected void bindView() { @@ -150,6 +151,7 @@ public class SearchBookActivity extends BaseActivity { foldBookcase = SharedPreUtils.getInstance().getBoolean("foldBookcase"); foldSuggest = SharedPreUtils.getInstance().getBoolean("foldSuggest"); foldHistory = SharedPreUtils.getInstance().getBoolean("foldHistory"); + needReGetHistory = true; searchEngine = new SearchEngine(); searchEngine.setOnSearchListener(new SearchEngine.OnSearchListener() { @Override @@ -317,6 +319,7 @@ public class SearchBookActivity extends BaseActivity { if (mCurHistories.get(pos) != null) { mSearchHistoryService.deleteHistory(mCurHistories.get(pos)); } + needReGetHistory = true; initHistoryList(); } }); @@ -584,7 +587,8 @@ public class SearchBookActivity extends BaseActivity { hisDis.dispose(); } Single.create((SingleOnSubscribe) emitter -> { - mSearchHistories = mSearchHistoryService.findAllSearchHistory(); + if (needReGetHistory) + mSearchHistories = mSearchHistoryService.findAllSearchHistory(); mHistoryNames.clear(); mCurHistories.clear(); if (mSearchHistories == null || mSearchHistories.size() == 0) { @@ -750,6 +754,7 @@ public class SearchBookActivity extends BaseActivity { binding.fabSearchStop.setVisibility(View.VISIBLE); getData(); mSearchHistoryService.addOrUpadteHistory(searchKey); + needReGetHistory = true; //收起软键盘 InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(binding.etSearchKey.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);