List of usage examples for android.widget TextView setTypeface
public void setTypeface(@Nullable Typeface tf)
From source file:com.ada.utils.Ui.java
public static void setTypeface(TextView view, String path) { if (!view.isInEditMode()) { view.setTypeface(TypefaceUtils.getTypeface(view.getContext(), path)); }/*from www. j a va2s .c o m*/ }
From source file:Main.java
private static void setCustomFont(TextView c) { Object tag = c.getTag();/* w w w . j a va2 s . co m*/ if (tag instanceof String) { final String tagString = (String) tag; if (tagString.contains(TAG_BOLD) && bold != null) { c.setTypeface(bold); return; } if (tagString.contains(TAG_CONDENSED) && condensed != null) { c.setTypeface(condensed); return; } if (tagString.contains(TAG_LIGHT) && light != null) { c.setTypeface(light); return; } } if (normal != null) { c.setTypeface(normal); } }
From source file:codepath.watsiapp.utils.Util.java
public static void applyPrimaryFont(Context ctx, TextView textView) { Typeface typeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/" + PRIMARY_FONT); textView.setTypeface(typeface); }
From source file:com.scigames.slidegame.ProfileActivity.java
public static void setTextViewFont(Typeface tf, TextView... params) { for (TextView tv : params) { tv.setTypeface(tf); }/*w w w . j a v a 2 s . co m*/ }
From source file:com.spoiledmilk.ibikecph.util.Util.java
public static void launchNoConnectionDialog(Context ctx) { final Dialog dialog = new Dialog(ctx); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_no_connection); TextView text = (TextView) dialog.findViewById(R.id.textNetworkError); text.setTypeface(IbikeApplication.getNormalFont()); text.setText(IbikeApplication.getString("network_error_text")); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); dialog.show();/*from w w w . ja v a2s.c o m*/ final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { try { dialog.dismiss(); } catch (Exception e) { // dialog not attached to window } } }, 3000); }
From source file:eu.e43.impeller.Utils.java
public static void updateStatebar(View parent, int replies, int likes, int shares) { TextView commentsIcon = (TextView) parent.findViewById(R.id.commentsIcon); TextView sharesIcon = (TextView) parent.findViewById(R.id.sharesIcon); TextView likesIcon = (TextView) parent.findViewById(R.id.likesIcon); commentsIcon.setTypeface(ImpellerApplication.fontAwesome); sharesIcon.setTypeface(ImpellerApplication.fontAwesome); likesIcon.setTypeface(ImpellerApplication.fontAwesome); TextView commentCount = (TextView) parent.findViewById(R.id.commentsCount); TextView shareCount = (TextView) parent.findViewById(R.id.sharesCount); TextView likeCount = (TextView) parent.findViewById(R.id.likesCount); commentCount.setText(String.valueOf(replies)); shareCount.setText(String.valueOf(shares)); likeCount.setText(String.valueOf(likes)); }
From source file:com.androidinspain.deskclock.Utils.java
public static void setClockIconTypeface(View clock) { final TextView nextAlarmIconView = (TextView) clock.findViewById(R.id.nextAlarmIcon); nextAlarmIconView.setTypeface(UiDataModel.getUiDataModel().getAlarmIconTypeface()); }
From source file:com.fjoglar.etsitnoticias.utils.UiUtils.java
/** * Configure the TextViews that will show the attachments of the new. * * @param textView TextView to be configured. * @param title Text shown in TextView * @param downloadLink Link attached to TextView. * @param fileType Type of file of the attachment. * @param context The context of activity. *///from w w w. ja v a 2s .co m public static void configureTextView(TextView textView, String title, final String downloadLink, Attachment.FILE_TYPE fileType, final Context context) { final int TEXT_VIEW_MIN_HEIGHT = 40; final int TEXT_VIEW_MARGIN_TOP = 4; LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.setMargins(0, convertDpToPx(TEXT_VIEW_MARGIN_TOP, context), 0, 0); textView.setLayoutParams(params); textView.setText(title); textView.setTypeface(Typeface.create("sans-serif-condensed", Typeface.NORMAL)); textView.setMinHeight(convertDpToPx(TEXT_VIEW_MIN_HEIGHT, context)); textView.setGravity(Gravity.CENTER_VERTICAL); switch (fileType) { case FILE: textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_file, 0, 0, 0); break; case IMAGE: textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_photo, 0, 0, 0); break; case FOLDER: textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_folder, 0, 0, 0); break; default: textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_link, 0, 0, 0); break; } textView.setCompoundDrawablePadding(convertDpToPx(4, context)); TypedValue typedValue = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.selectableItemBackground, typedValue, true); textView.setBackgroundResource(typedValue.resourceId); textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Navigator.getInstance().openUrl(context, downloadLink); } }); }
From source file:com.android.inputmethod.keyboard.emoji.EmojiPalettesView.java
private static void setupAlphabetKey(final TextView alphabetKey, final String label, final KeyDrawParams params) { alphabetKey.setText(label);/*from w w w . j ava2 s. c o m*/ alphabetKey.setTextColor(params.mFunctionalTextColor); alphabetKey.setTextSize(TypedValue.COMPLEX_UNIT_PX, params.mLabelSize); alphabetKey.setTypeface(params.mTypeface); }
From source file:it.mb.whatshare.Dialogs.java
/** * Shows a dialog containing the code received by goo.gl if any, or an error * message stating that the pairing operation failed. * //from w w w. j a v a 2s . com * @param googl * the pairing code retrieved by goo.gl * @param activity * the caller activity */ public static void onObtainPairingCode(final String googl, final MainActivity activity) { new PatchedDialogFragment() { public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = getBuilder(activity); if (googl != null) { View layout = View.inflate(getContext(), R.layout.pairing_code_dialog, null); TextView message = (TextView) layout.findViewById(R.id.pairingCode); Typeface typeFace = Typeface.createFromAsset(activity.getAssets(), CUSTOM_TYPEFACE_PATH); message.setTypeface(typeFace); message.setText(googl); builder.setView(layout); } else { builder.setMessage(getResources().getString(R.string.code_dialog_fail)); } builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (googl != null) { Resources res = getResources(); String howManyTotal = res.getQuantityString(R.plurals.added_device, activity.getInboundDevicesCount(), activity.getInboundDevicesCount()); Toast.makeText(getActivity(), res.getString(R.string.device_paired, howManyTotal), Toast.LENGTH_LONG).show(); } } }); return builder.create(); } }.show(activity.getSupportFragmentManager(), "resultCode"); }