1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-26 01:28:50 -05:00

Javadoc cleanup

This commit is contained in:
cketti 2012-11-03 06:20:11 +01:00
parent c231b732ac
commit 2cfd25fa23

View File

@ -163,7 +163,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
/** /**
* @param delegate * @param delegate
* Never <code>null</code>. * Never {@code null}.
*/ */
public ReverseComparator(final Comparator<T> delegate) { public ReverseComparator(final Comparator<T> delegate) {
mDelegate = delegate; mDelegate = delegate;
@ -186,7 +186,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
/** /**
* @param chain * @param chain
* Comparator chain. Never <code>null</code>. * Comparator chain. Never {@code null}.
*/ */
public ComparatorChain(final List<Comparator<T>> chain) { public ComparatorChain(final List<Comparator<T>> chain) {
mChain = chain; mChain = chain;
@ -344,8 +344,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
private Cursor[] mCursors; private Cursor[] mCursors;
/** /**
* Stores the name of the folder that we want to open as soon as possible * Stores the name of the folder that we want to open as soon as possible after load.
* after load.
*/ */
private String mFolderName; private String mFolderName;
@ -380,9 +379,8 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
private Boolean mHasConnectivity; private Boolean mHasConnectivity;
/** /**
* Relevant messages for the current context when we have to remember the * Relevant messages for the current context when we have to remember the chosen messages
* chosen messages between user interactions (eg. Selecting a folder for * between user interactions (e.g. selecting a folder for move operation).
* move operation)
*/ */
private List<Message> mActiveMessages; private List<Message> mActiveMessages;
@ -472,7 +470,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
/** /**
* @return The comparator to use to display messages in an ordered * @return The comparator to use to display messages in an ordered
* fashion. Never <code>null</code>. * fashion. Never {@code null}.
*/ */
protected Comparator<Cursor> getComparator() { protected Comparator<Cursor> getComparator() {
final List<Comparator<Cursor>> chain = final List<Comparator<Cursor>> chain =
@ -1385,9 +1383,12 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
} }
/** /**
* Handle a select or unselect swipe event * Handle a select or unselect swipe event.
* @param downMotion Event that started the swipe *
* @param selected true if this was an attempt to select (i.e. left to right). * @param downMotion
* Event that started the swipe
* @param selected
* {@code true} if this was an attempt to select (i.e. left to right).
*/ */
private void handleSwipe(final MotionEvent downMotion, final boolean selected) { private void handleSwipe(final MotionEvent downMotion, final boolean selected) {
int[] listPosition = new int[2]; int[] listPosition = new int[2];
@ -1962,7 +1963,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
* Display the message move activity. * Display the message move activity.
* *
* @param messages * @param messages
* Never {@code null}. * Never {@code null}.
*/ */
private void onMove(List<Message> messages) { private void onMove(List<Message> messages) {
if (!checkCopyOrMovePossible(messages, FolderOperation.MOVE)) { if (!checkCopyOrMovePossible(messages, FolderOperation.MOVE)) {
@ -1983,7 +1984,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
* Display the message copy activity. * Display the message copy activity.
* *
* @param messages * @param messages
* Never {@code null}. * Never {@code null}.
*/ */
private void onCopy(List<Message> messages) { private void onCopy(List<Message> messages) {
if (!checkCopyOrMovePossible(messages, FolderOperation.COPY)) { if (!checkCopyOrMovePossible(messages, FolderOperation.COPY)) {
@ -1997,19 +1998,17 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
} }
/** /**
* Helper method to manage the invocation of * Helper method to manage the invocation of {@link #startActivityForResult(Intent, int)} for a
* {@link #startActivityForResult(Intent, int)} for a folder operation * folder operation ({@link ChooseFolder} activity), while saving a list of associated messages.
* ({@link ChooseFolder} activity), while saving a list of associated
* messages.
* *
* @param requestCode * @param requestCode
* If >= 0, this code will be returned in onActivityResult() when * If {@code >= 0}, this code will be returned in {@code onActivityResult()} when the
* the activity exits. * activity exits.
* @param folder * @param folder
* Never {@code null}. * The source folder. Never {@code null}.
* @param holders * @param messages
* Messages to be affected by the folder operation. Never * Messages to be affected by the folder operation. Never {@code null}.
* {@code null}. *
* @see #startActivityForResult(Intent, int) * @see #startActivityForResult(Intent, int)
*/ */
private void displayFolderChoice(final int requestCode, final Folder folder, final List<Message> messages) { private void displayFolderChoice(final int requestCode, final Folder folder, final List<Message> messages) {
@ -2060,8 +2059,10 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
} }
/** /**
* @param holders * Move messages to the spam folder.
* Never {@code null}. *
* @param messages
* The messages to move to the spam folder. Never {@code null}.
*/ */
private void onSpam(List<Message> messages) { private void onSpam(List<Message> messages) {
if (K9.confirmSpam()) { if (K9.confirmSpam()) {
@ -2091,14 +2092,14 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
} }
/** /**
* Display an Toast message if any message isn't synchronized * Display a Toast message if any message isn't synchronized
* *
* @param holders * @param messages
* Never <code>null</code>. * The messages to copy or move. Never {@code null}.
* @param operation * @param operation
* Never {@code null}. * The type of operation to perform. Never {@code null}.
* *
* @return <code>true</code> if operation is possible * @return {@code true}, if operation is possible.
*/ */
private boolean checkCopyOrMovePossible(final List<Message> messages, private boolean checkCopyOrMovePossible(final List<Message> messages,
final FolderOperation operation) { final FolderOperation operation) {
@ -2133,8 +2134,10 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
/** /**
* Copy the specified messages to the specified folder. * Copy the specified messages to the specified folder.
* *
* @param holders Never {@code null}. * @param messages
* @param destination Never {@code null}. * List of messages to copy. Never {@code null}.
* @param destination
* The name of the destination folder. Never {@code null}.
*/ */
private void copy(List<Message> messages, final String destination) { private void copy(List<Message> messages, final String destination) {
copyOrMove(messages, destination, FolderOperation.COPY); copyOrMove(messages, destination, FolderOperation.COPY);
@ -2143,8 +2146,10 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
/** /**
* Move the specified messages to the specified folder. * Move the specified messages to the specified folder.
* *
* @param holders Never {@code null}. * @param messages
* @param destination Never {@code null}. * The list of messages to move. Never {@code null}.
* @param destination
* The name of the destination folder. Never {@code null}.
*/ */
private void move(List<Message> messages, final String destination) { private void move(List<Message> messages, final String destination) {
copyOrMove(messages, destination, FolderOperation.MOVE); copyOrMove(messages, destination, FolderOperation.MOVE);
@ -2155,14 +2160,12 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
* {@link #move(List, String)}. This method was added mainly because those 2 * {@link #move(List, String)}. This method was added mainly because those 2
* methods share common behavior. * methods share common behavior.
* *
* Note: Must be called from the UI thread! * @param messages
* * The list of messages to copy or move. Never {@code null}.
* @param holders
* Never {@code null}.
* @param destination * @param destination
* Never {@code null}. * The name of the destination folder. Never {@code null}.
* @param operation * @param operation
* Never {@code null}. * Specifies what operation to perform. Never {@code null}.
*/ */
private void copyOrMove(List<Message> messages, final String destination, final FolderOperation operation) { private void copyOrMove(List<Message> messages, final String destination, final FolderOperation operation) {
if (K9.FOLDER_NONE.equalsIgnoreCase(destination)) { if (K9.FOLDER_NONE.equalsIgnoreCase(destination)) {
@ -2209,29 +2212,6 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
} }
} }
/**
* Return the currently "open" account if available.
*
* @param prefs
* A {@link Preferences} instance that might be used to retrieve the current
* {@link Account}.
*
* @return The {@code Account} all displayed messages belong to.
*/
//TODO: remove
/*private Account getCurrentAccount(Preferences prefs) {
Account account = null;
if (mQueryString != null && !mIntegrate && mAccountUuids != null &&
mAccountUuids.length == 1) {
String uuid = mAccountUuids[0];
account = prefs.getAccount(uuid);
} else if (mAccount != null) {
account = mAccount;
}
return account;
}*/
class ActionModeCallback implements ActionMode.Callback { class ActionModeCallback implements ActionMode.Callback {
private MenuItem mSelectAll; private MenuItem mSelectAll;
@ -2316,42 +2296,41 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
} }
/** /**
* Disables menu options based on if the account supports it or not. * Disables menu options not supported by the account type or current "search view".
* It also checks the controller and for now the 'mode' the messagelist
* is operation in ( query or not ).
* *
* @param mAccount Account to check capabilities of. * @param account
* @param menu Menu to adapt. * The account to query for its capabilities.
* @param menu
* The menu to adapt.
*/ */
private void setContextCapabilities(Account mAccount, Menu menu) { private void setContextCapabilities(Account account, Menu menu) {
/*
* TODO get rid of this when we finally split the messagelist into
* a folder content display and a search result display
*/
if (!mSingleAccountMode) { if (!mSingleAccountMode) {
// We don't support cross-account copy/move operations right now
menu.findItem(R.id.move).setVisible(false); menu.findItem(R.id.move).setVisible(false);
menu.findItem(R.id.copy).setVisible(false); menu.findItem(R.id.copy).setVisible(false);
//TODO: we could support the archive and spam operations if all selected messages
// belong to non-POP3 accounts
menu.findItem(R.id.archive).setVisible(false); menu.findItem(R.id.archive).setVisible(false);
menu.findItem(R.id.spam).setVisible(false); menu.findItem(R.id.spam).setVisible(false);
} else { } else {
// hide unsupported // hide unsupported
if (!mController.isCopyCapable(mAccount)) { if (!mController.isCopyCapable(account)) {
menu.findItem(R.id.copy).setVisible(false); menu.findItem(R.id.copy).setVisible(false);
} }
if (!mController.isMoveCapable(mAccount)) { if (!mController.isMoveCapable(account)) {
menu.findItem(R.id.move).setVisible(false); menu.findItem(R.id.move).setVisible(false);
menu.findItem(R.id.archive).setVisible(false); menu.findItem(R.id.archive).setVisible(false);
menu.findItem(R.id.spam).setVisible(false); menu.findItem(R.id.spam).setVisible(false);
} }
if (!mAccount.hasArchiveFolder()) { if (!account.hasArchiveFolder()) {
menu.findItem(R.id.archive).setVisible(false); menu.findItem(R.id.archive).setVisible(false);
} }
if (!mAccount.hasSpamFolder()) { if (!account.hasSpamFolder()) {
menu.findItem(R.id.spam).setVisible(false); menu.findItem(R.id.spam).setVisible(false);
} }
} }
@ -2481,8 +2460,8 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
} }
/** /**
* We need to do some special clean up when leaving a remote search result screen. If no remote search is * We need to do some special clean up when leaving a remote search result screen. If no
* in progress, this method does nothing special. * remote search is in progress, this method does nothing special.
*/ */
@Override @Override
public void onStop() { public void onStop() {