804: Fixed prev and submit button in search

While doing searching, if the content is changed, the search result will NOT change. So if prev and submit are clicked, it may not give the correct respond.
This commit is contained in:
Mike Chester Wang 2020-04-23 23:56:35 +08:00 committed by GitHub
parent 117a3c8e24
commit 5bfb3ee70a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,6 +102,7 @@ public abstract class SearchableBaseNoteFragment extends BaseNoteFragment {
if (prev != null) {
prev.setOnClickListener(v -> {
occurrenceCount = countOccurrences(getContent(), searchView.getQuery().toString());
currentOccurrence--;
jumpToOccurrence();
colorWithText(searchView.getQuery().toString(), currentOccurrence);
@ -114,6 +115,7 @@ public abstract class SearchableBaseNoteFragment extends BaseNoteFragment {
@Override
public boolean onQueryTextSubmit(String query) {
colorWithText(query, currentOccurrence);
currentOccurrence++;
jumpToOccurrence();
return true;