Example usage for android.graphics RectF RectF

List of usage examples for android.graphics RectF RectF

Introduction

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

Prototype

public RectF() 

Source Link

Document

Create a new empty RectF.

Usage

From source file:jp.co.recruit_lifestyle.android.widget.ColoringLoadingView.java

public ColoringLoadingView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    initView();/* w w w .  ja va 2s .  com*/

    mLoadingHandler = new Handler();
    mCharacterHandler = new Handler();
    mRectF = new RectF();
    mRegion = new Region();
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}

From source file:com.amitupadhyay.aboutexample.util.CollapsingTextHelper.java

public CollapsingTextHelper(View view) {
    mView = view;/*from  ww w.j  a v a 2 s . c om*/
    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    mCollapsedBounds = new Rect();
    mExpandedBounds = new Rect();
    mCurrentBounds = new RectF();
}

From source file:org.mariotaku.twidere.view.ShapedImageView.java

public ShapedImageView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ShapedImageView, defStyle, 0);

    mMatrix = new Matrix();
    mSource = new RectF();
    mDestination = new RectF();
    mTempDestination = new RectF();

    mBitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBitmapPaint.setFilterBitmap(true);//from ww w  .jav  a2  s.c  om
    mBitmapPaint.setDither(true);
    mSolidColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

    mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBorderPaint.setStyle(Paint.Style.STROKE);

    mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

    if (a.hasValue(R.styleable.ShapedImageView_sivBorder)) {
        setBorderEnabled(a.getBoolean(R.styleable.ShapedImageView_sivBorder, false));
    } else if (a.hasValue(R.styleable.ShapedImageView_sivBorderColor)
            || a.hasValue(R.styleable.ShapedImageView_sivBorderWidth)) {
        setBorderEnabled(true);
    }
    setBorderColor(a.getColor(R.styleable.ShapedImageView_sivBorderColor, Color.TRANSPARENT));
    setBorderWidth(a.getDimensionPixelSize(R.styleable.ShapedImageView_sivBorderWidth, 0));
    @ShapeStyle
    final int shapeStyle = a.getInt(R.styleable.ShapedImageView_sivShape, SHAPE_RECTANGLE);
    setStyle(shapeStyle);
    setCornerRadius(a.getDimension(R.styleable.ShapedImageView_sivCornerRadius, 0));
    setCornerRadiusRatio(a.getFraction(R.styleable.ShapedImageView_sivCornerRadiusRatio, 1, 1, -1));

    if (useOutline()) {
        if (a.hasValue(R.styleable.ShapedImageView_sivElevation)) {
            ViewCompat.setElevation(this, a.getDimensionPixelSize(R.styleable.ShapedImageView_sivElevation, 0));
        }
    } else {
        mShadowRadius = a.getDimensionPixelSize(R.styleable.ShapedImageView_sivElevation, 0);
    }
    setBackgroundColor(a.getColor(R.styleable.ShapedImageView_sivBackgroundColor, 0));
    a.recycle();

    initOutlineProvider();
}

From source file:de.vanita5.twittnuker.view.ShapedImageView.java

public ShapedImageView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ShapedImageView, defStyle, 0);

    mMatrix = new Matrix();
    mSource = new RectF();
    mDestination = new RectF();
    mTempDestination = new RectF();

    mBitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBitmapPaint.setFilterBitmap(true);/*from ww w  . j a v a 2 s.c  o  m*/
    mBitmapPaint.setDither(true);
    mSolidColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

    mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBorderPaint.setStyle(Paint.Style.STROKE);

    mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

    if (a.hasValue(R.styleable.ShapedImageView_sivBorder)) {
        setBorderEnabled(a.getBoolean(R.styleable.ShapedImageView_sivBorder, false));
    } else if (a.hasValue(R.styleable.ShapedImageView_sivBorderColor)
            || a.hasValue(R.styleable.ShapedImageView_sivBorderWidth)) {
        setBorderEnabled(true);
    }
    setBorderColor(a.getColor(R.styleable.ShapedImageView_sivBorderColor, Color.TRANSPARENT));
    setBorderWidth(a.getDimensionPixelSize(R.styleable.ShapedImageView_sivBorderWidth, 0));
    @ShapeStyle
    final int shapeStyle = a.getInt(R.styleable.ShapedImageView_sivShape, SHAPE_RECTANGLE);
    setStyle(shapeStyle);
    setCornerRadius(a.getDimension(R.styleable.ShapedImageView_sivCornerRadius, 0));
    setCornerRadiusRatio(a.getFraction(R.styleable.ShapedImageView_sivCornerRadiusRatio, 1, 1, -1));

    if (USE_OUTLINE) {
        if (a.hasValue(R.styleable.ShapedImageView_sivElevation)) {
            ViewCompat.setElevation(this, a.getDimensionPixelSize(R.styleable.ShapedImageView_sivElevation, 0));
        }
    } else {
        mShadowRadius = a.getDimensionPixelSize(R.styleable.ShapedImageView_sivElevation, 0);
    }
    setBackgroundColor(a.getColor(R.styleable.ShapedImageView_sivBackgroundColor, 0));
    a.recycle();

    if (USE_OUTLINE) {
        initOutlineProvider();
    }
}

From source file:com.github.shareme.gwsmaterialuikit.library.material.drawable.LineMorphingDrawable.java

private LineMorphingDrawable(State[] states, int curState, int paddingLeft, int paddingTop, int paddingRight,
        int paddingBottom, int animDuration, Interpolator interpolator, int strokeSize, int strokeColor,
        Paint.Cap strokeCap, Paint.Join strokeJoin, boolean clockwise, boolean isRtl) {
    mStates = states;//  w w  w  .  j  a va 2s .  com
    mPaddingLeft = paddingLeft;
    mPaddingTop = paddingTop;
    mPaddingRight = paddingRight;
    mPaddingBottom = paddingBottom;

    mAnimDuration = animDuration;
    mInterpolator = interpolator;
    mStrokeSize = strokeSize;
    mStrokeColor = strokeColor;
    mStrokeCap = strokeCap;
    mStrokeJoin = strokeJoin;
    mClockwise = clockwise;
    mIsRtl = isRtl;

    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeCap(mStrokeCap);
    mPaint.setStrokeJoin(mStrokeJoin);
    mPaint.setColor(mStrokeColor);
    mPaint.setStrokeWidth(mStrokeSize);

    mDrawBound = new RectF();

    mPath = new Path();

    switchLineState(curState, false);
}

From source file:com.wordplat.ikvstockchart.InteractiveKLineView.java

public InteractiveKLineView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    viewRect = new RectF();
    viewPadding = ViewUtils.dpTopx(context, 10);

    render = new KLineRender(context);

    gestureDetector.setIsLongpressEnabled(true);

    int touchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    gestureCompat.setTouchSlop(touchSlop);

    final Interpolator interpolator = new Interpolator() {
        public float getInterpolation(float t) {
            t -= 1.0f;//from w w  w.  j ava  2s.  co m
            return t * t * t * t * t + 1.0f;
        }
    };

    scroller = ScrollerCompat.create(context, interpolator);

    render.setSizeColor(ViewUtils.getSizeColor(context, attrs, defStyleAttr));
}

From source file:cn.com.hgh.view.SlideSwitch.java

public void initDrawingVal() {
    width = getMeasuredWidth();/*from www  .j  a  v a 2  s . c  om*/
    int height = getMeasuredHeight();

    backCircleRect = new RectF();
    frontCircleRect = new RectF();
    frontRect = new Rect();

    backRect = new Rect(0, 0, width, height);
    min_left = RIM_SIZE;
    max_left = width / 2;
    if (isOpen) {
        frontRect_left = max_left;
        alpha = 255;
        alpha1 = 0;
    } else {
        frontRect_left = RIM_SIZE;
        alpha = 0;
        alpha1 = 255;
    }
    frontRect_left_begin = frontRect_left;
}

From source file:com.audionote.widget.SlideSwitch.java

public void initDrawingVal() {
    int width = getMeasuredWidth();
    int height = getMeasuredHeight();

    backCircleRect = new RectF();
    backBorderCircleRect = new RectF();
    frontCircleRect = new RectF();
    frontBorderCircleRect = new RectF();
    frontRect = new Rect();
    frontBorderRect = new Rect();
    backRect = new Rect(borderWidth, borderWidth, width - borderWidth, height - borderWidth);
    backBorderRect = new Rect(0, 0, width, height);
    min_left = 0;//w  w w.j  a  v a  2 s. c  o m
    if (shape == SHAPE_RECT)
        max_left = width / 2;
    else
        max_left = width - (height - 2 * borderWidth) - 2 * borderWidth;
    if (isOpen) {
        frontRect_left = max_left;
        alpha = 255;
    } else {
        frontRect_left = 0;
        alpha = 0;
    }
    frontRect_left_begin = frontRect_left;
}

From source file:org.buffer.android.buffertextinputlayout.util.CollapsingTextHelper.java

public CollapsingTextHelper(View view) {
    mView = view;// w  ww  .j a va  2  s.co  m
    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);
    mCollapsedBounds = new Rect();
    mExpandedBounds = new Rect();
    mCurrentBounds = new RectF();
}

From source file:android.support.design.widget.CollapsingTextHelper.java

public CollapsingTextHelper(View view) {
    mView = view;/*from  w  w w.  j ava2 s. c om*/

    mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG);

    mCollapsedBounds = new Rect();
    mExpandedBounds = new Rect();
    mCurrentBounds = new RectF();
}