diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/view/RenderNode.java | 7 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 22 |
2 files changed, 29 insertions, 0 deletions
diff --git a/core/java/android/view/RenderNode.java b/core/java/android/view/RenderNode.java index ce7e8f3b55b5..7c25fac3974e 100644 --- a/core/java/android/view/RenderNode.java +++ b/core/java/android/view/RenderNode.java @@ -687,6 +687,11 @@ public class RenderNode { return nIsPivotExplicitlySet(mNativeRenderNode); } + /** lint */ + public boolean resetPivot() { + return nResetPivot(mNativeRenderNode); + } + /** * Sets the camera distance for the display list. Refer to * {@link View#setCameraDistance(float)} for more information on how to @@ -903,6 +908,8 @@ public class RenderNode { @CriticalNative private static native boolean nSetPivotX(long renderNode, float pivotX); @CriticalNative + private static native boolean nResetPivot(long renderNode); + @CriticalNative private static native boolean nSetLayerType(long renderNode, int layerType); @CriticalNative private static native boolean nSetLayerPaint(long renderNode, long paint); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index afff19b0be31..18c3d76e03aa 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -14843,6 +14843,28 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** + * Returns whether or not a pivot has been set by a call to {@link #setPivotX(float)} or + * {@link #setPivotY(float)}. If no pivot has been set then the pivot will be the center + * of the view. + * + * @return True if a pivot has been set, false if the default pivot is being used + */ + public boolean isPivotSet() { + return mRenderNode.isPivotExplicitlySet(); + } + + /** + * Clears any pivot previously set by a call to {@link #setPivotX(float)} or + * {@link #setPivotY(float)}. After calling this {@link #isPivotSet()} will be false + * and the pivot used for rotation will return to default of being centered on the view. + */ + public void resetPivot() { + if (mRenderNode.resetPivot()) { + invalidateViewProperty(false, false); + } + } + + /** * The opacity of the view. This is a value from 0 to 1, where 0 means the view is * completely transparent and 1 means the view is completely opaque. * |
