Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c3aa361d authored by Chet Haase's avatar Chet Haase
Browse files

Add various properties to View to allow it to be moved, scaled, faded, and...

Add various properties to View to allow it to be moved, scaled, faded, and rotated by property manipulation instead of just Animation operations.

Change-Id: Iefab11f243c7511f7bba0e32bd399ed716b9131f
parent d1131401
Loading
Loading
Loading
Loading
+255 −0
Original line number Diff line number Diff line
@@ -184278,6 +184278,17 @@
 visibility="public"
>
</method>
<method name="getAlpha"
 return="float"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getAnimation"
 return="android.view.animation.Animation"
 abstract="false"
@@ -184711,6 +184722,17 @@
<parameter name="location" type="int[]">
</parameter>
</method>
<method name="getMatrix"
 return="android.graphics.Matrix"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getMeasuredHeight"
 return="int"
 abstract="false"
@@ -184843,6 +184865,28 @@
 visibility="public"
>
</method>
<method name="getPivotX"
 return="float"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getPivotY"
 return="float"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getResources"
 return="android.content.res.Resources"
 abstract="false"
@@ -184898,6 +184942,39 @@
 visibility="public"
>
</method>
<method name="getRotation"
 return="float"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getScaleX"
 return="float"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getScaleY"
 return="float"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getScrollBarStyle"
 return="int"
 abstract="false"
@@ -185144,6 +185221,28 @@
<parameter name="outRect" type="android.graphics.Rect">
</parameter>
</method>
<method name="getX"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getY"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="hasFocus"
 return="boolean"
 abstract="false"
@@ -186474,6 +186573,19 @@
<parameter name="event" type="android.view.accessibility.AccessibilityEvent">
</parameter>
</method>
<method name="setAlpha"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="alpha" type="float">
</parameter>
</method>
<method name="setAnimation"
 return="void"
 abstract="false"
@@ -186526,6 +186638,19 @@
<parameter name="resid" type="int">
</parameter>
</method>
<method name="setBottom"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="bottom" type="int">
</parameter>
</method>
<method name="setClickable"
 return="void"
 abstract="false"
@@ -186734,6 +186859,19 @@
<parameter name="params" type="android.view.ViewGroup.LayoutParams">
</parameter>
</method>
<method name="setLeft"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="left" type="int">
</parameter>
</method>
<method name="setLongClickable"
 return="void"
 abstract="false"
@@ -186937,6 +187075,32 @@
<parameter name="bottom" type="int">
</parameter>
</method>
<method name="setPivotX"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="pivotX" type="float">
</parameter>
</method>
<method name="setPivotY"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="pivotY" type="float">
</parameter>
</method>
<method name="setPressed"
 return="void"
 abstract="false"
@@ -186950,6 +187114,32 @@
<parameter name="pressed" type="boolean">
</parameter>
</method>
<method name="setRight"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="right" type="int">
</parameter>
</method>
<method name="setRotation"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="rotation" type="float">
</parameter>
</method>
<method name="setSaveEnabled"
 return="void"
 abstract="false"
@@ -186976,6 +187166,32 @@
<parameter name="enabled" type="boolean">
</parameter>
</method>
<method name="setScaleX"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="scaleX" type="float">
</parameter>
</method>
<method name="setScaleY"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="scaleY" type="float">
</parameter>
</method>
<method name="setScrollBarStyle"
 return="void"
 abstract="false"
@@ -187069,6 +187285,19 @@
<parameter name="tag" type="java.lang.Object">
</parameter>
</method>
<method name="setTop"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="top" type="int">
</parameter>
</method>
<method name="setTouchDelegate"
 return="void"
 abstract="false"
@@ -187147,6 +187376,32 @@
<parameter name="willNotDraw" type="boolean">
</parameter>
</method>
<method name="setX"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="x" type="int">
</parameter>
</method>
<method name="setY"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="y" type="int">
</parameter>
</method>
<method name="showContextMenu"
 return="boolean"
 abstract="false"
+607 −8

File changed.

Preview size limit exceeded, changes collapsed.

+112 −30
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view;

import android.graphics.Matrix;
import com.android.internal.R;

import android.content.Context;
@@ -867,22 +868,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                    final View child = children[i];
                    if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE
                            || child.getAnimation() != null) {
                        child.getHitRect(frame);
                        if (frame.contains(scrolledXInt, scrolledYInt)) {
                            // offset the event to the view's coordinate system
                            final float xc = scrolledXFloat - child.mLeft;
                            final float yc = scrolledYFloat - child.mTop;
                            ev.setLocation(xc, yc);
                        if (child.dispatchTouchEvent(ev, scrolledXFloat, scrolledYFloat)) {
                            child.mPrivateFlags &= ~CANCEL_NEXT_UP_EVENT;
                            if (child.dispatchTouchEvent(ev))  {
                                // Event handled, we have a target now.
                            mMotionTarget = child;
                            return true;
                        }
                            // The event didn't get handled, try the next view.
                            // Don't reset the event's location, it's not
                            // necessary here.
                        }
                    }
                }
            }
@@ -937,8 +927,21 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager

        // finally offset the event to the target's coordinate system and
        // dispatch the event.
        final float xc = scrolledXFloat - (float) target.mLeft;
        final float yc = scrolledYFloat - (float) target.mTop;
        float xc;
        float yc;
        Matrix m = getMatrix();
        if (mMatrixIsIdentity || mAttachInfo == null) {
            xc = scrolledXFloat - (float) target.mLeft;
            yc = scrolledYFloat - (float) target.mTop;
        } else {
            // non-identity matrix: transform the point into the view's coordinates
            final float[] localXY = mAttachInfo.mTmpTransformLocation;
            localXY[0] = scrolledXFloat;
            localXY[1] = scrolledYFloat;
            getInverseMatrix().mapPoints(localXY);
            xc = localXY[0] - (float) target.mLeft;
            yc = localXY[1] - (float) target.mTop;
        }
        ev.setLocation(xc, yc);

        if ((target.mPrivateFlags & CANCEL_NEXT_UP_EVENT) != 0) {
@@ -1609,16 +1612,18 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
            }
        }

        float alpha = 1.0f;
        float alpha = child.getAlpha();
        Matrix childMatrix = child.getMatrix();

        if (transformToApply != null) {
            if (concatMatrix) {
        if (transformToApply != null || alpha < 1.0f || !child.mMatrixIsIdentity) {
            int transX = 0;
            int transY = 0;
            if (hasNoCache) {
                transX = -sx;
                transY = -sy;
            }
            if (transformToApply != null) {
                if (concatMatrix) {
                    // Undo the scroll translation, apply the transformation matrix,
                    // then redo the scroll translate to get the correct result.
                    canvas.translate(-transX, -transY);
@@ -1626,8 +1631,17 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                    canvas.translate(transX, transY);
                    mGroupFlags |= FLAG_CLEAR_TRANSFORMATION;
                }

            alpha = transformToApply.getAlpha();
                float transformAlpha = transformToApply.getAlpha();
                if (transformAlpha < 1.0f) {
                    alpha *= transformToApply.getAlpha();
                    mGroupFlags |= FLAG_CLEAR_TRANSFORMATION;
                }
            }
            if (!child.mMatrixIsIdentity) {
                canvas.translate(-transX, -transY);
                canvas.concat(child.getMatrix());
                canvas.translate(transX, transY);
            }
            if (alpha < 1.0f) {
                mGroupFlags |= FLAG_CLEAR_TRANSFORMATION;
            }
@@ -2498,6 +2512,41 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
            final int[] location = attachInfo.mInvalidateChildLocation;
            location[CHILD_LEFT_INDEX] = child.mLeft;
            location[CHILD_TOP_INDEX] = child.mTop;
            Matrix childMatrix = child.getMatrix();
            if (!childMatrix.isIdentity()) {
                float[] boundingRectPoints = attachInfo.mTmpTransformBounds;
                boundingRectPoints[0] = dirty.left; // upper left
                boundingRectPoints[1] = dirty.top;
                boundingRectPoints[2] = dirty.right; // upper right
                boundingRectPoints[3] = dirty.top;
                boundingRectPoints[4] = dirty.right; // lower right
                boundingRectPoints[5] = dirty.bottom;
                boundingRectPoints[6] = dirty.left; // lower left
                boundingRectPoints[7] = dirty.bottom;
                childMatrix.mapPoints(boundingRectPoints);
                // find the mind/max points to get the bounding rect
                float left = Float.MAX_VALUE;
                float top = Float.MAX_VALUE;
                float right = -Float.MAX_VALUE;
                float bottom = -Float.MAX_VALUE;
                for (int i = 0; i < 8; i += 2) {
                    float x = boundingRectPoints[i];
                    float y = boundingRectPoints[i+1];
                    if (x < left) {
                        left = x;
                    }
                    if (x > right) {
                        right = x;
                    }
                    if (y < top) {
                        top = y;
                    }
                    if (y > bottom) {
                        bottom = y;
                    }
                }
                dirty.set((int)left, (int)top, (int)(right + .5f), (int)(bottom + .5f));
            }

            // If the child is drawing an animation, we want to copy this flag onto
            // ourselves and the parent to make sure the invalidate request goes
@@ -2532,6 +2581,39 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                }

                parent = parent.invalidateChildInParent(location, dirty);
                Matrix m = getMatrix();
                if (!m.isIdentity()) {
                    float[] boundingRectPoints = {
                            dirty.left - mLeft, dirty.top - mTop, // upper left 
                            dirty.right - mLeft, dirty.top - mTop, // upper right
                            dirty.right - mLeft, dirty.bottom - mTop, // lower right
                            dirty.left - mLeft, dirty.bottom - mTop // lower left
                    };
                    m.mapPoints(boundingRectPoints);
                    // find the mind/max points to get the bounding rect
                    float left = Float.MAX_VALUE;
                    float top = Float.MAX_VALUE;
                    float right = Float.MIN_VALUE;
                    float bottom = Float.MIN_VALUE;
                    for (int i = 0; i < 8; i += 2) {
                        float x = boundingRectPoints[i];
                        float y = boundingRectPoints[i+1];
                        if (x < left) {
                            left = x;
                        }
                        if (x > right) {
                            right = x;
                        }
                        if (y < top) {
                            top = y;
                        }
                        if (y > bottom) {
                            bottom = y;
                        }
                    }
                    dirty.set((int)left + mLeft, (int)top + mTop, (int)(right + .5f) + mLeft,
                            (int)(bottom + .5f) + mTop);
                }
            } while (parent != null);
        }
    }