Merge "Move State to a separate file."
This commit is contained in:
@@ -33,14 +33,11 @@ import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.DocumentsContract.Root;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@@ -67,7 +64,6 @@ import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
@@ -367,129 +363,6 @@ abstract class BaseActivity extends Activity {
|
||||
public static String EXTRA_DIRECTORY_COPY = "com.android.documentsui.DIRECTORY_COPY";
|
||||
}
|
||||
|
||||
public static class State implements android.os.Parcelable {
|
||||
public int action;
|
||||
public String[] acceptMimes;
|
||||
|
||||
/** Explicit user choice */
|
||||
public int userMode = MODE_UNKNOWN;
|
||||
/** Derived after loader */
|
||||
public int derivedMode = MODE_LIST;
|
||||
|
||||
/** Explicit user choice */
|
||||
public int userSortOrder = SORT_ORDER_UNKNOWN;
|
||||
/** Derived after loader */
|
||||
public int derivedSortOrder = SORT_ORDER_DISPLAY_NAME;
|
||||
|
||||
public boolean allowMultiple;
|
||||
public boolean forceSize ;
|
||||
public boolean showSize;
|
||||
public boolean localOnly ;
|
||||
public boolean forceAdvanced ;
|
||||
public boolean showAdvanced ;
|
||||
public boolean stackTouched ;
|
||||
public boolean restored ;
|
||||
public boolean directoryCopy ;
|
||||
/** Transfer mode for file copy/move operations. */
|
||||
public int transferMode;
|
||||
|
||||
/** Current user navigation stack; empty implies recents. */
|
||||
public DocumentStack stack = new DocumentStack();
|
||||
/** Currently active search, overriding any stack. */
|
||||
public String currentSearch;
|
||||
|
||||
/** Instance state for every shown directory */
|
||||
public HashMap<String, SparseArray<Parcelable>> dirState = new HashMap<>();
|
||||
|
||||
/** Currently copying file */
|
||||
public List<DocumentInfo> selectedDocumentsForCopy = new ArrayList<DocumentInfo>();
|
||||
|
||||
/** Name of the package that started DocsUI */
|
||||
public List<String> excludedAuthorities = new ArrayList<>();
|
||||
|
||||
public static final int ACTION_OPEN = 1;
|
||||
public static final int ACTION_CREATE = 2;
|
||||
public static final int ACTION_GET_CONTENT = 3;
|
||||
public static final int ACTION_OPEN_TREE = 4;
|
||||
public static final int ACTION_MANAGE = 5;
|
||||
public static final int ACTION_BROWSE = 6;
|
||||
public static final int ACTION_OPEN_COPY_DESTINATION = 8;
|
||||
|
||||
public static final int MODE_UNKNOWN = 0;
|
||||
public static final int MODE_LIST = 1;
|
||||
public static final int MODE_GRID = 2;
|
||||
|
||||
public static final int SORT_ORDER_UNKNOWN = 0;
|
||||
public static final int SORT_ORDER_DISPLAY_NAME = 1;
|
||||
public static final int SORT_ORDER_LAST_MODIFIED = 2;
|
||||
public static final int SORT_ORDER_SIZE = 3;
|
||||
|
||||
public void initAcceptMimes(Intent intent) {
|
||||
if (intent.hasExtra(Intent.EXTRA_MIME_TYPES)) {
|
||||
acceptMimes = intent.getStringArrayExtra(Intent.EXTRA_MIME_TYPES);
|
||||
} else {
|
||||
String glob = intent.getType();
|
||||
acceptMimes = new String[] { glob != null ? glob : "*/*" };
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeInt(action);
|
||||
out.writeInt(userMode);
|
||||
out.writeStringArray(acceptMimes);
|
||||
out.writeInt(userSortOrder);
|
||||
out.writeInt(allowMultiple ? 1 : 0);
|
||||
out.writeInt(forceSize ? 1 : 0);
|
||||
out.writeInt(showSize ? 1 : 0);
|
||||
out.writeInt(localOnly ? 1 : 0);
|
||||
out.writeInt(forceAdvanced ? 1 : 0);
|
||||
out.writeInt(showAdvanced ? 1 : 0);
|
||||
out.writeInt(stackTouched ? 1 : 0);
|
||||
out.writeInt(restored ? 1 : 0);
|
||||
DurableUtils.writeToParcel(out, stack);
|
||||
out.writeString(currentSearch);
|
||||
out.writeMap(dirState);
|
||||
out.writeList(selectedDocumentsForCopy);
|
||||
out.writeList(excludedAuthorities);
|
||||
}
|
||||
|
||||
public static final Creator<State> CREATOR = new Creator<State>() {
|
||||
@Override
|
||||
public State createFromParcel(Parcel in) {
|
||||
final State state = new State();
|
||||
state.action = in.readInt();
|
||||
state.userMode = in.readInt();
|
||||
state.acceptMimes = in.readStringArray();
|
||||
state.userSortOrder = in.readInt();
|
||||
state.allowMultiple = in.readInt() != 0;
|
||||
state.forceSize = in.readInt() != 0;
|
||||
state.showSize = in.readInt() != 0;
|
||||
state.localOnly = in.readInt() != 0;
|
||||
state.forceAdvanced = in.readInt() != 0;
|
||||
state.showAdvanced = in.readInt() != 0;
|
||||
state.stackTouched = in.readInt() != 0;
|
||||
state.restored = in.readInt() != 0;
|
||||
DurableUtils.readFromParcel(in, state.stack);
|
||||
state.currentSearch = in.readString();
|
||||
in.readMap(state.dirState, null);
|
||||
in.readList(state.selectedDocumentsForCopy, null);
|
||||
in.readList(state.excludedAuthorities, null);
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public State[] newArray(int size) {
|
||||
return new State[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void setDisplayAdvancedDevices(boolean display) {
|
||||
State state = getDisplayState();
|
||||
LocalPreferences.setDisplayAdvancedDevices(this, display);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.documentsui;
|
||||
|
||||
import static com.android.documentsui.Shared.DEBUG;
|
||||
import static com.android.documentsui.model.DocumentInfo.getCursorLong;
|
||||
import static com.android.documentsui.model.DocumentInfo.getCursorString;
|
||||
|
||||
@@ -56,7 +57,6 @@ import java.util.Objects;
|
||||
|
||||
public class CopyService extends IntentService {
|
||||
public static final String TAG = "CopyService";
|
||||
public static final boolean DEBUG = false;
|
||||
|
||||
private static final String EXTRA_CANCEL = "com.android.documentsui.CANCEL";
|
||||
public static final String EXTRA_SRC_LIST = "com.android.documentsui.SRC_LIST";
|
||||
|
||||
@@ -16,14 +16,15 @@
|
||||
|
||||
package com.android.documentsui;
|
||||
|
||||
import static com.android.documentsui.BaseActivity.State.ACTION_BROWSE;
|
||||
import static com.android.documentsui.BaseActivity.State.ACTION_CREATE;
|
||||
import static com.android.documentsui.BaseActivity.State.ACTION_MANAGE;
|
||||
import static com.android.documentsui.BaseActivity.State.MODE_GRID;
|
||||
import static com.android.documentsui.BaseActivity.State.MODE_LIST;
|
||||
import static com.android.documentsui.BaseActivity.State.MODE_UNKNOWN;
|
||||
import static com.android.documentsui.BaseActivity.State.SORT_ORDER_UNKNOWN;
|
||||
import static com.android.documentsui.Shared.DEBUG;
|
||||
import static com.android.documentsui.Shared.TAG;
|
||||
import static com.android.documentsui.State.ACTION_BROWSE;
|
||||
import static com.android.documentsui.State.ACTION_CREATE;
|
||||
import static com.android.documentsui.State.ACTION_MANAGE;
|
||||
import static com.android.documentsui.State.MODE_GRID;
|
||||
import static com.android.documentsui.State.MODE_LIST;
|
||||
import static com.android.documentsui.State.MODE_UNKNOWN;
|
||||
import static com.android.documentsui.State.SORT_ORDER_UNKNOWN;
|
||||
import static com.android.documentsui.model.DocumentInfo.getCursorInt;
|
||||
import static com.android.documentsui.model.DocumentInfo.getCursorLong;
|
||||
import static com.android.documentsui.model.DocumentInfo.getCursorString;
|
||||
@@ -93,7 +94,6 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.documentsui.BaseActivity.DocumentContext;
|
||||
import com.android.documentsui.BaseActivity.State;
|
||||
import com.android.documentsui.MultiSelectManager.Selection;
|
||||
import com.android.documentsui.ProviderExecutor.Preemptable;
|
||||
import com.android.documentsui.RecentsProvider.StateColumns;
|
||||
@@ -124,7 +124,6 @@ public class DirectoryFragment extends Fragment {
|
||||
public static final int REQUEST_COPY_DESTINATION = 1;
|
||||
|
||||
private static final int LOADER_ID = 42;
|
||||
private static final boolean DEBUG = false;
|
||||
private static final boolean DEBUG_ENABLE_DND = false;
|
||||
|
||||
private static final String EXTRA_TYPE = "type";
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package com.android.documentsui;
|
||||
|
||||
import static com.android.documentsui.BaseActivity.State.MODE_UNKNOWN;
|
||||
import static com.android.documentsui.BaseActivity.State.SORT_ORDER_DISPLAY_NAME;
|
||||
import static com.android.documentsui.BaseActivity.State.SORT_ORDER_LAST_MODIFIED;
|
||||
import static com.android.documentsui.BaseActivity.State.SORT_ORDER_SIZE;
|
||||
import static com.android.documentsui.BaseActivity.State.SORT_ORDER_UNKNOWN;
|
||||
import static com.android.documentsui.Shared.TAG;
|
||||
import static com.android.documentsui.State.MODE_UNKNOWN;
|
||||
import static com.android.documentsui.State.SORT_ORDER_DISPLAY_NAME;
|
||||
import static com.android.documentsui.State.SORT_ORDER_LAST_MODIFIED;
|
||||
import static com.android.documentsui.State.SORT_ORDER_SIZE;
|
||||
import static com.android.documentsui.State.SORT_ORDER_UNKNOWN;
|
||||
import static com.android.documentsui.model.DocumentInfo.getCursorInt;
|
||||
|
||||
import android.content.AsyncTaskLoader;
|
||||
@@ -37,7 +37,6 @@ import android.provider.DocumentsContract;
|
||||
import android.provider.DocumentsContract.Document;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.documentsui.BaseActivity.State;
|
||||
import com.android.documentsui.RecentsProvider.StateColumns;
|
||||
import com.android.documentsui.model.DocumentInfo;
|
||||
import com.android.documentsui.model.RootInfo;
|
||||
|
||||
@@ -16,13 +16,12 @@
|
||||
|
||||
package com.android.documentsui;
|
||||
|
||||
import static com.android.documentsui.BaseActivity.State.ACTION_CREATE;
|
||||
import static com.android.documentsui.BaseActivity.State.ACTION_GET_CONTENT;
|
||||
import static com.android.documentsui.BaseActivity.State.ACTION_OPEN;
|
||||
import static com.android.documentsui.BaseActivity.State.ACTION_OPEN_COPY_DESTINATION;
|
||||
import static com.android.documentsui.BaseActivity.State.ACTION_OPEN_TREE;
|
||||
import static com.android.documentsui.DirectoryFragment.ANIM_DOWN;
|
||||
import static com.android.documentsui.DirectoryFragment.ANIM_NONE;
|
||||
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_COPY_DESTINATION;
|
||||
import static com.android.documentsui.State.ACTION_OPEN_TREE;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
|
||||
@@ -222,7 +222,7 @@ public class IconUtils {
|
||||
return context.getDrawable(R.drawable.ic_doc_album);
|
||||
}
|
||||
|
||||
if (mode == BaseActivity.State.MODE_GRID) {
|
||||
if (mode == State.MODE_GRID) {
|
||||
return context.getDrawable(R.drawable.ic_grid_folder);
|
||||
} else {
|
||||
return context.getDrawable(R.drawable.ic_doc_folder);
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
package com.android.documentsui;
|
||||
|
||||
import static com.android.documentsui.BaseActivity.State.ACTION_MANAGE;
|
||||
import static com.android.documentsui.DirectoryFragment.ANIM_DOWN;
|
||||
import static com.android.documentsui.DirectoryFragment.ANIM_NONE;
|
||||
import static com.android.documentsui.State.ACTION_MANAGE;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
|
||||
@@ -21,7 +21,6 @@ import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -29,8 +28,6 @@ import android.widget.Button;
|
||||
|
||||
import com.android.documentsui.model.DocumentInfo;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Display pick confirmation bar, usually for selecting a directory.
|
||||
*/
|
||||
@@ -93,7 +90,7 @@ public class PickFragment extends Fragment {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param action Which action defined in BaseActivity.State is the picker shown for.
|
||||
* @param action Which action defined in State is the picker shown for.
|
||||
*/
|
||||
public void setPickTarget(int action, int transferMode, DocumentInfo pickTarget) {
|
||||
mAction = action;
|
||||
@@ -109,11 +106,11 @@ public class PickFragment extends Fragment {
|
||||
*/
|
||||
private void updateView() {
|
||||
switch (mAction) {
|
||||
case BaseActivity.State.ACTION_OPEN_TREE:
|
||||
case State.ACTION_OPEN_TREE:
|
||||
mPick.setText(R.string.button_select);
|
||||
mCancel.setVisibility(View.GONE);
|
||||
break;
|
||||
case BaseActivity.State.ACTION_OPEN_COPY_DESTINATION:
|
||||
case State.ACTION_OPEN_COPY_DESTINATION:
|
||||
mPick.setText(R.string.button_copy);
|
||||
mCancel.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
@@ -123,7 +120,7 @@ public class PickFragment extends Fragment {
|
||||
}
|
||||
|
||||
if (mPickTarget != null && (
|
||||
mAction == BaseActivity.State.ACTION_OPEN_TREE ||
|
||||
mAction == State.ACTION_OPEN_TREE ||
|
||||
mPickTarget.isCreateSupported())) {
|
||||
mContainer.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.documentsui;
|
||||
|
||||
import static com.android.documentsui.Shared.DEBUG;
|
||||
import static com.android.documentsui.Shared.TAG;
|
||||
import static com.android.documentsui.model.DocumentInfo.getCursorString;
|
||||
|
||||
import android.content.ClipData;
|
||||
@@ -38,9 +40,6 @@ import com.android.documentsui.model.DocumentInfo;
|
||||
*/
|
||||
final class QuickViewIntentBuilder {
|
||||
|
||||
private static final String TAG = "QvIntentBuilder";
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private final DocumentInfo mDocument;
|
||||
private final DocumentContext mContext;
|
||||
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
package com.android.documentsui;
|
||||
|
||||
import static com.android.documentsui.BaseActivity.State.SORT_ORDER_LAST_MODIFIED;
|
||||
import static com.android.documentsui.Shared.DEBUG;
|
||||
import static com.android.documentsui.Shared.TAG;
|
||||
import static com.android.documentsui.State.SORT_ORDER_LAST_MODIFIED;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.AsyncTaskLoader;
|
||||
@@ -34,7 +35,6 @@ import android.provider.DocumentsContract.Root;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.documentsui.BaseActivity.State;
|
||||
import com.android.documentsui.model.RootInfo;
|
||||
|
||||
import com.google.common.util.concurrent.AbstractFuture;
|
||||
@@ -53,8 +53,6 @@ import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class RecentLoader extends AsyncTaskLoader<DirectoryResult> {
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
// TODO: clean up cursor ownership so background thread doesn't traverse
|
||||
// previously returned cursors for filtering/sorting; this currently races
|
||||
// with the UI thread.
|
||||
|
||||
@@ -45,7 +45,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.documentsui.BaseActivity.State;
|
||||
import com.android.documentsui.RecentsProvider.RecentColumns;
|
||||
import com.android.documentsui.model.DocumentStack;
|
||||
import com.android.documentsui.model.DurableUtils;
|
||||
|
||||
@@ -39,6 +39,7 @@ import android.util.Log;
|
||||
import com.android.documentsui.model.DocumentStack;
|
||||
import com.android.documentsui.model.DurableUtils;
|
||||
import com.android.internal.util.Predicate;
|
||||
|
||||
import com.google.android.collect.Sets;
|
||||
|
||||
import libcore.io.IoUtils;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package com.android.documentsui;
|
||||
|
||||
import static com.android.documentsui.Shared.TAG;
|
||||
import static com.android.documentsui.Shared.DEBUG;
|
||||
import static com.android.documentsui.Shared.TAG;
|
||||
|
||||
import android.content.ContentProviderClient;
|
||||
import android.content.ContentResolver;
|
||||
@@ -35,12 +35,11 @@ import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.DocumentsContract.Root;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.documentsui.BaseActivity.State;
|
||||
import com.android.documentsui.model.RootInfo;
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
@@ -41,7 +41,6 @@ import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.documentsui.BaseActivity.State;
|
||||
import com.android.documentsui.model.DocumentInfo;
|
||||
import com.android.documentsui.model.RootInfo;
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.documentsui;
|
||||
import android.content.AsyncTaskLoader;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.documentsui.BaseActivity.State;
|
||||
import com.android.documentsui.model.RootInfo;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
package com.android.documentsui;
|
||||
|
||||
import static com.android.documentsui.BaseActivity.State.SORT_ORDER_DISPLAY_NAME;
|
||||
import static com.android.documentsui.BaseActivity.State.SORT_ORDER_LAST_MODIFIED;
|
||||
import static com.android.documentsui.BaseActivity.State.SORT_ORDER_SIZE;
|
||||
import static com.android.documentsui.State.SORT_ORDER_DISPLAY_NAME;
|
||||
import static com.android.documentsui.State.SORT_ORDER_LAST_MODIFIED;
|
||||
import static com.android.documentsui.State.SORT_ORDER_SIZE;
|
||||
import static com.android.documentsui.model.DocumentInfo.getCursorLong;
|
||||
import static com.android.documentsui.model.DocumentInfo.getCursorString;
|
||||
|
||||
|
||||
153
packages/DocumentsUI/src/com/android/documentsui/State.java
Normal file
153
packages/DocumentsUI/src/com/android/documentsui/State.java
Normal file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright (C) 2013 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.documentsui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import com.android.documentsui.model.DocumentInfo;
|
||||
import com.android.documentsui.model.DocumentStack;
|
||||
import com.android.documentsui.model.DurableUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class State implements android.os.Parcelable {
|
||||
public int action;
|
||||
public String[] acceptMimes;
|
||||
|
||||
/** Explicit user choice */
|
||||
public int userMode = MODE_UNKNOWN;
|
||||
/** Derived after loader */
|
||||
public int derivedMode = MODE_LIST;
|
||||
|
||||
/** Explicit user choice */
|
||||
public int userSortOrder = SORT_ORDER_UNKNOWN;
|
||||
/** Derived after loader */
|
||||
public int derivedSortOrder = SORT_ORDER_DISPLAY_NAME;
|
||||
|
||||
public boolean allowMultiple;
|
||||
public boolean forceSize ;
|
||||
public boolean showSize;
|
||||
public boolean localOnly ;
|
||||
public boolean forceAdvanced ;
|
||||
public boolean showAdvanced ;
|
||||
public boolean stackTouched ;
|
||||
public boolean restored ;
|
||||
public boolean directoryCopy ;
|
||||
/** Transfer mode for file copy/move operations. */
|
||||
public int transferMode;
|
||||
|
||||
/** Current user navigation stack; empty implies recents. */
|
||||
public DocumentStack stack = new DocumentStack();
|
||||
/** Currently active search, overriding any stack. */
|
||||
public String currentSearch;
|
||||
|
||||
/** Instance state for every shown directory */
|
||||
public HashMap<String, SparseArray<Parcelable>> dirState = new HashMap<>();
|
||||
|
||||
/** Currently copying file */
|
||||
public List<DocumentInfo> selectedDocumentsForCopy = new ArrayList<DocumentInfo>();
|
||||
|
||||
/** Name of the package that started DocsUI */
|
||||
public List<String> excludedAuthorities = new ArrayList<>();
|
||||
|
||||
public static final int ACTION_OPEN = 1;
|
||||
public static final int ACTION_CREATE = 2;
|
||||
public static final int ACTION_GET_CONTENT = 3;
|
||||
public static final int ACTION_OPEN_TREE = 4;
|
||||
public static final int ACTION_MANAGE = 5;
|
||||
public static final int ACTION_BROWSE = 6;
|
||||
public static final int ACTION_OPEN_COPY_DESTINATION = 8;
|
||||
|
||||
public static final int MODE_UNKNOWN = 0;
|
||||
public static final int MODE_LIST = 1;
|
||||
public static final int MODE_GRID = 2;
|
||||
|
||||
public static final int SORT_ORDER_UNKNOWN = 0;
|
||||
public static final int SORT_ORDER_DISPLAY_NAME = 1;
|
||||
public static final int SORT_ORDER_LAST_MODIFIED = 2;
|
||||
public static final int SORT_ORDER_SIZE = 3;
|
||||
|
||||
public void initAcceptMimes(Intent intent) {
|
||||
if (intent.hasExtra(Intent.EXTRA_MIME_TYPES)) {
|
||||
acceptMimes = intent.getStringArrayExtra(Intent.EXTRA_MIME_TYPES);
|
||||
} else {
|
||||
String glob = intent.getType();
|
||||
acceptMimes = new String[] { glob != null ? glob : "*/*" };
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeInt(action);
|
||||
out.writeInt(userMode);
|
||||
out.writeStringArray(acceptMimes);
|
||||
out.writeInt(userSortOrder);
|
||||
out.writeInt(allowMultiple ? 1 : 0);
|
||||
out.writeInt(forceSize ? 1 : 0);
|
||||
out.writeInt(showSize ? 1 : 0);
|
||||
out.writeInt(localOnly ? 1 : 0);
|
||||
out.writeInt(forceAdvanced ? 1 : 0);
|
||||
out.writeInt(showAdvanced ? 1 : 0);
|
||||
out.writeInt(stackTouched ? 1 : 0);
|
||||
out.writeInt(restored ? 1 : 0);
|
||||
DurableUtils.writeToParcel(out, stack);
|
||||
out.writeString(currentSearch);
|
||||
out.writeMap(dirState);
|
||||
out.writeList(selectedDocumentsForCopy);
|
||||
out.writeList(excludedAuthorities);
|
||||
}
|
||||
|
||||
public static final Creator<State> CREATOR = new Creator<State>() {
|
||||
@Override
|
||||
public State createFromParcel(Parcel in) {
|
||||
final State state = new State();
|
||||
state.action = in.readInt();
|
||||
state.userMode = in.readInt();
|
||||
state.acceptMimes = in.readStringArray();
|
||||
state.userSortOrder = in.readInt();
|
||||
state.allowMultiple = in.readInt() != 0;
|
||||
state.forceSize = in.readInt() != 0;
|
||||
state.showSize = in.readInt() != 0;
|
||||
state.localOnly = in.readInt() != 0;
|
||||
state.forceAdvanced = in.readInt() != 0;
|
||||
state.showAdvanced = in.readInt() != 0;
|
||||
state.stackTouched = in.readInt() != 0;
|
||||
state.restored = in.readInt() != 0;
|
||||
DurableUtils.readFromParcel(in, state.stack);
|
||||
state.currentSearch = in.readString();
|
||||
in.readMap(state.dirState, null);
|
||||
in.readList(state.selectedDocumentsForCopy, null);
|
||||
in.readList(state.excludedAuthorities, null);
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public State[] newArray(int size) {
|
||||
return new State[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -19,7 +19,6 @@ package com.android.documentsui;
|
||||
import android.test.AndroidTestCase;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
|
||||
import com.android.documentsui.BaseActivity.State;
|
||||
import com.android.documentsui.model.RootInfo;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
Reference in New Issue
Block a user