From 525b59acdaa1f0f02f534cb2be3be2219e127224 Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Mon, 17 Jan 2022 15:52:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=97=E8=AF=BB=E5=88=B0?= =?UTF-8?q?=E7=AB=A0=E8=8A=82=E6=9C=80=E5=90=8E=E4=B8=80=E9=A1=B5=E6=97=B6?= =?UTF-8?q?=E5=81=9C=E6=AD=A2=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/xyz/fycz/myreader/ui/activity/ReadActivity.java | 6 ++++-- .../xyz/fycz/myreader/ui/activity/SearchBookActivity.java | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) 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);