Example usage for android.graphics PointF PointF

List of usage examples for android.graphics PointF PointF

Introduction

In this page you can find the example usage for android.graphics PointF PointF.

Prototype

public PointF(float x, float y) 

Source Link

Usage

From source file:com.imczy.customactivitytransition.transition.ChangePosition.java

@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    if (null == startValues || null == endValues) {
        return null;
    }/*  w w  w. j  a v  a 2s.co  m*/

    if (startValues.view.getId() > 0) {
        Rect startRect = (Rect) startValues.values.get(PROPNAME_POSITION);
        Rect endRect = (Rect) endValues.values.get(PROPNAME_POSITION);

        final View view = endValues.view;

        Path changePosPath = getPathMotion().getPath(startRect.centerX(), startRect.centerY(),
                endRect.centerX(), endRect.centerY());

        int radius = startRect.centerY() - endRect.centerY();

        ObjectAnimator objectAnimator = ObjectAnimator.ofObject(view,
                new PropPosition(PointF.class, "position", new PointF(endRect.centerX(), endRect.centerY())),
                null, changePosPath);
        objectAnimator.setInterpolator(new FastOutSlowInInterpolator());

        return objectAnimator;
    }
    return null;

}

From source file:com.github.barteksc.pdfviewpager.view.ScrollBar.java

private void init() {

    indicator = new ScrollBarPageIndicator(getContext());
    setIndicatorPage(currentPage);/*from  w  w  w  .  j  a  va 2  s  .  c o  m*/
    indicator.setBackgroundColor(indicatorColor);
    indicator.setTextColor(indicatorTextColor);

    addOnLayoutChangeListener(new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop,
                int oldRight, int oldBottom) {
            indicator.addToScrollBar(ScrollBar.this);
            ScrollBar.this.removeOnLayoutChangeListener(this);
        }
    });

    handlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    handlePaint.setStyle(Paint.Style.FILL);
    handlePaint.setColor(handleColor);

    if (getBackground() == null) {
        setBackgroundColor(Color.LTGRAY);
    }

    handlePos = new PointF(0, 0);

    viewWidth = Util.getDP(getContext(), 30);
}

From source file:io.mattcarroll.hover.defaulthovermenu.window.WindowHoverMenu.java

public WindowHoverMenu(@NonNull Context context, @NonNull WindowManager windowManager,
        @Nullable Navigator navigator, @Nullable String savedVisualState) {
    mWindowViewController = new WindowViewController(windowManager);

    InWindowDragger inWindowDragger = new InWindowDragger(context, mWindowViewController,
            ViewConfiguration.get(context).getScaledTouchSlop());

    PointF anchorState = new PointF(2, 0.5f); // Default to right side, half way down. See CollapsedMenuAnchor.
    if (null != savedVisualState) {
        try {//from w w  w .j a  va  2s  .  com
            VisualStateMemento visualStateMemento = VisualStateMemento.fromJsonString(savedVisualState);
            anchorState.set(visualStateMemento.getAnchorSide(), visualStateMemento.getNormalizedPositionY());
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    mHoverMenuView = new HoverMenuView(context, navigator, inWindowDragger, anchorState);
    mHoverMenuView.setHoverMenuExitRequestListener(mMenuExitRequestListener);
}

From source file:xyz.zpayh.hdimage.ValueAnimator.java

public PointF getViewFocus() {
    float focusX = mViewFocusStart.x
            + mTranslateInterpolator.getInterpolation(mFraction) * (mViewFocusEnd.x - mViewFocusStart.x);
    float focusY = mViewFocusStart.y
            + mTranslateInterpolator.getInterpolation(mFraction) * (mViewFocusEnd.y - mViewFocusStart.y);
    return new PointF(focusX, focusY);
}

From source file:draw.chemy.JSONLoader.java

private List<Path> createPath(String aPath) {
    StringTokenizer tokenizer = new StringTokenizer(aPath);
    List<Path> result = new ArrayList<Path>();
    List<PointF> tempPointFs = new ArrayList<PointF>();
    SVGPathCommand currentOp = null;/* w  w w . j  a va2s. co  m*/
    PointF lastPointF = new PointF(0f, 0f);
    while (tokenizer.hasMoreTokens()) {
        String token = tokenizer.nextToken();
        if (token.contains(",")) {
            String[] split = token.split(",");
            PointF PointF = new PointF(Float.parseFloat(split[0]), Float.parseFloat(split[1]));
            tempPointFs.add(PointF);
        } else if (fSVGCommands.containsKey(token)) {
            if (currentOp != null) {
                currentOp.operation(tempPointFs, result, lastPointF);
            }
            currentOp = fSVGCommands.get(token);
            tempPointFs.clear();
        }
    }
    if (currentOp != null) {
        currentOp.operation(tempPointFs, result, lastPointF);
    }
    return result;
}

From source file:org.mozilla.gecko.gfx.ViewportMetrics.java

public ViewportMetrics() {
    DisplayMetrics metrics = new DisplayMetrics();
    GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);

    mPageSize = new FloatSize(metrics.widthPixels, metrics.heightPixels);
    mViewportRect = new RectF(0, 0, metrics.widthPixels, metrics.heightPixels);
    mViewportOffset = new PointF(0, 0);
    mZoomFactor = 1.0f;/*from w  w  w.j av  a 2  s.  c om*/
    mViewportBias = new PointF(0.0f, 0.0f);
}

From source file:org.mozilla.gecko.gfx.RectUtils.java

public static PointF getOrigin(RectF rect) {
    return new PointF(rect.left, rect.top);
}

From source file:com.richtodd.android.quiltdesign.block.PaperPiecedBlockPiece.java

public PointF getBlockFrom(int width, int height) {
    return new PointF(m_from.x * width, m_from.y * height);
}

From source file:io.mattcarroll.hover.defaulthovermenu.view.ViewHoverMenu.java

@Override
public void restoreVisualState(@NonNull String savedVisualState) {
    try {//from   w  ww.j  a va2s  . com
        VisualStateMemento memento = VisualStateMemento.fromJsonString(savedVisualState);
        mHoverMenuView.setAnchorState(new PointF(memento.getAnchorSide(), memento.getNormalizedPositionY()));
    } catch (JSONException e) {
        e.printStackTrace();
    }
}

From source file:com.richtodd.android.quiltdesign.block.PaperPiecedBlockPiece.java

public PointF getBlockTo(int width, int height) {
    return new PointF(m_to.x * width, m_to.y * height);
}