Use floating-point value for Drawable level
This allows us to run fine-grained level animations. Backwards compatibility: Another CL will add DrawableCompat.setLevel(float) to forward calls to the existing integer-based method. For callbacks, developers can override onLevelChanged(int) and use DrawableCompat.getLevelFloat() to obtain the floating-point level. Overriding onLevelChanged(float) will only work on current API. Bug: 23566299 Change-Id: I431fe6f3679c8f23f9cf3c2bb1f92a4059ee68e3
This commit is contained in:
@@ -322,7 +322,7 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onLevelChange(int level) {
|
||||
protected boolean onLevelChange(float level) {
|
||||
if (mLastDrawable != null) {
|
||||
return mLastDrawable.setLevel(level);
|
||||
}
|
||||
@@ -510,7 +510,7 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
|
||||
d.setVisible(isVisible(), true);
|
||||
d.setDither(mDrawableContainerState.mDither);
|
||||
d.setState(getState());
|
||||
d.setLevel(getLevel());
|
||||
d.setLevel(getLevelFloat());
|
||||
d.setBounds(getBounds());
|
||||
d.setLayoutDirection(getLayoutDirection());
|
||||
d.setAutoMirrored(mDrawableContainerState.mAutoMirrored);
|
||||
|
||||
Reference in New Issue
Block a user