List of usage examples for android.widget TextView setTypeface
public void setTypeface(@Nullable Typeface tf)
From source file:com.gh4a.IssueLabelListActivity.java
private void fillData() { final Typeface condensed = getApplicationContext().condensed; LinearLayout ll = (LinearLayout) findViewById(R.id.main_content); ll.removeAllViews();/*from w w w . j a v a 2 s . c om*/ mAllLabelLayout = new ArrayList<Map<String, Object>>(); for (final Label label : mLabels) { Map<String, Object> selectedLabelItems = new HashMap<String, Object>(); selectedLabelItems.put("label", label); final View rowView = getLayoutInflater().inflate(R.layout.row_issue_label, null); final View viewColor = (View) rowView.findViewById(R.id.view_color); final LinearLayout llEdit = (LinearLayout) rowView.findViewById(R.id.ll_edit); selectedLabelItems.put("llEdit", llEdit); final EditText etLabel = (EditText) rowView.findViewById(R.id.et_label); selectedLabelItems.put("etLabel", etLabel); final TextView tvLabel = (TextView) rowView.findViewById(R.id.tv_title); selectedLabelItems.put("tvLabel", tvLabel); tvLabel.setTypeface(condensed); tvLabel.setText(label.getName()); viewColor.setBackgroundColor(Color.parseColor("#" + label.getColor())); selectedLabelItems.put("viewColor", viewColor); mAllLabelLayout.add(selectedLabelItems); viewColor.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (llEdit.getVisibility() == View.VISIBLE) { llEdit.setVisibility(View.GONE); unselectLabel(tvLabel, viewColor, label.getColor()); } else { llEdit.setVisibility(View.VISIBLE); selectLabel(tvLabel, viewColor, label.getColor(), true, etLabel); etLabel.setText(label.getName()); mActionMode = startActionMode(new EditActionMode(label.getName(), etLabel)); } } }); tvLabel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { LinearLayout llEdit = (LinearLayout) rowView.findViewById(R.id.ll_edit); if (llEdit.getVisibility() == View.VISIBLE) { llEdit.setVisibility(View.GONE); unselectLabel(tvLabel, viewColor, label.getColor()); } else { llEdit.setVisibility(View.VISIBLE); selectLabel(tvLabel, viewColor, label.getColor(), true, etLabel); etLabel.setText(label.getName()); mActionMode = startActionMode(new EditActionMode(label.getName(), etLabel)); } } }); if (!StringUtils.isBlank(mSelectedLabel) && mSelectedLabel.equals(label.getName())) { selectLabel(tvLabel, viewColor, label.getColor(), false, etLabel); llEdit.setVisibility(View.VISIBLE); etLabel.setText(label.getName()); } final View color1 = (View) rowView.findViewById(R.id.color_444444); color1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color1.getTag(), false, etLabel); } }); final View color2 = (View) rowView.findViewById(R.id.color_02d7e1); color2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color2.getTag(), false, etLabel); } }); final View color3 = (View) rowView.findViewById(R.id.color_02e10c); color3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color3.getTag(), false, etLabel); } }); final View color4 = (View) rowView.findViewById(R.id.color_0b02e1); color4.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color4.getTag(), false, etLabel); } }); final View color5 = (View) rowView.findViewById(R.id.color_d7e102); color5.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color5.getTag(), false, etLabel); } }); final View color6 = (View) rowView.findViewById(R.id.color_DDDDDD); color6.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color6.getTag(), false, etLabel); } }); final View color7 = (View) rowView.findViewById(R.id.color_e102d8); color7.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color7.getTag(), false, etLabel); } }); final View color8 = (View) rowView.findViewById(R.id.color_e10c02); color8.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { selectLabel(tvLabel, viewColor, (String) color8.getTag(), false, etLabel); } }); ll.addView(rowView); } }
From source file:com.speed.traquer.app.Feedback_rate_taxi.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_feedback_rate_taxi); getSupportActionBar().setDisplayHomeAsUpEnabled(true); inputTaxi = (EditText) findViewById(R.id.taxi_id); taxiDriver = (EditText) findViewById(R.id.taxi_driver); taxiLic = (EditText) findViewById(R.id.taxi_license); feedback_remarks = (EditText) findViewById(R.id.feedback_remarks); rgSafety = (RadioGroup) findViewById(R.id.radioSafety); rgDriver = (RadioGroup) findViewById(R.id.radioDriver); rgClean = (RadioGroup) findViewById(R.id.radioClean); rgComfort = (RadioGroup) findViewById(R.id.radioComfort); rgPunctual = (RadioGroup) findViewById(R.id.radioPunctual); rgIntegrity = (RadioGroup) findViewById(R.id.radioIntegrity); rateBtnBus = (ImageButton) findViewById(R.id.btn_rate_bus); editCurrDate = (EditText) findViewById(R.id.editCurrDate); editCurrTime = (EditText) findViewById(R.id.editCurrTime); ProgressBar barProgress = (ProgressBar) findViewById(R.id.progressLoading); rateBtnBus.setOnClickListener(new View.OnClickListener() { @Override/*from w w w . ja va2s . co m*/ public void onClick(View view) { Intent intent = new Intent(getApplicationContext(), Feedback_rate.class); startActivity(intent); } }); //Auto Complete Database if (isNetworkConnected()) { actv_comp_taxi = (AutoCompleteTextView) findViewById(R.id.search_taxi_comp); SuggestionAdapter sa = new SuggestionAdapter(this, actv_comp_taxi.getText().toString(), taxiUrl, "compcode"); sa.setLoadingIndicator(barProgress); actv_comp_taxi.setAdapter(sa); } else { Toast.makeText(getApplicationContext(), "Looks like there's a problem with your network connection.", Toast.LENGTH_SHORT).show(); } actv_comp_taxi = (AutoCompleteTextView) findViewById(R.id.search_taxi_comp); SuggestionAdapter sa = new SuggestionAdapter(this, actv_comp_taxi.getText().toString(), taxiUrl, "compcode"); sa.setLoadingIndicator(barProgress); actv_comp_taxi.setAdapter(sa); getCurrentDate(); getCurrentTime(); String fontPath = "fonts/segoeuil.ttf"; Typeface tf = Typeface.createFromAsset(getAssets(), fontPath); actv_comp_taxi.setTypeface(tf); actv_comp_taxi.setTypeface(tf); feedback_remarks.setTypeface(tf); inputTaxi.setTypeface(tf); taxiDriver.setTypeface(tf); taxiLic.setTypeface(tf); TextView txtTaxiDriver = (TextView) findViewById(R.id.txt_taxi_driver); txtTaxiDriver.setTypeface(tf); TextView txtTaxiLic = (TextView) findViewById(R.id.txt_taxi_license); txtTaxiLic.setTypeface(tf); TextView txtComp = (TextView) findViewById(R.id.taxi_comp); txtComp.setTypeface(tf); TextView txtNumber = (TextView) findViewById(R.id.taxi_number); txtNumber.setTypeface(tf); TextView txtSafety = (TextView) findViewById(R.id.txtSafety); txtSafety.setTypeface(tf); TextView txtDriver = (TextView) findViewById(R.id.txtDriver); txtDriver.setTypeface(tf); TextView txtClean = (TextView) findViewById(R.id.txtClean); txtClean.setTypeface(tf); TextView txtComfort = (TextView) findViewById(R.id.txtComfort); txtComfort.setTypeface(tf); TextView txtPunctual = (TextView) findViewById(R.id.txtPunctual); txtPunctual.setTypeface(tf); TextView txtIntegrity = (TextView) findViewById(R.id.txtIntegrity); txtIntegrity.setTypeface(tf); rgSafety.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int i) { RadioButton ibGreatSafety = (RadioButton) findViewById(R.id.ibGreatSafety); RadioButton ibGoodSafety = (RadioButton) findViewById(R.id.ibGoodSafety); RadioButton ibBadSafety = (RadioButton) findViewById(R.id.ibBadSafety); if (ibGreatSafety.isChecked()) { re1 = 1; rGroup1 = 1; //Toast.makeText(Feedback_rate.this, "Awesome Safety",Toast.LENGTH_SHORT).show(); } else if (ibGoodSafety.isChecked()) { rg1 = 1; rGroup1 = 1; //Toast.makeText(Feedback_rate.this, "Good Safety",Toast.LENGTH_SHORT).show(); } else if (ibBadSafety.isChecked()) { rb1 = 1; rGroup1 = 1; //Toast.makeText(Feedback_rate.this, "Bad Safety",Toast.LENGTH_SHORT).show(); } } }); rgDriver.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int i) { RadioButton ibGreatDriver = (RadioButton) findViewById(R.id.ibGreatDriver); RadioButton ibGoodDriver = (RadioButton) findViewById(R.id.ibGoodDriver); RadioButton ibBadDriver = (RadioButton) findViewById(R.id.ibBadDriver); if (ibGreatDriver.isChecked()) { re2 = 1; rGroup2 = 1; //Toast.makeText(Feedback_rate.this, "Awesome Driver",Toast.LENGTH_SHORT).show(); } else if (ibGoodDriver.isChecked()) { rg2 = 1; rGroup2 = 1; //Toast.makeText(Feedback_rate.this, "Good Driver",Toast.LENGTH_SHORT).show(); } else if (ibBadDriver.isChecked()) { rb2 = 1; rGroup2 = 1; //Toast.makeText(Feedback_rate.this, "Bad Driver",Toast.LENGTH_SHORT).show(); } } }); rgClean.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int i) { RadioButton ibGreatClean = (RadioButton) findViewById(R.id.ibGreatClean); RadioButton ibGoodClean = (RadioButton) findViewById(R.id.ibGoodClean); RadioButton ibBadClean = (RadioButton) findViewById(R.id.ibBadClean); if (ibGreatClean.isChecked()) { re3 = 1; rGroup3 = 1; //Toast.makeText(Feedback_rate.this, "Awesome Cleanliness",Toast.LENGTH_SHORT).show(); } else if (ibGoodClean.isChecked()) { rg3 = 1; rGroup3 = 1; //Toast.makeText(Feedback_rate.this, "Good Cleanliness",Toast.LENGTH_SHORT).show(); } else if (ibBadClean.isChecked()) { rb3 = 1; rGroup3 = 1; //Toast.makeText(Feedback_rate.this, "Bad Cleanliness",Toast.LENGTH_SHORT).show(); } } }); rgComfort.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int i) { RadioButton ibGreatComfort = (RadioButton) findViewById(R.id.ibGreatComfort); RadioButton ibGoodComfort = (RadioButton) findViewById(R.id.ibGoodComfort); RadioButton ibBadComfort = (RadioButton) findViewById(R.id.ibBadComfort); if (ibGreatComfort.isChecked()) { re4 = 1; rGroup4 = 1; //Toast.makeText(Feedback_rate.this, "Super Comfort",Toast.LENGTH_SHORT).show(); } else if (ibGoodComfort.isChecked()) { rg4 = 1; rGroup4 = 1; //Toast.makeText(Feedback_rate.this, "Comfort",Toast.LENGTH_SHORT).show(); } else if (ibBadComfort.isChecked()) { rb4 = 1; rGroup4 = 1; //Toast.makeText(Feedback_rate.this, "Not Comfort at all",Toast.LENGTH_SHORT).show(); } } }); rgPunctual.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int i) { RadioButton ibGreatPunctual = (RadioButton) findViewById(R.id.ibGreatPunctual); RadioButton ibGoodPunctual = (RadioButton) findViewById(R.id.ibGoodPunctual); RadioButton ibBadPunctual = (RadioButton) findViewById(R.id.ibBadPunctual); if (ibGreatPunctual.isChecked()) { re5 = 1; rGroup5 = 1; //Toast.makeText(Feedback_rate.this, "Very Punctual",Toast.LENGTH_SHORT).show(); } else if (ibGoodPunctual.isChecked()) { rg5 = 1; rGroup5 = 1; //Toast.makeText(Feedback_rate.this, "Delay Abit",Toast.LENGTH_SHORT).show(); } else if (ibBadPunctual.isChecked()) { rb5 = 1; rGroup5 = 1; //Toast.makeText(Feedback_rate.this, "Not Punctual at all",Toast.LENGTH_SHORT).show(); } } }); rgIntegrity.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int i) { RadioButton ibGreatDriver = (RadioButton) findViewById(R.id.ibGreatIntegrity); RadioButton ibGoodDriver = (RadioButton) findViewById(R.id.ibGoodIntegrity); RadioButton ibBadDriver = (RadioButton) findViewById(R.id.ibBadIntegrity); if (ibGreatDriver.isChecked()) { re6 = 1; rGroup6 = 1; //Toast.makeText(Feedback_rate.this, "Awesome Driver",Toast.LENGTH_SHORT).show(); } else if (ibGoodDriver.isChecked()) { rg6 = 1; rGroup6 = 1; //Toast.makeText(Feedback_rate.this, "Good Driver",Toast.LENGTH_SHORT).show(); } else if (ibBadDriver.isChecked()) { rb6 = 1; rGroup6 = 1; //Toast.makeText(Feedback_rate.this, "Bad Driver",Toast.LENGTH_SHORT).show(); } } }); easyTracker = EasyTracker.getInstance(Feedback_rate_taxi.this); }
From source file:com.example.reabar.wimc.Fragments.ManageMyCarsScreenFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_manage_my_cars_screen, container, false); fragmentCommunicator = (FragmentCommunicator) getActivity(); if (cars == null) { cars = new ArrayList<>(); }// w ww . j a v a 2 s. c o m Button addNewCarButton = (Button) view.findViewById(R.id.newCarButton); TextView title = (TextView) view.findViewById(R.id.logoTextManageMyCars); 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("")) { addNewCarButton.setTypeface(hebrew); title.setTypeface(hebrew); } else { addNewCarButton.setTypeface(english); title.setTypeface(english); } progressBar = (ProgressBar) view.findViewById(R.id.mainProgressBar); progressBar.setVisibility(View.VISIBLE); carCompanyInput = (EditText) view.findViewById(R.id.carCompanyInput); carColorInput = (EditText) view.findViewById(R.id.carColorInput); carLicenseInput = (EditText) view.findViewById(R.id.carLicenseInput); carModelInput = (EditText) view.findViewById(R.id.carModelInput); addNewCarButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //hide keyboard after click InputMethodManager inputManager = (InputMethodManager) getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); if (carCompanyInput.getText().toString().matches("") || carColorInput.getText().toString().matches("") || carLicenseInput.getText().toString().matches("") || carModelInput.getText().toString().matches("")) { Toast.makeText(MyApplication.getAppActivity(), "You must fill all the information about the new car", Toast.LENGTH_SHORT).show(); } else { Car newCar = new Car(carLicenseInput.getText().toString(), carColorInput.getText().toString(), carModelInput.getText().toString(), carCompanyInput.getText().toString(), Model.getInstance().getCurrentUser().getEmail()); Model.getInstance().addCarToDB(newCar, new Model.SyncListener() { @Override public void isSuccessful(boolean success) { if (success) { Toast.makeText(MyApplication.getAppActivity(), "New Car Added!", Toast.LENGTH_SHORT) .show(); fragmentCommunicator.passString("HomeScreenFragment"); } } @Override public void failed(String message) { Toast.makeText(MyApplication.getAppActivity(), message, Toast.LENGTH_SHORT).show(); } @Override public void passData(Object data) { } }); } } }); carsList = (ListView) view.findViewById(R.id.carsListView); Model.getInstance().getOwnedCars(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) { } }); adapter = new MyCarsAdapter(); carsList.setAdapter(adapter); carsList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Object[] data = new Object[] { cars.get(position) }; fragmentCommunicator.passData(data, "CarScreenFragment"); } }); return view; }
From source file:com.example.reabar.wimc.Fragments.CarScreenFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_car_screen, container, false); TextView text = (TextView) view.findViewById(R.id.deleteTextView); Button addUserButton = (Button) view.findViewById(R.id.addUserButton); 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("")) { addUserButton.setTypeface(hebrew); text.setTypeface(hebrew); } else {//from w w w .j a v a 2 s . c o m addUserButton.setTypeface(english); text.setTypeface(english); } if (sharedUsersList == null) { sharedUsersList = new ArrayList<>(); } if (sharedUsersList.isEmpty()) { text.setVisibility(View.GONE); } TextView licenseTextView = (TextView) view.findViewById(R.id.cars_list_row_car_license); licenseTextView.setText(carLicense); TextView modelCompanyTextView = (TextView) view.findViewById(R.id.cars_list_row_car_model_company); modelCompanyTextView.setText(modelCompany); list = (ListView) view.findViewById(R.id.listSharedUsersID); adapter = new MyUsersCarAdapter(); list.setAdapter(adapter); list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { car.removeCarUser(sharedUsersList.get(position)); adapter.notifyDataSetChanged(); Toast.makeText(MyApplication.getAppActivity(), "User removed successfully", Toast.LENGTH_SHORT) .show(); } }); emailSharedInput = (EditText) view.findViewById(R.id.emailSharedinput); addUserButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //hide keyboard after click InputMethodManager inputManager = (InputMethodManager) getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); if (emailSharedInput.getText().toString().matches("")) { Toast.makeText(MyApplication.getAppActivity(), "You must enter email of the shared user", Toast.LENGTH_SHORT).show(); } else { //addUser user to car by email final String userEmail = emailSharedInput.getText().toString(); //car.setCarUser(userEmail, true); //car.setNewCarUser(userEmail); Model.getInstance().setCarUser(car, userEmail); emailSharedInput.setText(""); adapter.notifyDataSetChanged(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } //sharedUsersList.add(userEmail); Object[] data = new Object[] { car }; fragmentCommunicator.passData(data, "CarScreenFragment"); } } }); return view; }
From source file:br.com.carlosrafaelgn.fplay.ActivityBrowserRadio.java
@Override public View getView(int position, View convertView, ViewGroup parent) { TextView txt = (TextView) convertView; if (txt == null) { txt = new TextView(getApplication()); txt.setPadding(UI._8dp, UI._4dp, UI._8dp, UI._4dp); txt.setTypeface(UI.defaultTypeface); txt.setTextSize(TypedValue.COMPLEX_UNIT_PX, UI._DLGsp); txt.setTextColor(defaultTextColors); }/*from ww w. j a v a 2 s.c o m*/ txt.setText(getGenreString(position)); return txt; }
From source file:de.madvertise.android.sdk.MadView.java
private void showTextBannerView() { MadUtil.logMessage(null, Log.DEBUG, "Add text banner"); TextView textView = new TextView(getContext()); textView.setGravity(Gravity.CENTER); textView.setText(currentAd.getText()); textView.setTextSize(textSize);// w w w . java 2 s.co m textView.setTextColor(textColor); textView.setTypeface(Typeface.DEFAULT_BOLD); setBackgroundDrawable(textBannerBackground); removeAllViews(); addView(textView); }
From source file:com.jgraves.achievementunlocked.AchievementsList_Fragment.java
private void addAchievementToList(Long id, String name, int points) { Log.i(ExploraApp.TAG, "Adding achievement image request of id " + id + " with height, " + imageViewHeight); FrameLayout fl = new FrameLayout(getActivity()); touchMap.put(fl, id);//from www .j a v a2 s . co m fl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Long id = touchMap.get(v); Log.i(ExploraApp.TAG, "TOUCHED " + id); Intent intent = new Intent(getActivity(), Activity_AchievementInfo.class); intent.putExtra("achievement_id", Long.toString(id)); startActivity(intent); } }); TextView tv_name = new TextView(getActivity()); TextView tv_points = new TextView(getActivity()); ImageView iv = new ImageView(getActivity()); fl.setMinimumHeight(imageViewHeight); fl.setMinimumWidth(ExploraApp.screenWidth); robotoTypeface = Typeface.createFromAsset(getActivity().getAssets(), "Roboto-Thin.ttf"); tv_name.setText(name); tv_name.setTextSize(15f); tv_points.setTextSize(15f); tv_name.setTypeface(robotoTypeface); tv_points.setTypeface(robotoTypeface); tv_points.setText(Integer.toString(points)); tv_points.setGravity(Gravity.RIGHT); tv_points.setTextColor(Color.WHITE); tv_name.setTextColor(Color.WHITE); iv.setMinimumHeight(imageViewHeight); iv.setMinimumWidth(ExploraApp.screenWidth); fl.addView(iv); fl.addView(tv_name); fl.addView(tv_points); ll_images_container.addView(fl); sv_images.bringChildToFront(mQuickReturnView); DefaultImageListener listener = new DefaultImageListener(iv); ImageRequest imageRequest = new ImageRequest( ExploraApp.url_main + "/achievement/" + id + "/photo?y=" + imageViewHeight + "&x=" + ExploraApp.screenWidth, listener, ExploraApp.screenWidth, imageViewHeight, Bitmap.Config.ARGB_8888, listener); ExploraApp.mRequestQueue.add(imageRequest); }
From source file:br.com.carlosrafaelgn.fplay.ActivityBrowserRadio.java
@Override public View getDropDownView(int position, View convertView, ViewGroup parent) { TextView txt = (TextView) convertView; if (txt == null) { txt = new TextView(getApplication()); txt.setPadding(UI._DLGdppad, UI._DLGsppad, UI._DLGdppad, UI._DLGsppad); txt.setTypeface(UI.defaultTypeface); txt.setTextSize(TypedValue.COMPLEX_UNIT_PX, UI._DLGsp); txt.setTextColor(defaultTextColors); }//w w w . j av a 2 s .co m txt.setText(getGenreString(position)); return txt; }
From source file:chaitanya.im.searchforreddit.LauncherActivity.java
private void showMessageInSnackbar(String message) { launcherRefresh.setRefreshing(false); snackbar = Snackbar.make(coordinatorLayout, message, Snackbar.LENGTH_INDEFINITE); View snackbarView = snackbar.getView(); TextView textView = (TextView) snackbarView.findViewById(android.support.design.R.id.snackbar_text); textView.setTypeface(fontAwesome); snackbarView.setBackgroundColor(ContextCompat.getColor(this, R.color.blue_tint)); snackbar.show();/*from w w w. jav a 2s. c o m*/ }
From source file:com.gsbabil.antitaintdroid.UtilityFunctions.java
public int captureBitmapCache(String in) { TextView tv = (TextView) MyApp.context.findViewById(R.id.ocrTextview); String tvText = tv.getText().toString(); float tvTextSize = tv.getTextSize(); int tvColor = tv.getCurrentTextColor(); Bitmap bitmap = null;/*from ww w. ja v a2 s.com*/ tv.setTextSize(36); tv.setTextColor(Color.CYAN); tv.setTypeface(Typeface.SANS_SERIF); tv.setText(in); while (bitmap == null) { // http://stackoverflow.com/questions/2339429/android-view-getdrawingcache-returns-null-only-null tv.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); tv.layout(0, 0, tv.getMeasuredWidth(), tv.getMeasuredHeight()); tv.setDrawingCacheEnabled(true); tv.buildDrawingCache(true); bitmap = Bitmap.createBitmap(tv.getDrawingCache()); tv.destroyDrawingCache(); tv.setDrawingCacheEnabled(false); } FileOutputStream fos = null; int res = -1; try { fos = new FileOutputStream(currentDirectory() + "/files/" + MyApp.SCREENSHOT_FILENAME); if (fos != null) { bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fos); fos.close(); res = 0; } } catch (Throwable e) { Log.i(MyApp.TAG, e.getMessage().toString()); res = -1; } tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, tvTextSize); tv.setTypeface(Typeface.MONOSPACE); tv.setText(tvText); tv.setTextColor(tvColor); return res; }