Search in sources :

Example 46 with PointF

use of android.graphics.PointF in project platform_frameworks_base by android.

the class CameraMetadataTest method testReadWritePointF.

@SmallTest
public void testReadWritePointF() {
    // float x 2 [actually 'x samples' but pretend it's a single value for now]
    checkKeyMarshal("android.sensor.profileToneCurve", new PointF(1.0f, 2.0f), toByteArray(1.0f, 2.0f));
    // float x 2 x samples
    checkKeyMarshal("android.sensor.profileToneCurve", new PointF[] { new PointF(1.0f, 2.0f), new PointF(3.0f, 4.0f), new PointF(5.0f, 6.0f), new PointF(7.0f, 8.0f) }, toByteArray(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f));
}
Also used : PointF(android.graphics.PointF) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 47 with PointF

use of android.graphics.PointF in project platform_frameworks_base by android.

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 48 with PointF

use of android.graphics.PointF in project platform_frameworks_base by android.

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 : PowerManager(android.os.PowerManager) PointF(android.graphics.PointF)

Example 49 with PointF

use of android.graphics.PointF in project platform_frameworks_base by android.

the class Quad method rotated.

/**
     * Rotate the quad by the given angle.
     *
     * The Quad is rotated counter-clockwise around its centroid.
     *
     * @param angle the angle to rotate in radians
     * @return the rotated Quad
     */
public Quad rotated(float angle) {
    PointF center = center();
    float cosa = (float) Math.cos(angle);
    float sina = (float) Math.sin(angle);
    PointF topLeft = rotatePoint(topLeft(), center, cosa, sina);
    PointF topRight = rotatePoint(topRight(), center, cosa, sina);
    PointF bottomLeft = rotatePoint(bottomLeft(), center, cosa, sina);
    PointF bottomRight = rotatePoint(bottomRight(), center, cosa, sina);
    return new Quad(topLeft, topRight, bottomLeft, bottomRight);
}
Also used : PointF(android.graphics.PointF)

Example 50 with PointF

use of android.graphics.PointF in project MagicIndicator by hackware1993.

the class CircleNavigator method drawCircles.

private void drawCircles(Canvas canvas) {
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(mStrokeWidth);
    for (int i = 0, j = mCirclePoints.size(); i < j; i++) {
        PointF pointF = mCirclePoints.get(i);
        canvas.drawCircle(pointF.x, pointF.y, mRadius, mPaint);
    }
}
Also used : PointF(android.graphics.PointF) Paint(android.graphics.Paint)

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