Merge change 23657 into eclair

* changes:
  Fix the foldername of outbox
This commit is contained in:
Android (Google) Code Review 2009-09-02 17:51:17 -07:00
commit 7c4a39981d
4 changed files with 55 additions and 9 deletions

View File

@ -81,6 +81,8 @@
<item>5</item>
</string-array>
<!-- Arrays of "special_mailbox_display_names" and "special_mailbox_icons" are depends on
types of mailboxes defined in EmailContent -->
<string-array name="special_mailbox_display_names" translatable="false">
<!-- TYPE_INBOX = 0 -->
<item>@string/special_mailbox_display_name_inbox</item>
@ -88,10 +90,10 @@
<item></item>
<!-- TYPE_PARENT = 2 -->
<item></item>
<!-- TYPE_OUTBOX = 3 -->
<item>@string/special_mailbox_display_name_junk</item>
<!-- TYPE_DRAFTS = 4 -->
<!-- TYPE_DRAFTS = 3 -->
<item>@string/special_mailbox_display_name_drafts</item>
<!-- TYPE_OUTBOX = 4 -->
<item>@string/special_mailbox_display_name_outbox</item>
<!-- TYPE_SENT = 5 -->
<item>@string/special_mailbox_display_name_sent</item>
<!-- TYPE_TRASH = 6 -->
@ -100,6 +102,8 @@
<item>@string/special_mailbox_display_name_junk</item>
</string-array>
<!-- Arrays of "special_mailbox_display_names" and "special_mailbox_icons" are depends on
types of mailboxes defined in EmailContent -->
<array name="special_mailbox_icons" translatable="false">
<!-- TYPE_INBOX = 0 -->
<item>@drawable/ic_list_inbox</item>
@ -107,10 +111,10 @@
<item>@drawable/ic_list_folder</item>
<!-- TYPE_PARENT = 2 -->
<item>@drawable/ic_list_folder</item>
<!-- TYPE_OUTBOX = 3 -->
<item>@drawable/ic_list_outbox</item>
<!-- TYPE_DRAFTS = 4 -->
<!-- TYPE_DRAFTS = 3 -->
<item>@drawable/ic_list_drafts</item>
<!-- TYPE_OUTBOX = 4 -->
<item>@drawable/ic_list_outbox</item>
<!-- TYPE_SENT = 5 -->
<item>@drawable/ic_list_sent</item>
<!-- TYPE_TRASH = 6 -->

View File

@ -329,7 +329,7 @@ public class Utility {
* @param type
* @return icon's drawable
*/
public synchronized Drawable getIconIds(int type) {
public Drawable getIconIds(int type) {
if (type < mSpecialMailboxDrawable.length()) {
return mSpecialMailboxDrawable.getDrawable(type);
}

View File

@ -1736,6 +1736,8 @@ public abstract class EmailContent {
// Types of mailboxes. The list is ordered to match a typical UI presentation, e.g.
// placing the inbox at the top.
// The "main" mailbox for the account, almost always referred to as "Inbox"
// Arrays of "special_mailbox_display_names" and "special_mailbox_icons" are depends on
// types Id of mailboxes.
public static final int TYPE_INBOX = 0;
// Types of mailboxes
// Holds mail (generic)

View File

@ -16,6 +16,12 @@
package com.android.email;
import com.android.email.provider.EmailContent.Mailbox;
import com.android.email.R;
import com.android.email.Utility;
import android.content.Context;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import junit.framework.TestCase;
@ -25,7 +31,7 @@ import junit.framework.TestCase;
* complete - no server(s) required.
*/
@SmallTest
public class UtilityUnitTests extends TestCase {
public class UtilityUnitTests extends AndroidTestCase {
/**
* Tests of the IMAP quoting rules function.
@ -41,5 +47,39 @@ public class UtilityUnitTests extends TestCase {
// Quoting internal \ with \\
assertEquals("\"ab\\\\cd\"", Utility.imapQuoted("ab\\cd"));
}
/**
* Tests of the syncronization of array and types of the display folder names
*/
public void testGetDisplayName() {
Context context = getContext();
String expect, name;
expect = context.getString(R.string.special_mailbox_display_name_inbox);
name = Utility.FolderProperties.getInstance(context).getDisplayName(Mailbox.TYPE_INBOX);
assertEquals(expect, name);
expect = null;
name = Utility.FolderProperties.getInstance(context).getDisplayName(Mailbox.TYPE_MAIL);
assertEquals(expect, name);
expect = null;
name = Utility.FolderProperties.getInstance(context).getDisplayName(Mailbox.TYPE_PARENT);
assertEquals(expect, name);
expect = context.getString(R.string.special_mailbox_display_name_drafts);
name = Utility.FolderProperties.getInstance(context).getDisplayName(Mailbox.TYPE_DRAFTS);
assertEquals(expect, name);
expect = context.getString(R.string.special_mailbox_display_name_outbox);
name = Utility.FolderProperties.getInstance(context).getDisplayName(Mailbox.TYPE_OUTBOX);
assertEquals(expect, name);
expect = context.getString(R.string.special_mailbox_display_name_sent);
name = Utility.FolderProperties.getInstance(context).getDisplayName(Mailbox.TYPE_SENT);
assertEquals(expect, name);
expect = context.getString(R.string.special_mailbox_display_name_trash);
name = Utility.FolderProperties.getInstance(context).getDisplayName(Mailbox.TYPE_TRASH);
assertEquals(expect, name);
expect = context.getString(R.string.special_mailbox_display_name_junk);
name = Utility.FolderProperties.getInstance(context).getDisplayName(Mailbox.TYPE_JUNK);
assertEquals(expect, name);
// Testing illegal index
expect = null;
name = Utility.FolderProperties.getInstance(context).getDisplayName(8);
assertEquals(expect, name);
}
}