// Path: PrintClient/app/src/main/java/com/tinkerlog/printclient/util/FontCache.java
// public class FontCache {
// 
//     private static Map<String, Typeface> fontMap = new HashMap<String, Typeface>();
// 
//     public static Typeface getFont(Context context, String fontName){
//         if (fontMap.containsKey(fontName)){
//             return fontMap.get(fontName);
//         }
//         else {
//             Typeface tf = Typeface.createFromAsset(context.getAssets(), fontName);
//             fontMap.put(fontName, tf);
//             return tf;
//         }
//     }
// }


import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.EditText;
import com.tinkerlog.printclient.R;
import com.tinkerlog.printclient.util.FontCache;
package com.tinkerlog.printclient.view;



/**
 * Created by alex on 24.08.15.
 */
public class CustomEditText extends EditText {

    public CustomEditText(Context context) {
        super(context);
        initialize(context, null);
    }

    public CustomEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
        initialize(context, attrs);
    }

    public CustomEditText(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initialize(context, attrs);
    }

    private void initialize(Context context, AttributeSet attrs) {
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CustomTextView);
        String fontName = a.getString(R.styleable.CustomTextView_fontName);
        if (fontName != null) {
// Path: PrintClient/app/src/main/java/com/tinkerlog/printclient/util/FontCache.java
// public class FontCache {
// 
//     private static Map<String, Typeface> fontMap = new HashMap<String, Typeface>();
// 
//     public static Typeface getFont(Context context, String fontName){
//         if (fontMap.containsKey(fontName)){
//             return fontMap.get(fontName);
//         }
//         else {
//             Typeface tf = Typeface.createFromAsset(context.getAssets(), fontName);
//             fontMap.put(fontName, tf);
//             return tf;
//         }
//     }
// }


// Path: PrintClient/app/src/main/java/com/tinkerlog/printclient/view/CustomEditText.java
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.EditText;
import com.tinkerlog.printclient.R;
import com.tinkerlog.printclient.util.FontCache;

package com.tinkerlog.printclient.view;



/**
 * Created by alex on 24.08.15.
 */
public class CustomEditText extends EditText {

    public CustomEditText(Context context) {
        super(context);
        initialize(context, null);
    }

    public CustomEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
        initialize(context, attrs);
    }

    public CustomEditText(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initialize(context, attrs);
    }

    private void initialize(Context context, AttributeSet attrs) {
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CustomTextView);
        String fontName = a.getString(R.styleable.CustomTextView_fontName);
        if (fontName != null) {
            Typeface tf = FontCache.getFont(context, fontName);