Example usage for android.content.res Resources getColor

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

Introduction

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

Prototype

@ColorInt
@Deprecated
public int getColor(@ColorRes int id) throws NotFoundException 

Source Link

Document

Returns a color integer associated with a particular resource ID.

Usage

From source file:com.geozen.smarttrail.ui.tablet.AreasDropdownFragment.java

public void loadArea(Cursor cursor, boolean loadTargetFragment) {
    //final String areaId;
    final int areaColor;
    final Resources res = getResources();

    if (cursor != null) {
        String colorStr = cursor.getString(AreasAdapter.AreasQuery.AREA_COLOR);
        areaColor = Color.parseColor(colorStr);
        //areaId = cursor.getString(AreasAdapter.AreasQuery.AREA_ID);

        mTitle.setText(cursor.getString(AreasAdapter.AreasQuery.AREA_NAME));
        // mAbstract.setText(cursor.getString(AreasAdapter.AreasQuery.TRACK_ABSTRACT));

    } else {/*w  ww  .j a  va2  s. c  o  m*/
        areaColor = res.getColor(R.color.all_area_color);
        //areaId = AreasSchema.ALL_AREAS_ID;

        mTitle.setText(R.string.all_trails_title);
        mAbstract.setText(R.string.all_trails_subtitle);
    }

    boolean isDark = UIUtils.isColorDark(areaColor);
    mRootView.setBackgroundColor(areaColor);

    if (isDark) {
        mTitle.setTextColor(res.getColor(R.color.body_text_1_inverse));
        mAbstract.setTextColor(res.getColor(R.color.body_text_2_inverse));
        mRootView.findViewById(R.id.area_dropdown_arrow)
                .setBackgroundResource(R.drawable.area_dropdown_arrow_light);
    } else {
        mTitle.setTextColor(res.getColor(R.color.body_text_1));
        mAbstract.setTextColor(res.getColor(R.color.body_text_2));
        mRootView.findViewById(R.id.area_dropdown_arrow)
                .setBackgroundResource(R.drawable.area_dropdown_arrow_dark);
    }

    if (loadTargetFragment) {
        final Intent intent = new Intent(Intent.ACTION_VIEW);

        intent.setData(AreasSchema.CONTENT_URI);

        ((BaseActivity) getActivity()).openActivityOrFragment(intent);
    }
}

From source file:cpi.suhaib.extendedcirclepagerindicator.CirclePageIndicator.java

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

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

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

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);
    mMaxIndicators = a.getInt(R.styleable.CirclePageIndicator_maxIndicators, 0);
    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    Drawable nextDrawable = a.getDrawable(R.styleable.CirclePageIndicator_more_ahead_icon);
    Drawable previousDrawable = a.getDrawable(R.styleable.CirclePageIndicator_more_back_icon);

    a.recycle();

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

    if (nextDrawable != null && nextDrawable instanceof BitmapDrawable) {
        mNextIcon = ((BitmapDrawable) nextDrawable).getBitmap();
    } else {
        mNextIcon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_walkthrough_next);
    }
    if (previousDrawable != null && previousDrawable instanceof BitmapDrawable) {
        mPreviousIcon = ((BitmapDrawable) previousDrawable).getBitmap();
    } else {
        mPreviousIcon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_walkthrough_previous);
    }

    mHiddenDots = new ArrayList<>();
}

From source file:com.xmm.cactus.ui.viewpagerindicator.CirclePageIndicator.java

public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*from  ww w.  j a v a 2 s.  c o m*/

    //Load defaults from resources
    final Resources res = getResources();
    //TODO   ?(values,color,drawable)????
    final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

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

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

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

From source file:co.paulburke.android.textviewpager.TextViewPagerIndicator.java

public TextViewPagerIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;//from  www  . ja  va2 s  .  c o m

    final Resources res = getResources();

    // Load defaults from resources
    final boolean defaultFades = res.getBoolean(R.bool.scroll_indicator_fades);
    final int defaultFadeDelay = res.getInteger(R.integer.scroll_indicator_fade_delay);
    final int defaultFadeLength = res.getInteger(R.integer.scroll_indicator_fade_length);
    final int defaultSelectedColor = res.getColor(R.color.scroll_indicator_selected_color);

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

    setFades(a.getBoolean(R.styleable.TextViewPagerIndicator_fades, defaultFades));
    setSelectedColor(a.getColor(R.styleable.TextViewPagerIndicator_selectedColor, defaultSelectedColor));
    setFadeDelay(a.getInteger(R.styleable.TextViewPagerIndicator_fadeDelay, defaultFadeDelay));
    setFadeLength(a.getInteger(R.styleable.TextViewPagerIndicator_fadeLength, defaultFadeLength));

    Drawable background = a.getDrawable(R.styleable.TextViewPagerIndicator_android_background);
    if (background != null)
        setBackgroundDrawable(background);

    a.recycle();
}

From source file:com.example.anumbrella.viewpager.LinePagerIndicator.java

public LinePagerIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    ////from  w  ww.  ja  va2 s.co  m
    if (isInEditMode()) {
        return;
    }

    //??
    final Resources res = getResources();

    //
    //?
    final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color);
    //
    final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color);
    //
    final float defalutLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width);
    //?
    final float defalutGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width);
    //
    final float defalutStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width);
    //??
    final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered);
    //xml
    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.LinePagerIndicator, defStyle, 0);

    mCentered = array.getBoolean(R.styleable.LinePagerIndicator_centered, defaultCentered);
    mLineWidth = array.getDimension(R.styleable.LinePagerIndicator_lineWidth, defalutLineWidth);
    mGapWidth = array.getDimension(R.styleable.LinePagerIndicator_gapWidth, defalutGapWidth);
    //?
    setStrokeWidth(array.getDimension(R.styleable.LinePagerIndicator_strokeWidth, defalutStrokeWidth));
    mPaintUnselected
            .setColor(array.getColor(R.styleable.LinePagerIndicator_unselectedColor, defaultUnselectedColor));
    mPaintSelected.setColor(array.getColor(R.styleable.LinePagerIndicator_selectedColor, defaultSelectedColor));

    Drawable background = array.getDrawable(R.styleable.LinePagerIndicator_android_background);

    //
    if (background != null) {
        setBackgroundDrawable(background);
    }
    array.recycle();
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    //????(?????)
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);

}

From source file:eu.operando.operandoapp.wifi.AccessPointsDetail.java

public void setView(@NonNull Resources resources, @NonNull View view, @NonNull final WiFiDetail wiFiDetail) {

    TextView ssidLabel = (TextView) view.findViewById(R.id.ssid);
    ssidLabel.setText(wiFiDetail.getTitle());
    TextView textLinkSpeed = (TextView) view.findViewById(R.id.linkSpeed);
    textLinkSpeed.setTextColor(Color.BLACK);
    String ipAddress = wiFiDetail.getWiFiAdditional().getIPAddress();
    boolean isConnected = StringUtils.isNotBlank(ipAddress);
    if (!isConnected) {
        textLinkSpeed.setVisibility(View.GONE);
        ssidLabel.setTextColor(resources.getColor(android.R.color.black));
    } else {//from  w  w  w.  jav  a 2s  .c om
        ssidLabel.setTextColor(resources.getColor(R.color.connected));

        int linkSpeed = wiFiDetail.getWiFiAdditional().getLinkSpeed();
        if (linkSpeed == WiFiConnection.LINK_SPEED_INVALID) {
            textLinkSpeed.setVisibility(View.GONE);
        } else {
            textLinkSpeed.setVisibility(View.VISIBLE);
            textLinkSpeed.setText(String.format("%d%s", linkSpeed, WifiInfo.LINK_SPEED_UNITS));
        }
    }

    WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal();
    Strength strength = wiFiSignal.getStrength();
    ImageView imageView = (ImageView) view.findViewById(R.id.levelImage);
    imageView.setImageResource(strength.imageResource());
    imageView.setColorFilter(resources.getColor(strength.colorResource()));

    Security security = wiFiDetail.getSecurity();
    ImageView securityImage = (ImageView) view.findViewById(R.id.securityImage);
    securityImage.setImageResource(security.imageResource());
    securityImage.setColorFilter(resources.getColor(R.color.icons_color));

    TextView textLevel = (TextView) view.findViewById(R.id.level);
    textLevel.setText(String.format("%ddBm", wiFiSignal.getLevel()));
    textLevel.setTextColor(Color.BLACK);
    //textLevel.setTextColor(resources.getColor(strength.colorResource()));

    ((TextView) view.findViewById(R.id.channel))
            .setText(String.format("%d", wiFiSignal.getWiFiChannel().getChannel()));
    ((TextView) view.findViewById(R.id.frequency))
            .setText(String.format("%d%s", wiFiSignal.getFrequency(), WifiInfo.FREQUENCY_UNITS));
    ((TextView) view.findViewById(R.id.distance)).setText(String.format("%.1fm", wiFiSignal.getDistance()));
    ((TextView) view.findViewById(R.id.capabilities)).setText(wiFiDetail.getCapabilities());

    LayoutInflater layoutInflater = mainContext.getLayoutInflater();

    final WiFiApConfig wiFiApConfig = wiFiDetail.getWiFiAdditional().getWiFiApConfig();
    ImageView configuredImage = (ImageView) view.findViewById(R.id.configuredImage);
    if (wiFiApConfig != null) {

        configuredImage.setVisibility(View.VISIBLE);

        if (isOperandoCompatible(wiFiApConfig)) {
            configuredImage.setColorFilter(resources.getColor(android.R.color.holo_green_light));
            view.setOnClickListener(
                    new ConfiguredClickListener(context, wiFiDetail, wiFiApConfig, isConnected));
        } else {
            configuredImage.setColorFilter(resources.getColor(android.R.color.holo_red_light));
            view.setOnClickListener(new ForgetClickListener(context, wiFiDetail));
        }

    } else {
        configuredImage.setVisibility(View.GONE);
        view.setOnClickListener(new ConnectClickListener(context, wiFiDetail, layoutInflater));
    }

}

From source file:com.jakewharton.android.viewpagerindicator.TitlePageIndicator.java

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

    //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);

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

    //Retrieve the colors to be used for this view and apply them.
    mFooterLineHeight = a.getDimension(R.styleable.TitlePageIndicator_footerLineHeight,
            defaultFooterLineHeight);//from  w  w  w . ja  v  a2s . co m
    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);
    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_textColor, defaultTextColor);
    mBoldText = a.getBoolean(R.styleable.TitlePageIndicator_selectedBold, defaultSelectedBold);

    final float textSize = a.getDimension(R.styleable.TitlePageIndicator_textSize, defaultTextSize);
    final int footerColor = a.getColor(R.styleable.TitlePageIndicator_footerColor, defaultFooterColor);
    mPaintText = new Paint();
    mPaintText.setTextSize(textSize);
    mPaintText.setAntiAlias(true);
    mPaintFooterLine = new Paint();
    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.pdmanager.views.caregiver.CaregiverActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    try {// w w w.j av a2s  .  co m
        Resources resources = getResources();
        ColorDrawable bgColorPrimary = new ColorDrawable(resources.getColor(R.color.primary_title_background));
        ColorDrawable bgColorSecondary = new ColorDrawable(
                resources.getColor(R.color.secondary_title_background));
        currentBgColor = bgColorPrimary;
        setContentView(R.layout.activity_caregiver);
        Toolbar tb = (Toolbar) this.findViewById(R.id.toolbar);
        this.setSupportActionBar(tb);
        tb.setTitleTextColor(Color.WHITE);
        actionBar = getSupportActionBar();

        if (actionBar != null) {
            actionBar.setBackgroundDrawable(currentBgColor);
        }
        this.setupActionBar();
    } catch (Exception ex) {

    }

    //RecordingSettingsHandler.getInstance().Init(getApplicationContext());

    app = (PDApplicationContext) this.getApplicationContext();

    //    this.tipsPresenter = com.telerik.android.common.Util.getLayoutPart(this, R.id.tipsPresenter, TipsPresenter.class);

    try {
        this.setupNavigationDrawer(savedInstanceState);

    } catch (Exception e) {

    }
    try {
        // Prevents the drawer from being opened at the time of the first launch.
        //com.telerik.android.common.Util.getLayoutPart(this, R.id.drawer_layout, DrawerLayout.class).closeDrawer(Gravity.LEFT);
        this.getSupportFragmentManager().addOnBackStackChangedListener(this);
        if (savedInstanceState == null) {
            this.loadSectionFromIntent(this.getIntent(), false);
            //    this.app.trackScreenOpened(this);

        }

    } catch (Exception e) {

    }
}

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

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

    // ?
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

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

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

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

From source file:com.fanfou.app.opensource.ui.viewpager.TitlePageIndicator.java

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

    // 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);

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

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

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

    a.recycle();

    this.mPath = new Path();
}