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);
}
use of com.android.documentsui.services.FileOperationService.OpType in project android_frameworks_base by AOSPA.
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("• %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();
}
use of com.android.documentsui.services.FileOperationService.OpType in project android_frameworks_base by ResurrectionRemix.
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);
}
use of com.android.documentsui.services.FileOperationService.OpType in project android_frameworks_base by ResurrectionRemix.
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("• %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();
}
use of com.android.documentsui.services.FileOperationService.OpType in project android_frameworks_base by DirtyUnicorns.
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("• %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();
}
Aggregations