private void initSeekBar(AttributeSet attrs, int defStyleAttr) { if (isInEditMode()) return; colorControl = Carbon.getThemeColor(getContext(), R.attr.colorControlNormal); thumbRadius = thumbRadius2 = THUMB_RADIUS = Carbon.getDip(getContext()) * 8; THUMB_RADIUS_DRAGGED = Carbon.getDip(getContext()) * 10; STROKE_WIDTH = Carbon.getDip(getContext()) * 2; if (attrs != null) { Carbon.initAnimations(this, attrs, defStyleAttr); Carbon.initTint(this, attrs, defStyleAttr); Carbon.initRippleDrawable(this, attrs, defStyleAttr); TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.SeekBar, defStyleAttr, 0); setStyle(Style.values()[a.getInt(R.styleable.SeekBar_carbon_barStyle, 0)]); setMin(a.getFloat(R.styleable.SeekBar_carbon_min, 0)); setMax(a.getFloat(R.styleable.SeekBar_carbon_max, 0)); setStepSize(a.getFloat(R.styleable.SeekBar_carbon_stepSize, 0)); setValue(a.getFloat(R.styleable.SeekBar_carbon_value, 0)); setValue2(a.getFloat(R.styleable.SeekBar_carbon_value2, 0)); a.recycle(); } setFocusableInTouchMode(false); // TODO: from theme }
private void init(AttributeSet attrs, int defStyleAttr) { content = inflate(getContext(), R.layout.carbon_snackbar, null); addView(content); message = (TextView) findViewById(R.id.carbon_messageText); button = (Button) findViewById(R.id.carbon_actionButton); TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Snackbar, defStyleAttr, 0); style = Style.values()[a.getInt(R.styleable.Snackbar_carbon_layoutStyle, 0)]; setStyle(style); duration = a.getInt(R.styleable.Snackbar_carbon_duration, 0); a.recycle(); handler = new Handler(); }
public void initView(int color, int style) { mColor = color; mStyle = Style.values()[style]; Sprite sprite = SpriteFactory.create(mStyle); setIndeterminateDrawable(sprite); }