Make sure "refresh" button animation refrects actual state

When selecting a different mailbox, start/stop the refresh button animation
as necessary.

Bug 2997302

Change-Id: If29d7ec37348d527698685503b7b4fbf0ed0c35f
This commit is contained in:
Makoto Onuki 2010-09-13 16:35:58 -07:00
parent 52930bfda3
commit 40b2d92851
2 changed files with 22 additions and 2 deletions

View File

@ -516,6 +516,11 @@ public class MessageListXL extends Activity implements View.OnClickListener,
startActivity(AccountSecurity.actionUpdateSecurityIntent(this, accountId));
}
@Override
public void onMailboxChanged(long accountId, long newMailboxId) {
updateProgressIcon();
}
private void loadAccounts() {
getLoaderManager().initLoader(LOADER_ID_ACCOUNT_LIST, null, new LoaderCallbacks<Cursor>() {
@Override
@ -583,15 +588,24 @@ public class MessageListXL extends Activity implements View.OnClickListener,
@Override
public void onMessagingError(long accountId, long mailboxId, String message) {
Utility.showToast(MessageListXL.this, message); // STOPSHIP temporary UI
invalidateOptionsMenu();
updateProgressIcon();
}
@Override
public void onRefreshStatusChanged(long accountId, long mailboxId) {
invalidateOptionsMenu();
updateProgressIcon();
}
}
/**
* If we're refreshing the current mailbox, animate the "mailbox refreshing" progress icon.
*/
private void updateProgressIcon() {
// TODO See the comment on onPrepareOptionsMenu -- change this when we get a better progress
// bar support.
invalidateOptionsMenu();
}
private boolean isProgressActive() {
final long mailboxId = mFragmentManager.getMailboxId();
return (mailboxId >= 0) && mRefreshManager.isMessageListRefreshing(mailboxId);

View File

@ -100,6 +100,11 @@ class MessageListXLFragmentManager {
* Called when the selected account is on security-hold.
*/
public void onAccountSecurityHold(long accountId);
/**
* Called when the current mailbox has changed.
*/
public void onMailboxChanged(long accountId, long newMailboxId);
}
private final TargetActivity mTargetActivity;
@ -405,6 +410,7 @@ class MessageListXLFragmentManager {
mMessageListFragment.setCallback(mMessageListFragmentCallback);
mMessageListFragment.openMailbox(mMailboxId);
restoreMesasgeListState();
mTargetActivity.onMailboxChanged(mAccountId, mMailboxId);
}
/**