List of usage examples for android.graphics Typeface NORMAL
int NORMAL
To view the source code for android.graphics Typeface NORMAL.
Click Source Link
From source file:io.doist.datetimepicker.time.RadialTimePickerView.java
public RadialTimePickerView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); // Pull disabled alpha from theme. final TypedValue outValue = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.disabledAlpha, outValue, true); mDisabledAlpha = (int) (outValue.getFloat() * 255 + 0.5f); // process style attributes final Resources res = getResources(); final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.TimePicker, defStyleAttr, 0); mTypeface = Typeface.create("sans-serif", Typeface.NORMAL); // Initialize all alpha values to opaque. for (int i = 0; i < mAlpha.length; i++) { mAlpha[i] = new IntHolder(ALPHA_OPAQUE); }//from w w w .ja va2 s. co m for (int i = 0; i < mAlphaSelector.length; i++) { for (int j = 0; j < mAlphaSelector[i].length; j++) { mAlphaSelector[i][j] = new IntHolder(ALPHA_OPAQUE); } } final int numbersTextColor = a.getColor(R.styleable.TimePicker_numbersTextColor, res.getColor(R.color.timepicker_default_text_color_material)); mPaint[HOURS] = new Paint(); mPaint[HOURS].setAntiAlias(true); mPaint[HOURS].setTextAlign(Paint.Align.CENTER); mColor[HOURS] = numbersTextColor; mPaint[MINUTES] = new Paint(); mPaint[MINUTES].setAntiAlias(true); mPaint[MINUTES].setTextAlign(Paint.Align.CENTER); mColor[MINUTES] = numbersTextColor; mPaintCenter.setColor(numbersTextColor); mPaintCenter.setAntiAlias(true); mPaintCenter.setTextAlign(Paint.Align.CENTER); mPaintSelector[HOURS][SELECTOR_CIRCLE] = new Paint(); mPaintSelector[HOURS][SELECTOR_CIRCLE].setAntiAlias(true); mColorSelector[HOURS][SELECTOR_CIRCLE] = a.getColor(R.styleable.TimePicker_numbersSelectorColor, R.color.timepicker_default_selector_color_material); mPaintSelector[HOURS][SELECTOR_DOT] = new Paint(); mPaintSelector[HOURS][SELECTOR_DOT].setAntiAlias(true); mColorSelector[HOURS][SELECTOR_DOT] = a.getColor(R.styleable.TimePicker_numbersSelectorColor, R.color.timepicker_default_selector_color_material); mPaintSelector[HOURS][SELECTOR_LINE] = new Paint(); mPaintSelector[HOURS][SELECTOR_LINE].setAntiAlias(true); mPaintSelector[HOURS][SELECTOR_LINE].setStrokeWidth(2); mColorSelector[HOURS][SELECTOR_LINE] = a.getColor(R.styleable.TimePicker_numbersSelectorColor, R.color.timepicker_default_selector_color_material); mPaintSelector[MINUTES][SELECTOR_CIRCLE] = new Paint(); mPaintSelector[MINUTES][SELECTOR_CIRCLE].setAntiAlias(true); mColorSelector[MINUTES][SELECTOR_CIRCLE] = a.getColor(R.styleable.TimePicker_numbersSelectorColor, R.color.timepicker_default_selector_color_material); mPaintSelector[MINUTES][SELECTOR_DOT] = new Paint(); mPaintSelector[MINUTES][SELECTOR_DOT].setAntiAlias(true); mColorSelector[MINUTES][SELECTOR_DOT] = a.getColor(R.styleable.TimePicker_numbersSelectorColor, R.color.timepicker_default_selector_color_material); mPaintSelector[MINUTES][SELECTOR_LINE] = new Paint(); mPaintSelector[MINUTES][SELECTOR_LINE].setAntiAlias(true); mPaintSelector[MINUTES][SELECTOR_LINE].setStrokeWidth(2); mColorSelector[MINUTES][SELECTOR_LINE] = a.getColor(R.styleable.TimePicker_numbersSelectorColor, R.color.timepicker_default_selector_color_material); mPaintBackground.setColor(a.getColor(R.styleable.TimePicker_numbersBackgroundColor, res.getColor(R.color.timepicker_default_numbers_background_color_material))); mPaintBackground.setAntiAlias(true); if (DEBUG) { mPaintDebug.setColor(DEBUG_COLOR); mPaintDebug.setAntiAlias(true); mPaintDebug.setStrokeWidth(DEBUG_STROKE_WIDTH); mPaintDebug.setStyle(Paint.Style.STROKE); mPaintDebug.setTextAlign(Paint.Align.CENTER); } mShowHours = true; mIs24HourMode = false; mAmOrPm = AM; // Set up accessibility components. mTouchHelper = new RadialPickerTouchHelper(); ViewCompat.setAccessibilityDelegate(this, mTouchHelper); if (getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) { setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); } initHoursAndMinutesText(); initData(); mTransitionMidRadiusMultiplier = Float .parseFloat(res.getString(R.string.timepicker_transition_mid_radius_multiplier)); mTransitionEndRadiusMultiplier = Float .parseFloat(res.getString(R.string.timepicker_transition_end_radius_multiplier)); mTextGridHeights[HOURS] = new float[7]; mTextGridHeights[MINUTES] = new float[7]; mSelectionRadiusMultiplier = Float .parseFloat(res.getString(R.string.timepicker_selection_radius_multiplier)); a.recycle(); setOnTouchListener(this); setClickable(true); // Initial values final Calendar calendar = Calendar.getInstance(Locale.getDefault()); final int currentHour = calendar.get(Calendar.HOUR_OF_DAY); final int currentMinute = calendar.get(Calendar.MINUTE); setCurrentHourInternal(currentHour, false, false); setCurrentMinuteInternal(currentMinute, false); setHapticFeedbackEnabled(true); }
From source file:com.layer.atlas.AtlasMessagesList.java
public void parseStyle(Context context, AttributeSet attrs, int defStyle) { TypedArray ta = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AtlasMessageList, R.attr.AtlasMessageList, defStyle); this.myTextColor = ta.getColor(R.styleable.AtlasMessageList_myTextColor, context.getResources().getColor(R.color.atlas_text_black)); this.myTextStyle = ta.getInt(R.styleable.AtlasMessageList_myTextStyle, Typeface.NORMAL); String myTextTypefaceName = ta.getString(R.styleable.AtlasMessageList_myTextTypeface); this.myTextTypeface = myTextTypefaceName != null ? Typeface.create(myTextTypefaceName, myTextStyle) : null; //this.myTextSize = ta.getDimension(R.styleable.AtlasMessageList_myTextSize, context.getResources().getDimension(R.dimen.atlas_text_size_general)); this.otherTextColor = ta.getColor(R.styleable.AtlasMessageList_theirTextColor, context.getResources().getColor(R.color.atlas_text_black)); this.otherTextStyle = ta.getInt(R.styleable.AtlasMessageList_theirTextStyle, Typeface.NORMAL); String otherTextTypefaceName = ta.getString(R.styleable.AtlasMessageList_theirTextTypeface); this.otherTextTypeface = otherTextTypefaceName != null ? Typeface.create(otherTextTypefaceName, otherTextStyle) : null;// w ww . j a v a 2s . c om //this.otherTextSize = ta.getDimension(R.styleable.AtlasMessageList_theirTextSize, context.getResources().getDimension(R.dimen.atlas_text_size_general)); this.myBubbleColor = ta.getColor(R.styleable.AtlasMessageList_myBubbleColor, context.getResources().getColor(R.color.atlas_bubble_blue)); this.otherBubbleColor = ta.getColor(R.styleable.AtlasMessageList_theirBubbleColor, context.getResources().getColor(R.color.atlas_background_gray)); this.dateTextColor = ta.getColor(R.styleable.AtlasMessageList_dateTextColor, context.getResources().getColor(R.color.atlas_text_gray)); this.avatarTextColor = ta.getColor(R.styleable.AtlasMessageList_avatarTextColor, context.getResources().getColor(R.color.atlas_text_black)); this.avatarBackgroundColor = ta.getColor(R.styleable.AtlasMessageList_avatarBackgroundColor, context.getResources().getColor(R.color.atlas_background_gray)); ta.recycle(); }
From source file:com.philliphsu.bottomsheetpickers.date.MonthView.java
/** * Sets up the text and style properties for painting. Override this if you * want to use a different paint.//from w w w. j av a 2 s . com */ protected void initView() { mMonthTitlePaint = new Paint(); mMonthTitlePaint.setFakeBoldText(true); mMonthTitlePaint.setAntiAlias(true); mMonthTitlePaint.setTextSize(MONTH_LABEL_TEXT_SIZE); mMonthTitlePaint.setTypeface(Typeface.create(mMonthTitleTypeface, Typeface.BOLD)); mMonthTitlePaint.setColor(mDayTextColor); mMonthTitlePaint.setTextAlign(Align.CENTER); mMonthTitlePaint.setStyle(Style.FILL); mMonthTitleBGPaint = new Paint(); mMonthTitleBGPaint.setFakeBoldText(true); mMonthTitleBGPaint.setAntiAlias(true); mMonthTitleBGPaint.setColor(mMonthTitleBGColor); mMonthTitleBGPaint.setTextAlign(Align.CENTER); mMonthTitleBGPaint.setStyle(Style.FILL); mSelectedCirclePaint = new Paint(); mSelectedCirclePaint.setFakeBoldText(true); mSelectedCirclePaint.setAntiAlias(true); mSelectedCirclePaint.setColor(mTodayNumberColor); mSelectedCirclePaint.setTextAlign(Align.CENTER); mSelectedCirclePaint.setStyle(Style.FILL); mSelectedCirclePaint.setAlpha(SELECTED_CIRCLE_ALPHA); mMonthDayLabelPaint = new Paint(); mMonthDayLabelPaint.setAntiAlias(true); mMonthDayLabelPaint.setTextSize(MONTH_DAY_LABEL_TEXT_SIZE); mMonthDayLabelPaint.setColor(mMonthDayLabelTextColor); mMonthDayLabelPaint.setTypeface(Typeface.create(mDayOfWeekTypeface, Typeface.NORMAL)); mMonthDayLabelPaint.setStyle(Style.FILL); mMonthDayLabelPaint.setTextAlign(Align.CENTER); mMonthDayLabelPaint.setFakeBoldText(true); mMonthNumPaint = new Paint(); mMonthNumPaint.setAntiAlias(true); mMonthNumPaint.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE); mMonthNumPaint.setStyle(Style.FILL); mMonthNumPaint.setTextAlign(Align.CENTER); mMonthNumPaint.setFakeBoldText(false); }
From source file:com.appeaser.sublimepickerlibrary.timepicker.RadialTimePickerView.java
private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) { Context context = getContext(); // Pull disabled alpha from theme. final TypedValue outValue = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.disabledAlpha, outValue, true); mDisabledAlpha = outValue.getFloat(); // process style attributes final Resources res = getResources(); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RadialTimePickerView, defStyleAttr, defStyleRes);//from w ww . ja v a 2 s.co m mTypeface = Typeface.create("sans-serif", Typeface.NORMAL); // Initialize all alpha values to opaque. for (int i = 0; i < mAlpha.length; i++) { mAlpha[i] = new IntHolder(ALPHA_OPAQUE); } mTextColor[HOURS] = a.getColorStateList(R.styleable.RadialTimePickerView_spNumbersTextColor); mTextColor[HOURS_INNER] = a.getColorStateList(R.styleable.RadialTimePickerView_spNumbersInnerTextColor); mTextColor[MINUTES] = mTextColor[HOURS]; mPaint[HOURS] = new Paint(); mPaint[HOURS].setAntiAlias(true); mPaint[HOURS].setTextAlign(Paint.Align.CENTER); mPaint[MINUTES] = new Paint(); mPaint[MINUTES].setAntiAlias(true); mPaint[MINUTES].setTextAlign(Paint.Align.CENTER); final ColorStateList selectorColors = a .getColorStateList(R.styleable.RadialTimePickerView_spNumbersSelectorColor); int selectorActivatedColor = Color.BLACK; if (selectorColors != null) { selectorActivatedColor = selectorColors .getColorForState(SUtils.resolveStateSet(SUtils.STATE_ENABLED | SUtils.STATE_ACTIVATED), 0); } mPaintCenter.setColor(selectorActivatedColor); mPaintCenter.setAntiAlias(true); final int[] activatedStateSet = SUtils.resolveStateSet(SUtils.STATE_ENABLED | SUtils.STATE_ACTIVATED); mSelectorColor = selectorActivatedColor; mSelectorDotColor = mTextColor[HOURS].getColorForState(activatedStateSet, 0); mPaintSelector[HOURS][SELECTOR_CIRCLE] = new Paint(); mPaintSelector[HOURS][SELECTOR_CIRCLE].setAntiAlias(true); mPaintSelector[HOURS][SELECTOR_DOT] = new Paint(); mPaintSelector[HOURS][SELECTOR_DOT].setAntiAlias(true); mPaintSelector[HOURS][SELECTOR_LINE] = new Paint(); mPaintSelector[HOURS][SELECTOR_LINE].setAntiAlias(true); mPaintSelector[HOURS][SELECTOR_LINE].setStrokeWidth(2); mPaintSelector[MINUTES][SELECTOR_CIRCLE] = new Paint(); mPaintSelector[MINUTES][SELECTOR_CIRCLE].setAntiAlias(true); mPaintSelector[MINUTES][SELECTOR_DOT] = new Paint(); mPaintSelector[MINUTES][SELECTOR_DOT].setAntiAlias(true); mPaintSelector[MINUTES][SELECTOR_LINE] = new Paint(); mPaintSelector[MINUTES][SELECTOR_LINE].setAntiAlias(true); mPaintSelector[MINUTES][SELECTOR_LINE].setStrokeWidth(2); mPaintBackground.setColor(a.getColor(R.styleable.RadialTimePickerView_spNumbersBackgroundColor, ContextCompat.getColor(context, R.color.timepicker_default_numbers_background_color_material))); mPaintBackground.setAntiAlias(true); mSelectorRadius = res.getDimensionPixelSize(R.dimen.sp_timepicker_selector_radius); mSelectorStroke = res.getDimensionPixelSize(R.dimen.sp_timepicker_selector_stroke); mSelectorDotRadius = res.getDimensionPixelSize(R.dimen.sp_timepicker_selector_dot_radius); mCenterDotRadius = res.getDimensionPixelSize(R.dimen.sp_timepicker_center_dot_radius); mTextSize[HOURS] = res.getDimensionPixelSize(R.dimen.sp_timepicker_text_size_normal); mTextSize[MINUTES] = res.getDimensionPixelSize(R.dimen.sp_timepicker_text_size_normal); mTextSize[HOURS_INNER] = res.getDimensionPixelSize(R.dimen.sp_timepicker_text_size_inner); mTextInset[HOURS] = res.getDimensionPixelSize(R.dimen.sp_timepicker_text_inset_normal); mTextInset[MINUTES] = res.getDimensionPixelSize(R.dimen.sp_timepicker_text_inset_normal); mTextInset[HOURS_INNER] = res.getDimensionPixelSize(R.dimen.sp_timepicker_text_inset_inner); mShowHours = true; mIs24HourMode = false; mAmOrPm = AM; // Set up accessibility components. mTouchHelper = new RadialPickerTouchHelper(); ViewCompat.setAccessibilityDelegate(this, mTouchHelper); if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); } initHoursAndMinutesText(); initData(); a.recycle(); // Initial values final Calendar calendar = Calendar.getInstance(Locale.getDefault()); final int currentHour = calendar.get(Calendar.HOUR_OF_DAY); final int currentMinute = calendar.get(Calendar.MINUTE); setCurrentHourInternal(currentHour, false, false); setCurrentMinuteInternal(currentMinute, false); setHapticFeedbackEnabled(true); }
From source file:com.tr4android.support.extension.picker.time.RadialTimePickerView.java
public RadialTimePickerView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs); // Pull disabled alpha from theme. final TypedValue outValue = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.disabledAlpha, outValue, true); mDisabledAlpha = outValue.getFloat(); // process style attributes final Resources res = getResources(); final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.TimePickerDialog, defStyleAttr, defStyleRes);/*from www . j a v a2 s . com*/ mTypeface = Typeface.create("sans-serif", Typeface.NORMAL); // Initialize all alpha values to opaque. for (int i = 0; i < mAlpha.length; i++) { mAlpha[i] = new IntHolder(ALPHA_OPAQUE); } mTextColor[HOURS] = a.getColorStateList(R.styleable.TimePickerDialog_numbersTextColor); if (mTextColor[HOURS] == null) { mTextColor[HOURS] = PickerThemeUtils.getTextColorPrimaryActivatedStateList(context); } mTextColor[HOURS_INNER] = a.getColorStateList(R.styleable.TimePickerDialog_numbersInnerTextColor); if (mTextColor[HOURS_INNER] == null) { mTextColor[HOURS_INNER] = PickerThemeUtils.getTextColorSecondaryActivatedStateList(context); } mTextColor[MINUTES] = mTextColor[HOURS]; mPaint[HOURS] = new Paint(); mPaint[HOURS].setAntiAlias(true); mPaint[HOURS].setTextAlign(Paint.Align.CENTER); mPaint[MINUTES] = new Paint(); mPaint[MINUTES].setAntiAlias(true); mPaint[MINUTES].setTextAlign(Paint.Align.CENTER); final int[] selectedStateSet = new int[] { android.R.attr.state_enabled, android.R.attr.state_selected }; // Set up number selected color, if available. final ColorStateList numbersSelectorColor; if (a.hasValue(R.styleable.TimePickerDialog_numbersSelectorColor)) { numbersSelectorColor = a.getColorStateList(R.styleable.TimePickerDialog_numbersSelectorColor); } else { final TypedArray ta = context.obtainStyledAttributes(new int[] { R.attr.colorControlActivated }); numbersSelectorColor = ta.getColorStateList(0); ta.recycle(); } final int selectorActivatedColor = numbersSelectorColor.getColorForState(selectedStateSet, 0); mPaintCenter.setColor(selectorActivatedColor); mPaintCenter.setAntiAlias(true); mSelectorColor = selectorActivatedColor; mSelectorDotColor = mTextColor[HOURS].getColorForState(selectedStateSet, 0); mPaintSelector[HOURS][SELECTOR_CIRCLE] = new Paint(); mPaintSelector[HOURS][SELECTOR_CIRCLE].setAntiAlias(true); mPaintSelector[HOURS][SELECTOR_DOT] = new Paint(); mPaintSelector[HOURS][SELECTOR_DOT].setAntiAlias(true); mPaintSelector[HOURS][SELECTOR_LINE] = new Paint(); mPaintSelector[HOURS][SELECTOR_LINE].setAntiAlias(true); mPaintSelector[HOURS][SELECTOR_LINE].setStrokeWidth(2); mPaintSelector[MINUTES][SELECTOR_CIRCLE] = new Paint(); mPaintSelector[MINUTES][SELECTOR_CIRCLE].setAntiAlias(true); mPaintSelector[MINUTES][SELECTOR_DOT] = new Paint(); mPaintSelector[MINUTES][SELECTOR_DOT].setAntiAlias(true); mPaintSelector[MINUTES][SELECTOR_LINE] = new Paint(); mPaintSelector[MINUTES][SELECTOR_LINE].setAntiAlias(true); mPaintSelector[MINUTES][SELECTOR_LINE].setStrokeWidth(2); mPaintBackground.setColor(a.getColor(R.styleable.TimePickerDialog_numbersBackgroundColor, ContextCompat.getColor(context, android.R.color.transparent))); mPaintBackground.setAntiAlias(true); mSelectorRadius = res.getDimensionPixelSize(R.dimen.timepicker_selector_radius); mSelectorStroke = res.getDimensionPixelSize(R.dimen.timepicker_selector_stroke); mSelectorDotRadius = res.getDimensionPixelSize(R.dimen.timepicker_selector_dot_radius); mCenterDotRadius = res.getDimensionPixelSize(R.dimen.timepicker_center_dot_radius); mTextSize[HOURS] = res.getDimensionPixelSize(R.dimen.timepicker_text_size_normal); mTextSize[MINUTES] = res.getDimensionPixelSize(R.dimen.timepicker_text_size_normal); mTextSize[HOURS_INNER] = res.getDimensionPixelSize(R.dimen.timepicker_text_size_inner); mTextInset[HOURS] = res.getDimensionPixelSize(R.dimen.timepicker_text_inset_normal); mTextInset[MINUTES] = res.getDimensionPixelSize(R.dimen.timepicker_text_inset_normal); mTextInset[HOURS_INNER] = res.getDimensionPixelSize(R.dimen.timepicker_text_inset_inner); mShowHours = true; mIs24HourMode = false; mAmOrPm = AM; // Set up accessibility components. mTouchHelper = new RadialPickerTouchHelper(); ViewCompat.setAccessibilityDelegate(this, mTouchHelper); if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); } initHoursAndMinutesText(); initData(); a.recycle(); // Initial values final Calendar calendar = Calendar.getInstance(Locale.getDefault()); final int currentHour = calendar.get(Calendar.HOUR_OF_DAY); final int currentMinute = calendar.get(Calendar.MINUTE); setCurrentHourInternal(currentHour, false, false); setCurrentMinuteInternal(currentMinute, false); setHapticFeedbackEnabled(true); }
From source file:com.mattfred.betterpickers.calendardatepicker.MonthView.java
/** * Sets up the text and style properties for painting. Override this if you want to use a different paint. *///from ww w . j a v a 2s .c om protected void initView() { mMonthTitlePaint = new Paint(); mMonthTitlePaint.setFakeBoldText(true); mMonthTitlePaint.setAntiAlias(true); mMonthTitlePaint.setTextSize(MONTH_LABEL_TEXT_SIZE); mMonthTitlePaint.setTypeface(Typeface.create(mMonthTitleTypeface, Typeface.BOLD)); mMonthTitlePaint.setColor(mDayTextColorEnabled); mMonthTitlePaint.setTextAlign(Align.CENTER); mMonthTitlePaint.setStyle(Style.FILL); mMonthTitleBGPaint = new Paint(); mMonthTitleBGPaint.setFakeBoldText(true); mMonthTitleBGPaint.setAntiAlias(true); mMonthTitleBGPaint.setColor(mMonthTitleBGColor); mMonthTitleBGPaint.setTextAlign(Align.CENTER); mMonthTitleBGPaint.setStyle(Style.FILL); mSelectedCirclePaint = new Paint(); mSelectedCirclePaint.setFakeBoldText(true); mSelectedCirclePaint.setAntiAlias(true); mSelectedCirclePaint.setColor(mTodayNumberColor); mSelectedCirclePaint.setTextAlign(Align.CENTER); mSelectedCirclePaint.setStyle(Style.FILL); mSelectedCirclePaint.setAlpha(SELECTED_CIRCLE_ALPHA); mDisabledDaySquarePaint = new Paint(); mDisabledDaySquarePaint.setFakeBoldText(true); mDisabledDaySquarePaint.setAntiAlias(true); mDisabledDaySquarePaint.setColor(mDisabledDayColor); mDisabledDaySquarePaint.setTextAlign(Align.CENTER); mDisabledDaySquarePaint.setStyle(Style.FILL); mDisabledDaySquarePaint.setAlpha(DISABLED_DAY_SQUARE_ALPHA); mMonthDayLabelPaint = new Paint(); mMonthDayLabelPaint.setAntiAlias(true); mMonthDayLabelPaint.setTextSize(MONTH_DAY_LABEL_TEXT_SIZE); mMonthDayLabelPaint.setColor(mDayTextColorEnabled); mMonthDayLabelPaint.setTypeface(Typeface.create(mDayOfWeekTypeface, Typeface.NORMAL)); mMonthDayLabelPaint.setStyle(Style.FILL); mMonthDayLabelPaint.setTextAlign(Align.CENTER); mMonthDayLabelPaint.setFakeBoldText(true); mMonthNumPaint = new Paint(); mMonthNumPaint.setAntiAlias(true); mMonthNumPaint.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE); mMonthNumPaint.setStyle(Style.FILL); mMonthNumPaint.setTextAlign(Align.CENTER); mMonthNumPaint.setFakeBoldText(false); }
From source file:com.taobao.weex.dom.WXStyle.java
public static int getFontWeight(Map<String, Object> style) { int typeface = android.graphics.Typeface.NORMAL; if (style != null) { Object temp = style.get(Constants.Name.FONT_WEIGHT); if (temp != null) { String fontWeight = temp.toString(); switch (fontWeight) { case "600": case "700": case "800": case "900": case Constants.Value.BOLD: typeface = Typeface.BOLD; break; }//from w w w . ja v a2 s . co m } } return typeface; }
From source file:io.karim.materialtabs.sample.TabsActivity.java
private String getStyleFromStyleInt(int styleInt) { switch (styleInt) { case Typeface.BOLD: default:// w w w. ja v a 2s .c o m return "bold"; case Typeface.ITALIC: return "italic"; case Typeface.NORMAL: return "normal"; } }
From source file:com.codetroopers.betterpickers.calendardatepicker.MonthView.java
/** * Sets up the text and style properties for painting. Override this if you want to use a different paint. *//*from ww w. ja va 2 s. c o m*/ protected void initView() { mMonthTitlePaint = new Paint(); mMonthTitlePaint.setFakeBoldText(true); mMonthTitlePaint.setAntiAlias(true); mMonthTitlePaint.setTextSize(MONTH_LABEL_TEXT_SIZE); mMonthTitlePaint.setTypeface(Typeface.create(mMonthTitleTypeface, Typeface.BOLD)); mMonthTitlePaint.setColor(mDayTextColorEnabled); mMonthTitlePaint.setTextAlign(Align.CENTER); mMonthTitlePaint.setStyle(Style.FILL); mMonthTitleBGPaint = new Paint(); mMonthTitleBGPaint.setFakeBoldText(true); mMonthTitleBGPaint.setAntiAlias(true); mMonthTitleBGPaint.setTextAlign(Align.CENTER); mMonthTitleBGPaint.setStyle(Style.FILL); mSelectedCirclePaint = new Paint(); mSelectedCirclePaint.setFakeBoldText(true); mSelectedCirclePaint.setAntiAlias(true); mSelectedCirclePaint.setColor(mTodayNumberColor); mSelectedCirclePaint.setTextAlign(Align.CENTER); mSelectedCirclePaint.setStyle(Style.FILL); mSelectedCirclePaint.setAlpha(SELECTED_CIRCLE_ALPHA); mDisabledDaySquarePaint = new Paint(); mDisabledDaySquarePaint.setFakeBoldText(true); mDisabledDaySquarePaint.setAntiAlias(true); mDisabledDaySquarePaint.setColor(mDayBackgroundColorDisabled); mDisabledDaySquarePaint.setTextAlign(Align.CENTER); mDisabledDaySquarePaint.setStyle(Style.FILL); mDisabledDaySquarePaint.setAlpha(DISABLED_DAY_SQUARE_ALPHA); mMonthDayLabelPaint = new Paint(); mMonthDayLabelPaint.setAntiAlias(true); mMonthDayLabelPaint.setTextSize(MONTH_DAY_LABEL_TEXT_SIZE); mMonthDayLabelPaint.setColor(mDayTextColorEnabled); mMonthDayLabelPaint.setTypeface(Typeface.create(mDayOfWeekTypeface, Typeface.NORMAL)); mMonthDayLabelPaint.setStyle(Style.FILL); mMonthDayLabelPaint.setTextAlign(Align.CENTER); mMonthDayLabelPaint.setFakeBoldText(true); mMonthNumPaint = new Paint(); mMonthNumPaint.setAntiAlias(true); mMonthNumPaint.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE); mMonthNumPaint.setStyle(Style.FILL); mMonthNumPaint.setTextAlign(Align.CENTER); mMonthNumPaint.setFakeBoldText(false); }
From source file:com.stasbar.knowyourself.Utils.java
/** * @param amPmRatio a value between 0 and 1 that is the ratio of the relative size of the * am/pm string to the time string * @return format string for 12 hours mode time *//*from www . ja va 2 s.com*/ public static CharSequence get12ModeFormat(float amPmRatio) { String pattern = DateFormat.getBestDateTimePattern(Locale.getDefault(), "hma"); if (amPmRatio <= 0) { pattern = pattern.replaceAll("a", "").trim(); } // Replace spaces with "Hair Space" pattern = pattern.replaceAll(" ", "\u200A"); // Build a spannable so that the am/pm will be formatted int amPmPos = pattern.indexOf('a'); if (amPmPos == -1) { return pattern; } final Spannable sp = new SpannableString(pattern); sp.setSpan(new RelativeSizeSpan(amPmRatio), amPmPos, amPmPos + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); sp.setSpan(new StyleSpan(Typeface.NORMAL), amPmPos, amPmPos + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); sp.setSpan(new TypefaceSpan("sans-serif"), amPmPos, amPmPos + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); return sp; }