mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-26 23:27:55 +03:00
#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:
parent
f13ff681b9
commit
834930981a
3 changed files with 6 additions and 6 deletions
|
@ -114,6 +114,7 @@ public class NoteEditFragment extends SearchableBaseNoteFragment {
|
|||
|
||||
@Override
|
||||
protected Layout getLayout() {
|
||||
editContent.onPreDraw();
|
||||
return editContent.getLayout();
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ public class NotePreviewFragment extends SearchableBaseNoteFragment {
|
|||
|
||||
@Override
|
||||
protected Layout getLayout() {
|
||||
noteContent.onPreDraw();
|
||||
return noteContent.getLayout();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue