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:info.hl.mediam.MyProfileActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case GET_IMAGE_DIALOG:
        mGetImageDialog = new Dialog(MyProfileActivity.this, R.style.TransparentDialogTheme);
        mGetImageDialog.getWindow().setGravity(Gravity.BOTTOM);
        mGetImageDialog.setContentView(R.layout.dialog_get_image);
        WindowManager.LayoutParams params = new WindowManager.LayoutParams();
        Window window = mGetImageDialog.getWindow();
        params.copyFrom(window.getAttributes());
        params.width = WindowManager.LayoutParams.MATCH_PARENT;
        params.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(params);/*  www.j a v a  2s.c o  m*/

        final Button btnGallery = (Button) mGetImageDialog.findViewById(R.id.btnGallery);
        btnGallery.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD);
        btnGallery.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                Intent galleryIntent = new Intent(MyProfileActivity.this, CameraCropActivity.class);
                galleryIntent.putExtra("type", "gallery");
                galleryIntent.putExtra("profile", true);
                MyProfileActivity.this.startActivityForResult(galleryIntent, UPDATE_IMAGE_REQUEST_CODE);
                mGetImageDialog.dismiss();

            }
        });

        final Button btnCamera = (Button) mGetImageDialog.findViewById(R.id.btnCamera);
        btnCamera.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD);
        btnCamera.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                Intent cameraIntent = new Intent(MyProfileActivity.this, CameraCropActivity.class);
                cameraIntent.putExtra("type", "camera");
                cameraIntent.putExtra("profile", true);
                MyProfileActivity.this.startActivityForResult(cameraIntent, UPDATE_IMAGE_REQUEST_CODE);
                mGetImageDialog.dismiss();

            }
        });

        final Button btnRemovePhoto = (Button) mGetImageDialog.findViewById(R.id.btnRemovePhoto);
        btnRemovePhoto.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD);
        btnRemovePhoto.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                mNewAvatarId = "";
                gProfileImage = null;
                Utils.displayImage(mNewAvatarId, mIvProfileImage, mPbLoading, ImageLoader.LARGE,
                        R.drawable.user_stub_large, false);
                mGetImageDialog.dismiss();

            }
        });

        return mGetImageDialog;
    case GET_BIRTHDAY_DIALOG:

        int intMaxYear = Calendar.getInstance().get(Calendar.YEAR);
        int intMaxMonth = Calendar.getInstance().get(Calendar.MONTH);
        int intMaxDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);

        mGetBirthdayDialog = new DatePickerDialogWithRange(this, new DatePickerDialog.OnDateSetListener() {
            public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                Time chosenDate = new Time();
                chosenDate.set(dayOfMonth, monthOfYear, year);
                mNewBirthday = chosenDate.toMillis(true) / 1000;
                CharSequence stringDate = DateFormat.format(getString(R.string.hookup_date_format),
                        chosenDate.toMillis(true));
                mEtUserBirthday.setText(stringDate.toString());
            }
        }, intMaxYear, intMaxMonth, intMaxDay);
        mGetBirthdayDialog.setMessage(getString(R.string.when_is_your_birthday));
        return mGetBirthdayDialog;
    default:
        return null;
    }
}

From source file:com.cloverstudio.spika.MyProfileActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case GET_IMAGE_DIALOG:
        mGetImageDialog = new Dialog(MyProfileActivity.this, R.style.TransparentDialogTheme);
        mGetImageDialog.getWindow().setGravity(Gravity.BOTTOM);
        mGetImageDialog.setContentView(R.layout.dialog_get_image);
        WindowManager.LayoutParams params = new WindowManager.LayoutParams();
        Window window = mGetImageDialog.getWindow();
        params.copyFrom(window.getAttributes());
        params.width = WindowManager.LayoutParams.MATCH_PARENT;
        params.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(params);/*from  w  w  w  . j  a v a 2 s .  c  om*/

        final Button btnGallery = (Button) mGetImageDialog.findViewById(R.id.btnGallery);
        btnGallery.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD);
        btnGallery.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                Intent galleryIntent = new Intent(MyProfileActivity.this, CameraCropActivity.class);
                galleryIntent.putExtra("type", "gallery");
                galleryIntent.putExtra("profile", true);
                MyProfileActivity.this.startActivityForResult(galleryIntent, UPDATE_IMAGE_REQUEST_CODE);
                mGetImageDialog.dismiss();

            }
        });

        final Button btnCamera = (Button) mGetImageDialog.findViewById(R.id.btnCamera);
        btnCamera.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD);
        btnCamera.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                Intent cameraIntent = new Intent(MyProfileActivity.this, CameraCropActivity.class);
                cameraIntent.putExtra("type", "camera");
                cameraIntent.putExtra("profile", true);
                MyProfileActivity.this.startActivityForResult(cameraIntent, UPDATE_IMAGE_REQUEST_CODE);
                mGetImageDialog.dismiss();

            }
        });

        final Button btnRemovePhoto = (Button) mGetImageDialog.findViewById(R.id.btnRemovePhoto);
        btnRemovePhoto.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD);
        btnRemovePhoto.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                mNewAvatarId = "";
                gProfileImage = null;
                Utils.displayImage(mNewAvatarId, mIvProfileImage, mPbLoading, ImageLoader.LARGE,
                        R.drawable.user_stub_large, false);
                mGetImageDialog.dismiss();

            }
        });

        return mGetImageDialog;
    case GET_BIRTHDAY_DIALOG:

        int intMaxYear = Calendar.getInstance().get(Calendar.YEAR);
        int intMaxMonth = Calendar.getInstance().get(Calendar.MONTH);
        int intMaxDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);

        mGetBirthdayDialog = new DatePickerDialogWithRange(this, new DatePickerDialog.OnDateSetListener() {
            public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                Time chosenDate = new Time();
                chosenDate.set(dayOfMonth, monthOfYear, year);
                mNewBirthday = chosenDate.toMillis(true) / 1000;
                CharSequence stringDate = DateFormat.format(getString(R.string.hookup_date_format),
                        chosenDate.toMillis(true));
                mEtUserBirthday.setText(stringDate.toString());
            }
        }, intMaxYear, intMaxMonth, intMaxDay);
        mGetBirthdayDialog.setMessage(getString(R.string.when_is_your_birthday));
        return mGetBirthdayDialog;
    default:
        return null;
    }
}

From source file:it.crs4.most.ehrlib.WidgetProvider.java

/**
 * Builds the title view.//w w  w. j a v a2s. c  o  m
 *
 * @param context the context
 * @param title the title
 * @return the view
 */
private View buildTitleView(Context context, String title) {
    titleView = new TextView(context);
    titleView.setText(title);
    titleView.setTextColor(Color.WHITE);
    titleView.setTextSize(22);
    titleView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    titleView.setTypeface(null, Typeface.BOLD);
    titleView.setGravity(Gravity.CENTER);

    return titleView;
}

From source file:org.wikipedia.edit.EditSectionActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_edit_section, menu);
    MenuItem item = menu.findItem(R.id.menu_save_section);

    if (editSummaryFragment.isActive()) {
        item.setTitle(getString(R.string.edit_next));
    } else if (editPreviewFragment.isActive()) {
        item.setTitle(getString(R.string.edit_done));
    } else {/*from ww w .  j  a v  a  2  s.  c  o m*/
        item.setTitle(getString(R.string.edit_next));
    }

    if (abusefilterEditResult != null) {
        if (abusefilterEditResult.getType() == EditAbuseFilterResult.TYPE_ERROR) {
            item.setEnabled(false);
        } else {
            item.setEnabled(true);
        }
    } else {
        item.setEnabled(sectionTextModified);
    }

    View v = getLayoutInflater().inflate(R.layout.item_edit_actionbar_button, null);
    item.setActionView(v);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    v.setLayoutParams(params);
    TextView txtView = v.findViewById(R.id.edit_actionbar_button_text);
    txtView.setText(item.getTitle());
    txtView.setTypeface(null, item.isEnabled() ? Typeface.BOLD : Typeface.NORMAL);
    v.setTag(item);
    v.setClickable(true);
    v.setEnabled(item.isEnabled());
    v.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onOptionsItemSelected((MenuItem) view.getTag());
        }
    });

    v.setBackgroundColor(ContextCompat.getColor(this,
            item.isEnabled()
                    ? (editPreviewFragment.isActive() ? R.color.accent50
                            : ResourceUtil.getThemedAttributeId(this, R.attr.colorAccent))
                    : R.color.base50));

    return true;
}

From source file:com.appdupe.flamer.LoginUsingFacebook.java

private void getTemplateFromResource() {

    // logDebug("getTemplateFromResource   ");
    imgs = res.obtainTypedArray(R.array.galleryimage);

    for (int i = 0; i < imgs.length(); i++) {
        GellaryData gellaryData = new GellaryData();
        gellaryData.setResourceId(imgs.getResourceId(i, -1));
        imagelist.add(gellaryData);/*from  w  w  w .  j av  a  2  s  . c  o  m*/
    }
    page_text = new TextView[imgs.length()];
    count = imagelist.size();
    // logDebug("getTemplateFromResource   count");
    for (int i = 0; i < imagelist.size(); i++) {
        page_text[i] = new TextView(this);

        page_text[i].setTypeface(null, Typeface.BOLD);
        page_text[i].setText(".");
        page_text[i].setTextSize(25);
        page_text[i].setTextColor(android.graphics.Color.GRAY);
        count_layout.addView(page_text[i]);
    }

    // icon =
    // BitmapFactory.decodeResource(this.getResources(),imgs.getResourceId(shre.getInt("itemId",
    // -1)-1,-1));
    // Log.d(TAG, "item index is "+shre.getInt("itemId", -1));
    mAdapterForGalery.notifyDataSetChanged();

}

From source file:com.fa.mastodon.activity.MainActivity.java

private void setupSearchView() {
    searchView.attachNavigationDrawerToMenuButton(drawer.getDrawerLayout());

    // Setup content descriptions for the different elements in the search view.
    final View leftAction = searchView.findViewById(R.id.left_action);
    leftAction.setContentDescription(getString(R.string.action_open_drawer));
    searchView.setOnFocusChangeListener(new FloatingSearchView.OnFocusChangeListener() {
        @Override/*  w  w  w  . java 2s  .c  om*/
        public void onFocus() {
            leftAction.setContentDescription(getString(R.string.action_close));
        }

        @Override
        public void onFocusCleared() {
            leftAction.setContentDescription(getString(R.string.action_open_drawer));
        }
    });
    View clearButton = searchView.findViewById(R.id.clear_btn);
    clearButton.setContentDescription(getString(R.string.action_clear));

    searchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() {
        @Override
        public void onSearchTextChanged(String oldQuery, String newQuery) {
            if (!oldQuery.equals("") && newQuery.equals("")) {
                searchView.clearSuggestions();
                return;
            }

            if (newQuery.length() < 3) {
                return;
            }

            searchView.showProgress();

            mastodonAPI.searchAccounts(newQuery, false, 5).enqueue(new Callback<List<Account>>() {
                @Override
                public void onResponse(Call<List<Account>> call, Response<List<Account>> response) {
                    if (response.isSuccessful()) {
                        searchView.swapSuggestions(response.body());
                        searchView.hideProgress();
                    } else {
                        searchView.hideProgress();
                    }
                }

                @Override
                public void onFailure(Call<List<Account>> call, Throwable t) {
                    searchView.hideProgress();
                }
            });
        }
    });

    searchView.setOnSearchListener(new FloatingSearchView.OnSearchListener() {
        @Override
        public void onSuggestionClicked(SearchSuggestion searchSuggestion) {
            Account accountSuggestion = (Account) searchSuggestion;
            Intent intent = new Intent(MainActivity.this, AccountActivity.class);
            intent.putExtra("id", accountSuggestion.id);
            startActivity(intent);
        }

        @Override
        public void onSearchAction(String currentQuery) {
        }
    });

    searchView.setOnBindSuggestionCallback(new SearchSuggestionsAdapter.OnBindSuggestionCallback() {
        @Override
        public void onBindSuggestion(View suggestionView, ImageView leftIcon, TextView textView,
                SearchSuggestion item, int itemPosition) {
            Account accountSuggestion = ((Account) item);

            Picasso.with(MainActivity.this).load(accountSuggestion.avatar)
                    .placeholder(R.drawable.avatar_default).into(leftIcon);

            String searchStr = accountSuggestion.getDisplayName() + " " + accountSuggestion.username;
            final SpannableStringBuilder str = new SpannableStringBuilder(searchStr);

            str.setSpan(new StyleSpan(Typeface.BOLD), 0, accountSuggestion.getDisplayName().length(),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            textView.setText(str);
            textView.setMaxLines(1);
            textView.setEllipsize(TextUtils.TruncateAt.END);
        }
    });

    if (PreferenceManager.getDefaultSharedPreferences(this).getString("theme_selection", "light")
            .equals("black")) {
        searchView.setBackgroundColor(Color.parseColor("#444444"));
    }

}

From source file:com.juick.android.JuickMessagesAdapter.java

public static ParsedMessage formatMessageText(final Context ctx, final JuickMessage jmsg, boolean condensed) {
    if (jmsg.parsedText != null) {
        return (ParsedMessage) jmsg.parsedText; // was parsed before
    }// ww w .ja  v  a 2s. c  o  m
    getColorTheme(ctx);
    SpannableStringBuilder ssb = new SpannableStringBuilder();
    int spanOffset = 0;
    final boolean isMainMessage = jmsg.getRID() == 0;
    final boolean doCompactComment = !isMainMessage && compactComments;
    if (jmsg.continuationInformation != null) {
        ssb.append(jmsg.continuationInformation + "\n");
        ssb.setSpan(new StyleSpan(Typeface.ITALIC), spanOffset, ssb.length() - 1,
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
    //
    // NAME
    //
    spanOffset = ssb.length();
    String name = '@' + jmsg.User.UName;
    int userNameStart = ssb.length();
    ssb.append(name);
    int userNameEnd = ssb.length();
    StyleSpan userNameBoldSpan;
    ForegroundColorSpan userNameColorSpan;
    ssb.setSpan(userNameBoldSpan = new StyleSpan(Typeface.BOLD), spanOffset, ssb.length(),
            Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    ssb.setSpan(
            userNameColorSpan = new ForegroundColorSpan(
                    colorTheme.getColor(ColorsTheme.ColorKey.USERNAME, 0xFFC8934E)),
            spanOffset, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

    if (helvNueFonts) {
        ssb.setSpan(new CustomTypefaceSpan("", JuickAdvancedApplication.helvNueBold), spanOffset, ssb.length(),
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
    ssb.append(' ');
    spanOffset = ssb.length();

    if (!condensed) {
        //
        // TAGS
        //
        String tags = jmsg.getTags();
        if (feedlyFonts)
            tags = tags.toUpperCase();
        ssb.append(tags + "\n");
        if (tags.length() > 0) {
            ssb.setSpan(new ForegroundColorSpan(colorTheme.getColor(ColorsTheme.ColorKey.TAGS, 0xFF0000CC)),
                    spanOffset, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            if (feedlyFonts) {
                ssb.setSpan(new CustomTypefaceSpan("", JuickAdvancedApplication.dinWebPro), spanOffset,
                        ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            } else if (helvNueFonts) {
                ssb.setSpan(new CustomTypefaceSpan("", JuickAdvancedApplication.helvNue), spanOffset,
                        ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

        }
        spanOffset = ssb.length();
    }
    if (jmsg.translated) {
        //
        // 'translated'
        //
        ssb.append("translated: ");
        ssb.setSpan(
                new ForegroundColorSpan(colorTheme.getColor(ColorsTheme.ColorKey.TRANSLATED_LABEL, 0xFF4ec856)),
                spanOffset, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        ssb.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), spanOffset, ssb.length(),
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        spanOffset = ssb.length();
    }
    int bodyOffset = ssb.length();
    int messageNumberStart = -1, messageNumberEnd = -1;
    if (showNumbers(ctx) && !condensed) {
        //
        // numbers
        //
        if (isMainMessage) {
            messageNumberStart = ssb.length();
            ssb.append(jmsg.getDisplayMessageNo());
            messageNumberEnd = ssb.length();
        } else {
            ssb.append("/" + jmsg.getRID());
            if (jmsg.getReplyTo() != 0) {
                ssb.append("->" + jmsg.getReplyTo());
            }
        }
        ssb.append(" ");
        ssb.setSpan(new ForegroundColorSpan(colorTheme.getColor(ColorsTheme.ColorKey.MESSAGE_ID, 0xFFa0a5bd)),
                spanOffset, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        spanOffset = ssb.length();
    }
    //
    // MESSAGE BODY
    //
    String txt = Censor.getCensoredText(jmsg.Text);
    if (!condensed) {
        if (jmsg.Photo != null) {
            txt = jmsg.Photo + "\n" + txt;
        }
        if (jmsg.Video != null) {
            txt = jmsg.Video + "\n" + txt;
        }
    }
    ssb.append(txt);
    boolean ssbChanged = false; // allocation optimization
    // Highlight links http://example.com/
    ArrayList<ExtractURLFromMessage.FoundURL> foundURLs = ExtractURLFromMessage.extractUrls(txt, jmsg.getMID());
    ArrayList<String> urls = new ArrayList<String>();
    for (ExtractURLFromMessage.FoundURL foundURL : foundURLs) {
        setSSBSpan(ssb, new ForegroundColorSpan(colorTheme.getColor(ColorsTheme.ColorKey.URLS, 0xFF0000CC)),
                spanOffset + foundURL.start, spanOffset + foundURL.end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        urls.add(foundURL.url);
        if (foundURL.title != null) {
            ssb.replace(spanOffset + foundURL.title.start - 1, spanOffset + foundURL.title.start, " ");
            ssb.replace(spanOffset + foundURL.title.end, spanOffset + foundURL.title.end + 1, " ");
            ssb.replace(spanOffset + foundURL.start - 1, spanOffset + foundURL.start, "(");
            ssb.replace(spanOffset + foundURL.end, spanOffset + foundURL.end + 1, ")");
            ssb.setSpan(new StyleSpan(Typeface.BOLD), spanOffset + foundURL.title.start,
                    spanOffset + foundURL.title.end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
        ssbChanged = true;
    }
    // bold italic underline
    if (jmsg.Text.indexOf("*") != -1) {
        setStyleSpans(ssb, spanOffset, Typeface.BOLD, "*");
        ssbChanged = true;
    }
    if (jmsg.Text.indexOf("/") != 0) {
        setStyleSpans(ssb, spanOffset, Typeface.ITALIC, "/");
        ssbChanged = true;
    }
    if (jmsg.Text.indexOf("_") != 0) {
        setStyleSpans(ssb, spanOffset, UnderlineSpan.class, "_");
        ssbChanged = true;
    }
    if (ssbChanged) {
        txt = ssb.subSequence(spanOffset, ssb.length()).toString(); // ssb was modified in between
    }

    // Highlight nick
    String accountName = XMPPService.getMyAccountName(jmsg.getMID(), ctx);
    if (accountName != null) {
        int scan = spanOffset;
        String nickScanArea = (ssb + " ").toUpperCase();
        while (true) {
            int myNick = nickScanArea.indexOf("@" + accountName.toUpperCase(), scan);
            if (myNick != -1) {
                if (!isNickPart(nickScanArea.charAt(myNick + accountName.length() + 1))) {
                    setSSBSpan(ssb,
                            new BackgroundColorSpan(
                                    colorTheme.getColor(ColorsTheme.ColorKey.USERNAME_ME, 0xFF938e00)),
                            myNick - 1, myNick + accountName.length() + 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                }
                scan = myNick + 1;
            } else {
                break;
            }
        }
    }

    // Highlight messages #1234
    int pos = 0;
    Matcher m = getCrossReferenceMsgPattern(jmsg.getMID()).matcher(txt);
    while (m.find(pos)) {
        ssb.setSpan(new ForegroundColorSpan(colorTheme.getColor(ColorsTheme.ColorKey.URLS, 0xFF0000CC)),
                spanOffset + m.start(), spanOffset + m.end(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        pos = m.end();
    }

    SpannableStringBuilder compactDt = null;
    if (!condensed) {

        // found messages count (search results)
        if (jmsg.myFoundCount != 0 || jmsg.hisFoundCount != 0) {
            ssb.append("\n");
            int where = ssb.length();
            if (jmsg.myFoundCount != 0) {
                ssb.append(ctx.getString(R.string.MyReplies_) + jmsg.myFoundCount + "  ");
            }
            if (jmsg.hisFoundCount != 0) {
                ssb.append(ctx.getString(R.string.UserReplies_) + jmsg.hisFoundCount);
            }
            ssb.setSpan(
                    new ForegroundColorSpan(
                            colorTheme.getColor(ColorsTheme.ColorKey.TRANSLATED_LABEL, 0xFF4ec856)),
                    where, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        }

        int rightPartOffset = spanOffset = ssb.length();

        if (!doCompactComment) {
            //
            // TIME (bottom of message)
            //

            try {
                DateFormat df = new SimpleDateFormat("HH:mm dd/MMM/yy");
                String date = jmsg.Timestamp != null ? df.format(jmsg.Timestamp) : "[bad date]";
                if (date.endsWith("/76"))
                    date = date.substring(0, date.length() - 3); // special case for no year in datasource
                ssb.append("\n" + date + " ");
            } catch (Exception e) {
                ssb.append("\n[fmt err] ");
            }

            ssb.setSpan(new ForegroundColorSpan(colorTheme.getColor(ColorsTheme.ColorKey.DATE, 0xFFAAAAAA)),
                    spanOffset, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        } else {
            compactDt = new SpannableStringBuilder();
            try {
                if (true || jmsg.deltaTime != Long.MIN_VALUE) {
                    compactDt.append(com.juickadvanced.Utils.toRelaviteDate(jmsg.Timestamp.getTime(), russian));
                } else {
                    DateFormat df = new SimpleDateFormat("HH:mm dd/MMM/yy");
                    String date = jmsg.Timestamp != null ? df.format(jmsg.Timestamp) : "[bad date]";
                    if (date.endsWith("/76"))
                        date = date.substring(0, date.length() - 3); // special case for no year in datasource
                    compactDt.append(date);
                }
            } catch (Exception e) {
                compactDt.append("\n[fmt err] ");
            }
            compactDt.setSpan(
                    new ForegroundColorSpan(colorTheme.getColor(ColorsTheme.ColorKey.DATE, 0xFFAAAAAA)), 0,
                    compactDt.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

        }

        spanOffset = ssb.length();

        //
        // Number of REPLIES
        //
        if (jmsg.replies > 0) {
            String replies = Replies + jmsg.replies;
            ssb.append(" " + replies);
            ssb.setSpan(
                    new ForegroundColorSpan(
                            colorTheme.getColor(ColorsTheme.ColorKey.NUMBER_OF_COMMENTS, 0xFFC8934E)),
                    spanOffset, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            ssb.setSpan(new WrapTogetherSpan() {
            }, spanOffset, ssb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
        if (!doCompactComment) {
            // right align
            ssb.setSpan(new AlignmentSpan.Standard(Alignment.ALIGN_OPPOSITE), rightPartOffset, ssb.length(),
                    Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
    }

    if (helvNueFonts) {
        ssb.setSpan(new CustomTypefaceSpan("", JuickAdvancedApplication.helvNue), bodyOffset, ssb.length(),
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    }

    LeadingMarginSpan.LeadingMarginSpan2 userpicSpan = null;
    if (showUserpics(ctx) && !condensed) {
        userpicSpan = new LeadingMarginSpan.LeadingMarginSpan2() {
            @Override
            public int getLeadingMarginLineCount() {
                if (_wrapUserpics) {
                    return 2;
                } else {
                    return 22222;
                }
            }

            @Override
            public int getLeadingMargin(boolean first) {
                if (first) {
                    return (int) (2 * getLineHeight(ctx, (double) textScale));
                } else {
                    return 0;
                }
            }

            @Override
            public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, int top, int baseline, int bottom,
                    CharSequence text, int start, int end, boolean first, Layout layout) {
            }
        };
        ssb.setSpan(userpicSpan, 0, ssb.length(), 0);
    }
    ParsedMessage parsedMessage = new ParsedMessage(ssb, urls);
    parsedMessage.userpicSpan = userpicSpan;
    parsedMessage.userNameBoldSpan = userNameBoldSpan;
    parsedMessage.userNameColorSpan = userNameColorSpan;
    parsedMessage.userNameStart = userNameStart;
    parsedMessage.userNameEnd = userNameEnd;
    parsedMessage.messageNumberStart = messageNumberStart;
    parsedMessage.messageNumberEnd = messageNumberEnd;
    parsedMessage.compactDate = compactDt;
    return parsedMessage;
}

From source file:com.github.omadahealth.slidepager.lib.views.ProgressView.java

/**
 * Sets the font type of {@link ViewProgressBinding#progressText}
 *
 * @param selected True for {@link TypefaceType#getDefaultTypeface(Context)} in bold, false for normal
 *//*from w w w  .j a v  a2s.c o m*/
public void isSelected(boolean selected) {
    Resources res = getContext().getResources();
    Typeface typeface = TypefaceTextView.getFont(getContext(),
            TypefaceType.getTypeface(TypefaceType.getDefaultTypeface(getContext())).getAssetFileName());
    mBinding.progressText.setTypeface(typeface, selected ? Typeface.BOLD : Typeface.NORMAL);
}

From source file:biz.bokhorst.xprivacy.ActivityMain.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    int userId = Util.getUserId(Process.myUid());
    boolean mounted = Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
    boolean updates = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingUpdates, false);

    menu.findItem(R.id.menu_export).setEnabled(mounted);
    menu.findItem(R.id.menu_import).setEnabled(mounted);

    menu.findItem(R.id.menu_submit).setEnabled(Util.hasValidFingerPrint(this));

    menu.findItem(R.id.menu_pro).setVisible(!Util.isProEnabled() && Util.hasProLicense(this) == null);

    menu.findItem(R.id.menu_dump).setVisible(Util.isDebuggable(this));

    menu.findItem(R.id.menu_update).setVisible(updates);
    menu.findItem(R.id.menu_update).setEnabled(mounted);

    // Update filter count

    // Get settings
    boolean fUsed = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFUsed, false);
    boolean fInternet = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFInternet, false);
    boolean fRestriction = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFRestriction, false);
    boolean fPermission = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFPermission, true);
    boolean fOnDemand = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFOnDemand, false);
    boolean fUser = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFUser, true);
    boolean fSystem = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFSystem, false);

    // Count number of active filters
    int numberOfFilters = 0;
    if (fUsed)//  w  ww  .  j ava 2  s  . c om
        numberOfFilters++;
    if (fInternet)
        numberOfFilters++;
    if (fRestriction)
        numberOfFilters++;
    if (fPermission)
        numberOfFilters++;
    if (fOnDemand)
        numberOfFilters++;
    if (fUser)
        numberOfFilters++;
    if (fSystem)
        numberOfFilters++;

    if (numberOfFilters > 0) {
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon_filter)
                .copy(Bitmap.Config.ARGB_8888, true);

        Paint paint = new Paint();
        paint.setStyle(Style.FILL);
        paint.setColor(Color.GRAY);
        paint.setTextSize(bitmap.getWidth() / 3);
        paint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));

        String text = Integer.toString(numberOfFilters);

        Canvas canvas = new Canvas(bitmap);
        canvas.drawText(text, bitmap.getWidth() - paint.measureText(text), bitmap.getHeight(), paint);

        MenuItem fMenu = menu.findItem(R.id.menu_filter);
        fMenu.setIcon(new BitmapDrawable(getResources(), bitmap));
    }

    return super.onPrepareOptionsMenu(menu);
}

From source file:com.hybris.mobile.app.commerce.fragment.ProductDetailFragmentBase.java

/**
 * Create table to show data in a table/*from   ww w .  j  a v a2  s  .  c om*/
 *
 * @param volumePricingTable : Table which contains from volume pricing for the current product
 */
protected void createVolumePricingTable(TableLayout volumePricingTable) {
    if (mProduct.getVolumePrices() != null) {
        TableRow headerRow = new TableRow(getActivity());

        TextView header1 = new TextView(getActivity());
        header1.setText(getString(R.string.product_detail_volume_qty));
        header1.setTypeface(null, Typeface.BOLD);
        headerRow.addView(header1);

        TextView header2 = new TextView(getActivity());
        header2.setText(getString(R.string.product_detail_volume_price));
        header2.setTypeface(null, Typeface.BOLD);
        headerRow.addView(header2);

        if (mProduct.getVolumePrices().size() > 5) {
            TextView header3 = new TextView(getActivity());
            header3.setText(getString(R.string.product_detail_volume_qty));
            header3.setTypeface(null, Typeface.BOLD);
            headerRow.addView(header3);

            TextView header4 = new TextView(getActivity());
            header4.setText(getString(R.string.product_detail_volume_price));
            header4.setTypeface(null, Typeface.BOLD);
            headerRow.addView(header4);
        }
        volumePricingTable.addView(headerRow);

        for (Price volumePrice : mProduct.getVolumePrices()) {
            TableRow contentRow = new TableRow(getActivity());

            if (volumePrice != null) {
                TextView content1 = new TextView(getActivity());
                content1.setText(volumePrice.getMinQuantity() + " - " + volumePrice.getMaxQuantity());
                contentRow.addView(content1);

                TextView content2 = new TextView(getActivity());
                content2.setText(volumePrice.getFormattedValue());
                contentRow.addView(content2);

                if (mProduct.getVolumePrices().size() > 5) {
                    TextView content3 = new TextView(getActivity());
                    content3.setText(volumePrice.getMinQuantity() + " - " + volumePrice.getMaxQuantity());
                    contentRow.addView(content3);

                    TextView content4 = new TextView(getActivity());
                    content4.setText(volumePrice.getFormattedValue());
                    contentRow.addView(content4);
                }
            } else {
                Log.d(TAG, "Price or Stock is null");
            }

            volumePricingTable.addView(contentRow);
        }
    }

}