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:cc.mintcoin.wallet.ui.TransactionsListFragment.java
@Override public void onViewCreated(final View view, final Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final SpannableStringBuilder emptyText = new SpannableStringBuilder( getString(direction == Direction.SENT ? R.string.wallet_transactions_fragment_empty_text_sent : R.string.wallet_transactions_fragment_empty_text_received)); emptyText.setSpan(new StyleSpan(Typeface.BOLD), 0, emptyText.length(), SpannableStringBuilder.SPAN_POINT_MARK); if (direction != Direction.SENT) emptyText.append("\n\n").append(getString(R.string.wallet_transactions_fragment_empty_text_howto)); setEmptyText(emptyText);//from ww w.j a v a 2 s. co m }
From source file:com.mybitcoin.wallet.ui.TransactionsListFragment.java
@Override public void onViewCreated(final View view, final Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final SpannableStringBuilder emptyText = new SpannableStringBuilder( getString(direction == Direction.SENT ? R.string.wallet_transactions_fragment_empty_text_sent : R.string.wallet_transactions_fragment_empty_text_received)); emptyText.setSpan(new StyleSpan(Typeface.BOLD), 0, emptyText.length(), SpannableStringBuilder.SPAN_POINT_MARK); /*if (direction != Direction.SENT) emptyText.append("\n\n").append(getString(R.string.wallet_transactions_fragment_empty_text_howto));*/ setEmptyText(emptyText);//from w w w . ja va2 s. c o m }
From source file:com.yy.androidlib.widget.tab.PagerSlidingTabStrip.java
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);//from ww w .j av a 2 s . co 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); // 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.PagerSlidingTab); indicatorColor = a.getColor(R.styleable.PagerSlidingTab_alIndicatorColor, indicatorColor); underlineColor = a.getColor(R.styleable.PagerSlidingTab_alUnderlineColor, underlineColor); dividerColor = a.getColor(R.styleable.PagerSlidingTab_alDividerColor, dividerColor); indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTab_alIndicatorHeight, indicatorHeight); underlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTab_alUnderlineHeight, underlineHeight); dividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTab_alDividerPadding, dividerPadding); tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTab_alTabPaddingLeftRight, tabPadding); tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTab_alTabBackground, tabBackgroundResId); shouldExpand = a.getBoolean(R.styleable.PagerSlidingTab_alShouldExpand, shouldExpand); scrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTab_alScrollOffset, scrollOffset); textAllCaps = a.getBoolean(R.styleable.PagerSlidingTab_alTextAllCaps, textAllCaps); tabTextSize = a.getDimensionPixelSize(R.styleable.PagerSlidingTab_alTextSize, tabTextSize); tabTextColor = a.getColor(R.styleable.PagerSlidingTab_alTextColor, tabTextColor); tabTextCheckedColor = a.getColor(R.styleable.PagerSlidingTab_alTextCheckedColor, tabTextCheckedColor); boolean bold = a.getBoolean(R.styleable.PagerSlidingTab_alTextBold, false); if (bold) { tabTypefaceStyle = Typeface.BOLD; } 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:org.akvo.caddisfly.sensor.colorimetry.strip.camera.InstructionFragment.java
private void showInstruction(@NonNull LinearLayout linearLayout, @NonNull String instruction, int style) { TextView textView = new TextView(getActivity()); textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.mediumTextSize)); textView.setPadding((int) getResources().getDimension(R.dimen.activity_vertical_margin), 0, (int) getResources().getDimension(R.dimen.activity_vertical_margin), (int) getResources().getDimension(R.dimen.activity_vertical_margin)); String text = instruction;/*from w w w .j a va2s. co m*/ if (instruction.contains("<!>")) { text = instruction.replaceAll("<!>", ""); textView.setTextColor(Color.RED); } else { textView.setTextColor(Color.DKGRAY); } if (instruction.contains("<b>") || style == BOLD) { text = text.replaceAll("<b>", "").replaceAll("</b>", ""); textView.setTypeface(null, Typeface.BOLD); textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.titleTextSize)); } else { textView.setTextColor(Color.DKGRAY); } textView.setLineSpacing( TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5.0f, getResources().getDisplayMetrics()), 1.0f); Spanned spanned = StringUtil.getStringResourceByName(getContext(), text); if (!text.isEmpty()) { textView.append(spanned); linearLayout.addView(textView); } }
From source file:fr.cph.chicago.core.activity.StationActivity.java
@Override protected final void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); App.checkTrainData(this); if (!this.isFinishing()) { // Layout setup setContentView(R.layout.activity_station); ButterKnife.bind(this); // Get station id from bundle stationId = getIntent().getExtras().getInt(bundleTrainStationId, 0); if (stationId != 0) { // Get station final TrainData trainData = DataHolder.getInstance().getTrainData(); station = trainData.getStation(stationId).orElse(new Station()); paramsStop = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); final RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) streetViewImage .getLayoutParams();//from ww w. j a v a 2 s . c o m final Position position = station.getStops().get(0).getPosition(); final ViewGroup.LayoutParams params = streetViewImage.getLayoutParams(); ids = new HashMap<>(); isFavorite = isFavorite(); createGoogleStreetObservable(position.getLatitude(), position.getLongitude()); subscribeToGoogleStreet(streetViewImage, streetViewText); createTrainArrivalObservableAndSubscribe(); streetViewImage.setOnClickListener( new GoogleStreetOnClickListener(position.getLatitude(), position.getLongitude())); streetViewImage.setLayoutParams(params); streetViewText.setTypeface(null, Typeface.BOLD); swipeRefreshLayout.setOnRefreshListener(() -> trainArrivalObservable .subscribe(new SubscriberTrainArrival(this, swipeRefreshLayout))); if (isFavorite) { favoritesImage.setColorFilter(yellowLineDark); } else { favoritesImage.setColorFilter(grey_5); } params.height = height; params.width = layoutParams.width; mapImage.setColorFilter(grey_5); directionImage.setColorFilter(grey_5); favoritesImageContainer.setOnClickListener(v -> switchFavorite()); mapContainer.setOnClickListener( new GoogleMapOnClickListener(position.getLatitude(), position.getLongitude())); walkContainer.setOnClickListener( new GoogleMapDirectionOnClickListener(position.getLatitude(), position.getLongitude())); final Map<TrainLine, List<Stop>> stopByLines = station.getStopByLines(); final TrainLine randomTrainLine = getRandomLine(stopByLines); setUpStopLayouts(stopByLines); swipeRefreshLayout.setColorSchemeColors(randomTrainLine.getColor()); setToolBar(randomTrainLine); Util.trackScreen(getApplicationContext(), trainDetails); } } }
From source file:com.tcity.android.ui.info.BuildInfoFragment.java
private void updateBranchView(@NotNull BuildInfoData data) { View row = getView().findViewById(R.id.build_info_branch_row); if (data.branch != null) { row.setVisibility(View.VISIBLE); TextView view = (TextView) row.findViewById(R.id.build_info_branch); view.setText(data.branch);/*from ww w. java 2 s . c o m*/ if (data.isBranchDefault) { view.setTypeface(null, Typeface.BOLD); } else { view.setTypeface(null, Typeface.NORMAL); } } else { row.setVisibility(View.GONE); } }
From source file:com.landenlabs.all_devtool.TextFragment.java
private void fillLayout() { m_tableLayout.removeAllViews();/*from www. j a v a 2s. com*/ m_textInfoList.clear(); int minSP = 8; int maxSP = 20; int stepSP = 2; int[] colors = new int[] { 0xffe0e0e0, 0xffffe0e0, 0xffe0ffe0, 0xffe0e0ff }; TableLayout.LayoutParams tableLP = new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT); TableRow.LayoutParams rowLP = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.MATCH_PARENT); TextView textView; TableRow tableRow; int textColor = 0xff000000; for (int tfIdx = 0; tfIdx < TextInfo.getCount(); tfIdx++) { Typeface typeface = TextInfo.getTypeface(tfIdx); String typefaceStr = TextInfo.getTypefaceStr(tfIdx); textView = new TextView(m_context); textView.setBackgroundColor(Utils.blend(colors[tfIdx], 0x20000000)); textView.setText(typefaceStr); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); m_tableLayout.addView(textView, tableLP); for (int sizeSP = minSP; sizeSP <= maxSP; sizeSP += stepSP) { tableRow = new TableRow(m_context); tableRow.setBackgroundColor(colors[tfIdx]); tableRow.setTag(Integer.valueOf(m_textInfoList.size())); m_textInfoList.add(new TextInfo(sizeSP, tfIdx)); tableRow.setClickable(true); tableRow.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int idx = (Integer) v.getTag(); showTextDialog(m_textInfoList, idx); } }); textView = new TextView(m_context); textView.setText(String.valueOf(sizeSP) + "sp "); textView.setBackgroundColor(0x20000000); textView.setPadding(8, 0, 8, 0); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); tableRow.addView(textView, rowLP); textView = new TextView(m_context); textView.setText("Normal"); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, sizeSP); textView.setTypeface(typeface, Typeface.NORMAL); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); tableRow.addView(textView, rowLP); textView = new TextView(m_context); textView.setText("Bold"); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, sizeSP); textView.setTypeface(typeface, Typeface.BOLD); textView.setPadding(8, 0, 8, 0); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); tableRow.addView(textView, rowLP); textView = new TextView(m_context); textView.setText("Italic"); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, sizeSP); textView.setTypeface(typeface, Typeface.ITALIC); textView.setGravity(Gravity.CENTER); textView.setTextColor(textColor); tableRow.addView(textView, rowLP); m_tableLayout.addView(tableRow, tableLP); } } }
From source file:de.egore911.drilog.adapter.ShowDataAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { Object o = getItem(position); boolean isUser = o instanceof User; ViewGroup row;//from www. ja va 2 s . co m if (null == convertView) { // Create a new view for the user or comment if (isUser) { row = (RelativeLayout) layoutInflater.inflate(R.layout.line_name, null); UserViewHolder holder = new UserViewHolder(); holder.nameField = (TextView) row.findViewById(R.id.name); holder.avatarField = (ImageView) row.findViewById(R.id.avatar); holder.user = (User) o; row.setTag(holder); } else { row = (RelativeLayout) layoutInflater.inflate(R.layout.line_comment, null); CommentViewHolder holder = new CommentViewHolder(); holder.commentField = (TextView) row.findViewById(R.id.comment); holder.dateField = (TextView) row.findViewById(R.id.date); holder.comment = (Comment) o; row.setTag(holder); } } else { // Recycle a previous view if possible row = (ViewGroup) convertView; if (isUser) { UserViewHolder holder = (UserViewHolder) row.getTag(); holder.user = (User) o; } else { CommentViewHolder holder = (CommentViewHolder) row.getTag(); holder.comment = (Comment) o; } } if (isUser) { User user = (User) o; setDefaultCellBackground(position, row, false); // Render a user UserViewHolder holder = (UserViewHolder) row.getTag(); if (watchList != null && watchList.contains(user.nick)) { holder.nameField.setTypeface(null, Typeface.BOLD); } else { holder.nameField.setTypeface(null, Typeface.NORMAL); } holder.nameField.setText(user.name); Picasso.with(activity).load(user.image).placeholder(R.drawable.ic_launcher).into(holder.avatarField); } else { Comment comment = (Comment) o; setDefaultCellBackground(position, row, anchor == comment); // Render a comment CommentViewHolder holder = (CommentViewHolder) row.getTag(); holder.commentField.setText(comment.content); holder.dateField.setText(comment.time); } return row; }
From source file:com.libreteam.taxi.Customer_Boarding.java
private void initComponents(View v) { Taxi_System.setContent((LinearLayout) v.findViewById(R.id.header), context, 1, (float) 0.07); Taxi_System.applyFonts(v, Taxi_System.faceType_normal(getActivity())); LinearLayout thirdsection = (LinearLayout) v.findViewById(R.id.thirdsection); Taxi_System.setContent(thirdsection, context, (float) 0.125, (float) 0.07); ImageView thirdimg = (ImageView) v.findViewById(R.id.thirdimg); Taxi_System.setContent(thirdimg, context, (float) 0.06, (float) 0.04); LinearLayout logosection = (LinearLayout) v.findViewById(R.id.logosection); Taxi_System.setContent(logosection, context, (float) 0.25, (float) 0.07); ImageView logo = (ImageView) v.findViewById(R.id.logo); // Taxi_System.setContent(logo, context, Float.parseFloat((String) getResources().getText(R.string.logosize_w)), Float.parseFloat((String) getResources().getText(R.string.logosize))); Taxi_System.setContentLogo(logo, context, (float) 0.25, (float) 0.07); LinearLayout border = (LinearLayout) v.findViewById(R.id.border); Taxi_System.setContent(border, context, (float) 0.5, (float) 0.06); ((TextView) v.findViewById(R.id.username)).setText(username); ((TextView) v.findViewById(R.id.carmodel)).setText(car_model); ((TextView) v.findViewById(R.id.taxicompany)).setText(taxi_company); ((TextView) v.findViewById(R.id.licenseplate)).setText(license_plate); ((TextView) v.findViewById(R.id.time)).setText(time.replace("s", "")); ((TextView) v.findViewById(R.id.time)).setTypeface(null, Typeface.BOLD); ((TextView) v.findViewById(R.id.licenseplate)).setTypeface(null, Typeface.BOLD); // new ImageLoader(context).DisplayImage("http://www.thetorquereport.com/assets_c/2013/02/2014_Ford_Fiesta_ST_Race_Car_00010-thumb-530x398-26165.jpg", (ImageView)v.findViewById(R.id.icon)); new ImageLoader(context).DisplayImage(Customer_Constants.selected_taxi_icon, (ImageView) v.findViewById(R.id.icon)); //jin ((ImageView) v.findViewById(R.id.icon)) .getLayoutParams().height = (int) (Taxi_System.getWidth(context) * 0.25); ((ImageView) v.findViewById(R.id.icon)) .getLayoutParams().width = (int) (Taxi_System.getWidth(context) * 0.25); Button reject = (Button) v.findViewById(R.id.reject); reject.setOnClickListener(this); Button accept = (Button) v.findViewById(R.id.accept); accept.setOnClickListener(this); Button urlatlong = (Button) v.findViewById(R.id.update); urlatlong.getLayoutParams().width = (int) (Taxi_System.getHeight(context) * 0.07); urlatlong.getLayoutParams().height = (int) (Taxi_System.getHeight(context) * 0.07); urlatlong.setOnClickListener(this); ((TextView) v.findViewById(R.id.reject)).setTypeface(null, Typeface.BOLD); ((TextView) v.findViewById(R.id.accept)).setTypeface(null, Typeface.BOLD); if (mMapFragment == null) { mMapFragment = CustomMapFragment.newInstance(); getChildFragmentManager().beginTransaction().replace(R.id.map, mMapFragment, "customer_boarding") .commit();/*from ww w. j a v a 2 s. c om*/ } }
From source file:de.msal.shoutemo.adapters.ChatAdapter.java
@Override public void onBindViewHolder(ChatAdapter.ViewHolder holder, int position) { Post post = mPosts.get(position);// ww w .j a v a 2 s. co m long timestamp = post.getDate().getTime(); String message = post.getMessage().getHtml(); String author = null; if (post.getAuthor() != null) { author = post.getAuthor().getName(); } /* SHOUTS */ if (getItemType(position).equals(Message.Type.SHOUT)) { /* set text */ holder.tvAuthor.setText(author); /* show the right tvAuthor color (mod/admin/member) */ switch (post.getAuthor().getType()) { case ADMIN: holder.tvAuthor.setTextColor(ContextCompat.getColor(mContext, R.color.autemo_blue)); break; case MOD: holder.tvAuthor.setTextColor(ContextCompat.getColor(mContext, R.color.autemo_green_secondary)); break; default: holder.tvAuthor.setTextColor(ContextCompat.getColor(mContext, R.color.autemo_grey_bright)); break; } } /* EVENTS */ else { switch (post.getMessage().getType()) { case THREAD: /* styling */ holder.itemView .setBackgroundColor(ContextCompat.getColor(mContext, R.color.autemo_green_secondary)); holder.tvMessage.setTextColor(ContextCompat.getColor(mContext, R.color.autemo_grey)); holder.tvTimestamp.setTextColor(ContextCompat.getColor(mContext, R.color.autemo_grey_bright)); holder.ivIcon.setImageResource(R.drawable.ic_event_thread); holder.tvGlobalTitle.setVisibility(View.GONE); /* alter message */ message = mContext.getResources().getString(R.string.thread_author, author) + message; break; case AWARD: /* styling */ holder.itemView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.autemo_white_dirty)); holder.tvMessage.setTextColor(ContextCompat.getColor(mContext, R.color.autemo_grey)); holder.tvTimestamp.setTextColor(ContextCompat.getColor(mContext, R.color.autemo_grey_bright)); holder.ivIcon.setImageResource(R.drawable.ic_event_award); holder.tvGlobalTitle.setVisibility(View.GONE); /* alter message */ message = mContext.getResources().getString(R.string.award_author, author) + message; break; case GLOBAL: /* styling */ holder.itemView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.autemo_pink)); holder.tvMessage.setTextAppearance(mContext, android.R.style.TextAppearance_Medium); holder.tvMessage.setTypeface(holder.tvMessage.getTypeface(), Typeface.BOLD); holder.tvMessage.setTextColor(ContextCompat.getColor(mContext, R.color.autemo_grey)); holder.tvMessage.setLinkTextColor(ContextCompat.getColor(mContext, R.color.autemo_yellow_dark)); holder.tvTimestamp.setTextColor(ContextCompat.getColor(mContext, R.color.autemo_trns_white)); holder.ivIcon.setImageResource(R.drawable.ic_event_global); /* show wanted elements */ holder.tvGlobalTitle.setVisibility(View.VISIBLE); break; case COMPETITION: /* styling */ holder.itemView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.autemo_blue)); holder.tvMessage.setTextColor(ContextCompat.getColor(mContext, R.color.autemo_grey)); holder.tvMessage.setLinkTextColor(ContextCompat.getColor(mContext, R.color.autemo_white_dirty)); holder.tvTimestamp.setTextColor(ContextCompat.getColor(mContext, R.color.autemo_grey)); holder.ivIcon.setImageResource(R.drawable.ic_event_competition); holder.tvGlobalTitle.setVisibility(View.GONE); /* alter message */ message = this.mContext.getResources().getString(R.string.competition_author, author) + message; break; case PROMOTION: /* styling */ holder.itemView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.autemo_orange)); holder.tvMessage.setTextColor(ContextCompat.getColor(mContext, R.color.autemo_white_dirty)); holder.tvTimestamp.setTextColor(ContextCompat.getColor(mContext, R.color.autemo_white_dirty)); holder.ivIcon.setImageResource(R.drawable.ic_event_promotion); holder.tvGlobalTitle.setVisibility(View.GONE); /* alter message */ message = this.mContext.getResources().getString(R.string.promotion, author) + message; break; } } // message GlideImageGetter imageGetter = new GlideImageGetter(mContext, holder.tvMessage); holder.tvMessage.setText(Html.fromHtml(message, imageGetter, null)); // time holder.tvTimestamp.setText(TimeUtils.getRelativeTime(mContext, timestamp)); }