List of usage examples for android.graphics Typeface createFromAsset
public static Typeface createFromAsset(AssetManager mgr, String path)
From source file:tech.salroid.filmy.activities.AboutActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); nightMode = sp.getBoolean("dark", false); if (nightMode) setTheme(R.style.AppTheme_Base_Dark); else//from w w w . j a va2 s. c o m setTheme(R.style.AppTheme_Base); setContentView(R.layout.activity_developers); ButterKnife.bind(this); setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(""); } Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/canaro_extra_bold.otf"); logo.setTypeface(typeface); if (nightMode) allThemeLogic(); }
From source file:com.jaguarlandrover.auto.remote.vehicleentry.LockActivityFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_lock, container, false); sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity()); Typeface fontawesome = Typeface.createFromAsset(getActivity().getAssets(), "fonts/fontawesome-webfont.ttf"); lock = (ImageButton) view.findViewById(R.id.lock); unlock = (ImageButton) view.findViewById(R.id.unlock); trunk = (ImageButton) view.findViewById(R.id.trunk); find = (ImageButton) view.findViewById(R.id.find); start = (ImageButton) view.findViewById(R.id.start); stop = (ImageButton) view.findViewById(R.id.stop); panic = (ImageButton) view.findViewById(R.id.panic); share = (ImageButton) view.findViewById(R.id.share); change = (ImageButton) view.findViewById(R.id.change); keylbl = (TextView) view.findViewById(R.id.keysharelbl); validDate = (TextView) view.findViewById(R.id.guestvalidDate); validTime = (TextView) view.findViewById(R.id.guestvalidTime); userHeader = (TextView) view.findViewById(R.id.user_header); vehicleHeader = (TextView) view.findViewById(R.id.vehicle_header); keyManagementLayout = (LinearLayout) view.findViewById(R.id.key_management_layout); // panicOn = (Button) view.findViewById(R.id.panicOn); UserCredentials userCredentials = ServerNode.getUserCredentials(); if (userCredentials == null) { setButtons(new UserCredentials()); } else {/*from w ww. j ava 2s . c o m*/ setButtons(userCredentials); } buttonSet = new Handler(); startRepeatingTask(); lock.setOnClickListener(l); unlock.setOnClickListener(l); trunk.setOnClickListener(l); find.setOnClickListener(l); start.setOnClickListener(l); stop.setOnClickListener(l); panic.setOnClickListener(l); share.setOnClickListener(l); change.setOnClickListener(l); // panicOn.setOnClickListener(l); buttonListener = (LockFragmentButtonListener) getActivity(); return view; }
From source file:sk.jmurin.android.hradcicva.gui.MainActivityIncludeFragment.java
@Nullable @Override/*from w w w. j a v a 2 s. c o m*/ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.activity_main_include_fragment, container, false); CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) view .findViewById(R.id.collapsing_toolbar); collapsingToolbar.setTitle(getString(R.string.toolbar_title)); tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Constantia.ttf"); collapsingToolbar.setCollapsedTitleTypeface(tf); collapsingToolbar.setExpandedTitleTypeface(tf); final ImageView imageView = (ImageView) view.findViewById(R.id.backdrop); Glide.with(this).load(Database.getHeaderDrawable()).centerCrop().into(imageView); RecyclerView rv = (RecyclerView) view.findViewById(R.id.recyclerview); setupRecyclerView(rv); return view; }
From source file:com.module.candychat.net.wouclass.SimpleAssetFontLoader.java
@Override public Typeface getTypeFace(String typefaceName) { Typeface typeface = sTypefaceCache.get(typefaceName); if (typeface == null) { String fontFile = mFolderForPath + typefaceName + "." + mExtension; try {/*from ww w. j av a 2s .c o m*/ typeface = Typeface.createFromAsset(mAssetManager, fontFile); sTypefaceCache.put(typefaceName, typeface); } catch (java.lang.RuntimeException e) { return android.graphics.Typeface.DEFAULT; } } return typeface; }
From source file:com.github.irib_examples.Act_JsonRequest.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.act__json_request); mTvadad = (TextView) findViewById(R.id.tv_adad); Typeface face = Typeface.createFromAsset(getAssets(), "fonts/IRIB.TTF"); mTvadad.setTypeface(face);//from ww w.ja v a2s. com mTvResult = (TextView) findViewById(R.id.tv_result); mTvResult.setTypeface(face); mTvResult2 = (TextView) findViewById(R.id.tv_result2); mTvResult2.setTypeface(face); Button btnJsonRequest = (Button) findViewById(R.id.btn_json_request); btnJsonRequest.setTypeface(face); btnJsonRequest.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { RequestQueue queue = MyVolley.getRequestQueue(); URL = urlurl5 + Integer.toString(count); JsonObjectRequest myReq = new JsonObjectRequest(Method.GET, URL, null, createMyReqSuccessListener(), createMyReqErrorListener()); queue.add(myReq); String tvtxt = mTvResult.getText().toString(); String tvtxt2 = mTvResult2.getText().toString(); if (tvtxt == "null") count = 1; else if (tvtxt != "" && tvtxt2 != "") count++; } }); }
From source file:com.achillesrasquinha.biblegenerator.ImageGenerator.java
public ImageGenerator(Context context) { mContext = context;/*from w w w . j a v a2s . co m*/ DisplayMetrics m = mContext.getResources().getDisplayMetrics(); mImageSize = new Point(); mImageSize.x = m.widthPixels; mImageSize.y = mImageSize.x; mX = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, m)); mSizeTitle = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 24, m); mYTitle = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, m) + mSizeTitle); mSizeSubtitle = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 14, m); mYSubtitle = Math .round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, m) + mYTitle + mSizeSubtitle); mLineSpacing = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, m); mTextPaint = new TextPaint(); mTextPaint.setAntiAlias(true); mTextPaint.setTextAlign(TextPaint.Align.LEFT); mTextPaint.setTypeface(Typeface.createFromAsset(mContext.getAssets(), "fonts/Roboto/Roboto-Medium.ttf")); mColor1 = ContextCompat.getColor(mContext, R.color.primary_text_default_material_light); mColor2 = ContextCompat.getColor(mContext, R.color.primary_text_disabled_material_light); mColor3 = ContextCompat.getColor(mContext, R.color.secondary_text_default_material_light); }
From source file:fr.outadev.skinswitch.SkinsListAdapter.java
public SkinsListAdapter(Activity activity, SkinsListFragment frag, int resource, List<BasicSkin> array) { super(activity, resource, array); this.frag = frag; this.activity = activity; minecraftiaFont = Typeface.createFromAsset(getContext().getAssets(), "Minecraftia.ttf"); wasTutorialPlayed = PreferenceManager.getDefaultSharedPreferences(getContext()) .getBoolean("wasTutorialPlayed", false); }
From source file:com.somethoughts.chinmay.game.Dice.DiceFragment.java
void spin() { if (inProgress) { Toast.makeText(getActivity(), "Please Wait", Toast.LENGTH_SHORT).show(); return;/*from w w w .j a va2s .co m*/ } Typeface custom_font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/myfnt.ttf"); final TextView textView = (TextView) view.findViewById(R.id.dice_result_textview); final TextView textViewrun = (TextView) view.findViewById(R.id.result_textView_run); final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.dice_progressBar); progressBar.setIndeterminate(false); progressBar.setMax(3000); textView.setTypeface(custom_font); textViewrun.setTypeface(custom_font); progressBar.setVisibility(View.VISIBLE); countDownTimer = new CountDownTimer(3000, 250) { @Override public void onTick(long l) { inProgress = true; Random random = new Random(); progressBar.setProgress(3000 - (int) l); Log.v("Progress", Integer.toString(progressBar.getProgress())); textViewrun.setVisibility(View.VISIBLE); textViewrun.setText("Waiting"); textView.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark)); textView.setText(Integer.toString(random.nextInt(6) + 1)); } @Override public void onFinish() { inProgress = false; view.setBackgroundColor(getResources().getColor(R.color.colorWin)); textViewrun.setText("Here you go"); progressBar.setProgress(3000); return; } }.start(); }
From source file:me.trashout.fragment.ThankYouFragment.java
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_thank_you, container, false); ButterKnife.bind(this, view); this.trashResponse = getArguments().getParcelable(BUNDLE_TRASH_RESPONSE); Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/capriola.ttf"); thankYouTitle.setTypeface(typeface); return view;/*from w w w .j a v a 2s . c o m*/ }
From source file:pedromendes.tempodeespera.HospitalDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_hospital_detail); Typeface font = Typeface.createFromAsset(getAssets(), "fontawesome-webfont.ttf"); Long hospitalId = getIntent().getExtras().getLong("HOSPITAL_ID"); String hospitalName = getIntent().getExtras().getString("HOSPITAL_NAME"); String hospitalDescription = getIntent().getExtras().getString("HOSPITAL_DESCRIPTION"); String hospitalAddress = getIntent().getExtras().getString("HOSPITAL_ADDRESS"); final String hospitalPhone = getIntent().getExtras().getString("HOSPITAL_PHONE"); String hospitalEmail = getIntent().getExtras().getString("HOSPITAL_EMAIL"); String latitude = getIntent().getExtras().getString("HOSPITAL_LAT"); String longitude = getIntent().getExtras().getString("HOSPITAL_LONG"); TextView hospitalNameView = (TextView) findViewById(R.id.hospitalName); hospitalNameView.setText(hospitalName); if (hospitalAddress != null && !hospitalAddress.isEmpty()) { TextView hospitalAddressView = (TextView) findViewById(R.id.hospitalAddress); hospitalAddressView.setText(Html.fromHtml(hospitalAddress + "<br/>" + "<a href=\"geo:" + latitude + "," + longitude + "\">" + "Ver mapa" + "</a>")); hospitalAddressView.setMovementMethod(LinkMovementMethod.getInstance()); }/*from w w w .j ava 2 s . com*/ if (hospitalPhone != null && !hospitalPhone.isEmpty()) { Button hospitalPhoneView = (Button) findViewById(R.id.hospitalPhone); hospitalPhoneView.append(" " + hospitalPhone); hospitalPhoneView.setTypeface(font); hospitalPhoneView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + hospitalPhone)); callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { return; } startActivity(callIntent); } }); } dialog = new ProgressDialog(this); dialog.setMessage("A carregar..."); dialog.show(); new RequestHospitalDetailTask().execute(hospitalId.toString()); }