Search in sources :

Example 71 with PointF

use of android.graphics.PointF in project android_frameworks_base by crdroidandroid.

the class CurvedTranslateAnimation method applyTransformation.

@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    PointF location = (PointF) mKeyframes.getValue(interpolatedTime);
    t.getMatrix().setTranslate(location.x, location.y);
}
Also used : PointF(android.graphics.PointF)

Example 72 with PointF

use of android.graphics.PointF in project android_frameworks_base by crdroidandroid.

the class PhoneStatusBar method wakeUpIfDozing.

public void wakeUpIfDozing(long time, MotionEvent event) {
    if (mDozing && mDozeScrimController.isPulsing()) {
        PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
        pm.wakeUp(time, "com.android.systemui:NODOZE");
        mWakeUpComingFromTouch = true;
        mWakeUpTouchLocation = new PointF(event.getX(), event.getY());
        mNotificationPanel.setTouchDisabled(false);
        mStatusBarKeyguardViewManager.notifyDeviceWakeUpRequested();
        mFalsingManager.onScreenOnFromTouch();
    }
}
Also used : IPowerManager(android.os.IPowerManager) PowerManager(android.os.PowerManager) PointF(android.graphics.PointF)

Example 73 with PointF

use of android.graphics.PointF in project android_frameworks_base by crdroidandroid.

the class GlobalScreenshot method createScreenshotDropOutAnimation.

private ValueAnimator createScreenshotDropOutAnimation(int w, int h, boolean statusBarVisible, boolean navBarVisible) {
    ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f);
    anim.setStartDelay(SCREENSHOT_DROP_OUT_DELAY);
    anim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mBackgroundView.setVisibility(View.GONE);
            mScreenshotView.setVisibility(View.GONE);
            mScreenshotView.setLayerType(View.LAYER_TYPE_NONE, null);
        }
    });
    if (!statusBarVisible || !navBarVisible) {
        // There is no status bar/nav bar, so just fade the screenshot away in place
        anim.setDuration(SCREENSHOT_FAST_DROP_OUT_DURATION);
        anim.addUpdateListener(new AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float t = (Float) animation.getAnimatedValue();
                float scaleT = (SCREENSHOT_DROP_IN_MIN_SCALE + mBgPaddingScale) - t * (SCREENSHOT_DROP_IN_MIN_SCALE - SCREENSHOT_FAST_DROP_OUT_MIN_SCALE);
                mBackgroundView.setAlpha((1f - t) * BACKGROUND_ALPHA);
                mScreenshotView.setAlpha(1f - t);
                mScreenshotView.setScaleX(scaleT);
                mScreenshotView.setScaleY(scaleT);
            }
        });
    } else {
        // In the case where there is a status bar, animate to the origin of the bar (top-left)
        final float scaleDurationPct = (float) SCREENSHOT_DROP_OUT_SCALE_DURATION / SCREENSHOT_DROP_OUT_DURATION;
        final Interpolator scaleInterpolator = new Interpolator() {

            @Override
            public float getInterpolation(float x) {
                if (x < scaleDurationPct) {
                    // Decelerate, and scale the input accordingly
                    return (float) (1f - Math.pow(1f - (x / scaleDurationPct), 2f));
                }
                return 1f;
            }
        };
        // Determine the bounds of how to scale
        float halfScreenWidth = (w - 2f * mBgPadding) / 2f;
        float halfScreenHeight = (h - 2f * mBgPadding) / 2f;
        final float offsetPct = SCREENSHOT_DROP_OUT_MIN_SCALE_OFFSET;
        final PointF finalPos = new PointF(-halfScreenWidth + (SCREENSHOT_DROP_OUT_MIN_SCALE + offsetPct) * halfScreenWidth, -halfScreenHeight + (SCREENSHOT_DROP_OUT_MIN_SCALE + offsetPct) * halfScreenHeight);
        // Animate the screenshot to the status bar
        anim.setDuration(SCREENSHOT_DROP_OUT_DURATION);
        anim.addUpdateListener(new AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float t = (Float) animation.getAnimatedValue();
                float scaleT = (SCREENSHOT_DROP_IN_MIN_SCALE + mBgPaddingScale) - scaleInterpolator.getInterpolation(t) * (SCREENSHOT_DROP_IN_MIN_SCALE - SCREENSHOT_DROP_OUT_MIN_SCALE);
                mBackgroundView.setAlpha((1f - t) * BACKGROUND_ALPHA);
                mScreenshotView.setAlpha(1f - scaleInterpolator.getInterpolation(t));
                mScreenshotView.setScaleX(scaleT);
                mScreenshotView.setScaleY(scaleT);
                mScreenshotView.setTranslationX(t * finalPos.x);
                mScreenshotView.setTranslationY(t * finalPos.y);
            }
        });
    }
    return anim;
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) PointF(android.graphics.PointF) Interpolator(android.view.animation.Interpolator) AnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(android.animation.ValueAnimator)

Example 74 with PointF

use of android.graphics.PointF in project android_frameworks_base by AOSPA.

the class ViewRootImpl method dispatchMoved.

public void dispatchMoved(int newX, int newY) {
    if (DEBUG_LAYOUT)
        Log.v(mTag, "Window moved " + this + ": newX=" + newX + " newY=" + newY);
    if (mTranslator != null) {
        PointF point = new PointF(newX, newY);
        mTranslator.translatePointInScreenToAppWindow(point);
        newX = (int) (point.x + 0.5);
        newY = (int) (point.y + 0.5);
    }
    Message msg = mHandler.obtainMessage(MSG_WINDOW_MOVED, newX, newY);
    mHandler.sendMessage(msg);
}
Also used : Message(android.os.Message) PointF(android.graphics.PointF)

Example 75 with PointF

use of android.graphics.PointF in project weex-example by KalicyZhou.

the class TopRightCorner method getSharpCornerEnd.

@NonNull
@Override
protected PointF getSharpCornerEnd() {
    PointF pointF = getSharpCornerVertex();
    pointF.x = getBorderBox().right;
    return pointF;
}
Also used : PointF(android.graphics.PointF) NonNull(android.support.annotation.NonNull)

Aggregations

PointF (android.graphics.PointF)686 Paint (android.graphics.Paint)132 Point (android.graphics.Point)53 RectF (android.graphics.RectF)53 Matrix (android.graphics.Matrix)43 Test (org.junit.Test)40 Path (android.graphics.Path)29 View (android.view.View)28 Drawable (android.graphics.drawable.Drawable)23 ArrayList (java.util.ArrayList)23 MotionEvent (android.view.MotionEvent)22 NonNull (android.support.annotation.NonNull)21 Rect (android.graphics.Rect)18 ValueAnimator (android.animation.ValueAnimator)14 ViewGroup (android.view.ViewGroup)11 List (java.util.List)11 Animator (android.animation.Animator)10 Bitmap (android.graphics.Bitmap)10 GestureDetector (android.view.GestureDetector)10 LinearSmoothScroller (android.support.v7.widget.LinearSmoothScroller)9