List of usage examples for android.graphics Typeface createFromAsset
public static Typeface createFromAsset(AssetManager mgr, String path)
From source file:se.frikod.payday.TypefaceTextView.java
public TypefaceTextView(Context context, AttributeSet attrs) { super(context, attrs); // Get our custom attributes TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.TypefaceTextView, 0, 0); try {/*from w w w . ja v a 2s . c o m*/ String typefaceName = a.getString(R.styleable.TypefaceTextView_typeface); if (!isInEditMode() && !TextUtils.isEmpty(typefaceName)) { Typeface typeface = sTypefaceCache.get(typefaceName); if (typeface == null) { typeface = Typeface.createFromAsset(context.getAssets(), String.format("%s", typefaceName)); // Cache the Typeface object sTypefaceCache.put(typefaceName, typeface); } setTypeface(typeface); // Note: This flag is required for proper typeface rendering setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG); } } finally { a.recycle(); } }
From source file:com.yojiokisoft.globish1500.activity.EnglishFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_english, container, false); mEnglishText = (TextView) view.findViewById(R.id.english_text); mPhoneticSymbolText = (TextView) view.findViewById(R.id.phonetic_symbol); mExampleText = (TextView) view.findViewById(R.id.example); mPrevButton = (Button) view.findViewById(R.id.prev_button); mNextButton = (Button) view.findViewById(R.id.next_button); mPrevButton.setOnClickListener(mPrevButtonClicked); mNextButton.setOnClickListener(mNextButtonClicked); ImageButton speakButton = (ImageButton) view.findViewById(R.id.speak_button); speakButton.setOnClickListener(mSpeakButtonClicked); Typeface typeface = Typeface.createFromAsset(App.getInstance().getAppContext().getAssets(), "DoulosSIL-R.ttf"); mPhoneticSymbolText.setTypeface(typeface); return view;/*from w w w. j a v a 2 s . c o m*/ }
From source file:com.ipa.Tools.TypefaceTextView.java
public TypefaceTextView(Context context, AttributeSet attrs) { super(context, attrs); // Get our custom attributes TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.TypefaceTextView, 0, 0); try {//from w w w.j a v a 2 s . c o m String typefaceName = a.getString(R.styleable.TypefaceTextView_typeface); if (!isInEditMode() && !TextUtils.isEmpty(typefaceName)) { Typeface typeface = sTypefaceCache.get(typefaceName); if (typeface == null) { typeface = Typeface.createFromAsset(context.getAssets(), String.format("fonts/%s-Family.otf", typefaceName)); // Cache the Typeface object sTypefaceCache.put(typefaceName, typeface); } setTypeface(typeface); // Note: This flag is required for proper typeface rendering setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG); } } finally { a.recycle(); } }
From source file:tech.salroid.filmy.activities.CollectionsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences spref = PreferenceManager.getDefaultSharedPreferences(this); boolean nightMode = spref.getBoolean("dark", false); if (nightMode) setTheme(R.style.AppTheme_Base_Dark); else// w ww . j a va 2 s. co m setTheme(R.style.AppTheme_Base); setContentView(R.layout.activity_collections); ButterKnife.bind(this); setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setTitle(" "); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } if (nightMode) allThemeLogic(); Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/canaro_extra_bold.otf"); logo.setTypeface(typeface); setupViewPager(viewPager); tabLayout.setupWithViewPager(viewPager); favourite_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(CollectionsActivity.this, Favorite.class)); } }); watchlist_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(CollectionsActivity.this, WatchList.class)); } }); client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build(); }
From source file:com.mjaworski.myQuotes.Utils.TypefaceTextView.java
public TypefaceTextView(Context context, AttributeSet attrs) { super(context, attrs); // Get our custom attributes TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.TypefaceTextView, 0, 0); try {/* w w w.j a v a 2s .co m*/ String typefaceName = a.getString(R.styleable.TypefaceTextView_typeface); if (!isInEditMode() && !TextUtils.isEmpty(typefaceName)) { Typeface typeface = sTypefaceCache.get(typefaceName); if (typeface == null) { typeface = Typeface.createFromAsset(context.getAssets(), String.format("fonts/%s", typefaceName)); // Cache the Typeface object sTypefaceCache.put(typefaceName, typeface); } setTypeface(typeface); } } finally { a.recycle(); } }
From source file:cl.smartcities.isci.transportinspector.adapters.dialogAdapters.IncomingBusesAdapter.java
public IncomingBusesAdapter(Context pContext, ArrayList<Service> pServices, String busStop) { super(pContext, R.layout.bus_list_row); this.busStop = busStop; originalServices = pServices;//from w w w . j a v a2 s .c o m loadViewState(); this.typeface = Typeface.createFromAsset(pContext.getAssets(), pContext.getString(R.string.icon_font)); this.mInflater = (LayoutInflater) pContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.context = pContext; this.next = ContextCompat.getDrawable(this.context, R.drawable.ic_navigate_next_black_36dp); this.prev = ContextCompat.getDrawable(this.context, R.drawable.ic_navigate_before_black_36dp); this.scale = getContext().getResources().getDisplayMetrics().density; this.onIcon = ContextCompat.getDrawable(getContext(), R.drawable.ic_location_on_28dp); this.onOffIcon = ContextCompat.getDrawable(getContext(), R.drawable.ic_location_on_28dp); this.offIcon = ContextCompat.getDrawable(getContext(), R.drawable.ic_location_off_28dp); this.onIconColor = ContextCompat.getColor(getContext(), R.color.green_button); this.offIconColor = ContextCompat.getColor(getContext(), R.color.color_grey_off); this.onOffIconColor = ContextCompat.getColor(getContext(), R.color.background_white); }
From source file:com.support.android.designlibdemo.DetailContactActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); Intent intent = getIntent();//from ww w . j av a 2s. co m contact = getIntent().getParcelableExtra("ContactTag"); // Inserting Contacts // if(contact.getID()==0) { // db.addContact(contact); // } //TextView txt = (TextView) findViewById(R.id.no); final String cheeseName = intent.getStringExtra(EXTRA_NAME); QRcode = intent.getStringExtra("QRcode"); photo = intent.getStringExtra("URL"); contact = getIntent().getParcelableExtra("ContactTag"); System.out.println(contact.toString()); Typeface type = Typeface.createFromAsset(getAssets(), "varsity_regular.ttf"); TextView logo = (TextView) findViewById(R.id.logo); logo.setTypeface(type); Pic = (ImageView) findViewById(R.id.access); _name = ((TextView) findViewById(R.id.Nom)); _prenom = ((TextView) findViewById(R.id.Prenom)); _name.setText(contact.getName()); _prenom.setText(contact.get_prenom()); new DownloadImageTask().execute(Pic); // for(int i = 0 ; i < 1 ; i++ ) // new FetchFilesTask().execute(image_url[i]); }
From source file:com.netpace.expressit.android.ui.TypefaceTextView.java
public TypefaceTextView(Context context, AttributeSet attrs) { super(context, attrs); // Get our custom attributes TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.TypefaceTextView, 0, 0); try {// ww w . j a v a 2 s. co m String typefaceName = a.getString(R.styleable.TypefaceTextView_typeface); if (!isInEditMode() && !TextUtils.isEmpty(typefaceName)) { Typeface typeface = sTypefaceCache.get(typefaceName); if (typeface == null) { typeface = Typeface.createFromAsset(context.getAssets(), String.format("fonts/%s_0.otf", typefaceName)); // Cache the Typeface object sTypefaceCache.put(typefaceName, typeface); } setTypeface(typeface); // Note: This flag is required for proper typeface rendering setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG); } } finally { a.recycle(); } }
From source file:com.physphil.android.restaurantroulette.RestaurantListFragment.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true);// w w w . j a va 2 s. c om mDatabaseHelper = DatabaseHelper.getInstance(getActivity()); mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); mTf = Typeface.createFromAsset(getActivity().getAssets(), Constants.FONT_DEFAULT); // Register broadcast receivers. Need to happen here as receivers need to be active while detail fragment is updating LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mLifetimeReceiver, new IntentFilter(RestaurantFragment.ACTION_RESTAURANT_UPDATED)); }
From source file:de.enlightened.peris.TextDialogFragment.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.opensans = Typeface.createFromAsset(getActivity().getAssets(), "fonts/opensans.ttf"); this.setStyle(STYLE_NO_TITLE, getTheme()); }