am 9a166c7d: Merge "Mutate scroll bar drawables" into lmp-mr1-dev
* commit '9a166c7da3d77c4b9801dbe249f78149649d5b0e': Mutate scroll bar drawables
This commit is contained in:
@@ -12872,7 +12872,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
Interpolator.Result.FREEZE_END) {
|
||||
cache.state = ScrollabilityCache.OFF;
|
||||
} else {
|
||||
cache.scrollBar.setAlpha(Math.round(values[0]));
|
||||
cache.scrollBar.mutate().setAlpha(Math.round(values[0]));
|
||||
}
|
||||
|
||||
// This will make the scroll bars inval themselves after
|
||||
@@ -12882,7 +12882,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
} else {
|
||||
// We're just on -- but we may have been fading before so
|
||||
// reset alpha
|
||||
cache.scrollBar.setAlpha(255);
|
||||
cache.scrollBar.mutate().setAlpha(255);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public class ScrollBarDrawable extends Drawable {
|
||||
private final Rect mTempBounds = new Rect();
|
||||
private boolean mAlwaysDrawHorizontalTrack;
|
||||
private boolean mAlwaysDrawVerticalTrack;
|
||||
private boolean mMutated;
|
||||
|
||||
public ScrollBarDrawable() {
|
||||
}
|
||||
@@ -191,6 +192,9 @@ public class ScrollBarDrawable extends Drawable {
|
||||
|
||||
public void setVerticalThumbDrawable(Drawable thumb) {
|
||||
if (thumb != null) {
|
||||
if (mMutated) {
|
||||
thumb.mutate();
|
||||
}
|
||||
thumb.setState(STATE_ENABLED);
|
||||
mVerticalThumb = thumb;
|
||||
}
|
||||
@@ -198,6 +202,9 @@ public class ScrollBarDrawable extends Drawable {
|
||||
|
||||
public void setVerticalTrackDrawable(Drawable track) {
|
||||
if (track != null) {
|
||||
if (mMutated) {
|
||||
track.mutate();
|
||||
}
|
||||
track.setState(STATE_ENABLED);
|
||||
}
|
||||
mVerticalTrack = track;
|
||||
@@ -205,6 +212,9 @@ public class ScrollBarDrawable extends Drawable {
|
||||
|
||||
public void setHorizontalThumbDrawable(Drawable thumb) {
|
||||
if (thumb != null) {
|
||||
if (mMutated) {
|
||||
thumb.mutate();
|
||||
}
|
||||
thumb.setState(STATE_ENABLED);
|
||||
mHorizontalThumb = thumb;
|
||||
}
|
||||
@@ -212,6 +222,9 @@ public class ScrollBarDrawable extends Drawable {
|
||||
|
||||
public void setHorizontalTrackDrawable(Drawable track) {
|
||||
if (track != null) {
|
||||
if (mMutated) {
|
||||
track.mutate();
|
||||
}
|
||||
track.setState(STATE_ENABLED);
|
||||
}
|
||||
mHorizontalTrack = track;
|
||||
@@ -227,6 +240,26 @@ public class ScrollBarDrawable extends Drawable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScrollBarDrawable mutate() {
|
||||
if (!mMutated && super.mutate() == this) {
|
||||
if (mVerticalTrack != null) {
|
||||
mVerticalTrack.mutate();
|
||||
}
|
||||
if (mVerticalThumb != null) {
|
||||
mVerticalThumb.mutate();
|
||||
}
|
||||
if (mHorizontalTrack != null) {
|
||||
mHorizontalTrack.mutate();
|
||||
}
|
||||
if (mHorizontalThumb != null) {
|
||||
mHorizontalThumb.mutate();
|
||||
}
|
||||
mMutated = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(int alpha) {
|
||||
if (mVerticalTrack != null) {
|
||||
|
||||
Reference in New Issue
Block a user