1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

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

View File

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

View File

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

View File

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

View File

@ -163,7 +163,6 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
private LocalSearch mSearch; private LocalSearch mSearch;
private boolean mSingleFolderMode; private boolean mSingleFolderMode;
private boolean mSingleAccountMode; private boolean mSingleAccountMode;
private boolean mStars = true;
private ProgressBar mActionBarProgress; private ProgressBar mActionBarProgress;
private MenuItem mMenuButtonCheckMail; private MenuItem mMenuButtonCheckMail;
@ -490,7 +489,6 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
mStars = K9.messageListStars();
if (!(this instanceof Search)) { if (!(this instanceof Search)) {
//necessary b/c no guarantee Search.onStop will be called before MessageList.onResume //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(); final Intent intent = getIntent();
mAccount = preferences.getAccount(intent.getStringExtra(EXTRA_ACCOUNT)); 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()) { if (mAccount == null || mMessageRefs == null || mMessageRefs.isEmpty()) {
finish(); finish();

View File

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

View File

@ -156,7 +156,7 @@ public class ContactPictureLoader {
return mDefaultBackgroundColor; 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]; int rgb = CONTACT_DUMMY_COLORS_ARGB[Math.abs(val) % CONTACT_DUMMY_COLORS_ARGB.length];
return rgb; 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.LocalSearch;
import com.fsck.k9.search.SearchAccount; import com.fsck.k9.search.SearchAccount;
import com.fsck.k9.search.SearchSpecification; 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.search.SqlQueryBuilder;
import com.fsck.k9.service.NotificationActionService; import com.fsck.k9.service.NotificationActionService;

View File

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

View File

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

View File

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

View File

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