Fix CTS failure.
Loosen the reigns on setPickTarget to accommodate no sub command mode. Change-Id: Ia11c4194970c93fe86e98dfd0d23ed4fa1cea765
This commit is contained in:
@@ -16,8 +16,9 @@
|
||||
|
||||
package com.android.documentsui;
|
||||
|
||||
import static com.android.documentsui.services.FileOperationService.OPERATION_COPY;
|
||||
import static com.android.documentsui.services.FileOperationService.OPERATION_DELETE;
|
||||
import static com.android.documentsui.services.FileOperationService.OPERATION_MOVE;
|
||||
import static com.android.documentsui.services.FileOperationService.OPERATION_UNKNOWN;
|
||||
import static com.android.internal.util.Preconditions.checkArgument;
|
||||
|
||||
import android.app.Activity;
|
||||
@@ -40,7 +41,8 @@ public class PickFragment extends Fragment {
|
||||
public static final String TAG = "PickFragment";
|
||||
|
||||
private int mAction;
|
||||
private @OpType int mOperationType;
|
||||
// Only legal values are OPERATION_COPY, OPERATION_MOVE, and unset (OPERATION_UNKNOWN).
|
||||
private @OpType int mCopyOperationSubType = OPERATION_UNKNOWN;
|
||||
private DocumentInfo mPickTarget;
|
||||
private View mContainer;
|
||||
private Button mPick;
|
||||
@@ -97,10 +99,11 @@ public class PickFragment extends Fragment {
|
||||
/**
|
||||
* @param action Which action defined in State is the picker shown for.
|
||||
*/
|
||||
public void setPickTarget(int action, @OpType int operationType, DocumentInfo pickTarget) {
|
||||
checkArgument(operationType == OPERATION_COPY || operationType == OPERATION_MOVE);
|
||||
public void setPickTarget(
|
||||
int action, @OpType int copyOperationSubType, DocumentInfo pickTarget) {
|
||||
checkArgument(copyOperationSubType != OPERATION_DELETE);
|
||||
mAction = action;
|
||||
mOperationType = operationType;
|
||||
mCopyOperationSubType = copyOperationSubType;
|
||||
mPickTarget = pickTarget;
|
||||
if (mContainer != null) {
|
||||
updateView();
|
||||
@@ -117,7 +120,7 @@ public class PickFragment extends Fragment {
|
||||
mCancel.setVisibility(View.GONE);
|
||||
break;
|
||||
case State.ACTION_PICK_COPY_DESTINATION:
|
||||
mPick.setText(mOperationType == OPERATION_MOVE
|
||||
mPick.setText(mCopyOperationSubType == OPERATION_MOVE
|
||||
? R.string.button_move : R.string.button_copy);
|
||||
mCancel.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.android.documentsui.model.DocumentInfo;
|
||||
import com.android.documentsui.model.DocumentStack;
|
||||
import com.android.documentsui.model.DurableUtils;
|
||||
import com.android.documentsui.model.RootInfo;
|
||||
import com.android.documentsui.services.FileOperationService;
|
||||
import com.android.documentsui.services.FileOperationService.OpType;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -93,9 +94,10 @@ public class State implements android.os.Parcelable {
|
||||
|
||||
/**
|
||||
* This is basically a sub-type for the copy operation. It can be either COPY or MOVE.
|
||||
* The only legal values are: OPERATION_COPY, OPERATION_MOVE.
|
||||
* The only legal values, if set, are: OPERATION_COPY, OPERATION_MOVE. Other pick
|
||||
* operations don't use this. In those cases OPERATION_UNKNOWN is also legal.
|
||||
*/
|
||||
public @OpType int copyOperationSubType;
|
||||
public @OpType int copyOperationSubType = FileOperationService.OPERATION_UNKNOWN;
|
||||
|
||||
/** Current user navigation stack; empty implies recents. */
|
||||
public DocumentStack stack = new DocumentStack();
|
||||
|
||||
Reference in New Issue
Block a user