List of usage examples for android.text.style TextAppearanceSpan TextAppearanceSpan
public TextAppearanceSpan(Context context, int appearance)
From source file:Main.java
public static void SpannableforStrUtil(Context mContext, String spannableString, TextView textView, int style, int index) { SpannableString styledText1 = new SpannableString(spannableString); styledText1.setSpan(new TextAppearanceSpan(mContext, style), index, index + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(styledText1, TextView.BufferType.SPANNABLE); }
From source file:com.fututel.ui.chat.MessageAdapter.java
public MessageAdapter(Context context, Cursor c) { super(context, R.layout.chat_list_item, c, 0); mTextSmallSpan = new TextAppearanceSpan(context, android.R.style.TextAppearance_Small); personalInfo = CallerInfo.getCallerInfoForSelf(mContext); }
From source file:com.abcvoipsip.ui.messages.MessageAdapter.java
public MessageAdapter(Context context, Cursor c) { super(context, R.layout.message_list_item, c, 0); mTextSmallSpan = new TextAppearanceSpan(context, android.R.style.TextAppearance_Small); personalInfo = CallerInfo.getCallerInfoForSelf(mContext); }
From source file:com.frostwire.android.gui.views.KeywordTagView.java
private KeywordTagView(Context context, AttributeSet attrs, KeywordFilter keywordFilter) { super(context, attrs); if (keywordFilter == null) { TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.KeywordTagView, 0, 0); count = attributes.getInteger(R.styleable.KeywordTagView_keyword_tag_count, 0); dismissible = attributes.getBoolean(R.styleable.KeywordTagView_keyword_tag_dismissable, true); boolean inclusive = attributes.getBoolean(R.styleable.KeywordTagView_keyword_tag_inclusive, true); String keyword = attributes.getString(R.styleable.KeywordTagView_keyword_tag_keyword); keywordFilter = new KeywordFilter(inclusive, keyword != null ? keyword : "[Text]", KeywordDetector.Feature.MANUAL_ENTRY); attributes.recycle();/*from w w w. j a va 2 s . c om*/ } this.keywordFilter = keywordFilter; keywordSpan = new TextAppearanceSpan(getContext(), R.style.keywordTagText); countSpan = new TextAppearanceSpan(getContext(), R.style.keywordTagCount); layoutParams = new FlexboxLayout.LayoutParams(FlexboxLayout.LayoutParams.WRAP_CONTENT, toPx(34)); layoutParams.setMargins(0, 0, toPx(6), toPx(8)); setPadding(toPx(12), toPx(4), toPx(12), toPx(4)); setMinHeight(toPx(34)); setGravity(Gravity.CENTER_VERTICAL); setCompoundDrawablePadding(toPx(6)); }
From source file:com.liuwuping.sm.ui.user.UserActivity.java
private SpannableString newTabTitle(CharSequence old, int add) { int start = old.length(); String newStr = old.toString() + "\n" + add; CharSequence newCs = newStr;/* ww w . ja v a 2 s.c om*/ SpannableString ss = new SpannableString(newCs); ss.setSpan(new TextAppearanceSpan(this, R.style.TabTitleNum), start, newCs.length(), 0); return ss; }
From source file:com.chen.mail.browse.SendersView.java
private static synchronized void getSenderResources(Context context, final boolean resourceCachingRequired) { if (sConfigurationChangedReceiver == null && resourceCachingRequired) { sConfigurationChangedReceiver = new BroadcastReceiver() { @Override// www. j av a 2 s. com public void onReceive(Context context, Intent intent) { sDraftSingularString = null; getSenderResources(context, true); } }; context.registerReceiver(sConfigurationChangedReceiver, new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED)); } if (sDraftSingularString == null) { Resources res = context.getResources(); sSendersSplitToken = res.getString(R.string.senders_split_token); sElidedString = res.getString(R.string.senders_elided); sDraftSingularString = res.getQuantityText(R.plurals.draft, 1); sDraftPluralString = res.getQuantityText(R.plurals.draft, 2); sDraftCountFormatString = res.getString(R.string.draft_count_format); sMessageInfoUnreadStyleSpan = new TextAppearanceSpan(context, R.style.MessageInfoUnreadTextAppearance); sMessageInfoReadStyleSpan = new TextAppearanceSpan(context, R.style.MessageInfoReadTextAppearance); sDraftsStyleSpan = new TextAppearanceSpan(context, R.style.DraftTextAppearance); sUnreadStyleSpan = new TextAppearanceSpan(context, R.style.SendersUnreadTextAppearance); sSendingStyleSpan = new TextAppearanceSpan(context, R.style.SendingTextAppearance); sReadStyleSpan = new TextAppearanceSpan(context, R.style.SendersReadTextAppearance); sMessageCountSpacerString = res.getString(R.string.message_count_spacer); sSendingString = res.getString(R.string.sending); sBidiFormatter = BidiFormatter.getInstance(); } }
From source file:com.roamprocess1.roaming4world.ui.messages.MessageAdapter.java
public MessageAdapter(Context context, Cursor c) { super(context, R.layout.message_list_item, c, 0); System.out.println("MessageAdapter.java inconstructor MessageAdapter() "); mTextSmallSpan = new TextAppearanceSpan(context, android.R.style.TextAppearance_Small); messageActivity = new MessageActivity(); personalInfo = CallerInfo.getCallerInfoForSelf(mContext); System.out.println("MessageAdapter.java inconstructor MessageAdapter() personalInfo is " + personalInfo); }
From source file:com.madgag.agit.RepoListFragment.java
private SpannableStringBuilder clickableWelcomeMessage() { SpannableStringBuilder message = new SpannableStringBuilder(getString(welcome_message)); applyToEntireString(message, new TextAppearanceSpan(getActivity(), R.style.WelcomeText)); final Context applicationContext = getActivity().getApplicationContext(); CharacterStyle linkStyle = new ForegroundColorSpan(getResources().getColor(R.color.link_text)); ClickableText.addLinks(message, linkStyle, new ClickableText.Listener() { public void onClick(String command, View widget) { if (command.equals("clone")) { startActivity(new Intent(applicationContext, CloneLauncherActivity.class)); }/*www .j a va 2s.co m*/ } }); return message; }
From source file:com.android.mail.browse.SendersView.java
private static synchronized void getSenderResources(Context context, final boolean resourceCachingRequired) { if (sConfigurationChangedReceiver == null && resourceCachingRequired) { sConfigurationChangedReceiver = new BroadcastReceiver() { @Override//from w ww . j av a2 s . c o m public void onReceive(Context context, Intent intent) { sDraftSingularString = null; getSenderResources(context, true); } }; context.registerReceiver(sConfigurationChangedReceiver, new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED)); } if (sDraftSingularString == null) { Resources res = context.getResources(); sSendersSplitToken = res.getString(R.string.senders_split_token); sElidedString = res.getString(R.string.senders_elided); sDraftSingularString = res.getQuantityText(R.plurals.draft, 1); sDraftPluralString = res.getQuantityText(R.plurals.draft, 2); sDraftCountFormatString = res.getString(R.string.draft_count_format); sMeSubjectString = res.getString(R.string.me_subject_pronoun); sMeObjectString = res.getString(R.string.me_object_pronoun); sToHeaderString = res.getString(R.string.to_heading); sMessageInfoUnreadStyleSpan = new TextAppearanceSpan(context, R.style.MessageInfoUnreadTextAppearance); sMessageInfoReadStyleSpan = new TextAppearanceSpan(context, R.style.MessageInfoReadTextAppearance); sDraftsStyleSpan = new TextAppearanceSpan(context, R.style.DraftTextAppearance); sUnreadStyleSpan = new TextAppearanceSpan(context, R.style.SendersAppearanceUnreadStyle); sSendingStyleSpan = new TextAppearanceSpan(context, R.style.SendingTextAppearance); sRetryingStyleSpan = new TextAppearanceSpan(context, R.style.RetryingTextAppearance); sFailedStyleSpan = new TextAppearanceSpan(context, R.style.FailedTextAppearance); sReadStyleSpan = new TextAppearanceSpan(context, R.style.SendersAppearanceReadStyle); sMessageCountSpacerString = res.getString(R.string.message_count_spacer); sSendingString = res.getString(R.string.sending); sRetryingString = res.getString(R.string.message_retrying); sFailedString = res.getString(R.string.message_failed); sBidiFormatter = BidiFormatter.getInstance(); } }
From source file:org.jraf.android.dcn.wearable.app.notif.NotificationWearableListenerService.java
private void showNotification(String title, String textShort, String textLong, @Nullable Bitmap photo, Uri contactUri, @Nullable String phoneNumber) { Log.d();// ww w . jav a 2s . c o m NotificationCompat.Builder mainNotifBuilder = new NotificationCompat.Builder(this); // Small icon mainNotifBuilder.setSmallIcon(R.drawable.ic_launcher); // Title SpannableString spannableTitle = new SpannableString(title); Object appearanceSpan = new TextAppearanceSpan(this, R.style.NotificationContentTitleTextAppearance); spannableTitle.setSpan(appearanceSpan, 0, title.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); mainNotifBuilder.setContentTitle(spannableTitle); // Text (short) -- This may be completely useless since the "big text style" (below) is always used instead SpannableString spannableTextShort = new SpannableString(textShort); appearanceSpan = new TextAppearanceSpan(this, R.style.NotificationContentTextTextAppearance); spannableTextShort.setSpan(appearanceSpan, 0, textShort.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); mainNotifBuilder.setContentText(spannableTextShort); // Text (long) SpannableString spannableTextLong = new SpannableString(textLong); appearanceSpan = new TextAppearanceSpan(this, R.style.NotificationContentTextTextAppearance); spannableTextLong.setSpan(appearanceSpan, 0, textLong.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); mainNotifBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(spannableTextLong)); // Dismiss intent Intent dismissIntent = new Intent(NotificationIntentService.ACTION_DISMISS_NOTIFICATION, null, this, NotificationIntentService.class); PendingIntent dismissPendingIntent = PendingIntent.getService(this, 0, dismissIntent, PendingIntent.FLAG_UPDATE_CURRENT); mainNotifBuilder.setDeleteIntent(dismissPendingIntent); // Wear specifics NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender(); // Contact photo if (photo != null) wearableExtender.setBackground(photo); // Actions if (phoneNumber != null) { // Call action Intent callIntent = new Intent(NotificationIntentService.ACTION_CALL, null, this, NotificationIntentService.class); callIntent.putExtra(NotificationIntentService.EXTRA_PHONE_NUMBER, phoneNumber); PendingIntent callPendingIntent = PendingIntent.getService(this, 0, callIntent, PendingIntent.FLAG_UPDATE_CURRENT); String callText = getString(R.string.notification_action_call); wearableExtender.addAction( new NotificationCompat.Action(R.drawable.ic_action_call_full, callText, callPendingIntent)); // Sms action Intent smsIntent = new Intent(NotificationIntentService.ACTION_SMS, null, this, NotificationIntentService.class); smsIntent.putExtra(NotificationIntentService.EXTRA_PHONE_NUMBER, phoneNumber); PendingIntent smsPendingIntent = PendingIntent.getService(this, 0, smsIntent, PendingIntent.FLAG_UPDATE_CURRENT); String smsText = getString(R.string.notification_action_sms); wearableExtender.addAction( new NotificationCompat.Action(R.drawable.ic_action_sms_full, smsText, smsPendingIntent)); } // 'Show contact' action Intent showContactIntent = new Intent(NotificationIntentService.ACTION_SHOW_CONTACT, null, this, NotificationIntentService.class); showContactIntent.setData(contactUri); PendingIntent showContactPendingIntent = PendingIntent.getService(this, 0, showContactIntent, PendingIntent.FLAG_UPDATE_CURRENT); String showContactText = getString(R.string.notification_action_showContact); wearableExtender.addAction(new NotificationCompat.Action(R.drawable.ic_action_show_contact_full, showContactText, showContactPendingIntent)); // Misc mainNotifBuilder.setPriority(NotificationCompat.PRIORITY_HIGH); // Time sensitive, try to appear on top mainNotifBuilder.setCategory(NotificationCompat.CATEGORY_STATUS); // Not sure if this category is really the most appropriate wearableExtender.setHintScreenTimeout(NotificationCompat.WearableExtender.SCREEN_TIMEOUT_LONG); // Could be useful mainNotifBuilder.extend(wearableExtender); // Show the notification Notification notification = mainNotifBuilder.build(); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(NOTIFICATION_ID, notification); }