Merge "Make the refresh button animate in-place." into honeycomb
This commit is contained in:
commit
da75871620
29
res/layout/action_bar_indeterminate_progress.xml
Normal file
29
res/layout/action_bar_indeterminate_progress.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2011 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="64dip"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
>
|
||||||
|
<ProgressBar
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
style="?android:attr/indeterminateProgressStyle"
|
||||||
|
/>
|
||||||
|
</FrameLayout>
|
@ -45,7 +45,6 @@ import android.util.Log;
|
|||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
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");
|
if (Email.DEBUG_LIFECYCLE && Email.DEBUG) Log.d(Email.LOG_TAG, "MessageListXL onCreate");
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
ActivityHelper.debugSetWindowFlags(this);
|
ActivityHelper.debugSetWindowFlags(this);
|
||||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
|
||||||
setContentView(R.layout.message_list_xl);
|
setContentView(R.layout.message_list_xl);
|
||||||
|
|
||||||
ActionBar ab = getActionBar();
|
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.
|
* If we're refreshing the current mailbox, animate the "mailbox refreshing" progress icon.
|
||||||
*/
|
*/
|
||||||
private void updateProgressIcon() {
|
private void updateProgressIcon() {
|
||||||
setProgressBarIndeterminateVisibility(isProgressActive());
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isProgressActive() {
|
private boolean isProgressActive() {
|
||||||
@ -723,6 +721,12 @@ public class MessageListXL extends Activity implements
|
|||||||
MenuItem item = menu.findItem(R.id.refresh);
|
MenuItem item = menu.findItem(R.id.refresh);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
item.setVisible(shouldShowRefreshButton());
|
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);
|
return super.onPrepareOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user