Merge "Add isPivotSet/resetPivot" into pi-dev
am: 6045d66aa2
Change-Id: I29ab902c1a1391d26f95ec1abfa14c887320eb5f
This commit is contained in:
@@ -47536,6 +47536,7 @@ package android.view {
|
||||
method public boolean isOpaque();
|
||||
method protected boolean isPaddingOffsetRequired();
|
||||
method public boolean isPaddingRelative();
|
||||
method public boolean isPivotSet();
|
||||
method public boolean isPressed();
|
||||
method public boolean isSaveEnabled();
|
||||
method public boolean isSaveFromParentEnabled();
|
||||
@@ -47654,6 +47655,7 @@ package android.view {
|
||||
method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
|
||||
method public final void requestUnbufferedDispatch(android.view.MotionEvent);
|
||||
method public final <T extends android.view.View> T requireViewById(int);
|
||||
method public void resetPivot();
|
||||
method public static int resolveSize(int, int);
|
||||
method public static int resolveSizeAndState(int, int, int);
|
||||
method public boolean restoreDefaultFocus();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -14842,6 +14842,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.
|
||||
|
||||
@@ -266,6 +266,10 @@ static jboolean android_view_RenderNode_setPivotY(jlong renderNodePtr, float py)
|
||||
return SET_AND_DIRTY(setPivotY, py, RenderNode::GENERIC);
|
||||
}
|
||||
|
||||
static jboolean android_view_RenderNode_resetPivot(jlong renderNodePtr) {
|
||||
return SET_AND_DIRTY(resetPivot, /* void */, RenderNode::GENERIC);
|
||||
}
|
||||
|
||||
static jboolean android_view_RenderNode_setCameraDistance(jlong renderNodePtr, float distance) {
|
||||
return SET_AND_DIRTY(setCameraDistance, distance, RenderNode::GENERIC);
|
||||
}
|
||||
@@ -613,6 +617,7 @@ static const JNINativeMethod gMethods[] = {
|
||||
{ "nSetScaleY", "(JF)Z", (void*) android_view_RenderNode_setScaleY },
|
||||
{ "nSetPivotX", "(JF)Z", (void*) android_view_RenderNode_setPivotX },
|
||||
{ "nSetPivotY", "(JF)Z", (void*) android_view_RenderNode_setPivotY },
|
||||
{ "nResetPivot", "(J)Z", (void*) android_view_RenderNode_resetPivot },
|
||||
{ "nSetCameraDistance", "(JF)Z", (void*) android_view_RenderNode_setCameraDistance },
|
||||
{ "nSetLeft", "(JI)Z", (void*) android_view_RenderNode_setLeft },
|
||||
{ "nSetTop", "(JI)Z", (void*) android_view_RenderNode_setTop },
|
||||
|
||||
@@ -328,6 +328,10 @@ public:
|
||||
|
||||
bool isPivotExplicitlySet() const { return mPrimitiveFields.mPivotExplicitlySet; }
|
||||
|
||||
bool resetPivot() {
|
||||
return RP_SET_AND_DIRTY(mPrimitiveFields.mPivotExplicitlySet, false);
|
||||
}
|
||||
|
||||
bool setCameraDistance(float distance) {
|
||||
if (distance != getCameraDistance()) {
|
||||
mPrimitiveFields.mMatrixOrPivotDirty = true;
|
||||
|
||||
Reference in New Issue
Block a user