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(); }
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 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(); }
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(); }
public static boolean isIconicsAnimateChanges(@NonNull Context context, @Nullable AttributeSet attrs) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.IconicsAnimateChanges, 0, 0); try { return a.getBoolean(R.styleable.IconicsAnimateChanges_iiv_animate_icon_changes, true); } finally { 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(); }
/** * Get the boolean value of a given styleable. * * @param ctx * @param styleable * @param def * @return */ public static boolean getBooleanStyleable(Context ctx, @StyleableRes int styleable, boolean def) { TypedArray ta = ctx.getTheme().obtainStyledAttributes(R.styleable.MaterialDrawer); return ta.getBoolean(styleable, def); }
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_border_width, DEFAULT_BORDER_WIDTH); mBorderColor = a.getColor(R.styleable.CircleImageView_border_color, DEFAULT_BORDER_COLOR); mBorderOverlay = a.getBoolean(R.styleable.CircleImageView_border_overlay, DEFAULT_BORDER_OVERLAY); a.recycle(); init(); }
static boolean getAttrBoolean(Context context, AttributeSet attrs, int attr, boolean defaultValue) { TypedArray a = obtainAttributes(context.getResources(), context.getTheme(), attrs, new int[]{attr}); final boolean value = a.getBoolean(0, defaultValue); a.recycle(); return value; }
public static boolean getThemeAttrBoolean(Context context, @AttrRes int attr) { TEMP_ARRAY[0] = attr; TypedArray a = context.obtainStyledAttributes(null, TEMP_ARRAY); try { return a.getBoolean(0, false); } finally { a.recycle(); } }
public ChangeBounds(@NonNull Context context, @NonNull AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ChangeBounds); boolean resizeClip = a.getBoolean(R.styleable.ChangeBounds_resizeClip, false); a.recycle(); setResizeClip(resizeClip); }
public XLHRatingBar(Context context, AttributeSet attrs) { super(context, attrs); TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.XlHRatingBar); countNum = typedArray.getInt(R.styleable.XlHRatingBar_starCount, 5); countSelected = typedArray.getInt(R.styleable.XlHRatingBar_countSelected, 0); canEdit = typedArray.getBoolean(R.styleable.XlHRatingBar_canEdit, false); differentSize = typedArray.getBoolean(R.styleable.XlHRatingBar_differentSize, false); widthAndHeight = typedArray.getDimension(R.styleable.XlHRatingBar_widthAndHeight, ScreenUtils.dpToPxInt(0)); dividerWidth = typedArray.getDimension(R.styleable.XlHRatingBar_dividerWidth, ScreenUtils.dpToPxInt(0)); stateResId = typedArray.getResourceId(R.styleable.XlHRatingBar_stateResId, -1); initView(); }
private void parseAttributes(AttributeSet attrs) { TypedArray a = getContext().obtainStyledAttributes( attrs, R.styleable.com_facebook_profile_picture_view); setPresetSize(a.getInt(R.styleable.com_facebook_profile_picture_view_com_facebook_preset_size, CUSTOM)); isCropped = a.getBoolean( R.styleable.com_facebook_profile_picture_view_com_facebook_is_cropped, IS_CROPPED_DEFAULT_VALUE); a.recycle(); }
protected void initialise(AttributeSet attrs) { TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapProgressBarGroup); try { this.maxProgress = a.getInt(R.styleable.BootstrapProgressBarGroup_bootstrapMaxProgress, 100); this.sizeOrdinal = a.getInt(R.styleable.BootstrapProgressBarGroup_bootstrapSize, 2); this.rounded = a.getBoolean(R.styleable.BootstrapProgressBarGroup_roundedCorners, false); } finally { a.recycle(); } setOrientation(HORIZONTAL); updateBootstrapGroup(); }
private void initialise(AttributeSet attrs) { TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapLabel); try { int attrValue = a.getInt(R.styleable.BootstrapLabel_bootstrapHeading, 5); this.roundable = a.getBoolean(R.styleable.BootstrapLabel_roundedCorners, false); this.bootstrapHeading = DefaultBootstrapHeading.fromAttributeValue(attrValue); } finally { a.recycle(); } updateBootstrapState(); }
private boolean hasTransparentTheme(ActivityInfo activityInfo) { final int theme = activityInfo.getThemeResource(); final Resources.Theme themeObj = mContext.getResources().newTheme(); themeObj.applyStyle(theme, true); TypedArray ta = null; try { ta = themeObj.obtainStyledAttributes(TRANSLUCENT_ATTR_ID); return ta.getBoolean(0, false); } catch (Throwable thr) { return false; } finally { if (ta != null) { ta.recycle(); } } } }
public boolean resolveBoolAttr(@AttrRes int attrResId, @BoolRes int defResId) { mAttrs[0] = attrResId; TypedArray a = mTheme.obtainStyledAttributes(mAttrs); try { return a.getBoolean(0, resolveBoolRes(defResId)); } finally { a.recycle(); } }
@Override public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) { super.onInflate(activity, attrs, savedInstanceState); TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.picker_place_picker_fragment); setRadiusInMeters(a.getInt(R.styleable.picker_place_picker_fragment_radius_in_meters, radiusInMeters)); setResultsLimit(a.getInt(R.styleable.picker_place_picker_fragment_results_limit, resultsLimit)); if (a.hasValue(R.styleable.picker_place_picker_fragment_results_limit)) { setSearchText(a.getString(R.styleable.picker_place_picker_fragment_search_text)); } showSearchBox = a.getBoolean(R.styleable.picker_place_picker_fragment_show_search_box, showSearchBox); a.recycle(); }
@Override public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) { super.onInflate(activity, attrs, savedInstanceState); TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.picker_friend_picker_fragment); setMultiSelect(a.getBoolean(R.styleable.picker_friend_picker_fragment_multi_select, multiSelect)); a.recycle(); }