Merge "Fix text on move notifications and toasts."
This commit is contained in:
@@ -126,6 +126,8 @@
|
||||
|
||||
<!-- Title of the copy notification [CHAR LIMIT=24] -->
|
||||
<string name="copy_notification_title">Copying files</string>
|
||||
<!-- Title of the move notification [CHAR LIMIT=24] -->
|
||||
<string name="move_notification_title">Moving files</string>
|
||||
<!-- Text shown on the copy notification to indicate remaining time, in minutes [CHAR LIMIT=24] -->
|
||||
<string name="copy_remaining"><xliff:g id="duration" example="3 minutes">%s</xliff:g> left</string>
|
||||
<!-- Toast shown when a file copy is kicked off -->
|
||||
@@ -137,19 +139,28 @@
|
||||
<item quantity="one">Moving <xliff:g id="count" example="1">%1$d</xliff:g> file.</item>
|
||||
<item quantity="other">Moving <xliff:g id="count" example="3">%1$d</xliff:g> files.</item>
|
||||
</plurals>
|
||||
<!-- Text shown on the copy notification while DocumentsUI performs setup in preparation for copying files [CHAR LIMIT=32] -->
|
||||
<!-- Text shown on the notification while DocumentsUI performs setup in preparation for copying files [CHAR LIMIT=32] -->
|
||||
<string name="copy_preparing">Preparing for copy\u2026</string>
|
||||
<!-- Text shown on the notification while DocumentsUI performs setup in preparation for moving files [CHAR LIMIT=32] -->
|
||||
<string name="move_preparing">Preparing for move\u2026</string>
|
||||
<!-- Title of the copy error notification [CHAR LIMIT=48] -->
|
||||
<plurals name="copy_error_notification_title">
|
||||
<item quantity="one">Couldn\'t copy <xliff:g id="count" example="1">%1$d</xliff:g> file</item>
|
||||
<item quantity="other">Couldn\'t copy <xliff:g id="count" example="2">%1$d</xliff:g> files</item>
|
||||
</plurals>
|
||||
<!-- Title of the move error notification [CHAR LIMIT=48] -->
|
||||
<plurals name="move_error_notification_title">
|
||||
<item quantity="one">Couldn\'t move <xliff:g id="count" example="1">%1$d</xliff:g> file</item>
|
||||
<item quantity="other">Couldn\'t move <xliff:g id="count" example="2">%1$d</xliff:g> files</item>
|
||||
</plurals>
|
||||
<!-- Second line for notifications saying that more information will be shown after touching [CHAR LIMIT=48] -->
|
||||
<string name="notification_touch_for_details">Touch to view details</string>
|
||||
<!-- Label of a dialog button for retrying a failed operation [CHAR LIMIT=24] -->
|
||||
<string name="retry">Retry</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] -->
|
||||
<string name="move_failure_alert_content">These files weren\'t moved: <xliff:g id="list">%1$s</xliff:g></string>
|
||||
<!-- Toast shown when a user copies files to clipboard. -->
|
||||
<plurals name="clipboard_files_clipped">
|
||||
<item quantity="one">Copied <xliff:g id="count" example="1">%1$d</xliff:g> file to clipboard.</item>
|
||||
|
||||
@@ -150,7 +150,7 @@ public class CopyService extends IntentService {
|
||||
mDstClient = DocumentsApplication.acquireUnstableProviderOrThrow(getContentResolver(),
|
||||
stack.peek().authority);
|
||||
|
||||
setupCopyJob(srcs, stack);
|
||||
setupCopyJob(srcs, stack, transferMode);
|
||||
|
||||
for (int i = 0; i < srcs.size() && !mIsCancelled; ++i) {
|
||||
copy(srcs.get(i), stack.peek(), transferMode);
|
||||
@@ -172,10 +172,12 @@ public class CopyService extends IntentService {
|
||||
navigateIntent.putExtra(EXTRA_FAILURE, FAILURE_COPY);
|
||||
navigateIntent.putParcelableArrayListExtra(EXTRA_SRC_LIST, mFailedFiles);
|
||||
|
||||
final int titleResourceId = (transferMode == TRANSFER_MODE_COPY ?
|
||||
R.plurals.copy_error_notification_title :
|
||||
R.plurals.move_error_notification_title);
|
||||
final Notification.Builder errorBuilder = new Notification.Builder(this)
|
||||
.setContentTitle(context.getResources().
|
||||
getQuantityString(R.plurals.copy_error_notification_title,
|
||||
mFailedFiles.size(), mFailedFiles.size()))
|
||||
.setContentTitle(context.getResources().getQuantityString(titleResourceId,
|
||||
mFailedFiles.size(), mFailedFiles.size()))
|
||||
.setContentText(getString(R.string.notification_touch_for_details))
|
||||
.setContentIntent(PendingIntent.getActivity(context, 0, navigateIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT))
|
||||
@@ -199,10 +201,12 @@ public class CopyService extends IntentService {
|
||||
*
|
||||
* @param srcs A list of src files to copy.
|
||||
* @param stack The copy destination stack.
|
||||
* @param transferMode The mode (i.e. copy, or move)
|
||||
* @throws RemoteException
|
||||
*/
|
||||
private void setupCopyJob(ArrayList<DocumentInfo> srcs, DocumentStack stack)
|
||||
private void setupCopyJob(ArrayList<DocumentInfo> srcs, DocumentStack stack, int transferMode)
|
||||
throws RemoteException {
|
||||
final boolean copying = (transferMode == TRANSFER_MODE_COPY);
|
||||
// Create an ID for this copy job. Use the timestamp.
|
||||
mJobId = String.valueOf(SystemClock.elapsedRealtime());
|
||||
// Reset the cancellation flag.
|
||||
@@ -212,8 +216,10 @@ public class CopyService extends IntentService {
|
||||
final Intent navigateIntent = new Intent(context, StandaloneActivity.class);
|
||||
navigateIntent.putExtra(EXTRA_STACK, (Parcelable) stack);
|
||||
|
||||
final String contentTitle = getString(copying ? R.string.copy_notification_title
|
||||
: R.string.move_notification_title);
|
||||
mProgressBuilder = new Notification.Builder(this)
|
||||
.setContentTitle(getString(R.string.copy_notification_title))
|
||||
.setContentTitle(contentTitle)
|
||||
.setContentIntent(PendingIntent.getActivity(context, 0, navigateIntent, 0))
|
||||
.setCategory(Notification.CATEGORY_PROGRESS)
|
||||
.setSmallIcon(R.drawable.ic_menu_copy)
|
||||
@@ -227,8 +233,10 @@ public class CopyService extends IntentService {
|
||||
PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_CANCEL_CURRENT));
|
||||
|
||||
// Send an initial progress notification.
|
||||
final String contentText = getString(copying ? R.string.copy_preparing
|
||||
: R.string.move_preparing);
|
||||
mProgressBuilder.setProgress(0, 0, true); // Indeterminate progress while setting up.
|
||||
mProgressBuilder.setContentText(getString(R.string.copy_preparing));
|
||||
mProgressBuilder.setContentText(contentText);
|
||||
mNotificationManager.notify(mJobId, 0, mProgressBuilder.build());
|
||||
|
||||
// Reset batch parameters.
|
||||
|
||||
@@ -84,8 +84,9 @@ public class FailureDialogFragment extends DialogFragment
|
||||
list.append(String.format("• %s<br>", documentInfo.displayName));
|
||||
}
|
||||
list.append("</p>");
|
||||
final String message = String.format(getString(R.string.copy_failure_alert_content),
|
||||
list.toString());
|
||||
final String messageFormat = getString(mTransferMode == CopyService.TRANSFER_MODE_COPY ?
|
||||
R.string.copy_failure_alert_content : R.string.move_failure_alert_content);
|
||||
final String message = String.format(messageFormat, list.toString());
|
||||
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setMessage(Html.fromHtml(message))
|
||||
|
||||
Reference in New Issue
Block a user