Java Code Examples for android.content.Context#obtainStyledAttributes()

The following examples show how to use android.content.Context#obtainStyledAttributes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MaterialProgressBar.java    From FireFiles with Apache License 2.0 6 votes vote down vote up
public MaterialProgressBar(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (isInEditMode()) {
        setIndeterminateDrawable(new MaterialProgressDrawable(getContext(), this));
        return;
    }

    Resources res = context.getResources();
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MaterialProgressBar, defStyle, 0);

    final int color = a.getColor(R.styleable.MaterialProgressBar_color, res.getColor(R.color.accentColor));
    final float strokeWidth = a.getDimension(R.styleable.MaterialProgressBar_stroke_width, res.getDimension(R.dimen.default_stroke_width));
    final float sweepSpeed = a.getFloat(R.styleable.MaterialProgressBar_sweep_speed, Float.parseFloat(res.getString(R.string.default_sweep_speed)));
    final float rotationSpeed = a.getFloat(R.styleable.MaterialProgressBar_rotation_speed, Float.parseFloat(res.getString(R.string.default_rotation_speed)));
    final int minSweepAngle = a.getInteger(R.styleable.MaterialProgressBar_min_sweep_angle, res.getInteger(R.integer.default_min_sweep_angle));
    final int maxSweepAngle = a.getInteger(R.styleable.MaterialProgressBar_max_sweep_angle, res.getInteger(R.integer.default_max_sweep_angle));
    a.recycle();

    indeterminateDrawable = new MaterialProgressDrawable(getContext(), this);
    indeterminateDrawable.setBackgroundColor(CIRCLE_BG_LIGHT);
    indeterminateDrawable.setAlpha(255);
    indeterminateDrawable.updateSizes(MaterialProgressDrawable.LARGE);
    setColor(color);
}
 
Example 2
Source File: CameraPreview.java    From Viewer with Apache License 2.0 6 votes vote down vote up
private void initialize(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    if (getBackground() == null) {
        // Default to SurfaceView colour, so that there are less changes.
        setBackgroundColor(Color.BLACK);
    }

    TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.zxing_camera_preview);
    int framingRectWidth = (int) attributes.getDimension(R.styleable.zxing_camera_preview_zxing_framing_rect_width, -1);
    int framingRectHeight = (int) attributes.getDimension(R.styleable.zxing_camera_preview_zxing_framing_rect_height, -1);
    attributes.recycle();

    if (framingRectWidth > 0 && framingRectHeight > 0) {
        this.framingRectSize = new Size(framingRectWidth, framingRectHeight);
    }

    windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);

    stateHandler = new Handler(stateCallback);

    setupSurfaceView();

    rotationListener = new RotationListener();
}
 
Example 3
Source File: FlowIndicator.java    From Bailan with Apache License 2.0 6 votes vote down vote up
public FlowIndicator(Context context, AttributeSet attrs) {
	super(context, attrs);
	TypedArray a = context.obtainStyledAttributes(attrs,
			R.styleable.FlowIndicator);
	//小圆点数量
	count = a.getInteger(R.styleable.FlowIndicator_count, 4);
	//每个小圆点间隔距离
	space = a.getDimension(R.styleable.FlowIndicator_space, 4);
	//小圆点半径
	radius = a.getDimension(R.styleable.FlowIndicator_radius, 7);
	//正常 没有选中的图片
	bmp_normal = BitmapFactory.decodeResource(getResources(),
			R.drawable.hui);
	//选中的图片
	bmp_selected = BitmapFactory.decodeResource(getResources(),
			R.drawable.lan);
	a.recycle();
}
 
Example 4
Source File: SkinCompatTextHelperV17.java    From Android-skin-support with MIT License 6 votes vote down vote up
@Override
public void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
    final Context context = mView.getContext();

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SkinCompatTextHelper,
            defStyleAttr, 0);
    if (a.hasValue(R.styleable.SkinCompatTextHelper_android_drawableStart)) {
        mDrawableStartResId = a.getResourceId(R.styleable.SkinCompatTextHelper_android_drawableStart, INVALID_ID);
        mDrawableStartResId = SkinCompatHelper.checkResourceId(mDrawableStartResId);
    }
    if (a.hasValue(R.styleable.SkinCompatTextHelper_android_drawableEnd)) {
        mDrawableEndResId = a.getResourceId(R.styleable.SkinCompatTextHelper_android_drawableEnd, INVALID_ID);
        mDrawableEndResId = SkinCompatHelper.checkResourceId(mDrawableEndResId);
    }
    a.recycle();
    super.loadFromAttributes(attrs, defStyleAttr);
}
 
Example 5
Source File: FlexboxLayout.java    From Collection-Android with MIT License 6 votes vote down vote up
public LayoutParams(Context context, AttributeSet attrs) {
    super(context, attrs);

    TypedArray a = context
            .obtainStyledAttributes(attrs, R.styleable.FlexboxLayout_Layout);
    mOrder = a.getInt(R.styleable.FlexboxLayout_Layout_layout_order, ORDER_DEFAULT);
    mFlexGrow = a
            .getFloat(R.styleable.FlexboxLayout_Layout_layout_flexGrow, FLEX_GROW_DEFAULT);
    mFlexShrink = a.getFloat(R.styleable.FlexboxLayout_Layout_layout_flexShrink,
            FLEX_SHRINK_DEFAULT);
    mAlignSelf = a
            .getInt(R.styleable.FlexboxLayout_Layout_layout_alignSelf, AlignSelf.AUTO);
    mFlexBasisPercent = a
            .getFraction(R.styleable.FlexboxLayout_Layout_layout_flexBasisPercent, 1, 1,
                    FLEX_BASIS_PERCENT_DEFAULT);
    mMinWidth = a
            .getDimensionPixelSize(R.styleable.FlexboxLayout_Layout_layout_minWidth, NOT_SET);
    mMinHeight = a
            .getDimensionPixelSize(R.styleable.FlexboxLayout_Layout_layout_minHeight, NOT_SET);
    mMaxWidth = a.getDimensionPixelSize(R.styleable.FlexboxLayout_Layout_layout_maxWidth,
            MAX_SIZE);
    mMaxHeight = a.getDimensionPixelSize(R.styleable.FlexboxLayout_Layout_layout_maxHeight,
            MAX_SIZE);
    mWrapBefore = a.getBoolean(R.styleable.FlexboxLayout_Layout_layout_wrapBefore, false);
    a.recycle();
}
 
Example 6
Source File: CustomFontTextView.java    From FriendlyDemo with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({"PMD.UnusedFormalParameter", "PMD.ConstructorCallsOverridableMethod"})
public CustomFontTextView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs);
    setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);

    String fontName = null;
    TypedArray appearance = context.obtainStyledAttributes(attrs, R.styleable.CustomFontTextView);

    if (appearance != null) {
        int indexCount = appearance.getIndexCount();
        for (int i = 0; i < indexCount; i++) {
            int attr = appearance.getIndex(i);
            if (attr == R.styleable.CustomFontTextView_font) {
                fontName = appearance.getString(attr);
            }
        }
        appearance.recycle();
    }
    setTypeface(fontName);
}
 
Example 7
Source File: ARadioButton.java    From Stylish-Widget-for-Android with Apache License 2.0 5 votes vote down vote up
private void setCustomTypeface(Context context, AttributeSet attrs) {
    if (isInEditMode())
        return;
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TextAppearance);
    int style = a.getInt(R.styleable.TextAppearance_android_textStyle, Typeface.NORMAL);

    setTextStyle(style);
    a.recycle();

}
 
Example 8
Source File: RippleLayout.java    From fingerpoetry-android with Apache License 2.0 5 votes vote down vote up
public RippleLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    setWillNotDraw(false);
    gestureDetector = new GestureDetector(context, longClickListener);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MaterialRippleLayout);
    rippleColor = a.getColor(R.styleable.MaterialRippleLayout_mrl_rippleColor, DEFAULT_COLOR);
    rippleDiameter = a.getDimensionPixelSize(
            R.styleable.MaterialRippleLayout_mrl_rippleDimension,
            (int) dpToPx(getResources(), DEFAULT_DIAMETER_DP)
    );
    rippleOverlay = a.getBoolean(R.styleable.MaterialRippleLayout_mrl_rippleOverlay, DEFAULT_RIPPLE_OVERLAY);
    rippleHover = a.getBoolean(R.styleable.MaterialRippleLayout_mrl_rippleHover, DEFAULT_HOVER);
    rippleDuration = a.getInt(R.styleable.MaterialRippleLayout_mrl_rippleDuration, DEFAULT_DURATION);
    rippleAlpha = (int) (255 * a.getFloat(R.styleable.MaterialRippleLayout_mrl_rippleAlpha, DEFAULT_ALPHA));
    rippleDelayClick = a.getBoolean(R.styleable.MaterialRippleLayout_mrl_rippleDelayClick, DEFAULT_DELAY_CLICK);
    rippleFadeDuration = a.getInteger(R.styleable.MaterialRippleLayout_mrl_rippleFadeDuration, DEFAULT_FADE_DURATION);
    rippleBackground = new ColorDrawable(a.getColor(R.styleable.MaterialRippleLayout_mrl_rippleBackground, DEFAULT_BACKGROUND));
    ripplePersistent = a.getBoolean(R.styleable.MaterialRippleLayout_mrl_ripplePersistent, DEFAULT_PERSISTENT);
    rippleInAdapter = a.getBoolean(R.styleable.MaterialRippleLayout_mrl_rippleInAdapter, DEFAULT_SEARCH_ADAPTER);
    rippleRoundedCorners = a.getDimensionPixelSize(R.styleable.MaterialRippleLayout_mrl_rippleRoundedCorners, DEFAULT_ROUNDED_CORNERS);

    a.recycle();

    paint.setColor(rippleColor);
    paint.setAlpha(rippleAlpha);

    enableClipPathSupportIfNecessary();
}
 
Example 9
Source File: FlexibleRecyclerView.java    From v2ex with Apache License 2.0 5 votes vote down vote up
public FlexibleRecyclerView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (attrs != null) {
        final TypedArray xmlArgs = context.obtainStyledAttributes(attrs,
                R.styleable.FlexibleRecyclerView, defStyle, 0);
        mContentTopClearance = xmlArgs.getDimensionPixelSize(
                R.styleable.FlexibleRecyclerView_topClearance, 0);
        xmlArgs.recycle();
    }
}
 
Example 10
Source File: CirclePageIndicator.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
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 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);
}
 
Example 11
Source File: FragmentTabHost.java    From android-recipes-app with Apache License 2.0 5 votes vote down vote up
private void initFragmentTabHost(Context context, AttributeSet attrs) {
    TypedArray a = context.obtainStyledAttributes(attrs,
            new int[] { android.R.attr.inflatedId }, 0, 0);
    mContainerId = a.getResourceId(0, 0);
    a.recycle();

    super.setOnTabChangedListener(this);
}
 
Example 12
Source File: GridLayout.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void reInitSuper(Context context, AttributeSet attrs) {
    TypedArray a =
            context.obtainStyledAttributes(attrs, R.styleable.ViewGroup_MarginLayout);
    try {
        int margin = a.getDimensionPixelSize(MARGIN, DEFAULT_MARGIN);

        this.leftMargin = a.getDimensionPixelSize(LEFT_MARGIN, margin);
        this.topMargin = a.getDimensionPixelSize(TOP_MARGIN, margin);
        this.rightMargin = a.getDimensionPixelSize(RIGHT_MARGIN, margin);
        this.bottomMargin = a.getDimensionPixelSize(BOTTOM_MARGIN, margin);
    } finally {
        a.recycle();
    }
}
 
Example 13
Source File: RoundImageView.java    From orz with Apache License 2.0 5 votes vote down vote up
public RoundImageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mMatrix = new Matrix();
    mBitmapPaint = new Paint();
    mBitmapPaint.setAntiAlias(true);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundImageView);

    mBorderRadius = a.getDimensionPixelSize(R.styleable.RoundImageView_borderRadius,
            (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, BODER_RADIUS_DEFAULT, getResources().getDisplayMetrics()));// 默认为10dp
    mType = a.getInt(R.styleable.RoundImageView_type, TYPE_ROUND);// 默认为Round

    a.recycle();
}
 
Example 14
Source File: EaseChatExtendMenu.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
private void init(Context context, AttributeSet attrs){
    this.context = context;
    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.EaseChatExtendMenu);
    int numColumns = ta.getInt(R.styleable.EaseChatExtendMenu_numColumns, 4);
    ta.recycle();
    
    setNumColumns(numColumns);
    setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
    setGravity(Gravity.CENTER_VERTICAL);
    setVerticalSpacing(DensityUtil.dip2px(context, 8));
}
 
Example 15
Source File: SeekArc.java    From SeekArc with MIT License 4 votes vote down vote up
private void init(Context context, AttributeSet attrs, int defStyle) {

		Log.d(TAG, "Initialising SeekArc");
		final Resources res = getResources();
		float density = context.getResources().getDisplayMetrics().density;

		// Defaults, may need to link this into theme settings
		int arcColor = res.getColor(R.color.progress_gray);
		int progressColor = res.getColor(R.color.default_blue_light);
		int thumbHalfheight = 0;
		int thumbHalfWidth = 0;
		mThumb = res.getDrawable(R.drawable.seek_arc_control_selector);
		// Convert progress width to pixels for current density
		mProgressWidth = (int) (mProgressWidth * density);

		
		if (attrs != null) {
			// Attribute initialization
			final TypedArray a = context.obtainStyledAttributes(attrs,
					R.styleable.SeekArc, defStyle, 0);

			Drawable thumb = a.getDrawable(R.styleable.SeekArc_thumb);
			if (thumb != null) {
				mThumb = thumb;
			}

			
			
			thumbHalfheight = (int) mThumb.getIntrinsicHeight() / 2;
			thumbHalfWidth = (int) mThumb.getIntrinsicWidth() / 2;
			mThumb.setBounds(-thumbHalfWidth, -thumbHalfheight, thumbHalfWidth,
					thumbHalfheight);

			mMax = a.getInteger(R.styleable.SeekArc_max, mMax);
			mProgress = a.getInteger(R.styleable.SeekArc_progress, mProgress);
			mProgressWidth = (int) a.getDimension(
					R.styleable.SeekArc_progressWidth, mProgressWidth);
			mArcWidth = (int) a.getDimension(R.styleable.SeekArc_arcWidth,
					mArcWidth);
			mStartAngle = a.getInt(R.styleable.SeekArc_startAngle, mStartAngle);
			mSweepAngle = a.getInt(R.styleable.SeekArc_sweepAngle, mSweepAngle);
			mRotation = a.getInt(R.styleable.SeekArc_rotation, mRotation);
			mRoundedEdges = a.getBoolean(R.styleable.SeekArc_roundEdges,
					mRoundedEdges);
			mTouchInside = a.getBoolean(R.styleable.SeekArc_touchInside,
					mTouchInside);
			mClockwise = a.getBoolean(R.styleable.SeekArc_clockwise,
					mClockwise);
			mEnabled = a.getBoolean(R.styleable.SeekArc_enabled, mEnabled);

			arcColor = a.getColor(R.styleable.SeekArc_arcColor, arcColor);
			progressColor = a.getColor(R.styleable.SeekArc_progressColor,
					progressColor);

			a.recycle();
		}

		mProgress = (mProgress > mMax) ? mMax : mProgress;
		mProgress = (mProgress < 0) ? 0 : mProgress;

		mSweepAngle = (mSweepAngle > 360) ? 360 : mSweepAngle;
		mSweepAngle = (mSweepAngle < 0) ? 0 : mSweepAngle;

		mProgressSweep = (float) mProgress / mMax * mSweepAngle;

		mStartAngle = (mStartAngle > 360) ? 0 : mStartAngle;
		mStartAngle = (mStartAngle < 0) ? 0 : mStartAngle;

		mArcPaint = new Paint();
		mArcPaint.setColor(arcColor);
		mArcPaint.setAntiAlias(true);
		mArcPaint.setStyle(Paint.Style.STROKE);
		mArcPaint.setStrokeWidth(mArcWidth);
		//mArcPaint.setAlpha(45);

		mProgressPaint = new Paint();
		mProgressPaint.setColor(progressColor);
		mProgressPaint.setAntiAlias(true);
		mProgressPaint.setStyle(Paint.Style.STROKE);
		mProgressPaint.setStrokeWidth(mProgressWidth);

		if (mRoundedEdges) {
			mArcPaint.setStrokeCap(Paint.Cap.ROUND);
			mProgressPaint.setStrokeCap(Paint.Cap.ROUND);
		}
	}
 
Example 16
Source File: TextAppearanceSpan.java    From PowerFileExplorer with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Uses the specified TextAppearance resource to determine the
 * text appearance, and the specified text color resource
 * to determine the color.  The <code>appearance</code> should be,
 * for example, <code>android.R.style.TextAppearance_Small</code>,
 * and the <code>colorList</code> should be, for example,
 * <code>android.R.styleable.Theme_textColorDim</code>.
 */
public TextAppearanceSpan(Context context, int appearance,
                          int colorList) {
    ColorStateList textColor;

    TypedArray a =
        context.obtainStyledAttributes(appearance,
                                       com.android.internal.R.styleable.TextAppearance);

    textColor = a.getColorStateList(com.android.internal.R.styleable.
                                    TextAppearance_textColor);
    mTextColorLink = a.getColorStateList(com.android.internal.R.styleable.
                                    TextAppearance_textColorLink);
    mTextSize = a.getDimensionPixelSize(com.android.internal.R.styleable.
                                    TextAppearance_textSize, -1);

    mStyle = a.getInt(com.android.internal.R.styleable.TextAppearance_textStyle, 0);
    int tf = a.getInt(com.android.internal.R.styleable.TextAppearance_typeface, 0);

    switch (tf) {
        case 1:
            mTypeface = "sans";
            break;

        case 2:
            mTypeface = "serif";
            break;

        case 3:
            mTypeface = "monospace";
            break;

        default:
            mTypeface = null;
            break;
    }

    a.recycle();

    if (colorList >= 0) {
        a = context.obtainStyledAttributes(com.android.internal.R.style.Theme,
                                        com.android.internal.R.styleable.Theme);

        textColor = a.getColorStateList(colorList);
        a.recycle();
    }

    mTextColor = textColor;
}
 
Example 17
Source File: DividerItemDecoration.java    From double-direction-adapter-endless with MIT License 4 votes vote down vote up
public DividerItemDecoration(Context context, int orientation) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    a.recycle();
    setOrientation(orientation);
}
 
Example 18
Source File: CircleFlowIndicator.java    From BigApp_WordPress_Android with Apache License 2.0 4 votes vote down vote up
/**
 * The contructor used with an inflater
 * 
 * @param context
 * @param attrs
 */
public CircleFlowIndicator(Context context, AttributeSet attrs) {
	super(context, attrs);
	// Retrieve styles attributs
	TypedArray a = context.obtainStyledAttributes(attrs,
			R.styleable.CircleFlowIndicator);

	// Gets the active circle type, defaulting to "fill"
	int activeType = a.getInt(R.styleable.CircleFlowIndicator_activeType,
			STYLE_FILL);

	int activeDefaultColor = 0xFF7DC62D;

	// Get a custom active color if there is one
	int activeColor = a
			.getColor(R.styleable.CircleFlowIndicator_activeColor,
					activeDefaultColor);

	// Gets the inactive circle type, defaulting to "stroke"
	int inactiveType = a.getInt(
			R.styleable.CircleFlowIndicator_inactiveType, STYLE_STROKE);

	int inactiveDefaultColor = 0xFF9D9D9D;
	// Get a custom inactive color if there is one
	int inactiveColor = a.getColor(
			R.styleable.CircleFlowIndicator_inactiveColor,
			inactiveDefaultColor);

	// Retrieve the radius
	mRadius = a.getDimension(R.styleable.CircleFlowIndicator_radius, 4.0f);
	mRadiusActive = mRadius;
	mRadiusInactive = mRadius;

	// Retrieve the spacing
	spacing = a.getDimension(R.styleable.CircleFlowIndicator_spacing, 4.0f);
	// We want the spacing to be center-to-center
	spacing += 2 * mRadiusActive;

	// Retrieve the fade out time
	fadeOutTime = a.getInt(R.styleable.CircleFlowIndicator_fadeOut, 0);

	mCentered = a.getBoolean(R.styleable.CircleFlowIndicator_centered,
			false);

	mSnap = a.getBoolean(R.styleable.CircleFlowIndicator_snap, true);

	initColors(activeColor, inactiveColor, activeType, inactiveType);
}
 
Example 19
Source File: DividerItemDecoration.java    From Girls with Apache License 2.0 4 votes vote down vote up
public DividerItemDecoration(Context context, int orientation) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    a.recycle();
    setOrientation(orientation);
}
 
Example 20
Source File: DividerItemDecoration.java    From android with Apache License 2.0 4 votes vote down vote up
public DividerItemDecoration(Context context, AttributeSet attrs) {
  final TypedArray a = context
      .obtainStyledAttributes(attrs, new int[]{android.R.attr.listDivider});
  mDivider = a.getDrawable(0);
  a.recycle();
}