Merge change 5817 into donut

* changes:
   Replace indeterminate progress animated asset with new ones
This commit is contained in:
Android (Google) Code Review
2009-06-30 12:40:23 -07:00
23 changed files with 384 additions and 252 deletions

View File

@@ -3419,39 +3419,6 @@
visibility="public"
>
</field>
<field name="donut_resource_pad23"
type="int"
transient="false"
volatile="false"
value="16843401"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="donut_resource_pad24"
type="int"
transient="false"
volatile="false"
value="16843400"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="donut_resource_pad25"
type="int"
transient="false"
volatile="false"
value="16843399"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="donut_resource_pad3"
type="int"
transient="false"
@@ -6730,6 +6697,17 @@
visibility="public"
>
</field>
<field name="progressBarStyleInverse"
type="int"
transient="false"
volatile="false"
value="16843399"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="progressBarStyleLarge"
type="int"
transient="false"
@@ -6741,6 +6719,17 @@
visibility="public"
>
</field>
<field name="progressBarStyleLargeInverse"
type="int"
transient="false"
volatile="false"
value="16843401"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="progressBarStyleSmall"
type="int"
transient="false"
@@ -6752,6 +6741,17 @@
visibility="public"
>
</field>
<field name="progressBarStyleSmallInverse"
type="int"
transient="false"
volatile="false"
value="16843400"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="progressBarStyleSmallTitle"
type="int"
transient="false"
@@ -15156,6 +15156,17 @@
visibility="public"
>
</field>
<field name="Widget_ProgressBar_Inverse"
type="int"
transient="false"
volatile="false"
value="16973915"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="Widget_ProgressBar_Large"
type="int"
transient="false"
@@ -15167,6 +15178,17 @@
visibility="public"
>
</field>
<field name="Widget_ProgressBar_Large_Inverse"
type="int"
transient="false"
volatile="false"
value="16973916"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="Widget_ProgressBar_Small"
type="int"
transient="false"
@@ -15178,6 +15200,17 @@
visibility="public"
>
</field>
<field name="Widget_ProgressBar_Small_Inverse"
type="int"
transient="false"
volatile="false"
value="16973917"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="Widget_RatingBar"
type="int"
transient="false"
@@ -15409,39 +15442,6 @@
visibility="public"
>
</field>
<field name="donut_resource_pad20"
type="int"
transient="false"
volatile="false"
value="16973917"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="donut_resource_pad21"
type="int"
transient="false"
volatile="false"
value="16973916"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="donut_resource_pad22"
type="int"
transient="false"
volatile="false"
value="16973915"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="donut_resource_pad3"
type="int"
transient="false"
@@ -56678,6 +56678,47 @@
</package>
<package name="android.graphics.drawable"
>
<interface name="Animatable"
abstract="true"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<method name="isRunning"
return="boolean"
abstract="true"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="start"
return="void"
abstract="true"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="stop"
return="void"
abstract="true"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
</interface>
<class name="AnimationDrawable"
extends="android.graphics.drawable.DrawableContainer"
abstract="false"
@@ -56686,6 +56727,8 @@
deprecated="not deprecated"
visibility="public"
>
<implements name="android.graphics.drawable.Animatable">
</implements>
<implements name="java.lang.Runnable">
</implements>
<constructor name="AnimationDrawable"

View File

@@ -34,6 +34,7 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Animatable;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemClock;
@@ -422,11 +423,11 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
if (working) {
mSearchAutoComplete.setCompoundDrawablesWithIntrinsicBounds(
null, null, mWorkingSpinner, null);
// mWorkingSpinner.start();
((Animatable) mWorkingSpinner).start();
} else {
mSearchAutoComplete.setCompoundDrawablesWithIntrinsicBounds(
null, null, null, null);
// mWorkingSpinner.stop();
((Animatable) mWorkingSpinner).stop();
}
}

View File

@@ -30,6 +30,7 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.StateListDrawable;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.shapes.RoundRectShape;
import android.graphics.drawable.shapes.Shape;
import android.util.AttributeSet;
@@ -683,7 +684,7 @@ public class ProgressBar extends View {
return;
}
if (mIndeterminateDrawable instanceof AnimationDrawable) {
if (mIndeterminateDrawable instanceof Animatable) {
mShouldStartAnimationDrawable = true;
mAnimation = null;
} else {
@@ -708,8 +709,8 @@ public class ProgressBar extends View {
void stopAnimation() {
mAnimation = null;
mTransformation = null;
if (mIndeterminateDrawable instanceof AnimationDrawable) {
((AnimationDrawable) mIndeterminateDrawable).stop();
if (mIndeterminateDrawable instanceof Animatable) {
((Animatable) mIndeterminateDrawable).stop();
mShouldStartAnimationDrawable = false;
}
}
@@ -818,8 +819,8 @@ public class ProgressBar extends View {
}
d.draw(canvas);
canvas.restore();
if (mShouldStartAnimationDrawable && d instanceof AnimationDrawable) {
((AnimationDrawable) d).start();
if (mShouldStartAnimationDrawable && d instanceof Animatable) {
((Animatable) d).start();
mShouldStartAnimationDrawable = false;
}
}

View File

@@ -1,45 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 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.
<!--
/*
**
** Copyright 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.
*/
-->
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%" android:pivotY="50%"
android:fromDegrees="0" android:toDegrees="360">
<shape
android:shape="ring"
android:innerRadiusRatio="3"
android:thicknessRatio="8"
android:useLevel="false">
<size
android:width="76dip"
android:height="76dip"
/>
<gradient
android:type="sweep"
android:useLevel="false"
android:startColor="#4c737373"
android:centerColor="#4c737373"
android:centerY="0.50"
android:endColor="#ffffd300"
/>
</shape>
</rotate>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/spinner_black_76"
android:pivotX="50%"
android:pivotY="50%"
android:framesCount="12"
android:frameDuration="100" />

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 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.
*/
-->
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/spinner_white_76"
android:pivotX="50%"
android:pivotY="50%"
android:framesCount="12"
android:frameDuration="100" />

View File

@@ -1,43 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 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.
<!--
/*
**
** Copyright 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.
*/
-->
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%" android:pivotY="50%"
android:fromDegrees="0" android:toDegrees="360">
<shape
android:shape="ring"
android:innerRadiusRatio="3"
android:thicknessRatio="8"
android:useLevel="false">
<size
android:width="48dip"
android:height="48dip"
/>
<gradient
android:type="sweep"
android:useLevel="false"
android:startColor="#4c737373"
android:centerColor="#4c737373"
android:centerY="0.50"
android:endColor="#ffffd300"
/>
</shape>
</rotate>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/spinner_black_48"
android:pivotX="50%"
android:pivotY="50%"
android:framesCount="12"
android:frameDuration="100" />

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 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.
*/
-->
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/spinner_white_48"
android:pivotX="50%"
android:pivotY="50%"
android:framesCount="12"
android:frameDuration="100" />

View File

@@ -1,45 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 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.
<!--
/*
**
** Copyright 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.
*/
-->
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%" android:pivotY="50%"
android:fromDegrees="0" android:toDegrees="360">
<!-- An extra pixel is added on both ratios for stroke -->
<shape
android:shape="ring"
android:innerRadiusRatio="3.2"
android:thicknessRatio="5.333"
android:useLevel="false">
<size
android:width="16dip"
android:height="16dip"
/>
<gradient
android:type="sweep"
android:useLevel="false"
android:startColor="#4c737373"
android:centerColor="#4c737373"
android:centerY="0.50"
android:endColor="#ffffd300"
/>
</shape>
</rotate>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/spinner_black_16"
android:pivotX="50%"
android:pivotY="50%"
android:framesCount="12"
android:frameDuration="100" />

View File

@@ -1,45 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 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.
<!--
/*
**
** Copyright 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.
*/
-->
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%" android:pivotY="50%"
android:fromDegrees="0" android:toDegrees="360">
<!-- An extra pixel is added on both ratios for stroke -->
<shape
android:shape="ring"
android:innerRadiusRatio="3.2"
android:thicknessRatio="5.333"
android:useLevel="false">
<size
android:width="16dip"
android:height="16dip"
/>
<gradient
android:type="sweep"
android:useLevel="false"
android:startColor="#ff666666"
android:centerColor="#ff666666"
android:centerY="0.50"
android:endColor="#ffffd300"
/>
</shape>
</rotate>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/spinner_white_16"
android:pivotX="50%"
android:pivotY="50%"
android:framesCount="12"
android:frameDuration="100" />

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 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.
*/
-->
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/spinner_white_16"
android:pivotX="50%"
android:pivotY="50%"
android:framesCount="12"
android:frameDuration="100" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -350,6 +350,12 @@
<attr name="progressBarStyleSmallTitle" format="reference" />
<!-- Large ProgressBar style. This is a large circular progress bar. -->
<attr name="progressBarStyleLarge" format="reference" />
<!-- Inverse ProgressBar style. This is a medium circular progress bar. -->
<attr name="progressBarStyleInverse" format="reference" />
<!-- Small inverse ProgressBar style. This is a small circular progress bar. -->
<attr name="progressBarStyleSmallInverse" format="reference" />
<!-- Large inverse ProgressBar style. This is a large circular progress bar. -->
<attr name="progressBarStyleLargeInverse" format="reference" />
<!-- Default SeekBar style. -->
<attr name="seekBarStyle" format="reference" />
<!-- Default RatingBar style. -->

View File

@@ -1120,11 +1120,17 @@
<public type="attr" name="smallScreens" />
<public type="attr" name="normalScreens" />
<public type="attr" name="largeScreens" />
<public type="attr" name="progressBarStyleInverse" />
<public type="attr" name="progressBarStyleSmallInverse" />
<public type="attr" name="progressBarStyleLargeInverse" />
<public-padding type="attr" name="donut_resource_pad" end="0x0101029f" />
<public-padding type="id" name="donut_resource_pad" end="0x01020040" />
<public type="style" name="Widget.ProgressBar.Inverse" id="0x0103005b" />
<public type="style" name="Widget.ProgressBar.Large.Inverse" id="0x0103005c" />
<public type="style" name="Widget.ProgressBar.Small.Inverse" id="0x0103005d" />
<public-padding type="style" name="donut_resource_pad" end="0x01030070" />
<public-padding type="string" name="donut_resource_pad" end="0x01040030" />

View File

@@ -243,7 +243,7 @@
<style name="Widget.ProgressBar">
<item name="android:indeterminateOnly">true</item>
<item name="android:indeterminateDrawable">@android:drawable/progress_medium</item>
<item name="android:indeterminateDrawable">@android:drawable/progress_medium_white</item>
<item name="android:indeterminateBehavior">repeat</item>
<item name="android:indeterminateDuration">3500</item>
<item name="android:minWidth">48dip</item>
@@ -253,7 +253,7 @@
</style>
<style name="Widget.ProgressBar.Large">
<item name="android:indeterminateDrawable">@android:drawable/progress_large</item>
<item name="android:indeterminateDrawable">@android:drawable/progress_large_white</item>
<item name="android:minWidth">76dip</item>
<item name="android:maxWidth">76dip</item>
<item name="android:minHeight">76dip</item>
@@ -261,13 +261,25 @@
</style>
<style name="Widget.ProgressBar.Small">
<item name="android:indeterminateDrawable">@android:drawable/progress_small</item>
<item name="android:indeterminateDrawable">@android:drawable/progress_small_white</item>
<item name="android:minWidth">16dip</item>
<item name="android:maxWidth">16dip</item>
<item name="android:minHeight">16dip</item>
<item name="android:maxHeight">16dip</item>
</style>
<style name="Widget.ProgressBar.Inverse">
<item name="android:indeterminateDrawable">@android:drawable/progress_medium</item>
</style>
<style name="Widget.ProgressBar.Large.Inverse">
<item name="android:indeterminateDrawable">@android:drawable/progress_large</item>
</style>
<style name="Widget.ProgressBar.Small.Inverse">
<item name="android:indeterminateDrawable">@android:drawable/progress_small</item>
</style>
<style name="Widget.ProgressBar.Small.Title">
<item name="android:indeterminateDrawable">@android:drawable/progress_small_titlebar</item>
</style>

View File

@@ -154,6 +154,9 @@
<item name="progressBarStyleSmall">@android:style/Widget.ProgressBar.Small</item>
<item name="progressBarStyleSmallTitle">@android:style/Widget.ProgressBar.Small.Title</item>
<item name="progressBarStyleLarge">@android:style/Widget.ProgressBar.Large</item>
<item name="progressBarStyleInverse">@android:style/Widget.ProgressBar.Inverse</item>
<item name="progressBarStyleSmallInverse">@android:style/Widget.ProgressBar.Small.Inverse</item>
<item name="progressBarStyleLargeInverse">@android:style/Widget.ProgressBar.Large.Inverse</item>
<item name="seekBarStyle">@android:style/Widget.SeekBar</item>
<item name="ratingBarStyle">@android:style/Widget.RatingBar</item>
<item name="ratingBarStyleIndicator">@android:style/Widget.RatingBar.Indicator</item>
@@ -233,6 +236,13 @@
<item name="listViewStyle">@android:style/Widget.ListView.White</item>
<item name="listDivider">@drawable/divider_horizontal_bright</item>
<item name="listSeparatorTextViewStyle">@android:style/Widget.TextView.ListSeparator.White</item>
<item name="progressBarStyle">@android:style/Widget.ProgressBar.Inverse</item>
<item name="progressBarStyleSmall">@android:style/Widget.ProgressBar.Small.Inverse</item>
<item name="progressBarStyleLarge">@android:style/Widget.ProgressBar.Large.Inverse</item>
<item name="progressBarStyleInverse">@android:style/Widget.ProgressBar</item>
<item name="progressBarStyleSmallInverse">@android:style/Widget.ProgressBar.Small</item>
<item name="progressBarStyleLargeInverse">@android:style/Widget.ProgressBar.Large</item>
</style>
<!-- Variant of the light theme with no title bar -->

View File

@@ -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();
}

View File

@@ -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

View File

@@ -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;