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.code.android.vibevault.FeaturedShowsScreen.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.featured_shows_screen); getMoreShowsButton = new Button(this); getMoreShowsButton.setText("More Featured Shows"); getMoreShowsButton.setTextColor(Color.rgb(18, 125, 212)); getMoreShowsButton.setTypeface(Typeface.DEFAULT, Typeface.BOLD); getMoreShowsButton.setPadding(0, 6, 0, 6); getMoreShowsButton.setOnClickListener(new OnClickListener() { @Override//w w w. j av a2s.c o m public void onClick(View v) { if (VibeVault.moreFeaturedShows.size() != 0) { fetchSelectedShows(VibeVault.moreFeaturedShows.get(0)); } else { Toast.makeText(getBaseContext(), "More featured shows weekly...", Toast.LENGTH_SHORT).show(); } } }); this.featuredShowsList = (ListView) this.findViewById(R.id.SelectedShowsListView); featuredShowsList.addFooterView(getMoreShowsButton); if (VibeVault.featuredShows.size() == 0) { getMoreShowsButton.setVisibility(View.GONE); } else { getMoreShowsButton.setVisibility(View.VISIBLE); } featuredShowsList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> a, View v, int position, long id) { ArchiveShowObj show = (ArchiveShowObj) featuredShowsList.getItemAtPosition(position); Intent i = new Intent(FeaturedShowsScreen.this, ShowDetailsScreen.class); i.putExtra("Show", show); startActivity(i); } }); featuredShowsList.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.add(Menu.NONE, VibeVault.EMAIL_LINK, Menu.NONE, "Email Link to Show"); menu.add(Menu.NONE, VibeVault.ADD_TO_FAVORITE_LIST, Menu.NONE, "Bookmark Show"); } }); Object retained = getLastNonConfigurationInstance(); if (retained instanceof GetSelectedShowsListTask) { workerTask = (GetSelectedShowsListTask) retained; workerTask.setActivity(this); } else { workerTask = new GetSelectedShowsListTask(this); if (VibeVault.featuredShows.size() == 0) { this.fetchSelectedShows("http://andrewpearson.org/vibevault/shows/vvshows1"); } this.refreshSelectedShowsList(); } }
From source file:com.github.chilinh.androidformbuilder.MainFragment.java
private void showDialog() { AlertDialog dialog = new Form.Builder().title("Edit Info").addSection(new SectionElement("Personal")) .addElement(new EditTextElement(null, "Name:").placeholder("Your name here").required(true) .labelTypeface(Typeface.BOLD)) .addElement(new ComboBoxElement(null, "Genre", "", "Male", "Female")) .addElement(new TextElement(null, "For you:").placeholder("N/A").labelTypeface(Typeface.BOLD)) .addElement(new EditTextElement(null, null).placeholder("Phone number here") .setInputTypeMask(InputType.TYPE_CLASS_PHONE, true).required(true)) .addSection(new SectionElement("More")) .addElement(new DatePickerElement(null, "Birthday: ").date(Calendar.getInstance().getTime())) .addElement(new TimePickerElement(null, "Leave: ").time(Calendar.getInstance().getTime())) .build(getContext()).buildDialog(getContext(), null, null); dialog.show();//from ww w. jav a2 s .c o m }
From source file:com.rachelgrau.rachel.health4theworldstroke.Activities.InfoActivity.java
public void addSubheaderWithText(String text) { LinearLayout ll = (LinearLayout) findViewById(R.id.text_linear_layout); TextView textView = new TextView(this); textView.setTypeface(null, Typeface.BOLD); textView.setText(text);/*from w w w . j av a2s. c om*/ textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setPadding(40, 10, 40, 0); textView.setTextSize(16); textView.setBackgroundColor(Color.WHITE); ll.addView(textView); }
From source file:com.thatkawaiiguy.meleehandbook.adapter.SearchAdapter.java
private void highlight(String search, String originalText, TextView textView) { int startPos = originalText.toLowerCase(Locale.US).indexOf(search.toLowerCase(Locale.US)); int endPos = startPos + search.length(); if (startPos != -1) { Spannable spannable = new SpannableString(originalText); ColorStateList yellowColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { ContextCompat.getColor(mContext, R.color.overscroll_color) }); TextAppearanceSpan highlightSpan = new TextAppearanceSpan(null, Typeface.BOLD, -1, yellowColor, null); spannable.setSpan(highlightSpan, startPos, endPos, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(spannable);//from w ww. j a va 2 s . c o m } else textView.setText(originalText); }
From source file:com.farmerbb.taskbar.adapter.StartMenuAdapter.java
@Override public @NonNull View getView(int position, View convertView, final @NonNull ViewGroup parent) { // Check if an existing view is being reused, otherwise inflate the view if (convertView == null) convertView = LayoutInflater.from(getContext()).inflate(isGrid ? R.layout.row_alt : R.layout.row, parent, false);/* www . j a va 2s. c o m*/ final AppEntry entry = getItem(position); assert entry != null; final SharedPreferences pref = U.getSharedPreferences(getContext()); TextView textView = (TextView) convertView.findViewById(R.id.name); textView.setText(entry.getLabel()); Intent intent = new Intent(); intent.setComponent(ComponentName.unflattenFromString(entry.getComponentName())); ActivityInfo activityInfo = intent.resolveActivityInfo(getContext().getPackageManager(), 0); if (activityInfo != null) textView.setTypeface(null, isTopApp(activityInfo) ? Typeface.BOLD : Typeface.NORMAL); switch (pref.getString("theme", "light")) { case "light": textView.setTextColor(ContextCompat.getColor(getContext(), R.color.text_color)); break; case "dark": textView.setTextColor(ContextCompat.getColor(getContext(), R.color.text_color_dark)); break; } ImageView imageView = (ImageView) convertView.findViewById(R.id.icon); imageView.setImageDrawable(entry.getIcon(getContext())); LinearLayout layout = (LinearLayout) convertView.findViewById(R.id.entry); layout.setOnClickListener(view -> { LocalBroadcastManager.getInstance(getContext()) .sendBroadcast(new Intent("com.farmerbb.taskbar.HIDE_START_MENU")); U.launchApp(getContext(), entry.getPackageName(), entry.getComponentName(), entry.getUserId(getContext()), null, false, false); }); layout.setOnLongClickListener(view -> { int[] location = new int[2]; view.getLocationOnScreen(location); openContextMenu(entry, location); return true; }); layout.setOnGenericMotionListener((view, motionEvent) -> { int action = motionEvent.getAction(); if (action == MotionEvent.ACTION_BUTTON_PRESS && motionEvent.getButtonState() == MotionEvent.BUTTON_SECONDARY) { int[] location = new int[2]; view.getLocationOnScreen(location); openContextMenu(entry, location); } if (action == MotionEvent.ACTION_SCROLL && pref.getBoolean("visual_feedback", true)) view.setBackgroundColor(0); return false; }); if (pref.getBoolean("visual_feedback", true)) { layout.setOnHoverListener((v, event) -> { if (event.getAction() == MotionEvent.ACTION_HOVER_ENTER) { int backgroundTint = pref.getBoolean("transparent_start_menu", false) ? U.getAccentColor(getContext()) : U.getBackgroundTint(getContext()); //noinspection ResourceAsColor backgroundTint = ColorUtils.setAlphaComponent(backgroundTint, Color.alpha(backgroundTint) / 2); v.setBackgroundColor(backgroundTint); } if (event.getAction() == MotionEvent.ACTION_HOVER_EXIT) v.setBackgroundColor(0); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) v.setPointerIcon(PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_DEFAULT)); return false; }); layout.setOnTouchListener((v, event) -> { v.setAlpha( event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE ? 0.5f : 1); return false; }); } return convertView; }
From source file:de.treichels.hott.ui.android.html.AndroidCurveImageGenerator.java
private Bitmap getBitmap(final Curve curve, final float scale, final boolean description) { final boolean pitchCurve = curve.getPoint()[0].getPosition() == 0; final float scale1 = scale * 0.75f; // smaller images on the android // platform//from ww w. j a v a 2s .co m final Bitmap image = Bitmap.createBitmap((int) (10 + 200 * scale1), (int) (10 + 250 * scale1), Bitmap.Config.ARGB_8888); final Canvas canvas = new Canvas(image); final Paint backgroundPaint = new Paint(); backgroundPaint.setColor(Color.WHITE); backgroundPaint.setStyle(Style.FILL); final Paint forgroundPaint = new Paint(); forgroundPaint.setColor(Color.BLACK); forgroundPaint.setStyle(Style.STROKE); forgroundPaint.setStrokeWidth(1.0f); forgroundPaint.setStrokeCap(Cap.BUTT); forgroundPaint.setStrokeJoin(Join.ROUND); forgroundPaint.setStrokeMiter(0.0f); final Paint curvePaint = new Paint(forgroundPaint); curvePaint.setFlags(Paint.ANTI_ALIAS_FLAG); curvePaint.setStrokeWidth(2.0f); final Paint pointPaint = new Paint(curvePaint); pointPaint.setStrokeWidth(5.0f); pointPaint.setStyle(Style.FILL_AND_STROKE); final Paint helpLinePaint = new Paint(forgroundPaint); helpLinePaint.setColor(Color.GRAY); helpLinePaint.setPathEffect(new DashPathEffect(new float[] { 5.0f, 5.0f }, 2.5f)); final Paint textPaint = new Paint(forgroundPaint); textPaint.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD)); textPaint.setTextSize(12.0f); textPaint.setTextAlign(Align.CENTER); textPaint.setStyle(Style.FILL); canvas.drawRect(0, 0, 10 + 200 * scale1, 10 + 250 * scale1, backgroundPaint); canvas.drawRect(5, 5, 5 + 200 * scale1, 5 + 250 * scale1, forgroundPaint); canvas.drawLine(5, 5 + 25 * scale1, 5 + 200 * scale1, 5 + 25 * scale1, helpLinePaint); canvas.drawLine(5, 5 + 225 * scale1, 5 + 200 * scale1, 5 + 225 * scale1, helpLinePaint); if (!pitchCurve) { canvas.drawLine(5, 5 + 125 * scale1, 5 + 200 * scale1, 5 + 125 * scale1, helpLinePaint); canvas.drawLine(5 + 100 * scale1, 5, 5 + 100 * scale1, 5 + 250 * scale1, helpLinePaint); } if (curve.getPoint() != null) { int numPoints = 0; for (final CurvePoint p : curve.getPoint()) { if (p.isEnabled()) { numPoints++; } } final double[] xVals = new double[numPoints]; final double[] yVals = new double[numPoints]; int i = 0; for (final CurvePoint p : curve.getPoint()) { if (p.isEnabled()) { if (i == 0) { xVals[i] = pitchCurve ? 0 : -100; } else if (i == numPoints - 1) { xVals[i] = 100; } else { xVals[i] = p.getPosition(); } yVals[i] = p.getValue(); if (description) { float x0; float y0; if (pitchCurve) { x0 = (float) (5 + xVals[i] * 2 * scale1); y0 = (float) (5 + (225 - yVals[i] * 2) * scale1); } else { x0 = (float) (5 + (100 + xVals[i]) * scale1); y0 = (float) (5 + (125 - yVals[i]) * scale1); } canvas.drawPoint(x0, y0, pointPaint); if (y0 < 5 + 125 * scale1) { canvas.drawRect(x0 - 4, y0 + 5, x0 + 3, y0 + 18, backgroundPaint); canvas.drawText(Integer.toString(p.getNumber() + 1), x0 - 1, y0 + 16, textPaint); } else { canvas.drawRect(x0 - 4, y0 - 5, x0 + 3, y0 - 18, backgroundPaint); canvas.drawText(Integer.toString(p.getNumber() + 1), x0 - 1, y0 - 7, textPaint); } } i++; } } if (numPoints > 2 && curve.isSmoothing()) { final SplineInterpolator s = new SplineInterpolator(); final PolynomialSplineFunction function = s.interpolate(xVals, yVals); float x0 = 5; float y0; if (pitchCurve) { y0 = (float) (5 + (225 - yVals[0] * 2) * scale1); } else { y0 = (float) (5 + (125 - yVals[0]) * scale1); } while (x0 < 4 + 200 * scale1) { final float x1 = x0 + 1; float y1; if (pitchCurve) { y1 = (float) (5 + (225 - function.value((x1 - 5) / scale1 / 2) * 2) * scale1); } else { y1 = (float) (5 + (125 - function.value((x1 - 5) / scale1 - 100)) * scale1); } canvas.drawLine(x0, y0, x1, y1, curvePaint); x0 = x1; y0 = y1; } } else { for (i = 0; i < numPoints - 1; i++) { float x0, y0, x1, y1; if (pitchCurve) { x0 = (float) (5 + xVals[i] * 2 * scale1); y0 = (float) (5 + (225 - yVals[i] * 2) * scale1); x1 = (float) (5 + xVals[i + 1] * 2 * scale1); y1 = (float) (5 + (225 - yVals[i + 1] * 2) * scale1); } else { x0 = (float) (5 + (100 + xVals[i]) * scale1); y0 = (float) (5 + (125 - yVals[i]) * scale1); x1 = (float) (5 + (100 + xVals[i + 1]) * scale1); y1 = (float) (5 + (125 - yVals[i + 1]) * scale1); } canvas.drawLine(x0, y0, x1, y1, curvePaint); } } } return image; }
From source file:com.oasisfeng.nevo.decorators.StackDecorator.java
@Override public void apply(final StatusBarNotificationEvo evolved) throws RemoteException { final Collection<StatusBarNotificationEvo> history = getArchivedNotifications(evolved.getKey(), KMaxNumLines);/*w ww . j av a 2 s . com*/ if (history.size() <= 1) return; final INotification evolved_n = evolved.notification(); final IBundle evolved_extras = evolved_n.extras(); if (evolved_extras.containsKey(EXTRA_TEXT_LINES)) return; // Never stack already inbox-styled notification. final Calendar calendar = Calendar.getInstance(); final List<CharSequence> lines = new ArrayList<>(KMaxNumLines); long previous_when = 0; final long latest_when = evolved_n.getWhen(); for (final StatusBarNotificationEvo sbn : history) { final INotification n = sbn.notification(); final CharSequence text = n.extras().getCharSequence(NotificationCompat.EXTRA_TEXT); if (text == null) continue; final long when = n.getWhen(); if (when == latest_when || Math.abs(when - previous_when) <= KMinIntervalToShowTimestamp) lines.add(text); else { // Add time-stamp final SpannableStringBuilder line = new SpannableStringBuilder(); calendar.setTimeInMillis(when); final String time_text = String.format((Locale) null, "%1$02d:%2$02d ", calendar.get(HOUR_OF_DAY), calendar.get(MINUTE)); line.append(time_text); line.append(text); line.setSpan(new StyleSpan(Typeface.BOLD), 0, 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); lines.add(line); } previous_when = when; } if (lines.isEmpty()) return; Collections.reverse(lines); // Latest first, since earliest lines will be trimmed by InboxStyle. final CharSequence title = evolved_extras.getCharSequence(NotificationCompat.EXTRA_TITLE); evolved_extras.putCharSequence(NotificationCompat.EXTRA_TITLE_BIG, title); evolved_extras.putCharSequenceArray(EXTRA_TEXT_LINES, lines); evolved_n.setBigContentView(buildBigContentView(evolved.getPackageName(), title, lines)); }
From source file:com.normalexception.app.rx8club.view.profile.ProfileViewArrayAdapter.java
public View getView(int position, View convertView, ViewGroup parent) { View vi = convertView;/*from www .j ava2 s. c o m*/ if (vi == null) { vi = new TextView(sourceFragment.getActivity()); } TextView tv = (TextView) vi; final ProfileModel pm = data.get(position); String text = String.format("%s\n%s", pm.getName(), pm.getText()); SpannableString spanString = new SpannableString(text); spanString.setSpan(new StyleSpan(Typeface.BOLD), 0, text.indexOf("\n"), 0); spanString.setSpan(new StyleSpan(Typeface.ITALIC), text.indexOf("\n") + 1, text.length(), 0); tv.setText(spanString); tv.setPadding(1, 10, 1, 10); tv.setBackgroundColor(Color.DKGRAY); tv.setTextColor(Color.WHITE); tv.setTextSize(10); tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Bundle args = new Bundle(); args.putString("link", pm.getLink()); args.putString("title", pm.getName()); FragmentUtils.fragmentTransaction(sourceFragment.getActivity(), ThreadFragment.newInstance(), false, true, args); } }); return vi; }
From source file:com.fastbootmobile.encore.app.fragments.NavigationDrawerFragment.java
public NavigationDrawerFragment() { sUnselectedTypeface = Typeface.create("sans-serif", 0); sSelectedTypeface = Typeface.create("sans-serif", Typeface.BOLD); }
From source file:com.g_node.gca.abstracts.AbstractContentTabFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Log.i("GCA-Abs-Frag", "Abstract Content Fragment onViewCreated"); /*/* ww w .j a v a 2 s. co m*/ * Initializing fields */ initial_UI(); resetAllFields(); /* * Getting UUID of intent that's detail is to be shown. */ value = TabsPagerAdapter.getValue(); Log.i("GCA-Abs-Frag", "new value: " + value); /* * Run SQL Queries to fetch data from database. */ fetchBasicAbstractDataFromDB(); /* * Fetch Authors name for abstract and update author name fields */ fetchAndUpdateAuthorsDataFromDB(); /* * Get Affiliation Name for associate abstracts - and update affiliations view */ fetchAndUpdateAffiliationNamesFromDB(); /* * Getting the title of Abstract - and update abstract title view */ getAndUpdateAbstractTitle(); /* * Set Title to BOLD */ title.setTypeface(null, Typeface.BOLD); /* * Getting Topic of the Abstract - and update abstract topic view */ getAndUpdateAbstractTopic(); /* * Get Abstract Content/Text from Cursor and display - update abstract Text view */ getAndUpdateAbstractContent(); /* * Get acknowledgements for Abstract and display - update abstract acknowldegement view */ getAndUpdateAbstractAcknowledgements(); /* * Get References from database and display - Update references view */ getAndUpdateAbstractReferences(); /* * Get associated Figures from database and set button enabled/disabled - */ getAndUpdateAbstractFiguresBtn(); }