Loading packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java +3 −29 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ public class DocumentsActivity extends BaseActivity { } if (mState.restored) { refreshCurrentRootAndDirectory(ANIM_NONE); if (DEBUG) Log.d(TAG, "Stack already resolved"); } else { // We set the activity title in AsyncTask.onPostExecute(). // To prevent talkback from reading aloud the default title, we clear it here. Loading @@ -108,9 +108,7 @@ public class DocumentsActivity extends BaseActivity { // we restore the stack as last used from that app. if (mState.action == ACTION_PICK_COPY_DESTINATION) { if (DEBUG) Log.d(TAG, "Launching directly into Home directory."); Uri homeUri = DocumentsContract.buildHomeUri(); new LoadRootTask(this, homeUri).executeOnExecutor( ProviderExecutor.forAuthority(homeUri.getAuthority())); loadRoot(DocumentsContract.buildHomeUri()); } else { if (DEBUG) Log.d(TAG, "Attempting to load last used stack for calling package."); new LoadLastUsedStackTask(this).execute(); Loading Loading @@ -156,30 +154,6 @@ public class DocumentsActivity extends BaseActivity { } } private void onStackRestored(boolean restored, boolean external) { // Show drawer when no stack restored, but only when requesting // non-visual content. However, if we last used an external app, // drawer is always shown. boolean showDrawer = false; if (!restored) { showDrawer = true; } if (MimePredicate.mimeMatches(MimePredicate.VISUAL_MIMES, mState.acceptMimes)) { showDrawer = false; } if (external && mState.action == ACTION_GET_CONTENT) { showDrawer = true; } if (mState.action == ACTION_PICK_COPY_DESTINATION) { showDrawer = true; } if (showDrawer) { mNavigator.revealRootsDrawer(true); } } public void onAppPicked(ResolveInfo info) { final Intent intent = new Intent(getIntent()); intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_FORWARD_RESULT); Loading Loading @@ -517,8 +491,8 @@ public class DocumentsActivity extends BaseActivity { @Override protected void finish(Void result) { mState.restored = true; mState.external = mExternal; mOwner.refreshCurrentRootAndDirectory(ANIM_NONE); mOwner.onStackRestored(mRestoredStack, mExternal); } } Loading packages/DocumentsUI/src/com/android/documentsui/State.java +6 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,10 @@ public class State implements android.os.Parcelable { public boolean showSize; public boolean localOnly; public boolean restored; /* * Indicates handler was an external app, like photos. */ public boolean external; // Indicates that a copy operation (or move) includes a directory. // Why? Directory creation isn't supported by some roots (like Downloads). Loading Loading @@ -182,6 +186,7 @@ public class State implements android.os.Parcelable { out.writeInt(showSize ? 1 : 0); out.writeInt(localOnly ? 1 : 0); out.writeInt(restored ? 1 : 0); out.writeInt(external ? 1 : 0); DurableUtils.writeToParcel(out, stack); out.writeMap(dirState); out.writeParcelable(selectedDocuments, 0); Loading Loading @@ -210,6 +215,7 @@ public class State implements android.os.Parcelable { state.showSize = in.readInt() != 0; state.localOnly = in.readInt() != 0; state.restored = in.readInt() != 0; state.external = in.readInt() != 0; DurableUtils.readFromParcel(in, state.stack); in.readMap(state.dirState, loader); state.selectedDocuments = in.readParcelable(loader); Loading packages/DocumentsUI/src/com/android/documentsui/dirlist/FragmentTuner.java +21 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.android.documentsui.State.ACTION_CREATE; import static com.android.documentsui.State.ACTION_GET_CONTENT; import static com.android.documentsui.State.ACTION_OPEN; import static com.android.documentsui.State.ACTION_OPEN_TREE; import static com.android.documentsui.State.ACTION_PICK_COPY_DESTINATION; import android.content.Context; import android.provider.DocumentsContract.Document; Loading Loading @@ -154,8 +155,27 @@ public abstract class FragmentTuner { @Override void onModelLoaded(Model model, @ResultType int resultType, boolean isSearch) { boolean showDrawer = false; if (mState.restored) { showDrawer = true; } if (MimePredicate.mimeMatches(MimePredicate.VISUAL_MIMES, mState.acceptMimes)) { showDrawer = false; } if (mState.external && mState.action == ACTION_GET_CONTENT) { showDrawer = true; } if (mState.action == ACTION_PICK_COPY_DESTINATION) { showDrawer = true; } // When launched into empty root, open drawer. if (model.isEmpty() && !mState.hasInitialLocationChanged() && !isSearch) { if (model.isEmpty()) { showDrawer = true; } if (showDrawer && !mState.hasInitialLocationChanged() && !isSearch) { // This noops on layouts without drawer, so no need to guard. ((BaseActivity) mContext).setRootsDrawerOpen(true); } Loading Loading
packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java +3 −29 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ public class DocumentsActivity extends BaseActivity { } if (mState.restored) { refreshCurrentRootAndDirectory(ANIM_NONE); if (DEBUG) Log.d(TAG, "Stack already resolved"); } else { // We set the activity title in AsyncTask.onPostExecute(). // To prevent talkback from reading aloud the default title, we clear it here. Loading @@ -108,9 +108,7 @@ public class DocumentsActivity extends BaseActivity { // we restore the stack as last used from that app. if (mState.action == ACTION_PICK_COPY_DESTINATION) { if (DEBUG) Log.d(TAG, "Launching directly into Home directory."); Uri homeUri = DocumentsContract.buildHomeUri(); new LoadRootTask(this, homeUri).executeOnExecutor( ProviderExecutor.forAuthority(homeUri.getAuthority())); loadRoot(DocumentsContract.buildHomeUri()); } else { if (DEBUG) Log.d(TAG, "Attempting to load last used stack for calling package."); new LoadLastUsedStackTask(this).execute(); Loading Loading @@ -156,30 +154,6 @@ public class DocumentsActivity extends BaseActivity { } } private void onStackRestored(boolean restored, boolean external) { // Show drawer when no stack restored, but only when requesting // non-visual content. However, if we last used an external app, // drawer is always shown. boolean showDrawer = false; if (!restored) { showDrawer = true; } if (MimePredicate.mimeMatches(MimePredicate.VISUAL_MIMES, mState.acceptMimes)) { showDrawer = false; } if (external && mState.action == ACTION_GET_CONTENT) { showDrawer = true; } if (mState.action == ACTION_PICK_COPY_DESTINATION) { showDrawer = true; } if (showDrawer) { mNavigator.revealRootsDrawer(true); } } public void onAppPicked(ResolveInfo info) { final Intent intent = new Intent(getIntent()); intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_FORWARD_RESULT); Loading Loading @@ -517,8 +491,8 @@ public class DocumentsActivity extends BaseActivity { @Override protected void finish(Void result) { mState.restored = true; mState.external = mExternal; mOwner.refreshCurrentRootAndDirectory(ANIM_NONE); mOwner.onStackRestored(mRestoredStack, mExternal); } } Loading
packages/DocumentsUI/src/com/android/documentsui/State.java +6 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,10 @@ public class State implements android.os.Parcelable { public boolean showSize; public boolean localOnly; public boolean restored; /* * Indicates handler was an external app, like photos. */ public boolean external; // Indicates that a copy operation (or move) includes a directory. // Why? Directory creation isn't supported by some roots (like Downloads). Loading Loading @@ -182,6 +186,7 @@ public class State implements android.os.Parcelable { out.writeInt(showSize ? 1 : 0); out.writeInt(localOnly ? 1 : 0); out.writeInt(restored ? 1 : 0); out.writeInt(external ? 1 : 0); DurableUtils.writeToParcel(out, stack); out.writeMap(dirState); out.writeParcelable(selectedDocuments, 0); Loading Loading @@ -210,6 +215,7 @@ public class State implements android.os.Parcelable { state.showSize = in.readInt() != 0; state.localOnly = in.readInt() != 0; state.restored = in.readInt() != 0; state.external = in.readInt() != 0; DurableUtils.readFromParcel(in, state.stack); in.readMap(state.dirState, loader); state.selectedDocuments = in.readParcelable(loader); Loading
packages/DocumentsUI/src/com/android/documentsui/dirlist/FragmentTuner.java +21 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.android.documentsui.State.ACTION_CREATE; import static com.android.documentsui.State.ACTION_GET_CONTENT; import static com.android.documentsui.State.ACTION_OPEN; import static com.android.documentsui.State.ACTION_OPEN_TREE; import static com.android.documentsui.State.ACTION_PICK_COPY_DESTINATION; import android.content.Context; import android.provider.DocumentsContract.Document; Loading Loading @@ -154,8 +155,27 @@ public abstract class FragmentTuner { @Override void onModelLoaded(Model model, @ResultType int resultType, boolean isSearch) { boolean showDrawer = false; if (mState.restored) { showDrawer = true; } if (MimePredicate.mimeMatches(MimePredicate.VISUAL_MIMES, mState.acceptMimes)) { showDrawer = false; } if (mState.external && mState.action == ACTION_GET_CONTENT) { showDrawer = true; } if (mState.action == ACTION_PICK_COPY_DESTINATION) { showDrawer = true; } // When launched into empty root, open drawer. if (model.isEmpty() && !mState.hasInitialLocationChanged() && !isSearch) { if (model.isEmpty()) { showDrawer = true; } if (showDrawer && !mState.hasInitialLocationChanged() && !isSearch) { // This noops on layouts without drawer, so no need to guard. ((BaseActivity) mContext).setRootsDrawerOpen(true); } Loading