List of usage examples for android.content.res TypedArray getColor
@ColorInt public int getColor(@StyleableRes int index, @ColorInt int defValue)
From source file:com.forecast.weather.activities.MainActivity.java
private void aboutDialog() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Forecast Weather"); final WebView webView = new WebView(this); String about = "<p>Forecast weather app.</p>" + "<p>Data provided by <a href='http://openweathermap.org/'>OpenWeatherMap</a>, under the <a href='http://creativecommons.org/licenses/by-sa/2.0/'>Creative Commons license</a>" + "<p>Icons are <a href='https://erikflowers.github.io/weather-icons/'>Weather Icons</a>, by <a href='http://www.twitter.com/artill'>Lukas Bischoff</a> under the <a href='http://scripts.sil.org/OFL'>SIL OFL 1.1</a> licence."; TypedArray ta = obtainStyledAttributes(new int[] { android.R.attr.textColorPrimary, R.attr.colorAccent }); String textColor = String.format("#%06X", (0xFFFFFF & ta.getColor(0, Color.BLACK))); String accentColor = String.format("#%06X", (0xFFFFFF & ta.getColor(1, Color.BLUE))); ta.recycle();/*from w w w . ja va 2 s.co m*/ about = "<style media=\"screen\" type=\"text/css\">" + "body {\n" + " color:" + textColor + ";\n" + "}\n" + "a:link {color:" + accentColor + "}\n" + "</style>" + about; webView.setBackgroundColor(Color.TRANSPARENT); webView.loadData(about, "text/html", "UTF-8"); alert.setView(webView, 32, 0, 32, 0); alert.setPositiveButton(R.string.dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alert.show(); }
From source file:com.bolaa.medical.view.banner.CirclePageIndicator.java
public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); //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, R.style.Widget_CirclePageIndicator); mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered); mOrientation = a.getInt(R.styleable.CirclePageIndicator_orientation, defaultOrientation); mPaintPageFill = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintPageFill.setStyle(Style.STROKE); mPaintPageFill.setStrokeWidth(1);// mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor)); mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintStroke.setStyle(Style.STROKE); mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor)); mPaintStroke//from w w w . j a va 2 s. com .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth)); mPaintFill = new Paint(Paint.ANTI_ALIAS_FLAG); 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); a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.c102c.app.ui.tabstrip.PagerSlidingTabStrip.java
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);/*from ww w . j a va 2 s . c o m*/ setWillNotDraw(false); tabsContainer = new LinearLayout(context); tabsContainer.setOrientation(LinearLayout.HORIZONTAL); tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); addView(tabsContainer); DisplayMetrics dm = getResources().getDisplayMetrics(); scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm); indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm); underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm); dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm); tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm); dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm); tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm); // get system attrs (android:textSize and android:textColor) TypedArray a = context.obtainStyledAttributes(attrs, ATTRS); // tabTextSize = a.getDimensionPixelSize(0, tabTextSize); // tabTextColor = a.getColor(1, tabTextColor); // // a.recycle(); // get custom attrs a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip); tabTextSize = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_tabTextSize, tabTextSize); tabTextColor = indicatorColor; selectedTabTextColor = a.getColor(R.styleable.PagerSlidingTabStrip_selectedTabTextColor, indicatorColor); //tab, indicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, indicatorColor); underlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, underlineColor); dividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, dividerColor); indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, indicatorHeight); underlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, underlineHeight); dividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, dividerPadding); tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, tabPadding); tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, tabBackgroundResId); shouldExpand = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, shouldExpand); scrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, scrollOffset); textAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTextAllCaps, textAllCaps); a.recycle(); rectPaint = new Paint(); rectPaint.setAntiAlias(true); rectPaint.setStyle(Style.FILL); dividerPaint = new Paint(); dividerPaint.setAntiAlias(true); dividerPaint.setStrokeWidth(dividerWidth); defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); expandedTabLayoutParams = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f); if (locale == null) { locale = getResources().getConfiguration().locale; } }
From source file:com.folioreader.ui.folio.activity.FolioActivity.java
private void initActionBar() { appBarLayout = findViewById(R.id.appBarLayout); toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar);/* w ww . j ava2 s . c om*/ actionBar = getSupportActionBar(); Config config = AppUtil.getSavedConfig(getApplicationContext()); assert config != null; Drawable drawable = ContextCompat.getDrawable(this, R.drawable.ic_drawer); UiUtil.setColorIntToDrawable(config.getThemeColor(), drawable); toolbar.setNavigationIcon(drawable); if (config.isNightMode()) { setNightMode(); } else { setDayMode(); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int color; if (config.isNightMode()) { color = ContextCompat.getColor(this, R.color.black); } else { int[] attrs = { android.R.attr.navigationBarColor }; TypedArray typedArray = getTheme().obtainStyledAttributes(attrs); color = typedArray.getColor(0, ContextCompat.getColor(this, R.color.white)); } getWindow().setNavigationBarColor(color); } if (Build.VERSION.SDK_INT < 16) { // Fix for appBarLayout.fitSystemWindows() not being called on API < 16 appBarLayout.setTopMargin(getStatusBarHeight()); } }
From source file:com.bolaa.sleepingbar.view.banner.LoopCirclePageIndicator.java
public LoopCirclePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); //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, R.style.Widget_CirclePageIndicator); mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered); mOrientation = a.getInt(R.styleable.CirclePageIndicator_orientation, defaultOrientation); mPaintPageFill = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintPageFill.setStyle(Style.FILL); mPaintPageFill.setStrokeWidth(3);//? mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor)); mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintStroke.setStyle(Style.FILL); mPaintStroke.setStyle(Style.STROKE); mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor)); mPaintStroke// www . j a v a 2 s . c o m .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth)); mPaintFill = new Paint(Paint.ANTI_ALIAS_FLAG); 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); a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.bolaa.medical.view.banner.LoopCirclePageIndicator.java
public LoopCirclePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); //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, R.style.Widget_CirclePageIndicator); mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered); mOrientation = a.getInt(R.styleable.CirclePageIndicator_orientation, defaultOrientation); mPaintPageFill = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintPageFill.setStyle(Style.FILL); // mPaintPageFill.setStrokeWidth(3);//? mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor)); mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintStroke.setStyle(Style.FILL); mPaintStroke.setStyle(Style.STROKE); mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor)); mPaintStroke/* w ww . jav a2 s . c om*/ .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth)); mPaintFill = new Paint(Paint.ANTI_ALIAS_FLAG); 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); a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.example.anumbrella.viewpager.LinePagerIndicator.java
public LinePagerIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); ////from ww w . 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:com.ryan.ryanreader.reddit.prepared.RedditPreparedPost.java
private void rebuildSubtitle(Context context) { // TODO customise display // TODO preference for the X days, X hours thing final TypedArray appearance = context.obtainStyledAttributes(new int[] { R.attr.rrPostSubtitleBoldCol, R.attr.rrPostSubtitleUpvoteCol, R.attr.rrPostSubtitleDownvoteCol }); final int boldCol = appearance.getColor(0, 255), rrPostSubtitleUpvoteCol = appearance.getColor(1, 255), rrPostSubtitleDownvoteCol = appearance.getColor(2, 255); final BetterSSB postListDescSb = new BetterSSB(); final int pointsCol; int score = src.score; if (Boolean.TRUE.equals(src.likes)) score--;/*from w ww .j a v a 2s . c om*/ if (Boolean.FALSE.equals(src.likes)) score++; if (isUpvoted()) { pointsCol = rrPostSubtitleUpvoteCol; score++; } else if (isDownvoted()) { pointsCol = rrPostSubtitleDownvoteCol; score--; } else { pointsCol = boldCol; } if (src.over_18) { postListDescSb.append(" NSFW ", BetterSSB.BOLD | BetterSSB.FOREGROUND_COLOR | BetterSSB.BACKGROUND_COLOR, Color.WHITE, Color.RED, 1f); // TODO color? postListDescSb.append(" ", 0); } postListDescSb.append(String.valueOf(score), BetterSSB.BOLD | BetterSSB.FOREGROUND_COLOR, pointsCol, 0, 1f); postListDescSb.append(" " + context.getString(R.string.subtitle_points) + " ", 0); postListDescSb.append( RRTime.formatDurationMsAgo(context, RRTime.utcCurrentTimeMillis() - src.created_utc * 1000), BetterSSB.BOLD | BetterSSB.FOREGROUND_COLOR, boldCol, 0, 1f); postListDescSb.append(" " + context.getString(R.string.subtitle_by) + " ", 0); postListDescSb.append(src.author, BetterSSB.BOLD | BetterSSB.FOREGROUND_COLOR, boldCol, 0, 1f); if (showSubreddit) { postListDescSb.append(" " + context.getString(R.string.subtitle_to) + " ", 0); postListDescSb.append(src.subreddit, BetterSSB.BOLD | BetterSSB.FOREGROUND_COLOR, boldCol, 0, 1f); } postListDescSb.append(" (" + src.domain + ")", 0); postListDescription = postListDescSb.get(); }
From source file:com.example.anumbrella.viewpager.CirclePagerIndicator.java
public CirclePagerIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); ////from ww w . j a v a 2 s . c om if (isInEditMode()) { return; } //?? 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); //xml TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.CirclePagerIndicator, defStyle, 0); mCentered = array.getBoolean(R.styleable.CirclePagerIndicator_centered, defaultCentered); mOrientation = array.getInteger(R.styleable.CirclePagerIndicator_android_orientation, defaultOrientation); // mPaintPageFill.setStyle(Paint.Style.FILL); // mPaintPageFill.setColor(array.getColor(R.styleable.CirclePagerIndicator_pageColor, defaultPageColor)); // mPaintFill.setStyle(Paint.Style.FILL); // mPaintFill.setColor(array.getColor(R.styleable.CirclePagerIndicator_fillColor, defaultFillColor)); // mPaintStroke.setColor(array.getColor(R.styleable.CirclePagerIndicator_strokeColor, defaultStrokeColor)); //(??) mPaintStroke.setStyle(Paint.Style.STROKE); // mPaintStroke.setStrokeWidth( array.getDimension(R.styleable.CirclePagerIndicator_strokeWidth, defaultStrokeWidth)); //??? mRadius = array.getDimension(R.styleable.CirclePagerIndicator_radius, defaultRadius); //? mSnap = array.getBoolean(R.styleable.CirclePagerIndicator_snap, defaultSnap); Drawable background = array.getDrawable(R.styleable.CirclePagerIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } array.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.appsimobile.appsii.module.appsiagenda.MonthView.java
public MonthView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mDayLabelCalendar = Calendar.getInstance(); mCalendar = Calendar.getInstance(); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MonthView, 0, R.style.MonthViewStyle); mDayOfWeekTypeface = a.getString(R.styleable.MonthView_monthview_dayOfWeekTypeface); mMonthTitleTypeface = a.getString(R.styleable.MonthView_monthview_monthTitleTypeface); mDayTextColor = a.getColor(R.styleable.MonthView_monthview_dayTextColor, 0xFF999999); mTodayNumberColor = a.getColor(R.styleable.MonthView_monthview_todayNumberColor, 0xFF33b5e5); mDisabledDayTextColor = a.getColor(R.styleable.MonthView_monthview_disabledDayTextColor, 0xFFcccccc); mMonthTitleColor = a.getColor(R.styleable.MonthView_monthview_monthTitleColor, 0xFFFFFFFF); mMonthTitleBGColor = a.getColor(R.styleable.MonthView_monthview_monthTitleBGColor, 0xFFF2F2F2); MINI_DAY_NUMBER_TEXT_SIZE = a.getDimensionPixelSize(R.styleable.MonthView_monthview_miniDayNumberTextSize, 24);//ww w.jav a2 s . c om MONTH_LABEL_TEXT_SIZE = a.getDimensionPixelSize(R.styleable.MonthView_monthview_monthLabelTextSize, 24); MONTH_DAY_LABEL_TEXT_SIZE = a.getDimensionPixelSize(R.styleable.MonthView_monthview_monthDayLabelTextSize, 24); MONTH_HEADER_SIZE = a.getDimensionPixelOffset(R.styleable.MonthView_monthview_headerSize, 24); DAY_SELECTED_CIRCLE_SIZE = a.getDimensionPixelSize(R.styleable.MonthView_monthview_daySelectedCircleSize, 24); mRowHeight = (a.getDimensionPixelOffset(R.styleable.MonthView_monthview_viewHeight, 24) - getMonthHeaderSize()) / MAX_NUM_ROWS; a.recycle(); mStringBuilder = new StringBuilder(50); mFormatter = new Formatter(mStringBuilder, Locale.getDefault()); if (!isInEditMode()) { // Set up accessibility components. mTouchHelper = getMonthViewTouchHelper(); ViewCompat.setAccessibilityDelegate(this, mTouchHelper); ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); mLockAccessibilityDelegate = true; } else { mTouchHelper = null; } // Sets up any standard paints that will be used initView(); }