Android Open Source - TypeFaceTextView Type Face Cache






From Project

Back to project page TypeFaceTextView.

License

The source code is released under:

MIT License

If you think the Android project TypeFaceTextView listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.nubicz.customviews;
//from   ww w. j av a2s. co  m
import java.util.HashMap;

import android.content.Context;
import android.graphics.Typeface;


public class TypeFaceCache {
  
  public static HashMap<String,Typeface> pCache = null;
  
  public static Typeface getFont(Context context,String path){
    
    if(pCache == null){
      pCache = new HashMap<String, Typeface>();
    }
    if(pCache.get(path) == null){
      Typeface  tf = Typeface.createFromAsset(context.getAssets(),path);
      pCache.put(path,tf);
    }
    
    return pCache.get(path);
  }
}




Java Source Code List

com.nubicz.customviews.TypeFaceAnimTextView.java
com.nubicz.customviews.TypeFaceAnimTextView.java
com.nubicz.customviews.TypeFaceCache.java
com.nubicz.customviews.TypeFaceCache.java
com.nubicz.customviews.TypeFaceTextView.java
com.nubicz.customviews.TypeFaceTextView.java
com.nubicz.typefacetextview.example.MainActivity.java