Search in sources :

Example 11 with TypedArray

use of android.content.res.TypedArray in project android-betterpickers by code-troopers.

the class HmsView method setTheme.

/**
     * Set a theme and restyle the views. This View will change its text color.
     *
     * @param themeResId the resource ID for theming
     */
public void setTheme(int themeResId) {
    if (themeResId != -1) {
        TypedArray a = getContext().obtainStyledAttributes(themeResId, R.styleable.BetterPickersDialogFragment);
        mTextColor = a.getColorStateList(R.styleable.BetterPickersDialogFragment_bpTextColor);
    }
    restyleViews();
}
Also used : TypedArray(android.content.res.TypedArray)

Example 12 with TypedArray

use of android.content.res.TypedArray in project android-betterpickers by code-troopers.

the class NumberPicker method setTheme.

/**
     * Change the theme of the Picker
     *
     * @param themeResId the resource ID of the new style
     */
public void setTheme(int themeResId) {
    mTheme = themeResId;
    if (mTheme != -1) {
        TypedArray a = getContext().obtainStyledAttributes(themeResId, R.styleable.BetterPickersDialogFragment);
        mTextColor = a.getColorStateList(R.styleable.BetterPickersDialogFragment_bpTextColor);
        mKeyBackgroundResId = a.getResourceId(R.styleable.BetterPickersDialogFragment_bpKeyBackground, mKeyBackgroundResId);
        mButtonBackgroundResId = a.getResourceId(R.styleable.BetterPickersDialogFragment_bpButtonBackground, mButtonBackgroundResId);
        mDividerColor = a.getColor(R.styleable.BetterPickersDialogFragment_bpDividerColor, mDividerColor);
        mDeleteDrawableSrcResId = a.getResourceId(R.styleable.BetterPickersDialogFragment_bpDeleteIcon, mDeleteDrawableSrcResId);
    }
    restyleViews();
}
Also used : TypedArray(android.content.res.TypedArray)

Example 13 with TypedArray

use of android.content.res.TypedArray in project android-betterpickers by code-troopers.

the class DatePicker method setTheme.

/**
     * Change the theme of the Picker
     *
     * @param themeResId the resource ID of the new style
     */
public void setTheme(int themeResId) {
    mTheme = themeResId;
    if (mTheme != -1) {
        TypedArray a = getContext().obtainStyledAttributes(themeResId, R.styleable.BetterPickersDialogFragment);
        mTextColor = a.getColorStateList(R.styleable.BetterPickersDialogFragment_bpTextColor);
        mKeyBackgroundResId = a.getResourceId(R.styleable.BetterPickersDialogFragment_bpKeyBackground, mKeyBackgroundResId);
        mButtonBackgroundResId = a.getResourceId(R.styleable.BetterPickersDialogFragment_bpButtonBackground, mButtonBackgroundResId);
        mCheckDrawableSrcResId = a.getResourceId(R.styleable.BetterPickersDialogFragment_bpCheckIcon, mCheckDrawableSrcResId);
        mTitleDividerColor = a.getColor(R.styleable.BetterPickersDialogFragment_bpTitleDividerColor, mTitleDividerColor);
        mKeyboardIndicatorColor = a.getColor(R.styleable.BetterPickersDialogFragment_bpKeyboardIndicatorColor, mKeyboardIndicatorColor);
        mDeleteDrawableSrcResId = a.getResourceId(R.styleable.BetterPickersDialogFragment_bpDeleteIcon, mDeleteDrawableSrcResId);
    }
    restyleViews();
}
Also used : TypedArray(android.content.res.TypedArray)

Example 14 with TypedArray

use of android.content.res.TypedArray in project android-betterpickers by code-troopers.

the class DateView method setTheme.

/**
     * Set a theme and restyle the views. This View will change its title color.
     *
     * @param themeResId the resource ID for theming
     */
public void setTheme(int themeResId) {
    if (themeResId != -1) {
        TypedArray a = getContext().obtainStyledAttributes(themeResId, R.styleable.BetterPickersDialogFragment);
        mTitleColor = a.getColorStateList(R.styleable.BetterPickersDialogFragment_bpTitleColor);
    }
    restyleViews();
}
Also used : TypedArray(android.content.res.TypedArray)

Example 15 with TypedArray

use of android.content.res.TypedArray in project android-betterpickers by code-troopers.

the class NumberView method setTheme.

/**
     * Set a theme and restyle the views. This View will change its title color.
     *
     * @param themeResId the resource ID for theming
     */
public void setTheme(int themeResId) {
    if (themeResId != -1) {
        TypedArray a = getContext().obtainStyledAttributes(themeResId, R.styleable.BetterPickersDialogFragment);
        mTextColor = a.getColorStateList(R.styleable.BetterPickersDialogFragment_bpTextColor);
    }
    restyleViews();
}
Also used : TypedArray(android.content.res.TypedArray)

Aggregations

TypedArray (android.content.res.TypedArray)1991 Paint (android.graphics.Paint)190 TypedValue (android.util.TypedValue)185 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)162 Resources (android.content.res.Resources)118 View (android.view.View)116 Drawable (android.graphics.drawable.Drawable)114 XmlResourceParser (android.content.res.XmlResourceParser)80 Context (android.content.Context)78 ColorStateList (android.content.res.ColorStateList)78 AttributeSet (android.util.AttributeSet)78 IOException (java.io.IOException)77 SuppressLint (android.annotation.SuppressLint)66 TextPaint (android.text.TextPaint)63 TextView (android.widget.TextView)62 ViewGroup (android.view.ViewGroup)59 Bundle (android.os.Bundle)48 LayoutInflater (android.view.LayoutInflater)42 Point (android.graphics.Point)41 ImageView (android.widget.ImageView)40