Make "Message deleted" be plural

Bug: 2264751
This commit is contained in:
satok 2010-02-15 15:29:39 +09:00
parent c1cea617cc
commit dffe2f486d
3 changed files with 11 additions and 8 deletions

View File

@ -261,7 +261,10 @@
<!-- Appears progress dialog for fetching attachment --> <!-- Appears progress dialog for fetching attachment -->
<string name="message_view_fetching_attachment_progress">Fetching attachment <xliff:g id="filename">%s</xliff:g></string> <string name="message_view_fetching_attachment_progress">Fetching attachment <xliff:g id="filename">%s</xliff:g></string>
<!-- Toast shown briefly while deleting a message --> <!-- Toast shown briefly while deleting a message -->
<string name="message_deleted_toast">Message deleted.</string> <plurals name="message_deleted_toast">
<item quantity="one">Message <xliff:g id="deleted.">deleted.</xliff:g></item>
<item quantity="other">Messages <xliff:g id="deleted.">deleted.</xliff:g></item>
</plurals>
<!-- Toast shown briefly while deleting an unsent (draft) message --> <!-- Toast shown briefly while deleting an unsent (draft) message -->
<string name="message_discarded_toast">Message discarded.</string> <string name="message_discarded_toast">Message discarded.</string>
<!-- Toast shown briefly while saving a draft --> <!-- Toast shown briefly while saving a draft -->

View File

@ -32,7 +32,6 @@ import com.android.email.provider.EmailContent.MailboxColumns;
import com.android.email.provider.EmailContent.MessageColumns; import com.android.email.provider.EmailContent.MessageColumns;
import com.android.email.service.MailService; import com.android.email.service.MailService;
import android.app.Activity;
import android.app.ListActivity; import android.app.ListActivity;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.content.ContentResolver; import android.content.ContentResolver;
@ -58,7 +57,6 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
@ -637,7 +635,8 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
private void onDelete(long messageId, long accountId) { private void onDelete(long messageId, long accountId) {
mController.deleteMessage(messageId, accountId); mController.deleteMessage(messageId, accountId);
Toast.makeText(this, R.string.message_deleted_toast, Toast.LENGTH_SHORT).show(); Toast.makeText(this, getResources().getQuantityString(
R.plurals.message_deleted_toast, 1), Toast.LENGTH_SHORT).show();
} }
private void onSetMessageRead(long messageId, boolean newRead) { private void onSetMessageRead(long messageId, boolean newRead) {
@ -701,8 +700,8 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
for (Long id : cloneSet) { for (Long id : cloneSet) {
mController.deleteMessage(id, -1); mController.deleteMessage(id, -1);
} }
// TODO: count messages and show "n messages deleted" Toast.makeText(this, getResources().getQuantityString(
Toast.makeText(this, R.string.message_deleted_toast, Toast.LENGTH_SHORT).show(); R.plurals.message_deleted_toast, cloneSet.size()), Toast.LENGTH_SHORT).show();
selectedSet.clear(); selectedSet.clear();
showMultiPanel(false); showMultiPanel(false);
} }

View File

@ -488,7 +488,8 @@ public class MessageView extends Activity implements OnClickListener {
long messageIdToDelete = mMessageId; long messageIdToDelete = mMessageId;
boolean moved = moveToOlder() || moveToNewer(); boolean moved = moveToOlder() || moveToNewer();
mController.deleteMessage(messageIdToDelete, mMessage.mAccountKey); mController.deleteMessage(messageIdToDelete, mMessage.mAccountKey);
Toast.makeText(this, R.string.message_deleted_toast, Toast.LENGTH_SHORT).show(); Toast.makeText(this, getResources().getQuantityString(R.plurals.message_deleted_toast,
1), Toast.LENGTH_SHORT).show();
if (!moved) { if (!moved) {
// this generates a benign warning "Duplicate finish request" because // this generates a benign warning "Duplicate finish request" because
// repositionMessageListCursor() will fail to reposition and do its own finish() // repositionMessageListCursor() will fail to reposition and do its own finish()