Allow null focus points for ScaleTypeDrawable
Summary: This makes it possible to re-purpose a ScaleTypeDrawable where you go from FOCUS_CROP to a normal scale type where you ideally want to properly clean up the focus point.
@@ -119,16 +119,18 @@ public class ScaleTypeDrawable extends ForwardingDrawable {
*
* @param focusPoint focus point of the image
*/
- public void setFocusPoint(PointF focusPoint) {
+ public void setFocusPoint(@Nullable PointF focusPoint) {
if (Objects.equal(mFocusPoint, focusPoint)) {
return;
}
-
+ if (focusPoint == null) {
+ mFocusPoint = null;
+ } else {
if (mFocusPoint == null) {
mFocusPoint = new PointF();
}
-
mFocusPoint.set(focusPoint);
+ }
configureBounds();
invalidateSelf();
}
