Example usage for android.content.res Resources getBoolean

List of usage examples for android.content.res Resources getBoolean

Introduction

In this page you can find the example usage for android.content.res Resources getBoolean.

Prototype

public boolean getBoolean(@BoolRes int id) throws NotFoundException 

Source Link

Document

Return a boolean associated with a particular resource ID.

Usage

From source file:com.ex.english.viewpagerindicator.TitlePageIndicator.java

public TitlePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*from  www . j a va 2 s.  c o  m*/

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultFooterColor = res.getColor(R.color.default_title_indicator_footer_color);
    final float defaultFooterLineHeight = res.getDimension(R.dimen.default_title_indicator_footer_line_height);
    final int defaultFooterIndicatorStyle = res
            .getInteger(R.integer.default_title_indicator_footer_indicator_style);
    final float defaultFooterIndicatorHeight = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_height);
    final float defaultFooterIndicatorUnderlinePadding = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_underline_padding);
    final float defaultFooterPadding = res.getDimension(R.dimen.default_title_indicator_footer_padding);
    final int defaultSelectedColor = res.getColor(R.color.default_title_indicator_selected_color);
    final boolean defaultSelectedBold = res.getBoolean(R.bool.default_title_indicator_selected_bold);
    final int defaultTextColor = res.getColor(R.color.default_title_indicator_text_color);
    final float defaultTextSize = res.getDimension(R.dimen.default_title_indicator_text_size);
    final float defaultTitlePadding = res.getDimension(R.dimen.default_title_indicator_title_padding);
    final float defaultClipPadding = res.getDimension(R.dimen.default_title_indicator_clip_padding);
    final float defaultTopPadding = res.getDimension(R.dimen.default_title_indicator_top_padding);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TitlePageIndicator, defStyle, 0);

    //Retrieve the colors to be used for this view and apply them.
    mFooterLineHeight = a.getDimension(R.styleable.TitlePageIndicator_footerLineHeight,
            defaultFooterLineHeight);
    mFooterIndicatorStyle = IndicatorStyle.fromValue(
            a.getInteger(R.styleable.TitlePageIndicator_footerIndicatorStyle, defaultFooterIndicatorStyle));
    mFooterIndicatorHeight = a.getDimension(R.styleable.TitlePageIndicator_footerIndicatorHeight,
            defaultFooterIndicatorHeight);
    mFooterIndicatorUnderlinePadding = a.getDimension(
            R.styleable.TitlePageIndicator_footerIndicatorUnderlinePadding,
            defaultFooterIndicatorUnderlinePadding);
    mFooterPadding = a.getDimension(R.styleable.TitlePageIndicator_footerPadding, defaultFooterPadding);
    mTopPadding = a.getDimension(R.styleable.TitlePageIndicator_topPadding, defaultTopPadding);
    mTitlePadding = a.getDimension(R.styleable.TitlePageIndicator_titlePadding, defaultTitlePadding);
    mClipPadding = a.getDimension(R.styleable.TitlePageIndicator_clipPadding, defaultClipPadding);
    mColorSelected = a.getColor(R.styleable.TitlePageIndicator_selectedColor, defaultSelectedColor);
    mColorText = a.getColor(R.styleable.TitlePageIndicator_android_textColor, defaultTextColor);
    mBoldText = a.getBoolean(R.styleable.TitlePageIndicator_selectedBold, defaultSelectedBold);

    final float textSize = a.getDimension(R.styleable.TitlePageIndicator_android_textSize, defaultTextSize);
    final int footerColor = a.getColor(R.styleable.TitlePageIndicator_footerColor, defaultFooterColor);
    mPaintText.setTextSize(textSize);
    mPaintText.setAntiAlias(true);
    mPaintFooterLine.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterLine.setStrokeWidth(mFooterLineHeight);
    mPaintFooterLine.setColor(footerColor);
    mPaintFooterIndicator.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterIndicator.setColor(footerColor);

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.tandong.sa.vpic.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;//from   w  w w . ja  v  a2  s. com

    // Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(context.getResources()
            .getIdentifier("default_circle_indicator_page_color", "color", context.getPackageName()));
    final int defaultFillColor = res.getColor(context.getResources()
            .getIdentifier("default_circle_indicator_fill_color", "color", context.getPackageName()));

    final int defaultOrientation = res.getInteger(context.getResources()
            .getIdentifier("default_circle_indicator_orientation", "integer", context.getPackageName()));

    final int defaultStrokeColor = res.getColor(context.getResources()
            .getIdentifier("default_circle_indicator_stroke_color", "color", context.getPackageName()));
    final float defaultStrokeWidth = res.getDimension(context.getResources()
            .getIdentifier("default_circle_indicator_stroke_width", "dimen", context.getPackageName()));
    final float defaultRadius = res.getDimension(context.getResources()
            .getIdentifier("default_circle_indicator_radius", "dimen", context.getPackageName()));
    final boolean defaultCentered = res.getBoolean(context.getResources()
            .getIdentifier("default_circle_indicator_centered", "bool", context.getPackageName()));

    final boolean defaultSnap = res.getBoolean(context.getResources()
            .getIdentifier("default_circle_indicator_snap", "bool", context.getPackageName()));

    // Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, new int[] {
            getResources().getIdentifier("CirclePageIndicator", "styleable", context.getPackageName()) },
            defStyle, 0);

    mCentered = a.getBoolean(
            getResources().getIdentifier("CirclePageIndicator_centered", "styleable", context.getPackageName()),
            defaultCentered);

    mOrientation = a.getInt(getResources().getIdentifier("CirclePageIndicator_android_orientation", "styleable",
            context.getPackageName()), defaultOrientation);

    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(getResources().getIdentifier("CirclePageIndicator_pageColor",
            "styleable", context.getPackageName()), defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(getResources().getIdentifier("CirclePageIndicator_strokeColor",
            "styleable", context.getPackageName()), defaultStrokeColor));
    mPaintStroke.setStrokeWidth(a.getDimension(getResources().getIdentifier("CirclePageIndicator_strokeWidth",
            "styleable", context.getPackageName()), defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(getResources().getIdentifier("CirclePageIndicator_fillColor", "styleable",
            context.getPackageName()), defaultFillColor));
    mRadius = a.getDimension(
            getResources().getIdentifier("CirclePageIndicator_radius", "styleable", context.getPackageName()),
            defaultRadius);
    mSnap = a.getBoolean(
            getResources().getIdentifier("CirclePageIndicator_snap", "styleable", context.getPackageName()),
            defaultSnap);

    Drawable background = a.getDrawable(getResources().getIdentifier("CirclePageIndicator_android_background",
            "styleable", context.getPackageName()));

    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.example.marvin.familylink._UI.pager.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;//  ww w.j av  a 2 s . co m

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultFooterColor = res.getColor(R.color.default_title_indicator_footer_color);
    final float defaultFooterLineHeight = res.getDimension(R.dimen.default_title_indicator_footer_line_height);
    final int defaultFooterIndicatorStyle = res
            .getInteger(R.integer.default_title_indicator_footer_indicator_style);
    final float defaultFooterIndicatorHeight = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_height);
    final float defaultFooterIndicatorUnderlinePadding = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_underline_padding);
    final float defaultFooterPadding = res.getDimension(R.dimen.default_title_indicator_footer_padding);
    final int defaultSelectedColor = res.getColor(R.color.default_title_indicator_selected_color);
    final boolean defaultSelectedBold = res.getBoolean(R.bool.default_title_indicator_selected_bold);
    final int defaultTextColor = res.getColor(R.color.default_title_indicator_text_color);
    final float defaultTextSize = res.getDimension(R.dimen.default_title_indicator_text_size);
    final float defaultTitlePadding = res.getDimension(R.dimen.default_title_indicator_title_padding);
    final float defaultClipPadding = res.getDimension(R.dimen.default_title_indicator_clip_padding);
    final float defaultTopPadding = res.getDimension(R.dimen.default_title_indicator_top_padding);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TitlePageIndicator, defStyle, 0);

    //Retrieve the colors to be used for this view and apply them.
    mFooterLineHeight = a.getDimension(R.styleable.TitlePageIndicator_footerLineHeight,
            defaultFooterLineHeight);
    mFooterIndicatorStyle = IndicatorStyle.fromValue(
            a.getInteger(R.styleable.TitlePageIndicator_footerIndicatorStyle, defaultFooterIndicatorStyle));
    mFooterIndicatorHeight = a.getDimension(R.styleable.TitlePageIndicator_footerIndicatorHeight,
            defaultFooterIndicatorHeight);
    mFooterIndicatorUnderlinePadding = a.getDimension(
            R.styleable.TitlePageIndicator_footerIndicatorUnderlinePadding,
            defaultFooterIndicatorUnderlinePadding);
    mFooterPadding = a.getDimension(R.styleable.TitlePageIndicator_footerPadding, defaultFooterPadding);
    mTopPadding = a.getDimension(R.styleable.TitlePageIndicator_topPadding, defaultTopPadding);
    mTitlePadding = a.getDimension(R.styleable.TitlePageIndicator_titlePadding, defaultTitlePadding);
    mClipPadding = a.getDimension(R.styleable.TitlePageIndicator_clipPadding, defaultClipPadding);
    mColorSelected = a.getColor(R.styleable.TitlePageIndicator_selectedColor, defaultSelectedColor);
    mColorText = a.getColor(R.styleable.TitlePageIndicator_android_textColor, defaultTextColor);
    mBoldText = a.getBoolean(R.styleable.TitlePageIndicator_selectedBold, defaultSelectedBold);

    final float textSize = a.getDimension(R.styleable.TitlePageIndicator_android_textSize, defaultTextSize);
    final int footerColor = a.getColor(R.styleable.TitlePageIndicator_footerColor, defaultFooterColor);
    mPaintText.setTextSize(textSize);
    mPaintText.setAntiAlias(true);
    mPaintFooterLine.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterLine.setStrokeWidth(mFooterLineHeight);
    mPaintFooterLine.setColor(footerColor);
    mPaintFooterIndicator.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterIndicator.setColor(footerColor);

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:indrora.atomic.indicator.ConversationTitlePageIndicator.java

public ConversationTitlePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode()) {
        return;// ww  w  . jav a2  s  . c  o  m
    }

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultFooterColor = res.getColor(R.color.default_title_indicator_footer_color);
    final float defaultFooterLineHeight = res.getDimension(R.dimen.default_title_indicator_footer_line_height);
    final int defaultFooterIndicatorStyle = res
            .getInteger(R.integer.default_title_indicator_footer_indicator_style);
    final float defaultFooterIndicatorHeight = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_height);
    final float defaultFooterIndicatorUnderlinePadding = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_underline_padding);
    final float defaultFooterPadding = res.getDimension(R.dimen.default_title_indicator_footer_padding);
    final int defaultSelectedColor = res.getColor(R.color.default_title_indicator_selected_color);
    final boolean defaultSelectedBold = res.getBoolean(R.bool.default_title_indicator_selected_bold);
    final int defaultTextColor = res.getColor(R.color.default_title_indicator_text_color);
    final float defaultTextSize = res.getDimension(R.dimen.default_title_indicator_text_size);
    final float defaultTitlePadding = res.getDimension(R.dimen.default_title_indicator_title_padding);
    final float defaultClipPadding = res.getDimension(R.dimen.default_title_indicator_clip_padding);
    final float defaultTopPadding = res.getDimension(R.dimen.default_title_indicator_top_padding);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TitlePageIndicator, defStyle, 0);

    //Retrieve the colors to be used for this view and apply them.
    mFooterLineHeight = a.getDimension(R.styleable.TitlePageIndicator_footerLineHeight,
            defaultFooterLineHeight);
    mFooterIndicatorStyle = IndicatorStyle.fromValue(
            a.getInteger(R.styleable.TitlePageIndicator_footerIndicatorStyle, defaultFooterIndicatorStyle));
    mFooterIndicatorHeight = a.getDimension(R.styleable.TitlePageIndicator_footerIndicatorHeight,
            defaultFooterIndicatorHeight);
    mFooterIndicatorUnderlinePadding = a.getDimension(
            R.styleable.TitlePageIndicator_footerIndicatorUnderlinePadding,
            defaultFooterIndicatorUnderlinePadding);
    mFooterPadding = a.getDimension(R.styleable.TitlePageIndicator_footerPadding, defaultFooterPadding);
    mTopPadding = a.getDimension(R.styleable.TitlePageIndicator_topPadding, defaultTopPadding);
    mTitlePadding = a.getDimension(R.styleable.TitlePageIndicator_titlePadding, defaultTitlePadding);
    mClipPadding = a.getDimension(R.styleable.TitlePageIndicator_clipPadding, defaultClipPadding);
    mColorSelected = a.getColor(R.styleable.TitlePageIndicator_selectedColor, defaultSelectedColor);
    mColorText = a.getColor(R.styleable.TitlePageIndicator_android_textColor, defaultTextColor);
    mBoldText = a.getBoolean(R.styleable.TitlePageIndicator_selectedBold, defaultSelectedBold);

    final float textSize = a.getDimension(R.styleable.TitlePageIndicator_android_textSize, defaultTextSize);
    final int footerColor = a.getColor(R.styleable.TitlePageIndicator_footerColor, defaultFooterColor);
    mPaintText.setTextSize(textSize);
    mPaintText.setAntiAlias(true);
    mPaintFooterLine.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterLine.setStrokeWidth(mFooterLineHeight);
    mPaintFooterLine.setColor(footerColor);
    mPaintFooterIndicator.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterIndicator.setColor(footerColor);

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.android.mail.browse.ConversationItemView.java

public ConversationItemView(Context context, Account account) {
    super(context);
    Utils.traceBeginSection("CIVC constructor");
    setClickable(true);//from  ww w . j a va 2  s  .  c  o  m
    setLongClickable(true);
    mContext = context.getApplicationContext();
    final Resources res = mContext.getResources();
    mTabletDevice = Utils.useTabletUI(res);
    mListCollapsible = !res.getBoolean(R.bool.is_tablet_landscape);
    mAccount = account;

    getItemViewResources(mContext);

    final int layoutDir = TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault());

    mSendersTextView = new TextView(mContext);
    mSendersTextView.setIncludeFontPadding(false);

    mSubjectTextView = new TextView(mContext);
    mSubjectTextView.setEllipsize(TextUtils.TruncateAt.END);
    mSubjectTextView.setIncludeFontPadding(false);
    ViewCompat.setLayoutDirection(mSubjectTextView, layoutDir);
    ViewUtils.setTextAlignment(mSubjectTextView, View.TEXT_ALIGNMENT_VIEW_START);

    mSnippetTextView = new TextView(mContext);
    mSnippetTextView.setEllipsize(TextUtils.TruncateAt.END);
    mSnippetTextView.setIncludeFontPadding(false);
    mSnippetTextView.setTypeface(SANS_SERIF_LIGHT);
    mSnippetTextView.setTextColor(getResources().getColor(R.color.snippet_text_color));
    ViewCompat.setLayoutDirection(mSnippetTextView, layoutDir);
    ViewUtils.setTextAlignment(mSnippetTextView, View.TEXT_ALIGNMENT_VIEW_START);

    // hack for b/16345519. Root cause is b/17280038.
    if (layoutDir == LAYOUT_DIRECTION_RTL) {
        mSubjectTextView.setMaxLines(1);
        mSnippetTextView.setMaxLines(1);
    } else {
        mSubjectTextView.setSingleLine();
        mSnippetTextView.setSingleLine();
    }

    mSendersImageView = new CheckableContactFlipDrawable(res, sCabAnimationDuration);
    mSendersImageView.setCallback(this);

    Utils.traceEndSection();
}

From source file:com.icloud.listenbook.base.view.viewpagerindicator.FixedTitlePageIndicator.java

public FixedTitlePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    // //ww w  . jav a 2 s  .c  om
    final Resources res = getResources();
    final int defaultFooterColor = res.getColor(R.color.default_title_indicator_footer_color);
    final float defaultFooterLineHeight = res.getDimension(R.dimen.default_title_indicator_footer_line_height);
    final int defaultFooterIndicatorStyle = res
            .getInteger(R.integer.default_title_indicator_footer_indicator_style);
    final float defaultFooterIndicatorHeight = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_height);
    final float defaultFooterIndicatorUnderlinePadding = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_underline_padding);
    final float defaultFooterPadding = res.getDimension(R.dimen.default_title_indicator_footer_padding);
    final int defaultSelectedColor = res.getColor(R.color.default_title_indicator_selected_color);
    final boolean defaultSelectedBold = res.getBoolean(R.bool.default_title_indicator_selected_bold);
    final int defaultTextColor = res.getColor(R.color.default_title_indicator_text_color);
    final float defaultTextSize = res.getDimension(R.dimen.default_title_indicator_text_size);
    final float defaultTitlePadding = res.getDimension(R.dimen.default_title_indicator_title_padding);
    final float defaultClipPadding = res.getDimension(R.dimen.default_title_indicator_clip_padding);
    final float defaultTopPadding = res.getDimension(R.dimen.default_title_indicator_top_padding);

    // 
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TitlePageIndicator, defStyle, 0);

    // z } 
    mFooterLineHeight = a.getDimension(R.styleable.TitlePageIndicator_footerLineHeight,
            defaultFooterLineHeight);
    mFooterIndicatorStyle = IndicatorStyle.fromValue(
            a.getInteger(R.styleable.TitlePageIndicator_footerIndicatorStyle, defaultFooterIndicatorStyle));

    mFooterIndicatorHeight = a.getDimension(R.styleable.TitlePageIndicator_footerIndicatorHeight,
            defaultFooterIndicatorHeight);
    mFooterIndicatorUnderlinePadding = a.getDimension(
            R.styleable.TitlePageIndicator_footerIndicatorUnderlinePadding,
            defaultFooterIndicatorUnderlinePadding);
    mFooterPadding = a.getDimension(R.styleable.TitlePageIndicator_footerPadding, defaultFooterPadding);
    mTopPadding = a.getDimension(R.styleable.TitlePageIndicator_topPadding, defaultTopPadding);
    mTitlePadding = a.getDimension(R.styleable.TitlePageIndicator_titlePadding, defaultTitlePadding);
    mClipPadding = a.getDimension(R.styleable.TitlePageIndicator_clipPadding, defaultClipPadding);
    mColorSelected = a.getColor(R.styleable.TitlePageIndicator_selectedColor, defaultSelectedColor);
    mColorText = a.getColor(R.styleable.TitlePageIndicator_android_textColor, defaultTextColor);
    mBoldText = a.getBoolean(R.styleable.TitlePageIndicator_selectedBold, defaultSelectedBold);
    //  
    final float textSize = a.getDimension(R.styleable.TitlePageIndicator_android_textSize, defaultTextSize);
    final int footerColor = a.getColor(R.styleable.TitlePageIndicator_footerColor, defaultFooterColor);
    mPaintText = new Paint();
    mPaintText.setTextSize(textSize);
    mPaintText.setAntiAlias(true);
    mPaintFooterLine = new Paint();
    // O+
    mPaintFooterLine.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterLine.setStrokeWidth(mFooterLineHeight);
    mPaintFooterLine.setColor(footerColor);
    mPaintFooterIndicator = new Paint();
    mPaintFooterIndicator.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterIndicator.setColor(footerColor);

    a.recycle();
}

From source file:com.viewpagerindicator.RichTitlePageIndicator.java

public RichTitlePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;//from www.j ava 2  s  .  co m

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultFooterColor = res.getColor(R.color.default_title_indicator_footer_color);
    final float defaultFooterLineHeight = res.getDimension(R.dimen.default_title_indicator_footer_line_height);
    final int defaultFooterIndicatorStyle = res
            .getInteger(R.integer.default_title_indicator_footer_indicator_style);
    final float defaultFooterIndicatorHeight = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_height);
    final float defaultFooterIndicatorUnderlinePadding = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_underline_padding);
    final float defaultFooterPadding = res.getDimension(R.dimen.default_title_indicator_footer_padding);
    final int defaultSelectedColor = res.getColor(R.color.default_title_indicator_selected_color);
    final boolean defaultSelectedBold = res.getBoolean(R.bool.default_title_indicator_selected_bold);
    final int defaultTextColor = res.getColor(R.color.default_title_indicator_text_color);
    final float defaultTextSize = res.getDimension(R.dimen.default_title_indicator_text_size);
    final float defaultTitlePadding = res.getDimension(R.dimen.default_title_indicator_title_padding);
    final float defaultClipPadding = res.getDimension(R.dimen.default_title_indicator_clip_padding);
    final float defaultTopPadding = res.getDimension(R.dimen.default_title_indicator_top_padding);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TitlePageIndicator, defStyle, 0);

    //Retrieve the colors to be used for this view and apply them.
    mFooterLineHeight = a.getDimension(R.styleable.TitlePageIndicator_footerLineHeight,
            defaultFooterLineHeight);
    mFooterIndicatorStyle = IndicatorStyle.fromValue(
            a.getInteger(R.styleable.TitlePageIndicator_footerIndicatorStyle, defaultFooterIndicatorStyle));
    mFooterIndicatorHeight = a.getDimension(R.styleable.TitlePageIndicator_footerIndicatorHeight,
            defaultFooterIndicatorHeight);
    mFooterIndicatorUnderlinePadding = a.getDimension(
            R.styleable.TitlePageIndicator_footerIndicatorUnderlinePadding,
            defaultFooterIndicatorUnderlinePadding);
    mFooterPadding = a.getDimension(R.styleable.TitlePageIndicator_footerPadding, defaultFooterPadding);
    mTopPadding = a.getDimension(R.styleable.TitlePageIndicator_topPadding, defaultTopPadding);
    mTitlePadding = a.getDimension(R.styleable.TitlePageIndicator_titlePadding, defaultTitlePadding);
    mClipPadding = a.getDimension(R.styleable.TitlePageIndicator_clipPadding, defaultClipPadding);
    mColorSelected = a.getColor(R.styleable.TitlePageIndicator_selectedColor, defaultSelectedColor);
    mColorText = a.getColor(R.styleable.TitlePageIndicator_android_textColor, defaultTextColor);
    mBoldText = a.getBoolean(R.styleable.TitlePageIndicator_selectedBold, defaultSelectedBold);

    final float textSize = a.getDimension(R.styleable.TitlePageIndicator_android_textSize, defaultTextSize);
    final int footerColor = a.getColor(R.styleable.TitlePageIndicator_footerColor, defaultFooterColor);
    mPaintText.setTextSize(textSize);
    mPaintText.setAntiAlias(true);
    mPaintFooterLine.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterLine.setStrokeWidth(mFooterLineHeight);
    mPaintFooterLine.setColor(footerColor);
    mPaintFooterIndicator.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterIndicator.setColor(footerColor);

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.lovebridge.library.view.viewpagerindicator.TitlePageIndicator.java

public TitlePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;//from w  w  w  . ja va 2  s.  c  om
    // Load defaults from resources
    final Resources res = getResources();
    final int defaultFooterColor = res.getColor(R.color.default_title_indicator_footer_color);
    final float defaultFooterLineHeight = res.getDimension(R.dimen.default_title_indicator_footer_line_height);
    final int defaultFooterIndicatorStyle = res
            .getInteger(R.integer.default_title_indicator_footer_indicator_style);
    final float defaultFooterIndicatorHeight = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_height);
    final float defaultFooterIndicatorUnderlinePadding = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_underline_padding);
    final float defaultFooterPadding = res.getDimension(R.dimen.default_title_indicator_footer_padding);
    final int defaultLinePosition = res.getInteger(R.integer.default_title_indicator_line_position);
    final int defaultSelectedColor = res.getColor(R.color.default_title_indicator_selected_color);
    final boolean defaultSelectedBold = res.getBoolean(R.bool.default_title_indicator_selected_bold);
    final int defaultTextColor = res.getColor(R.color.default_title_indicator_text_color);
    final float defaultTextSize = res.getDimension(R.dimen.default_title_indicator_text_size);
    final float defaultTitlePadding = res.getDimension(R.dimen.default_title_indicator_title_padding);
    final float defaultClipPadding = res.getDimension(R.dimen.default_title_indicator_clip_padding);
    final float defaultTopPadding = res.getDimension(R.dimen.default_title_indicator_top_padding);
    // Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TitlePageIndicator, defStyle, 0);
    // Retrieve the colors to be used for this view and apply them.
    mFooterLineHeight = a.getDimension(R.styleable.TitlePageIndicator_footerLineHeight,
            defaultFooterLineHeight);
    mFooterIndicatorStyle = IndicatorStyle.fromValue(
            a.getInteger(R.styleable.TitlePageIndicator_footerIndicatorStyle, defaultFooterIndicatorStyle));
    mFooterIndicatorHeight = a.getDimension(R.styleable.TitlePageIndicator_footerIndicatorHeight,
            defaultFooterIndicatorHeight);
    mFooterIndicatorUnderlinePadding = a.getDimension(
            R.styleable.TitlePageIndicator_footerIndicatorUnderlinePadding,
            defaultFooterIndicatorUnderlinePadding);
    mFooterPadding = a.getDimension(R.styleable.TitlePageIndicator_footerPadding, defaultFooterPadding);
    mLinePosition = LinePosition
            .fromValue(a.getInteger(R.styleable.TitlePageIndicator_linePosition, defaultLinePosition));
    mTopPadding = a.getDimension(R.styleable.TitlePageIndicator_topPadding, defaultTopPadding);
    mTitlePadding = a.getDimension(R.styleable.TitlePageIndicator_titlePadding, defaultTitlePadding);
    mClipPadding = a.getDimension(R.styleable.TitlePageIndicator_clipPadding, defaultClipPadding);
    mColorSelected = a.getColor(R.styleable.TitlePageIndicator_selectedColor, defaultSelectedColor);
    mColorText = a.getColor(R.styleable.TitlePageIndicator_android_textColor, defaultTextColor);
    mBoldText = a.getBoolean(R.styleable.TitlePageIndicator_selectedBold, defaultSelectedBold);
    final float textSize = a.getDimension(R.styleable.TitlePageIndicator_android_textSize, defaultTextSize);
    final int footerColor = a.getColor(R.styleable.TitlePageIndicator_footerColor, defaultFooterColor);
    mPaintText.setTextSize(textSize);
    mPaintText.setAntiAlias(true);
    mPaintFooterLine.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterLine.setStrokeWidth(mFooterLineHeight);
    mPaintFooterLine.setColor(footerColor);
    mPaintFooterIndicator.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterIndicator.setColor(footerColor);
    Drawable background = a.getDrawable(R.styleable.TitlePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }
    a.recycle();
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.tandong.sa.vpic.LinePageIndicator.java

public LinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/* w w  w .j ava2 s .  co m*/

    final Resources res = getResources();

    // Load defaults from resources
    final int defaultSelectedColor = res.getColor(context.getResources()
            .getIdentifier("default_line_indicator_selected_color", "color", context.getPackageName()));
    final int defaultUnselectedColor = res.getColor(context.getResources()
            .getIdentifier("default_line_indicator_unselected_color", "color", context.getPackageName()));
    final float defaultLineWidth = res.getDimension(context.getResources()
            .getIdentifier("default_line_indicator_line_width", "dimen", context.getPackageName()));
    // final float defaultLineWidth = res
    // .getDimension(R.dimen.default_line_indicator_line_width);
    final float defaultGapWidth = res.getDimension(context.getResources()
            .getIdentifier("default_line_indicator_gap_width", "dimen", context.getPackageName()));
    // final float defaultGapWidth = res
    // .getDimension(R.dimen.default_line_indicator_gap_width);
    final float defaultStrokeWidth = res.getDimension(context.getResources()
            .getIdentifier("default_line_indicator_stroke_width", "dimen", context.getPackageName()));
    // final float defaultStrokeWidth = res
    // .getDimension(R.dimen.default_line_indicator_stroke_width);
    final boolean defaultCentered = res.getBoolean(context.getResources()
            .getIdentifier("default_line_indicator_centered", "bool", context.getPackageName()));
    // final boolean defaultCentered = res
    // .getBoolean(R.bool.default_line_indicator_centered);

    // Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs,
            new int[] {
                    getResources().getIdentifier("LinePageIndicator", "styleable", context.getPackageName()) },
            defStyle, 0);
    // TypedArray a = context.obtainStyledAttributes(attrs,
    // R.styleable.LinePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(
            getResources().getIdentifier("LinePageIndicator_centered", "styleable", context.getPackageName()),
            defaultCentered);
    // mCentered = a.getBoolean(R.styleable.LinePageIndicator_centered,
    // defaultCentered);
    mLineWidth = a.getDimension(
            getResources().getIdentifier("LinePageIndicator_lineWidth", "styleable", context.getPackageName()),
            defaultLineWidth);
    // mLineWidth = a.getDimension(R.styleable.LinePageIndicator_lineWidth,
    // defaultLineWidth);
    mGapWidth = a.getDimension(
            getResources().getIdentifier("LinePageIndicator_gapWidth", "styleable", context.getPackageName()),
            defaultGapWidth);
    // mGapWidth = a.getDimension(R.styleable.LinePageIndicator_gapWidth,
    // defaultGapWidth);
    setStrokeWidth(a.getDimension(getResources().getIdentifier("LinePageIndicator_strokeWidth", "styleable",
            context.getPackageName()), defaultStrokeWidth));
    // setStrokeWidth(a.getDimension(
    // R.styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintUnselected.setColor(a.getColor(getResources().getIdentifier("LinePageIndicator_unselectedColor",
            "styleable", context.getPackageName()), defaultUnselectedColor));
    // mPaintUnselected.setColor(a.getColor(
    // R.styleable.LinePageIndicator_unselectedColor,
    // defaultUnselectedColor));
    mPaintSelected.setColor(a.getColor(getResources().getIdentifier("LinePageIndicator_selectedColor",
            "styleable", context.getPackageName()), defaultSelectedColor));
    // mPaintSelected.setColor(a.getColor(
    // R.styleable.LinePageIndicator_selectedColor,
    // defaultSelectedColor));

    Drawable background = a.getDrawable(getResources().getIdentifier("LinePageIndicator_android_background",
            "styleable", context.getPackageName()));
    // Drawable background = a
    // .getDrawable(R.styleable.LinePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.benefit.buy.library.viewpagerindicator.TitlePageIndicator.java

public TitlePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode()) {
        return;/*from w  w  w .  ja v  a2  s .  c o m*/
    }
    //Load defaults from resources
    final Resources res = getResources();
    final int defaultFooterColor = res.getColor(R.color.default_title_indicator_footer_color);
    final float defaultFooterLineHeight = res.getDimension(R.dimen.default_title_indicator_footer_line_height);
    final int defaultFooterIndicatorStyle = res
            .getInteger(R.integer.default_title_indicator_footer_indicator_style);
    final float defaultFooterIndicatorHeight = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_height);
    final float defaultFooterIndicatorUnderlinePadding = res
            .getDimension(R.dimen.default_title_indicator_footer_indicator_underline_padding);
    final float defaultFooterPadding = res.getDimension(R.dimen.default_title_indicator_footer_padding);
    final int defaultLinePosition = res.getInteger(R.integer.default_title_indicator_line_position);
    final int defaultSelectedColor = res.getColor(R.color.default_title_indicator_selected_color);
    final boolean defaultSelectedBold = res.getBoolean(R.bool.default_title_indicator_selected_bold);
    final int defaultTextColor = res.getColor(R.color.default_title_indicator_text_color);
    final float defaultTextSize = res.getDimension(R.dimen.default_title_indicator_text_size);
    final float defaultTitlePadding = res.getDimension(R.dimen.default_title_indicator_title_padding);
    final float defaultClipPadding = res.getDimension(R.dimen.default_title_indicator_clip_padding);
    final float defaultTopPadding = res.getDimension(R.dimen.default_title_indicator_top_padding);
    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TitlePageIndicator, defStyle, 0);
    //Retrieve the colors to be used for this view and apply them.
    mFooterLineHeight = a.getDimension(R.styleable.TitlePageIndicator_footerLineHeight,
            defaultFooterLineHeight);
    mFooterIndicatorStyle = IndicatorStyle.fromValue(
            a.getInteger(R.styleable.TitlePageIndicator_footerIndicatorStyle, defaultFooterIndicatorStyle));
    mFooterIndicatorHeight = a.getDimension(R.styleable.TitlePageIndicator_footerIndicatorHeight,
            defaultFooterIndicatorHeight);
    mFooterIndicatorUnderlinePadding = a.getDimension(
            R.styleable.TitlePageIndicator_footerIndicatorUnderlinePadding,
            defaultFooterIndicatorUnderlinePadding);
    mFooterPadding = a.getDimension(R.styleable.TitlePageIndicator_footerPadding, defaultFooterPadding);
    mLinePosition = LinePosition
            .fromValue(a.getInteger(R.styleable.TitlePageIndicator_linePosition, defaultLinePosition));
    mTopPadding = a.getDimension(R.styleable.TitlePageIndicator_topPadding, defaultTopPadding);
    mTitlePadding = a.getDimension(R.styleable.TitlePageIndicator_titlePadding, defaultTitlePadding);
    mClipPadding = a.getDimension(R.styleable.TitlePageIndicator_clipPadding, defaultClipPadding);
    mColorSelected = a.getColor(R.styleable.TitlePageIndicator_selectedColor, defaultSelectedColor);
    mColorText = a.getColor(R.styleable.TitlePageIndicator_android_textColor, defaultTextColor);
    mBoldText = a.getBoolean(R.styleable.TitlePageIndicator_selectedBold, defaultSelectedBold);
    final float textSize = a.getDimension(R.styleable.TitlePageIndicator_android_textSize, defaultTextSize);
    final int footerColor = a.getColor(R.styleable.TitlePageIndicator_footerColor, defaultFooterColor);
    mPaintText.setTextSize(textSize);
    mPaintText.setAntiAlias(true);
    mPaintFooterLine.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterLine.setStrokeWidth(mFooterLineHeight);
    mPaintFooterLine.setColor(footerColor);
    mPaintFooterIndicator.setStyle(Paint.Style.FILL_AND_STROKE);
    mPaintFooterIndicator.setColor(footerColor);
    Drawable background = a.getDrawable(R.styleable.TitlePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }
    a.recycle();
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}