當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。