修复朗读到章节最后一页时停止的bug

master
fengyuecanzhu 3 years ago
parent e82030a0bc
commit 525b59acda
  1. 6
      app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java
  2. 7
      app/src/main/java/xyz/fycz/myreader/ui/activity/SearchBookActivity.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()))) {

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

Loading…
Cancel
Save