Refine search
public MyCustomView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MyCustomView, defStyle, 0); String str = a.getString(R.styleable.MyCustomView_my_custom_attribute); //do something with str a.recycle(); }
public MyCustomElement(Context context, AttributeSet attrs) { super(context, attrs); TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.MyCustomElement, 0, 0); try { distanceExample = ta.getDimension(R.styleable.MyCustomElement_distanceExample, 100.0f); } finally { ta.recycle(); } // ... }
public DividerItemDecoration(Context context, AttributeSet attrs) { final TypedArray a = context .obtainStyledAttributes(attrs, new int[]{android.R.attr.listDivider}); mDivider = a.getDrawable(0); a.recycle(); }
public LayoutParams(Context c, AttributeSet attrs) { super(c, attrs); final TypedArray a = c.obtainStyledAttributes(attrs, ATTRS); a.recycle(); }
public LiftOff(Context context, AttributeSet attrs) { super(context, attrs); final TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.LiftOff); initialElevation = ta.getDimension(R.styleable.LiftOff_initialElevation, 0f); finalElevation = ta.getDimension(R.styleable.LiftOff_finalElevation, 0f); ta.recycle(); }
public StartAnimatable(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.StartAnimatable); Drawable drawable = a.getDrawable(R.styleable.StartAnimatable_android_src); a.recycle(); if (drawable instanceof Animatable) { animatable = (Animatable) drawable; } else { throw new IllegalArgumentException("Non-Animatable resource provided."); } }
public LayoutParams(Context c, AttributeSet attrs) { super(c, attrs); final TypedArray ta = c.obtainStyledAttributes(attrs, ATTRS); if (ta != null) { this.weight = ta.getFloat(0, 0); ta.recycle(); } } }
public ImageAdapter(Context c) { mContext = c; TypedArray a = c.obtainStyledAttributes(R.styleable.Gallery1); mGalleryItemBackground = a.getResourceId(R.styleable.Gallery1_android_galleryItemBackground, 0); a.recycle(); }
public PopupWindow(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PopupWindow, defStyleAttr, 0); mOverlapAnchor = a.getBoolean(R.styleable.PopupWindow_overlapAnchor, false); a.recycle(); }
public ReflowText(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ReflowText); velocity = a.getDimensionPixelSize(R.styleable.ReflowText_velocity, velocity); minDuration = a.getInt(R.styleable.ReflowText_minDuration, (int) minDuration); maxDuration = a.getInt(R.styleable.ReflowText_maxDuration, (int) maxDuration); staggerDelay = a.getInt(R.styleable.ReflowText_staggerDelay, (int) staggerDelay); freezeFrame = a.getBoolean(R.styleable.ReflowText_freezeFrame, false); a.recycle(); }
public TwoLevelHeader(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mSpinnerStyle = SpinnerStyle.FixedBehind; TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.TwoLevelHeader); mMaxRage = ta.getFloat(R.styleable.TwoLevelHeader_srlMaxRage, mMaxRage); mFloorRage = ta.getFloat(R.styleable.TwoLevelHeader_srlFloorRage, mFloorRage); mRefreshRage = ta.getFloat(R.styleable.TwoLevelHeader_srlRefreshRage, mRefreshRage); mFloorDuration = ta.getInt(R.styleable.TwoLevelHeader_srlFloorDuration, mFloorDuration); mEnableTwoLevel = ta.getBoolean(R.styleable.TwoLevelHeader_srlEnableTwoLevel, mEnableTwoLevel); mEnablePullToCloseTwoLevel = ta.getBoolean(R.styleable.TwoLevelHeader_srlEnablePullToCloseTwoLevel, mEnablePullToCloseTwoLevel); ta.recycle(); }
GifViewAttributes(final View view, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes) { final TypedArray gifViewAttributes = view.getContext().obtainStyledAttributes(attrs, R.styleable.GifView, defStyleAttr, defStyleRes); freezesAnimation = gifViewAttributes.getBoolean(R.styleable.GifView_freezesAnimation, false); mLoopCount = gifViewAttributes.getInt(R.styleable.GifView_loopCount, -1); gifViewAttributes.recycle(); }
private void obtainAttributes(Context context, AttributeSet attrs) { TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.MsgView); backgroundColor = ta.getColor(R.styleable.MsgView_mv_backgroundColor, Color.TRANSPARENT); cornerRadius = ta.getDimensionPixelSize(R.styleable.MsgView_mv_cornerRadius, 0); strokeWidth = ta.getDimensionPixelSize(R.styleable.MsgView_mv_strokeWidth, 0); strokeColor = ta.getColor(R.styleable.MsgView_mv_strokeColor, Color.TRANSPARENT); isRadiusHalfHeight = ta.getBoolean(R.styleable.MsgView_mv_isRadiusHalfHeight, false); isWidthHeightEqual = ta.getBoolean(R.styleable.MsgView_mv_isWidthHeightEqual, false); ta.recycle(); }
public MoreDetailsView(Context context, AttributeSet attrs) { super(context, attrs); Resources resources = getResources(); iconPaint = new Paint(Paint.ANTI_ALIAS_FLAG); float strokeSize = resources.getDimensionPixelSize(R.dimen.leak_canary_more_stroke_width); iconPaint.setStrokeWidth(strokeSize); // This lint check doesn't work for libraries which have a common prefix. @SuppressLint("CustomViewStyleable") // TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.leak_canary_MoreDetailsView); int plusColor = a.getColor(R.styleable.leak_canary_MoreDetailsView_leak_canary_plus_color, Color.BLACK); a.recycle(); iconPaint.setColor(plusColor); }
@Keep public StaggeredDistanceSlide(Context context, AttributeSet attrs) { super(context, attrs); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.StaggeredDistanceSlide); spread = a.getInteger(R.styleable.StaggeredDistanceSlide_spread, spread); a.recycle(); }
public ForegroundLinearLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ForegroundView, defStyle, 0); final Drawable d = a.getDrawable(R.styleable.ForegroundView_android_foreground); if (d != null) { setForeground(d); } a.recycle(); }
public CircleImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyle, 0); mBorderWidth = a.getDimensionPixelSize(R.styleable.CircleImageView_civ_border_width, DEFAULT_BORDER_WIDTH); mBorderColor = a.getColor(R.styleable.CircleImageView_civ_border_color, DEFAULT_BORDER_COLOR); mBorderOverlay = a.getBoolean(R.styleable.CircleImageView_civ_border_overlay, DEFAULT_BORDER_OVERLAY); mCircleBackgroundColor = a.getColor(R.styleable.CircleImageView_civ_circle_background_color, DEFAULT_CIRCLE_BACKGROUND_COLOR); a.recycle(); init(); }
public void setCollapsedTextAppearance(int resId) { TypedArray a = mView.getContext().obtainStyledAttributes(resId, R.styleable.TextAppearance); if (a.hasValue(R.styleable.TextAppearance_android_textColor)) { mCollapsedTextColor = a.getColor( R.styleable.TextAppearance_android_textColor, mCollapsedTextColor); } if (a.hasValue(R.styleable.TextAppearance_android_textSize)) { mCollapsedTextSize = a.getDimensionPixelSize( R.styleable.TextAppearance_android_textSize, (int) mCollapsedTextSize); } a.recycle(); recalculate(); }
public void setExpandedTextAppearance(int resId) { TypedArray a = mView.getContext().obtainStyledAttributes(resId, R.styleable.TextAppearance); if (a.hasValue(R.styleable.TextAppearance_android_textColor)) { mExpandedTextColor = a.getColor( R.styleable.TextAppearance_android_textColor, mExpandedTextColor); } if (a.hasValue(R.styleable.TextAppearance_android_textSize)) { mExpandedTextSize = a.getDimensionPixelSize( R.styleable.TextAppearance_android_textSize, (int) mExpandedTextSize); } a.recycle(); recalculate(); }
public FunGameHitBlockHeader(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.FunGameHitBlockHeader); speed = ta.getInt(R.styleable.FunGameHitBlockHeader_fghBallSpeed, DensityUtil.dp2px(SPEED)); blockHorizontalNum = ta.getInt(R.styleable.FunGameHitBlockHeader_fghBlockHorizontalNum, BLOCK_HORIZONTAL_NUM); ta.recycle(); blockPaint = new Paint(Paint.ANTI_ALIAS_FLAG); blockPaint.setStyle(Paint.Style.FILL); BALL_RADIUS = DensityUtil.dp2px(4); }