Some assorted warning fixes.

This commit is contained in:
Danny Baumann 2013-09-25 15:20:43 +02:00
parent d6d22a82bc
commit 890e0e22e3
14 changed files with 47 additions and 59 deletions

View file

@ -218,12 +218,6 @@ public class Account implements BaseAccount {
private ColorChip mFlaggedUnreadColorChip;
private ColorChip mFlaggedReadColorChip;
private ColorChip mToMeUnreadColorChip;
private ColorChip mToMeReadColorChip;
private ColorChip mCcMeUnreadColorChip;
private ColorChip mCcMeReadColorChip;
private ColorChip mFromMeUnreadColorChip;
private ColorChip mFromMeReadColorChip;
private ColorChip mCheckmarkChip;
@ -851,12 +845,6 @@ public class Account implements BaseAccount {
public synchronized void cacheChips() {
mReadColorChip = new ColorChip(mChipColor, true, ColorChip.CIRCULAR);
mUnreadColorChip = new ColorChip(mChipColor, false, ColorChip.CIRCULAR);
mToMeReadColorChip = new ColorChip(mChipColor, true, ColorChip.RIGHT_POINTING);
mToMeUnreadColorChip = new ColorChip(mChipColor, false,ColorChip.RIGHT_POINTING);
mCcMeReadColorChip = new ColorChip(mChipColor, true, ColorChip.RIGHT_NOTCH);
mCcMeUnreadColorChip = new ColorChip(mChipColor, false,ColorChip.RIGHT_NOTCH);
mFromMeReadColorChip = new ColorChip(mChipColor, true, ColorChip.LEFT_POINTING);
mFromMeUnreadColorChip = new ColorChip(mChipColor, false,ColorChip.LEFT_POINTING);
mFlaggedReadColorChip = new ColorChip(mChipColor, true, ColorChip.STAR);
mFlaggedUnreadColorChip = new ColorChip(mChipColor, false, ColorChip.STAR);
mCheckmarkChip = new ColorChip(mChipColor, true, ColorChip.CHECKMARK);
@ -878,24 +866,12 @@ public class Account implements BaseAccount {
if (messageRead) {
if (messageFlagged) {
chip = mFlaggedReadColorChip;
// } else if (toMe) {
// chip = mToMeReadColorChip;
// } else if (ccMe) {
// chip = mCcMeReadColorChip;
// } else if (fromMe) {
// chip = mFromMeReadColorChip;
} else {
chip = mReadColorChip;
}
} else {
if (messageFlagged) {
chip = mFlaggedUnreadColorChip;
// } else if (toMe) {
// chip = mToMeUnreadColorChip;
// } else if (ccMe) {
// chip = mCcMeUnreadColorChip;
// } else if (fromMe) {
// chip = mFromMeUnreadColorChip;
} else {
chip = mUnreadColorChip;
}

View file

@ -142,6 +142,7 @@ public final class PRNGFixes {
* all requests to the Linux PRNG.
*/
private static class LinuxPRNGSecureRandomProvider extends Provider {
private static final long serialVersionUID = 6538669771360998378L;
public LinuxPRNGSecureRandomProvider() {
super("LinuxPRNG",
@ -175,6 +176,8 @@ public final class PRNGFixes {
* duplicated PRNG output.
*/
private static final long serialVersionUID = 628140755730642770L;
private static final File URANDOM_FILE = new File("/dev/urandom");
private static final Object sLock = new Object();

View file

@ -1,13 +1,10 @@
package com.fsck.k9.activity;
import android.content.Context;
import android.util.Log;
import com.fsck.k9.Account;
import com.fsck.k9.K9;
import com.fsck.k9.R;
import com.fsck.k9.mail.Folder;
import com.fsck.k9.mail.MessagingException;
public class FolderInfoHolder implements Comparable<FolderInfoHolder> {
public String name;

View file

@ -2157,6 +2157,8 @@ public class MessageCompose extends K9Activity implements OnClickListener,
performSave();
break;
}
case NONE:
break;
}
}

View file

@ -163,7 +163,6 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
private LocalSearch mSearch;
private boolean mSingleFolderMode;
private boolean mSingleAccountMode;
private boolean mStars = true;
private ProgressBar mActionBarProgress;
private MenuItem mMenuButtonCheckMail;
@ -490,7 +489,6 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
@Override
public void onResume() {
super.onResume();
mStars = K9.messageListStars();
if (!(this instanceof Search)) {
//necessary b/c no guarantee Search.onStop will be called before MessageList.onResume

View file

@ -45,7 +45,7 @@ public class NotificationDeleteConfirmation extends Activity {
final Intent intent = getIntent();
mAccount = preferences.getAccount(intent.getStringExtra(EXTRA_ACCOUNT));
mMessageRefs = (ArrayList<MessageReference>) intent.getSerializableExtra(EXTRA_MESSAGE_LIST);
mMessageRefs = intent.getParcelableArrayListExtra(EXTRA_MESSAGE_LIST);
if (mAccount == null || mMessageRefs == null || mMessageRefs.isEmpty()) {
finish();

View file

@ -7,7 +7,6 @@ import android.util.Log;
import com.fsck.k9.K9;
import com.fsck.k9.activity.misc.Attachment;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import java.io.File;

View file

@ -156,7 +156,7 @@ public class ContactPictureLoader {
return mDefaultBackgroundColor;
}
int val = address.getAddress().toLowerCase().hashCode();
int val = address.getAddress().toLowerCase(Locale.getDefault()).hashCode();
int rgb = CONTACT_DUMMY_COLORS_ARGB[Math.abs(val) % CONTACT_DUMMY_COLORS_ARGB.length];
return rgb;
}

View file

@ -91,8 +91,6 @@ import com.fsck.k9.search.ConditionsTreeNode;
import com.fsck.k9.search.LocalSearch;
import com.fsck.k9.search.SearchAccount;
import com.fsck.k9.search.SearchSpecification;
import com.fsck.k9.search.SearchSpecification.Attribute;
import com.fsck.k9.search.SearchSpecification.Searchfield;
import com.fsck.k9.search.SqlQueryBuilder;
import com.fsck.k9.service.NotificationActionService;

View file

@ -1,5 +1,6 @@
package com.fsck.k9.fragment;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@ -405,7 +406,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
private boolean mSingleFolderMode;
private boolean mAllAccounts;
private MessageListHandler mHandler = new MessageListHandler();
private MessageListHandler mHandler = new MessageListHandler(this);
private SortType mSortType = SortType.SORT_DATE;
private boolean mSortAscending = true;
@ -457,7 +458,6 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
private boolean mInitialized = false;
private ContactPictureLoader mContactsPictureLoader;
private float mScreenDensity;
private LocalBroadcastManager mLocalBroadcastManager;
private BroadcastReceiver mCacheBroadcastReceiver;
@ -485,7 +485,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
* <p><strong>Note:</strong> If you add a method to this class make sure you don't accidentally
* perform the operation in the calling thread.</p>
*/
class MessageListHandler extends Handler {
static class MessageListHandler extends Handler {
private static final int ACTION_FOLDER_LOADING = 1;
private static final int ACTION_REFRESH_TITLE = 2;
private static final int ACTION_PROGRESS = 3;
@ -494,7 +494,11 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
private static final int ACTION_RESTORE_LIST_POSITION = 6;
private static final int ACTION_OPEN_MESSAGE = 7;
private WeakReference<MessageListFragment> mFragment;
public MessageListHandler(MessageListFragment fragment) {
mFragment = new WeakReference<MessageListFragment>(fragment);
}
public void folderLoading(String folder, boolean loading) {
android.os.Message msg = android.os.Message.obtain(this, ACTION_FOLDER_LOADING,
(loading) ? 1 : 0, 0, folder);
@ -521,7 +525,10 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
post(new Runnable() {
@Override
public void run() {
MessageListFragment.this.updateFooter(message);
MessageListFragment fragment = mFragment.get();
if (fragment != null) {
fragment.updateFooter(message);
}
}
});
}
@ -532,10 +539,13 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
}
public void restoreListPosition() {
android.os.Message msg = android.os.Message.obtain(this, ACTION_RESTORE_LIST_POSITION,
mSavedListState);
mSavedListState = null;
sendMessage(msg);
MessageListFragment fragment = mFragment.get();
if (fragment != null) {
android.os.Message msg = android.os.Message.obtain(this, ACTION_RESTORE_LIST_POSITION,
fragment.mSavedListState);
fragment.mSavedListState = null;
sendMessage(msg);
}
}
public void openMessage(MessageReference messageReference) {
@ -546,16 +556,21 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
@Override
public void handleMessage(android.os.Message msg) {
MessageListFragment fragment = mFragment.get();
if (fragment == null) {
return;
}
// The following messages don't need an attached activity.
switch (msg.what) {
case ACTION_REMOTE_SEARCH_FINISHED: {
MessageListFragment.this.remoteSearchFinished();
fragment.remoteSearchFinished();
return;
}
}
// Discard messages if the fragment isn't attached to an activity anymore.
Activity activity = getActivity();
Activity activity = fragment.getActivity();
if (activity == null) {
return;
}
@ -564,29 +579,29 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
case ACTION_FOLDER_LOADING: {
String folder = (String) msg.obj;
boolean loading = (msg.arg1 == 1);
MessageListFragment.this.folderLoading(folder, loading);
fragment.folderLoading(folder, loading);
break;
}
case ACTION_REFRESH_TITLE: {
updateTitle();
fragment.updateTitle();
break;
}
case ACTION_PROGRESS: {
boolean progress = (msg.arg1 == 1);
MessageListFragment.this.progress(progress);
fragment.progress(progress);
break;
}
case ACTION_GO_BACK: {
mFragmentListener.goBack();
fragment.mFragmentListener.goBack();
break;
}
case ACTION_RESTORE_LIST_POSITION: {
mListView.onRestoreInstanceState((Parcelable) msg.obj);
fragment.mListView.onRestoreInstanceState((Parcelable) msg.obj);
break;
}
case ACTION_OPEN_MESSAGE: {
MessageReference messageReference = (MessageReference) msg.obj;
mFragmentListener.openMessage(messageReference);
fragment.mFragmentListener.openMessage(messageReference);
break;
}
}
@ -782,7 +797,6 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
Context appContext = getActivity().getApplicationContext();
mScreenDensity = appContext.getResources().getDisplayMetrics().density;
mPreferences = Preferences.getPreferences(appContext);
mController = MessagingController.getInstance(getActivity().getApplication());
@ -1394,7 +1408,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
}
private String getDialogTag(int dialogId) {
return String.format("dialog-%d", dialogId);
return "dialog-" + dialogId;
}
@Override
@ -1723,7 +1737,8 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
public void remoteSearchServerQueryComplete(Account account, String folderName, int numResults) {
mHandler.progress(true);
if (account != null && account.getRemoteSearchNumResults() != 0 && numResults > account.getRemoteSearchNumResults()) {
mHandler.updateFooter(mContext.getString(R.string.remote_search_downloading_limited, account.getRemoteSearchNumResults(), numResults));
mHandler.updateFooter(mContext.getString(R.string.remote_search_downloading_limited,
account.getRemoteSearchNumResults(), numResults));
} else {
mHandler.updateFooter(mContext.getString(R.string.remote_search_downloading, numResults));
}

View file

@ -7,6 +7,7 @@ import android.database.Cursor;
import android.net.Uri;
import android.content.Intent;
import android.provider.ContactsContract;
import android.provider.ContactsContract.DataUsageFeedback;
import android.util.Log;
import com.fsck.k9.K9;

View file

@ -22,7 +22,6 @@ import java.io.FileOutputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

View file

@ -77,8 +77,8 @@ public class NotificationActionService extends CoreService {
if (K9.DEBUG)
Log.i(K9.LOG_TAG, "NotificationActionService marking messages as read");
ArrayList<MessageReference> refs = (ArrayList<MessageReference>)
intent.getSerializableExtra(EXTRA_MESSAGE_LIST);
ArrayList<MessageReference> refs =
intent.getParcelableArrayListExtra(EXTRA_MESSAGE_LIST);
for (MessageReference ref : refs) {
controller.setFlag(account, ref.folderName, ref.uid, Flag.SEEN, true);
}
@ -86,8 +86,8 @@ public class NotificationActionService extends CoreService {
if (K9.DEBUG)
Log.i(K9.LOG_TAG, "NotificationActionService deleting messages");
ArrayList<MessageReference> refs = (ArrayList<MessageReference>)
intent.getSerializableExtra(EXTRA_MESSAGE_LIST);
ArrayList<MessageReference> refs =
intent.getParcelableArrayListExtra(EXTRA_MESSAGE_LIST);
ArrayList<Message> messages = new ArrayList<Message>();
for (MessageReference ref : refs) {

View file

@ -276,8 +276,8 @@ public class MessageHeader extends ScrollView implements OnClickListener {
mDateView.setText(dateTime);
if (K9.showContactPicture()) {
mContactBadge.assignContactFromEmail(counterpartyAddress.getAddress(), true);
if (counterpartyAddress != null) {
mContactBadge.assignContactFromEmail(counterpartyAddress.getAddress(), true);
mContactsPictureLoader.loadContactPicture(counterpartyAddress, mContactBadge);
} else {
mContactBadge.setImageResource(R.drawable.ic_contact_picture);