Search in sources :

Example 21 with PointF

use of android.graphics.PointF in project ViewPagerIndicator by LuckyJayce.

the class RecyclerIndicatorView method smoothScrollToPosition.

private void smoothScrollToPosition(int position, final int offeset) {
    LinearSmoothScroller linearSmoothScroller = new LinearSmoothScroller(getContext()) {

        @Override
        public PointF computeScrollVectorForPosition(int targetPosition) {
            PointF pointF = linearLayoutManager.computeScrollVectorForPosition(targetPosition);
            pointF.x += offeset;
            return pointF;
        }
    };
    linearSmoothScroller.setTargetPosition(position);
    linearLayoutManager.startSmoothScroll(linearSmoothScroller);
}
Also used : PointF(android.graphics.PointF) LinearSmoothScroller(android.support.v7.widget.LinearSmoothScroller)

Example 22 with PointF

use of android.graphics.PointF in project TouchImageView by MikeOrtiz.

the class SingleTouchImageViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_single_touchimageview);
    //
    // DecimalFormat rounds to 2 decimal places.
    //
    df = new DecimalFormat("#.##");
    scrollPositionTextView = (TextView) findViewById(R.id.scroll_position);
    zoomedRectTextView = (TextView) findViewById(R.id.zoomed_rect);
    currentZoomTextView = (TextView) findViewById(R.id.current_zoom);
    image = (TouchImageView) findViewById(R.id.img);
    //
    // Set the OnTouchImageViewListener which updates edit texts
    // with zoom and scroll diagnostics.
    //
    image.setOnTouchImageViewListener(new OnTouchImageViewListener() {

        @Override
        public void onMove() {
            PointF point = image.getScrollPosition();
            RectF rect = image.getZoomedRect();
            float currentZoom = image.getCurrentZoom();
            boolean isZoomed = image.isZoomed();
            scrollPositionTextView.setText("x: " + df.format(point.x) + " y: " + df.format(point.y));
            zoomedRectTextView.setText("left: " + df.format(rect.left) + " top: " + df.format(rect.top) + "\nright: " + df.format(rect.right) + " bottom: " + df.format(rect.bottom));
            currentZoomTextView.setText("getCurrentZoom(): " + currentZoom + " isZoomed(): " + isZoomed);
        }
    });
}
Also used : RectF(android.graphics.RectF) OnTouchImageViewListener(com.ortiz.touch.TouchImageView.OnTouchImageViewListener) DecimalFormat(java.text.DecimalFormat) PointF(android.graphics.PointF)

Example 23 with PointF

use of android.graphics.PointF in project TouchImageView by MikeOrtiz.

the class TouchImageView method setZoom.

/**
     * Set zoom parameters equal to another TouchImageView. Including scale, position,
     * and ScaleType.
     * @param TouchImageView
     */
public void setZoom(TouchImageView img) {
    PointF center = img.getScrollPosition();
    setZoom(img.getCurrentZoom(), center.x, center.y, img.getScaleType());
}
Also used : PointF(android.graphics.PointF)

Example 24 with PointF

use of android.graphics.PointF in project TouchImageView by MikeOrtiz.

the class TouchImageView method getZoomedRect.

/**
     * Return a Rect representing the zoomed image.
     * @return rect representing zoomed image
     */
public RectF getZoomedRect() {
    if (mScaleType == ScaleType.FIT_XY) {
        throw new UnsupportedOperationException("getZoomedRect() not supported with FIT_XY");
    }
    PointF topLeft = transformCoordTouchToBitmap(0, 0, true);
    PointF bottomRight = transformCoordTouchToBitmap(viewWidth, viewHeight, true);
    float w = getDrawable().getIntrinsicWidth();
    float h = getDrawable().getIntrinsicHeight();
    return new RectF(topLeft.x / w, topLeft.y / h, bottomRight.x / w, bottomRight.y / h);
}
Also used : RectF(android.graphics.RectF) PointF(android.graphics.PointF)

Example 25 with PointF

use of android.graphics.PointF in project BoomMenu by Nightonke.

the class TextOutsideCircleButton method init.

private void init(Builder builder) {
    LayoutInflater.from(context).inflate(R.layout.bmb_text_outside_circle_button, this, true);
    initAttrs(builder);
    initTextOutsideCircleButtonLayout();
    initShadow(buttonRadius + shadowRadius);
    initCircleButton();
    initText(layout);
    initImage();
    centerPoint = new PointF(trueRadius, trueRadius);
}
Also used : PointF(android.graphics.PointF)

Aggregations

PointF (android.graphics.PointF)342 Paint (android.graphics.Paint)67 Test (org.junit.Test)31 Matrix (android.graphics.Matrix)28 RectF (android.graphics.RectF)21 Path (android.graphics.Path)18 Point (android.graphics.Point)18 View (android.view.View)12 ValueAnimator (android.animation.ValueAnimator)11 Drawable (android.graphics.drawable.Drawable)11 MotionEvent (android.view.MotionEvent)10 LinearSmoothScroller (android.support.v7.widget.LinearSmoothScroller)9 Animator (android.animation.Animator)8 NonNull (android.support.annotation.NonNull)8 ArrayList (java.util.ArrayList)8 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)7 Rect (android.graphics.Rect)7 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)6 Message (android.os.Message)6 Interpolator (android.view.animation.Interpolator)6