Merge "Fix focus issues in directory fragment * Empty directory view gets focus when shown * Skip opening drawer when showing empty search results * Fix typo" into nyc-dev
diff --git a/packages/DocumentsUI/res/layout/fragment_directory.xml b/packages/DocumentsUI/res/layout/fragment_directory.xml
index 0fb74e5..0d336f9 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">
<LinearLayout
diff --git a/packages/DocumentsUI/src/com/android/documentsui/State.java b/packages/DocumentsUI/src/com/android/documentsui/State.java
index 139fb45..7dca8a7 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/State.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/State.java
@@ -153,7 +153,7 @@
return mStackTouched;
}
- public boolean initialiLocationHasChanged() {
+ public boolean initialLocationHasChanged() {
return mInitialRootChanged || mInitialDocChanged;
}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java
index f8735b2..4233b36 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DirectoryFragment.java
@@ -889,12 +889,14 @@
imageView.setImageResource(drawable);
mEmptyView.setVisibility(View.VISIBLE);
+ mEmptyView.requestFocus();
mRecView.setVisibility(View.GONE);
}
private void showDirectory() {
mEmptyView.setVisibility(View.GONE);
mRecView.setVisibility(View.VISIBLE);
+ mRecView.requestFocus();
}
private String findCommonMimeType(List<String> mimeTypes) {
diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/FragmentTuner.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/FragmentTuner.java
index 3f51e538..a9b0fd1 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 @@
@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.