Example usage for android.widget TextView setTypeface

List of usage examples for android.widget TextView setTypeface

Introduction

In this page you can find the example usage for android.widget TextView setTypeface.

Prototype

public void setTypeface(@Nullable Typeface tf) 

Source Link

Document

Sets the typeface and style in which the text should be displayed.

Usage

From source file:com.ibm.mil.readyapps.physio.fragments.library.ExerciseFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Google Analytics
    Tracker tracker = PhysioApplication.tracker;
    tracker.setScreenName("Exercise screen");
    tracker.send(new HitBuilders.ScreenViewBuilder().build());

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

    // set custom typeface on header text
    Typeface robotoRegular = AndroidUtils.robotoRegular(getActivity());
    TextView routineName = (TextView) view.findViewById(R.id.routine_name);
    routineName.setTypeface(robotoRegular);
    TextView routineDirections = (TextView) view.findViewById(R.id.routine_directions);
    routineDirections.setTypeface(robotoRegular);

    return view;/*from   w  w w.  j ava 2  s  .co m*/
}

From source file:com.bytestemplar.tonedef.international.ButtonsFragment.java

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    TextView tv_name = (TextView) getView().findViewById(R.id.tv_countryname);
    tv_name.setTypeface(UICustom.getInstance().getTypeface());

    int position = -1;

    if (savedInstanceState != null) {
        position = savedInstanceState.getInt(ARG_POSITION);

    } else {//  w  ww . j a  va  2  s  .c  om
        Bundle args = getArguments();
        if (args != null) {
            position = getArguments().getInt(ARG_POSITION);
        }
    }

    if (position >= 0) {
        updateButtons(position);
    }

}

From source file:com.example.rosem.TravelPlanner.Fragment.SettingFragment.java

@Nullable
@Override//from   ww w. jav  a  2s.co  m
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    ViewGroup view = (ViewGroup) inflater.inflate(R.layout.setting_layout, container, false);

    logout = (TextView) view.findViewById(R.id.logout);
    TextView license = (TextView) view.findViewById(R.id.license);

    logout.setTypeface(fontType);
    license.setTypeface(fontType);

    logout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            FirebaseAuth auth = FirebaseAuth.getInstance();
            FirebaseUser user = auth.getCurrentUser();
            if (user != null) {
                auth.signOut();
                Toast.makeText(getContext(), getString(R.string.logout_success), Toast.LENGTH_SHORT).show();
                logout.setText(getString(R.string.login));
            } else {
                Intent intent = new Intent(getContext(), SignInActivity.class);
                startActivityForResult(intent, SIGN_IN);

            }

        }
    });
    license.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.license_url)));
            startActivity(intent);
        }
    });

    return view;
}

From source file:com.ibm.mil.readyapps.physio.fragments.FormFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Google Analytics
    Tracker tracker = PhysioApplication.tracker;
    tracker.setScreenName("Forms screen");
    tracker.send(new HitBuilders.ScreenViewBuilder().build());

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

    // set custom typeface on header and footer text
    Typeface robotoRegular = AndroidUtils.robotoRegular(getActivity());
    TextView title = (TextView) view.findViewById(R.id.title);
    title.setTypeface(robotoRegular);
    TextView directions = (TextView) view.findViewById(R.id.directions);
    directions.setTypeface(robotoRegular);
    Button nextButton = (Button) view.findViewById(R.id.next_button);
    nextButton.setTypeface(robotoRegular);

    nextButton.setOnClickListener(new View.OnClickListener() {
        @Override//from   w  ww.java2  s  . com
        public void onClick(View v) {
            PainLocationFragment fragment = new PainLocationFragment();
            fragment.setBlue(true);

            getFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment)
                    .addToBackStack(null).commit();
        }
    });

    return view;
}

From source file:com.ibm.mil.readyapps.physio.fragments.library.EndRoutineFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Google Analytics
    Tracker tracker = PhysioApplication.tracker;
    tracker.setScreenName("End routine screen");
    tracker.send(new HitBuilders.ScreenViewBuilder().build());

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

    // set custom typeface for header and footer text
    Typeface robotoRegular = AndroidUtils.robotoRegular(getActivity());
    TextView title = (TextView) view.findViewById(R.id.title);
    title.setTypeface(robotoRegular);
    Button submitButton = (Button) view.findViewById(R.id.submit_button);
    submitButton.setTypeface(robotoRegular);

    submitButton.setOnClickListener(new View.OnClickListener() {
        @Override/* www  .  j  a  v  a2  s.  c  o  m*/
        public void onClick(View v) {
            // show alert dialog asking if user wants to end their routine
            final PhysioAlertDialog alertDialog = new PhysioAlertDialog(getActivity());
            alertDialog.setPrimaryText(getString(R.string.end_routine_dialog_message));
            alertDialog.hideSecondaryText(true);
            alertDialog.setPositiveClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    // unwind entire exercise library fragment sequence from back stack
                    ((LandingActivity) getActivity()).unwindFragmentBackStack(LibraryFragment.class);
                    alertDialog.cancel();
                }
            });
            alertDialog.setNegativeClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    alertDialog.cancel();
                }
            });
            alertDialog.show();
        }
    });

    return view;
}

From source file:com.skubit.android.transactions.TransactionsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.wallet_transactions_fragment, null);
    TextView balanceLabel = (TextView) view.findViewById(R.id.wallet_balance_label);
    balanceLabel.setTypeface(FontManager.CONDENSED_REGULAR);

    mBalance = (TextView) view.findViewById(R.id.wallet_balance);

    ListView list = (ListView) view.findViewById(R.id.list);
    list.setAdapter(mAdapter);//w w w  .  j a  va  2s  . co m

    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapter, View arg1, int position, long arg3) {
            TransactionDto transactionDto = (TransactionDto) adapter.getItemAtPosition(position);
            ObjectMapper mapper = new ObjectMapper();
            String value;
            try {
                value = mapper.writeValueAsString(transactionDto);
                startActivity(TransactionDetailsActivity.newIntent(value, getActivity().getPackageName()));
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            }
        }

    });

    return view;
}

From source file:agronet.mpayer.zegetech.com.mpayercashbox.fragments.HomeMenuFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    switch (position) {
    case 0:/* w ww .ja  v a 2s.  c o m*/
        View view = inflater.inflate(R.layout.fragment_home, container, false);

        TextView tv = (TextView) view.findViewById(R.id.orders);
        tv.setTypeface(Constants.getCustomFace(getActivity(), "Open"));

        ImageView btnOrders = (ImageView) view.findViewById(R.id.ordersBtn);
        btnOrders.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(getActivity(), OrdersActivity.class);
                startActivity(i);
            }
        });
        tv = (TextView) view.findViewById(R.id.transactions);
        tv.setTypeface(Constants.getCustomFace(getActivity(), "Open"));

        ImageView btnTransactions = (ImageView) view.findViewById(R.id.transactionsBtn);
        btnTransactions.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(getActivity(), TransactionsActivity.class);
                startActivity(i);
            }
        });

        tv = (TextView) view.findViewById(R.id.accounts);
        tv.setTypeface(Constants.getCustomFace(getActivity(), "Open"));

        ImageView btnAccounts = (ImageView) view.findViewById(R.id.accountsBtn);
        btnAccounts.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(getActivity(), AccountsActivity.class);
                startActivity(i);
            }
        });

        tv = (TextView) view.findViewById(R.id.members);
        tv.setTypeface(Constants.getCustomFace(getActivity(), "Open"));

        ImageView btnMembers = (ImageView) view.findViewById(R.id.membersBtn);
        btnMembers.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(getActivity(), MembersActivity.class);
                startActivity(i);
            }
        });

        tv = (TextView) view.findViewById(R.id.reports);
        tv.setTypeface(Constants.getCustomFace(getActivity(), "Open"));

        ImageView btnReports = (ImageView) view.findViewById(R.id.reportsBtn);
        btnReports.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(getActivity(), ReportsActivity.class);
                startActivity(i);
            }
        });

        tv = (TextView) view.findViewById(R.id.settings);
        tv.setTypeface(Constants.getCustomFace(getActivity(), "Open"));

        ImageView btnSettings = (ImageView) view.findViewById(R.id.settingsBtn);
        btnSettings.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(getActivity(), SettingsActivity.class);
                startActivity(i);
            }
        });
        return view;
    case 1:
        LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        FrameLayout fl = new FrameLayout(getActivity());

        fl.setLayoutParams(params);

        final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
                getResources().getDisplayMetrics());
        TextView v = new TextView(getActivity());
        params.setMargins(margin, margin, margin, margin);
        v.setLayoutParams(params);
        v.setLayoutParams(params);
        v.setGravity(Gravity.CENTER);
        v.setText("LOG");

        fl.addView(v);
        return fl;
    }
    return null;
}

From source file:com.bytestemplar.tonedef.international.ButtonsFragment.java

public void updateButtons(int position) {
    LinearLayout ll_btn_container = (LinearLayout) getView().findViewById(R.id.buttons_container);

    if (ll_btn_container != null) {

        _current_position = position;//from  ww w.j a v  a 2  s .com
        CountryTones current_tones = CountryTonesRepository.getInstance().getCountryAtPosition(position);

        ll_btn_container.removeAllViewsInLayout();

        // Update label
        TextView tv_name = (TextView) getView().findViewById(R.id.tv_countryname);
        tv_name.setText(current_tones.getName());
        tv_name.setTypeface(UICustom.getInstance().getTypeface());
        if (current_tones.getFlagDrawable() > 0) {
            tv_name.setCompoundDrawablesWithIntrinsicBounds(current_tones.getFlagDrawable(), 0, 0, 0);
        }

        // Generate buttons
        HashMap<String, ToneSequence> sequences = current_tones.getSequences();

        for (Object o : sequences.entrySet()) {
            Map.Entry pair = (Map.Entry) o;

            String sequence_name = (String) pair.getKey();
            final ToneSequence sequence = (ToneSequence) pair.getValue();

            Button btn = new Button(ll_btn_container.getContext());
            btn.setText(sequence_name);
            btn.setTypeface(UICustom.getInstance().getTypeface());
            btn.setBackgroundResource(R.drawable.touchpadbutton);
            btn.setTextColor(Color.WHITE);
            btn.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    switch (event.getAction()) {
                    case MotionEvent.ACTION_DOWN:
                        sequence.start();
                        v.setBackgroundResource(R.drawable.touchpadbutton_selected);
                        break;
                    case MotionEvent.ACTION_UP:
                    case MotionEvent.ACTION_CANCEL:
                        sequence.stop();
                        v.setBackgroundResource(R.drawable.touchpadbutton);
                        break;
                    }
                    return false;
                }
            });
            btn.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT));
            ll_btn_container.addView(btn);
        }
    }
}

From source file:com.example.igorklimov.popularmoviesdemo.activities.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //        Stetho.initializeWithDefaults(this);
    //        OkHttpClient client = new OkHttpClient();
    //        client.networkInterceptors().add(new StethoInterceptor());
    //        Stetho.initialize(
    //                Stetho.newInitializerBuilder(this)
    //                        .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
    //                        .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
    //                        .build());
    ////from   w ww .  j  ava 2s. c  o  m
    //        client.networkInterceptors().add(new StethoInterceptor());

    setContentView(R.layout.drawer);
    Utility.setIsTabletPreference(this, findViewById(R.id.details_fragment) != null);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    if (savedInstanceState == null)
        Utility.setSortByPreference(this, 1);

    SyncAdapter.initializeSyncAdapter(this);

    mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawer, toolbar,
            R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    mDrawer.addDrawerListener(toggle);
    toggle.syncState();
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    navigationView.setItemIconTintList(null);
    navigationView.setItemTextColor(null);
    Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/RemachineScript_Personal_Use.ttf");
    TextView title = (TextView) findViewById(R.id.app_title);
    if (title != null)
        title.setTypeface(typeface);

}

From source file:ca.rmen.android.palidamuerte.app.poem.detail.PoemDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.v(TAG, "onCreateView");
    final View rootView = inflater.inflate(R.layout.fragment_poem_detail, container, false);
    TextView tvTitleView = (TextView) rootView.findViewById(R.id.title);
    Typeface font = Font.getTypeface(getActivity());
    tvTitleView.setTypeface(font);
    updateView(getActivity(), rootView);
    return rootView;
}