Example usage for android.graphics Typeface BOLD

List of usage examples for android.graphics Typeface BOLD

Introduction

In this page you can find the example usage for android.graphics Typeface BOLD.

Prototype

int BOLD

To view the source code for android.graphics Typeface BOLD.

Click Source Link

Usage

From source file:com.bamalearn.bamalearnburmese.DrawerMainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    common_helper = new Common_helper(this);
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder().setDefaultFontPath("fonts/Roboto-Regular.ttf")
            .setFontAttrId(R.attr.fontPath).build());

    final String[] from = new String[] { "cityName" };
    final int[] to = new int[] { android.R.id.text1 };
    mAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, null, from, to,
            CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);

    setContentView(R.layout.activity_drawer_main);
    ButterKnife.inject(this);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    app_version = (TextView) findViewById(R.id.app_version);

    app_version.setText("Version " + common_helper.getAppVersion(this) + "\n");
    app_version.setTypeface(null, Typeface.BOLD);

    //toolbar.inflateMenu(R.menu.menu_drawer_main);

    mDalSettings = new DAL_Settings(DrawerMainActivity.this);

    /* MenuItem menuItem=toolbar.getMenu().findItem(R.id.action_search);
     SearchView searchView = (SearchView) MenuItemCompat.getActionView(menuItem);
     searchView.setSuggestionsAdapter(mAdapter);
     searchView.setOnSuggestionListener(new QueryListener());
     searchView.setOnQueryTextListener(new QueryListener());
     searchView.setQueryHint("Search Here");
            /* w ww. j ava2s .co m*/
     changeSearchViewTextColor(searchView);
    */

    initialize();
    binddataTOList();

    Db_Help dbhelper = new Db_Help(this);
    if (mDalSettings.getStringPreference("DB_EXISTS", "").equals("")) {

        dbhelper.MakeDB();
        mDalSettings.setStringPreference("DB_EXISTS", "true");
    }

    makeFragmentSelection(0);

}

From source file:eu.geopaparazzi.mapsforge.sourcesview.SourcesExpandableListAdapter.java

public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView,
        ViewGroup parent) {/* w  w  w .  ja  v a2 s .c  o  m*/

    final BaseMap baseMap = (BaseMap) getChild(groupPosition, childPosition);

    if (convertView == null) {
        LayoutInflater infalInflater = (LayoutInflater) this.activity
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = infalInflater.inflate(R.layout.sources_list_item, null);
    }

    TextView tableNameView = (TextView) convertView.findViewById(R.id.source_header_titletext);
    tableNameView.setTypeface(null, Typeface.BOLD);

    tableNameView.setText(baseMap.title);

    TextView tableTypeView = (TextView) convertView.findViewById(R.id.source_header_descriptiontext);
    tableTypeView.setText("[" + baseMap.mapType + "]");

    if (selectedBaseMap != null && selectedBaseMap.equals(baseMap)) {
        convertView.setBackgroundColor(selectionColorColor);
    }

    return convertView;
}

From source file:com.google.samples.apps.iosched.util.LPreviewUtilsBase.java

public void setMediumTypeface(TextView textView) {
    textView.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
}

From source file:com.ashlikun.badgeview.BadgeView.java

private void init(AttributeSet attrs) {
    defaultHeight = dip2px(getContext(), defaultHeight);
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BadgeView);
    // set default background
    setBackground(dip2px(getContext(), radius), a.getColor(R.styleable.BadgeView_bvColor, bvColor));
    mHideOnNull = a.getBoolean(R.styleable.BadgeView_bvISHideNull, true);
    a.recycle();//from  w  ww.j a v  a2 s.c  om
    setGravity(Gravity.CENTER);
    setPadding((int) (radius / 3f), 0, (int) (radius / 3f), 0);
    ViewCompat.setElevation(this, dip2px(getContext(), 1));
    setTypeface(null, Typeface.BOLD);
}

From source file:com.view.widget.SlidingTabLayout.java

protected TextView createDefaultTabView(Context context) {
    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTypeface(Typeface.SERIF, Typeface.BOLD);

    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
    textView.setBackgroundResource(outValue.resourceId);
    //textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, 0, padding, padding);

    return textView;
}

From source file:com.example.textviewsample.MainActivityFragment.java

private void styleSourceCode() {
    TypefaceSpan codeSpan = new TypefaceSpan(getActivity(), "SourceCodePro-Regular");
    TypefaceSpan codeSpan2 = new TypefaceSpan(getActivity(), "SourceCodePro-Bold", Typeface.BOLD);
    ForegroundColorSpan colorSpan = new ForegroundColorSpan(Color.MAGENTA);
    ForegroundColorSpan colorSpan2 = new ForegroundColorSpan(Color.BLUE);

    SpannableString title = new SpannableString(getString(R.string.code_sample));
    title.setSpan(codeSpan, 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    title.setSpan(codeSpan2, 19, 23, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    title.setSpan(colorSpan, 4, 15, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    title.setSpan(colorSpan2, 19, 23, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

    sourceCodeText.setText(title);//www . j  ava  2s  .c  o m
}

From source file:com.skydoves.elasticviewsexample.ElasticVIews.ElasticButton.java

private void setTypeArray(TypedArray typedArray) {
    GradientDrawable bgShape = (GradientDrawable) view.getBackground();

    round = typedArray.getInt(R.styleable.ElasticButton_button_round, round);
    bgShape.setCornerRadius(round);/*from  ww  w  .j av a  2  s.  c  om*/

    color = typedArray.getInt(R.styleable.ElasticButton_button_backgroundColor, color);
    bgShape.setColor(color);

    scale = typedArray.getFloat(R.styleable.ElasticButton_button_scale, scale);

    duration = typedArray.getInt(R.styleable.ElasticButton_button_duration, duration);

    labelText = typedArray.getString(R.styleable.ElasticButton_button_labelText);
    view.setText(labelText);

    labelColor = typedArray.getInt(R.styleable.ElasticButton_button_labelColor, labelColor);
    view.setTextColor(labelColor);

    labelSize = typedArray.getInt(R.styleable.ElasticButton_button_labelSize, labelSize);
    view.setTextSize(labelSize);

    labelStyle = typedArray.getInt(R.styleable.ElasticButton_button_labelStyle, labelStyle);

    if (labelStyle == 0)
        view.setTypeface(null, Typeface.NORMAL);
    else if (labelStyle == 1)
        view.setTypeface(null, Typeface.BOLD);
    else if (labelStyle == 2)
        view.setTypeface(null, Typeface.ITALIC);
}

From source file:ufms.br.com.ufmsapp.adapter.EventosAdapter.java

@Override
public void onBindViewHolder(EventosViewHolder eventosViewHolder, int i) {
    evento = eventosList.get(i);//from  w  w  w  .  j av a 2s  .  com

    EventoRead eventoRead = MyApplication.getWritableDatabase().eventoReadById(evento.getIdEventoServidor());

    if (eventoRead != null) {
        if (eventoRead.getEventoReadStatus() == 0) {
            eventosViewHolder.cardLayout
                    .setBackgroundColor(ContextCompat.getColor(context, R.color.whiteTextColor));
            eventosViewHolder.eventoTitle.setTypeface(null, Typeface.BOLD);
            eventosViewHolder.eventoSubtitle.setTypeface(null, Typeface.BOLD);
        } else if (eventoRead.getEventoReadStatus() == 1) {
            eventosViewHolder.eventoTitle.setTypeface(null, Typeface.NORMAL);
            eventosViewHolder.eventoSubtitle.setTypeface(null, Typeface.NORMAL);
            eventosViewHolder.cardLayout
                    .setBackground(ContextCompat.getDrawable(context, R.drawable.custom_bg));
        }

    }

    eventosViewHolder.eventoTitle.setText(evento.getTitulo());

    Disciplina disciplina = MyApplication.getWritableDatabase().disciplinaById(evento.getDisciplina());

    eventosViewHolder.eventoSubtitle.setText(disciplina.getTitulo());
    eventosViewHolder.eventoDescription.setText(evento.getDescricao());
    eventosViewHolder.eventoTimeStamp.setText(df.format(evento.getDataEventoCriado()));

    String firstLetter = String.valueOf(evento.getTitulo().charAt(0));

    ColorGenerator generator = ColorGenerator.MATERIAL;

    int color = generator.getRandomColor();

    TextDrawable drawable = TextDrawable.builder().buildRound(firstLetter, color);

    eventosViewHolder.eventoIcon.setImageDrawable(drawable);

    /*  Picasso.with(itemView.getContext())
        .load(UrlEndpoints.URL_ENDPOINT + evento.getBigIcon())
        .resize(110, 80)
        .centerCrop()
        .into(eventosViewHolder.eventoIcon);*/

    setAnimation(eventosViewHolder.cardLayout, i);

}

From source file:nz.al4.airclock.AirClockFragment.java

private View setupClock() {
    // add digital clock
    textClock = new TextClock(getContext());
    textClock.setId(textClockId);/* w ww  .ja  v a2 s  .c  o m*/

    textClock.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
            RelativeLayout.LayoutParams.WRAP_CONTENT));
    textClock.setTypeface(textClock.getTypeface(), Typeface.BOLD);
    textClock.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 48);
    textClock.setGravity(Gravity.CENTER_HORIZONTAL);

    return textClock;
}

From source file:org.mozilla.gecko.DataReportingNotification.java

/**
 * Launch a notification of the data policy, and record notification time and version.
 *//*from www. ja va2s.c  o  m*/
private static void notifyDataPolicy(Context context, SharedPreferences sharedPrefs) {
    boolean result = false;
    try {
        // Launch main App to launch Data choices when notification is clicked.
        Intent prefIntent = new Intent(GeckoApp.ACTION_LAUNCH_SETTINGS);
        prefIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
                AppConstants.MOZ_ANDROID_BROWSER_INTENT_CLASS);

        GeckoPreferences.setResourceToOpen(prefIntent, "preferences_vendor");
        prefIntent.putExtra(ALERT_NAME_DATAREPORTING_NOTIFICATION, true);

        PendingIntent contentIntent = PendingIntent.getActivity(context, 0, prefIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);
        final Resources resources = context.getResources();

        // Create and send notification.
        String notificationTitle = resources.getString(R.string.datareporting_notification_title);
        String notificationSummary;
        if (Versions.preJB) {
            notificationSummary = resources.getString(R.string.datareporting_notification_action);
        } else {
            // Display partial version of Big Style notification for supporting devices.
            notificationSummary = resources.getString(R.string.datareporting_notification_summary);
        }
        String notificationAction = resources.getString(R.string.datareporting_notification_action);
        String notificationBigSummary = resources.getString(R.string.datareporting_notification_summary);

        // Make styled ticker text for display in notification bar.
        String tickerString = resources.getString(R.string.datareporting_notification_ticker_text);
        SpannableString tickerText = new SpannableString(tickerString);
        // Bold the notification title of the ticker text, which is the same string as notificationTitle.
        tickerText.setSpan(new StyleSpan(Typeface.BOLD), 0, notificationTitle.length(),
                Spannable.SPAN_INCLUSIVE_EXCLUSIVE);

        Notification notification = new NotificationCompat.Builder(context).setContentTitle(notificationTitle)
                .setContentText(notificationSummary).setSmallIcon(R.drawable.ic_status_logo).setAutoCancel(true)
                .setContentIntent(contentIntent)
                .setStyle(new NotificationCompat.BigTextStyle().bigText(notificationBigSummary))
                .addAction(R.drawable.firefox_settings_alert, notificationAction, contentIntent)
                .setTicker(tickerText).build();

        NotificationManager notificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        int notificationID = ALERT_NAME_DATAREPORTING_NOTIFICATION.hashCode();
        notificationManager.notify(notificationID, notification);

        // Record version and notification time.
        SharedPreferences.Editor editor = sharedPrefs.edit();
        long now = System.currentTimeMillis();
        editor.putLong(PREFS_POLICY_NOTIFIED_TIME, now);
        editor.putInt(PREFS_POLICY_VERSION, DATA_REPORTING_VERSION);
        editor.apply();
        result = true;
    } finally {
        // We want to track any errors, so record notification outcome.
        Telemetry.sendUIEvent(TelemetryContract.Event.POLICY_NOTIFICATION_SUCCESS, result);
    }
}