Revised assets for progress bars and indeterminate progress spinners.
Add support in ActionBar for activity-wide progress APIs.
Add ability for progress bars to set a target framerate rather than
the 5fps previously used.
Clean up some more dialog layouts using hardcoded styles rather than
theme attributes.
Change-Id: I8e88c7595e27c0b6f7829b598f2b084ac8501ae3
diff --git a/api/current.xml b/api/current.xml
index 15224ce..8a5e0d6 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -2297,6 +2297,17 @@
visibility="public"
>
</field>
+<field name="animationResolution"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843563"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="antialias"
type="int"
transient="false"
@@ -5135,6 +5146,17 @@
visibility="public"
>
</field>
+<field name="indeterminateProgressStyle"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843561"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="indicatorLeft"
type="int"
transient="false"
@@ -7159,6 +7181,17 @@
visibility="public"
>
</field>
+<field name="progressBarPadding"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843562"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="progressBarStyle"
type="int"
transient="false"
diff --git a/core/java/android/app/ProgressDialog.java b/core/java/android/app/ProgressDialog.java
index 4c5d28e..af1b294 100644
--- a/core/java/android/app/ProgressDialog.java
+++ b/core/java/android/app/ProgressDialog.java
@@ -42,7 +42,7 @@
*/
public class ProgressDialog extends AlertDialog {
- /** Creates a ProgressDialog with a ciruclar, spinning progress
+ /** Creates a ProgressDialog with a circular, spinning progress
* bar. This is the default.
*/
public static final int STYLE_SPINNER = 0;
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index b7048fc..63fb3e9 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -154,6 +154,8 @@
private boolean mInDrawing;
+ private int mAnimationResolution;
+
/**
* Create a new progress bar with range 0...100 and initial progress of 0.
* @param context the application environment
@@ -167,12 +169,19 @@
}
public ProgressBar(Context context, AttributeSet attrs, int defStyle) {
+ this(context, attrs, defStyle, 0);
+ }
+
+ /**
+ * @hide
+ */
+ public ProgressBar(Context context, AttributeSet attrs, int defStyle, int styleRes) {
super(context, attrs, defStyle);
mUiThreadId = Thread.currentThread().getId();
initProgressBar();
TypedArray a =
- context.obtainStyledAttributes(attrs, R.styleable.ProgressBar, defStyle, 0);
+ context.obtainStyledAttributes(attrs, R.styleable.ProgressBar, defStyle, styleRes);
mNoInvalidate = true;
@@ -222,6 +231,9 @@
setIndeterminate(mOnlyIndeterminate || a.getBoolean(
R.styleable.ProgressBar_indeterminate, mIndeterminate));
+ mAnimationResolution = a.getInteger(R.styleable.ProgressBar_animationResolution,
+ ANIMATION_RESOLUTION);
+
a.recycle();
}
@@ -852,9 +864,9 @@
} finally {
mInDrawing = false;
}
- if (SystemClock.uptimeMillis() - mLastDrawTime >= ANIMATION_RESOLUTION) {
+ if (SystemClock.uptimeMillis() - mLastDrawTime >= mAnimationResolution) {
mLastDrawTime = SystemClock.uptimeMillis();
- postInvalidateDelayed(ANIMATION_RESOLUTION);
+ postInvalidateDelayed(mAnimationResolution);
}
}
d.draw(canvas);
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index 7a64da0..0a4f543 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -26,7 +26,6 @@
import android.app.Activity;
import android.content.Context;
import android.content.pm.ApplicationInfo;
-import android.content.pm.ComponentInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.TypedArray;
@@ -45,6 +44,7 @@
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
+import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
@@ -94,9 +94,15 @@
private HorizontalScrollView mTabScrollView;
private LinearLayout mTabLayout;
private View mCustomNavView;
+ private ProgressBar mProgressView;
+ private ProgressBar mIndeterminateProgressView;
+
+ private int mProgressBarPadding;
private int mTitleStyleRes;
private int mSubtitleStyleRes;
+ private int mProgressStyle;
+ private int mIndeterminateProgressStyle;
private boolean mShowMenu;
private boolean mUserTitle;
@@ -185,6 +191,11 @@
mTitleStyleRes = a.getResourceId(R.styleable.ActionBar_titleTextStyle, 0);
mSubtitleStyleRes = a.getResourceId(R.styleable.ActionBar_subtitleTextStyle, 0);
+ mProgressStyle = a.getResourceId(R.styleable.ActionBar_progressBarStyle, 0);
+ mIndeterminateProgressStyle = a.getResourceId(
+ R.styleable.ActionBar_indeterminateProgressStyle, 0);
+
+ mProgressBarPadding = a.getDimensionPixelOffset(R.styleable.ActionBar_progressBarPadding, 0);
setDisplayOptions(a.getInt(R.styleable.ActionBar_displayOptions, DISPLAY_DEFAULT));
@@ -216,6 +227,20 @@
mHomeLayout.setFocusable(true);
}
+ public void initProgress() {
+ mProgressView = new ProgressBar(mContext, null, 0, mProgressStyle);
+ mProgressView.setId(R.id.progress_horizontal);
+ mProgressView.setMax(10000);
+ addView(mProgressView);
+ }
+
+ public void initIndeterminateProgress() {
+ mIndeterminateProgressView = new ProgressBar(mContext, null, 0,
+ mIndeterminateProgressStyle);
+ mIndeterminateProgressView.setId(R.id.progress_circular);
+ addView(mIndeterminateProgressView);
+ }
+
@Override
public ActionMode startActionModeForChild(View child, ActionMode.Callback callback) {
// No starting an action mode for an action bar child! (Where would it go?)
@@ -665,6 +690,13 @@
break;
}
+ if (mIndeterminateProgressView != null &&
+ mIndeterminateProgressView.getVisibility() != GONE) {
+ availableWidth = measureChildView(mIndeterminateProgressView, availableWidth,
+ childSpecHeight, 0);
+ rightOfCenter -= mIndeterminateProgressView.getMeasuredWidth();
+ }
+
if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0 && mCustomNavView != null) {
final LayoutParams lp = generateLayoutParams(mCustomNavView.getLayoutParams());
final ActionBar.LayoutParams ablp = lp instanceof ActionBar.LayoutParams ?
@@ -726,6 +758,12 @@
if (mContextView != null) {
mContextView.setHeight(getMeasuredHeight());
}
+
+ if (mProgressView != null && mProgressView.getVisibility() != GONE) {
+ mProgressView.measure(MeasureSpec.makeMeasureSpec(
+ contentWidth - mProgressBarPadding * 2, MeasureSpec.EXACTLY),
+ MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST));
+ }
}
private int measureChildView(View child, int availableWidth, int childSpecHeight, int spacing) {
@@ -764,6 +802,7 @@
if (mTabScrollView != null) {
x += positionChild(mTabScrollView, x, y, contentHeight);
}
+ break;
}
int menuLeft = r - l - getPaddingRight();
@@ -772,6 +811,12 @@
menuLeft -= mMenuView.getMeasuredWidth();
}
+ if (mIndeterminateProgressView != null &&
+ mIndeterminateProgressView.getVisibility() != GONE) {
+ positionChildInverse(mIndeterminateProgressView, menuLeft, y, contentHeight);
+ menuLeft -= mIndeterminateProgressView.getMeasuredWidth();
+ }
+
if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
LayoutParams lp = mCustomNavView.getLayoutParams();
final ActionBar.LayoutParams ablp = lp instanceof ActionBar.LayoutParams ?
@@ -830,6 +875,13 @@
}
x += positionChild(mCustomNavView, xpos, ypos, contentHeight);
}
+
+ if (mProgressView != null) {
+ mProgressView.bringToFront();
+ final int halfProgressHeight = mProgressView.getMeasuredHeight() / 2;
+ mProgressView.layout(mProgressBarPadding, -halfProgressHeight,
+ mProgressBarPadding + mProgressView.getMeasuredWidth(), halfProgressHeight);
+ }
}
private int positionChild(View child, int x, int y, int contentHeight) {
diff --git a/core/res/res/drawable-hdpi/progress_bg_holo_dark.9.png b/core/res/res/drawable-hdpi/progress_bg_holo_dark.9.png
index 192df6d2..079de61 100644
--- a/core/res/res/drawable-hdpi/progress_bg_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/progress_bg_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progress_bg_holo_light.9.png b/core/res/res/drawable-hdpi/progress_bg_holo_light.9.png
index 223416d..2272b41 100644
--- a/core/res/res/drawable-hdpi/progress_bg_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/progress_bg_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png b/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png
index 1a59124..16b7349 100644
--- a/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png b/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png
index f119c6a..7229343 100644
--- a/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progress_secondary_holo_dark.9.png b/core/res/res/drawable-hdpi/progress_secondary_holo_dark.9.png
index 3c6c5ed..894dfcf 100644
--- a/core/res/res/drawable-hdpi/progress_secondary_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/progress_secondary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progress_secondary_holo_light.9.png b/core/res/res/drawable-hdpi/progress_secondary_holo_light.9.png
index cab3888..f553ba6 100644
--- a/core/res/res/drawable-hdpi/progress_secondary_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/progress_secondary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_16_inner_holo.png b/core/res/res/drawable-hdpi/spinner_16_inner_holo.png
new file mode 100644
index 0000000..ff363f0
--- /dev/null
+++ b/core/res/res/drawable-hdpi/spinner_16_inner_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_16_outer_holo.png b/core/res/res/drawable-hdpi/spinner_16_outer_holo.png
new file mode 100644
index 0000000..a5a0b98
--- /dev/null
+++ b/core/res/res/drawable-hdpi/spinner_16_outer_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_20_inner_holo.png b/core/res/res/drawable-hdpi/spinner_20_inner_holo.png
new file mode 100644
index 0000000..16742e8
--- /dev/null
+++ b/core/res/res/drawable-hdpi/spinner_20_inner_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_20_outer_holo.png b/core/res/res/drawable-hdpi/spinner_20_outer_holo.png
new file mode 100644
index 0000000..d6aa73b
--- /dev/null
+++ b/core/res/res/drawable-hdpi/spinner_20_outer_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_48_inner_holo.png b/core/res/res/drawable-hdpi/spinner_48_inner_holo.png
new file mode 100644
index 0000000..ee3f4c2
--- /dev/null
+++ b/core/res/res/drawable-hdpi/spinner_48_inner_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_48_outer_holo.png b/core/res/res/drawable-hdpi/spinner_48_outer_holo.png
new file mode 100644
index 0000000..7c59e2f
--- /dev/null
+++ b/core/res/res/drawable-hdpi/spinner_48_outer_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_76_inner_holo.png b/core/res/res/drawable-hdpi/spinner_76_inner_holo.png
new file mode 100644
index 0000000..a1ef44c
--- /dev/null
+++ b/core/res/res/drawable-hdpi/spinner_76_inner_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_76_outer_holo.png b/core/res/res/drawable-hdpi/spinner_76_outer_holo.png
new file mode 100644
index 0000000..69e3ab7
--- /dev/null
+++ b/core/res/res/drawable-hdpi/spinner_76_outer_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_bg_holo_dark.9.png b/core/res/res/drawable-mdpi/progress_bg_holo_dark.9.png
index 316af64..0376e53 100644
--- a/core/res/res/drawable-mdpi/progress_bg_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/progress_bg_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_bg_holo_light.9.png b/core/res/res/drawable-mdpi/progress_bg_holo_light.9.png
index e286136..e825119 100644
--- a/core/res/res/drawable-mdpi/progress_bg_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/progress_bg_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png b/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png
index 0502669..e525eaf 100644
--- a/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png b/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png
index 1ba9e34..0532f0e 100644
--- a/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_secondary_holo_dark.9.png b/core/res/res/drawable-mdpi/progress_secondary_holo_dark.9.png
index a2fe2b3..99f8f06 100644
--- a/core/res/res/drawable-mdpi/progress_secondary_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/progress_secondary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_secondary_holo_light.9.png b/core/res/res/drawable-mdpi/progress_secondary_holo_light.9.png
index 3b264ab..198d7d9 100644
--- a/core/res/res/drawable-mdpi/progress_secondary_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/progress_secondary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_16_inner_holo.png b/core/res/res/drawable-mdpi/spinner_16_inner_holo.png
new file mode 100644
index 0000000..2703553
--- /dev/null
+++ b/core/res/res/drawable-mdpi/spinner_16_inner_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_16_outer_holo.png b/core/res/res/drawable-mdpi/spinner_16_outer_holo.png
new file mode 100644
index 0000000..87d2c87
--- /dev/null
+++ b/core/res/res/drawable-mdpi/spinner_16_outer_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_20_inner_holo.png b/core/res/res/drawable-mdpi/spinner_20_inner_holo.png
new file mode 100644
index 0000000..3c97355
--- /dev/null
+++ b/core/res/res/drawable-mdpi/spinner_20_inner_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_20_outer_holo.png b/core/res/res/drawable-mdpi/spinner_20_outer_holo.png
new file mode 100644
index 0000000..96155e3
--- /dev/null
+++ b/core/res/res/drawable-mdpi/spinner_20_outer_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_48_inner_holo.png b/core/res/res/drawable-mdpi/spinner_48_inner_holo.png
new file mode 100644
index 0000000..26dcfbf
--- /dev/null
+++ b/core/res/res/drawable-mdpi/spinner_48_inner_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_48_outer_holo.png b/core/res/res/drawable-mdpi/spinner_48_outer_holo.png
new file mode 100644
index 0000000..49dad0c
--- /dev/null
+++ b/core/res/res/drawable-mdpi/spinner_48_outer_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_76_inner_holo.png b/core/res/res/drawable-mdpi/spinner_76_inner_holo.png
new file mode 100644
index 0000000..ebccabd
--- /dev/null
+++ b/core/res/res/drawable-mdpi/spinner_76_inner_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_76_outer_holo.png b/core/res/res/drawable-mdpi/spinner_76_outer_holo.png
new file mode 100644
index 0000000..37d3f58
--- /dev/null
+++ b/core/res/res/drawable-mdpi/spinner_76_outer_holo.png
Binary files differ
diff --git a/core/res/res/drawable/progress_large_holo.xml b/core/res/res/drawable/progress_large_holo.xml
new file mode 100644
index 0000000..5865780
--- /dev/null
+++ b/core/res/res/drawable/progress_large_holo.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2010, 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.
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <rotate
+ android:drawable="@drawable/spinner_76_outer_holo"
+ android:pivotX="50%"
+ android:pivotY="50%"
+ android:fromDegrees="0"
+ android:toDegrees="1080" />
+ </item>
+ <item>
+ <rotate
+ android:drawable="@drawable/spinner_76_inner_holo"
+ android:pivotX="50%"
+ android:pivotY="50%"
+ android:fromDegrees="720"
+ android:toDegrees="0" />
+ </item>
+</layer-list>
diff --git a/core/res/res/drawable/progress_medium_holo.xml b/core/res/res/drawable/progress_medium_holo.xml
new file mode 100644
index 0000000..6772f58
--- /dev/null
+++ b/core/res/res/drawable/progress_medium_holo.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2010, 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.
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <rotate
+ android:drawable="@drawable/spinner_48_outer_holo"
+ android:pivotX="50%"
+ android:pivotY="50%"
+ android:fromDegrees="0"
+ android:toDegrees="1080" />
+ </item>
+ <item>
+ <rotate
+ android:drawable="@drawable/spinner_48_inner_holo"
+ android:pivotX="50%"
+ android:pivotY="50%"
+ android:fromDegrees="720"
+ android:toDegrees="0" />
+ </item>
+</layer-list>
diff --git a/core/res/res/drawable/progress_small_holo.xml b/core/res/res/drawable/progress_small_holo.xml
new file mode 100644
index 0000000..1d3b62b
--- /dev/null
+++ b/core/res/res/drawable/progress_small_holo.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2010, 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.
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <rotate
+ android:drawable="@drawable/spinner_16_outer_holo"
+ android:pivotX="50%"
+ android:pivotY="50%"
+ android:fromDegrees="0"
+ android:toDegrees="1080" />
+ </item>
+ <item>
+ <rotate
+ android:drawable="@drawable/spinner_16_inner_holo"
+ android:pivotX="50%"
+ android:pivotY="50%"
+ android:fromDegrees="720"
+ android:toDegrees="0" />
+ </item>
+</layer-list>
diff --git a/core/res/res/layout/progress_dialog.xml b/core/res/res/layout/progress_dialog.xml
index 298173a..08e720f 100644
--- a/core/res/res/layout/progress_dialog.xml
+++ b/core/res/res/layout/progress_dialog.xml
@@ -33,7 +33,7 @@
android:paddingBottom="10dip">
<ProgressBar android:id="@android:id/progress"
- style="@android:style/Widget.ProgressBar"
+ style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:max="10000"
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index d6684fe..65a580b 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2165,6 +2165,8 @@
<attr name="minHeight" format="dimension" />
<attr name="maxHeight" />
<attr name="interpolator" format="reference" />
+ <!-- Timeout between frames of animation in milliseconds -->
+ <attr name="animationResolution" format="integer" />
</declare-styleable>
<declare-styleable name="SeekBar">
@@ -4379,6 +4381,12 @@
<attr name="height" />
<!-- Specifies a drawable to use for the 'home as up' indicator. -->
<attr name="homeAsUpIndicator" format="reference" />
+ <!-- Specifies a style resource to use for an embedded progress bar. -->
+ <attr name="progressBarStyle" />
+ <!-- Specifies a style resource to use for an indeterminate progress spinner. -->
+ <attr name="indeterminateProgressStyle" format="reference" />
+ <!-- Specifies the horizontal padding on either end for an embedded progress bar. -->
+ <attr name="progressBarPadding" format="dimension" />
</declare-styleable>
<declare-styleable name="ActionMode">
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 28df995..3eb980f 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1372,6 +1372,9 @@
<public type="attr" name="textEditNoPasteWindowLayout" />
<public type="attr" name="textIsSelectable" />
<public type="attr" name="windowEnableSplitTouch" />
+ <public type="attr" name="indeterminateProgressStyle" />
+ <public type="attr" name="progressBarPadding" />
+ <public type="attr" name="animationResolution" />
<public type="anim" name="animator_fade_in" />
<public type="anim" name="animator_fade_out" />
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 457175b4..8bec87b 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -920,6 +920,8 @@
<item name="android:paddingBottom">0dip</item>
<item name="android:titleTextStyle">@android:style/TextAppearance.Widget.ActionBar.Title</item>
<item name="android:subtitleTextStyle">@android:style/TextAppearance.Widget.ActionBar.Subtitle</item>
+ <item name="android:progressBarStyle">@android:style/Widget.ProgressBar.Horizontal</item>
+ <item name="android:indeterminateProgressStyle">@android:style/Widget.ProgressBar.Small</item>
</style>
<style name="Widget.ActionMode">
@@ -1356,30 +1358,34 @@
</style>
<style name="Widget.Holo.ProgressBar" parent="Widget.ProgressBar">
+ <item name="android:indeterminateDrawable">@android:drawable/progress_medium_holo</item>
+ <item name="android:animationResolution">33</item>
</style>
<style name="Widget.Holo.ProgressBar.Horizontal" parent="Widget.ProgressBar.Horizontal">
<item name="android:progressDrawable">@android:drawable/progress_horizontal_holo_dark</item>
- <item name="android:minHeight">16dip</item>
- <item name="android:maxHeight">16dip</item>
+ <item name="android:minHeight">24dip</item>
+ <item name="android:maxHeight">24dip</item>
</style>
- <style name="Widget.Holo.ProgressBar.Small" parent="Widget.ProgressBar.Horizontal">
+ <style name="Widget.Holo.ProgressBar.Small" parent="Widget.ProgressBar.Small">
+ <item name="android:indeterminateDrawable">@android:drawable/progress_small_holo</item>
</style>
- <style name="Widget.Holo.ProgressBar.Small.Title" parent="Widget.ProgressBar.Small.Title">
+ <style name="Widget.Holo.ProgressBar.Small.Title">
</style>
<style name="Widget.Holo.ProgressBar.Large" parent="Widget.ProgressBar.Large">
+ <item name="android:indeterminateDrawable">@android:drawable/progress_large_holo</item>
</style>
- <style name="Widget.Holo.ProgressBar.Inverse" parent="Widget.ProgressBar.Inverse">
+ <style name="Widget.Holo.ProgressBar.Inverse">
</style>
- <style name="Widget.Holo.ProgressBar.Small.Inverse" parent="Widget.ProgressBar.Small.Inverse">
+ <style name="Widget.Holo.ProgressBar.Small.Inverse">
</style>
- <style name="Widget.Holo.ProgressBar.Large.Inverse" parent="Widget.ProgressBar.Large.Inverse">
+ <style name="Widget.Holo.ProgressBar.Large.Inverse">
</style>
<style name="Widget.Holo.SeekBar">
@@ -1540,6 +1546,9 @@
<item name="android:background">@null</item>
<item name="android:divider">?android:attr/dividerVertical</item>
<item name="android:homeAsUpIndicator">@android:drawable/ic_ab_back_holo_dark</item>
+ <item name="android:progressBarStyle">@android:style/Widget.Holo.ProgressBar.Horizontal</item>
+ <item name="android:indeterminateProgressStyle">@android:style/Widget.Holo.ProgressBar</item>
+ <item name="android:progressBarPadding">32dip</item>
</style>
<!-- Light widget styles -->
@@ -1645,29 +1654,29 @@
<style name="Widget.Holo.Light.PopupWindow" parent="Widget.PopupWindow">
</style>
- <style name="Widget.Holo.Light.ProgressBar" parent="Widget.ProgressBar">
+ <style name="Widget.Holo.Light.ProgressBar" parent="Widget.Holo.ProgressBar">
</style>
- <style name="Widget.Holo.Light.ProgressBar.Horizontal" parent="Widget.ProgressBar.Horizontal">
+ <style name="Widget.Holo.Light.ProgressBar.Horizontal" parent="Widget.Holo.ProgressBar.Horizontal">
<item name="android:progressDrawable">@android:drawable/progress_horizontal_holo_light</item>
</style>
- <style name="Widget.Holo.Light.ProgressBar.Small" parent="Widget.ProgressBar.Small">
+ <style name="Widget.Holo.Light.ProgressBar.Small" parent="Widget.Holo.ProgressBar.Small">
</style>
- <style name="Widget.Holo.Light.ProgressBar.Small.Title" parent="Widget.ProgressBar.Small.Title">
+ <style name="Widget.Holo.Light.ProgressBar.Small.Title" parent="Widget.Holo.ProgressBar.Small.Title">
</style>
- <style name="Widget.Holo.Light.ProgressBar.Large" parent="Widget.ProgressBar.Large">
+ <style name="Widget.Holo.Light.ProgressBar.Large" parent="Widget.Holo.ProgressBar.Large">
</style>
- <style name="Widget.Holo.Light.ProgressBar.Inverse" parent="Widget.ProgressBar.Inverse">
+ <style name="Widget.Holo.Light.ProgressBar.Inverse" parent="Widget.Holo.ProgressBar.Inverse">
</style>
- <style name="Widget.Holo.Light.ProgressBar.Small.Inverse" parent="Widget.ProgressBar.Small.Inverse">
+ <style name="Widget.Holo.Light.ProgressBar.Small.Inverse" parent="Widget.Holo.ProgressBar.Small.Inverse">
</style>
- <style name="Widget.Holo.Light.ProgressBar.Large.Inverse" parent="Widget.ProgressBar.Large.Inverse">
+ <style name="Widget.Holo.Light.ProgressBar.Large.Inverse" parent="Widget.Holo.ProgressBar.Large.Inverse">
</style>
<style name="Widget.Holo.Light.SeekBar" parent="Widget.Holo.SeekBar">
@@ -1794,6 +1803,8 @@
<item name="android:subtitleTextStyle">@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle</item>
<item name="android:background">@null</item>
<item name="android:homeAsUpIndicator">@android:drawable/ic_ab_back_holo_light</item>
+ <item name="android:progressBarStyle">@android:style/Widget.Holo.Light.ProgressBar.Horizontal</item>
+ <item name="android:indeterminateProgressStyle">@android:style/Widget.Holo.Light.ProgressBar.Small</item>
</style>
<!-- Animation Styles -->
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index c8cce81..8082f6b 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -1031,15 +1031,15 @@
<item name="imageWellStyle">@android:style/Widget.Holo.ImageWell</item>
<item name="listViewStyle">@android:style/Widget.Holo.ListView</item>
<item name="listViewWhiteStyle">@android:style/Widget.Holo.ListView.White</item>
- <item name="popupWindowStyle">@android:style/Widget.Holo.PopupWindow</item>
- <item name="progressBarStyle">@android:style/Widget.Holo.ProgressBar</item>
- <item name="progressBarStyleHorizontal">@android:style/Widget.Holo.ProgressBar.Horizontal</item>
- <item name="progressBarStyleSmall">@android:style/Widget.Holo.ProgressBar.Small</item>
- <item name="progressBarStyleSmallTitle">@android:style/Widget.Holo.ProgressBar.Small.Title</item>
- <item name="progressBarStyleLarge">@android:style/Widget.Holo.ProgressBar.Large</item>
- <item name="progressBarStyleInverse">@android:style/Widget.Holo.ProgressBar.Inverse</item>
- <item name="progressBarStyleSmallInverse">@android:style/Widget.Holo.ProgressBar.Small.Inverse</item>
- <item name="progressBarStyleLargeInverse">@android:style/Widget.Holo.ProgressBar.Large.Inverse</item>
+ <item name="popupWindowStyle">@android:style/Widget.Holo.Light.PopupWindow</item>
+ <item name="progressBarStyle">@android:style/Widget.Holo.Light.ProgressBar</item>
+ <item name="progressBarStyleHorizontal">@android:style/Widget.Holo.Light.ProgressBar.Horizontal</item>
+ <item name="progressBarStyleSmall">@android:style/Widget.Holo.Light.ProgressBar.Small</item>
+ <item name="progressBarStyleSmallTitle">@android:style/Widget.Holo.Light.ProgressBar.Small.Title</item>
+ <item name="progressBarStyleLarge">@android:style/Widget.Holo.Light.ProgressBar.Large</item>
+ <item name="progressBarStyleInverse">@android:style/Widget.Holo.Light.ProgressBar.Inverse</item>
+ <item name="progressBarStyleSmallInverse">@android:style/Widget.Holo.Light.ProgressBar.Small.Inverse</item>
+ <item name="progressBarStyleLargeInverse">@android:style/Widget.Holo.Light.ProgressBar.Large.Inverse</item>
<item name="seekBarStyle">@android:style/Widget.Holo.SeekBar</item>
<item name="ratingBarStyle">@android:style/Widget.Holo.RatingBar</item>
<item name="ratingBarStyleIndicator">@android:style/Widget.Holo.RatingBar.Indicator</item>
diff --git a/graphics/java/android/graphics/drawable/RotateDrawable.java b/graphics/java/android/graphics/drawable/RotateDrawable.java
index 9c47dab..f3f3653 100644
--- a/graphics/java/android/graphics/drawable/RotateDrawable.java
+++ b/graphics/java/android/graphics/drawable/RotateDrawable.java
@@ -232,8 +232,6 @@
float toDegrees = a.getFloat(
com.android.internal.R.styleable.RotateDrawable_toDegrees, 360.0f);
- toDegrees = Math.max(fromDegrees, toDegrees);
-
int res = a.getResourceId(
com.android.internal.R.styleable.RotateDrawable_drawable, 0);
Drawable drawable = null;
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 71bf956..1090c71 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -2234,12 +2234,11 @@
// XXX Remove this once action bar supports these features.
removeFeature(FEATURE_ACTION_BAR);
// System.out.println("Title Icons!");
- } else if ((features & ((1 << FEATURE_PROGRESS) | (1 << FEATURE_INDETERMINATE_PROGRESS))) != 0) {
+ } else if ((features & ((1 << FEATURE_PROGRESS) | (1 << FEATURE_INDETERMINATE_PROGRESS))) != 0
+ && (features & (1 << FEATURE_ACTION_BAR)) == 0) {
// Special case for a window with only a progress bar (and title).
// XXX Need to have a no-title version of embedded windows.
layoutResource = com.android.internal.R.layout.screen_progress;
- // XXX Remove this once action bar supports these features.
- removeFeature(FEATURE_ACTION_BAR);
// System.out.println("Progress!");
} else if ((features & (1 << FEATURE_CUSTOM_TITLE)) != 0) {
// Special case for a window with a custom title.
@@ -2352,6 +2351,13 @@
if (mActionBar.getTitle() == null) {
mActionBar.setWindowTitle(mTitle);
}
+ final int localFeatures = getLocalFeatures();
+ if ((localFeatures & (1 << FEATURE_PROGRESS)) != 0) {
+ mActionBar.initProgress();
+ }
+ if ((localFeatures & (1 << FEATURE_INDETERMINATE_PROGRESS)) != 0) {
+ mActionBar.initIndeterminateProgress();
+ }
// Post the panel invalidate for later; avoid application onCreateOptionsMenu
// being called in the middle of onCreate or similar.
mDecor.post(new Runnable() {
@@ -2543,8 +2549,10 @@
if (mContentParent == null && shouldInstallDecor) {
installDecor();
}
- mCircularProgressBar = (ProgressBar)findViewById(com.android.internal.R.id.progress_circular);
- mCircularProgressBar.setVisibility(View.INVISIBLE);
+ mCircularProgressBar = (ProgressBar) findViewById(com.android.internal.R.id.progress_circular);
+ if (mCircularProgressBar != null) {
+ mCircularProgressBar.setVisibility(View.INVISIBLE);
+ }
return mCircularProgressBar;
}
@@ -2555,8 +2563,10 @@
if (mContentParent == null && shouldInstallDecor) {
installDecor();
}
- mHorizontalProgressBar = (ProgressBar)findViewById(com.android.internal.R.id.progress_horizontal);
- mHorizontalProgressBar.setVisibility(View.INVISIBLE);
+ mHorizontalProgressBar = (ProgressBar) findViewById(com.android.internal.R.id.progress_horizontal);
+ if (mHorizontalProgressBar != null) {
+ mHorizontalProgressBar.setVisibility(View.INVISIBLE);
+ }
return mHorizontalProgressBar;
}