List of usage examples for android.graphics Typeface createFromAsset
public static Typeface createFromAsset(AssetManager mgr, String path)
From source file:com.adrianlesniak.gamerspot.extra.CustomTypefaceSpan.java
/** * Load the {@link android.graphics.Typeface} and apply to a {@link Spannable}. */// ww w . ja v a2s .c o m public CustomTypefaceSpan(Context context, String typefaceName) { mTypeface = sTypefaceCache.get(typefaceName); if (mTypeface == null) { mTypeface = Typeface.createFromAsset(context.getAssets(), typefaceName); // Cache the loaded Typeface sTypefaceCache.put(typefaceName, mTypeface); } }
From source file:net.netmadness.net.TypefaceSpan.java
/** * Load the {@link Typeface} and apply to a {@link Spannable}. *//* w w w . j ava 2s. co m*/ public TypefaceSpan(Context context, String typefaceName) { mTypeface = sTypefaceCache.get(typefaceName); if (mTypeface == null) { mTypeface = Typeface.createFromAsset(context.getApplicationContext().getAssets(), typefaceName); // Cache the loaded Typeface sTypefaceCache.put(typefaceName, mTypeface); } }
From source file:com.example.reabar.wimc.Fragments.MySharedCarsScreenFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_my_shared_cars_screen, container, false); TextView title = (TextView) view.findViewById(R.id.logoText); TextView text = (TextView) view.findViewById(R.id.textTextView); Typeface english = Typeface.createFromAsset(getActivity().getAssets(), "KOMIKAX_.ttf"); // create a typeface from the raw ttf Typeface hebrew = Typeface.createFromAsset(getActivity().getAssets(), "OpenSansHebrew-Bold.ttf"); // create a typeface from the raw ttf if (Locale.getDefault().getDisplayLanguage().equals("")) { title.setTypeface(hebrew);/*from w ww . ja v a 2 s . c om*/ text.setTypeface(hebrew); } else { title.setTypeface(english); text.setTypeface(english); } if (cars == null) { cars = new ArrayList<>(); } progressBar = (ProgressBar) view.findViewById(R.id.mySharedCars_ProgressBar); progressBar.setVisibility(View.VISIBLE); carsList = (ListView) view.findViewById(R.id.listShredCars); Model.getInstance().getListOfSharedCars(Model.getInstance().getCurrentUser().getEmail(), new Model.SyncListener() { @Override public void passData(Object allCars) { cars = (ArrayList) allCars; progressBar.setVisibility(View.GONE); adapter.notifyDataSetChanged(); } @Override public void isSuccessful(boolean s) { } @Override public void failed(String s) { } }); adapter = new MySharedCarsAdapter(); carsList.setAdapter(adapter); /* carsList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(MyApplication.getAppActivity(), "Row Clicked!", Toast.LENGTH_SHORT).show(); } });*/ return view; }
From source file:org.cs15.xchievements.views.ActionBarFont.java
/** * Load the {@link android.graphics.Typeface} and apply to a {@link android.text.Spannable}. */// www. j a v a 2 s. c o m public ActionBarFont(Context context, String typefaceName) { mTypeface = sTypefaceCache.get(typefaceName); if (mTypeface == null) { mTypeface = Typeface.createFromAsset(context.getApplicationContext().getAssets(), String.format("fonts/%s", typefaceName)); // Cache the loaded Typeface sTypefaceCache.put(typefaceName, mTypeface); } }
From source file:com.ticketmaster.servos.util.TypefaceSpan.java
/** * Load the {@link Typeface} and apply to a spannable. * @param context An application or activity context. * @param typefacePathName The typeface name with path relative to the assets folder. *//*from w w w . j a v a 2 s. co m*/ public TypefaceSpan(Context context, String typefacePathName) { mTypeface = sTypefaceCache.get(typefacePathName); if (mTypeface == null) { mTypeface = Typeface.createFromAsset(context.getApplicationContext().getAssets(), typefacePathName); // Cache the loaded Typeface sTypefaceCache.put(typefacePathName, mTypeface); } }
From source file:se.attentec.attenhome.TypefaceSpan.java
/** * Load the {@link Typeface} and apply to a {@link Spannable}. */// ww w.ja va 2s . c o m public TypefaceSpan(Context context, String typefaceName, int colorId) { mTypeface = sTypefaceCache.get(typefaceName); mColor = context.getResources().getColor(colorId); if (mTypeface == null) { mTypeface = Typeface.createFromAsset(context.getApplicationContext().getAssets(), String.format("fonts/%s", typefaceName)); // Cache the loaded Typeface sTypefaceCache.put(typefaceName, mTypeface); } }
From source file:de.enlightened.peris.PreviewDialogFragment.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.opensans = Typeface.createFromAsset(getActivity().getAssets(), "fonts/opensans.ttf"); final SharedPreferences appPreferences = getActivity().getSharedPreferences("prefs", 0); this.useShading = appPreferences.getBoolean("use_shading", false); this.useOpenSans = appPreferences.getBoolean("use_opensans", true); this.fontSize = appPreferences.getInt("font_size", DEFAULT_FONT_SIZE); this.setStyle(DialogFragment.STYLE_NORMAL, getTheme()); }
From source file:org.lol.reddit.common.General.java
public static Typeface getMonoTypeface(Context context) { if (monoTypeface == null) { monoTypeface = Typeface.createFromAsset(context.getAssets(), "fonts/VeraMono.ttf"); }/*from w w w . j a v a2 s . co m*/ return monoTypeface; }
From source file:org.lol.reddit.views.PostListingHeader.java
public PostListingHeader(final Context context, final String titleText, final String subtitleText) { super(context); final float dpScale = context.getResources().getDisplayMetrics().density; setOrientation(LinearLayout.VERTICAL); final int sidesPadding = (int) (15.0f * dpScale); final int topPadding = (int) (10.0f * dpScale); setPadding(sidesPadding, topPadding, sidesPadding, topPadding); final Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Light.ttf"); final TextView title = new TextView(context); title.setText(StringUtils.abbreviate(titleText, 33)); title.setTextSize(22.0f);/* w w w . ja v a 2 s. c o m*/ title.setTypeface(tf); title.setTextColor(Color.WHITE); addView(title); final TextView subtitle = new TextView(context); subtitle.setTextSize(14.0f); subtitle.setText(StringUtils.abbreviate(subtitleText, 50)); subtitle.setTextColor(Color.rgb(200, 200, 200)); addView(subtitle); setBackgroundColor(Color.rgb(50, 50, 50)); // TODO theme color }
From source file:com.docd.purefm.adapters.BrowserListAdapter.java
public BrowserListAdapter(@NonNull final Activity context) { super(context); mTypefaceMonospace = Typeface.createFromAsset(context.getAssets(), "DroidSansMono.ttf"); }