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:com.leeon.blank.widget.RangeBarNew.java

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

    applyConfig(context, attrs);/*from w ww  .  j a  v  a  2 s  .c o m*/

    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(ViewConfiguration.get(context));

    mPaddingRect = new Rect();
    mLeftCursorRect = new Rect();
    mRightCursorRect = new Rect();
    mLeftIndicatorRect = new Rect();
    mRightIndicatorRect = new Rect();

    mPaddingRect.left = getPaddingLeft();
    mPaddingRect.top = getPaddingTop();
    mPaddingRect.right = getPaddingRight();
    mPaddingRect.bottom = getPaddingBottom();

    mRangeBarRect = new RectF();
    mRangeBarRectSelected = new RectF();

    if (mTextArray != null) {
        mTextWidthArray = new float[mTextArray.length];
    }

    mLeftScroller = new Scroller(context);
    mRightScroller = new Scroller(context);

    initPaint();
    initTextWidthArray();

    setWillNotDraw(false);
    setFocusable(true);
    setClickable(true);
}

From source file:com.karthikb351.vitinfo2.customwidget.TimeLineView.java

private void initialize() {

    density = getContext().getResources().getDisplayMetrics().density;

    PADDING_TOP *= density;//ww w . j  a  v a  2 s .  co m
    BORDER_THICKNESS += CIRCLE_RADIUS;
    BORDER_THICKNESS *= density;
    CIRCLE_RADIUS *= density;
    STROKE_WIDTH_RING *= density;
    STROKE_WIDTH_BORDER *= density;
    STROKE_WIDTH_LINE *= density;

    paintDot = new Paint();
    paintDot.setColor(ContextCompat.getColor(getContext(), R.color.text_secondary));
    paintDot.setFlags(Paint.ANTI_ALIAS_FLAG);

    paintRing = new Paint();
    paintRing.setColor(ContextCompat.getColor(getContext(), R.color.text_secondary));
    paintRing.setFlags(Paint.ANTI_ALIAS_FLAG);
    paintRing.setStrokeWidth(STROKE_WIDTH_RING);
    paintRing.setStyle(Paint.Style.FILL_AND_STROKE);

    paintBorder = new Paint();
    paintBorder.setColor(ContextCompat.getColor(getContext(), R.color.text_secondary));
    paintBorder.setAlpha(90);
    paintBorder.setFlags(Paint.ANTI_ALIAS_FLAG);
    paintBorder.setStrokeWidth(STROKE_WIDTH_BORDER);
    paintBorder.setStyle(Paint.Style.FILL_AND_STROKE);

    paintLine = new Paint();
    paintLine.setColor(ContextCompat.getColor(getContext(), R.color.text_secondary));
    paintLine.setAlpha(70);
    paintLine.setFlags(Paint.ANTI_ALIAS_FLAG);
    paintLine.setStrokeWidth(STROKE_WIDTH_LINE);
    paintLine.setStyle(Paint.Style.FILL_AND_STROKE);

    widgetState = STATE_SCHEDULED;
    widgetType = TYPE_INNER;

    rectF = new RectF();
    mPath = new Path();

}

From source file:com.filemanager.free.ui.views.Indicator.java

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

    final int density = (int) context.getResources().getDisplayMetrics().density;

    // Load attributes
    final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Indicator, defStyle, 0);

    dotDiameter = a.getDimensionPixelSize(R.styleable.Indicator_dotDiameter, DEFAULT_DOT_SIZE * density);
    dotRadius = dotDiameter / 2;//from   w  w w .jav a2s  .  c om
    halfDotRadius = dotRadius / 2;
    gap = a.getDimensionPixelSize(R.styleable.Indicator_dotGap, DEFAULT_GAP * density);
    animDuration = (long) a.getInteger(R.styleable.Indicator_animationDuration, DEFAULT_ANIM_DURATION);
    animHalfDuration = animDuration / 2;
    int unselectedColour = a.getColor(R.styleable.Indicator_pageIndicatorColor, DEFAULT_UNSELECTED_COLOUR);
    int selectedColour = a.getColor(R.styleable.Indicator_currentPageIndicatorColor, DEFAULT_SELECTED_COLOUR);

    a.recycle();

    unselectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    unselectedPaint.setColor(unselectedColour);
    selectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    selectedPaint.setColor(selectedColour);
    interpolator = AnimUtils.getFastOutSlowInInterpolator(context);

    // create paths & rect now  reuse & rewind later
    combinedUnselectedPath = new Path();
    unselectedDotPath = new Path();
    unselectedDotLeftPath = new Path();
    unselectedDotRightPath = new Path();
    rectF = new RectF();

    addOnAttachStateChangeListener(this);
}

From source file:com.astir_trotter.atcustom.ui.iconics.core.IconicsDrawable.java

private void prepare() {
    mIconPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    mIconPaint.setStyle(Paint.Style.FILL);
    mIconPaint.setTextAlign(Paint.Align.CENTER);
    mIconPaint.setUnderlineText(false);/*  w w  w. ja  va 2 s .  c o m*/
    mIconPaint.setAntiAlias(true);

    mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

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

    mPath = new Path();

    mPathBounds = new RectF();
    mPaddingBounds = new Rect();
}

From source file:com.commit451.inkpageindicator.InkPageIndicator.java

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

    final int density = (int) context.getResources().getDisplayMetrics().density;

    // Load attributes
    final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.InkPageIndicator, defStyle, 0);

    dotDiameter = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotDiameter, DEFAULT_DOT_SIZE * density);
    dotRadius = dotDiameter / 2;// w w  w.j a va  2  s . c  om
    halfDotRadius = dotRadius / 2;
    gap = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotGap, DEFAULT_GAP * density);
    animDuration = (long) a.getInteger(R.styleable.InkPageIndicator_animationDuration, DEFAULT_ANIM_DURATION);
    animHalfDuration = animDuration / 2;
    unselectedColour = a.getColor(R.styleable.InkPageIndicator_pageIndicatorColor, DEFAULT_UNSELECTED_COLOUR);
    selectedColour = a.getColor(R.styleable.InkPageIndicator_currentPageIndicatorColor,
            DEFAULT_SELECTED_COLOUR);

    a.recycle();

    unselectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    unselectedPaint.setColor(unselectedColour);
    selectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    selectedPaint.setColor(selectedColour);
    interpolator = new FastOutSlowInInterpolator();

    // create paths & rect now  reuse & rewind later
    combinedUnselectedPath = new Path();
    unselectedDotPath = new Path();
    unselectedDotLeftPath = new Path();
    unselectedDotRightPath = new Path();
    rectF = new RectF();

    addOnAttachStateChangeListener(this);
}

From source file:io.plaidapp.ui.widget.InkPageIndicator.java

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

    final int density = (int) context.getResources().getDisplayMetrics().density;

    // Load attributes
    final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.InkPageIndicator, defStyle, 0);

    dotDiameter = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotDiameter, DEFAULT_DOT_SIZE * density);
    dotRadius = dotDiameter / 2;//from  w w  w . jav  a 2 s  .c  o m
    halfDotRadius = dotRadius / 2;
    gap = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotGap, DEFAULT_GAP * density);
    animDuration = (long) a.getInteger(R.styleable.InkPageIndicator_animationDuration, DEFAULT_ANIM_DURATION);
    animHalfDuration = animDuration / 2;
    unselectedColour = a.getColor(R.styleable.InkPageIndicator_pageIndicatorColor, DEFAULT_UNSELECTED_COLOUR);
    selectedColour = a.getColor(R.styleable.InkPageIndicator_currentPageIndicatorColor,
            DEFAULT_SELECTED_COLOUR);

    a.recycle();

    unselectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    unselectedPaint.setColor(unselectedColour);
    selectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    selectedPaint.setColor(selectedColour);
    interpolator = android.view.animation.AnimationUtils.loadInterpolator(context,
            android.R.interpolator.fast_out_slow_in);

    // create paths & rect now  reuse & rewind later
    combinedUnselectedPath = new Path();
    unselectedDotPath = new Path();
    unselectedDotLeftPath = new Path();
    unselectedDotRightPath = new Path();
    rectF = new RectF();

    addOnAttachStateChangeListener(this);
}

From source file:com.ww.administrator.demotest.widget.InkPageIndicator.java

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

    final int density = (int) context.getResources().getDisplayMetrics().density;

    // Load attributes
    final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.InkPageIndicator, defStyle, 0);

    dotDiameter = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotDiameter, DEFAULT_DOT_SIZE * density);
    dotRadius = dotDiameter / 2;//from ww  w. jav a 2s.co  m
    halfDotRadius = dotRadius / 2;
    gap = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotGap, DEFAULT_GAP * density);
    animDuration = (long) a.getInteger(R.styleable.InkPageIndicator_animationDuration, DEFAULT_ANIM_DURATION);
    animHalfDuration = animDuration / 2;
    unselectedColour = a.getColor(R.styleable.InkPageIndicator_pageIndicatorColor, DEFAULT_UNSELECTED_COLOUR);
    selectedColour = a.getColor(R.styleable.InkPageIndicator_currentPageIndicatorColor,
            DEFAULT_SELECTED_COLOUR);

    a.recycle();

    unselectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    unselectedPaint.setColor(unselectedColour);
    selectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    selectedPaint.setColor(selectedColour);
    interpolator = AnimUtil.getFastOutSlowInInterpolator(context);

    // create paths & rect now  reuse & rewind later
    combinedUnselectedPath = new Path();
    unselectedDotPath = new Path();
    unselectedDotLeftPath = new Path();
    unselectedDotRightPath = new Path();
    rectF = new RectF();

    addOnAttachStateChangeListener(this);
}

From source file:com.amitupadhyay.aboutexample.ui.widget.InkPageIndicator.java

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

    final int density = (int) context.getResources().getDisplayMetrics().density;

    // Load attributes
    final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.InkPageIndicator, defStyle, 0);

    dotDiameter = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotDiameter, DEFAULT_DOT_SIZE * density);
    dotRadius = dotDiameter / 2;//www .  j  a v a 2 s.  c  o  m
    halfDotRadius = dotRadius / 2;
    gap = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotGap, DEFAULT_GAP * density);
    animDuration = (long) a.getInteger(R.styleable.InkPageIndicator_animationDuration, DEFAULT_ANIM_DURATION);
    animHalfDuration = animDuration / 2;
    unselectedColour = a.getColor(R.styleable.InkPageIndicator_pageIndicatorColor, DEFAULT_UNSELECTED_COLOUR);
    selectedColour = a.getColor(R.styleable.InkPageIndicator_currentPageIndicatorColor,
            DEFAULT_SELECTED_COLOUR);

    a.recycle();

    unselectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    unselectedPaint.setColor(unselectedColour);
    selectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    selectedPaint.setColor(selectedColour);
    interpolator = AnimUtils.getFastOutSlowInInterpolator(context);

    // create paths & rect now  reuse & rewind later
    combinedUnselectedPath = new Path();
    unselectedDotPath = new Path();
    unselectedDotLeftPath = new Path();
    unselectedDotRightPath = new Path();
    rectF = new RectF();

    addOnAttachStateChangeListener(this);
}

From source file:com.amaze.carbonfilemanager.ui.views.Indicator.java

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

    final int density = (int) context.getResources().getDisplayMetrics().density;

    // Load attributes
    final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Indicator, defStyle, 0);

    dotDiameter = a.getDimensionPixelSize(R.styleable.Indicator_dotDiameter, DEFAULT_DOT_SIZE * density);
    dotRadius = dotDiameter / 2;/*from   w  w w  . j a v a 2 s  . c  o  m*/
    halfDotRadius = dotRadius / 2;
    gap = a.getDimensionPixelSize(R.styleable.Indicator_dotGap, DEFAULT_GAP * density);
    animDuration = (long) a.getInteger(R.styleable.Indicator_animationDuration, DEFAULT_ANIM_DURATION);
    animHalfDuration = animDuration / 2;
    selectedColour = a.getColor(R.styleable.Indicator_currentPageIndicatorColor, DEFAULT_SELECTED_COLOUR);
    // half transparent accent color
    unselectedColour = Color.argb(80, Color.red(selectedColour), Color.green(selectedColour),
            Color.blue(selectedColour));

    a.recycle();

    unselectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    unselectedPaint.setColor(unselectedColour);
    selectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    selectedPaint.setColor(selectedColour);
    interpolator = AnimUtils.getFastOutSlowInInterpolator(context);

    // create paths & rect now  reuse & rewind later
    combinedUnselectedPath = new Path();
    unselectedDotPath = new Path();
    unselectedDotLeftPath = new Path();
    unselectedDotRightPath = new Path();
    rectF = new RectF();

    addOnAttachStateChangeListener(this);
}

From source file:com.github.shareme.gwsinkpageindicator.library.InkPageIndicator.java

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

    final int density = (int) context.getResources().getDisplayMetrics().density;

    // Load attributes
    final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.InkPageIndicator, defStyle, 0);

    dotDiameter = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotDiameter, DEFAULT_DOT_SIZE * density);
    dotRadius = dotDiameter / 2;/*from w  w w  .  j  a v  a  2s.c o m*/
    halfDotRadius = dotRadius / 2;
    gap = a.getDimensionPixelSize(R.styleable.InkPageIndicator_dotGap, DEFAULT_GAP * density);
    animDuration = (long) a.getInteger(R.styleable.InkPageIndicator_animationDuration, DEFAULT_ANIM_DURATION);
    animHalfDuration = animDuration / 2;
    unselectedColour = a.getColor(R.styleable.InkPageIndicator_pageIndicatorColor, DEFAULT_UNSELECTED_COLOUR);
    selectedColour = a.getColor(R.styleable.InkPageIndicator_currentPageIndicatorColor,
            DEFAULT_SELECTED_COLOUR);

    a.recycle();

    unselectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    unselectedPaint.setColor(unselectedColour);
    selectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    selectedPaint.setColor(selectedColour);
    interpolator = new FastOutSlowInInterpolator();

    // create paths & rect now  reuse & rewind later
    combinedUnselectedPath = new Path();
    unselectedDotPath = new Path();
    unselectedDotLeftPath = new Path();
    unselectedDotRightPath = new Path();
    rectF = new RectF();

    addOnAttachStateChangeListener(this);
}