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:
@@ -92,7 +92,7 @@ public abstract class DrawableWrapper extends Drawable implements Drawable.Callb
|
||||
// Only call setters for data that's stored in the base Drawable.
|
||||
dr.setVisible(isVisible(), true);
|
||||
dr.setState(getState());
|
||||
dr.setLevel(getLevel());
|
||||
dr.setLevel(getLevelFloat());
|
||||
dr.setBounds(getBounds());
|
||||
dr.setLayoutDirection(getLayoutDirection());
|
||||
|
||||
@@ -286,7 +286,7 @@ public abstract class DrawableWrapper extends Drawable implements Drawable.Callb
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onLevelChange(int level) {
|
||||
protected boolean onLevelChange(float level) {
|
||||
return mDrawable != null && mDrawable.setLevel(level);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user