mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Fix NullPointerException
This commit is contained in:
parent
ac9259a0e3
commit
e59d23ca0e
@ -922,15 +922,17 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
||||
menu.findItem(R.id.next_message).setVisible(false);
|
||||
menu.findItem(R.id.previous_message).setVisible(false);
|
||||
} else {
|
||||
final MessageReference ref = mMessageViewFragment.getMessageReference();
|
||||
final boolean canDoPrev = mMessageListFragment != null && !mMessageListFragment.isFirst(ref);
|
||||
final boolean canDoNext = mMessageListFragment != null && !mMessageListFragment.isLast(ref);
|
||||
MessageReference ref = mMessageViewFragment.getMessageReference();
|
||||
boolean initialized = (mMessageListFragment != null &&
|
||||
mMessageListFragment.isLoadFinished());
|
||||
boolean canDoPrev = (initialized && !mMessageListFragment.isFirst(ref));
|
||||
boolean canDoNext = (initialized && !mMessageListFragment.isLast(ref));
|
||||
|
||||
final MenuItem prev = menu.findItem(R.id.previous_message);
|
||||
MenuItem prev = menu.findItem(R.id.previous_message);
|
||||
prev.setEnabled(canDoPrev);
|
||||
prev.getIcon().setAlpha(canDoPrev ? 255 : 127);
|
||||
|
||||
final MenuItem next = menu.findItem(R.id.next_message);
|
||||
MenuItem next = menu.findItem(R.id.next_message);
|
||||
next.setEnabled(canDoNext);
|
||||
next.getIcon().setAlpha(canDoNext ? 255 : 127);
|
||||
}
|
||||
|
@ -2915,6 +2915,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
||||
boolean startSearch(Account account, String folderName);
|
||||
void remoteSearchStarted();
|
||||
void goBack();
|
||||
void updateMenu();
|
||||
}
|
||||
|
||||
public void onReverseSort() {
|
||||
@ -3230,16 +3231,22 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
||||
resetActionMode();
|
||||
computeBatchDirection();
|
||||
|
||||
if (isLoadFinished()) {
|
||||
if (mSavedListState != null) {
|
||||
mHandler.restoreListPosition();
|
||||
}
|
||||
|
||||
mFragmentListener.updateMenu();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLoadFinished() {
|
||||
boolean loadFinished = true;
|
||||
for (int i = 0; i < mCursorValid.length; i++) {
|
||||
loadFinished &= mCursorValid[i];
|
||||
}
|
||||
|
||||
if (loadFinished) {
|
||||
mHandler.restoreListPosition();
|
||||
}
|
||||
}
|
||||
return loadFinished;
|
||||
}
|
||||
|
||||
private void cleanupSelected(Cursor cursor) {
|
||||
|
Loading…
Reference in New Issue
Block a user