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.tandong.sa.vpic.TitlePageIndicator.java

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

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

    // Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs,
            new int[] {
                    getResources().getIdentifier("TitlePageIndicator", "styleable", context.getPackageName()) },
            defStyle, 0);
    // 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(getResources().getIdentifier("TitlePageIndicator_footerLineHeight",
            "styleable", context.getPackageName()), defaultFooterLineHeight);
    // mFooterLineHeight = a.getDimension(
    // R.styleable.TitlePageIndicator_footerLineHeight,
    // defaultFooterLineHeight);
    mFooterIndicatorStyle = IndicatorStyle
            .fromValue(a.getInteger(getResources().getIdentifier("TitlePageIndicator_footerIndicatorStyle",
                    "styleable", context.getPackageName()), defaultFooterIndicatorStyle));
    // mFooterIndicatorStyle = IndicatorStyle.fromValue(a.getInteger(
    // R.styleable.TitlePageIndicator_footerIndicatorStyle,
    // defaultFooterIndicatorStyle));
    mFooterIndicatorHeight = a.getDimension(getResources()
            .getIdentifier("TitlePageIndicator_footerIndicatorHeight", "styleable", context.getPackageName()),
            defaultFooterIndicatorHeight);
    // mFooterIndicatorHeight = a.getDimension(
    // R.styleable.TitlePageIndicator_footerIndicatorHeight,
    // defaultFooterIndicatorHeight);
    mFooterIndicatorUnderlinePadding = a
            .getDimension(getResources().getIdentifier("TitlePageIndicator_footerIndicatorUnderlinePadding",
                    "styleable", context.getPackageName()), defaultFooterIndicatorUnderlinePadding);
    // mFooterIndicatorUnderlinePadding = a.getDimension(
    // R.styleable.TitlePageIndicator_footerIndicatorUnderlinePadding,
    // defaultFooterIndicatorUnderlinePadding);
    mFooterPadding = a.getDimension(getResources().getIdentifier("TitlePageIndicator_footerPadding",
            "styleable", context.getPackageName()), defaultFooterPadding);
    // mFooterPadding = a.getDimension(
    // R.styleable.TitlePageIndicator_footerPadding,
    // defaultFooterPadding);
    mLinePosition = LinePosition
            .fromValue(a.getInteger(getResources().getIdentifier("TitlePageIndicator_linePosition", "styleable",
                    context.getPackageName()), defaultLinePosition));
    // mLinePosition = LinePosition.fromValue(a.getInteger(
    // R.styleable.TitlePageIndicator_linePosition,
    // defaultLinePosition));
    mTopPadding = a.getDimension(getResources().getIdentifier("TitlePageIndicator_topPadding", "styleable",
            context.getPackageName()), defaultTopPadding);
    // mTopPadding =
    // a.getDimension(R.styleable.TitlePageIndicator_topPadding,
    // defaultTopPadding);
    mTitlePadding = a.getDimension(getResources().getIdentifier("TitlePageIndicator_titlePadding", "styleable",
            context.getPackageName()), defaultTitlePadding);
    // mTitlePadding = a.getDimension(
    // R.styleable.TitlePageIndicator_titlePadding,
    // defaultTitlePadding);
    mClipPadding = a.getDimension(getResources().getIdentifier("TitlePageIndicator_clipPadding", "styleable",
            context.getPackageName()), defaultClipPadding);
    // mClipPadding = a.getDimension(
    // R.styleable.TitlePageIndicator_clipPadding, defaultClipPadding);
    mColorSelected = a.getColor(getResources().getIdentifier("TitlePageIndicator_selectedColor", "styleable",
            context.getPackageName()), defaultSelectedColor);
    // mColorSelected = a.getColor(
    // R.styleable.TitlePageIndicator_selectedColor,
    // defaultSelectedColor);
    mColorText = a.getColor(getResources().getIdentifier("TitlePageIndicator_android_textColor", "styleable",
            context.getPackageName()), defaultTextColor);
    // mColorText = a.getColor(
    // R.styleable.TitlePageIndicator_android_textColor,
    // defaultTextColor);
    mBoldText = a.getBoolean(getResources().getIdentifier("TitlePageIndicator_selectedBold", "styleable",
            context.getPackageName()), defaultSelectedBold);
    // mBoldText = a.getBoolean(R.styleable.TitlePageIndicator_selectedBold,
    // defaultSelectedBold);

    final float textSize = a.getDimension(getResources().getIdentifier("TitlePageIndicator_android_textSize",
            "styleable", context.getPackageName()), defaultTextSize);
    // final float textSize = a.getDimension(
    // R.styleable.TitlePageIndicator_android_textSize,
    // defaultTextSize);
    final int footerColor = a.getColor(getResources().getIdentifier("TitlePageIndicator_footerColor",
            "styleable", context.getPackageName()), defaultFooterColor);
    // 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(getResources().getIdentifier("TitlePageIndicator_android_background",
            "styleable", context.getPackageName()));
    // 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.ray.appchallenge.view.SwipeRefreshLayoutBottom.java

/**
 * Set the color resources used in the progress animation from color resources. The first color will also be the
 * color of the bar that grows in response to a user swipe gesture.
 *
 * @param  colorResIds//  w  w  w.  ja  va2 s.  c  o  m
 */
public void setColorSchemeResources(final int... colorResIds) {
    final Resources res = getResources();
    int[] colorRes = new int[colorResIds.length];
    for (int i = 0; i < colorResIds.length; i++) {
        colorRes[i] = res.getColor(colorResIds[i]);
    }

    setColorSchemeColors(colorRes);
}

From source file:de.mkrtchyan.recoverytools.FlashFragment.java

public void optimizeLayout(View root) throws NullPointerException {

    if (mDevice.isRecoverySupported() || mDevice.isKernelSupported()) {
        /** If device is supported start setting up layout */
        setupSwipeUpdater(root);//  w w w  .  j a  va  2  s . c  o m

        CardUI RashrCards = (CardUI) root.findViewById(R.id.RashrCards);
        final CardColorScheme scheme;
        Resources res = getResources();
        if (!RashrActivity.isDark) {
            scheme = null;
        } else {
            scheme = new CardColorScheme(res.getColor(R.color.background_floating_material_dark),
                    res.getColor(R.color.abc_secondary_text_material_dark));
        }
        /** Avoid overlapping scroll on CardUI and SwipeRefreshLayout */
        RashrCards.getListView().setOnScrollListener(new AbsListView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {

            }

            @Override
            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
                    int totalItemCount) {
                int topRowVerticalPosition = (view == null || view.getChildCount() == 0) ? 0
                        : view.getChildAt(0).getTop();
                mSwipeUpdater.setEnabled((topRowVerticalPosition >= 0));
            }
        });

        if (mDevice.isRecoverySupported()) {
            addRecoveryCards(RashrCards, scheme);
        }

        if (mDevice.isKernelSupported()) {
            addKernelCards(RashrCards, scheme);
        }

        final IconCard HistoryCard = new IconCard(getString(R.string.history), R.drawable.ic_history,
                getString(R.string.history_description), scheme);
        HistoryCard.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showFlashHistory();
            }
        });

        RashrCards.addCard(HistoryCard, true);

        addRebooterCards(RashrCards, scheme);
    }
}

From source file:com.cosmicsubspace.nerdyaudio.visuals.PlayControlsView.java

public PlayControlsView(Context context, AttributeSet attrs) {
    super(context, attrs);
    pt = new Paint(Paint.ANTI_ALIAS_FLAG);
    density = getResources().getDisplayMetrics().density;
    qm = QueueManager.getInstance();//  w  w  w. j a va 2 s. c  o  m
    ap = AudioPlayer.getInstance();

    Resources res = getResources();
    menuColor = getResources().getColor(R.color.colorPrimary);
    buttonColor = Color.WHITE;
    textPrimary = getResources().getColor(R.color.colorLightPrimaryText);
    textSecondary = getResources().getColor(R.color.colorLightSecondaryText);

    playedColor = ColorFiddler.setAlpha(res.getColor(R.color.colorPrimary), 200);
    //Log2.log(2,this,Color.alpha(playedColor),Color.red(playedColor),Color.blue(playedColor),Color.green(playedColor));
    remainingColor = ColorFiddler.setAlpha(res.getColor(R.color.colorPrimary), 100);

    playedColorEX = ColorFiddler.setAlpha(res.getColor(R.color.colorAccentFallbackDark), 255);
    remainingColorEX = ColorFiddler.setAlpha(res.getColor(R.color.colorAccent), 255);
    //We need to disable hardware acceleration for this layer,
    //since we need to fiddle with blending and shader combining
    //for the marquee text effect.
    //It also takes care of a bug with Paths.
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);

    prepareLayout();

    inst = this;

    refreshPlaying();
}

From source file:cn.edu.bit.bookstore.bookstore_android.widget.PullToRefreshLayout.java

/**
 * Set the color resources used in the progress animation from color resources.
 * The first color will also be the color of the bar that grows in response
 * to a user swipe gesture.//from  w ww .ja v a  2 s.  c  o  m
 *
 * @param colorResIds
 */
public void setColorSchemeResources(@ColorRes int... colorResIds) {
    final Resources res = getResources();
    int[] colorRes = new int[colorResIds.length];
    for (int i = 0; i < colorResIds.length; i++) {
        colorRes[i] = res.getColor(colorResIds[i]);
    }
    setColorSchemeColors(colorRes);
}

From source file:com.jtech.view.RefreshLayout.java

/**
 * Set the color resources used in the progress animation from color
 * resources. The first color will also be the color of the bar that grows
 * in response to a user swipe gesture./*from   w w  w .  ja va 2 s  . c om*/
 *
 * @param colorResIds
 */
@SuppressWarnings("deprecation")
public void setColorSchemeResources(@ColorRes int... colorResIds) {
    final Resources res = getResources();
    int[] colorRes = new int[colorResIds.length];
    for (int i = 0; i < colorResIds.length; i++) {
        colorRes[i] = res.getColor(colorResIds[i]);
    }
    setColorSchemeColors(colorRes);
}

From source file:com.mohamadamin.persianmaterialdatetimepicker.date.MonthView.java

public MonthView(Context context, AttributeSet attr, DatePickerController controller) {
    super(context, attr);
    mController = controller;//  ww w. j  a  v a  2 s  .c  o m
    Resources res = context.getResources();

    mDayLabelCalendar = new PersianCalendar();
    mPersianCalendar = new PersianCalendar();

    mDayOfWeekTypeface = res.getString(R.string.mdtp_day_of_week_label_typeface);
    mMonthTitleTypeface = res.getString(R.string.mdtp_sans_serif);

    boolean darkTheme = mController != null && mController.isThemeDark();
    if (darkTheme) {
        mDayTextColor = res.getColor(R.color.mdtp_date_picker_text_normal_dark_theme);
        mMonthDayTextColor = res.getColor(R.color.mdtp_date_picker_month_day_dark_theme);
        mDisabledDayTextColor = res.getColor(R.color.mdtp_date_picker_text_disabled_dark_theme);
        mHighlightedDayTextColor = res.getColor(R.color.mdtp_date_picker_text_highlighted_dark_theme);
    } else {
        mDayTextColor = res.getColor(R.color.mdtp_date_picker_text_normal);
        mMonthDayTextColor = res.getColor(R.color.mdtp_date_picker_month_day);
        mDisabledDayTextColor = res.getColor(R.color.mdtp_date_picker_text_disabled);
        mHighlightedDayTextColor = res.getColor(R.color.mdtp_date_picker_text_highlighted);
    }
    mSelectedDayTextColor = res.getColor(R.color.mdtp_white);
    mTodayNumberColor = res.getColor(R.color.mdtp_accent_color);
    mMonthTitleColor = res.getColor(R.color.mdtp_white);

    mStringBuilder = new StringBuilder(50);

    MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_day_number_size);
    MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_month_label_size);
    MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_month_day_label_text_size);
    MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.mdtp_month_list_item_header_height);
    DAY_SELECTED_CIRCLE_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_day_number_select_circle_radius);

    mRowHeight = (res.getDimensionPixelOffset(R.dimen.mdtp_date_picker_view_animator_height)
            - getMonthHeaderSize()) / MAX_NUM_ROWS;

    // Set up accessibility components.
    mTouchHelper = getMonthViewTouchHelper();
    ViewCompat.setAccessibilityDelegate(this, mTouchHelper);
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    mLockAccessibilityDelegate = true;

    // Sets up any standard paints that will be used
    initView();
}

From source file:ca.zadrox.dota2esportticker.service.ReminderAlarmService.java

private void notifyMatch(long matchId) {
    if (!PrefUtils.shouldShowMatchReminders(this)) {
        return;//from   ww w  . j  a  va  2 s.co m
    }

    final ContentResolver cr = getContentResolver();

    Cursor c = cr.query(MatchContract.SeriesEntry.CONTENT_URI, MatchDetailQuery.PROJECTION,
            SESSION_ID_WHERE_CLAUSE, new String[] { String.valueOf(matchId) }, null);

    if (!c.moveToNext()) {
        return;
    }

    Intent baseIntent = new Intent(this, MatchActivity.class);
    baseIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    TaskStackBuilder taskBuilder = TaskStackBuilder.create(this).addNextIntent(baseIntent);

    Intent matchIntent = new Intent(this, MatchDetailActivity.class);
    matchIntent.putExtra(MatchDetailActivity.ARGS_GG_MATCH_ID, matchId);
    taskBuilder.addNextIntent(matchIntent);

    PendingIntent pi = taskBuilder.getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT);

    final Resources res = getResources();
    String contentTitle = c.getString(MatchDetailQuery.TEAM_ONE_NAME) + " vs "
            + c.getString(MatchDetailQuery.TEAM_TWO_NAME);

    String contentText;

    long currentTime = TimeUtils.getUTCTime();
    long matchStart = c.getLong(MatchDetailQuery.DATE_TIME);

    int minutesLeft = (int) (matchStart - currentTime + 59000) / 60000;
    if (minutesLeft < 2 && minutesLeft >= 0) {
        minutesLeft = 1;
    }

    if (minutesLeft < 0) {
        contentText = "is scheduled to start now. (" + c.getString(MatchDetailQuery.TOURNAMENT_NAME) + ")";
    } else {
        contentText = "is scheduled to start in " + minutesLeft + " min. ("
                + c.getString(MatchDetailQuery.TOURNAMENT_NAME) + ")";
    }

    NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(this).setContentTitle(contentTitle)
            .setContentText(contentText).setColor(res.getColor(R.color.theme_primary))
            .setTicker(contentTitle + " is about to start.")
            .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE)
            .setLights(NOTIFICATION_ARGB_COLOR, NOTIFICATION_LED_ON_MS, NOTIFICATION_LED_OFF_MS)
            .setSmallIcon(R.drawable.ic_notification).setContentIntent(pi)
            .setPriority(Notification.PRIORITY_DEFAULT).setAutoCancel(true);

    NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    nm.notify(NOTIFICATION_ID, notifBuilder.build());
}

From source file:com.borax12.materialdaterangepicker.date.MonthView.java

public MonthView(Context context, AttributeSet attr, DatePickerController controller) {
    super(context, attr);
    mController = controller;//from w ww .  jav  a  2 s  .  c om
    Resources res = context.getResources();

    mDayLabelCalendar = Calendar.getInstance();
    mCalendar = Calendar.getInstance();

    mDayOfWeekTypeface = res.getString(R.string.mdtrp_day_of_week_label_typeface);
    mMonthTitleTypeface = res.getString(R.string.mdtrp_sans_serif);

    boolean darkTheme = mController != null && mController.isThemeDark();
    if (darkTheme) {
        mDayTextColor = res.getColor(R.color.mdtrp_date_picker_text_normal_dark_theme);
        mMonthDayTextColor = res.getColor(R.color.mdtrp_date_picker_month_day_dark_theme);
        mDisabledDayTextColor = res.getColor(R.color.mdtrp_date_picker_text_disabled_dark_theme);
        mHighlightedDayTextColor = res.getColor(R.color.mdtrp_date_picker_text_highlighted_dark_theme);
    } else {
        mDayTextColor = res.getColor(R.color.mdtrp_date_picker_text_normal);
        mMonthDayTextColor = res.getColor(R.color.mdtrp_date_picker_month_day);
        mDisabledDayTextColor = res.getColor(R.color.mdtrp_date_picker_text_disabled);
        mHighlightedDayTextColor = res.getColor(R.color.mdtrp_date_picker_text_highlighted);
    }
    mSelectedDayTextColor = res.getColor(R.color.mdtrp_white);
    mTodayNumberColor = res.getColor(R.color.mdtrp_accent_color);
    mMonthTitleColor = res.getColor(R.color.mdtrp_white);

    mStringBuilder = new StringBuilder(50);
    mFormatter = new Formatter(mStringBuilder, Locale.getDefault());

    MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtrp_day_number_size);
    MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtrp_month_label_size);
    MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtrp_month_day_label_text_size);
    MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.mdtrp_month_list_item_header_height);
    DAY_SELECTED_CIRCLE_SIZE = res.getDimensionPixelSize(R.dimen.mdtrp_day_number_select_circle_radius);

    mRowHeight = (res.getDimensionPixelOffset(R.dimen.mdtrp_date_picker_view_animator_height)
            - getMonthHeaderSize()) / MAX_NUM_ROWS;

    // Set up accessibility components.
    mTouchHelper = getMonthViewTouchHelper();
    ViewCompat.setAccessibilityDelegate(this, mTouchHelper);
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    mLockAccessibilityDelegate = true;

    // Sets up any standard paints that will be used
    initView();
}

From source file:com.borax12.materialdaterangepicker.multi.date.MonthView.java

public MonthView(Context context, AttributeSet attr, DatePickerController controller) {
    super(context, attr);
    mController = controller;/*from   w  w  w . j  a  v  a 2  s .  com*/
    Resources res = context.getResources();

    mDayLabelCalendar = Calendar.getInstance();
    mCalendar = Calendar.getInstance();

    mDayOfWeekTypeface = res.getString(R.string.mdtp_day_of_week_label_typeface);
    mMonthTitleTypeface = res.getString(R.string.mdtp_sans_serif);

    boolean darkTheme = mController != null && mController.isThemeDark();
    if (darkTheme) {
        mDayTextColor = res.getColor(R.color.mdtp_date_picker_text_normal_dark_theme);
        mMonthDayTextColor = res.getColor(R.color.mdtp_date_picker_month_day_dark_theme);
        mDisabledDayTextColor = res.getColor(R.color.mdtp_date_picker_text_disabled_dark_theme);
        mHighlightedDayTextColor = res.getColor(R.color.mdtp_date_picker_text_highlighted_dark_theme);
    } else {
        mDayTextColor = res.getColor(R.color.mdtp_date_picker_text_normal);
        mMonthDayTextColor = res.getColor(R.color.mdtp_date_picker_month_day);
        mDisabledDayTextColor = res.getColor(R.color.mdtp_date_picker_text_disabled);
        mHighlightedDayTextColor = res.getColor(R.color.mdtp_date_picker_text_highlighted);
    }
    mSelectedDayTextColor = res.getColor(R.color.mdtp_white);
    mTodayNumberColor = res.getColor(R.color.mdtp_accent_color);
    mMonthTitleColor = res.getColor(R.color.mdtp_white);

    mStringBuilder = new StringBuilder(50);
    mFormatter = new Formatter(mStringBuilder, Locale.getDefault());

    MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_day_number_size);
    MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_month_label_size);
    MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_month_day_label_text_size);
    MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.mdtp_month_list_item_header_height);
    DAY_SELECTED_CIRCLE_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_day_number_select_circle_radius);

    mRowHeight = (res.getDimensionPixelOffset(R.dimen.mdtp_date_picker_view_animator_height)
            - getMonthHeaderSize()) / MAX_NUM_ROWS;

    // Set up accessibility components.
    mTouchHelper = getMonthViewTouchHelper();
    ViewCompat.setAccessibilityDelegate(this, mTouchHelper);
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    mLockAccessibilityDelegate = true;

    // Sets up any standard paints that will be used
    initView();
}