#550 In-note-search doesn't jump to occurrence of searchstring

- Keep coloring and occurrences when switching between edit and preview mode
This commit is contained in:
stefan-niedermann 2020-01-23 12:52:41 +01:00
parent f13ff681b9
commit 834930981a
3 changed files with 6 additions and 6 deletions

View file

@ -114,6 +114,7 @@ public class NoteEditFragment extends SearchableBaseNoteFragment {
@Override
protected Layout getLayout() {
editContent.onPreDraw();
return editContent.getLayout();
}

View file

@ -96,6 +96,7 @@ public class NotePreviewFragment extends SearchableBaseNoteFragment {
@Override
protected Layout getLayout() {
noteContent.onPreDraw();
return noteContent.getLayout();
}

View file

@ -34,11 +34,6 @@ public abstract class SearchableBaseNoteFragment extends BaseNoteFragment {
if (savedInstanceState != null) {
searchQuery = savedInstanceState.getString("searchQuery", "");
currentOccurrence = savedInstanceState.getInt("currentOccurrence", 1);
// TODO if search is open
if (searchView != null && !TextUtils.isEmpty(searchView.getQuery().toString())) {
colorWithText(searchQuery);
jumpToOccurrence();
}
}
}
@ -74,6 +69,9 @@ public abstract class SearchableBaseNoteFragment extends BaseNoteFragment {
searchQuery = "";
hideSearchFabs();
} else {
jumpToOccurrence();
colorWithText(searchQuery);
occurrenceCount = countOccurrences(getContent(), searchQuery);
showSearchFabs();
}
@ -111,7 +109,6 @@ public abstract class SearchableBaseNoteFragment extends BaseNoteFragment {
@Override
public boolean onQueryTextChange(String newText) {
searchQuery = newText;
colorWithText(newText);
occurrenceCount = countOccurrences(getContent(), searchQuery);
if (occurrenceCount > 1) {
showSearchFabs();
@ -120,6 +117,7 @@ public abstract class SearchableBaseNoteFragment extends BaseNoteFragment {
}
currentOccurrence = 1;
jumpToOccurrence();
colorWithText(searchQuery);
return true;
}
});