Search in sources :

Example 1 with OpType

use of com.android.documentsui.services.FileOperationService.OpType in project platform_frameworks_base by android.

the class OperationDialogFragment method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle inState) {
    super.onCreate(inState);
    @DialogType final int dialogType = getArguments().getInt(FileOperationService.EXTRA_DIALOG_TYPE);
    @OpType final int operationType = getArguments().getInt(FileOperationService.EXTRA_OPERATION);
    final ArrayList<DocumentInfo> srcList = getArguments().getParcelableArrayList(FileOperationService.EXTRA_SRC_LIST);
    final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    String messageFormat;
    switch(dialogType) {
        case DIALOG_TYPE_CONVERTED:
            messageFormat = getString(R.string.copy_converted_warning_content);
            break;
        case DIALOG_TYPE_FAILURE:
            switch(operationType) {
                case FileOperationService.OPERATION_COPY:
                    messageFormat = getString(R.string.copy_failure_alert_content);
                    break;
                case FileOperationService.OPERATION_DELETE:
                    messageFormat = getString(R.string.delete_failure_alert_content);
                    break;
                case FileOperationService.OPERATION_MOVE:
                    messageFormat = getString(R.string.move_failure_alert_content);
                    break;
                default:
                    throw new UnsupportedOperationException();
            }
            break;
        default:
            throw new UnsupportedOperationException();
    }
    final StringBuilder list = new StringBuilder("<p>");
    for (DocumentInfo documentInfo : srcList) {
        list.append(String.format("&#8226; %s<br>", Html.escapeHtml(documentInfo.displayName)));
    }
    list.append("</p>");
    builder.setMessage(Html.fromHtml(String.format(messageFormat, list.toString())));
    builder.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int id) {
            dialog.dismiss();
        }
    });
    return builder.create();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) OpType(com.android.documentsui.services.FileOperationService.OpType) DocumentInfo(com.android.documentsui.model.DocumentInfo)

Example 2 with OpType

use of com.android.documentsui.services.FileOperationService.OpType in project platform_frameworks_base by android.

the class DirectoryFragment method handleCopyResult.

private void handleCopyResult(int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_CANCELED || data == null) {
        // proceed with the copy.
        return;
    }
    @OpType int operationType = data.getIntExtra(FileOperationService.EXTRA_OPERATION, FileOperationService.OPERATION_COPY);
    FileOperations.start(getActivity(), getDisplayState().selectedDocumentsForCopy, getDisplayState().stack.peek(), (DocumentStack) data.getParcelableExtra(Shared.EXTRA_STACK), operationType);
}
Also used : OpType(com.android.documentsui.services.FileOperationService.OpType) Point(android.graphics.Point)

Example 3 with OpType

use of com.android.documentsui.services.FileOperationService.OpType in project android_frameworks_base by DirtyUnicorns.

the class DirectoryFragment method handleCopyResult.

private void handleCopyResult(int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_CANCELED || data == null) {
        // proceed with the copy.
        return;
    }
    @OpType int operationType = data.getIntExtra(FileOperationService.EXTRA_OPERATION, FileOperationService.OPERATION_COPY);
    FileOperations.start(getActivity(), getDisplayState().selectedDocumentsForCopy, getDisplayState().stack.peek(), (DocumentStack) data.getParcelableExtra(Shared.EXTRA_STACK), operationType);
}
Also used : OpType(com.android.documentsui.services.FileOperationService.OpType) Point(android.graphics.Point)

Example 4 with OpType

use of com.android.documentsui.services.FileOperationService.OpType in project android_frameworks_base by AOSPA.

the class DirectoryFragment method handleCopyResult.

private void handleCopyResult(int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_CANCELED || data == null) {
        // proceed with the copy.
        return;
    }
    @OpType int operationType = data.getIntExtra(FileOperationService.EXTRA_OPERATION, FileOperationService.OPERATION_COPY);
    FileOperations.start(getActivity(), getDisplayState().selectedDocumentsForCopy, getDisplayState().stack.peek(), (DocumentStack) data.getParcelableExtra(Shared.EXTRA_STACK), operationType);
}
Also used : OpType(com.android.documentsui.services.FileOperationService.OpType) Point(android.graphics.Point)

Example 5 with OpType

use of com.android.documentsui.services.FileOperationService.OpType in project android_frameworks_base by crdroidandroid.

the class DirectoryFragment method handleCopyResult.

private void handleCopyResult(int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_CANCELED || data == null) {
        // proceed with the copy.
        return;
    }
    @OpType int operationType = data.getIntExtra(FileOperationService.EXTRA_OPERATION, FileOperationService.OPERATION_COPY);
    FileOperations.start(getActivity(), getDisplayState().selectedDocumentsForCopy, getDisplayState().stack.peek(), (DocumentStack) data.getParcelableExtra(Shared.EXTRA_STACK), operationType);
}
Also used : OpType(com.android.documentsui.services.FileOperationService.OpType) Point(android.graphics.Point)

Aggregations

OpType (com.android.documentsui.services.FileOperationService.OpType)10 AlertDialog (android.app.AlertDialog)5 DialogInterface (android.content.DialogInterface)5 Point (android.graphics.Point)5 DocumentInfo (com.android.documentsui.model.DocumentInfo)5