From 0af297735cd52da43763fa1419e355872b5b86f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey=20Vilas?= Date: Tue, 15 Mar 2022 18:43:27 +0100 Subject: [PATCH] ExtendedListFragment: Remove ViewTreeObserver on search frame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was incorrectly setting empty message when switching search types. And it makes no sense: search is only executed when submitted. Signed-off-by: Álvaro Brey Vilas --- .../ui/fragment/ExtendedListFragment.java | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java index 8478fd70d9..363e8b2b67 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java @@ -235,38 +235,6 @@ public class ExtendedListFragment extends Fragment implements } }); - final View mSearchEditFrame = searchView - .findViewById(androidx.appcompat.R.id.search_edit_frame); - - ViewTreeObserver vto = mSearchEditFrame.getViewTreeObserver(); - vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { - int oldVisibility = -1; - - @Override - public void onGlobalLayout() { - - int currentVisibility = mSearchEditFrame.getVisibility(); - - if (currentVisibility != oldVisibility) { - if (currentVisibility == View.VISIBLE) { - setEmptyListMessage(SearchType.REGULAR_FILTER); - } else { - if (MainApp.isOnlyOnDevice()) { - setMessageForEmptyList(R.string.file_list_empty_headline, - R.string.file_list_empty_on_device, - R.drawable.ic_list_empty_folder, - true); - } else { - setEmptyListMessage(SearchType.NO_SEARCH); - } - } - - oldVisibility = currentVisibility; - } - - } - }); - LinearLayout searchBar = searchView.findViewById(R.id.search_bar); searchBar.setLayoutTransition(new LayoutTransition()); }