Merge "Fix bug 5581874 - Animated drawables don't start as expected" into ics-mr1
This commit is contained in:
@@ -11402,8 +11402,12 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
|
||||
* {@link SystemClock#uptimeMillis} timebase.
|
||||
*/
|
||||
public void scheduleDrawable(Drawable who, Runnable what, long when) {
|
||||
if (verifyDrawable(who) && what != null && mAttachInfo != null) {
|
||||
mAttachInfo.mHandler.postAtTime(what, who, when);
|
||||
if (verifyDrawable(who) && what != null) {
|
||||
if (mAttachInfo != null) {
|
||||
mAttachInfo.mHandler.postAtTime(what, who, when);
|
||||
} else {
|
||||
ViewRootImpl.getRunQueue().postDelayed(what, when - SystemClock.uptimeMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11414,8 +11418,12 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
|
||||
* @param what the action to cancel
|
||||
*/
|
||||
public void unscheduleDrawable(Drawable who, Runnable what) {
|
||||
if (verifyDrawable(who) && what != null && mAttachInfo != null) {
|
||||
mAttachInfo.mHandler.removeCallbacks(what, who);
|
||||
if (verifyDrawable(who) && what != null) {
|
||||
if (mAttachInfo != null) {
|
||||
mAttachInfo.mHandler.removeCallbacks(what, who);
|
||||
} else {
|
||||
ViewRootImpl.getRunQueue().removeCallbacks(what);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1035,4 +1035,28 @@ public class ImageView extends View {
|
||||
mDrawable.setAlpha(mAlpha * mViewAlphaScale >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisibility(int visibility) {
|
||||
super.setVisibility(visibility);
|
||||
if (mDrawable != null) {
|
||||
mDrawable.setVisible(visibility == VISIBLE, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
if (mDrawable != null) {
|
||||
mDrawable.setVisible(getVisibility() == VISIBLE, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
if (mDrawable != null) {
|
||||
mDrawable.setVisible(false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user