From b5537c452271634b6ff3981b0624fa65384abd5b Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Tue, 30 Jun 2009 12:39:18 -0700 Subject: Replace indeterminate progress animated asset with new ones --- api/current.xml | 175 +++++++++++++-------- core/java/android/app/SearchDialog.java | 5 +- core/java/android/widget/ProgressBar.java | 11 +- core/res/res/drawable/progress_large.xml | 66 +++----- core/res/res/drawable/progress_large_white.xml | 25 +++ core/res/res/drawable/progress_medium.xml | 64 +++----- core/res/res/drawable/progress_medium_white.xml | 25 +++ core/res/res/drawable/progress_small.xml | 66 +++----- core/res/res/drawable/progress_small_titlebar.xml | 66 +++----- core/res/res/drawable/progress_small_white.xml | 25 +++ core/res/res/drawable/spinner_black_16.png | Bin 0 -> 291 bytes core/res/res/drawable/spinner_black_48.png | Bin 0 -> 1022 bytes core/res/res/drawable/spinner_black_76.png | Bin 0 -> 1086 bytes core/res/res/drawable/spinner_white_16.png | Bin 0 -> 2968 bytes core/res/res/drawable/spinner_white_48.png | Bin 0 -> 782 bytes core/res/res/drawable/spinner_white_76.png | Bin 0 -> 3745 bytes core/res/res/values/attrs.xml | 6 + core/res/res/values/public.xml | 6 + core/res/res/values/styles.xml | 18 ++- core/res/res/values/themes.xml | 10 ++ .../java/android/graphics/drawable/Animatable.java | 39 +++++ .../graphics/drawable/AnimatedRotateDrawable.java | 27 +++- .../graphics/drawable/AnimationDrawable.java | 2 +- 23 files changed, 384 insertions(+), 252 deletions(-) create mode 100644 core/res/res/drawable/progress_large_white.xml create mode 100644 core/res/res/drawable/progress_medium_white.xml create mode 100644 core/res/res/drawable/progress_small_white.xml create mode 100644 core/res/res/drawable/spinner_black_16.png create mode 100644 core/res/res/drawable/spinner_black_48.png create mode 100644 core/res/res/drawable/spinner_black_76.png create mode 100644 core/res/res/drawable/spinner_white_16.png create mode 100644 core/res/res/drawable/spinner_white_48.png create mode 100644 core/res/res/drawable/spinner_white_76.png create mode 100644 graphics/java/android/graphics/drawable/Animatable.java diff --git a/api/current.xml b/api/current.xml index 673d053e111f..787fcb41b8c8 100644 --- a/api/current.xml +++ b/api/current.xml @@ -3419,39 +3419,6 @@ visibility="public" > - - - - - - + + + + + + + + + + + + - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - + diff --git a/core/res/res/drawable/progress_large_white.xml b/core/res/res/drawable/progress_large_white.xml new file mode 100644 index 000000000000..c690ed4e0e9a --- /dev/null +++ b/core/res/res/drawable/progress_large_white.xml @@ -0,0 +1,25 @@ + + + diff --git a/core/res/res/drawable/progress_medium.xml b/core/res/res/drawable/progress_medium.xml index 92aebb51a512..eb1bd50d17d7 100644 --- a/core/res/res/drawable/progress_medium.xml +++ b/core/res/res/drawable/progress_medium.xml @@ -1,43 +1,25 @@ - - - - - - - - - - - - - + diff --git a/core/res/res/drawable/progress_medium_white.xml b/core/res/res/drawable/progress_medium_white.xml new file mode 100644 index 000000000000..b4f9b318a902 --- /dev/null +++ b/core/res/res/drawable/progress_medium_white.xml @@ -0,0 +1,25 @@ + + + diff --git a/core/res/res/drawable/progress_small.xml b/core/res/res/drawable/progress_small.xml index e5b0021d59cf..e0ee5e47d830 100644 --- a/core/res/res/drawable/progress_small.xml +++ b/core/res/res/drawable/progress_small.xml @@ -1,45 +1,25 @@ - - - - - - - - - - - - - - - + diff --git a/core/res/res/drawable/progress_small_titlebar.xml b/core/res/res/drawable/progress_small_titlebar.xml index cf8e41cb373d..8cfba864b5b2 100644 --- a/core/res/res/drawable/progress_small_titlebar.xml +++ b/core/res/res/drawable/progress_small_titlebar.xml @@ -1,45 +1,25 @@ - - - - - - - - - - - - - - - + diff --git a/core/res/res/drawable/progress_small_white.xml b/core/res/res/drawable/progress_small_white.xml new file mode 100644 index 000000000000..8cfba864b5b2 --- /dev/null +++ b/core/res/res/drawable/progress_small_white.xml @@ -0,0 +1,25 @@ + + + diff --git a/core/res/res/drawable/spinner_black_16.png b/core/res/res/drawable/spinner_black_16.png new file mode 100644 index 000000000000..5ee33cea6fa7 Binary files /dev/null and b/core/res/res/drawable/spinner_black_16.png differ diff --git a/core/res/res/drawable/spinner_black_48.png b/core/res/res/drawable/spinner_black_48.png new file mode 100644 index 000000000000..3a681926b537 Binary files /dev/null and b/core/res/res/drawable/spinner_black_48.png differ diff --git a/core/res/res/drawable/spinner_black_76.png b/core/res/res/drawable/spinner_black_76.png new file mode 100644 index 000000000000..ec57460277a6 Binary files /dev/null and b/core/res/res/drawable/spinner_black_76.png differ diff --git a/core/res/res/drawable/spinner_white_16.png b/core/res/res/drawable/spinner_white_16.png new file mode 100644 index 000000000000..dd2e1fd7da16 Binary files /dev/null and b/core/res/res/drawable/spinner_white_16.png differ diff --git a/core/res/res/drawable/spinner_white_48.png b/core/res/res/drawable/spinner_white_48.png new file mode 100644 index 000000000000..d25a33e24534 Binary files /dev/null and b/core/res/res/drawable/spinner_white_48.png differ diff --git a/core/res/res/drawable/spinner_white_76.png b/core/res/res/drawable/spinner_white_76.png new file mode 100644 index 000000000000..f53e8ffdb193 Binary files /dev/null and b/core/res/res/drawable/spinner_white_76.png differ diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index d0701070e356..3e93b0266e35 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -350,6 +350,12 @@ + + + + + + diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 14d8dbe20bfe..2121669c9174 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1120,11 +1120,17 @@ + + + + + + diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 648a7dd691cd..7d235ec8d4ef 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -243,7 +243,7 @@ + + + + + + diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index f37d514e6e1d..bd6e1df10f90 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -154,6 +154,9 @@ @android:style/Widget.ProgressBar.Small @android:style/Widget.ProgressBar.Small.Title @android:style/Widget.ProgressBar.Large + @android:style/Widget.ProgressBar.Inverse + @android:style/Widget.ProgressBar.Small.Inverse + @android:style/Widget.ProgressBar.Large.Inverse @android:style/Widget.SeekBar @android:style/Widget.RatingBar @android:style/Widget.RatingBar.Indicator @@ -233,6 +236,13 @@ @android:style/Widget.ListView.White @drawable/divider_horizontal_bright @android:style/Widget.TextView.ListSeparator.White + + @android:style/Widget.ProgressBar.Inverse + @android:style/Widget.ProgressBar.Small.Inverse + @android:style/Widget.ProgressBar.Large.Inverse + @android:style/Widget.ProgressBar + @android:style/Widget.ProgressBar.Small + @android:style/Widget.ProgressBar.Large diff --git a/graphics/java/android/graphics/drawable/Animatable.java b/graphics/java/android/graphics/drawable/Animatable.java new file mode 100644 index 000000000000..9dc62c36d618 --- /dev/null +++ b/graphics/java/android/graphics/drawable/Animatable.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2009 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. + */ + +package android.graphics.drawable; + +/** + * Interface that drawables suporting animations should implement. + */ +public interface Animatable { + /** + * Starts the drawable's animation. + */ + void start(); + + /** + * Stops the drawable's animation. + */ + void stop(); + + /** + * Indicates whether the animation is running. + * + * @return True if the animation is running, false otherwise. + */ + boolean isRunning(); +} diff --git a/graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java b/graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java index 08d295d1820e..ac96f20bc527 100644 --- a/graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java +++ b/graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java @@ -35,11 +35,14 @@ import com.android.internal.R; /** * @hide */ -public class AnimatedRotateDrawable extends Drawable implements Drawable.Callback, Runnable { +public class AnimatedRotateDrawable extends Drawable implements Drawable.Callback, Runnable, + Animatable { + private AnimatedRotateState mState; private boolean mMutated; private float mCurrentDegrees; private float mIncrement; + private boolean mRunning; public AnimatedRotateDrawable() { this(null); @@ -80,10 +83,24 @@ public class AnimatedRotateDrawable extends Drawable implements Drawable.Callbac drawable.draw(canvas); canvas.restoreToCount(saveCount); - - nextFrame(); } - + + public void start() { + if (!mRunning) { + mRunning = true; + nextFrame(); + } + } + + public void stop() { + mRunning = false; + unscheduleSelf(this); + } + + public boolean isRunning() { + return mRunning; + } + private void nextFrame() { unscheduleSelf(this); scheduleSelf(this, SystemClock.uptimeMillis() + mState.mFrameDuration); @@ -96,8 +113,8 @@ public class AnimatedRotateDrawable extends Drawable implements Drawable.Callbac if (mCurrentDegrees > (360.0f - mIncrement)) { mCurrentDegrees = 0.0f; } - nextFrame(); invalidateSelf(); + nextFrame(); } @Override diff --git a/graphics/java/android/graphics/drawable/AnimationDrawable.java b/graphics/java/android/graphics/drawable/AnimationDrawable.java index bab1703fbf24..68718c9763eb 100644 --- a/graphics/java/android/graphics/drawable/AnimationDrawable.java +++ b/graphics/java/android/graphics/drawable/AnimationDrawable.java @@ -71,7 +71,7 @@ import android.util.AttributeSet; * @attr ref android.R.styleable#AnimationDrawableItem_duration * @attr ref android.R.styleable#AnimationDrawableItem_drawable */ -public class AnimationDrawable extends DrawableContainer implements Runnable { +public class AnimationDrawable extends DrawableContainer implements Runnable, Animatable { private final AnimationState mAnimationState; private int mCurFrame = -1; private boolean mMutated; -- cgit v1.2.3-59-g8ed1b