List of usage examples for android.widget TextView setTypeface
public void setTypeface(@Nullable Typeface tf)
From source file:com.geomoby.geodeals.notification.CustomNotification.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Hide Title Bar this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.geomoby_offer); Intent intent = getIntent();/*from w ww. j a va2s .c o m*/ ArrayList<GeoMessage> geoMessage = intent.getParcelableArrayListExtra("GeoMessage"); String title = geoMessage.get(0).title; String link = geoMessage.get(0).siteURL; String image_url = geoMessage.get(0).imageURL; String description = geoMessage.get(0).message; final double latitude = Double.valueOf(geoMessage.get(0).latitude); final double longitude = Double.valueOf(geoMessage.get(0).longitude); int notification_id = geoMessage.get(0).id; Button btnClose = (Button) findViewById(R.id.close); btnClose.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click CustomNotification.this.finish(); } }); Button btnNearest = (Button) findViewById(R.id.nearest); btnNearest.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { SharedPreferences settingsActivity = CustomNotification.this.getSharedPreferences("GeoMobyPrefs", MODE_PRIVATE); final double myLatitude = Double.valueOf(settingsActivity.getString(SETTING_LAT, "")); final double myLongitude = Double.valueOf(settingsActivity.getString(SETTING_LNG, "")); Context context = CustomNotification.this; Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?f=d&saddr=" + myLatitude + "," + myLongitude + "&daddr=" + latitude + "," + longitude + "&dirflg=w")); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } }); Typeface font = Typeface.createFromAsset(getAssets(), "Bitter-Bold.otf"); TextView tvTitle = (TextView) findViewById(R.id.title); tvTitle.setTypeface(font); tvTitle.setText(title); TextView tvDesc = (TextView) findViewById(R.id.description); tvDesc.setTypeface(font); tvDesc.setText(description); TextView tvLink = (TextView) findViewById(R.id.link); tvLink.setTypeface(font); String desc = "<a href=\"" + link + "\">Demo Link</a>"; tvLink.setText(Html.fromHtml(desc)); tvLink.setMovementMethod(LinkMovementMethod.getInstance()); // Warning - Big bitmap images might create errors if (!image_url.equals("")) new DownloadImageTask((ImageView) findViewById(R.id.image)).execute(image_url); //Notify GeoMoby server that user has opened the notification //new ClickThroughAsyncTask(this).execute(notification_id); }
From source file:ca.rmen.android.palidamuerte.app.poem.list.PoemListFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ListView listView = getListView(); ViewGroup parent = (ViewGroup) listView.getParent(); final View emptyListView; String searchTerms = getActivity().getIntent().getStringExtra(SearchManager.QUERY); if (!TextUtils.isEmpty(searchTerms)) { emptyListView = getActivity().getLayoutInflater().inflate(R.layout.empty_search_list, parent, false); String[] keyWords = Search.getSearchTerms(searchTerms); ((TextView) emptyListView.findViewById(R.id.empty_search_list_description)).setText(getResources() .getQuantityString(R.plurals.empty_search_list_description, keyWords.length, searchTerms)); } else {/*from www. j av a 2 s .c om*/ emptyListView = getActivity().getLayoutInflater().inflate(R.layout.empty_favorite_list, parent, false); } TextView emptyTitle = (TextView) emptyListView.findViewById(R.id.title); emptyTitle.setTypeface(Font.getTypeface(getActivity())); parent.addView(emptyListView); listView.setEmptyView(emptyListView); // Restore the previously serialized activated item position. if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) { setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION)); } }
From source file:com.aniruddhc.acemusic.player.Dialogs.AddMusicLibraryDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { libraryLabelID = "circle_blue_dark"; View rootView = getActivity().getLayoutInflater().inflate(R.layout.dialog_add_music_library, null); TextView instructions = (TextView) rootView.findViewById(R.id.add_music_library_instructions); instructions.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light")); instructions.setPaintFlags(instructions.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); final ImageButton labelButton = (ImageButton) rootView.findViewById(R.id.add_music_library_label_button); final EditText musicLibraryName = (EditText) rootView.findViewById(R.id.add_music_library_text_field); musicLibraryName.setTypeface(TypefaceHelper.getTypeface(getActivity(), "RobotoCondensed-Light")); musicLibraryName/* w w w . j av a 2 s . co m*/ .setPaintFlags(musicLibraryName.getPaintFlags() | Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); labelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Create a new array with a list of all the library labels. final Drawable[] labelsArray = { getActivity().getResources().getDrawable(R.drawable.circle_blue_dark), getActivity().getResources().getDrawable(R.drawable.circle_blue_light), getActivity().getResources().getDrawable(R.drawable.circle_green_dark), getActivity().getResources().getDrawable(R.drawable.circle_green_light), getActivity().getResources().getDrawable(R.drawable.circle_purple_dark), getActivity().getResources().getDrawable(R.drawable.circle_purple_light), getActivity().getResources().getDrawable(R.drawable.circle_red_dark), getActivity().getResources().getDrawable(R.drawable.circle_red_light), getActivity().getResources().getDrawable(R.drawable.circle_yellow_dark), getActivity().getResources().getDrawable(R.drawable.circle_yellow_light) }; //Create a new array with a list of all the library labels. final String[] labelsIdsArray = { "circle_blue_dark", "circle_blue_light", "circle_green_dark", "circle_green_light", "circle_purple_dark", "circle_purple_light", "circle_red_dark", "circle_red_light", "circle_yellow_dark", "circle_yellow_light" }; AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.music_library_label); ArrayList<String> labelTitles = new ArrayList<String>(); labelTitles .addAll(Arrays.asList(getActivity().getResources().getStringArray(R.array.library_labels))); builder.setAdapter(new LibraryLabelsAdapter(getActivity(), labelTitles), new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); libraryLabelID = labelsIdsArray[which]; labelButton.setImageDrawable(labelsArray[which]); } }); builder.create().show(); } }); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); //Set the dialog title. builder.setTitle(R.string.add_music_library); builder.setView(rootView); builder.setPositiveButton(R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int arg1) { String libraryName = musicLibraryName.getText().toString(); Intent intent = new Intent(getActivity(), MusicLibraryEditorActivity.class); Bundle bundle = new Bundle(); bundle.putString("LIBRARY_NAME", libraryName); bundle.putString("LIBRARY_ICON", libraryLabelID); intent.putExtras(bundle); startActivity(intent); dialog.dismiss(); getActivity().finish(); } }); builder.setNegativeButton(R.string.cancel, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int arg1) { dialog.dismiss(); getActivity().finish(); } }); return builder.create(); }
From source file:com.skubit.iab.fragments.TransactionsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_wallet_transactions, null); TextView balanceLabel = (TextView) view.findViewById(R.id.wallet_balance_label); balanceLabel.setTypeface(FontManager.CONDENSED_REGULAR); TextView availableLabel = (TextView) view.findViewById(R.id.wallet_available_label); availableLabel.setTypeface(FontManager.CONDENSED_REGULAR); mBalance = (TextView) view.findViewById(R.id.wallet_balance); mAvailable = (TextView) view.findViewById(R.id.wallet_available); ListView list = (ListView) view.findViewById(R.id.list); list.setAdapter(mAdapter);//from w w w .j a v a 2 s .c o 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())); getActivity().overridePendingTransition(R.anim.pull_in_right, R.anim.none); } catch (JsonProcessingException e) { e.printStackTrace(); } } }); mSwipe = (SwipeRefreshLayout) view.findViewById(R.id.swipe_refresh); mSwipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { refreshBalance(); getTransactions(); } }); return view; }
From source file:com.appndroid.ipl2013.SwipeyTabsSampleActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_swipeytab); String fontPath = "fonts/Face Your Fears.ttf"; TextView txtHead = (TextView) findViewById(R.id.title); Typeface tf = Typeface.createFromAsset(getAssets(), fontPath); txtHead.setTypeface(tf); navigationImage = (ImageView) findViewById(R.id.nav); navigationImage.setOnClickListener(new OnClickListener() { @Override/* ww w.java2 s.c o m*/ public void onClick(View v) { callEvent(); } }); mViewPager = (MultipleScrollViewPager) findViewById(R.id.flipper); mTabs = (SwipeyTabs) findViewById(R.id.swipeytabs); mfragmentList = new Vector<Fragment>(); bundle = new Bundle(); Fragment pointsFragment = Fragment.instantiate(this, PointsTableFragment.class.getName()); pointsFragment.setArguments(bundle); Fragment orangeFragment = Fragment.instantiate(this, OrangeCapFragment.class.getName()); orangeFragment.setArguments(bundle); Fragment purpleFragment = Fragment.instantiate(this, PurpleCapFragment.class.getName()); purpleFragment.setArguments(bundle); mfragmentList.add(pointsFragment); mfragmentList.add(orangeFragment); mfragmentList.add(purpleFragment); SwipeyTabsPagerAdapter adapter = new SwipeyTabsPagerAdapter(this, getSupportFragmentManager(), mfragmentList); mViewPager.setAdapter(adapter); mTabs.setAdapter(adapter); mViewPager.setOnPageChangeListener(mTabs); mViewPager.setCurrentItem(0); mViewPager.setOffscreenPageLimit(2); }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static void initTextView(TextView view) { if (view.isInEditMode()) return;//from ww w.ja v a2s .c o m final Context context = view.getContext(); // view.setLinkTextColor(ThemeUtils.getUserLinkTextColor(context)); // view.setHighlightColor(ThemeUtils.getUserHighlightColor(context)); view.setTypeface(ThemeUtils.getUserTypeface(context, view.getTypeface())); }
From source file:chaitanya.im.searchforreddit.GenericAlertDialog.java
@SuppressLint("InflateParams") @Override/*from w w w .ja v a 2 s . c o m*/ @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View dialogView; setRetainInstance(true); switch (whichDialog) { case 0: dialogView = inflater.inflate(R.layout.dialog_purchase, null); builder.setView(dialogView).setPositiveButton(R.string.ok_purchase, buttonListener); final TextView dialogPurchaseTitle = (TextView) dialogView.findViewById(R.id.dialog_purchase_title); final TextView purchaseDescription = (TextView) dialogView.findViewById(R.id.purchase_description); final TextView priceDisplay = (TextView) dialogView.findViewById(R.id.price_display); final TextView coffeePitchText = (TextView) dialogView.findViewById(R.id.coffee_pitch_text); coffeePitchText.setTypeface(fontAwesome); coffeePitchText.setText(Html.fromHtml(getResources().getString(R.string.donate_coffee_pitch))); // SeekBar settings AppCompatSeekBar seekBar = (AppCompatSeekBar) dialogView.findViewById(R.id.price_seekbar); seekBar.setKeyProgressIncrement(1); seekBar.setMax(2); seekBar.setProgress(1); if (allPrices != null && allPrices.size() != 0) { // We can do a purchase since allPrices isn't null assert priceDisplay != null; priceDisplay.setText(allPrices.get(1)); if (purchaseDialog == 1) { dialogPurchaseTitle .setText(Html.fromHtml(getResources().getString(R.string.donate_dialog_title_2))); purchaseDescription.setText(Html.fromHtml(getResources().getString(R.string.donate_features2))); } skuCode = 1; seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean b) { skuCode = progress; priceDisplay.setText(allPrices.get(progress)); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); } else { // Aw shucks! We cannot do a purchase. skuCode = 1; seekBar.setEnabled(false); priceDisplay.setText(getResources().getString(R.string.donate_impossible)); } return builder.create(); case 1: skuCode = -1; dialogView = inflater.inflate(R.layout.dialog_license, null); builder.setView(dialogView).setTitle("Licenses").setPositiveButton(R.string.ok_string, buttonListener); return builder.create(); case 2: skuCode = -1; dialogView = inflater.inflate(R.layout.dialog_about, null); builder.setView(dialogView).setPositiveButton(R.string.ok_string, buttonListener); int versionCode = BuildConfig.VERSION_CODE; String versionName = BuildConfig.VERSION_NAME; String versionText = "Version Code <font color=#FF6F00>" + versionCode + "</font><br/>" + "Version Name <font color=#FF6F00>" + versionName + "</font><br/>"; TextView aboutText = (TextView) dialogView.findViewById(R.id.about_text); TextView aboutVersion = (TextView) dialogView.findViewById(R.id.about_version); TextView aboutCopyright = (TextView) dialogView.findViewById(R.id.about_copyright); aboutText.setTypeface(fontAwesome); aboutCopyright.setTypeface(fontAwesome); aboutText.setText(Html.fromHtml(getResources().getString(R.string.about_text))); aboutVersion.setText(Html.fromHtml(versionText)); aboutCopyright.setText(getResources().getString(R.string.about_copyright)); return builder.create(); case 3: skuCode = -1; dialogView = inflater.inflate(R.layout.dialog_whats_new, null); builder.setView(dialogView).setTitle("What's New?").setPositiveButton(R.string.ok_string, buttonListener); TextView whatsNewText = (TextView) dialogView.findViewById(R.id.whats_new_text); whatsNewText.setText(Html.fromHtml(StringResources.whatsNew)); return builder.create(); default: return builder.create(); } }
From source file:com.d2connect.droidltest.util.LPreviewUtilsImpl.java
@Override public void setMediumTypeface(TextView textView) { if (sMediumTypeface == null) { sMediumTypeface = Typeface.create("sans-serif-medium", Typeface.NORMAL); }//from w w w. ja v a 2 s .c o m textView.setTypeface(sMediumTypeface); }
From source file:com.ibm.mil.readyapps.physio.fragments.library.VideoFragment.java
private void setupView(View view) { Exercise exercise = DataManager.getCurrentPatient().getSelectedExercise(); TextView exerciseName = (TextView) view.findViewById(R.id.exercise_name); exerciseName.setTypeface(AndroidUtils.robotoRegular(exerciseName.getContext())); exerciseName.setText(exercise.getDescription()); List<Routine> routines = DataManager.getCurrentPatient().getRoutines(); Routine routine = DataManager.getCurrentPatient().getSelectedRoutine(); int routineIndex = routines.indexOf(routine); TextView routineName = (TextView) view.findViewById(R.id.routine_name); routineName.setText((routineIndex + 1) + " of " + routines.size()); TextView minutesValue = (TextView) view.findViewById(R.id.minutes_value); minutesValue.setTypeface(AndroidUtils.robotoBold(minutesValue.getContext())); minutesValue.setText(Utils.zeroPaddedNumber(exercise.getMinutes(), 2)); TextView repetitionsValue = (TextView) view.findViewById(R.id.repetitions_value); repetitionsValue.setTypeface(AndroidUtils.robotoBold(repetitionsValue.getContext())); repetitionsValue.setText(Utils.zeroPaddedNumber(exercise.getRepetitions(), 2)); TextView setsValue = (TextView) view.findViewById(R.id.sets_value); setsValue.setTypeface(AndroidUtils.robotoBold(setsValue.getContext())); setsValue.setText(Utils.zeroPaddedNumber(exercise.getSets(), 2)); TextView toolsValue = (TextView) view.findViewById(R.id.tools); toolsValue.setText(exercise.getTools()); TextView endRoutine = (TextView) view.findViewById(R.id.end_routine_button); endRoutine.setTypeface(AndroidUtils.robotoRegular(endRoutine.getContext())); endRoutine.setOnClickListener(new View.OnClickListener() { @Override//from ww w. jav a 2s . c om public void onClick(View v) { getFragmentManager().beginTransaction().replace(R.id.fragment_container, new EndRoutineFragment()) .addToBackStack(null).commit(); } }); TextView nextExercise = (TextView) view.findViewById(R.id.next_exercise_button); nextExercise.setTypeface(AndroidUtils.robotoRegular(nextExercise.getContext())); nextExercise.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Exercise nextExercise = nextExercise(); if (nextExercise != null) { DataManager.getCurrentPatient().setSelectedExercise(nextExercise); showNextExerciseDialog(); } else { showFinalExerciseDialog(); } } }); YouTubePlayerSupportFragment player = new YouTubePlayerSupportFragment(); player.initialize(YOUTUBE_API_KEY, this); getChildFragmentManager().beginTransaction().add(R.id.youtube_container, player).commit(); }
From source file:com.QuarkLabs.BTCeClient.adapters.OrdersBookAdapter.java
@SuppressLint("InflateParams") @Override/*from w ww . j a v a 2s. com*/ public View getView(int position, View convertView, ViewGroup parent) { View v; if (convertView == null) { v = mInflater.inflate(R.layout.ordersbook_item, parent, false); } else { v = convertView; } JSONArray value = mData.optJSONArray(position); double price = value.optDouble(0); double volume = value.optDouble(1); TextView text1 = (TextView) v.findViewById(R.id.orderBookPrice); TextView text2 = (TextView) v.findViewById(R.id.ordersBookVolume); text1.setText(String.valueOf(price)); text2.setText(String.valueOf(volume)); if (volume == mMaxValue) { text1.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); text2.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); } else { text1.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); text2.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); } return v; }