List of usage examples for android.graphics Typeface BOLD
int BOLD
To view the source code for android.graphics Typeface BOLD.
Click Source Link
From source file:com.sutromedia.android.core.PhotoActivity.java
public void onSetupView(View view, int viewId) { final IPhoto photo = getCurrentPhoto(); if (photo != null) { int backgroundId = (viewId == R.layout.image_view_inside) ? R.drawable.attrib_inside : R.drawable.attrib_outside; Drawable background = getResources().getDrawable(backgroundId); background.setAlpha(155);//from www . j ava 2s . c o m view.findViewById(R.image.licenseGroup).setBackgroundDrawable(background); setVisibility(view, R.image.caption, !mInSlideShow && !isSubsetOnEntry()); TextView caption = (TextView) view.findViewById(R.image.caption); String entryName = photo.getEntryName(); if (entryName != null) { entryName = entryName.replace(' ', '\u00A0'); entryName += "\u00A0\u00A0\u25B6"; } caption.setText(entryName); caption.setSingleLine(true); caption.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { onReceiveEntry(new NavigationDetailWeb(photo.getEntryId())); } }); setVisibility(view, R.image.licenseGroup, !mInSlideShow); Integer[] icons = PhotoLicence.getIcons(photo); setImageView(view, R.image.license1, 0, icons); setImageView(view, R.image.license2, 1, icons); TextView owner = (TextView) view.findViewById(R.image.owner); if (icons.length > 0) { owner.setText(photo.getAuthor()); } else { view.findViewById(R.image.licenseGroup).setVisibility(View.GONE); } String url = photo.getUrl(); View licenceGroup = view.findViewById(R.image.licenseGroup); if (url != null && url.length() > 0) { owner.setTextColor(Color.rgb(0x19, 0x49, 0x90)); owner.setTypeface(null, Typeface.BOLD); licenceGroup.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { onReceiveEntry(new NavigationWeb(photo.getUrl())); } }); } else { owner.setTypeface(null, Typeface.NORMAL); owner.setTextColor(Color.WHITE); licenceGroup.setOnClickListener(null); } setupTouchOnPlayButton(); setVisibility(R.image.play_slideshow, !mInSlideShow && mShowSlideShowControls); setVisibility(R.image.loading, mMissingPhoto); setVisibility(R.image.wait, mMissingPhoto && isOnline()); String missingTextTemplate = getString( mMissingPhoto && isOnline() ? R.string.missing_photo : R.string.missing_not_online); String missingText = String.format(missingTextTemplate, mCurrentImage + 1, getImageCountInSet()); setText(R.image.missing, missingText); } }
From source file:com.eccyan.widget.SpinningTabStrip.java
public SpinningTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);//from w w w.java 2s . co m setWillNotDraw(false); tabsContainer = new LinearLayout(context); tabsContainer.setOrientation(LinearLayout.HORIZONTAL); tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); addView(tabsContainer); flingVelocity = new Scroller(getContext()); flinger = new Flinger(); gestureDetector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { flingVelocity.forceFinished(true); flingVelocity.fling(getScrollX(), getScrollY(), -(int) velocityX, -(int) velocityY, Integer.MIN_VALUE, Integer.MAX_VALUE, 0, getHeight()); scrollStopped.set(false); Log.d(TAG, "scroll fling started"); return true; } @Override public boolean onDown(MotionEvent e) { if (!flingVelocity.isFinished()) { flingVelocity.forceFinished(true); } if (!flinger.isFinished()) { flinger.forceFinished(true); } return super.onDown(e); } }); 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(TEXT_SIZE_INDEX, tabTextSize); ColorStateList colorStateList = a.getColorStateList(TEXT_COLOR_INDEX); int textPrimaryColor = a.getColor(TEXT_COLOR_PRIMARY, android.R.color.white); if (colorStateList != null) { tabTextColor = colorStateList; } else { tabTextColor = getColorStateList(textPrimaryColor); } underlineColor = textPrimaryColor; dividerColor = textPrimaryColor; indicatorColor = textPrimaryColor; // get custom attrs a = context.obtainStyledAttributes(attrs, R.styleable.SpinningTabStrip); indicatorColor = a.getColor(R.styleable.SpinningTabStrip_pstsIndicatorColor, indicatorColor); underlineColor = a.getColor(R.styleable.SpinningTabStrip_pstsUnderlineColor, underlineColor); dividerColor = a.getColor(R.styleable.SpinningTabStrip_pstsDividerColor, dividerColor); dividerWidth = a.getDimensionPixelSize(R.styleable.SpinningTabStrip_pstsDividerWidth, dividerWidth); indicatorHeight = a.getDimensionPixelSize(R.styleable.SpinningTabStrip_pstsIndicatorHeight, indicatorHeight); underlineHeight = a.getDimensionPixelSize(R.styleable.SpinningTabStrip_pstsUnderlineHeight, underlineHeight); dividerPadding = a.getDimensionPixelSize(R.styleable.SpinningTabStrip_pstsDividerPadding, dividerPadding); tabPadding = a.getDimensionPixelSize(R.styleable.SpinningTabStrip_pstsTabPaddingLeftRight, tabPadding); tabBackgroundResId = a.getResourceId(R.styleable.SpinningTabStrip_pstsTabBackground, tabBackgroundResId); shouldExpand = a.getBoolean(R.styleable.SpinningTabStrip_pstsShouldExpand, shouldExpand); scrollOffset = a.getDimensionPixelSize(R.styleable.SpinningTabStrip_pstsScrollOffset, scrollOffset); textAllCaps = a.getBoolean(R.styleable.SpinningTabStrip_pstsTextAllCaps, textAllCaps); tabTypefaceStyle = a.getInt(R.styleable.SpinningTabStrip_pstsTextStyle, Typeface.BOLD); tabTypefaceSelectedStyle = a.getInt(R.styleable.SpinningTabStrip_pstsTextSelectedStyle, Typeface.BOLD); tabTextAlpha = a.getFloat(R.styleable.SpinningTabStrip_pstsTextAlpha, HALF_TRANSP); tabTextSelectedAlpha = a.getFloat(R.styleable.SpinningTabStrip_pstsTextSelectedAlpha, OPAQUE); a.recycle(); setMarginBottomTabContainer(); 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:de.hackerspacebremen.fragments.StatusFragment.java
private void outputStatus(final SpaceData data) { if (statusAnimation != null) { statusAnimation.stop();/*w w w . ja v a 2s . co m*/ } if (messageAnimation != null) { messageAnimation.stop(); } StatusViewHolder.get().imgStatus.setVisibility(ImageView.GONE); if (data == null) { StatusViewHolder.get().imgConnErr.setVisibility(ImageView.VISIBLE); final TextView statusView = StatusViewHolder.get().statusMessage; statusView.setText(this.getText(R.string.connection_error)); } else { this.spaceData = data; final TextView text = StatusViewHolder.get().statusMessage; String timeString = getString(R.string.unknown); if (data.getTime() != null) { timeString = SpeakingDateFormat.format(data.getTime()); } ((HackerspaceApplication) this.getActivity().getApplication()).spaceOpen = data.isSpaceOpen(); if (data.isSpaceOpen()) { text.setText(getString(R.string.space_open, timeString)); } else { text.setText(getString(R.string.space_closed, timeString)); } text.setTypeface(null, Typeface.BOLD); if (data.getMessage() != null && data.getMessage().length() > 0) { String message = data.getMessage(); final TextView messageView = StatusViewHolder.get().messageText; messageView.setText(message); final TextView messageLabel = StatusViewHolder.get().messageLabel; messageLabel.setVisibility(TextView.VISIBLE); StatusViewHolder.get().messageBlock.setVisibility(RelativeLayout.VISIBLE); } else { StatusViewHolder.get().messageBlock.setVisibility(RelativeLayout.INVISIBLE); } // TODO EventBus nutzen updateAppWidget(data); } }
From source file:uk.org.ngo.squeezer.itemlist.AlarmView.java
private void setDowText(AlarmViewHolder viewHolder, int day) { SpannableString text = new SpannableString(ServerString.getAlarmShortDayText(day)); if (viewHolder.alarm.isDayActive(day)) { text.setSpan(new StyleSpan(Typeface.BOLD), 0, text.length(), 0); text.setSpan(new ForegroundColorSpan(mColorSelected), 0, text.length(), 0); Drawable underline = mResources.getDrawable(R.drawable.underline); float textSize = (new Paint()).measureText(text.toString()); underline.setBounds(0, 0, (int) (textSize * mDensity), (int) (1 * mDensity)); viewHolder.dowTexts[day].setCompoundDrawables(null, null, null, underline); } else/*from w w w .ja va2 s . c o m*/ viewHolder.dowTexts[day].setCompoundDrawables(null, null, null, null); viewHolder.dowTexts[day].setText(text); }
From source file:uk.co.ashtonbrsc.intentexplode.Explode.java
/** textViewToIgnore is not updated so current selected char in that textview will not change */ private void showAllIntentData(TextView textViewToIgnore) { showTextViewIntentData(textViewToIgnore); categoriesLayout.removeAllViews();//from ww w . j av a 2s. co m Set<String> categories = editableIntent.getCategories(); StringBuilder stringBuilder = new StringBuilder(); if (categories != null) { categoriesHeader.setVisibility(View.VISIBLE); stringBuilder.append(getResources().getString(R.string.categories)); for (String category : categories) { stringBuilder.append(category).append(NEWLINE); TextView categoryTextView = new TextView(this); categoryTextView.setText(category); categoryTextView.setTextAppearance(this, R.style.TextFlags); categoriesLayout.addView(categoryTextView); } } else { categoriesHeader.setVisibility(View.GONE); // addTextToLayout("NONE", Typeface.NORMAL, categoriesLayout); } flagsLayout.removeAllViews(); ArrayList<String> flagsStrings = getFlags(); if (!flagsStrings.isEmpty()) { for (String thisFlagString : flagsStrings) { addTextToLayout(thisFlagString, Typeface.NORMAL, flagsLayout); } } else { addTextToLayout(getResources().getString(R.string.none), Typeface.NORMAL, flagsLayout); } extrasLayout.removeAllViews(); try { Bundle intentBundle = editableIntent.getExtras(); if (intentBundle != null) { Set<String> keySet = intentBundle.keySet(); stringBuilder.append(getResources().getString(R.string.bundle_title_bold)); int count = 0; for (String key : keySet) { count++; Object thisObject = intentBundle.get(key); addTextToLayout(getResources().getString(R.string.extra) + count, Typeface.BOLD, extrasLayout); String thisClass = thisObject.getClass().getName(); if (thisClass != null) { addTextToLayout(getResources().getString(R.string.class_text) + thisClass, Typeface.ITALIC, STANDARD_INDENT_SIZE_IN_DIP, extrasLayout); } addTextToLayout(getResources().getString(R.string.key) + key, Typeface.ITALIC, STANDARD_INDENT_SIZE_IN_DIP, extrasLayout); if (thisObject instanceof String || thisObject instanceof Long || thisObject instanceof Integer || thisObject instanceof Boolean || thisObject instanceof Uri) { addTextToLayout(getResources().getString(R.string.value) + thisObject.toString(), Typeface.ITALIC, STANDARD_INDENT_SIZE_IN_DIP, extrasLayout); } else if (thisObject instanceof ArrayList) { addTextToLayout(getResources().getString(R.string.values), Typeface.ITALIC, extrasLayout); ArrayList thisArrayList = (ArrayList) thisObject; for (Object thisArrayListObject : thisArrayList) { addTextToLayout(thisArrayListObject.toString(), Typeface.ITALIC, STANDARD_INDENT_SIZE_IN_DIP, extrasLayout); } } } } else { addTextToLayout(getResources().getString(R.string.none), Typeface.NORMAL, extrasLayout); } } catch (Exception e) { // TODO Should make this red to highlight error addTextToLayout(getResources().getString(R.string.error_extracting_extras), Typeface.NORMAL, extrasLayout); e.printStackTrace(); } // resolveInfo = pm.queryIntentServices(intent, 0); // stringBuilder.append("<br><b><u>" + resolveInfo.size() // + " services match this intent:</u></b><br>"); // for (int i = 0; i < resolveInfo.size(); i++) { // ResolveInfo info = resolveInfo.get(i); // ActivityInfo activityinfo = info.activityInfo; // stringBuilder.append(activityinfo.packageName + "<br>"); // } // intentDetailsHtml = stringBuilder.toString(); // (((TextView) findViewById(R.id.text))).setText(intentDetailsHtml); refreshUI(); }
From source file:com.money.manager.ex.reports.IncomeVsExpensesListFragment.java
/** * Add footer to ListView/*from w ww .j ava2 s .c o m*/ * * @return View of footer */ private View addListViewFooter() { TableRow row = (TableRow) View.inflate(getActivity(), R.layout.tablerow_income_vs_expenses, null); TextView txtYear = (TextView) row.findViewById(R.id.textViewYear); txtYear.setText(getString(R.string.total)); txtYear.setTypeface(null, Typeface.BOLD); TextView txtMonth = (TextView) row.findViewById(R.id.textViewMonth); txtMonth.setText(null); return row; }
From source file:com.handpoint.headstart.client.ui.ReceiptActivity.java
private void initReceiptView() { Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/roboto-regular.ttf"); TextView merchantName = (TextView) findViewById(R.id.merchant_name); merchantName.setTypeface(tf, Typeface.BOLD); merchantName.setText(getMerchantName()); TextView transactionDateView = (TextView) findViewById(R.id.date); java.text.DateFormat df = DateFormat.getDateFormat(this); transactionDateView.setTypeface(tf); transactionDateView.setText(" " + df.format(mResult.getDateTime())); TextView transactionResult = (TextView) findViewById(R.id.transaction_result); transactionResult.setTypeface(tf, Typeface.BOLD); transactionResult.setText(mResult.getFinancialStatus()); TextView messageView = (TextView) findViewById(R.id.message); messageView.setTypeface(tf);/*from w w w . j a va 2s .c o m*/ String message = ((Application) getApplication()).formatErrorMessage(mResult.getStatusMessage(), mResult.getErrorMessage()); messageView.setText(message); ImageView cardSchemeLogo = (ImageView) findViewById(R.id.card_scheme_logo); cardSchemeLogo.setImageDrawable(getCardSchemeLogo()); TextView amountView = (TextView) findViewById(R.id.amount_text); amountView.setTypeface(tf); amountView.setText(getTotalAmount(mResult.getAuthorizedAmount(), mResult.getCurrency())); TextView descriptionView = (TextView) findViewById(R.id.item_description_text); descriptionView.setTypeface(tf); descriptionView.setText(getDescriptionText()); ImageView productImageView = (ImageView) findViewById(R.id.picture); productImageView.setImageBitmap(getImageBitmap()); }
From source file:ir.blue_saffron.persianmaterialdatetimepicker.date.MonthView.java
/** * Sets up the text and style properties for painting. Override this if you * want to use a different paint./* w w w . j av a 2 s .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(mDayTextColor); mMonthTitlePaint.setTextAlign(Align.CENTER); mMonthTitlePaint.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(mMonthDayTextColor); // mMonthDayLabelPaint.setTypeface(TypefaceHelper.get(getContext(),"Roboto-Medium")); //TODO: Changed Here. 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.appsimobile.appsii.module.appsiagenda.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 .ja v a 2 s .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(mMonthTitleColor); 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); mEventDayCirclePaint = new Paint(); mEventDayCirclePaint.setAntiAlias(true); mEventDayCirclePaint.setColor(mDayTextColor); mEventDayCirclePaint.setStyle(Style.STROKE); mMonthDayLabelPaint = new Paint(); mMonthDayLabelPaint.setAntiAlias(true); mMonthDayLabelPaint.setTextSize(MONTH_DAY_LABEL_TEXT_SIZE); mMonthDayLabelPaint.setColor(mDayTextColor); 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.openerp.addons.idea.product.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.Dash_Board: Dash_Board detail = new Dash_Board(); FragmentListener frag = (FragmentListener) getActivity(); frag.startDetailFragment(detail); return true; case R.id.Search_product: final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.product_search_custom_dialog); // dialog.setTitle("Product Search"); dialog.setOnCancelListener(new OnCancelListener() { @Override/*from w w w .ja v a2 s .c o m*/ public void onCancel(DialogInterface dialog) { dialog.dismiss(); } }); AutoCompleteTextView autotext = (AutoCompleteTextView) dialog .findViewById(R.id.autoCompleteTextView_product_search); final ArrayAdapter adapter = new ArrayAdapter(getActivity(), android.R.layout.simple_list_item_1, OEHelper.datatemplate); TextView txv = (TextView) dialog.findViewById(R.id.textView1); Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Georgia.ttf"); autotext.setTypeface(font, Typeface.BOLD); autotext.setAdapter(adapter); txv.setTypeface(font, Typeface.BOLD); autotext.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String name = adapter.getItem(arg2).toString(); callmethod_for_position_productdetail(OEHelper.datatemplate.indexOf(name)); dialog.dismiss(); } }); dialog.show(); return true; } return true; }