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.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  v a 2s  . 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);
}

From source file:com.frostwire.android.gui.adapters.FileListAdapter.java

private void setNormalTextColors(View v) {
    if (inGridMode()) {
        return;/*  w  w  w  .j  av a 2  s.  c o m*/
    }
    TextView title = findView(v, R.id.view_my_files_thumbnail_list_image_item_file_title);
    TextView text = findView(v, R.id.view_my_files_thumbnail_list_image_item_extra_text);
    TextView size = findView(v, R.id.view_my_files_thumbnail_list_image_item_file_size);

    Resources res = getContext().getResources();

    // TODO: Fix deprecation warning when we hit API 23
    title.setTextColor(res.getColor(R.color.app_text_primary));
    text.setTextColor(res.getColor(R.color.app_text_primary));
    size.setTextColor(res.getColor(R.color.basic_blue_highlight_dark));
}

From source file:com.frostwire.android.gui.adapters.FileListAdapter.java

private void setInactiveTextColors(View v) {
    if (inGridMode()) {
        return;/*from  w  w  w.  j a va2  s.c om*/
    }
    TextView title = findView(v, R.id.view_my_files_thumbnail_list_image_item_file_title);
    TextView text = findView(v, R.id.view_my_files_thumbnail_list_image_item_extra_text);
    TextView size = findView(v, R.id.view_my_files_thumbnail_list_image_item_file_size);

    Resources res = getContext().getResources();

    // TODO: Fix deprecation warning when we hit API 23
    title.setTextColor(res.getColor(R.color.my_files_listview_item_inactive_foreground));
    text.setTextColor(res.getColor(R.color.my_files_listview_item_inactive_foreground));
    size.setTextColor(res.getColor(R.color.my_files_listview_item_inactive_foreground));
}

From source file:com.viewsforandroid.foundry.sample.indicators.NumericPageIndicator.java

@SuppressWarnings("deprecation")
public NumericPageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode()) {
        return;//from ww  w  .jav a 2  s. c o m
    }

    // Load defaults from resources
    final Resources res = getResources();
    final int defaultTextColor = res.getColor(R.color.default_page_number_indicator_text_color);
    final int defaultPageNumberTextColor = res
            .getColor(R.color.default_page_number_indicator_page_number_text_color);
    final boolean defaultPageNumberTextBold = res
            .getBoolean(R.bool.default_page_number_indicator_page_number_text_bold);
    final int defaultButtonPressedColor = res
            .getColor(R.color.default_page_number_indicator_pressed_button_color);
    final float defaultTopPadding = res.getDimension(R.dimen.default_page_number_indicator_top_padding);
    final float defaultBottomPadding = res.getDimension(R.dimen.default_page_number_indicator_bottom_padding);
    final float defaultTextSize = res.getDimension(R.dimen.default_page_number_indicator_text_size);
    final boolean defaultShowChangePageButtons = res
            .getBoolean(R.bool.default_page_number_indicator_show_change_page_buttons);
    final boolean defaultShowStartEndButtons = res
            .getBoolean(R.bool.default_page_number_indicator_show_start_end_buttons);

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

    mTextTemplate = a.getString(R.styleable.NumericPageIndicator_textTemplate);
    if (mTextTemplate == null) {
        mTextTemplate = res.getString(R.string.default_page_number_indicator_text_template);
        ;
    }
    parseTextTemplate();

    mTextStartButton = a.getString(R.styleable.NumericPageIndicator_startButtonText);
    if (mTextStartButton == null) {
        mTextStartButton = res.getString(R.string.default_page_number_indicator_start_button_text);
    }
    mTextEndButton = a.getString(R.styleable.NumericPageIndicator_endButtonText);
    if (mTextEndButton == null) {
        mTextEndButton = res.getString(R.string.default_page_number_indicator_end_button_text);
    }
    mTextPreviousButton = a.getString(R.styleable.NumericPageIndicator_previousButtonText);
    if (mTextPreviousButton == null) {
        mTextPreviousButton = res.getString(R.string.default_page_number_indicator_previous_button_text);
    }
    mTextNextButton = a.getString(R.styleable.NumericPageIndicator_nextButtonText);
    if (mTextNextButton == null) {
        mTextNextButton = res.getString(R.string.default_page_number_indicator_next_button_text);
    }

    mColorText = a.getColor(R.styleable.NumericPageIndicator_android_textColor, defaultTextColor);
    mColorPageNumberText = a.getColor(R.styleable.NumericPageIndicator_pageNumberTextColor,
            defaultPageNumberTextColor);
    mPageNumberTextBold = a.getBoolean(R.styleable.NumericPageIndicator_pageNumberTextBold,
            defaultPageNumberTextBold);
    mColorPressedButton = a.getColor(R.styleable.NumericPageIndicator_pressedButtonColor,
            defaultButtonPressedColor);
    mPaddingTop = a.getDimension(R.styleable.NumericPageIndicator_android_paddingTop, defaultTopPadding);
    mPaddingBottom = a.getDimension(R.styleable.NumericPageIndicator_android_paddingBottom,
            defaultBottomPadding);
    mPaintText.setColor(mColorText);
    mShowChangePageButtons = a.getBoolean(R.styleable.NumericPageIndicator_showChangePageButtons,
            defaultShowChangePageButtons);
    mShowStartEndButtons = a.getBoolean(R.styleable.NumericPageIndicator_showStartEndButtons,
            defaultShowStartEndButtons);

    mPaintButtonBackground.setColor(mColorPressedButton);
    final float textSize = a.getDimension(R.styleable.NumericPageIndicator_android_textSize, defaultTextSize);
    mPaintText.setTextSize(textSize);
    mPaintText.setAntiAlias(true);

    mPaintPageNumberText.setColor(mColorPageNumberText);
    mPaintPageNumberText.setTextSize(textSize);
    mPaintPageNumberText.setAntiAlias(true);
    if (mPageNumberTextBold) {
        mPaintPageNumberText.setTypeface(Typeface.DEFAULT_BOLD);
    }

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

    a.recycle();
}

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  . j  a  va2  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 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.maedi.user.godok.v1.viewpagerindicator.UnderlinePageIndicator.java

@SuppressWarnings("deprecation")
public UnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;/*from w  ww.j  av a 2  s. co  m*/

    final Resources res = getResources();

    //Load defaults from resources
    final boolean defaultFades = res
            .getBoolean(com.viewpagerindicator.R.bool.default_underline_indicator_fades);
    final int defaultFadeDelay = res
            .getInteger(com.viewpagerindicator.R.integer.default_underline_indicator_fade_delay);
    final int defaultFadeLength = res
            .getInteger(com.viewpagerindicator.R.integer.default_underline_indicator_fade_length);
    final int defaultSelectedColor = res
            .getColor(com.viewpagerindicator.R.color.default_underline_indicator_selected_color);

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

    setFades(a.getBoolean(com.viewpagerindicator.R.styleable.UnderlinePageIndicator_fades, defaultFades));
    setSelectedColor(a.getColor(com.viewpagerindicator.R.styleable.UnderlinePageIndicator_selectedColor,
            defaultSelectedColor));
    setFadeDelay(a.getInteger(com.viewpagerindicator.R.styleable.UnderlinePageIndicator_fadeDelay,
            defaultFadeDelay));
    setFadeLength(a.getInteger(com.viewpagerindicator.R.styleable.UnderlinePageIndicator_fadeLength,
            defaultFadeLength));

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

    a.recycle();

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

From source file:app.android.datetimepicker.date.SimpleMonthView.java

public SimpleMonthView(Context context) {
    super(context);

    Resources res = context.getResources();

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

    mDayOfWeekTypeface = res.getString(R.string.day_of_week_label_typeface);
    mMonthTitleTypeface = res.getString(R.string.sans_serif);

    mDayTextColor = res.getColor(R.color.date_picker_text_normal);
    mTodayNumberColor = res.getColor(R.color.blue);
    mMonthTitleColor = res.getColor(R.color.white);
    mMonthTitleBGColor = res.getColor(R.color.circle_background);

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

    MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.day_number_size);
    MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_label_size);
    MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_day_label_text_size);
    MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.month_list_item_header_height);
    DAY_SELECTED_CIRCLE_SIZE = res.getDimensionPixelSize(R.dimen.day_number_select_circle_radius);

    mRowHeight = (res.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height) - MONTH_HEADER_SIZE)
            / MAX_NUM_ROWS;/*from   ww w  .j a v  a  2 s.c o  m*/

    // Set up accessibility components.
    mTouchHelper = new MonthViewTouchHelper(this);
    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.limewoodmedia.nsdroid.activities.WorldAssembly.java

private void setUpChartRenderer(XYMultipleSeriesRenderer chartRenderer, XYSeriesRenderer forRenderer,
        XYSeriesRenderer againstRenderer) {
    Log.d(TAG, "Set up chart renderer");
    Resources r = getResources();
    float legendTextSize = r.getDimension(R.dimen.area_chart_legend_size);
    float labelTextSize = r.getDimension(R.dimen.area_chart_label_size);

    // For renderer
    forRenderer.setColor(r.getColor(R.color.wa_for));
    forRenderer.setChartValuesTextSize(legendTextSize);
    forRenderer.setDisplayChartValues(true);
    XYSeriesRenderer.FillOutsideLine line = new XYSeriesRenderer.FillOutsideLine(
            XYSeriesRenderer.FillOutsideLine.Type.BELOW);
    line.setColor(r.getColor(R.color.wa_for_below));
    forRenderer.addFillOutsideLine(line);

    againstRenderer.setColor(r.getColor(R.color.wa_against));
    againstRenderer.setChartValuesTextSize(legendTextSize);
    againstRenderer.setDisplayChartValues(true);
    line = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.Type.BELOW);
    line.setColor(r.getColor(R.color.wa_against_below));
    againstRenderer.addFillOutsideLine(line);

    chartRenderer.setZoomButtonsVisible(false);
    chartRenderer.setClickEnabled(true);
    chartRenderer.setInScroll(true);/*from   w  ww. j a  v  a  2 s.co  m*/
    chartRenderer.setAntialiasing(true);
    chartRenderer.setShowLegend(true);
    chartRenderer.setLegendTextSize(legendTextSize);
    chartRenderer.setLabelsTextSize(labelTextSize);
    chartRenderer.setTextTypeface(Typeface.DEFAULT);
    chartRenderer.setPanEnabled(false);
    chartRenderer.setShowLabels(true);
    chartRenderer.setXAxisMin(0);
    chartRenderer.setXAxisMax(24 * 4 + 1); // 1 per hour, 4 days, 1 at origo
    chartRenderer.setYAxisMin(0);
    chartRenderer.setXLabels(0);
    chartRenderer.setXLabelsAngle(-25);
    chartRenderer.setXLabelsAlign(Paint.Align.RIGHT);
    chartRenderer.setFitLegend(true);
    for (int i = 1; i < 5; i++) {
        chartRenderer.addXTextLabel(24 * i, i + " " + r.getQuantityString(R.plurals.days, i));
    }
    chartRenderer.setYLabels(0);
    chartRenderer.setGridColor(Color.WHITE);
    chartRenderer.setMarginsColor(Color.WHITE);
    chartRenderer.setMargins(new int[] { 0, 0, r.getDimensionPixelSize(R.dimen.area_chart_margin_bottom), 0 });
    chartRenderer.setBackgroundColor(Color.WHITE);
    chartRenderer.setApplyBackgroundColor(true);
    chartRenderer.removeAllRenderers();
    chartRenderer.addSeriesRenderer(forRenderer);
    chartRenderer.addSeriesRenderer(againstRenderer);
}

From source file:com.mobicage.rogerthat.plugins.friends.ServiceActionMenuActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    L.i("ServiceActionMenuActivity.onCreate");
    setContentView(R.layout.service_action_menu);
    Intent intent = getIntent();//from ww  w  .  j a va 2 s . c o  m
    email = intent.getStringExtra(SERVICE_EMAIL);
    page = intent.getIntExtra(MENU_PAGE, 0);
    activity = (RelativeLayout) findViewById(R.id.activity);
    title = (TextView) findViewById(R.id.title);
    badge = (TextView) findViewById(R.id.badge);
    branding = (WebView) findViewById(R.id.branding);
    branding.setWebViewClient(new WebViewClient() {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (url.startsWith("tel:")) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                startActivity(intent);
                return true;
            }
            return false;
        }

    });
    pages = (LinearLayout) findViewById(R.id.pages);
    Resources resources = getResources();
    darkSchemeTextColor = resources.getColor(android.R.color.primary_text_dark);
    lightSchemeTextColor = resources.getColor(android.R.color.primary_text_light);

    if (intent.getBooleanExtra(SHOW_ERROR_POPUP, false))
        UIUtils.showAlertDialog(this, null, R.string.error_please_try_again);

    findViewById(R.id.navigation_bar_home_button).setOnClickListener(new SafeViewOnClickListener() {
        @Override
        public void safeOnClick(View v) {
            long currentTime = System.currentTimeMillis();
            if (getLastTimeClicked() != 0
                    && currentTime < (getLastTimeClicked() + ServiceBoundActivity.DOUBLE_CLICK_TIMESPAN)) {
                L.d("ignoring click on home");
                return;
            }
            setLastTimeClicked(currentTime);
            Intent i = new Intent(ServiceActionMenuActivity.this, HomeActivity.class);
            i.setFlags(MainActivity.FLAG_CLEAR_STACK);
            startActivity(i);
            finish();
        }
    });

    goToMessagingActivityIfNeeded(intent);
}

From source file:com.diandi.widget.googledatetimepicker.date.SimpleMonthView.java

public SimpleMonthView(Context context) {
    super(context);

    Resources res = context.getResources();

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

    mDayOfWeekTypeface = res.getString(R.string.day_of_week_label_typeface);
    mMonthTitleTypeface = res.getString(R.string.sans_serif);

    mDayTextColor = res.getColor(R.color.date_picker_text_normal);
    mTodayNumberColor = res.getColor(R.color.blue);
    mMonthTitleColor = res.getColor(R.color.white);
    mMonthTitleBGColor = res.getColor(R.color.circle_background);

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

    MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.day_number_size);
    MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_label_size);
    MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_day_label_text_size);
    MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.month_list_item_header_height);
    DAY_SELECTED_CIRCLE_SIZE = res.getDimensionPixelSize(R.dimen.day_number_select_circle_radius);

    mRowHeight = (res.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height) - MONTH_HEADER_SIZE)
            / MAX_NUM_ROWS;//  ww w.java2  s .c  o  m

    // Set up accessibility components.
    mNodeProvider = new MonthViewNodeProvider(context, this);
    ViewCompat.setAccessibilityDelegate(this, mNodeProvider.getAccessibilityDelegate());
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    mLockAccessibilityDelegate = true;

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