Example usage for android.graphics Typeface createFromAsset

List of usage examples for android.graphics Typeface createFromAsset

Introduction

In this page you can find the example usage for android.graphics Typeface createFromAsset.

Prototype

public static Typeface createFromAsset(AssetManager mgr, String path) 

Source Link

Document

Create a new typeface from the specified font data.

Usage

From source file:net.quduo.pixel.interfaces.android.common.MenuActionProvider.java

@Override
public View onCreateActionView() {

    try {//from  w w w  .j a v a 2  s.c om
        mSearchActionitem = (TextView) view.findViewById(R.id.search_action_item);
        mPlusActionItem = (TextView) view.findViewById(R.id.plus_action_item);
        Typeface typeface = Typeface.createFromAsset(context.getAssets(), "font/icon/iconfont.ttf");
        mSearchActionitem.setTypeface(typeface);
        mPlusActionItem.setTypeface(typeface);
    } catch (Exception e) {
        e.printStackTrace();
    }

    // TODO Auto-generated method stub
    //        button = (ImageView) view.findViewById(R.id.action_bar);
    //        button.setOnClickListener(new View.OnClickListener() {
    //
    //            @Override
    //            public void onClick(View v) {
    //                // TODO Auto-generated method stub
    //                Toast.makeText(context, "", Toast.LENGTH_SHORT).show();
    //            }
    //        });
    return view;
}

From source file:com.proma.Nerd.Main_Page.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);/* ww w  .  j  a  v  a 2s.  c o m*/
    ListView listView = (ListView) findViewById(R.id.listView);

    NewsControler newsControler = new NewsControler();
    try {
        ArrayList<News> newses = newsControler.getLatestNews();
        NewsAdapter adapter = new NewsAdapter(getApplicationContext(), 0, newses);
        listView.setAdapter(adapter);

    } catch (JSONException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    }
    final Typeface fontsStyle = Typeface.createFromAsset(getApplicationContext().getAssets(),
            "fonts/byekan.ttf");
    ViewGroup root = (ViewGroup) findViewById(R.id.root);
    setFont(root, fontsStyle);

}

From source file:com.rgam.morsekeyboard.GtapWelcome.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.welcome2);//from   w w  w. ja v a2s. c om

    ViewPager pager = (ViewPager) findViewById(R.id.welcome_pager);
    SimplePagerAdapter adapter = new SimplePagerAdapter(getSupportFragmentManager());
    pager.setAdapter(adapter);

    TitlePageIndicator titleIndicator = (TitlePageIndicator) findViewById(R.id.titles);
    titleIndicator.setViewPager(pager);
    titleIndicator.setTypeface(Typeface.createFromAsset(getAssets(), "typefaces/Roboto-Thin.ttf"));
}

From source file:io.mpos.ui.shared.util.UiHelper.java

public static Typeface createAwesomeFontTypeface(Context context) {
    if (awesomeFont == null) {
        awesomeFont = Typeface.createFromAsset(context.getAssets(), "font/fontawesome-webfont.ttf");
    }//from  w w  w  .  ja v  a2 s  .com
    return awesomeFont;
}

From source file:io.coldstart.android.WelcomeFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_welcome, container, false);

    ((TextView) rootView.findViewById(R.id.WelcomeTitle))
            .setTypeface(Typeface.createFromAsset((getActivity()).getAssets(), "fonts/MavenPro-Regular.ttf"));
    return rootView;
}

From source file:com.somethoughts.chinmay.game.Coin.CoinTossMainFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.coin_main_layout, container, false);

    Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/myfnt.ttf");

    TextView textViewResult = (TextView) view.findViewById(R.id.coin_result_textview);
    TextView textViewStatus = (TextView) view.findViewById(R.id.coin_status_textView);
    TextView textView1 = (TextView) view.findViewById(R.id.coin_head);

    textViewResult.setTypeface(typeface);
    textView1.setTypeface(typeface);//  w w w  .ja  v  a  2s .  co  m
    textViewStatus.setTypeface(typeface);

    //Head button click listener
    Button headButton = (Button) view.findViewById(R.id.coin_button_heads);
    headButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View viewv) {
            toss_it(true);
        }
    });

    // Tails button on click listener
    Button tailsButton = (Button) view.findViewById(R.id.coin_button_tails);
    tailsButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View viewv) {
            toss_it(false);
        }
    });

    return view;
}

From source file:CustomControl.myEditText3.java

private void init() {
    if (!isInEditMode()) {
        Typeface custom_font = Typeface.createFromAsset(getContext().getAssets(),
                "fonts/DroidKufi-Regular.ttf");
        this.setTypeface(custom_font);
        this.setAccentTypeface(custom_font);
        this.setBaseColor(ContextCompat.getColor(this.getContext(), R.color.et_textcolor));
        this.setPrimaryColor(ContextCompat.getColor(this.getContext(), R.color.et_textcolor));
        this.setTextColor(ContextCompat.getColor(this.getContext(), R.color.et_textcolor));
        this.setHintTextColor(ContextCompat.getColor(this.getContext(), R.color.et_textcolor));
        this.setErrorColor(ContextCompat.getColor(this.getContext(), R.color.app_orange_thene));
        this.setHelperTextColor(ContextCompat.getColor(this.getContext(), R.color.et_textcolor));
        this.setUnderlineColor(ContextCompat.getColor(this.getContext(), R.color.app_orange_thene));
        this.setFloatingLabelTextColor(ContextCompat.getColor(this.getContext(), R.color.et_textcolor));
        this.setFloatingLabel(MaterialEditText.FLOATING_LABEL_HIGHLIGHT);
        this.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
        //            this.setIconRight(R.drawable.ic_camera_white);

    }// w ww.  ja  v a2  s  .c o m
}

From source file:org.cocos2dx.lib.Cocos2dxTypefaces.java

public static Typeface get(Context context, String name) {
    synchronized (cache) {
        if (!cache.containsKey(name)) {
            Typeface t = Typeface.createFromAsset(context.getAssets(), name);
            cache.put(name, t);/*  w w  w.ja  v a2  s  .  co m*/
        }

        return cache.get(name);
    }
}

From source file:org.gluu.super_gluu.app.fragments.PinCodeFragment.PinCodeSettingFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_pin_code_setting, container, false);

    if (!isPin()) {
        mainActivityListener.onShowPinFragment();
    }/*from   ww  w.  j av  a2  s. co  m*/

    TextView textSettingsTitle = (TextView) view.findViewById(R.id.pinCodeTitle);
    TextView textSettingsSubTitle = (TextView) view.findViewById(R.id.pinSubCodeTitle);
    Button yesButton = (Button) view.findViewById(R.id.yes_button_pin);
    yesButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mainActivityListener.onShowPinFragment();
            setPincodeEnabled(true);
        }
    });
    Button noButton = (Button) view.findViewById(R.id.no_button_pin);
    noButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mainActivityListener.onMainActivity();
            setPincodeEnabled(false);
        }
    });

    Typeface faceLight = Typeface.createFromAsset(getActivity().getAssets(), "ProximaNova-Regular.otf");
    textSettingsTitle.setTypeface(faceLight);
    textSettingsSubTitle.setTypeface(faceLight);
    yesButton.setTypeface(faceLight);
    noButton.setTypeface(faceLight);

    return view;
}

From source file:com.example.reabar.wimc.Fragments.HomeScreenFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_home_screen, container, false);

    TextView hello = (TextView) view.findViewById(R.id.helloTextView);
    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("")) {
        hello.setTypeface(hebrew);//  w  ww.ja  v  a2 s.  c  om
    } else {
        hello.setTypeface(english);
        hello.setTextSize(26);
    }

    progressBar = (ProgressBar) view.findViewById(R.id.homepageProgressBar);
    progressBar.setVisibility(View.VISIBLE);

    if (Model.getInstance().getCurrentUser() != null) {
        Model.getInstance().getMyUnparkedCars(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) {
                    }
                });
    }

    carsList = (ListView) view.findViewById(R.id.listCarsNotParkingNow);
    adapter = new CarsNotParkingAdapter();
    carsList.setAdapter(adapter);

    carsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Object[] data = new Object[1];
            data[0] = cars.get(position).getCarId();
            fragmentCommunicator.passData(data, "ParkingScreenFragment");
        }
    });

    return view;
}