From 484d220b6e02753f2e616277b26d9555231d95a6 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Tue, 25 Jan 2011 14:46:11 -0800 Subject: [PATCH] Make the refresh button animate in-place. Turn the refresh button into an indeterminate progress icon while refreshing. Bug 3388138 Change-Id: Ic0406ff5b857243c3e1e475ddb8b305441eddbb0 --- .../action_bar_indeterminate_progress.xml | 29 +++++++++++++++++++ .../android/email/activity/MessageListXL.java | 10 +++++-- 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 res/layout/action_bar_indeterminate_progress.xml diff --git a/res/layout/action_bar_indeterminate_progress.xml b/res/layout/action_bar_indeterminate_progress.xml new file mode 100644 index 000000000..c36c79266 --- /dev/null +++ b/res/layout/action_bar_indeterminate_progress.xml @@ -0,0 +1,29 @@ + + + + + + diff --git a/src/com/android/email/activity/MessageListXL.java b/src/com/android/email/activity/MessageListXL.java index 79ba623c9..2c4a185c8 100644 --- a/src/com/android/email/activity/MessageListXL.java +++ b/src/com/android/email/activity/MessageListXL.java @@ -45,7 +45,6 @@ import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.view.Window; import android.widget.TextView; import java.security.InvalidParameterException; @@ -151,7 +150,6 @@ public class MessageListXL extends Activity implements if (Email.DEBUG_LIFECYCLE && Email.DEBUG) Log.d(Email.LOG_TAG, "MessageListXL onCreate"); super.onCreate(savedInstanceState); ActivityHelper.debugSetWindowFlags(this); - requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.message_list_xl); ActionBar ab = getActionBar(); @@ -703,7 +701,7 @@ public class MessageListXL extends Activity implements * If we're refreshing the current mailbox, animate the "mailbox refreshing" progress icon. */ private void updateProgressIcon() { - setProgressBarIndeterminateVisibility(isProgressActive()); + invalidateOptionsMenu(); } private boolean isProgressActive() { @@ -723,6 +721,12 @@ public class MessageListXL extends Activity implements MenuItem item = menu.findItem(R.id.refresh); if (item != null) { item.setVisible(shouldShowRefreshButton()); + if (isProgressActive()) { + // Turn it into a progress icon. + item.setActionView(R.layout.action_bar_indeterminate_progress); + } else { + item.setActionView(null); + } } return super.onPrepareOptionsMenu(menu); }