Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af231f0a authored by Tomasz Mikolajewski's avatar Tomasz Mikolajewski
Browse files

Remove retry logic from DocumentsUI.

Bug: 26720030
Change-Id: I041caeed7243614e20d92e1bb3308f564f6aae34
parent e7695829
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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] -->
+15 −25
Original line number Diff line number Diff line
@@ -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.
@@ -64,37 +61,26 @@ public class FailureDialogFragment extends DialogFragment
        ft.commitAllowingStateLoss();
    }

    @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("&#8226; %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();
    }
}