1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 05:02:26 -05:00

Extract local variables for easier readability

This commit is contained in:
cketti 2015-04-03 20:27:11 +02:00
parent 632517be81
commit af36129449
2 changed files with 12 additions and 4 deletions

View File

@ -379,7 +379,9 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
Collection<Account> accounts = Preferences.getPreferences(this).getAvailableAccounts(); Collection<Account> accounts = Preferences.getPreferences(this).getAvailableAccounts();
for (Account account : accounts) { for (Account account : accounts) {
if (String.valueOf(account.getAccountNumber()).equals(accountId)) { if (String.valueOf(account.getAccountNumber()).equals(accountId)) {
mMessageReference = new MessageReference(account.getUuid(), segmentList.get(1), segmentList.get(2), null); String folderName = segmentList.get(1);
String messageUid = segmentList.get(2);
mMessageReference = new MessageReference(account.getUuid(), folderName, messageUid, null);
break; break;
} }
} }

View File

@ -2992,7 +2992,11 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
for (int i = 0, len = mAdapter.getCount(); i < len; i++) { for (int i = 0, len = mAdapter.getCount(); i < len; i++) {
Cursor cursor = (Cursor) mAdapter.getItem(i); Cursor cursor = (Cursor) mAdapter.getItem(i);
MessageReference ref = new MessageReference(cursor.getString(ACCOUNT_UUID_COLUMN), cursor.getString(FOLDER_NAME_COLUMN), cursor.getString(UID_COLUMN), null); String accountUuid = cursor.getString(ACCOUNT_UUID_COLUMN);
String folderName = cursor.getString(FOLDER_NAME_COLUMN);
String messageUid = cursor.getString(UID_COLUMN);
MessageReference ref = new MessageReference(accountUuid, folderName, messageUid, null);
messageRefs.add(ref); messageRefs.add(ref);
} }
@ -3054,9 +3058,11 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
private MessageReference getReferenceForPosition(int position) { private MessageReference getReferenceForPosition(int position) {
Cursor cursor = (Cursor) mAdapter.getItem(position); Cursor cursor = (Cursor) mAdapter.getItem(position);
MessageReference ref = new MessageReference(cursor.getString(ACCOUNT_UUID_COLUMN), cursor.getString(FOLDER_NAME_COLUMN), cursor.getString(UID_COLUMN), null);
return ref; String accountUuid = cursor.getString(ACCOUNT_UUID_COLUMN);
String folderName = cursor.getString(FOLDER_NAME_COLUMN);
String messageUid = cursor.getString(UID_COLUMN);
return new MessageReference(accountUuid, folderName, messageUid, null);
} }
private void openMessageAtPosition(int position) { private void openMessageAtPosition(int position) {