Example usage for android.view ViewConfiguration get

List of usage examples for android.view ViewConfiguration get

Introduction

In this page you can find the example usage for android.view ViewConfiguration get.

Prototype

public static ViewConfiguration get(Context context) 

Source Link

Document

Returns a configuration for the specified context.

Usage

From source file:com.github.lakeshire.pageindicator.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;// www .  j a  v a2s.  com

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);
    final float defaultExtraSpacing = res.getDimension(R.dimen.default_circle_indicator_extra_spacing);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);
    mExtraSpacing = a.getDimension(R.styleable.CirclePageIndicator_extraSpacing, defaultExtraSpacing);
    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:android.hqs.view.pager.indicator.CirclePageIndicator.java

/**
 * ?/*from   ww  w  .  java  2s.co m*/
 * @param context
 * @param attrs
 * @param defStyle
 */
@SuppressWarnings("deprecation")
public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;

    //Load defaults from resources
    final Resources res = getResources();

    final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            setBackground(background);
        } else {
            setBackgroundDrawable(background);
        }
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.example.anumbrella.viewpager.LinePagerIndicator.java

public LinePagerIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    ////from   w w w . java  2  s  .  c o m
    if (isInEditMode()) {
        return;
    }

    //??
    final Resources res = getResources();

    //
    //?
    final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);
    //
    final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color);
    //
    final float defalutLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);
    //?
    final float defalutGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);
    //
    final float defalutStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width);
    //??
    final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);
    //xml
    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.LinePagerIndicator, defStyle, 0);

    mCentered = array.getBoolean(R.styleable.LinePagerIndicator_centered, defaultCentered);
    mLineWidth = array.getDimension(R.styleable.LinePagerIndicator_lineWidth, defalutLineWidth);
    mGapWidth = array.getDimension(R.styleable.LinePagerIndicator_gapWidth, defalutGapWidth);
    //?
    setStrokeWidth(array.getDimension(R.styleable.LinePagerIndicator_strokeWidth, defalutStrokeWidth));
    mPaintUnselected
            .setColor(array.getColor(R.styleable.LinePagerIndicator_unselectedColor, defaultUnselectedColor));
    mPaintSelected.setColor(array.getColor(R.styleable.LinePagerIndicator_selectedColor, defaultSelectedColor));

    Drawable background = array.getDrawable(R.styleable.LinePagerIndicator_android_background);

    //
    if (background != null) {
        setBackgroundDrawable(background);
    }
    array.recycle();
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    //????(?????)
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);

}

From source file:com.dev.nutclass.view.pager.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;//from  ww  w  .jav a 2 s  .  c  o  m

    // Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(R.color.circle_page_indicator_page_color);
    final int defaultFillColor = res.getColor(R.color.circle_page_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(R.color.circle_page_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.circle_indicator_snap);

    // Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }
    a.recycle();
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    interval = mRadius * 4;
}

From source file:com.github.colinjeremie.willyoufindit.utils.pagerindicator.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*from w w  w .  j  a v  a2 s . c o m*/

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = ContextCompat.getColor(getContext(),
            R.color.default_circle_indicator_page_color);
    final int defaultFillColor = ContextCompat.getColor(getContext(),
            R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = ContextCompat.getColor(getContext(),
            R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        if (Build.VERSION.SDK_INT >= 16) {
            setBackground(background);
        } else {
            setBackgroundDrawable(background);
        }
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.futureinst.viewpagerindicator.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*  ww  w  .  j a v  a2 s.  c om*/

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(com.futureinst.R.color.default_circle_indicator_page_color);
    final int defaultFillColor = res.getColor(com.futureinst.R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res
            .getInteger(com.futureinst.R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(com.futureinst.R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res
            .getDimension(com.futureinst.R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(com.futureinst.R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(com.futureinst.R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(com.futureinst.R.bool.default_circle_indicator_snap);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, com.futureinst.R.styleable.CirclePageIndicator,
            defStyle, 0);

    mCentered = a.getBoolean(com.futureinst.R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(com.futureinst.R.styleable.CirclePageIndicator_android_orientation,
            defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill
            .setColor(a.getColor(com.futureinst.R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(
            a.getColor(com.futureinst.R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke.setStrokeWidth(
            a.getDimension(com.futureinst.R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(com.futureinst.R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(com.futureinst.R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(com.futureinst.R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(com.futureinst.R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.bw.luzz.monkeyapplication.View.DateTimePicker.time.RadialPickerLayout.java

public RadialPickerLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    setOnTouchListener(this);
    ViewConfiguration vc = ViewConfiguration.get(context);
    TOUCH_SLOP = vc.getScaledTouchSlop();
    TAP_TIMEOUT = ViewConfiguration.getTapTimeout();
    mDoingMove = false;/*from w ww  .  j  av a  2s . c  o m*/

    mCircleView = new com.bw.luzz.monkeyapplication.View.DateTimePicker.time.CircleView(context);
    addView(mCircleView);

    mAmPmCirclesView = new AmPmCirclesView(context);
    addView(mAmPmCirclesView);

    mHourRadialSelectorView = new RadialSelectorView(context);
    addView(mHourRadialSelectorView);
    mMinuteRadialSelectorView = new RadialSelectorView(context);
    addView(mMinuteRadialSelectorView);
    mSecondRadialSelectorView = new RadialSelectorView(context);
    addView(mSecondRadialSelectorView);

    mHourRadialTextsView = new com.bw.luzz.monkeyapplication.View.DateTimePicker.time.RadialTextsView(context);
    addView(mHourRadialTextsView);
    mMinuteRadialTextsView = new com.bw.luzz.monkeyapplication.View.DateTimePicker.time.RadialTextsView(
            context);
    addView(mMinuteRadialTextsView);
    mSecondRadialTextsView = new com.bw.luzz.monkeyapplication.View.DateTimePicker.time.RadialTextsView(
            context);
    addView(mSecondRadialTextsView);

    // Prepare mapping to snap touchable degrees to selectable degrees.
    preparePrefer30sMap();

    mLastValueSelected = null;

    mInputEnabled = true;

    mGrayBox = new View(context);
    mGrayBox.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    mGrayBox.setBackgroundColor(ContextCompat.getColor(context, R.color.mdtp_transparent_black));
    mGrayBox.setVisibility(View.INVISIBLE);
    addView(mGrayBox);

    mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);

    mTimeInitialized = false;
}

From source file:com.example.testautoscrollviewpager.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/* w ww.  j  a v  a  2s.com*/

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        //          setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.acious.android.paginationseekbar.PaginationSeekBar.java

public PaginationSeekBar(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    setFocusable(true);//  w  w  w .  j a va 2 s  .c  o m
    setWillNotDraw(false);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    float density = context.getResources().getDisplayMetrics().density;
    mTrackHeight = (int) (1 * density);
    mScrubberHeight = (int) (4 * density);
    int thumbSize = (int) (density * ThumbDrawable.DEFAULT_SIZE_DP);

    //Extra pixels for a touch area of 48dp
    int touchBounds = (int) (density * 32);
    mAddedTouchBounds = (touchBounds - thumbSize) / 2;

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PaginationSeekBar,
            R.attr.paginationSeekBarStyle, defStyle);

    int max = 100;
    int min = 0;
    int value = 1;
    mMirrorForRtl = a.getBoolean(R.styleable.PaginationSeekBar_psb_mirrorForRtl, mMirrorForRtl);
    mAllowTrackClick = a.getBoolean(R.styleable.PaginationSeekBar_psb_allowTrackClickToDrag, mAllowTrackClick);

    int indexMax = R.styleable.PaginationSeekBar_psb_max;
    int indexMin = R.styleable.PaginationSeekBar_psb_min;
    int indexValue = R.styleable.PaginationSeekBar_psb_value;
    pageCountPerOneBoard = R.styleable.PaginationSeekBar_psb_pageCountPerOneBoard;
    final TypedValue out = new TypedValue();
    //Not sure why, but we wanted to be able to use dimensions here...
    if (a.getValue(indexMax, out)) {
        if (out.type == TypedValue.TYPE_DIMENSION) {
            max = a.getDimensionPixelSize(indexMax, max);
        } else {
            max = a.getInteger(indexMax, max);
        }
    }
    if (a.getValue(indexMin, out)) {
        if (out.type == TypedValue.TYPE_DIMENSION) {
            min = a.getDimensionPixelSize(indexMin, min);
        } else {
            min = a.getInteger(indexMin, min);
        }
    }
    if (a.getValue(indexValue, out)) {
        if (out.type == TypedValue.TYPE_DIMENSION) {
            value = a.getDimensionPixelSize(indexValue, value);
        } else {
            value = a.getInteger(indexValue, value);
        }
    }
    if (a.getValue(pageCountPerOneBoard, out)) {
        pageCountPerOneBoard = a.getInteger(pageCountPerOneBoard, pageCountPerOneBoard);
    }
    mMin = min;
    mMax = Math.max(min + 1, max);
    mValue = Math.max(min, Math.min(max, value));
    updateKeyboardRange();

    mPrevPageText = a.getString(R.styleable.PaginationSeekBar_psb_indicatorPrevPageText);
    mNextPageText = a.getString(R.styleable.PaginationSeekBar_psb_indicatorNextPageText);
    mIndicatorFormatter = a.getString(R.styleable.PaginationSeekBar_psb_indicatorFormatter);

    ColorStateList trackColor = a.getColorStateList(R.styleable.PaginationSeekBar_psb_trackColor);
    ColorStateList progressColor = a.getColorStateList(R.styleable.PaginationSeekBar_psb_progressColor);
    ColorStateList rippleColor = a.getColorStateList(R.styleable.PaginationSeekBar_psb_rippleColor);
    int thumbTextColor = a.getColor(R.styleable.PaginationSeekBar_psb_thumbTextColor, Color.WHITE);
    boolean editMode = isInEditMode();
    if (editMode && rippleColor == null) {
        rippleColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { Color.DKGRAY });
    }
    if (editMode && trackColor == null) {
        trackColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { Color.GRAY });
    }
    if (editMode && progressColor == null) {
        progressColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { 0xff009688 });
    }
    if (editMode && thumbTextColor == 0) {
        thumbTextColor = Color.WHITE;
    }
    mRipple = SeekBarCompat.getRipple(rippleColor);
    if (isLollipopOrGreater) {
        SeekBarCompat.setBackground(this, mRipple);
    } else {
        mRipple.setCallback(this);
    }

    TrackRectDrawable shapeDrawable = new TrackRectDrawable(trackColor);
    mTrack = shapeDrawable;
    mTrack.setCallback(this);

    shapeDrawable = new TrackRectDrawable(progressColor);
    mScrubber = shapeDrawable;
    mScrubber.setCallback(this);

    ThumbDrawable thumbDrawable = new ThumbDrawable(progressColor, thumbTextColor, thumbSize, mValue);
    mThumb = thumbDrawable;
    mThumb.setCallback(this);
    mThumb.setBounds(0, 0, mThumb.getIntrinsicWidth(), mThumb.getIntrinsicHeight());

    if (!editMode) {
        mIndicator = new PopupIndicator(context, attrs, defStyle, convertValueToMessage(mMax), mPrevPageText,
                mNextPageText);
        mIndicator.setListener(mFloaterListener);
    }
    a.recycle();

    setNumericTransformer(new DefaultNumericTransformer());

    initPagecountPerOneboard(pageCountPerOneBoard);

}

From source file:com.github.shareme.gwsmaterialuikit.library.advancerv.expandable.RecyclerViewExpandableItemManager.java

/**
 * <p>Attaches {@link RecyclerView} instance.</p>
 * <p>Before calling this method, the target {@link RecyclerView} must set
 * the wrapped adapter instance which is returned by the
 * {@link #createWrappedAdapter(RecyclerView.Adapter)} method.</p>
 *
 * @param rv The {@link RecyclerView} instance
 *///from   ww w . j  ava2  s.c  o m
public void attachRecyclerView(@NonNull RecyclerView rv) {
    if (isReleased()) {
        throw new IllegalStateException("Accessing released object");
    }

    if (mRecyclerView != null) {
        throw new IllegalStateException("RecyclerView instance has already been set");
    }

    mRecyclerView = rv;
    mRecyclerView.addOnItemTouchListener(mInternalUseOnItemTouchListener);
    mTouchSlop = ViewConfiguration.get(mRecyclerView.getContext()).getScaledTouchSlop();
}