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:fr.cph.chicago.core.adapter.BusMapSnippetAdapter.java

@Override
public final View getView(final int position, View convertView, final ViewGroup parent) {
    final BusArrival arrival = (BusArrival) getItem(position);
    convertView = activity.getLayoutInflater().inflate(R.layout.list_map_train, parent, false);
    final TextView stationNameTextView = (TextView) convertView.findViewById(R.id.station_name);
    stationNameTextView.setText(arrival.getStopName());

    if (!(position == arrivals.size() - 1 && "No service".equals(arrival.getTimeLeftDueDelay()))) {
        final TextView timeTextView = (TextView) convertView.findViewById(R.id.time);
        timeTextView.setText(arrival.getTimeLeftDueDelay());
    } else {//w  w w.j a  v  a 2s  . com
        stationNameTextView.setTypeface(null, Typeface.BOLD);
        stationNameTextView.setText(arrival.getStopName());
        stationNameTextView.setTextColor(ContextCompat.getColor(parent.getContext(), R.color.grey));
        stationNameTextView.setGravity(Gravity.CENTER);
    }
    return convertView;
}

From source file:com.QuarkLabs.BTCeClient.adapters.OrdersBookAdapter.java

@SuppressLint("InflateParams")
@Override/*  w ww. j a  v a  2 s  . c om*/
public View getView(int position, View convertView, ViewGroup parent) {
    View v;
    if (convertView == null) {
        v = mInflater.inflate(R.layout.ordersbook_item, parent, false);
    } else {
        v = convertView;
    }
    JSONArray value = mData.optJSONArray(position);
    double price = value.optDouble(0);
    double volume = value.optDouble(1);
    TextView text1 = (TextView) v.findViewById(R.id.orderBookPrice);
    TextView text2 = (TextView) v.findViewById(R.id.ordersBookVolume);
    text1.setText(String.valueOf(price));
    text2.setText(String.valueOf(volume));
    if (volume == mMaxValue) {
        text1.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
        text2.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
    } else {
        text1.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
        text2.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
    }

    return v;
}

From source file:fr.cph.chicago.core.adapter.TrainMapSnippetAdapter.java

@Override
public final View getView(final int position, View convertView, final ViewGroup parent) {
    final Eta eta = (Eta) getItem(position);
    final LayoutInflater vi = (LayoutInflater) parent.getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    // TODO implement view holder
    convertView = vi.inflate(R.layout.list_map_train, parent, false);
    final TextView name = (TextView) convertView.findViewById(R.id.station_name);
    name.setText(eta.getStation().getName());

    if (!(position == etas.size() - 1 && "0 min".equals(eta.getTimeLeftDueDelay()))) {
        final TextView time = (TextView) convertView.findViewById(R.id.time);
        time.setText(eta.getTimeLeftDueDelay());
    } else {/*from w w w  .j a v a2  s. com*/
        name.setTextColor(ContextCompat.getColor(parent.getContext(), R.color.grey));
        name.setTypeface(null, Typeface.BOLD);
        name.setGravity(Gravity.CENTER);
    }
    return convertView;
}

From source file:com.mobisci_lab.virtualkeyboard.softkeyboard.LatinKeyboardView.java

@Override
public void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    TextPaint paint = new TextPaint();
    paint.setAntiAlias(true);//from  w w w  . j a v  a2 s  . com
    paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
    paint.setTextSize(11 * getResources().getDisplayMetrics().density);
    paint.setColor(ContextCompat.getColor(this.getContext(), R.color.candidate_other));

    List<Key> keys = getKeyboard().getKeys();
    for (Key key : keys) {
        float x = key.x + key.width / 2 + key.width / 5;
        float y = key.y + key.width / 2;
        String text = "";
        switch (key.codes[0]) {
        case 113:
            text = "1";
            break;
        case 119:
            text = "2";
            break;
        case 101:
            text = "3";
            break;
        case 114:
            text = "4";
            break;
        case 116:
            text = "5";
            break;
        case 121:
            text = "6";
            break;
        case 117:
            text = "7";
            break;
        case 105:
            text = "8";
            break;
        case 111:
            text = "9";
            break;
        case 112:
            text = "0";
            break;

        }
        canvas.drawText(text, x, y, paint);
    }
}

From source file:com.xinheng.crash.CrashListAdapter.java

@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
    String crash = mData[position];
    holder.log = crash;//  w w w .j  a  va 2s . c om
    if (crash != null) {
        setSpaceState(holder, /*show = */ crash.startsWith("at "));

        if (crash.startsWith("Caused by")) {
            holder.title.setTypeface(null, Typeface.BOLD);
            holder.title.setTextColor(0xdeffffff);
        } else {
            holder.title.setTypeface(null, Typeface.NORMAL);
            holder.title.setTextColor(0xffef4545);
        }

        if (mPackageName != null && crash.contains(mPackageName) && crash.indexOf("(") > -1) {
            holder.itemView.setSelected(true);
            int indexOfC = crash.indexOf("(");
            String atPackage = crash.substring(0, indexOfC);
            SpannableStringBuilder builder = new SpannableStringBuilder(atPackage)
                    .append(StringStyleUtils.format(holder.title.getContext(), " " + crash.substring(indexOfC),
                            R.style.LineTextAppearance));
            CharSequence title = builder.subSequence(0, builder.length());
            holder.title.setText(title);

        } else {
            holder.itemView.setSelected(false);
            holder.title.setText(crash);
        }
    }
}

From source file:me.drakeet.library.ui.CrashListAdapter.java

@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
    String crash = mData[position];
    holder.log = crash;//www. ja  v a 2s . co  m
    if (crash != null) {
        setSpaceState(holder, /*show = */ crash.startsWith("at "));

        if (crash.startsWith("Caused by")) {
            holder.title.setTypeface(null, Typeface.BOLD);
            holder.title.setTextColor(0xdeffffff);
        } else {
            holder.title.setTypeface(null, Typeface.NORMAL);
            holder.title.setTextColor(0xffef4545);
        }

        if (mPackageName != null && crash.contains(mPackageName)) {
            holder.itemView.setSelected(true);
            int indexOfC = crash.indexOf("(");
            if (indexOfC >= 0) {
                String atPackage = crash.substring(0, indexOfC);
                SpannableStringBuilder builder = new SpannableStringBuilder(atPackage)
                        .append(StringStyleUtils.format(holder.title.getContext(),
                                " " + crash.substring(indexOfC), R.style.LineTextAppearance));
                CharSequence title = builder.subSequence(0, builder.length());
                holder.title.setText(title);
            } else {
                holder.title.setText(crash);
            }
        } else {
            holder.itemView.setSelected(false);
            holder.title.setText(crash);
        }
    }
}

From source file:cat.mvmike.minimalcalendarwidget.service.DayService.java

private static void setInstanceNumber(final Context context, final RemoteViews cellRv, final String dayOfMonth,
        final boolean isToday, final int found) {

    Symbol symbols = ConfigurationService.getInstancesSymbols(context);
    Character[] symbolArray = symbols.getArray();

    int max = symbolArray.length - 1;
    String symbol = String.valueOf(found > max ? symbolArray[max] : symbolArray[found]);
    String dayOfMonthSpSt = PADDING + (dayOfMonth.length() == 1 ? dayOfMonth + DOUBLE_PADDING : dayOfMonth)
            + PADDING + symbol;/*from  w ww  . j  a va  2s .co  m*/
    SpannableString daySpSt = new SpannableString(dayOfMonthSpSt);
    daySpSt.setSpan(new StyleSpan(Typeface.BOLD), dayOfMonthSpSt.length() - 1, dayOfMonthSpSt.length(),
            Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

    int color;
    if (isToday) {
        color = ContextCompat.getColor(context, R.color.instances_today);
        daySpSt.setSpan(new StyleSpan(Typeface.BOLD), 0, dayOfMonthSpSt.length() - 1,
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    } else {
        color = ContextCompat.getColor(context,
                ConfigurationService.getInstancesSymbolsColours(context).getHexValue());
    }

    daySpSt.setSpan(new ForegroundColorSpan(color), dayOfMonthSpSt.length() - 1, dayOfMonthSpSt.length(),
            Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    daySpSt.setSpan(new RelativeSizeSpan(symbols.getRelativeSize()), dayOfMonthSpSt.length() - 1,
            dayOfMonthSpSt.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

    cellRv.setTextViewText(android.R.id.text1, daySpSt);
}

From source file:it.redturtle.mobile.apparpav.MeteogramFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = this.getActivity().getApplicationContext();
    View view = inflater.inflate(R.layout.meteograms, container, false);

    // Built current fragment
    Municipality m = Global.istance().getPrefMun(municipalityid);
    if (null == m) {
        Intent newintent = new Intent();
        newintent.setClass(context, MeteogramsActivity.class);
        newintent.putExtra("state", 1);
        this.getActivity().finish();
        startActivity(newintent);//from w  ww.j  a v  a  2  s  .c om
    }

    Meteogram meteogram = Global.istance().getMeteogramsByZoneIDS(m.getZoneid());
    if (null == meteogram)
        return view;

    ListView list = (ListView) view.findViewById(R.id.meteogram_items);
    TextView tv = (TextView) view.findViewById(R.id.municipality);
    tv.setTypeface(null, Typeface.BOLD);
    tv.setText(m.getName());
    ListAdapter adapter = new MeteogramAdapter(context, meteogram.getListOfSlot());
    list.setAdapter(adapter);
    return view;
}

From source file:com.github.michalbednarski.intentslab.browser.RegisteredReceiverFetcher.java

@Override
Object getEntries(Context context) {
    try {/*from  w  ww .  ja  v  a 2  s  . co  m*/
        final Categorizer<RegisteredReceiverInfo> categorizer = new ProcessCategorizer();
        (new RegisteredReceiversParser(mExcludeProtected) {
            @Override
            protected void onReceiverFound(RegisteredReceiverInfo receiverInfo) {
                categorizer.add(receiverInfo);
            }
        }).parse(context);
        return categorizer.getResult();
    } catch (SecurityException e) {
        // Create message about error
        SpannableStringBuilder ssb = new SpannableStringBuilder(
                context.getString(R.string.registered_receivers_denied));
        ssb.append("\n");
        int commandStart = ssb.length();
        if (ComponentFetcher.DEVELOPMENT_PERMISSIONS_SUPPORTED) {
            ssb.append("pm grant ").append(context.getPackageName()).append(" android.permission.DUMP");
        } else {
            ssb.append(RemoteEntryPoint.getScriptFile(context).getAbsolutePath());
        }
        int commandEnd = ssb.length();
        ssb.setSpan(new StyleSpan(Typeface.BOLD), commandStart, commandEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        return new CustomError(ssb);
    } catch (Throwable e) {
        e.printStackTrace();
        return new CustomError(Utils.describeException(e));
    }
}

From source file:com.ephemeraldreams.gallyshuttle.ui.adapters.NavigationDrawerAdapter.java

@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    String headerText = headers[groupPosition];
    if (convertView == null) {
        convertView = layoutInflater.inflate(R.layout.navigation_list_group, parent, false);
    }/* ww w .ja  v a2  s .  c o  m*/
    TextView headerTextView = ButterKnife.findById(convertView, R.id.navigation_drawer_header_text_view);
    headerTextView.setTypeface(null, Typeface.BOLD);
    headerTextView.setText(headerText);
    return convertView;
}