Clean up member variables.

- Fix misnomered fields.  (e.g. static mMember -> static sMember)
- Reduce visibility.  (e.g. mark as private)
- Mark final / static if possible.

Note it's on master.

There's a lot more cleanup oppotunities in the activities, but they're going
to go through a major overhaul, so I didn't bother.

Change-Id: I3fde73ba5f1f9ff675fff07c510e1e49521dde42
This commit is contained in:
Makoto Onuki 2010-05-10 14:20:16 -07:00
parent 31fa0172cf
commit b3f7dd0169
28 changed files with 139 additions and 138 deletions

View File

@ -91,12 +91,12 @@ public class Account {
/**
* All new fields should have named keys
*/
private final String KEY_SYNC_WINDOW = ".syncWindow";
private final String KEY_BACKUP_FLAGS = ".backupFlags";
private final String KEY_PROTOCOL_VERSION = ".protocolVersion";
private final String KEY_SECURITY_FLAGS = ".securityFlags";
private final String KEY_SIGNATURE = ".signature";
private final String KEY_VIBRATE_WHEN_SILENT = ".vibrateWhenSilent";
private static final String KEY_SYNC_WINDOW = ".syncWindow";
private static final String KEY_BACKUP_FLAGS = ".backupFlags";
private static final String KEY_PROTOCOL_VERSION = ".protocolVersion";
private static final String KEY_SECURITY_FLAGS = ".securityFlags";
private static final String KEY_SIGNATURE = ".signature";
private static final String KEY_VIBRATE_WHEN_SILENT = ".vibrateWhenSilent";
public Account(Context context) {
// TODO Change local store path to something readable / recognizable

View File

@ -50,13 +50,13 @@ import java.util.HashSet;
*/
public class Controller {
static Controller sInstance;
private Context mContext;
private static Controller sInstance;
private final Context mContext;
private Context mProviderContext;
private MessagingController mLegacyController;
private LegacyListener mLegacyListener = new LegacyListener();
private ServiceCallback mServiceCallback = new ServiceCallback();
private HashSet<Result> mListeners = new HashSet<Result>();
private final MessagingController mLegacyController;
private final LegacyListener mLegacyListener = new LegacyListener();
private final ServiceCallback mServiceCallback = new ServiceCallback();
private final HashSet<Result> mListeners = new HashSet<Result>();
private static String[] MESSAGEID_TO_ACCOUNTID_PROJECTION = new String[] {
EmailContent.RECORD_ID,

View File

@ -38,8 +38,6 @@ import java.util.HashMap;
public class Email extends Application {
public static final String LOG_TAG = "Email";
public static File tempDirectory;
/**
* If this is enabled there will be additional logging information sent to
* Log.d, including protocol dumps.

View File

@ -38,7 +38,7 @@ public class EmailAddressAdapter extends ResourceCursorAdapter {
protected static final String SORT_ORDER =
Contacts.TIMES_CONTACTED + " DESC, " + Contacts.DISPLAY_NAME;
protected ContentResolver mContentResolver;
protected final ContentResolver mContentResolver;
protected static final String[] PROJECTION = {
Data._ID, // 0

View File

@ -25,8 +25,8 @@ import java.io.InputStream;
* past where the protocol handler intended the client to read.
*/
public class FixedLengthInputStream extends InputStream {
private InputStream mIn;
private int mLength;
private final InputStream mIn;
private final int mLength;
private int mCount;
public FixedLengthInputStream(InputStream in, int length) {

View File

@ -93,8 +93,8 @@ public class MessagingController implements Runnable {
*/
private static final int MAX_SMALL_MESSAGE_SIZE = (25 * 1024);
private static Flag[] FLAG_LIST_SEEN = new Flag[] { Flag.SEEN };
private static Flag[] FLAG_LIST_FLAGGED = new Flag[] { Flag.FLAGGED };
private static final Flag[] FLAG_LIST_SEEN = new Flag[] { Flag.SEEN };
private static final Flag[] FLAG_LIST_FLAGGED = new Flag[] { Flag.FLAGGED };
/**
* We write this into the serverId field of messages that will never be upsynced.
@ -104,24 +104,24 @@ public class MessagingController implements Runnable {
/**
* Projections & CVs used by pruneCachedAttachments
*/
private static String[] PRUNE_ATTACHMENT_PROJECTION = new String[] {
private static final String[] PRUNE_ATTACHMENT_PROJECTION = new String[] {
AttachmentColumns.LOCATION
};
private static ContentValues PRUNE_ATTACHMENT_CV = new ContentValues();
private static final ContentValues PRUNE_ATTACHMENT_CV = new ContentValues();
static {
PRUNE_ATTACHMENT_CV.putNull(AttachmentColumns.CONTENT_URI);
}
private static MessagingController inst = null;
private BlockingQueue<Command> mCommands = new LinkedBlockingQueue<Command>();
private Thread mThread;
private static MessagingController sInstance = null;
private final BlockingQueue<Command> mCommands = new LinkedBlockingQueue<Command>();
private final Thread mThread;
/**
* All access to mListeners *must* be synchronized
*/
private GroupMessagingListener mListeners = new GroupMessagingListener();
private final GroupMessagingListener mListeners = new GroupMessagingListener();
private boolean mBusy;
private Context mContext;
private final Context mContext;
protected MessagingController(Context _context) {
mContext = _context;
@ -137,17 +137,17 @@ public class MessagingController implements Runnable {
* @return
*/
public synchronized static MessagingController getInstance(Context _context) {
if (inst == null) {
inst = new MessagingController(_context);
if (sInstance == null) {
sInstance = new MessagingController(_context);
}
return inst;
return sInstance;
}
/**
* Inject a mock controller. Used only for testing. Affects future calls to getInstance().
*/
public static void injectMockController(MessagingController mockController) {
inst = mockController;
sInstance = mockController;
}
// TODO: seems that this reading of mBusy isn't thread-safe
@ -214,10 +214,10 @@ public class MessagingController implements Runnable {
MailboxColumns.DISPLAY_NAME, MailboxColumns.ACCOUNT_KEY, MailboxColumns.TYPE,
};
long mId;
String mDisplayName;
long mAccountKey;
int mType;
final long mId;
final String mDisplayName;
final long mAccountKey;
final int mType;
public LocalMailboxInfo(Cursor c) {
mId = c.getLong(COLUMN_ID);
@ -419,12 +419,12 @@ public class MessagingController implements Runnable {
SyncColumns.SERVER_ID, MessageColumns.MAILBOX_KEY, MessageColumns.ACCOUNT_KEY
};
int mCursorIndex;
long mId;
boolean mFlagRead;
boolean mFlagFavorite;
int mFlagLoaded;
String mServerId;
final int mCursorIndex;
final long mId;
final boolean mFlagRead;
final boolean mFlagFavorite;
final int mFlagLoaded;
final String mServerId;
public LocalMessageInfo(Cursor c) {
mCursorIndex = c.getPosition();

View File

@ -25,7 +25,7 @@ import java.io.InputStream;
* and a subsequent read will still return the peeked byte.
*/
public class PeekableInputStream extends InputStream {
private InputStream mIn;
private final InputStream mIn;
private boolean mPeeked;
private int mPeekedByte;

View File

@ -38,9 +38,9 @@ public class Preferences {
private static final String DEVICE_UID = "deviceUID";
private static final String ONE_TIME_INITIALIZATION_PROGRESS = "oneTimeInitializationProgress";
private static Preferences preferences;
private static Preferences sPreferences;
SharedPreferences mSharedPreferences;
final SharedPreferences mSharedPreferences;
private Preferences(Context context) {
mSharedPreferences = context.getSharedPreferences(PREFERENCES_FILE, Context.MODE_PRIVATE);
@ -53,10 +53,10 @@ public class Preferences {
* context.
*/
public static synchronized Preferences getPreferences(Context context) {
if (preferences == null) {
preferences = new Preferences(context);
if (sPreferences == null) {
sPreferences = new Preferences(context);
}
return preferences;
return sPreferences;
}
/**

View File

@ -76,7 +76,7 @@ public class AccountFolderList extends ListActivity implements OnItemClickListen
/**
* Key codes used to open a debug settings screen.
*/
private static int[] secretKeyCodes = {
private static final int[] SECRET_KEY_CODES = {
KeyEvent.KEYCODE_D, KeyEvent.KEYCODE_E, KeyEvent.KEYCODE_B, KeyEvent.KEYCODE_U,
KeyEvent.KEYCODE_G
};
@ -600,9 +600,9 @@ public class AccountFolderList extends ListActivity implements OnItemClickListen
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (event.getKeyCode() == secretKeyCodes[mSecretKeyCodeIndex]) {
if (event.getKeyCode() == SECRET_KEY_CODES[mSecretKeyCodeIndex]) {
mSecretKeyCodeIndex++;
if (mSecretKeyCodeIndex == secretKeyCodes.length) {
if (mSecretKeyCodeIndex == SECRET_KEY_CODES.length) {
mSecretKeyCodeIndex = 0;
startActivity(new Intent(this, Debug.class));
}

View File

@ -42,16 +42,16 @@ import android.widget.AdapterView.OnItemClickListener;
* (or, one could be a base class of the other).
*/
public class AccountShortcutPicker extends ListActivity implements OnItemClickListener {
/**
* Support for list adapter
*/
private final static String[] sFromColumns = new String[] {
private final static String[] FROM_COLUMNS = new String[] {
EmailContent.AccountColumns.DISPLAY_NAME,
EmailContent.AccountColumns.EMAIL_ADDRESS,
EmailContent.RECORD_ID
};
private final int[] sToIds = new int[] {
private final static int[] TO_IDS = new int[] {
R.id.description,
R.id.email,
R.id.new_message_count
@ -60,7 +60,7 @@ public class AccountShortcutPicker extends ListActivity implements OnItemClickLi
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// finish() immediately if we aren't supposed to be here
if (!Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())) {
finish();
@ -71,22 +71,22 @@ public class AccountShortcutPicker extends ListActivity implements OnItemClickLi
// TODO: lightweight projection with only those columns needed for this display
// TODO: query outside of UI thread
Cursor c = this.managedQuery(
EmailContent.Account.CONTENT_URI,
EmailContent.Account.CONTENT_URI,
EmailContent.Account.CONTENT_PROJECTION,
null, null, null);
if (c.getCount() == 0) {
finish();
return;
}
setContentView(R.layout.accounts);
ListView listView = getListView();
listView.setOnItemClickListener(this);
listView.setItemsCanFocus(false);
listView.setEmptyView(findViewById(R.id.empty));
AccountsAdapter a = new AccountsAdapter(this,
R.layout.accounts_item, c, sFromColumns, sToIds);
AccountsAdapter a = new AccountsAdapter(this,
R.layout.accounts_item, c, FROM_COLUMNS, TO_IDS);
listView.setAdapter(a);
}
@ -103,7 +103,7 @@ public class AccountShortcutPicker extends ListActivity implements OnItemClickLi
super(context, layout, c, from, to);
setViewBinder(new MyViewBinder());
}
/**
* This is only used for the unread messages count. Most of the views are handled
* normally by SimpleCursorAdapter.
@ -112,7 +112,7 @@ public class AccountShortcutPicker extends ListActivity implements OnItemClickLi
public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
if (view.getId() == R.id.new_message_count) {
int unreadMessageCount = 0; // TODO get unread count from Account
if (unreadMessageCount <= 0) {
view.setVisibility(View.GONE);
@ -121,19 +121,19 @@ public class AccountShortcutPicker extends ListActivity implements OnItemClickLi
}
return true;
}
return false;
}
}
}
/**
* This function creates a shortcut and returns it to the caller. There are actually two
* This function creates a shortcut and returns it to the caller. There are actually two
* intents that you will send back.
*
* The first intent serves as a container for the shortcut and is returned to the launcher by
*
* The first intent serves as a container for the shortcut and is returned to the launcher by
* setResult(). This intent must contain three fields:
*
*
* <ul>
* <li>{@link android.content.Intent#EXTRA_SHORTCUT_INTENT} The shortcut intent.</li>
* <li>{@link android.content.Intent#EXTRA_SHORTCUT_NAME} The text that will be displayed with
@ -142,16 +142,16 @@ public class AccountShortcutPicker extends ListActivity implements OnItemClickLi
* bitmap, <i>or</i> {@link android.content.Intent#EXTRA_SHORTCUT_ICON_RESOURCE} if provided as
* a drawable resource.</li>
* </ul>
*
*
* If you use a simple drawable resource, note that you must wrapper it using
* {@link android.content.Intent.ShortcutIconResource}, as shown below. This is required so
* that the launcher can access resources that are stored in your application's .apk file. If
* you return a bitmap, such as a thumbnail, you can simply put the bitmap into the extras
* that the launcher can access resources that are stored in your application's .apk file. If
* you return a bitmap, such as a thumbnail, you can simply put the bitmap into the extras
* bundle using {@link android.content.Intent#EXTRA_SHORTCUT_ICON}.
*
* The shortcut intent can be any intent that you wish the launcher to send, when the user
* clicks on the shortcut. Typically this will be {@link android.content.Intent#ACTION_VIEW}
* with an appropriate Uri for your content, but any Intent will work here as long as it
*
* The shortcut intent can be any intent that you wish the launcher to send, when the user
* clicks on the shortcut. Typically this will be {@link android.content.Intent#ACTION_VIEW}
* with an appropriate Uri for your content, but any Intent will work here as long as it
* triggers the desired action within your Activity.
*/
private void setupShortcut(Account account) {

View File

@ -48,7 +48,7 @@ class AddressTextView extends MultiAutoCompleteTextView {
}
private boolean mIsValid = true;
private ForwardValidator mInternalValidator = new ForwardValidator();
private final ForwardValidator mInternalValidator = new ForwardValidator();
public AddressTextView(Context context, AttributeSet attrs) {
super(context, attrs);

View File

@ -71,7 +71,7 @@ public class AccountSetupCheckSettings extends Activity implements OnClickListen
public static final int RESULT_AUTO_DISCOVER_AUTH_FAILED = Activity.RESULT_FIRST_USER;
public static final int RESULT_SECURITY_REQUIRED_USER_CANCEL = Activity.RESULT_FIRST_USER + 1;
private Handler mHandler = new Handler();
private final Handler mHandler = new Handler();
private ProgressBar mProgressBar;
private TextView mMessageView;

View File

@ -47,16 +47,16 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
private static final String EXTRA_ACCOUNT = "account";
private static final String EXTRA_MAKE_DEFAULT = "makeDefault";
private static final int popPorts[] = {
private static final int POP_PORTS[] = {
110, 995, 995, 110, 110
};
private static final String popSchemes[] = {
private static final String POP_SCHEMES[] = {
"pop3", "pop3+ssl+", "pop3+ssl+trustallcerts", "pop3+tls+", "pop3+tls+trustallcerts"
};
private static final int imapPorts[] = {
private static final int IMAP_PORTS[] = {
143, 993, 993, 143, 143
};
private static final String imapSchemes[] = {
private static final String IMAP_SCHEMES[] = {
"imap", "imap+ssl+", "imap+ssl+trustallcerts", "imap+tls+", "imap+tls+trustallcerts"
};
@ -210,14 +210,14 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
if (uri.getScheme().startsWith("pop3")) {
serverLabelView.setText(R.string.account_setup_incoming_pop_server_label);
mAccountPorts = popPorts;
mAccountSchemes = popSchemes;
mAccountPorts = POP_PORTS;
mAccountSchemes = POP_SCHEMES;
findViewById(R.id.imap_path_prefix_section).setVisibility(View.GONE);
} else if (uri.getScheme().startsWith("imap")) {
serverLabelView.setText(R.string.account_setup_incoming_imap_server_label);
mAccountPorts = imapPorts;
mAccountSchemes = imapSchemes;
mAccountPorts = IMAP_PORTS;
mAccountSchemes = IMAP_SCHEMES;
findViewById(R.id.account_delete_policy_label).setVisibility(View.GONE);
mDeletePolicyView.setVisibility(View.GONE);

View File

@ -48,11 +48,11 @@ public class AccountSetupOutgoing extends Activity implements OnClickListener,
private static final String EXTRA_MAKE_DEFAULT = "makeDefault";
private static final int smtpPorts[] = {
private static final int SMTP_PORTS[] = {
587, 465, 465, 587, 587
};
private static final String smtpSchemes[] = {
private static final String SMTP_SCHEMES[] = {
"smtp", "smtp+ssl+", "smtp+ssl+trustallcerts", "smtp+tls+", "smtp+tls+trustallcerts"
};
@ -186,8 +186,8 @@ public class AccountSetupOutgoing extends Activity implements OnClickListener,
mPasswordView.setText(password);
}
for (int i = 0; i < smtpSchemes.length; i++) {
if (smtpSchemes[i].equals(uri.getScheme())) {
for (int i = 0; i < SMTP_SCHEMES.length; i++) {
if (SMTP_SCHEMES[i].equals(uri.getScheme())) {
SpinnerOption.setSpinnerOptionValue(mSecurityTypeView, i);
}
}
@ -243,7 +243,7 @@ public class AccountSetupOutgoing extends Activity implements OnClickListener,
private void updatePortFromSecurityType() {
int securityType = (Integer)((SpinnerOption)mSecurityTypeView.getSelectedItem()).value;
mPortView.setText(Integer.toString(smtpPorts[securityType]));
mPortView.setText(Integer.toString(SMTP_PORTS[securityType]));
}
@Override
@ -279,7 +279,7 @@ public class AccountSetupOutgoing extends Activity implements OnClickListener,
+ mPasswordView.getText().toString().trim();
}
URI uri = new URI(
smtpSchemes[securityType],
SMTP_SCHEMES[securityType],
userInfo,
mServerView.getText().toString().trim(),
Integer.parseInt(mPortView.getText().toString().trim()),

View File

@ -19,9 +19,9 @@ package com.android.email.activity.setup;
import android.widget.Spinner;
public class SpinnerOption {
public Object value;
public final Object value;
public String label;
public final String label;
public static void setSpinnerOptionValue(Spinner spinner, Object value) {
for (int i = 0, count = spinner.getCount(); i < count; i++) {

View File

@ -45,13 +45,13 @@ public class Address {
/**
* Address part, in the form local_part@domain_part. No surrounding angle brackets.
*/
String mAddress;
private String mAddress;
/**
* Name part. No surrounding double quote, and no MIME/base64 encoding.
* This must be null if Address has no name part.
*/
String mPersonal;
private String mPersonal;
// Regex that matches address surrounded by '<>' optionally. '^<?([^>]+)>?$'
private static final Pattern REMOVE_OPTIONAL_BRACKET = Pattern.compile("^<?([^>]+)>?$");

View File

@ -31,7 +31,7 @@ import java.util.HashMap;
public abstract class Sender {
protected static final int SOCKET_CONNECT_TIMEOUT = 10000;
private static HashMap<String, Sender> mSenders = new HashMap<String, Sender>();
private static final HashMap<String, Sender> sSenders = new HashMap<String, Sender>();
/**
* Static named constructor. It should be overrode by extending class.
@ -96,7 +96,7 @@ public abstract class Sender {
public synchronized static Sender getInstance(Context context, String uri)
throws MessagingException {
Sender sender = mSenders.get(uri);
Sender sender = sSenders.get(uri);
if (sender == null) {
sender = findSender(context, R.xml.senders_product, uri);
if (sender == null) {
@ -104,7 +104,7 @@ public abstract class Sender {
}
if (sender != null) {
mSenders.put(uri, sender);
sSenders.put(uri, sender);
}
}

View File

@ -56,7 +56,7 @@ public abstract class Store {
* should be returned on FetchProfile.Item.BODY_SANE requests.
*/
public static final int FETCH_BODY_SANE_SUGGESTED_SIZE = (50 * 1024);
private static HashMap<String, Store> mStores = new HashMap<String, Store>();
private static final HashMap<String, Store> sStores = new HashMap<String, Store>();
/**
* Static named constructor. It should be overrode by extending class.
@ -169,7 +169,7 @@ public abstract class Store {
public synchronized static Store getInstance(String uri, Context context,
PersistentDataCallbacks callbacks)
throws MessagingException {
Store store = mStores.get(uri);
Store store = sStores.get(uri);
if (store == null) {
StoreInfo info = StoreInfo.getStoreInfo(uri, context);
if (info != null) {
@ -177,7 +177,7 @@ public abstract class Store {
}
if (store != null) {
mStores.put(uri, store);
sStores.put(uri, store);
}
} else {
// update the callbacks, which may have been null at creation time.
@ -199,7 +199,7 @@ public abstract class Store {
* @param storeUri the store to be removed
*/
public synchronized static void removeInstance(String storeUri) {
mStores.remove(storeUri);
sStores.remove(storeUri);
}
/**

View File

@ -47,13 +47,13 @@ public class MimeHeader {
/**
* Fields that should be omitted when writing the header using writeTo()
*/
private static final String[] writeOmitFields = {
private static final String[] WRITE_OMIT_FIELDS = {
// HEADER_ANDROID_ATTACHMENT_DOWNLOADED,
// HEADER_ANDROID_ATTACHMENT_ID,
HEADER_ANDROID_ATTACHMENT_STORE_DATA
};
protected ArrayList<Field> mFields = new ArrayList<Field>();
protected final ArrayList<Field> mFields = new ArrayList<Field>();
public void clear() {
mFields.clear();
@ -114,7 +114,7 @@ public class MimeHeader {
}
StringBuilder builder = new StringBuilder();
for (Field field : mFields) {
if (!Utility.arrayContains(writeOmitFields, field.name)) {
if (!Utility.arrayContains(WRITE_OMIT_FIELDS, field.name)) {
builder.append(field.name + ": " + field.value + "\r\n");
}
}
@ -124,7 +124,7 @@ public class MimeHeader {
public void writeTo(OutputStream out) throws IOException, MessagingException {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);
for (Field field : mFields) {
if (!Utility.arrayContains(writeOmitFields, field.name)) {
if (!Utility.arrayContains(WRITE_OMIT_FIELDS, field.name)) {
writer.write(field.name + ": " + field.value + "\r\n");
}
}

View File

@ -68,7 +68,7 @@ public class MimeMessage extends Message {
private boolean mInhibitLocalMessageId = false;
// Shared random source for generating local message-id values
private static java.util.Random sRandom = new java.util.Random();
private static final java.util.Random sRandom = new java.util.Random();
// In MIME, en_US-like date format should be used. In other words "MMM" should be encoded to
// "Jan", not the other localized format like "Ene" (meaning January in locale es).

View File

@ -46,7 +46,7 @@ import java.util.HashMap;
public class ExchangeStore extends Store {
public static final String LOG_TAG = "ExchangeStore";
private URI mUri;
private final URI mUri;
private final ExchangeTransport mTransport;
/**
@ -169,7 +169,7 @@ public class ExchangeStore extends Store {
private String mUsername;
private String mPassword;
private static HashMap<String, ExchangeTransport> sUriToInstanceMap =
private static final HashMap<String, ExchangeTransport> sUriToInstanceMap =
new HashMap<String, ExchangeTransport>();
/**

View File

@ -93,7 +93,7 @@ public class ImapStore extends Store {
private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.SEEN, Flag.FLAGGED };
private Context mContext;
private final Context mContext;
private Transport mRootTransport;
private String mUsername;
private String mPassword;
@ -102,7 +102,7 @@ public class ImapStore extends Store {
private String mIdPhrase = null;
private static String sImapId = null;
private LinkedList<ImapConnection> mConnections =
private final LinkedList<ImapConnection> mConnections =
new LinkedList<ImapConnection>();
/**
@ -470,7 +470,7 @@ public class ImapStore extends Store {
}
class ImapFolder extends Folder {
private String mName;
private final String mName;
private int mMessageCount = -1;
private ImapConnection mConnection;
private OpenMode mMode;

View File

@ -88,10 +88,10 @@ public class LocalStore extends Store implements PersistentDataCallbacks {
private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.X_DESTROYED, Flag.SEEN };
private String mPath;
private final String mPath;
private SQLiteDatabase mDb;
private File mAttachmentsDir;
private Context mContext;
private final File mAttachmentsDir;
private final Context mContext;
private int mVisibleLimitDefault = -1;
/**
@ -589,7 +589,7 @@ public class LocalStore extends Store implements PersistentDataCallbacks {
}
public class LocalFolder extends Folder implements Folder.PersistentDataCallbacks {
private String mName;
private final String mName;
private long mFolderId = -1;
private int mUnreadMessageCount = -1;
private int mVisibleLimit = -1;

View File

@ -55,7 +55,7 @@ public class Pop3Store extends Store {
private Transport mTransport;
private String mUsername;
private String mPassword;
private HashMap<String, Folder> mFolders = new HashMap<String, Folder>();
private final HashMap<String, Folder> mFolders = new HashMap<String, Folder>();
// /**
// * Detected latency, used for usage scaling.
@ -181,17 +181,20 @@ public class Pop3Store extends Store {
}
class Pop3Folder extends Folder {
private HashMap<String, Pop3Message> mUidToMsgMap = new HashMap<String, Pop3Message>();
private HashMap<Integer, Pop3Message> mMsgNumToMsgMap = new HashMap<Integer, Pop3Message>();
private HashMap<String, Integer> mUidToMsgNumMap = new HashMap<String, Integer>();
private String mName;
private final HashMap<String, Pop3Message> mUidToMsgMap
= new HashMap<String, Pop3Message>();
private final HashMap<Integer, Pop3Message> mMsgNumToMsgMap
= new HashMap<Integer, Pop3Message>();
private final HashMap<String, Integer> mUidToMsgNumMap = new HashMap<String, Integer>();
private final String mName;
private int mMessageCount;
private Pop3Capabilities mCapabilities;
public Pop3Folder(String name) {
this.mName = name;
if (mName.equalsIgnoreCase("INBOX")) {
if (name.equalsIgnoreCase("INBOX")) {
mName = "INBOX";
} else {
mName = name;
}
}
@ -1000,9 +1003,9 @@ public class Pop3Store extends Store {
// TODO figure out what is special about this and merge it into MailTransport
class Pop3ResponseInputStream extends InputStream {
InputStream mIn;
boolean mStartOfLine = true;
boolean mFinished;
private final InputStream mIn;
private boolean mStartOfLine = true;
private boolean mFinished;
public Pop3ResponseInputStream(InputStream in) {
mIn = in;

View File

@ -56,7 +56,7 @@ public class Rfc822Output {
// In MIME, en_US-like date format should be used. In other words "MMM" should be encoded to
// "Jan", not the other localized format like "Ene" (meaning January in locale es).
static final SimpleDateFormat mDateFormat =
private static final SimpleDateFormat DATE_FORMAT =
new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
/*package*/ static String buildBodyText(Context context, Message message,
@ -131,7 +131,7 @@ public class Rfc822Output {
// Write the fixed headers. Ordering is arbitrary (the legacy code iterated through a
// hashmap here).
String date = mDateFormat.format(new Date(message.mTimeStamp));
String date = DATE_FORMAT.format(new Date(message.mTimeStamp));
writeHeader(writer, "Date", date);
writeEncodedHeader(writer, "Subject", message.mSubject);

View File

@ -42,10 +42,10 @@ import javax.net.ssl.SSLException;
*/
public class SmtpSender extends Sender {
Context mContext;
private final Context mContext;
private Transport mTransport;
String mUsername;
String mPassword;
private String mUsername;
private String mPassword;
/**
* Static named constructor.

View File

@ -54,7 +54,7 @@ public class EmailServiceProxy implements IEmailService {
private final Class<?> mClass;
private final IEmailServiceCallback mCallback;
private Runnable mRunnable;
private ServiceConnection mSyncManagerConnection = new EmailServiceConnection ();
private final ServiceConnection mSyncManagerConnection = new EmailServiceConnection ();
private IEmailService mService = null;
private Object mReturn = null;
// Service call timeout (in seconds)

View File

@ -54,9 +54,9 @@ public class MailService extends Service {
private static final String LOG_TAG = "Email-MailService";
public static int NOTIFICATION_ID_NEW_MESSAGES = 1;
public static int NOTIFICATION_ID_SECURITY_NEEDED = 2;
public static int NOTIFICATION_ID_EXCHANGE_CALENDAR_ADDED = 3;
public static final int NOTIFICATION_ID_NEW_MESSAGES = 1;
public static final int NOTIFICATION_ID_SECURITY_NEEDED = 2;
public static final int NOTIFICATION_ID_EXCHANGE_CALENDAR_ADDED = 3;
private static final String ACTION_CHECK_MAIL =
"com.android.email.intent.action.MAIL_SERVICE_WAKEUP";
@ -76,7 +76,7 @@ public class MailService extends Service {
private static final String[] NEW_MESSAGE_COUNT_PROJECTION =
new String[] {AccountColumns.NEW_MESSAGE_COUNT};
private Controller.Result mControllerCallback = new ControllerResults();
private final Controller.Result mControllerCallback = new ControllerResults();
private int mStartId;
@ -89,10 +89,10 @@ public class MailService extends Service {
/**
* Simple template used for clearing new message count in accounts
*/
static ContentValues mClearNewMessages;
private static final ContentValues CLEAR_NEW_MESSAGES;
static {
mClearNewMessages = new ContentValues();
mClearNewMessages.put(Account.NEW_MESSAGE_COUNT, 0);
CLEAR_NEW_MESSAGES = new ContentValues();
CLEAR_NEW_MESSAGES.put(Account.NEW_MESSAGE_COUNT, 0);
}
public static void actionReschedule(Context context) {
@ -130,7 +130,7 @@ public class MailService extends Service {
} else {
uri = ContentUris.withAppendedId(Account.CONTENT_URI, accountId);
}
context.getContentResolver().update(uri, mClearNewMessages, null, null);
context.getContentResolver().update(uri, CLEAR_NEW_MESSAGES, null, null);
}
/**