当前位置: 首页>>代码示例>>Java>>正文


Java Rect.exactCenterX方法代码示例

本文整理汇总了Java中android.graphics.Rect.exactCenterX方法的典型用法代码示例。如果您正苦于以下问题:Java Rect.exactCenterX方法的具体用法?Java Rect.exactCenterX怎么用?Java Rect.exactCenterX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Rect的用法示例。


在下文中一共展示了Rect.exactCenterX方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawTriangle

import android.graphics.Rect; //导入方法依赖的package包/类
private void drawTriangle(Canvas c, float startAngle, float sweepAngle, Rect bounds) {
    if (this.mShowArrow) {
        if (this.mArrow == null) {
            this.mArrow = new Path();
            this.mArrow.setFillType(FillType.EVEN_ODD);
        } else {
            this.mArrow.reset();
        }
        float inset = ((float) (((int) this.mStrokeInset) / 2)) * this.mArrowScale;
        float x = (float) ((this.mRingCenterRadius * Math.cos(0.0d)) + ((double) bounds.exactCenterX()));
        float y = (float) ((this.mRingCenterRadius * Math.sin(0.0d)) + ((double) bounds.exactCenterY()));
        this.mArrow.moveTo(0.0f, 0.0f);
        this.mArrow.lineTo(((float) this.mArrowWidth) * this.mArrowScale, 0.0f);
        this.mArrow.lineTo((((float) this.mArrowWidth) * this.mArrowScale) / 2.0f, ((float) this.mArrowHeight) * this.mArrowScale);
        this.mArrow.offset(x - inset, y);
        this.mArrow.close();
        this.mArrowPaint.setColor(this.mCurrentColor);
        c.rotate((startAngle + sweepAngle) - 5.0f, bounds.exactCenterX(), bounds.exactCenterY());
        c.drawPath(this.mArrow, this.mArrowPaint);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:22,代码来源:MaterialProgressDrawable.java

示例2: revealPopupWindow

import android.graphics.Rect; //导入方法依赖的package包/类
@UiThread public static void revealPopupWindow(@NonNull PopupWindow popupWindow, @NonNull View from) {
    Rect rect = ViewHelper.getLayoutPosition(from);
    int x = (int) rect.exactCenterX();
    int y = (int) rect.exactCenterY();
    if (popupWindow.getContentView() != null) {
        View view = popupWindow.getContentView();
        if (view != null) {
            popupWindow.showAsDropDown(from);
            view.post(() -> {
                if (ViewCompat.isAttachedToWindow(view)) {
                    Animator animator = ViewAnimationUtils.createCircularReveal(view, x, y, 0,
                            (float) Math.hypot(rect.width(), rect.height()));
                    animator.setDuration(view.getResources().getInteger(android.R.integer.config_shortAnimTime));
                    animator.start();
                }
            });
        }
    }
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:20,代码来源:AnimHelper.java

示例3: positionSelectorLikeFocusCompat

import android.graphics.Rect; //导入方法依赖的package包/类
protected void positionSelectorLikeFocusCompat(int position, View sel) {
    boolean manageState;
    boolean z = true;
    Drawable selector = getSelector();
    if (selector == null || position == -1) {
        manageState = false;
    } else {
        manageState = true;
    }
    if (manageState) {
        selector.setVisible(false, false);
    }
    positionSelectorCompat(position, sel);
    if (manageState) {
        Rect bounds = this.mSelectorRect;
        float x = bounds.exactCenterX();
        float y = bounds.exactCenterY();
        if (getVisibility() != 0) {
            z = false;
        }
        selector.setVisible(z, false);
        DrawableCompat.setHotspot(selector, x, y);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:ListViewCompat.java

示例4: drawTriangle

import android.graphics.Rect; //导入方法依赖的package包/类
private void drawTriangle(Canvas c, float startAngle, float sweepAngle, Rect bounds) {
    if (mShowArrow) {
        if (mArrow == null) {
            mArrow = new android.graphics.Path();
            mArrow.setFillType(android.graphics.Path.FillType.EVEN_ODD);
        } else {
            mArrow.reset();
        }

        // Adjust the position of the triangle so that it is inset as
        // much as the arc, but also centered on the arc.
        float x = (float) (mRingCenterRadius * Math.cos(0) + bounds.exactCenterX());
        float y = (float) (mRingCenterRadius * Math.sin(0) + bounds.exactCenterY());

        // Update the path each time. This works around an issue in SKIA
        // where concatenating a rotation matrix to a scale matrix
        // ignored a starting negative rotation. This appears to have
        // been fixed as of API 21.
        mArrow.moveTo(0, 0);
        mArrow.lineTo((mArrowWidth) * mArrowScale, 0);
        mArrow.lineTo(((mArrowWidth) * mArrowScale / 2), (mArrowHeight
                * mArrowScale));
        mArrow.offset(x-((mArrowWidth) * mArrowScale / 2), y);
        mArrow.close();
        // draw a triangle
        mArrowPaint.setColor(mColors[mColorIndex]);
        //when sweepAngle < 0 adjust the position of the arrow
        c.rotate(startAngle + (sweepAngle<0?0:sweepAngle) - ARROW_OFFSET_ANGLE, bounds.exactCenterX(),
                bounds.exactCenterY());
        c.drawPath(mArrow, mArrowPaint);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:MaterialProgressDrawable.java

示例5: drawTriangle

import android.graphics.Rect; //导入方法依赖的package包/类
private void drawTriangle(Canvas c, float startAngle, float sweepAngle, Rect bounds) {
    if (mShowArrow) {
        if (mArrow == null) {
            mArrow = new android.graphics.Path();
            mArrow.setFillType(android.graphics.Path.FillType.EVEN_ODD);
        } else {
            mArrow.reset();
        }

        // Adjust the position of the triangle so that it is inset as
        // much as the arc, but also centered on the arc.
        float inset = (int) mStrokeInset / 2 * mArrowScale;
        float x = (float) (mRingCenterRadius * Math.cos(0) + bounds.exactCenterX());
        float y = (float) (mRingCenterRadius * Math.sin(0) + bounds.exactCenterY());

        // Update the path each time. This works around an issue in SKIA
        // where concatenating a rotation matrix to a scale matrix
        // ignored a starting negative rotation. This appears to have
        // been fixed as of API 21.
        mArrow.moveTo(0, 0);
        mArrow.lineTo(mArrowWidth * mArrowScale, 0);
        mArrow.lineTo((mArrowWidth * mArrowScale / 2), (mArrowHeight
                * mArrowScale));
        mArrow.offset(x - inset, y);
        mArrow.close();
        // draw a triangle
        mArrowPaint.setColor(mCurrentColor);
        c.rotate(startAngle + sweepAngle - ARROW_OFFSET_ANGLE, bounds.exactCenterX(),
                bounds.exactCenterY());
        c.drawPath(mArrow, mArrowPaint);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:MaterialProgressDrawable.java

示例6: resize

import android.graphics.Rect; //导入方法依赖的package包/类
public static Rect resize(Rect rect, float mul){
    float x = rect.exactCenterX();
    float y = rect.exactCenterY();
    float toBT = Math.abs(rect.exactCenterY()-rect.bottom)*mul;
    float toLR = Math.abs(rect.exactCenterX()-rect.left)*mul;

    Rect resized = new Rect(
            Math.round(x-toLR),
            Math.round(y-toBT),
            Math.round( x+toLR),
            Math.round(y+toBT)
    );

    return resized;
}
 
开发者ID:MarukoZ,项目名称:FaceRecognition,代码行数:16,代码来源:FaceUtil.java

示例7: drawTriangle

import android.graphics.Rect; //导入方法依赖的package包/类
private void drawTriangle(Canvas c, float startAngle, float sweepAngle, Rect bounds) {
    if (mShowArrow) {
        if (mArrow == null) {
            mArrow = new android.graphics.Path();
            mArrow.setFillType(android.graphics.Path.FillType.EVEN_ODD);
        } else {
            mArrow.reset();
        }

        // Adjust the position of the triangle so that it is inset as
        // much as the arc, but also centered on the arc.
        float inset = (int) mStrokeInset / 2 * mArrowScale;
        float x = (float) (mRingCenterRadius * Math.cos(0) + bounds.exactCenterX());
        float y = (float) (mRingCenterRadius * Math.sin(0) + bounds.exactCenterY());

        // Update the path each time. This works around an issue in SKIA
        // where concatenating a rotation matrix to a scale matrix
        // ignored a starting negative rotation. This appears to have
        // been fixed as of API 21.
        mArrow.moveTo(0, 0);
        mArrow.lineTo(mArrowWidth * mArrowScale, 0);
        mArrow.lineTo((mArrowWidth * mArrowScale / 2), (mArrowHeight
                * mArrowScale));
        mArrow.offset(x - inset, y);
        mArrow.close();
        // draw a triangle
        mArrowPaint.setColor(mColors[mColorIndex]);
        c.rotate(startAngle + sweepAngle - ARROW_OFFSET_ANGLE, bounds.exactCenterX(),
                bounds.exactCenterY());
        c.drawPath(mArrow, mArrowPaint);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:33,代码来源:MaterialProgressDrawable.java

示例8: drawTriangle

import android.graphics.Rect; //导入方法依赖的package包/类
private void drawTriangle(Canvas c, float startAngle, float sweepAngle, Rect bounds) {
    if (mShowArrow) {
        if (mArrow == null) {
            mArrow = new android.graphics.Path();
            mArrow.setFillType(android.graphics.Path.FillType.EVEN_ODD);
        } else {
            mArrow.reset();
        }

        // Adjust the position of the triangle so that it is inset as
        // much as the arc, but also centered on the arc.
        float inset = (int) mStrokeInset / 2 * mArrowScale;
        float x = (float) (mRingCenterRadius * Math.cos(0) + bounds.exactCenterX());
        float y = (float) (mRingCenterRadius * Math.sin(0) + bounds.exactCenterY());

        // Update the path each time. This works around an issue in SKIA
        // where concatenating a rotation matrix to a scale matrix
        // ignored a starting negative rotation. This appears to have
        // been fixed as of API 21.
        mArrow.moveTo(0, 0);
        mArrow.lineTo(mArrowWidth * mArrowScale, 0);
        mArrow.lineTo((mArrowWidth * mArrowScale / 2), (mArrowHeight
                * mArrowScale));
        mArrow.offset(x - inset, y);
        mArrow.close();
        // draw a triangle
        mArrowPaint.setColor(mCurrentColor);
        //将alpha设置到画笔中
        mArrowPaint.setAlpha(mAlpha);
        c.rotate(startAngle + sweepAngle - ARROW_OFFSET_ANGLE, bounds.exactCenterX(),
                bounds.exactCenterY());
        c.drawPath(mArrow, mArrowPaint);
    }
}
 
开发者ID:zyyoona7,项目名称:MyLoadingViews,代码行数:35,代码来源:MaterialProgressDrawable.java

示例9: getCenterClickedView

import android.graphics.Rect; //导入方法依赖的package包/类
private int[] getCenterClickedView(ViewGroup from) {
  Rect clickedViewRect = new Rect();
  clickedView.getDrawingRect(clickedViewRect);
  from.offsetDescendantRectToMyCoords(clickedView, clickedViewRect);
  return new int[] {(int) clickedViewRect.exactCenterX(), (int) clickedViewRect.exactCenterY()};
}
 
开发者ID:wealthfront,项目名称:magellan,代码行数:7,代码来源:CircularRevealTransition.java


注:本文中的android.graphics.Rect.exactCenterX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。