From d4b17531701c13b77793ac5566978d4bc3056b89 Mon Sep 17 00:00:00 2001 From: Aga Wronska Date: Fri, 12 Feb 2016 09:15:32 -0800 Subject: [PATCH] Fix focus issues in directory fragment * Empty directory view gets focus when shown * Skip opening drawer when showing empty search results * Fix typo Bug: 27109140 Change-Id: Ie62d48e1c3f78e5244d88067587b3e5986f99a03 --- packages/DocumentsUI/res/layout/fragment_directory.xml | 2 ++ packages/DocumentsUI/src/com/android/documentsui/State.java | 2 +- .../com/android/documentsui/dirlist/DirectoryFragment.java | 2 ++ .../src/com/android/documentsui/dirlist/FragmentTuner.java | 5 +++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/DocumentsUI/res/layout/fragment_directory.xml b/packages/DocumentsUI/res/layout/fragment_directory.xml index 0fb74e5eca346..0d336f91ee3a3 100644 --- a/packages/DocumentsUI/res/layout/fragment_directory.xml +++ b/packages/DocumentsUI/res/layout/fragment_directory.xml @@ -46,6 +46,8 @@ android:layout_height="match_parent" android:orientation="vertical" android:background="@color/window_background" + android:focusable="true" + android:focusableInTouchMode="true" android:visibility="gone"> mimeTypes) { diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/FragmentTuner.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/FragmentTuner.java index 3f51e538a2636..a9b0fd181d8bc 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/FragmentTuner.java +++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/FragmentTuner.java @@ -249,9 +249,10 @@ public abstract class FragmentTuner { @Override void onModelLoaded(Model model, @ResultType int resultType) { - if (DEBUG) Log.d(TAG, "Handling model loaded. Has Location shcnage: " + mState.initialiLocationHasChanged()); + if (DEBUG) Log.d(TAG, "Handling model loaded. Has Location shcnage: " + mState.initialLocationHasChanged()); // When launched into empty root, open drawer. - if (model.isEmpty() && !mState.initialiLocationHasChanged()) { + if (model.isEmpty() && !mState.initialLocationHasChanged() + && resultType != DirectoryFragment.TYPE_SEARCH) { if (DEBUG) Log.d(TAG, "Showing roots drawer cuz stuffs empty."); // This noops on layouts without drawer, so no need to guard.