List of usage examples for android.text SpannableStringBuilder length
public int length()
From source file:ru.valle.btc.MainActivity.java
private void showQRCodePopupForAddress(final String address) { DisplayMetrics dm = getResources().getDisplayMetrics(); final int screenSize = Math.min(dm.widthPixels, dm.heightPixels); final String uriStr = SCHEME_BITCOIN + address; new AsyncTask<Void, Void, Bitmap>() { @Override//w ww . j av a2s. c o m protected Bitmap doInBackground(Void... params) { return QRCode.getMinimumQRCode(uriStr, ErrorCorrectLevel.M).createImage(screenSize / 2); } @Override protected void onPostExecute(final Bitmap bitmap) { if (bitmap != null) { View view = getLayoutInflater().inflate(R.layout.address_qr, mainLayout, false); if (view != null) { final ImageView qrView = (ImageView) view.findViewById(R.id.qr_code_image); qrView.setImageBitmap(bitmap); final TextView bitcoinProtocolLinkView = (TextView) view.findViewById(R.id.link1); SpannableStringBuilder labelUri = new SpannableStringBuilder(uriStr); ClickableSpan urlSpan = new ClickableSpan() { @Override public void onClick(View widget) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(uriStr)); try { startActivity(intent); } catch (Exception e) { Toast.makeText(MainActivity.this, R.string.no_apps_to_view_url, Toast.LENGTH_LONG).show(); } } }; labelUri.setSpan(urlSpan, 0, labelUri.length(), SpannableStringBuilder.SPAN_INCLUSIVE_INCLUSIVE); bitcoinProtocolLinkView.setText(labelUri); bitcoinProtocolLinkView.setMovementMethod(LinkMovementMethod.getInstance()); final TextView blockexplorerLinkView = (TextView) view.findViewById(R.id.link2); SpannableStringBuilder blockexplorerLinkText = new SpannableStringBuilder( "blockexplorer.com"); setUrlSpanForAddress("blockexplorer.com", address, blockexplorerLinkText); blockexplorerLinkView.setText(blockexplorerLinkText); blockexplorerLinkView.setMovementMethod(LinkMovementMethod.getInstance()); final TextView blockchainLinkView = (TextView) view.findViewById(R.id.link3); SpannableStringBuilder blockchainLinkText = new SpannableStringBuilder("blockchain.info"); setUrlSpanForAddress("blockchain.info", address, blockchainLinkText); blockchainLinkView.setText(blockchainLinkText); blockchainLinkView.setMovementMethod(LinkMovementMethod.getInstance()); AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setTitle(address); builder.setView(view); if (systemSupportsPrint()) { builder.setPositiveButton(R.string.print, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Renderer.printQR(MainActivity.this, SCHEME_BITCOIN + address); } }); builder.setNegativeButton(android.R.string.cancel, null); } else { builder.setPositiveButton(android.R.string.ok, null); } builder.show(); } } } }.execute(); }
From source file:com.t2.compassionMeditation.Graphs1Activity.java
/** * Sets up all parameters for display of both the chart on the screen * AND a color coded display of the parameters and their values *//*from ww w . j a v a 2 s .c o m*/ private void generateChart() { // Set up chart XYMultipleSeriesDataset deviceDataset = new XYMultipleSeriesDataset(); XYMultipleSeriesRenderer deviceRenderer = new XYMultipleSeriesRenderer(); LinearLayout layout = (LinearLayout) findViewById(R.id.deviceChart); if (mDeviceChartView != null) { layout.removeView(mDeviceChartView); } if (true) { mDeviceChartView = ChartFactory.getLineChartView(this, deviceDataset, deviceRenderer); mDeviceChartView.setBackgroundColor(Color.BLACK); layout.addView(mDeviceChartView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); } deviceRenderer.setShowLabels(false); deviceRenderer.setMargins(new int[] { 0, 5, 5, 0 }); deviceRenderer.setShowAxes(true); deviceRenderer.setShowLegend(false); deviceRenderer.setZoomEnabled(false, false); deviceRenderer.setPanEnabled(false, false); deviceRenderer.setYAxisMin(0); deviceRenderer.setYAxisMax(100); SpannableStringBuilder sMeasuresText = new SpannableStringBuilder("Displaying: "); ArrayList<Long> visibleIds = getVisibleIds(KEY_NAME); int keyCount = mBioParameters.size(); keyCount = mBioParameters.size(); int lineNum = 0; for (int i = 0; i < mBioParameters.size(); ++i) { GraphBioParameter item = mBioParameters.get(i); item.visible = visibleIds.contains(item.id); if (!item.visible) { continue; } deviceDataset.addSeries(item.series); item.color = getKeyColor(i, keyCount); // Add name of the measure to the displayed text field ForegroundColorSpan fcs = new ForegroundColorSpan(item.color); int start = sMeasuresText.length(); sMeasuresText.append(mBioParameters.get(i).title1 + ", "); int end = sMeasuresText.length(); sMeasuresText.setSpan(fcs, start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); if (sMeasuresText.length() > 40 && lineNum == 0) { lineNum++; } XYSeriesRenderer seriesRenderer = new XYSeriesRenderer(); seriesRenderer.setColor(item.color); seriesRenderer.setPointStyle(PointStyle.CIRCLE); deviceRenderer.addSeriesRenderer(seriesRenderer); } mMeasuresDisplayText.setText(sMeasuresText); }
From source file:com.tct.mail.browse.ConversationItemView.java
SpannableStringBuilder elideParticipants(List<SpannableString> parts) { final SpannableStringBuilder builder = new SpannableStringBuilder(); float totalWidth = 0; boolean ellipsize = false; float width;/*from ww w .j a v a2s .c o m*/ boolean skipToHeader = false; // start with "To: " if we're showing recipients if (mDisplayedFolder.shouldShowRecipients() && !parts.isEmpty()) { final SpannableString toHeader = SendersView.getFormattedToHeader(); CharacterStyle[] spans = toHeader.getSpans(0, toHeader.length(), CharacterStyle.class); // There is only 1 character style span; make sure we apply all the // styles to the paint object before measuring. if (spans.length > 0) { spans[0].updateDrawState(sPaint); } totalWidth += sPaint.measureText(toHeader.toString()); builder.append(toHeader); skipToHeader = true; } final SpannableStringBuilder messageInfoString = mHeader.messageInfoString; if (messageInfoString.length() > 0) { CharacterStyle[] spans = messageInfoString.getSpans(0, messageInfoString.length(), CharacterStyle.class); // There is only 1 character style span; make sure we apply all the // styles to the paint object before measuring. if (spans.length > 0) { spans[0].updateDrawState(sPaint); } // Paint the message info string to see if we lose space. float messageInfoWidth = sPaint.measureText(messageInfoString.toString()); totalWidth += messageInfoWidth; } SpannableString prevSender = null; SpannableString ellipsizedText; for (SpannableString sender : parts) { // There may be null sender strings if there were dupes we had to remove. if (sender == null) { continue; } // No more width available, we'll only show fixed fragments. if (ellipsize) { break; } CharacterStyle[] spans = sender.getSpans(0, sender.length(), CharacterStyle.class); // There is only 1 character style span. if (spans.length > 0) { spans[0].updateDrawState(sPaint); } // If there are already senders present in this string, we need to // make sure we prepend the dividing token if (SendersView.sElidedString.equals(sender.toString())) { prevSender = sender; sender = copyStyles(spans, sElidedPaddingToken + sender + sElidedPaddingToken); } else if (!skipToHeader && builder.length() > 0 && (prevSender == null || !SendersView.sElidedString.equals(prevSender.toString()))) { prevSender = sender; sender = copyStyles(spans, sSendersSplitToken + sender); } else { prevSender = sender; skipToHeader = false; } if (spans.length > 0) { spans[0].updateDrawState(sPaint); } //TS: yanhua.chen 2015-9-2 EMAIL CR_540046 MOD_S // Measure the width of the current sender and make sure we have space width = (int) sPaint.measureText(sender.toString()); if (width + totalWidth > mCoordinates.sendersWidth) { // The text is too long, new line won't help. We have to // ellipsize text. ellipsize = true; width = mCoordinates.sendersWidth - totalWidth; // ellipsis width? ellipsizedText = copyStyles(spans, TextUtils.ellipsize(sender, sPaint, width, TruncateAt.END)); width = (int) sPaint.measureText(ellipsizedText.toString()); } else { ellipsizedText = null; } totalWidth += width; //TS: yanhua.chen 2015-9-2 EMAIL CR_540046 MOD_E //[FEATURE]-Add-BEGIN by CDTS.zhonghua.tuo,05/29/2014,FR 670064 CharSequence fragmentDisplayText; if (ellipsizedText != null) { fragmentDisplayText = ellipsizedText; } else { fragmentDisplayText = sender; } boolean filterSender = false; if (mField == UIProvider.LOCAL_SEARCH_ALL || mField == UIProvider.LOCAL_SEARCH_FROM) { filterSender = true; } if (mQueryText != null && filterSender) { fragmentDisplayText = TextUtilities.highlightTermsInText(fragmentDisplayText.toString(), mQueryText); } //[FEATURE]-Add-END by CDTS.zhonghua.tuo builder.append(fragmentDisplayText); } mHeader.styledMessageInfoStringOffset = builder.length(); builder.append(messageInfoString); return builder; }
From source file:com.hichinaschool.flashcards.libanki.Sched.java
/** * Deck finished state ****************************************************** * ***************************************** *//*from w ww. j a va 2 s . com*/ public CharSequence finishedMsg(Context context) { SpannableStringBuilder sb = new SpannableStringBuilder(); sb.append(context.getString(R.string.studyoptions_congrats_finished)); StyleSpan boldSpan = new StyleSpan(Typeface.BOLD); sb.setSpan(boldSpan, 0, sb.length(), 0); sb.append(_nextDueMsg(context)); // sb.append("\n\n"); // sb.append(_tomorrowDueMsg(context)); return sb; }
From source file:com.juick.android.TagsFragment.java
private void reloadTags(final View view) { final View selectedContainer = myView.findViewById(R.id.selected_container); final View progressAll = myView.findViewById(R.id.progress_all); Thread thr = new Thread(new Runnable() { public void run() { Bundle args = getArguments(); MicroBlog microBlog;// ww w . ja v a 2s. c om JSONArray json = null; final int tagsUID = showMine ? uid : 0; if (PointMessageID.CODE.equals(args.getString("microblog"))) { microBlog = MainActivity.microBlogs.get(PointMessageID.CODE); json = ((PointMicroBlog) microBlog).getUserTags(view, uidS); } else { microBlog = MainActivity.microBlogs.get(JuickMessageID.CODE); json = ((JuickMicroBlog) microBlog).getUserTags(view, tagsUID); } if (isAdded()) { final SpannableStringBuilder tagsSSB = new SpannableStringBuilder(); if (json != null) { try { int cnt = json.length(); ArrayList<TagSort> sortables = new ArrayList<TagSort>(); for (int i = 0; i < cnt; i++) { final String tagg = json.getJSONObject(i).getString("tag"); final int messages = json.getJSONObject(i).getInt("messages"); sortables.add(new TagSort(tagg, messages)); } Collections.sort(sortables); HashMap<String, Double> scales = new HashMap<String, Double>(); for (int sz = 0, sortablesSize = sortables.size(); sz < sortablesSize; sz++) { TagSort sortable = sortables.get(sz); if (sz < 10) { scales.put(sortable.tag, 2.0); } else if (sz < 20) { scales.put(sortable.tag, 1.5); } } int start = 0; if (microBlog instanceof JuickMicroBlog && getArguments().containsKey("add_system_tags")) { start = -4; } for (int i = start; i < cnt; i++) { final String tagg; switch (i) { case -4: tagg = "public"; break; case -3: tagg = "friends"; break; case -2: tagg = "notwitter"; break; case -1: tagg = "readonly"; break; default: tagg = json.getJSONObject(i).getString("tag"); break; } int index = tagsSSB.length(); tagsSSB.append("*" + tagg); tagsSSB.setSpan(new URLSpan(tagg) { @Override public void onClick(View widget) { onTagClick(tagg, tagsUID); } }, index, tagsSSB.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); Double scale = scales.get(tagg); if (scale != null) { tagsSSB.setSpan(new RelativeSizeSpan((float) scale.doubleValue()), index, tagsSSB.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } tagOffsets.put(tagg, new TagOffsets(index, tagsSSB.length())); tagsSSB.append(" "); } } catch (Exception ex) { tagsSSB.append("Error: " + ex.toString()); } } if (getActivity() != null) { // maybe already closed? getActivity().runOnUiThread(new Runnable() { public void run() { TextView tv = (TextView) myView.findViewById(R.id.tags); progressAll.setVisibility(View.GONE); if (multi) selectedContainer.setVisibility(View.VISIBLE); tv.setText(tagsSSB, TextView.BufferType.SPANNABLE); tv.setMovementMethod(LinkMovementMethod.getInstance()); MainActivity.restyleChildrenOrWidget(view); final TextView selected = (TextView) myView.findViewById(R.id.selected); selected.setVisibility(View.VISIBLE); } }); } } } }); thr.start(); }
From source file:de.tum.in.tumcampus.auxiliary.calendar.DayView.java
/** * Return the layout for a numbered event. Create it if not already existing *///from w w w . j a v a2 s . c o m private StaticLayout getEventLayout(StaticLayout[] layouts, int i, Event event, Paint paint, Rect r) { if (i < 0 || i >= layouts.length) { return null; } StaticLayout layout = layouts[i]; // Check if we have already initialized the StaticLayout and that // the width hasn't changed (due to vertical resizing which causes // re-layout of events at min height) if (layout == null || r.width() != layout.getWidth()) { SpannableStringBuilder bob = new SpannableStringBuilder(); if (event.title != null) { // MAX - 1 since we add a space bob.append(drawTextSanitizer(event.title.toString(), MAX_EVENT_TEXT_LEN - 1)); bob.setSpan(new StyleSpan(Typeface.BOLD), 0, bob.length(), 0); bob.append(' '); } if (event.location != null) { bob.append(drawTextSanitizer(event.location.toString(), MAX_EVENT_TEXT_LEN - bob.length())); } paint.setColor(mEventTextColor); // Leave a one pixel boundary on the left and right of the rectangle for the event layout = new StaticLayout(bob, 0, bob.length(), new TextPaint(paint), r.width(), Alignment.ALIGN_NORMAL, 1.0f, 0.0f, true, null, r.width()); layouts[i] = layout; } layout.getPaint().setAlpha(mEventsAlpha); return layout; }
From source file:org.kontalk.ui.ComposeMessageFragment.java
private void showIdentityDialog(boolean informationOnly, int titleId) { String fingerprint;/*from w w w . ja v a2s . c om*/ String uid; PGPPublicKeyRing publicKey = UsersProvider.getPublicKey(getActivity(), mUserJID, false); if (publicKey != null) { PGPPublicKey pk = PGP.getMasterKey(publicKey); fingerprint = PGP.formatFingerprint(PGP.getFingerprint(pk)); uid = PGP.getUserId(pk, null); // TODO server!!! } else { // FIXME using another string fingerprint = uid = getString(R.string.peer_unknown); } SpannableStringBuilder text = new SpannableStringBuilder(); text.append(getString(R.string.text_invitation1)).append('\n'); Contact c = mConversation.getContact(); if (c != null) { text.append(c.getName()).append(" <").append(c.getNumber()).append('>'); } else { int start = text.length() - 1; text.append(uid); text.setSpan(MessageUtils.STYLE_BOLD, start, text.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } text.append('\n').append(getString(R.string.text_invitation2)).append('\n'); int start = text.length() - 1; text.append(fingerprint); text.setSpan(MessageUtils.STYLE_BOLD, start, text.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity()).setMessage(text); if (informationOnly) { builder.setTitle(titleId); } else { DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // hide warning bar hideWarning(); switch (which) { case DialogInterface.BUTTON_POSITIVE: // trust new key trustKeyChange(); break; case DialogInterface.BUTTON_NEGATIVE: // block user immediately setPrivacy(PRIVACY_BLOCK); break; } } }; builder.setTitle(titleId).setPositiveButton(R.string.button_accept, listener) .setNegativeButton(R.string.button_block, listener); } builder.show(); }
From source file:org.telegram.ui.Components.ChatActivityEnterView.java
public void setEditingMessageObject(MessageObject messageObject, boolean caption) { if (audioToSend != null || editingMessageObject == messageObject) { return;/* w w w.ja v a2 s. c om*/ } if (editingMessageReqId != 0) { ConnectionsManager.getInstance().cancelRequest(editingMessageReqId, true); editingMessageReqId = 0; } editingMessageObject = messageObject; editingCaption = caption; if (editingMessageObject != null) { if (doneButtonAnimation != null) { doneButtonAnimation.cancel(); doneButtonAnimation = null; } doneButtonContainer.setVisibility(View.VISIBLE); showEditDoneProgress(true, false); InputFilter[] inputFilters = new InputFilter[1]; if (caption) { inputFilters[0] = new InputFilter.LengthFilter(200); if (editingMessageObject.caption != null) { setFieldText(Emoji.replaceEmoji( new SpannableStringBuilder(editingMessageObject.caption.toString()), messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false)); } else { setFieldText(""); } } else { inputFilters[0] = new InputFilter.LengthFilter(4096); if (editingMessageObject.messageText != null) { ArrayList<TLRPC.MessageEntity> entities = editingMessageObject.messageOwner.entities;//MessagesQuery.getEntities(message); MessagesQuery.sortEntities(entities); SpannableStringBuilder stringBuilder = new SpannableStringBuilder( editingMessageObject.messageText); Object spansToRemove[] = stringBuilder.getSpans(0, stringBuilder.length(), Object.class); if (spansToRemove != null && spansToRemove.length > 0) { for (int a = 0; a < spansToRemove.length; a++) { stringBuilder.removeSpan(spansToRemove[a]); } } if (entities != null) { int addToOffset = 0; try { for (int a = 0; a < entities.size(); a++) { TLRPC.MessageEntity entity = entities.get(a); if (entity.offset + entity.length + addToOffset > stringBuilder.length()) { continue; } if (entity instanceof TLRPC.TL_inputMessageEntityMentionName) { if (entity.offset + entity.length + addToOffset < stringBuilder.length() && stringBuilder .charAt(entity.offset + entity.length + addToOffset) == ' ') { entity.length++; } stringBuilder.setSpan(new URLSpanUserMention( "" + ((TLRPC.TL_inputMessageEntityMentionName) entity).user_id.user_id, true), entity.offset + addToOffset, entity.offset + entity.length + addToOffset, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } else if (entity instanceof TLRPC.TL_messageEntityCode) { stringBuilder.insert(entity.offset + entity.length + addToOffset, "`"); stringBuilder.insert(entity.offset + addToOffset, "`"); addToOffset += 2; } else if (entity instanceof TLRPC.TL_messageEntityPre) { stringBuilder.insert(entity.offset + entity.length + addToOffset, "```"); stringBuilder.insert(entity.offset + addToOffset, "```"); addToOffset += 6; } else if (entity instanceof TLRPC.TL_messageEntityBold) { stringBuilder.setSpan( new TypefaceSpan(AndroidUtilities.getTypeface("fonts/rmedium.ttf")), entity.offset + addToOffset, entity.offset + entity.length + addToOffset, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } else if (entity instanceof TLRPC.TL_messageEntityItalic) { stringBuilder.setSpan( new TypefaceSpan(AndroidUtilities.getTypeface("fonts/ritalic.ttf")), entity.offset + addToOffset, entity.offset + entity.length + addToOffset, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } } } catch (Exception e) { FileLog.e(e); } } setFieldText(Emoji.replaceEmoji(stringBuilder, messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false)); } else { setFieldText(""); } } messageEditText.setFilters(inputFilters); openKeyboard(); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) messageEditText.getLayoutParams(); layoutParams.rightMargin = AndroidUtilities.dp(4); messageEditText.setLayoutParams(layoutParams); sendButton.setVisibility(GONE); cancelBotButton.setVisibility(GONE); audioVideoButtonContainer.setVisibility(GONE); attachLayout.setVisibility(GONE); sendButtonContainer.setVisibility(GONE); } else { doneButtonContainer.setVisibility(View.GONE); messageEditText.setFilters(new InputFilter[0]); delegate.onMessageEditEnd(false); audioVideoButtonContainer.setVisibility(VISIBLE); attachLayout.setVisibility(VISIBLE); sendButtonContainer.setVisibility(VISIBLE); attachLayout.setScaleX(1.0f); attachLayout.setAlpha(1.0f); sendButton.setScaleX(0.1f); sendButton.setScaleY(0.1f); sendButton.setAlpha(0.0f); cancelBotButton.setScaleX(0.1f); cancelBotButton.setScaleY(0.1f); cancelBotButton.setAlpha(0.0f); audioVideoButtonContainer.setScaleX(1.0f); audioVideoButtonContainer.setScaleY(1.0f); audioVideoButtonContainer.setAlpha(1.0f); sendButton.setVisibility(GONE); cancelBotButton.setVisibility(GONE); messageEditText.setText(""); if (getVisibility() == VISIBLE) { delegate.onAttachButtonShow(); } updateFieldRight(1); } updateFieldHint(); }
From source file:com.aujur.ebookreader.activity.ReadingFragment.java
private void displayPageNumber(int pageNumber) { String pageString;/*from www . j a v a 2 s .c o m*/ if (!config.isScrollingEnabled() && pageNumber > 0) { pageString = Integer.toString(pageNumber) + "\n"; } else { pageString = "\n"; } SpannableStringBuilder builder = new SpannableStringBuilder(pageString); builder.setSpan(new CenterSpan(), 0, builder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); pageNumberView.setTextColor(config.getTextColor()); pageNumberView.setTextSize(config.getTextSize()); pageNumberView.setTypeface(config.getDefaultFontFamily().getDefaultTypeface()); pageNumberView.setText(builder); pageNumberView.invalidate(); }
From source file:com.tct.mail.browse.ConversationItemView.java
private void layoutParticipantText(SpannableStringBuilder participantText) { if (participantText != null) { if (isActivated() && showActivatedText()) { participantText.setSpan(sActivatedTextSpan, 0, mHeader.styledMessageInfoStringOffset, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } else {/*from ww w . j a v a 2s . co m*/ participantText.removeSpan(sActivatedTextSpan); } //TS: yanhua.chen 2015-9-2 EMAIL CR_540046 MOD_S //Note sender width should use define in xml final int w = mCoordinates.sendersWidth; //TS: yanhua.chen 2015-9-2 EMAIL CR_540046 MOD_E final int h = mCoordinates.sendersHeight; mSendersTextView.setLayoutParams(new ViewGroup.LayoutParams(w, h)); mSendersTextView.setMaxLines(mCoordinates.sendersLineCount); mSendersTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mCoordinates.sendersFontSize); layoutViewExactly(mSendersTextView, w, h); /// TCT: add for search term highlight @{ boolean hasFilter = (mSearchParams != null && !TextUtils.isEmpty(mSearchParams.mFilter)); boolean fieldMatched = (mSearchParams != null && (SearchParams.SEARCH_FIELD_FROM.equals(mSearchParams.mField) || SearchParams.SEARCH_FIELD_ALL.equals(mSearchParams.mField) || SearchParams.SEARCH_FIELD_TO.equals(mSearchParams.mField))); //porting from PR937141 if (hasFilter && fieldMatched) { CharacterStyle[] spans = participantText.getSpans(0, participantText.length(), CharacterStyle.class); String senderToHightlight = participantText.toString(); CharSequence highlightedSender = TextUtilities.highlightTermsInText(senderToHightlight, mSearchParams.mFilter); highlightedSender = copyStyles(spans, highlightedSender); mSendersTextView.setText(highlightedSender); } else { mSendersTextView.setText(participantText); } /// @} } }