1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-02-07 02:30:10 -05:00

Add refresh to actionbar for Accounts activity.

This commit is contained in:
Sander Bogaert 2012-08-02 10:09:31 -04:00 committed by Andrew Chen
parent 65505c8145
commit 6daa8a3c0c
2 changed files with 16 additions and 3 deletions

View File

@ -27,7 +27,8 @@
android:id="@+id/check_mail"
android:alphabeticShortcut="r"
android:title="@string/check_mail_action"
android:icon="@drawable/ic_menu_refresh"
android:icon="@drawable/ic_action_refresh"
android:showAsAction="always"
/>
<!--
<item android:id="@+id/search"

View File

@ -127,6 +127,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
private SearchAccount integratedInboxAccount = null;
private FontSizes mFontSizes = K9.getFontSizes();
private MenuItem mRefreshMenuItem;
/**
* Contains information about objects that need to be retained on configuration changes.
*
@ -190,13 +191,23 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
}
});
}
public void progress(final boolean progress) {
// Make sure we don't try this before the menu is initialized
// this could happen while the activity is initialized.
if (mRefreshMenuItem == null) {
return;
}
runOnUiThread(new Runnable() {
public void run() {
setProgressBarIndeterminateVisibility(progress);
if (progress) {
mRefreshMenuItem.setActionView(R.layout.actionbar_indeterminate_progress_actionview);
} else {
mRefreshMenuItem.setActionView(null);
}
}
});
}
public void progress(final int progress) {
runOnUiThread(new Runnable() {
@ -1250,6 +1261,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getSupportMenuInflater().inflate(R.menu.accounts_option, menu);
mRefreshMenuItem = menu.findItem(R.id.check_mail);
return true;
}