Move system folder string resources to emailcommon.
This permits us to move shared code for looking up system folder names to emailcommon, which is also in this change. Also renames emailcommon2 to emailcommon. This is part of a multi-project submit with I4a071a07c3e33aaa4ea404eb66a8db1eabc9ef0e and I5746c0353783f9b29d52d6540472588c6542a6a2. Bug: 8383232 Change-Id: I6c6eec4f1bcf2abd54c1ed05da1add8d894ee403
This commit is contained in:
parent
24e165323e
commit
9ae81e2af0
|
@ -19,11 +19,12 @@ LOCAL_PATH := $(call my-dir)
|
|||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# Include res dir from chips, unified, and photoviewer
|
||||
# Include res dir from chips, unified, emailcommon, and photoviewer
|
||||
chips_dir := ../../../frameworks/ex/chips/res
|
||||
unified_email_dir := ../UnifiedEmail
|
||||
photo_dir := ../../../frameworks/opt/photoviewer/res
|
||||
res_dir := $(chips_dir) res $(unified_email_dir)/res $(photo_dir) build/res
|
||||
emailcommon_dir := emailcommon
|
||||
res_dir := $(chips_dir) res $(unified_email_dir)/res $(photo_dir) $(emailcommon_dir)/res build/res
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
|
@ -38,9 +39,9 @@ LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dir))
|
|||
LOCAL_ASSET_DIR := $(LOCAL_PATH)/$(unified_email_dir)/assets
|
||||
|
||||
LOCAL_AAPT_FLAGS := --auto-add-overlay
|
||||
LOCAL_AAPT_FLAGS += --extra-packages com.android.ex.chips:com.android.mail:com.android.email:com.android.ex.photo
|
||||
LOCAL_AAPT_FLAGS += --extra-packages com.android.ex.chips:com.android.mail:com.android.email:com.android.emailcommon:com.android.ex.photo
|
||||
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := android-common com.android.emailcommon2 com.android.emailsync guava android-common-chips libphotoviewer
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := android-common com.android.emailcommon com.android.emailsync guava android-common-chips libphotoviewer
|
||||
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
|
||||
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v13
|
||||
|
||||
|
|
|
@ -50,4 +50,5 @@
|
|||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.android.email*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Email*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.android.email*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Email*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Email*)
|
||||
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.android.email*)
|
|
@ -31,7 +31,7 @@ imported_unified_email_files := \
|
|||
$(unified_email_src_dir)/com/android/mail/utils/LogUtils.java \
|
||||
$(unified_email_src_dir)/com/android/mail/providers/UIProvider.java
|
||||
|
||||
LOCAL_MODULE := com.android.emailcommon2
|
||||
LOCAL_MODULE := com.android.emailcommon
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := guava android-common
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, src/com/android/emailcommon)
|
||||
LOCAL_SRC_FILES += \
|
||||
|
@ -44,4 +44,6 @@ LOCAL_SRC_FILES += $(imported_unified_email_files)
|
|||
|
||||
LOCAL_SDK_VERSION := 14
|
||||
|
||||
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
|
||||
|
||||
include $(BUILD_STATIC_JAVA_LIBRARY)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.emailcommon"
|
||||
android:versionCode="1">
|
||||
</manifest>
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2013 Google Inc.
|
||||
Licensed to The Android Open Source Project.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- For the following strings, the "system" name refers to the name used internally
|
||||
to distinguish the special mailboxes. In the past there was a notion of this being
|
||||
the name of the mailbox on the server, which is where the naming comes from.
|
||||
Long term I think these strings will change altogether, so I haven't bothered to
|
||||
rename them until after the dust settles on how we manage mailbox names. -->
|
||||
<!-- Do Not Translate. This is the system name of the "inbox" folder. -->
|
||||
<string name="mailbox_name_server_inbox" translatable="false">Inbox</string>
|
||||
<!-- Do Not Translate. This is the system name of the "outbox" folder. -->
|
||||
<string name="mailbox_name_server_outbox" translatable="false">Outbox</string>
|
||||
<!-- Do Not Translate. This is the system name of the "drafts" folder. -->
|
||||
<string name="mailbox_name_server_drafts" translatable="false">Drafts</string>
|
||||
<!-- Do Not Translate. This is the system name of the "trash" folder. -->
|
||||
<string name="mailbox_name_server_trash" translatable="false">Trash</string>
|
||||
<!-- Do Not Translate. This is the system name of the "sent" folder. -->
|
||||
<string name="mailbox_name_server_sent" translatable="false">Sent</string>
|
||||
<!-- Do Not Translate. This is the system name of the "junk" folder. -->
|
||||
<string name="mailbox_name_server_junk" translatable="false">Junk</string>
|
||||
<!-- Do Not Translate. This is the system name of the "starred" folder. -->
|
||||
<string name="mailbox_name_server_starred" translatable="false">Starred</string>
|
||||
</resources>
|
|
@ -27,6 +27,7 @@ import android.os.Parcelable;
|
|||
import android.util.Log;
|
||||
|
||||
import com.android.emailcommon.Logging;
|
||||
import com.android.emailcommon.R;
|
||||
import com.android.emailcommon.provider.EmailContent.MailboxColumns;
|
||||
import com.android.emailcommon.provider.EmailContent.SyncColumns;
|
||||
import com.android.emailcommon.utility.Utility;
|
||||
|
@ -229,6 +230,36 @@ public class Mailbox extends EmailContent implements SyncColumns, MailboxColumns
|
|||
mBaseUri = CONTENT_URI;
|
||||
}
|
||||
|
||||
public static String getSystemMailboxName(Context context, int mailboxType) {
|
||||
int resId = -1;
|
||||
switch (mailboxType) {
|
||||
case Mailbox.TYPE_INBOX:
|
||||
resId = R.string.mailbox_name_server_inbox;
|
||||
break;
|
||||
case Mailbox.TYPE_OUTBOX:
|
||||
resId = R.string.mailbox_name_server_outbox;
|
||||
break;
|
||||
case Mailbox.TYPE_DRAFTS:
|
||||
resId = R.string.mailbox_name_server_drafts;
|
||||
break;
|
||||
case Mailbox.TYPE_TRASH:
|
||||
resId = R.string.mailbox_name_server_trash;
|
||||
break;
|
||||
case Mailbox.TYPE_SENT:
|
||||
resId = R.string.mailbox_name_server_sent;
|
||||
break;
|
||||
case Mailbox.TYPE_JUNK:
|
||||
resId = R.string.mailbox_name_server_junk;
|
||||
break;
|
||||
case Mailbox.TYPE_STARRED:
|
||||
resId = R.string.mailbox_name_server_starred;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Illegal mailbox type");
|
||||
}
|
||||
return context.getString(resId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore a Mailbox from the database, given its unique id
|
||||
* @param context
|
||||
|
@ -246,7 +277,7 @@ public class Mailbox extends EmailContent implements SyncColumns, MailboxColumns
|
|||
* system mailboxes synced with the server.
|
||||
* Note: the mailbox is not persisted - clients must call {@link #save} themselves.
|
||||
*/
|
||||
public static Mailbox newSystemMailbox(long accountId, int mailboxType, String name) {
|
||||
public static Mailbox newSystemMailbox(Context context, long accountId, int mailboxType) {
|
||||
if (mailboxType == Mailbox.TYPE_MAIL) {
|
||||
throw new IllegalArgumentException("Cannot specify TYPE_MAIL for a system mailbox");
|
||||
}
|
||||
|
@ -255,7 +286,8 @@ public class Mailbox extends EmailContent implements SyncColumns, MailboxColumns
|
|||
box.mType = mailboxType;
|
||||
box.mSyncInterval = Account.CHECK_INTERVAL_NEVER;
|
||||
box.mFlagVisible = true;
|
||||
box.mServerId = box.mDisplayName = name;
|
||||
// TODO: Fix how display names work.
|
||||
box.mServerId = box.mDisplayName = getSystemMailboxName(context, mailboxType);
|
||||
box.mParentKey = Mailbox.NO_MAILBOX;
|
||||
box.mFlags = Mailbox.FLAG_HOLDS_MAIL;
|
||||
return box;
|
||||
|
|
|
@ -23,7 +23,7 @@ include $(CLEAR_VARS)
|
|||
|
||||
LOCAL_MODULE := com.android.emailsync
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, src/com/android/emailsync)
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := com.android.emailcommon2
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := com.android.emailcommon
|
||||
|
||||
LOCAL_SDK_VERSION := 14
|
||||
|
||||
|
|
|
@ -179,20 +179,6 @@
|
|||
<item quantity="one"><xliff:g id="num_accounts" example="1">%1$d</xliff:g> account</item>
|
||||
<item quantity="other"><xliff:g id="num_accounts" example="2">%1$d</xliff:g> accounts</item>
|
||||
</plurals>
|
||||
<!-- The next set of strings are used server-side and must not be localized. -->
|
||||
<!-- Do Not Translate. This is the name of the "inbox" folder, on the server. -->
|
||||
<string name="mailbox_name_server_inbox" translatable="false">Inbox</string>
|
||||
<!-- Do Not Translate. This is the name of the "outbox" folder, on the server. -->
|
||||
<string name="mailbox_name_server_outbox" translatable="false">Outbox</string>
|
||||
<!-- Do Not Translate. This is the name of the "drafts" folder, on the server. -->
|
||||
<string name="mailbox_name_server_drafts" translatable="false">Drafts</string>
|
||||
<!-- Do Not Translate. This is the name of the "trash" folder, on the server. -->
|
||||
<string name="mailbox_name_server_trash" translatable="false">Trash</string>
|
||||
<!-- Do Not Translate. This is the name of the "sent" folder, on the server. -->
|
||||
<string name="mailbox_name_server_sent" translatable="false">Sent</string>
|
||||
<!-- Do Not Translate. This is the name of the "junk" folder, on the server. -->
|
||||
<string name="mailbox_name_server_junk" translatable="false">Junk</string>
|
||||
|
||||
<!-- The next set of strings are used in local display and may be localized. -->
|
||||
<!-- In the UI, the inbox will be displayed with this name -->
|
||||
<string name="mailbox_name_display_inbox">Inbox</string>
|
||||
|
|
|
@ -126,8 +126,7 @@ public class Pop3Store extends Store {
|
|||
// Build default mailboxes as well, in case they're not already made.
|
||||
for (int type : DEFAULT_FOLDERS) {
|
||||
if (Mailbox.findMailboxOfType(mContext, mAccount.mId, type) == Mailbox.NO_MAILBOX) {
|
||||
String name = getMailboxServerName(mContext, type);
|
||||
mailbox = Mailbox.newSystemMailbox(mAccount.mId, type, name);
|
||||
mailbox = Mailbox.newSystemMailbox(mContext, mAccount.mId, type);
|
||||
mailbox.save(mContext);
|
||||
}
|
||||
}
|
||||
|
@ -135,37 +134,6 @@ public class Pop3Store extends Store {
|
|||
return new Folder[] { getFolder(inboxName) };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the server-side name for a specific mailbox.
|
||||
*
|
||||
* @return the resource string corresponding to the mailbox type, empty if not found.
|
||||
*/
|
||||
public String getMailboxServerName(Context context, int mailboxType) {
|
||||
int resId = -1;
|
||||
switch (mailboxType) {
|
||||
case Mailbox.TYPE_INBOX:
|
||||
resId = R.string.mailbox_name_server_inbox;
|
||||
break;
|
||||
case Mailbox.TYPE_OUTBOX:
|
||||
resId = R.string.mailbox_name_server_outbox;
|
||||
break;
|
||||
case Mailbox.TYPE_DRAFTS:
|
||||
resId = R.string.mailbox_name_server_drafts;
|
||||
break;
|
||||
case Mailbox.TYPE_TRASH:
|
||||
resId = R.string.mailbox_name_server_trash;
|
||||
break;
|
||||
case Mailbox.TYPE_SENT:
|
||||
resId = R.string.mailbox_name_server_sent;
|
||||
break;
|
||||
case Mailbox.TYPE_JUNK:
|
||||
resId = R.string.mailbox_name_server_junk;
|
||||
break;
|
||||
}
|
||||
return resId != -1 ? context.getString(resId) : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by account setup to test if an account's settings are appropriate. The definition
|
||||
* of "checked" here is simply, can you log into the account and does it meet some minimum set
|
||||
|
|
|
@ -3027,7 +3027,8 @@ outer:
|
|||
Object[] values = new Object[UIProvider.FOLDERS_PROJECTION.length];
|
||||
values[UIProvider.FOLDER_ID_COLUMN] = 0;
|
||||
values[UIProvider.FOLDER_URI_COLUMN] = combinedUriString("uifolder", idString);
|
||||
values[UIProvider.FOLDER_NAME_COLUMN] = getMailboxNameForType(mailboxType);
|
||||
values[UIProvider.FOLDER_NAME_COLUMN] =
|
||||
Mailbox.getSystemMailboxName(getContext(), mailboxType);
|
||||
values[UIProvider.FOLDER_HAS_CHILDREN_COLUMN] = 0;
|
||||
values[UIProvider.FOLDER_CAPABILITIES_COLUMN] = UIProvider.FolderCapabilities.IS_VIRTUAL;
|
||||
values[UIProvider.FOLDER_CONVERSATION_LIST_URI_COLUMN] = combinedUriString("uimessages",
|
||||
|
@ -3485,44 +3486,12 @@ outer:
|
|||
return att;
|
||||
}
|
||||
|
||||
private String getMailboxNameForType(int mailboxType) {
|
||||
Context context = getContext();
|
||||
int resId;
|
||||
switch (mailboxType) {
|
||||
case Mailbox.TYPE_INBOX:
|
||||
resId = R.string.mailbox_name_server_inbox;
|
||||
break;
|
||||
case Mailbox.TYPE_OUTBOX:
|
||||
resId = R.string.mailbox_name_server_outbox;
|
||||
break;
|
||||
case Mailbox.TYPE_DRAFTS:
|
||||
resId = R.string.mailbox_name_server_drafts;
|
||||
break;
|
||||
case Mailbox.TYPE_TRASH:
|
||||
resId = R.string.mailbox_name_server_trash;
|
||||
break;
|
||||
case Mailbox.TYPE_SENT:
|
||||
resId = R.string.mailbox_name_server_sent;
|
||||
break;
|
||||
case Mailbox.TYPE_JUNK:
|
||||
resId = R.string.mailbox_name_server_junk;
|
||||
break;
|
||||
case Mailbox.TYPE_STARRED:
|
||||
resId = R.string.widget_starred;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Illegal mailbox type");
|
||||
}
|
||||
return context.getString(resId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a mailbox given the account and mailboxType.
|
||||
*/
|
||||
private Mailbox createMailbox(long accountId, int mailboxType) {
|
||||
Context context = getContext();
|
||||
Mailbox box = Mailbox.newSystemMailbox(accountId, mailboxType,
|
||||
getMailboxNameForType(mailboxType));
|
||||
Mailbox box = Mailbox.newSystemMailbox(context, accountId, mailboxType);
|
||||
// Make sure drafts and save will show up in recents...
|
||||
// If these already exist (from old Email app), they will have touch times
|
||||
switch (mailboxType) {
|
||||
|
|
Loading…
Reference in New Issue