Embed Settings into Account object
Change-Id: Ie9e5d32fbd3c0dd21a43e7c6106c32641b51d467
diff --git a/src/com/android/mail/compose/ComposeActivity.java b/src/com/android/mail/compose/ComposeActivity.java
index a6c0744..e9405cb 100644
--- a/src/com/android/mail/compose/ComposeActivity.java
+++ b/src/com/android/mail/compose/ComposeActivity.java
@@ -97,7 +97,7 @@
public class ComposeActivity extends Activity implements OnClickListener, OnNavigationListener,
RespondInlineListener, DialogInterface.OnClickListener, TextWatcher,
- AttachmentDeletedListener, OnAccountChangedListener, LoaderCallbacks<Cursor> {
+ AttachmentDeletedListener, OnAccountChangedListener {
// Identifiers for which type of composition this is
static final int COMPOSE = -1;
static final int REPLY = 0;
@@ -159,7 +159,6 @@
// Request numbers for activities we start
private static final int RESULT_PICK_ATTACHMENT = 1;
private static final int RESULT_CREATE_ACCOUNT = 2;
- private static final int ACCOUNT_SETTINGS_LOADER = 0;
// TODO(mindyp) set mime-type for auto send?
private static final String AUTO_SEND_ACTION = "com.android.mail.action.AUTO_SEND";
@@ -411,8 +410,9 @@
assert(account != null);
if (!account.equals(mAccount)) {
mAccount = account;
+ mCachedSettings = mAccount.settings;
+ appendSignature();
}
- getLoaderManager().restartLoader(ACCOUNT_SETTINGS_LOADER, null, this);
}
private void initFromSpinner(int action) {
@@ -1694,7 +1694,7 @@
if (mRecipient != null && mRecipient.equals(mAccount.name)) {
mRecipient = selectedAccount.name;
}
- mAccount = selectedAccount.account;
+ setAccount(selectedAccount.account);
// Don't display the toast if the user is just changing the orientation,
// but we still need to save the draft to the cursor because this is how we restore
@@ -1878,9 +1878,8 @@
public void onAccountChanged() {
mReplyFromAccount = mFromSpinner.getCurrentAccount();
if (!mAccount.equals(mReplyFromAccount.account)) {
- mAccount = mReplyFromAccount.account;
- mCachedSettings = null;
- getLoaderManager().restartLoader(ACCOUNT_SETTINGS_LOADER, null, this);
+ setAccount(mReplyFromAccount.account);
+
// TODO: handle discarding attachments when switching accounts.
// Only enable save for this draft if there is any other content
// in the message.
@@ -2105,31 +2104,4 @@
// Do nothing.
}
}
-
- @Override
- public Loader<Cursor> onCreateLoader(int id, Bundle args) {
- if (id == ACCOUNT_SETTINGS_LOADER) {
- if (mAccount != null && mAccount.settingsQueryUri != null) {
- return new CursorLoader(this, mAccount.settingsQueryUri,
- UIProvider.SETTINGS_PROJECTION, null, null, null);
- }
- }
- return null;
- }
-
- @Override
- public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
- if (loader.getId() == ACCOUNT_SETTINGS_LOADER) {
- if (data != null) {
- data.moveToFirst();
- mCachedSettings = new Settings(data);
- appendSignature();
- }
- }
- }
-
- @Override
- public void onLoaderReset(Loader<Cursor> loader) {
- // Do nothing.
- }
}
\ No newline at end of file
diff --git a/src/com/android/mail/providers/Account.java b/src/com/android/mail/providers/Account.java
index 66ae656..f945c96 100644
--- a/src/com/android/mail/providers/Account.java
+++ b/src/com/android/mail/providers/Account.java
@@ -33,6 +33,8 @@
import java.lang.StringBuilder;
public class Account extends android.accounts.Account implements Parcelable {
+ private static final String SETTINGS_KEY = "settings";
+
/**
* The version of the UI provider schema from which this account provider
* will return results.
@@ -100,11 +102,6 @@
public final Uri settingsIntentUri;
/**
- * The content provider uri that can be used to query user settings/preferences
- */
- public final Uri settingsQueryUri;
-
- /**
* Uri for VIEW intent that will cause the help screens for this account type to be
* shown.
*/
@@ -133,10 +130,15 @@
*/
public final Uri recentFolderListUri;
+ /**
+ * Settings object for this account.
+ */
+ public final Settings settings;
+
private static final String LOG_TAG = new LogUtils().getLogTag();
/**
- * Return a serialized String for this folder.
+ * Return a serialized String for this account.
*/
public synchronized String serialize() {
JSONObject json = new JSONObject();
@@ -155,15 +157,17 @@
json.put(UIProvider.AccountColumns.EXPUNGE_MESSAGE_URI, expungeMessageUri);
json.put(UIProvider.AccountColumns.UNDO_URI, undoUri);
json.put(UIProvider.AccountColumns.SETTINGS_INTENT_URI, settingsIntentUri);
- json.put(UIProvider.AccountColumns.SETTINGS_QUERY_URI, settingsQueryUri);
json.put(UIProvider.AccountColumns.HELP_INTENT_URI, helpIntentUri);
json.put(UIProvider.AccountColumns.SEND_FEEDBACK_INTENT_URI, sendFeedbackIntentUri);
json.put(UIProvider.AccountColumns.SYNC_STATUS, syncStatus);
json.put(UIProvider.AccountColumns.COMPOSE_URI, composeIntentUri);
json.put(UIProvider.AccountColumns.MIME_TYPE, mimeType);
json.put(UIProvider.AccountColumns.RECENT_FOLDER_LIST_URI, recentFolderListUri);
+ if (settings != null) {
+ json.put(SETTINGS_KEY, settings.toJSON());
+ }
} catch (JSONException e) {
- LogUtils.wtf(LOG_TAG, e, "Could not serialize account with name " + name);
+ LogUtils.wtf(LOG_TAG, e, "Could not serialize account with name %s", name);
}
return json.toString();
}
@@ -187,8 +191,8 @@
final String type = (String) json.get(UIProvider.AccountColumns.TYPE);
return new Account(name, type, serializedAccount);
} catch (JSONException e) {
- LogUtils.wtf(LOG_TAG, e, "Could not create an account from this input: \""
- + serializedAccount + "\"");
+ LogUtils.wtf(LOG_TAG, e, "Could not create an account from this input: \"%s\"",
+ serializedAccount);
return null;
}
}
@@ -232,8 +236,6 @@
undoUri = getValidUri(json.optString(UIProvider.AccountColumns.UNDO_URI));
settingsIntentUri = getValidUri(json
.optString(UIProvider.AccountColumns.SETTINGS_INTENT_URI));
- settingsQueryUri = getValidUri(json.optString(
- UIProvider.AccountColumns.SETTINGS_QUERY_URI));
helpIntentUri = getValidUri(json.optString(UIProvider.AccountColumns.HELP_INTENT_URI));
sendFeedbackIntentUri =
getValidUri(json.optString(UIProvider.AccountColumns.SEND_FEEDBACK_INTENT_URI));
@@ -242,6 +244,8 @@
mimeType = json.optString(UIProvider.AccountColumns.MIME_TYPE);
recentFolderListUri = getValidUri(
json.optString(UIProvider.AccountColumns.RECENT_FOLDER_LIST_URI));
+
+ settings = Settings.newInstance(json.optJSONObject(SETTINGS_KEY));
}
public Account(Parcel in) {
@@ -257,13 +261,14 @@
expungeMessageUri = in.readParcelable(null);
undoUri = in.readParcelable(null);
settingsIntentUri = in.readParcelable(null);
- settingsQueryUri = in.readParcelable(null);
helpIntentUri = in.readParcelable(null);
sendFeedbackIntentUri = in.readParcelable(null);
syncStatus = in.readInt();
composeIntentUri = in.readParcelable(null);
mimeType = in.readString();
recentFolderListUri = in.readParcelable(null);
+ final String serializedSettings = in.readString();
+ settings = Settings.newInstance(serializedSettings);
}
public Account(Cursor cursor) {
@@ -284,10 +289,10 @@
expungeMessageUri = !TextUtils.isEmpty(expunge) ? Uri.parse(expunge) : null;
final String undo = cursor.getString(UIProvider.ACCOUNT_UNDO_URI_COLUMN);
undoUri = !TextUtils.isEmpty(undo) ? Uri.parse(undo) : null;
- final String settings = cursor.getString(UIProvider.ACCOUNT_SETTINGS_INTENT_URI_COLUMN);
- settingsIntentUri = !TextUtils.isEmpty(settings) ? Uri.parse(settings) : null;
- final String settingsQuery = cursor.getString(UIProvider.ACCOUNT_SETTINGS_QUERY_URI_COLUMN);
- settingsQueryUri = !TextUtils.isEmpty(settingsQuery) ? Uri.parse(settingsQuery) : null;
+ final String settingsUriString =
+ cursor.getString(UIProvider.ACCOUNT_SETTINGS_INTENT_URI_COLUMN);
+ settingsIntentUri =
+ !TextUtils.isEmpty(settingsUriString) ? Uri.parse(settingsUriString) : null;
final String help = cursor.getString(UIProvider.ACCOUNT_HELP_INTENT_URI_COLUMN);
helpIntentUri = !TextUtils.isEmpty(help) ? Uri.parse(help) : null;
final String sendFeedback =
@@ -299,6 +304,8 @@
mimeType = cursor.getString(UIProvider.ACCOUNT_MIME_TYPE_COLUMN);
final String recent = cursor.getString(UIProvider.ACCOUNT_RECENT_FOLDER_LIST_URI_COLUMN);
recentFolderListUri = !TextUtils.isEmpty(recent) ? Uri.parse(recent) : null;
+
+ settings = new Settings(cursor);
}
/**
@@ -342,21 +349,13 @@
dest.writeParcelable(expungeMessageUri, 0);
dest.writeParcelable(undoUri, 0);
dest.writeParcelable(settingsIntentUri, 0);
- dest.writeParcelable(settingsQueryUri, 0);
dest.writeParcelable(helpIntentUri, 0);
dest.writeParcelable(sendFeedbackIntentUri, 0);
dest.writeInt(syncStatus);
dest.writeParcelable(composeIntentUri, 0);
dest.writeString(mimeType);
dest.writeParcelable(recentFolderListUri, 0);
- }
-
- /**
- * Get the settings associated with this account.
- * TODO: this method is just a stand-in.
- */
- public Cursor getSettings() {
- return null;
+ dest.writeString(settings.serialize());
}
@Override
@@ -387,8 +386,6 @@
sb.append(undoUri);
sb.append(",settingsIntentUri=");
sb.append(settingsIntentUri);
- sb.append(",settingsQueryUri=");
- sb.append(settingsQueryUri);
sb.append(",helpIntentUri=");
sb.append(helpIntentUri);
sb.append(",sendFeedbackIntentUri=");
@@ -401,6 +398,8 @@
sb.append(mimeType);
sb.append(",recentFoldersUri=");
sb.append(recentFolderListUri);
+ sb.append(",settings=");
+ sb.append(settings.serialize());
return sb.toString();
}
@@ -427,7 +426,6 @@
Objects.equal(expungeMessageUri, other.expungeMessageUri) &&
Objects.equal(undoUri, other.undoUri) &&
Objects.equal(settingsIntentUri, other.settingsIntentUri) &&
- Objects.equal(settingsQueryUri, other.settingsQueryUri) &&
Objects.equal(helpIntentUri, other.helpIntentUri) &&
Objects.equal(sendFeedbackIntentUri, other.sendFeedbackIntentUri) &&
(syncStatus == other.syncStatus) &&
@@ -440,7 +438,7 @@
public int hashCode() {
return super.hashCode() ^ Objects.hashCode(name, type, capabilities, providerVersion,
uri, folderListUri, searchUri, accountFromAddresses, saveDraftUri,
- sendMessageUri, expungeMessageUri, undoUri, settingsIntentUri, settingsQueryUri,
+ sendMessageUri, expungeMessageUri, undoUri, settingsIntentUri,
helpIntentUri, sendFeedbackIntentUri, syncStatus, composeIntentUri, mimeType,
recentFolderListUri);
}
diff --git a/src/com/android/mail/providers/MailAppProvider.java b/src/com/android/mail/providers/MailAppProvider.java
index 88a0802..120fa7c 100644
--- a/src/com/android/mail/providers/MailAppProvider.java
+++ b/src/com/android/mail/providers/MailAppProvider.java
@@ -44,6 +44,7 @@
import com.google.common.collect.Sets;
import java.lang.IllegalStateException;
+import java.lang.Integer;
import java.lang.StringBuilder;
import java.util.Collections;
import java.util.Map;
@@ -218,9 +219,6 @@
UIProvider.AccountColumns.SETTINGS_INTENT_URI)) {
builder.add(account.settingsIntentUri);
} else if (TextUtils.equals(column,
- UIProvider.AccountColumns.SETTINGS_QUERY_URI)) {
- builder.add(account.settingsQueryUri);
- } else if (TextUtils.equals(column,
UIProvider.AccountColumns.HELP_INTENT_URI)) {
builder.add(account.helpIntentUri);
} else if (TextUtils.equals(column,
@@ -235,6 +233,39 @@
} else if (TextUtils.equals(column,
UIProvider.AccountColumns.RECENT_FOLDER_LIST_URI)) {
builder.add(account.recentFolderListUri);
+ } else if (TextUtils.equals(column,
+ UIProvider.AccountColumns.SettingsColumns.SIGNATURE)) {
+ builder.add(account.settings.signature);
+ } else if (TextUtils.equals(column,
+ UIProvider.AccountColumns.SettingsColumns.AUTO_ADVANCE)) {
+ builder.add(Integer.valueOf(account.settings.autoAdvance));
+ } else if (TextUtils.equals(column,
+ UIProvider.AccountColumns.SettingsColumns.MESSAGE_TEXT_SIZE)) {
+ builder.add(Integer.valueOf(account.settings.messageTextSize));
+ } else if (TextUtils.equals(column,
+ UIProvider.AccountColumns.SettingsColumns.REPLY_BEHAVIOR)) {
+ builder.add(Integer.valueOf(account.settings.replyBehavior));
+ } else if (TextUtils.equals(column,
+ UIProvider.AccountColumns.SettingsColumns.HIDE_CHECKBOXES)) {
+ builder.add(Integer.valueOf(account.settings.hideCheckboxes ? 1 : 0));
+ } else if (TextUtils.equals(column,
+ UIProvider.AccountColumns.SettingsColumns.CONFIRM_DELETE)) {
+ builder.add(Integer.valueOf(account.settings.confirmDelete ? 1 : 0));
+ } else if (TextUtils.equals(column,
+ UIProvider.AccountColumns.SettingsColumns.CONFIRM_ARCHIVE)) {
+ builder.add(Integer.valueOf(account.settings.confirmArchive ? 1 : 0));
+ } else if (TextUtils.equals(column,
+ UIProvider.AccountColumns.SettingsColumns.CONFIRM_SEND)) {
+ builder.add(Integer.valueOf(account.settings.confirmSend ? 1 : 0));
+ } else if (TextUtils.equals(column,
+ UIProvider.AccountColumns.SettingsColumns.DEFAULT_INBOX)) {
+ builder.add(account.settings.defaultInbox);
+ } else if (TextUtils.equals(column,
+ UIProvider.AccountColumns.SettingsColumns.SNAP_HEADERS)) {
+ builder.add(Integer.valueOf(account.settings.snapHeaders));
+ } else if (TextUtils.equals(column,
+ UIProvider.AccountColumns.SettingsColumns.FORCE_REPLY_FROM_DEFAULT)) {
+ builder.add(Integer.valueOf(account.settings.forceReplyFromDefault ? 1 : 0));
} else {
throw new IllegalStateException("Column not found: " + column);
}
@@ -389,8 +420,12 @@
try {
final AccountCacheEntry accountEntry =
new AccountCacheEntry(serializedAccount);
- addAccountImpl(accountEntry.mAccount, accountEntry.mAccountsQueryUri,
- false /* don't notify */);
+ if (accountEntry.mAccount.settings != null) {
+ addAccountImpl(accountEntry.mAccount, accountEntry.mAccountsQueryUri,
+ false /* don't notify */);
+ } else {
+ LogUtils.e(LOG_TAG, "Dropping account that doesn't specify settings");
+ }
} catch (Exception e) {
// Unable to create account object, skip to next
LogUtils.e(LOG_TAG, e,
diff --git a/src/com/android/mail/providers/Settings.java b/src/com/android/mail/providers/Settings.java
index c7f42c6..a179125 100644
--- a/src/com/android/mail/providers/Settings.java
+++ b/src/com/android/mail/providers/Settings.java
@@ -16,27 +16,36 @@
package com.android.mail.providers;
+import com.android.mail.utils.LogUtils;
+import com.android.mail.utils.Utils;
+
import android.database.Cursor;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+
/**
* Model to hold Settings for an account.
*/
public class Settings implements Parcelable {
- public String signature;
- public int autoAdvance;
- public int messageTextSize;
- public int snapHeaders;
- public int replyBehavior;
- public boolean hideCheckboxes;
- public boolean confirmDelete;
- public boolean confirmArchive;
- public boolean confirmSend;
- public Uri defaultInbox;
- public boolean forceReplyFromDefault;
+ private static final String LOG_TAG = new LogUtils().getLogTag();
+
+ public final String signature;
+ public final int autoAdvance;
+ public final int messageTextSize;
+ public final int snapHeaders;
+ public final int replyBehavior;
+ public final boolean hideCheckboxes;
+ public final boolean confirmDelete;
+ public final boolean confirmArchive;
+ public final boolean confirmSend;
+ public final Uri defaultInbox;
+ public final boolean forceReplyFromDefault;
public Settings(Parcel inParcel) {
signature = inParcel.readString();
@@ -54,21 +63,173 @@
}
public Settings(Cursor cursor) {
- signature = cursor.getString(UIProvider.SETTINGS_SIGNATURE_COLUMN);
- autoAdvance = cursor.getInt(UIProvider.SETTINGS_AUTO_ADVANCE_COLUMN);
- messageTextSize = cursor.getInt(UIProvider.SETTINGS_MESSAGE_TEXT_SIZE_COLUMN);
- snapHeaders = cursor.getInt(UIProvider.SETTINGS_SNAP_HEADERS_COLUMN);
- replyBehavior = cursor.getInt(UIProvider.SETTINGS_REPLY_BEHAVIOR_COLUMN);
- hideCheckboxes = cursor.getInt(UIProvider.SETTINGS_HIDE_CHECKBOXES_COLUMN) != 0;
- confirmDelete = cursor.getInt(UIProvider.SETTINGS_CONFIRM_DELETE_COLUMN) != 0;
- confirmArchive = cursor.getInt(UIProvider.SETTINGS_CONFIRM_ARCHIVE_COLUMN) != 0;
- confirmSend = cursor.getInt(UIProvider.SETTINGS_CONFIRM_SEND_COLUMN) != 0;
- final String inbox = cursor.getString(UIProvider.SETTINGS_DEFAULT_INBOX_COLUMN);
+ signature = cursor.getString(UIProvider.ACCOUNT_SETTINGS_SIGNATURE_COLUMN);
+ autoAdvance = cursor.getInt(UIProvider.ACCOUNT_SETTINGS_AUTO_ADVANCE_COLUMN);
+ messageTextSize = cursor.getInt(UIProvider.ACCOUNT_SETTINGS_MESSAGE_TEXT_SIZE_COLUMN);
+ snapHeaders = cursor.getInt(UIProvider.ACCOUNT_SETTINGS_SNAP_HEADERS_COLUMN);
+ replyBehavior = cursor.getInt(UIProvider.ACCOUNT_SETTINGS_REPLY_BEHAVIOR_COLUMN);
+ hideCheckboxes = cursor.getInt(UIProvider.ACCOUNT_SETTINGS_HIDE_CHECKBOXES_COLUMN) != 0;
+ confirmDelete = cursor.getInt(UIProvider.ACCOUNT_SETTINGS_CONFIRM_DELETE_COLUMN) != 0;
+ confirmArchive = cursor.getInt(UIProvider.ACCOUNT_SETTINGS_CONFIRM_ARCHIVE_COLUMN) != 0;
+ confirmSend = cursor.getInt(UIProvider.ACCOUNT_SETTINGS_CONFIRM_SEND_COLUMN) != 0;
+ final String inbox = cursor.getString(UIProvider.ACCOUNT_SETTINGS_DEFAULT_INBOX_COLUMN);
defaultInbox = !TextUtils.isEmpty(inbox) ? Uri.parse(inbox) : null;
forceReplyFromDefault = cursor.getInt(
- UIProvider.SETTINGS_FORCE_REPLY_FROM_DEFAULT_COLUMN) != 0;
+ UIProvider.ACCOUNT_SETTINGS_FORCE_REPLY_FROM_DEFAULT_COLUMN) != 0;
}
+ private Settings(JSONObject json) throws JSONException {
+ signature = (String) json.optString(UIProvider.AccountColumns.SettingsColumns.SIGNATURE);
+
+ autoAdvance = json.optInt(UIProvider.AccountColumns.SettingsColumns.AUTO_ADVANCE);
+ messageTextSize = json.optInt(UIProvider.AccountColumns.SettingsColumns.MESSAGE_TEXT_SIZE);
+ snapHeaders = json.optInt(UIProvider.AccountColumns.SettingsColumns.SNAP_HEADERS);
+ replyBehavior = json.optInt(UIProvider.AccountColumns.SettingsColumns.REPLY_BEHAVIOR);
+ hideCheckboxes = json.optBoolean(UIProvider.AccountColumns.SettingsColumns.HIDE_CHECKBOXES);
+ confirmDelete = json.optBoolean(UIProvider.AccountColumns.SettingsColumns.CONFIRM_DELETE);
+ confirmArchive = json.optBoolean(UIProvider.AccountColumns.SettingsColumns.CONFIRM_ARCHIVE);
+ confirmSend = json.optBoolean(UIProvider.AccountColumns.SettingsColumns.CONFIRM_SEND);
+ defaultInbox = getValidUri(
+ json.optString(UIProvider.AccountColumns.SettingsColumns.DEFAULT_INBOX));
+ forceReplyFromDefault =
+ json.optBoolean(UIProvider.AccountColumns.SettingsColumns.FORCE_REPLY_FROM_DEFAULT);
+ }
+
+ /**
+ * Parse a string (possibly null or empty) into a URI. If the string is null or empty, null
+ * is returned back. Otherwise an empty URI is returned.
+ * @param uri
+ * @return a valid URI, possibly {@link android.net.Uri#EMPTY}
+ */
+ private static Uri getValidUri(String uri) {
+ return Utils.getValidUri(uri);
+ }
+
+ /**
+ * Return a serialized String for these settings.
+ */
+ public synchronized String serialize() {
+ final JSONObject json = toJSON();
+ return json.toString();
+ }
+
+ /**
+ * Return a JSONObject for these settings.
+ */
+ public synchronized JSONObject toJSON() {
+ final JSONObject json = new JSONObject();
+ try {
+ json.put(UIProvider.AccountColumns.SettingsColumns.SIGNATURE, signature);
+ json.put(UIProvider.AccountColumns.SettingsColumns.AUTO_ADVANCE, autoAdvance);
+ json.put(UIProvider.AccountColumns.SettingsColumns.MESSAGE_TEXT_SIZE, messageTextSize);
+ json.put(UIProvider.AccountColumns.SettingsColumns.SNAP_HEADERS, snapHeaders);
+ json.put(UIProvider.AccountColumns.SettingsColumns.REPLY_BEHAVIOR, replyBehavior);
+ json.put(UIProvider.AccountColumns.SettingsColumns.HIDE_CHECKBOXES, hideCheckboxes);
+ json.put(UIProvider.AccountColumns.SettingsColumns.CONFIRM_DELETE, confirmDelete);
+ json.put(UIProvider.AccountColumns.SettingsColumns.CONFIRM_ARCHIVE, confirmArchive);
+ json.put(UIProvider.AccountColumns.SettingsColumns.CONFIRM_SEND, confirmSend);
+ json.put(UIProvider.AccountColumns.SettingsColumns.DEFAULT_INBOX, defaultInbox);
+ json.put(UIProvider.AccountColumns.SettingsColumns.FORCE_REPLY_FROM_DEFAULT,
+ forceReplyFromDefault);
+ } catch (JSONException e) {
+ LogUtils.wtf(LOG_TAG, e, "Could not serialize settings");
+ }
+ return json;
+ }
+
+ /**
+ * Create a new instance of an Settings object using a serialized instance created previously
+ * using {@link #serialize()}. This returns null if the serialized instance was invalid or does
+ * not represent a valid account object.
+ *
+ * @param serializedAccount
+ * @return
+ */
+ public static Settings newInstance(String serializedSettings) {
+ JSONObject json = null;
+ try {
+ json = new JSONObject(serializedSettings);
+ return new Settings(json);
+ } catch (JSONException e) {
+ LogUtils.wtf(LOG_TAG, e, "Could not create an settings from this input: \"%s\"",
+ serializedSettings);
+ return null;
+ }
+ }
+
+
+ /**
+ * Create a new instance of an Settings object using a JSONObject instance created previously
+ * using {@link #toJSON(). This returns null if the serialized instance was invalid or does
+ * not represent a valid account object.
+ *
+ * @param serializedAccount
+ * @return
+ */
+ public static Settings newInstance(JSONObject json) {
+ if (json == null) {
+ return null;
+ }
+ try {
+ return new Settings(json);
+ } catch (JSONException e) {
+ LogUtils.wtf(LOG_TAG, e, "Could not create an settings from this input: \"%s\"",
+ json.toString());
+ return null;
+ }
+ }
+
+
+
+ /**
+ * Integer column contaning the user's specified snap header preference. This value
+ * will be one of the values in {@link UIProvider.SnapHeaderValue}
+ */
+ public static final String SNAP_HEADERS = "snap_headers";
+
+ /**
+ * Integer column containing the user's specified default reply behavior. This value will
+ * be one of the values in {@link UIProvider.DefaultReplyBehavior}
+ */
+ public static final String REPLY_BEHAVIOR = "reply_behavior";
+
+ /**
+ * Integer column containing the user's specified checkbox preference. A
+ * non zero value means to hide checkboxes.
+ */
+ public static final String HIDE_CHECKBOXES = "hide_checkboxes";
+
+ /**
+ * Integer column containing the user's specified confirm delete preference value.
+ * A non zero value indicates that the user has indicated that a confirmation should
+ * be shown when a delete action is performed.
+ */
+ public static final String CONFIRM_DELETE = "confirm_delete";
+
+ /**
+ * Integer column containing the user's specified confirm archive preference value.
+ * A non zero value indicates that the user has indicated that a confirmation should
+ * be shown when an archive action is performed.
+ */
+ public static final String CONFIRM_ARCHIVE = "confirm_archive";
+
+ /**
+ * Integer column containing the user's specified confirm send preference value.
+ * A non zero value indicates that the user has indicated that a confirmation should
+ * be shown when a send action is performed.
+ */
+ public static final String CONFIRM_SEND = "confirm_send";
+ /**
+ * String folder containing the serialized default inbox folder for an account.
+ */
+ public static final String DEFAULT_INBOX = "default_inbox";
+ /**
+ * Integer column containing a non zero value if replies should always be sent from
+ * a default address instead of a recipient.
+ */
+ public static String FORCE_REPLY_FROM_DEFAULT = "force_reply_from_default";
+
+
@Override
public int describeContents() {
return 0;
diff --git a/src/com/android/mail/providers/UIProvider.java b/src/com/android/mail/providers/UIProvider.java
index d9131bd..4fb30c0 100644
--- a/src/com/android/mail/providers/UIProvider.java
+++ b/src/com/android/mail/providers/UIProvider.java
@@ -99,13 +99,23 @@
AccountColumns.EXPUNGE_MESSAGE_URI,
AccountColumns.UNDO_URI,
AccountColumns.SETTINGS_INTENT_URI,
- AccountColumns.SETTINGS_QUERY_URI,
AccountColumns.SYNC_STATUS,
AccountColumns.HELP_INTENT_URI,
AccountColumns.SEND_FEEDBACK_INTENT_URI,
AccountColumns.COMPOSE_URI,
AccountColumns.MIME_TYPE,
- AccountColumns.RECENT_FOLDER_LIST_URI
+ AccountColumns.RECENT_FOLDER_LIST_URI,
+ AccountColumns.SettingsColumns.SIGNATURE,
+ AccountColumns.SettingsColumns.AUTO_ADVANCE,
+ AccountColumns.SettingsColumns.MESSAGE_TEXT_SIZE,
+ AccountColumns.SettingsColumns.SNAP_HEADERS,
+ AccountColumns.SettingsColumns.REPLY_BEHAVIOR,
+ AccountColumns.SettingsColumns.HIDE_CHECKBOXES,
+ AccountColumns.SettingsColumns.CONFIRM_DELETE,
+ AccountColumns.SettingsColumns.CONFIRM_ARCHIVE,
+ AccountColumns.SettingsColumns.CONFIRM_SEND,
+ AccountColumns.SettingsColumns.DEFAULT_INBOX,
+ AccountColumns.SettingsColumns.FORCE_REPLY_FROM_DEFAULT
};
public static final int ACCOUNT_ID_COLUMN = 0;
@@ -121,13 +131,25 @@
public static final int ACCOUNT_EXPUNGE_MESSAGE_URI_COLUMN = 10;
public static final int ACCOUNT_UNDO_URI_COLUMN = 11;
public static final int ACCOUNT_SETTINGS_INTENT_URI_COLUMN = 12;
- public static final int ACCOUNT_SETTINGS_QUERY_URI_COLUMN = 13;
- public static final int ACCOUNT_SYNC_STATUS_COLUMN = 14;
- public static final int ACCOUNT_HELP_INTENT_URI_COLUMN = 15;
- public static final int ACCOUNT_SEND_FEEDBACK_INTENT_URI_COLUMN = 16;
- public static final int ACCOUNT_COMPOSE_INTENT_URI_COLUMN = 17;
- public static final int ACCOUNT_MIME_TYPE_COLUMN = 18;
- public static final int ACCOUNT_RECENT_FOLDER_LIST_URI_COLUMN = 19;
+ public static final int ACCOUNT_SYNC_STATUS_COLUMN = 13;
+ public static final int ACCOUNT_HELP_INTENT_URI_COLUMN = 14;
+ public static final int ACCOUNT_SEND_FEEDBACK_INTENT_URI_COLUMN = 15;
+ public static final int ACCOUNT_COMPOSE_INTENT_URI_COLUMN = 16;
+ public static final int ACCOUNT_MIME_TYPE_COLUMN = 17;
+ public static final int ACCOUNT_RECENT_FOLDER_LIST_URI_COLUMN = 18;
+
+ public static final int ACCOUNT_SETTINGS_SIGNATURE_COLUMN = 19;
+ public static final int ACCOUNT_SETTINGS_AUTO_ADVANCE_COLUMN = 20;
+ public static final int ACCOUNT_SETTINGS_MESSAGE_TEXT_SIZE_COLUMN = 21;
+ public static final int ACCOUNT_SETTINGS_SNAP_HEADERS_COLUMN = 21;
+ public static final int ACCOUNT_SETTINGS_REPLY_BEHAVIOR_COLUMN = 23;
+ public static final int ACCOUNT_SETTINGS_HIDE_CHECKBOXES_COLUMN = 24;
+ public static final int ACCOUNT_SETTINGS_CONFIRM_DELETE_COLUMN = 25;
+ public static final int ACCOUNT_SETTINGS_CONFIRM_ARCHIVE_COLUMN = 26;
+ public static final int ACCOUNT_SETTINGS_CONFIRM_SEND_COLUMN = 27;
+ public static final int ACCOUNT_SETTINGS_DEFAULT_INBOX_COLUMN = 28;
+ public static final int ACCOUNT_SETTINGS_FORCE_REPLY_FROM_DEFAULT_COLUMN = 29;
+
public static final class AccountCapabilities {
/**
@@ -312,14 +334,6 @@
public static String SETTINGS_INTENT_URI = "accountSettingsIntentUri";
/**
- * This string column contains the content provider uri that can be used to query user
- * settings/preferences.
- *
- * The cursor returned by this query support columns declared in {@link SettingsColumns}
- */
- public static final String SETTINGS_QUERY_URI = "accountSettingsQueryUri";
-
- /**
* Uri for VIEW intent that will cause the help screens for this account type to be
* shown.
* TODO: When we want to support a heterogeneous set of account types, this value may need
@@ -353,6 +367,74 @@
* URI for location of recent folders viewed on this account.
*/
public static final String RECENT_FOLDER_LIST_URI = "recentFolderListUri";
+
+ public static final class SettingsColumns {
+ /**
+ * String column containing the contents of the signature for this account. If no
+ * signature has been specified, the value will be null.
+ */
+ public static final String SIGNATURE = "signature";
+
+ /**
+ * Integer column containing the user's specified auto-advance policy. This value will
+ * be one of the values in {@link UIProvider.AutoAdvance}
+ */
+ public static final String AUTO_ADVANCE = "auto_advance";
+
+ /**
+ * Integer column containing the user's specified message text size preference. This
+ * value will be one of the values in {@link UIProvider.MessageTextSize}
+ */
+ public static final String MESSAGE_TEXT_SIZE = "message_text_size";
+
+ /**
+ * Integer column contaning the user's specified snap header preference. This value
+ * will be one of the values in {@link UIProvider.SnapHeaderValue}
+ */
+ public static final String SNAP_HEADERS = "snap_headers";
+
+ /**
+ * Integer column containing the user's specified default reply behavior. This value
+ * will be one of the values in {@link UIProvider.DefaultReplyBehavior}
+ */
+ public static final String REPLY_BEHAVIOR = "reply_behavior";
+
+ /**
+ * Integer column containing the user's specified checkbox preference. A
+ * non zero value means to hide checkboxes.
+ */
+ public static final String HIDE_CHECKBOXES = "hide_checkboxes";
+
+ /**
+ * Integer column containing the user's specified confirm delete preference value.
+ * A non zero value indicates that the user has indicated that a confirmation should
+ * be shown when a delete action is performed.
+ */
+ public static final String CONFIRM_DELETE = "confirm_delete";
+
+ /**
+ * Integer column containing the user's specified confirm archive preference value.
+ * A non zero value indicates that the user has indicated that a confirmation should
+ * be shown when an archive action is performed.
+ */
+ public static final String CONFIRM_ARCHIVE = "confirm_archive";
+
+ /**
+ * Integer column containing the user's specified confirm send preference value.
+ * A non zero value indicates that the user has indicated that a confirmation should
+ * be shown when a send action is performed.
+ */
+ public static final String CONFIRM_SEND = "confirm_send";
+ /**
+ * String folder containing the serialized default inbox folder for an account.
+ */
+ public static final String DEFAULT_INBOX = "default_inbox";
+ /**
+ * Integer column containing a non zero value if replies should always be sent from
+ * a default address instead of a recipient.
+ */
+ public static String FORCE_REPLY_FROM_DEFAULT = "force_reply_from_default";
+ }
}
public static final class SearchQueryParameters {
@@ -1216,32 +1298,6 @@
public static final String SEQUENCE_QUERY_PARAMETER = "seq";
- public static final String[] SETTINGS_PROJECTION = {
- SettingsColumns.SIGNATURE,
- SettingsColumns.AUTO_ADVANCE,
- SettingsColumns.MESSAGE_TEXT_SIZE,
- SettingsColumns.SNAP_HEADERS,
- SettingsColumns.REPLY_BEHAVIOR,
- SettingsColumns.HIDE_CHECKBOXES,
- SettingsColumns.CONFIRM_DELETE,
- SettingsColumns.CONFIRM_ARCHIVE,
- SettingsColumns.CONFIRM_SEND,
- SettingsColumns.DEFAULT_INBOX,
- SettingsColumns.FORCE_REPLY_FROM_DEFAULT
- };
-
- public static final int SETTINGS_SIGNATURE_COLUMN = 0;
- public static final int SETTINGS_AUTO_ADVANCE_COLUMN = 1;
- public static final int SETTINGS_MESSAGE_TEXT_SIZE_COLUMN = 2;
- public static final int SETTINGS_SNAP_HEADERS_COLUMN = 3;
- public static final int SETTINGS_REPLY_BEHAVIOR_COLUMN = 4;
- public static final int SETTINGS_HIDE_CHECKBOXES_COLUMN = 5;
- public static final int SETTINGS_CONFIRM_DELETE_COLUMN = 6;
- public static final int SETTINGS_CONFIRM_ARCHIVE_COLUMN = 7;
- public static final int SETTINGS_CONFIRM_SEND_COLUMN = 8;
- public static final int SETTINGS_DEFAULT_INBOX_COLUMN = 9;
- public static final int SETTINGS_FORCE_REPLY_FROM_DEFAULT_COLUMN = 10;
-
public static final class AutoAdvance {
public static final int UNSET = 0;
public static final int OLDER = 1;
@@ -1268,74 +1324,6 @@
public static final int REPLY_ALL = 1;
}
- public static final class SettingsColumns {
- /**
- * String column containing the contents of the signature for this account. If no
- * signature has been specified, the value will be null.
- */
- public static final String SIGNATURE = "signature";
-
- /**
- * Integer column containing the user's specified auto-advance policy. This value will be
- * one of the values in {@link UIProvider.AutoAdvance}
- */
- public static final String AUTO_ADVANCE = "auto_advance";
-
- /**
- * Integer column containing the user's specified message text size preference. This value
- * will be one of the values in {@link UIProvider.MessageTextSize}
- */
- public static final String MESSAGE_TEXT_SIZE = "message_text_size";
-
- /**
- * Integer column contaning the user's specified snap header preference. This value
- * will be one of the values in {@link UIProvider.SnapHeaderValue}
- */
- public static final String SNAP_HEADERS = "snap_headers";
-
- /**
- * Integer column containing the user's specified default reply behavior. This value will
- * be one of the values in {@link UIProvider.DefaultReplyBehavior}
- */
- public static final String REPLY_BEHAVIOR = "reply_behavior";
-
- /**
- * Integer column containing the user's specified checkbox preference. A
- * non zero value means to hide checkboxes.
- */
- public static final String HIDE_CHECKBOXES = "hide_checkboxes";
-
- /**
- * Integer column containing the user's specified confirm delete preference value.
- * A non zero value indicates that the user has indicated that a confirmation should
- * be shown when a delete action is performed.
- */
- public static final String CONFIRM_DELETE = "confirm_delete";
-
- /**
- * Integer column containing the user's specified confirm archive preference value.
- * A non zero value indicates that the user has indicated that a confirmation should
- * be shown when an archive action is performed.
- */
- public static final String CONFIRM_ARCHIVE = "confirm_archive";
-
- /**
- * Integer column containing the user's specified confirm send preference value.
- * A non zero value indicates that the user has indicated that a confirmation should
- * be shown when a send action is performed.
- */
- public static final String CONFIRM_SEND = "confirm_send";
- /**
- * String folder containing the serialized default inbox folder for an account.
- */
- public static final String DEFAULT_INBOX = "default_inbox";
- /**
- * Integer column containing a non zero value if replies should always be sent from
- * a default address instead of a recipient.
- */
- public static String FORCE_REPLY_FROM_DEFAULT = "force_reply_from_default";
- }
-
/**
* Action for an intent used to update/create new notifications. The mime type of this
* intent should be set to the mimeType of the account that is generating this notification.
diff --git a/src/com/android/mail/providers/UIProviderValidator.java b/src/com/android/mail/providers/UIProviderValidator.java
index 086b1a4..1fe2318 100644
--- a/src/com/android/mail/providers/UIProviderValidator.java
+++ b/src/com/android/mail/providers/UIProviderValidator.java
@@ -60,13 +60,6 @@
}
/**
- * Validates and returns the projection that can be used for a settings query.
- */
- public static String[] validateSettingsProjection(String[] projection) {
- return getValidProjection(projection, UIProvider.SETTINGS_PROJECTION);
- }
-
- /**
* Validates and returns the projection that can be used for a attachment query.
*/
public static String[] validateAttachmentProjection(String[] projection) {
diff --git a/src/com/android/mail/providers/protos/mock/MockUiProvider.java b/src/com/android/mail/providers/protos/mock/MockUiProvider.java
index cb1ebbc..f60c6c0 100644
--- a/src/com/android/mail/providers/protos/mock/MockUiProvider.java
+++ b/src/com/android/mail/providers/protos/mock/MockUiProvider.java
@@ -32,12 +32,12 @@
import com.android.mail.providers.ReplyFromAccount;
import com.android.mail.providers.UIProvider.AccountCapabilities;
import com.android.mail.providers.UIProvider.AccountColumns;
+import com.android.mail.providers.UIProvider.AccountColumns.SettingsColumns;
import com.android.mail.providers.UIProvider.AttachmentColumns;
import com.android.mail.providers.UIProvider.ConversationColumns;
import com.android.mail.providers.UIProvider.FolderCapabilities;
import com.android.mail.providers.UIProvider.FolderColumns;
import com.android.mail.providers.UIProvider.MessageColumns;
-import com.android.mail.providers.UIProvider.SettingsColumns;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
@@ -138,8 +138,6 @@
ImmutableList.of(folderDetailsMap0, folderDetailsMap1));
Map<String, Object> settings0 = createSettingsDetailsMap(folderDetailsMap0.get(
FolderColumns.URI).toString());
- builder.put(accountDetailsMap0.get(AccountColumns.SETTINGS_QUERY_URI).toString(),
- ImmutableList.of(settings0));
Map<String, Object> folderDetailsMap2 = createFolderDetailsMap(2, "two", 2, 2);
builder.put(folderDetailsMap2.get(FolderColumns.URI).toString(),
@@ -151,8 +149,6 @@
ImmutableList.of(folderDetailsMap2, folderDetailsMap3));
Map<String, Object> settings1 = createSettingsDetailsMap(folderDetailsMap2.get(
FolderColumns.URI).toString());
- builder.put(accountDetailsMap1.get(AccountColumns.SETTINGS_QUERY_URI).toString(),
- ImmutableList.of(settings1));
Map<String, Object> conv2 = createConversationDetailsMap("zeroConv2".hashCode(),
"zeroConv2", 0);
@@ -334,13 +330,15 @@
Uri.parse(accountUri + "/expungeMessage"));
accountMap.put(AccountColumns.UNDO_URI, Uri.parse(accountUri + "/undo"));
accountMap.put(AccountColumns.SETTINGS_INTENT_URI, Uri.parse("http://www.google.com"));
- accountMap.put(AccountColumns.SETTINGS_QUERY_URI, Uri.parse(accountUri + "/settings"));
accountMap.put(AccountColumns.HELP_INTENT_URI, Uri.parse("http://www.google.com"));
accountMap.put(AccountColumns.SYNC_STATUS, 0);
accountMap.put(AccountColumns.COMPOSE_URI, Uri.parse(accountUri + "/compose"));
accountMap.put(AccountColumns.RECENT_FOLDER_LIST_URI,
Uri.parse(accountUri + "/recentFolderListUri"));
accountMap.put(AccountColumns.MIME_TYPE, "account/mock");
+
+ // TODO: store the default inbox
+ accountMap.put(SettingsColumns.DEFAULT_INBOX, null);
if (cacheMap) {
addAccountInfoToAccountCache(accountMap);
}
@@ -432,7 +430,6 @@
dest.writeParcelable((Uri) accountInfo.get(AccountColumns.EXPUNGE_MESSAGE_URI), 0);
dest.writeParcelable((Uri) accountInfo.get(AccountColumns.UNDO_URI), 0);
dest.writeParcelable((Uri) accountInfo.get(AccountColumns.SETTINGS_INTENT_URI), 0);
- dest.writeParcelable((Uri)accountInfo.get(AccountColumns.SETTINGS_QUERY_URI), 0);
dest.writeParcelable((Uri) accountInfo.get(AccountColumns.HELP_INTENT_URI), 0);
dest.writeParcelable((Uri) accountInfo.get(AccountColumns.SEND_FEEDBACK_INTENT_URI), 0);
dest.writeInt((Integer) accountInfo.get(AccountColumns.SYNC_STATUS));
diff --git a/src/com/android/mail/ui/AbstractActivityController.java b/src/com/android/mail/ui/AbstractActivityController.java
index 9c8176b..740f948 100644
--- a/src/com/android/mail/ui/AbstractActivityController.java
+++ b/src/com/android/mail/ui/AbstractActivityController.java
@@ -145,7 +145,6 @@
protected static final String LOG_TAG = new LogUtils().getLogTag();
/** Constants used to differentiate between the types of loaders. */
private static final int LOADER_ACCOUNT_CURSOR = 0;
- private static final int LOADER_ACCOUNT_SETTINGS = 1;
private static final int LOADER_FOLDER_CURSOR = 2;
private static final int LOADER_RECENT_FOLDERS = 3;
private static final int LOADER_CONVERSATION_LIST = 4;
@@ -325,10 +324,8 @@
// the account Inbox.
mAccount = account;
mFolder = null;
- // Reset settings; they are no longer valid.
- onSettingsChanged(null);
+ onSettingsChanged(mAccount.settings);
mActionBarView.setAccount(mAccount);
- restartOptionalLoader(LOADER_ACCOUNT_SETTINGS);
loadAccountInbox();
mRecentFolderList.setCurrentAccount(account);
@@ -772,6 +769,7 @@
if (savedState != null) {
if (savedState.containsKey(SAVED_ACCOUNT)) {
mAccount = ((Account) savedState.getParcelable(SAVED_ACCOUNT));
+ onSettingsChanged(mAccount.settings);
mActionBarView.setAccount(mAccount);
mActivity.invalidateOptionsMenu();
}
@@ -786,7 +784,6 @@
showConversation(mCurrentConversation);
handled = true;
}
- startLoader(LOADER_ACCOUNT_SETTINGS);
} else if (intent != null) {
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
if (intent.hasExtra(Utils.EXTRA_ACCOUNT)) {
@@ -797,6 +794,7 @@
}
if (mAccount != null) {
mActionBarView.setAccount(mAccount);
+ onSettingsChanged(mAccount.settings);
mActivity.invalidateOptionsMenu();
}
@@ -830,7 +828,6 @@
// Nothing was saved; just load the account inbox.
loadAccountInbox();
}
- restartOptionalLoader(LOADER_ACCOUNT_SETTINGS);
} else if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
// Save this search query for future suggestions.
final String query = intent.getStringExtra(SearchManager.QUERY);
@@ -841,9 +838,9 @@
mViewMode.enterSearchResultsListMode();
mAccount = ((Account) intent.getParcelableExtra(Utils.EXTRA_ACCOUNT));
+ onSettingsChanged(mAccount.settings);
mActionBarView.setAccount(mAccount);
fetchSearchFolder(intent);
- restartOptionalLoader(LOADER_ACCOUNT_SETTINGS);
}
}
@@ -937,12 +934,6 @@
case LOADER_FOLDER_CURSOR:
return new CursorLoader(mContext, mFolder.uri, UIProvider.FOLDERS_PROJECTION, null,
null, null);
- case LOADER_ACCOUNT_SETTINGS:
- if (mAccount.settingsQueryUri != null) {
- return new CursorLoader(mContext, mAccount.settingsQueryUri,
- UIProvider.SETTINGS_PROJECTION, null, null, null);
- }
- break;
case LOADER_RECENT_FOLDERS:
if (mAccount.recentFolderListUri != null) {
return new CursorLoader(mContext, mAccount.recentFolderListUri,
@@ -969,6 +960,11 @@
return null;
}
+ @Override
+ public void onLoaderReset(Loader<Cursor> loader) {
+
+ }
+
/**
* {@link LoaderManager} currently has a bug in
* {@link LoaderManager#restartLoader(int, Bundle, android.app.LoaderManager.LoaderCallbacks)}
@@ -1161,15 +1157,6 @@
}
LogUtils.v(LOG_TAG, "FOLDER STATUS = %d", folder.syncStatus);
break;
- case LOADER_ACCOUNT_SETTINGS:
- // An account may actually have no settings if it is one of the
- // special combined accounts.
- Settings settings = null;
- if (data.moveToFirst()) {
- settings = new Settings(data);
- }
- onSettingsChanged(settings);
- break;
case LOADER_RECENT_FOLDERS:
mRecentFolderList.loadFromUiProvider(data);
break;
@@ -1199,18 +1186,6 @@
}
}
- /**
- * {@inheritDoc}
- */
- @Override
- public void onLoaderReset(Loader<Cursor> loader) {
- switch (loader.getId()) {
- case LOADER_ACCOUNT_SETTINGS:
- onSettingsChanged(null);
- break;
- }
- }
-
@Override
public void onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
diff --git a/src/com/android/mail/ui/FolderSelectionActivity.java b/src/com/android/mail/ui/FolderSelectionActivity.java
index b2b8bad..02d3862 100644
--- a/src/com/android/mail/ui/FolderSelectionActivity.java
+++ b/src/com/android/mail/ui/FolderSelectionActivity.java
@@ -202,7 +202,6 @@
finish();
} else if (mConfigureWidget) {
// Check to see if the widget is set to be synchronized
- final Cursor settings = mAccount.getSettings();
final Set<String> synchronizedFoldersSet = Sets.newHashSet();
// Add all of the synchronized folders to the set
diff --git a/src/com/android/mail/ui/SyncForWidgetDialog.java b/src/com/android/mail/ui/SyncForWidgetDialog.java
index fde31f4..eff0b8c 100644
--- a/src/com/android/mail/ui/SyncForWidgetDialog.java
+++ b/src/com/android/mail/ui/SyncForWidgetDialog.java
@@ -43,7 +43,6 @@
final ContentResolver resolver = context.getContentResolver();
// Get the current sync window for the specified account
- final Cursor settings = mAccount.getSettings();
// TODO: get sync days from settings.
final long syncDays = SYNC_DAYS;
@@ -77,7 +76,6 @@
@Override
protected Void doInBackground(Context... params) {
final Context context = params[0];
- final Cursor settings = mAccount.getSettings();
// TODO: (mindyp) enable syncing of folder.
return null;