From 44bcef5d780074c60abfef396fef0a7af13aa018 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Tue, 15 May 2018 11:04:56 +0200 Subject: [PATCH] Collapse search when needed Signed-off-by: Mario Danic --- .../owncloud/notes/android/fragment/NoteEditFragment.java | 2 ++ .../owncloud/notes/android/fragment/NotePreviewFragment.java | 2 ++ app/src/main/res/menu/menu_note_fragment.xml | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/NoteEditFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/NoteEditFragment.java index 705027f9..46c440e9 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/NoteEditFragment.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/NoteEditFragment.java @@ -119,6 +119,8 @@ public class NoteEditFragment extends BaseNoteFragment { } searchView.setQuery(searchQuery, true); searchView.clearFocus(); + } else { + searchMenuItem.collapseActionView(); } final LinearLayout searchEditFrame = searchView.findViewById(android.support.v7.appcompat.R.id diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/NotePreviewFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/NotePreviewFragment.java index 027e6242..23f06ffd 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/NotePreviewFragment.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/fragment/NotePreviewFragment.java @@ -65,6 +65,8 @@ public class NotePreviewFragment extends BaseNoteFragment { } searchView.setQuery(searchQuery, true); searchView.clearFocus(); + } else { + searchMenuItem.collapseActionView(); } final LinearLayout searchEditFrame = searchView.findViewById(android.support.v7.appcompat.R.id diff --git a/app/src/main/res/menu/menu_note_fragment.xml b/app/src/main/res/menu/menu_note_fragment.xml index 5afe0b57..9a5a9ada 100644 --- a/app/src/main/res/menu/menu_note_fragment.xml +++ b/app/src/main/res/menu/menu_note_fragment.xml @@ -6,8 +6,9 @@ android:id="@+id/search" android:title="@string/action_search" android:icon="@drawable/ic_search_white_24dp" + android:orderInCategory="70" app:actionViewClass="android.support.v7.widget.SearchView" - app:showAsAction="collapseActionView|always" /> + app:showAsAction="collapseActionView|ifRoom" />