diff options
| -rw-r--r-- | packages/DocumentsUI/res/values/strings.xml | 4 | ||||
| -rw-r--r-- | packages/DocumentsUI/src/com/android/documentsui/FailureDialogFragment.java | 40 |
2 files changed, 17 insertions, 27 deletions
diff --git a/packages/DocumentsUI/res/values/strings.xml b/packages/DocumentsUI/res/values/strings.xml index 8ac228e77282..5a9bc162f3d6 100644 --- a/packages/DocumentsUI/res/values/strings.xml +++ b/packages/DocumentsUI/res/values/strings.xml @@ -179,8 +179,8 @@ </plurals> <!-- Second line for notifications saying that more information will be shown after touching [CHAR LIMIT=48] --> <string name="notification_touch_for_details">Tap to view details</string> - <!-- Label of a dialog button for retrying a failed operation [CHAR LIMIT=24] --> - <string name="retry">Retry</string> + <!-- Label of the close dialog button.[CHAR LIMIT=24] --> + <string name="close">Close</string> <!-- Contents of the copying failure alert dialog. [CHAR LIMIT=48] --> <string name="copy_failure_alert_content">These files weren\'t copied: <xliff:g id="list">%1$s</xliff:g></string> <!-- Contents of the moving failure alert dialog. [CHAR LIMIT=48] --> diff --git a/packages/DocumentsUI/src/com/android/documentsui/FailureDialogFragment.java b/packages/DocumentsUI/src/com/android/documentsui/FailureDialogFragment.java index 7f6f1c6bef14..b8ef5ac4a542 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/FailureDialogFragment.java +++ b/packages/DocumentsUI/src/com/android/documentsui/FailureDialogFragment.java @@ -33,17 +33,14 @@ import com.android.documentsui.services.FileOperationService; import com.android.documentsui.services.FileOperations; import java.util.ArrayList; +import java.util.List; /** * Alert dialog for failed operations. */ -public class FailureDialogFragment extends DialogFragment - implements DialogInterface.OnClickListener { +public class FailureDialogFragment extends DialogFragment { private static final String TAG = "FailureDialogFragment"; - private int mOperationType; - private ArrayList<DocumentInfo> mFailedSrcList; - public static void show(FragmentManager fm, int failure, ArrayList<DocumentInfo> failedSrcList, DocumentStack dstStack, int operationType) { // TODO: Add support for other failures than copy. @@ -65,36 +62,25 @@ public class FailureDialogFragment extends DialogFragment } @Override - public void onClick(DialogInterface dialog, int whichButton) { - if (whichButton == DialogInterface.BUTTON_POSITIVE) { - FileOperations.start( - getActivity(), - mFailedSrcList, - (DocumentStack) getActivity().getIntent().getParcelableExtra( - Shared.EXTRA_STACK), - mOperationType); - } - } - - @Override public Dialog onCreateDialog(Bundle inState) { super.onCreate(inState); - mOperationType = getArguments().getInt(FileOperationService.EXTRA_OPERATION); - mFailedSrcList = getArguments().getParcelableArrayList(FileOperationService.EXTRA_SRC_LIST); + final int operationType = getArguments().getInt(FileOperationService.EXTRA_OPERATION); + final List<DocumentInfo> failedSrcList = getArguments().getParcelableArrayList( + FileOperationService.EXTRA_SRC_LIST); final StringBuilder list = new StringBuilder("<p>"); - for (DocumentInfo documentInfo : mFailedSrcList) { + for (DocumentInfo documentInfo : failedSrcList) { list.append(String.format("• %s<br>", documentInfo.displayName)); } list.append("</p>"); // TODO: Add support for other file operations. checkArgument( - mOperationType == FileOperationService.OPERATION_COPY - || mOperationType == FileOperationService.OPERATION_MOVE); + operationType == FileOperationService.OPERATION_COPY + || operationType == FileOperationService.OPERATION_MOVE); - int messageId = mOperationType == FileOperationService.OPERATION_COPY + int messageId = operationType == FileOperationService.OPERATION_COPY ? R.string.copy_failure_alert_content : R.string.move_failure_alert_content; @@ -105,8 +91,12 @@ public class FailureDialogFragment extends DialogFragment return new AlertDialog.Builder(getActivity()) .setMessage(Html.fromHtml(message)) - .setPositiveButton(R.string.retry, this) - .setNegativeButton(android.R.string.cancel, this) + .setPositiveButton(R.string.close, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + } + }) .create(); } } |