List of usage examples for android.graphics Typeface NORMAL
int NORMAL
To view the source code for android.graphics Typeface NORMAL.
Click Source Link
From source file:Main.java
public static CharSequence setTextStyleNormal(CharSequence text) { final StyleSpan style = new StyleSpan(Typeface.NORMAL); final SpannableString str = new SpannableString(text); str.setSpan(style, 0, text.length(), 0); return str;/*from w ww . ja v a 2 s . c o m*/ }
From source file:Main.java
public static int toTypefaceStyle(String fontWeight) { int style = Typeface.NORMAL; if (fontWeight != null) { if (fontWeight.equals("bold")) { style = Typeface.BOLD;// www . j a v a 2 s. c o m } } return style; }
From source file:Main.java
public static int toTypefaceStyle(String fontWeight, String fontStyle) { int style = Typeface.NORMAL; if (fontWeight != null) { if (fontWeight.equals("bold")) { if (fontStyle != null && fontStyle.equals("italic")) { style = Typeface.BOLD_ITALIC; } else { style = Typeface.BOLD;/*from w w w . j a v a2s. c om*/ } } else if (fontStyle != null && fontStyle.equals("italic")) { style = Typeface.ITALIC; } } else if (fontStyle != null && fontStyle.equals("italic")) { style = Typeface.ITALIC; } return style; }
From source file:Main.java
/** * Initializes all necessary values. Must be called once before * any other method to avoid NullPointerException. *//*from ww w .ja v a 2s . co m*/ public static void init() { // initialize all booleans to true draw_help = true; draw_aim = true; draw_shields = true; draw_battery = true; draw_controls = true; draw_stats = true; draw_btns = true; // Initialize all Paints and set as much information as possible without // access to resources titlePaint = new Paint(); titlePaint.setTextAlign(Align.LEFT); textPaint = new Paint(); textPaint.setTextAlign(Align.LEFT); textPaint.setTypeface(Typeface.create(Typeface.MONOSPACE, Typeface.NORMAL)); textPaint.setAntiAlias(true); fieldPaint = new Paint(); highlightPaint = new Paint(); highlightPaint.setStyle(Paint.Style.FILL); highlightPaint.setAntiAlias(true); arrowPaint = new Paint(); arrowPaint.setStyle(Paint.Style.FILL_AND_STROKE); arrowPaint.setStrokeWidth(3); arrowPaint.setAntiAlias(true); controlPaint = new Paint(); controlPaint.setStyle(Paint.Style.STROKE); controlPaint.setStrokeWidth(5); bitmapPaint = new Paint(); bitmapPaint = new Paint(); bitmapPaint.setStrokeWidth(10); bitmapPaint.setFilterBitmap(true); bitmapPaint.setAntiAlias(true); }
From source file:com.github.fountaingeyser.typefacecompat.TypefaceCompat.java
public static Typeface create(Context ctx, String familyName, int style) { if (isSupported(familyName)) { boolean styleAfterwards = false; String fileName = FONT_FAMILY_FILE_PREFIX.get(familyName); if (fileName.endsWith("-")) { // All styles are supported. fileName += STYLE_SUFFIX[style]; } else {//from w w w. j a v a2s.c o m switch (style) { case Typeface.NORMAL: break; case Typeface.BOLD: case Typeface.BOLD_ITALIC: // These styles are not supported by default. Therefore force style after retrieving normal font. styleAfterwards = true; break; case Typeface.ITALIC: fileName += STYLE_SUFFIX[style]; break; } } fileName += TTF_SUFFIX; // Retrieve Typeface from cache. Typeface tf = TYPEFACE_CACHE.get(fileName); if (tf == null) { // Create Typeface and cache it for later. String fontPath = "fonts/" + fileName; tf = Typeface.createFromAsset(ctx.getAssets(), fontPath); if (tf != null) { TYPEFACE_CACHE.put(fileName, tf); } } if (tf != null) { return styleAfterwards ? Typeface.create(tf, style) : tf; } } // Let the default implementation of Typeface try. return Typeface.create(familyName, style); }
From source file:net.networksaremadeofstring.rhybudd.EventsListWelcomeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.events_list_welcome_fragment, null); ((TextView) view.findViewById(R.id.WelcomeTitle)) .setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL)); ((TextView) view.findViewById(R.id.EventsListWelcomeIntro)) .setTypeface(Typeface.create("sans-serif", Typeface.NORMAL)); return view;//w w w .j a v a 2 s. com }
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. *//* w w w.j av a 2s . c o 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:app.hacked.ChallengeWelcomeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.challenge_welcome, null); ((TextView) view.findViewById(R.id.Title)).setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL)); ((TextView) view.findViewById(R.id.publicChoiceTitle)) .setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL)); ((TextView) view.findViewById(R.id.judgeTitle)) .setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL)); return view;/*from ww w .j ava 2s. c o m*/ }
From source file:app.hacked.ScheduleWelcomeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.schedule_welcome, null); ((TextView) view.findViewById(R.id.Title)).setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL)); ((TextView) view.findViewById(R.id.Welcome)).setText(Html.fromHtml(getString(R.string.ScheduleWelcome))); ((TextView) view.findViewById(R.id.Welcome)).setTypeface(Typeface.create("sans-serif", Typeface.NORMAL)); Log.e("html", getString(R.string.ScheduleWelcome)); return view;//from ww w .j av a 2 s. c om }
From source file:app.hacked.ProjectWelcomeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.project_welcome, null); ((TextView) view.findViewById(R.id.Title)).setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL)); ((ImageButton) view.findViewById(R.id.addProjectButton)).setOnClickListener(new View.OnClickListener() { @Override/*from w w w. java2 s. c o m*/ public void onClick(View view) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.hackerleague.org/hackathons/hacked/hacks"))); /*if (getActivity().findViewById(R.id.ProjectDetails) != null) { AddProjectFragment fragment = new AddProjectFragment(); getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.ProjectDetails, fragment).commit(); } else { Intent addProjectIntent = new Intent(getActivity(), AddProjectActivity.class); startActivity(addProjectIntent); }*/ } }); return view; }