diff options
3 files changed, 16 insertions, 3 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java index 4d410d5..1f3901c 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java +++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java @@ -295,6 +295,11 @@ public class DirectoryFragment extends Fragment { updateDisplayState(); + // When launched into empty recents, show drawer + if (mType == TYPE_RECENT_OPEN && mAdapter.isEmpty() && !state.stackTouched) { + ((DocumentsActivity) context).setRootsDrawerOpen(true); + } + // Restore any previous instance state final SparseArray<Parcelable> container = state.dirState.remove(mStateKey); if (container != null && !getArguments().getBoolean(EXTRA_IGNORE_STATE, false)) { diff --git a/packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java b/packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java index 3954173..05766f5 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java +++ b/packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java @@ -109,6 +109,11 @@ public class RecentsCreateFragment extends Fragment { public void onLoadFinished( Loader<List<DocumentStack>> loader, List<DocumentStack> data) { mAdapter.swapStacks(data); + + // When launched into empty recents, show drawer + if (mAdapter.isEmpty() && !state.stackTouched) { + ((DocumentsActivity) context).setRootsDrawerOpen(true); + } } @Override diff --git a/packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java b/packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java index 2fb12bb..fdbc3ab 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java +++ b/packages/DocumentsUI/src/com/android/documentsui/RootsFragment.java @@ -142,9 +142,12 @@ public class RootsFragment extends Fragment { final RootInfo root = ((DocumentsActivity) getActivity()).getCurrentRoot(); for (int i = 0; i < mAdapter.getCount(); i++) { final Object item = mAdapter.getItem(i); - if (Objects.equal(item, root)) { - mList.setItemChecked(i, true); - return; + if (item instanceof RootItem) { + final RootInfo testRoot = ((RootItem) item).root; + if (Objects.equal(testRoot, root)) { + mList.setItemChecked(i, true); + return; + } } } } |