List of usage examples for android.graphics Typeface BOLD
int BOLD
To view the source code for android.graphics Typeface BOLD.
Click Source Link
From source file:io.github.marktony.espresso.mvp.companydetails.CompanyDetailFragment.java
@Override public void setCompanyWebsite(String website) { this.website = website; String ws = getString(R.string.official_website) + "\n" + website; Spannable spannable = new SpannableStringBuilder(ws); spannable.setSpan(new StyleSpan(Typeface.BOLD), 0, ws.length() - website.length() - 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); spannable.setSpan(new URLSpan(website), ws.length() - website.length(), ws.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textViewWebsite.setText(spannable);//from w w w . j a v a 2 s . c o m }
From source file:mobisocial.bento.ebento.ui.RsvpFragment.java
private void setSelected(Button b) { if (UIUtils.isHoneycomb()) { b.setTextColor(getActivity().getResources().getColor(R.color.system_blue)); } else {//from w w w . j a v a 2s . c o m b.setTextColor(getActivity().getResources().getColor(R.color.system_green)); } b.setTypeface(null, Typeface.BOLD); }
From source file:net.toload.main.hd.ui.ShareDialog.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle icicle) { getDialog().getWindow().setTitle(getResources().getString(R.string.share_dialog_title)); datasource = new LimeDB(getActivity()); sharedialog = this; activity = getActivity();//from ww w . j a va 2 s .co m view = inflater.inflate(R.layout.fragment_dialog_share, container, false); btnShareCustom = (Button) view.findViewById(R.id.btnShareCustom); btnShareArray = (Button) view.findViewById(R.id.btnShareArray); btnShareArray10 = (Button) view.findViewById(R.id.btnShareArray10); btnShareCj = (Button) view.findViewById(R.id.btnShareCj); btnShareCj5 = (Button) view.findViewById(R.id.btnShareCj5); btnShareDayi = (Button) view.findViewById(R.id.btnShareDayi); btnShareEcj = (Button) view.findViewById(R.id.btnShareEcj); btnShareEz = (Button) view.findViewById(R.id.btnShareEz); btnSharePhonetic = (Button) view.findViewById(R.id.btnSharePhonetic); btnSharePinyin = (Button) view.findViewById(R.id.btnSharePinyin); btnShareScj = (Button) view.findViewById(R.id.btnShareScj); btnShareWb = (Button) view.findViewById(R.id.btnShareWb); btnShareHs = (Button) view.findViewById(R.id.btnShareHs); btnShareRelated = (Button) view.findViewById(R.id.btnShareRelated); btnShareCancel = (Button) view.findViewById(R.id.btnShareCancel); btnShareCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); HashMap<String, String> check = new HashMap<String, String>(); List<Im> imlist = datasource.getIm(null, Lime.IM_TYPE_NAME); for (int i = 0; i < imlist.size(); i++) { check.put(imlist.get(i).getCode(), imlist.get(i).getDesc()); } if (check.get(Lime.DB_TABLE_CUSTOM) == null) { btnShareCustom.setAlpha(Lime.HALF_ALPHA_VALUE); btnShareCustom.setTypeface(null, Typeface.ITALIC); btnShareCustom.setEnabled(false); } else { btnShareCustom.setAlpha(Lime.NORMAL_ALPHA_VALUE); btnShareCustom.setTypeface(null, Typeface.BOLD); btnShareCustom.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.IM_CUSTOM); } }); } if (check.get(Lime.DB_TABLE_PHONETIC) == null) { btnSharePhonetic.setAlpha(Lime.HALF_ALPHA_VALUE); btnSharePhonetic.setTypeface(null, Typeface.ITALIC); btnSharePhonetic.setEnabled(false); } else { btnSharePhonetic.setAlpha(Lime.NORMAL_ALPHA_VALUE); btnSharePhonetic.setTypeface(null, Typeface.BOLD); btnSharePhonetic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.IM_PHONETIC); } }); } if (check.get(Lime.DB_TABLE_CJ) == null) { btnShareCj.setAlpha(Lime.HALF_ALPHA_VALUE); btnShareCj.setTypeface(null, Typeface.ITALIC); btnShareCj.setEnabled(false); } else { btnShareCj.setAlpha(Lime.NORMAL_ALPHA_VALUE); btnShareCj.setTypeface(null, Typeface.BOLD); btnShareCj.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.IM_CJ); } }); } if (check.get(Lime.DB_TABLE_CJ5) == null) { btnShareCj5.setAlpha(Lime.HALF_ALPHA_VALUE); btnShareCj5.setTypeface(null, Typeface.ITALIC); btnShareCj5.setEnabled(false); } else { btnShareCj5.setAlpha(Lime.NORMAL_ALPHA_VALUE); btnShareCj5.setTypeface(null, Typeface.BOLD); btnShareCj5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.IM_CJ5); } }); } if (check.get(Lime.DB_TABLE_SCJ) == null) { btnShareScj.setAlpha(Lime.HALF_ALPHA_VALUE); btnShareScj.setTypeface(null, Typeface.ITALIC); btnShareScj.setEnabled(false); } else { btnShareScj.setAlpha(Lime.NORMAL_ALPHA_VALUE); btnShareScj.setTypeface(null, Typeface.BOLD); btnShareScj.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.IM_SCJ); } }); } if (check.get(Lime.DB_TABLE_ECJ) == null) { btnShareEcj.setAlpha(Lime.HALF_ALPHA_VALUE); btnShareEcj.setTypeface(null, Typeface.ITALIC); btnShareEcj.setEnabled(false); } else { btnShareEcj.setAlpha(Lime.NORMAL_ALPHA_VALUE); btnShareEcj.setTypeface(null, Typeface.BOLD); btnShareEcj.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.IM_ECJ); } }); } if (check.get(Lime.DB_TABLE_DAYI) == null) { btnShareDayi.setAlpha(Lime.HALF_ALPHA_VALUE); btnShareDayi.setTypeface(null, Typeface.ITALIC); btnShareDayi.setEnabled(false); } else { btnShareDayi.setAlpha(Lime.NORMAL_ALPHA_VALUE); btnShareDayi.setTypeface(null, Typeface.BOLD); btnShareDayi.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.IM_DAYI); } }); } if (check.get(Lime.DB_TABLE_EZ) == null) { btnShareEz.setAlpha(Lime.HALF_ALPHA_VALUE); btnShareEz.setTypeface(null, Typeface.ITALIC); btnShareEz.setEnabled(false); } else { btnShareEz.setAlpha(Lime.NORMAL_ALPHA_VALUE); btnShareEz.setTypeface(null, Typeface.BOLD); btnShareEz.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.IM_EZ); } }); } if (check.get(Lime.DB_TABLE_ARRAY) == null) { btnShareArray.setAlpha(Lime.HALF_ALPHA_VALUE); btnShareArray.setTypeface(null, Typeface.ITALIC); btnShareArray.setEnabled(false); } else { btnShareArray.setAlpha(Lime.NORMAL_ALPHA_VALUE); btnShareArray.setTypeface(null, Typeface.BOLD); btnShareArray.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.IM_ARRAY); } }); } if (check.get(Lime.DB_TABLE_ARRAY10) == null) { btnShareArray10.setAlpha(Lime.HALF_ALPHA_VALUE); btnShareArray10.setTypeface(null, Typeface.ITALIC); btnShareArray10.setEnabled(false); } else { btnShareArray10.setAlpha(Lime.NORMAL_ALPHA_VALUE); btnShareArray10.setTypeface(null, Typeface.BOLD); btnShareArray10.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.IM_ARRAY10); } }); } if (check.get(Lime.DB_TABLE_HS) == null) { btnShareHs.setAlpha(Lime.HALF_ALPHA_VALUE); btnShareHs.setTypeface(null, Typeface.ITALIC); btnShareHs.setEnabled(false); } else { btnShareHs.setAlpha(Lime.NORMAL_ALPHA_VALUE); btnShareHs.setTypeface(null, Typeface.BOLD); btnShareHs.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.IM_HS); } }); } if (check.get(Lime.DB_TABLE_WB) == null) { btnShareWb.setAlpha(Lime.HALF_ALPHA_VALUE); btnShareWb.setTypeface(null, Typeface.ITALIC); btnShareWb.setEnabled(false); } else { btnShareWb.setAlpha(Lime.NORMAL_ALPHA_VALUE); btnShareWb.setTypeface(null, Typeface.BOLD); btnShareWb.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.IM_WB); } }); } if (check.get(Lime.DB_TABLE_PINYIN) == null) { btnSharePinyin.setAlpha(Lime.HALF_ALPHA_VALUE); btnSharePinyin.setTypeface(null, Typeface.ITALIC); btnSharePinyin.setEnabled(false); } else { btnSharePinyin.setAlpha(Lime.NORMAL_ALPHA_VALUE); btnSharePinyin.setTypeface(null, Typeface.BOLD); btnSharePinyin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.IM_PINYIN); } }); } btnShareRelated.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { confirmShareDialog(Lime.DB_RELATED); } }); return view; }
From source file:com.bobomee.android.gank.io.widget.CompactTabLayout.java
private void renderSelectedText(TextView textView) { // textView.setTextSize(14); textView.setTypeface(null, Typeface.BOLD); }
From source file:info.hl.mediam.MyProfileActivity.java
private void Initialization() { if (MediamApp.hasNetworkConnection()) { getLoginUserData();// w w w. ja v a2s . c o m } mSvProfile = (ScrollView) findViewById(R.id.svProfile); mRlEditControls = (RelativeLayout) findViewById(R.id.rlEditControls); mRlBirthday = (RelativeLayout) findViewById(R.id.rlBirthday); mRlAbout = (RelativeLayout) findViewById(R.id.rlAbout); mRlGender = (RelativeLayout) findViewById(R.id.rlGender); mRlEmail = (RelativeLayout) findViewById(R.id.rlEmail); mRlOnlineStatus = (RelativeLayout) findViewById(R.id.rlOnlineStatus); mIvProfileImage = (ImageView) findViewById(R.id.ivProfileImage); mPbLoading = (ProgressBar) findViewById(R.id.pbLoadingForImage); mBtnEdit = (Button) findViewById(R.id.btnEdit); mBtnEdit.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD); mBtnSave = (Button) findViewById(R.id.btnSave); mBtnSave.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD); mTvUserName = (TextView) findViewById(R.id.tvUserName); mEtUserName = (EditText) findViewById(R.id.etUserName); mEtUserName.setTypeface(MediamApp.getTfMyriadPro()); mEtUserEmail = (EditText) findViewById(R.id.etUserEmail); mEtUserEmail.setTypeface(MediamApp.getTfMyriadPro()); mEtUserEmail.setInputType(InputType.TYPE_NULL); mSpinnerGender = (Spinner) findViewById(R.id.spinnerGender); final ArrayAdapter<String> genderAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.gender)) { @Override public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); ((TextView) v).setTextSize(16); ((TextView) v).setTypeface(MediamApp.getTfMyriadPro()); if (position == 2) { ((TextView) v).setTextColor(getResources().getColor(R.color.light_gray_subtext)); ((TextView) v).setText(getResources().getString(R.string.tap_to_add_gender)); } else { ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); } return v; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = super.getDropDownView(position, convertView, parent); ((TextView) v).setTextSize(20); ((TextView) v).setTypeface(MediamApp.getTfMyriadPro()); ((TextView) v).setPadding(15, 15, 15, 15); if (position == 2) { ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_neutral)); } else { ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); } return v; } }; mSpinnerGender.setAdapter(genderAdapter); mSpinnerGender.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { switch (arg2) { case 0: mNewGender = Const.MALE; break; case 1: mNewGender = Const.FEMALE; break; case 2: mNewGender = null; break; default: break; } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); mSpinnerStatus = (Spinner) findViewById(R.id.spinnerStatus); final ArrayAdapter<String> onlineStatusAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.online_status)) { @Override public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); ((TextView) v).setTextSize(16); ((TextView) v).setTypeface(MediamApp.getTfMyriadPro()); Drawable statusIcon = null; switch (position) { case 0: statusIcon = getContext().getResources().getDrawable(R.drawable.user_online_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 1: statusIcon = getContext().getResources().getDrawable(R.drawable.user_away_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 2: statusIcon = getContext().getResources().getDrawable(R.drawable.user_busy_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 3: statusIcon = getContext().getResources().getDrawable(R.drawable.user_offline_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; default: ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; } ((TextView) v).setCompoundDrawablePadding(10); ((TextView) v).setCompoundDrawablesWithIntrinsicBounds(statusIcon, null, null, null); return v; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = super.getDropDownView(position, convertView, parent); ((TextView) v).setTextSize(20); ((TextView) v).setTypeface(MediamApp.getTfMyriadPro()); ((TextView) v).setPadding(15, 15, 15, 15); Drawable statusIcon = null; switch (position) { case 0: statusIcon = getContext().getResources().getDrawable(R.drawable.user_online_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 1: statusIcon = getContext().getResources().getDrawable(R.drawable.user_away_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 2: statusIcon = getContext().getResources().getDrawable(R.drawable.user_busy_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 3: statusIcon = getContext().getResources().getDrawable(R.drawable.user_offline_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; default: ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; } ((TextView) v).setCompoundDrawablePadding(10); ((TextView) v).setCompoundDrawablesWithIntrinsicBounds(statusIcon, null, null, null); return v; } }; mSpinnerStatus.setAdapter(onlineStatusAdapter); mSpinnerStatus.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { switch (arg2) { case 0: mNewOnlineStatus = Const.ONLINE; break; case 1: mNewOnlineStatus = Const.AWAY; break; case 2: mNewOnlineStatus = Const.BUSY; break; case 3: mNewOnlineStatus = Const.OFFLINE; break; default: break; } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); mEtUserPassword = (EditText) findViewById(R.id.etUserPassword); mEtUserPassword.setTypeface(MediamApp.getTfMyriadPro()); mEtUserAbout = (EditText) findViewById(R.id.etUserAbout); mEtUserAbout.setTypeface(MediamApp.getTfMyriadPro()); mEtUserBirthday = (EditText) findViewById(R.id.etUserBirthday); mEtUserBirthday.setTypeface(MediamApp.getTfMyriadPro()); setProfileMode(ProfileMode.CANCEL); }
From source file:com.eugene.fithealthmaingit.UI.NavFragments.FragmentHealth.java
private void loadSavedPreferences() { // Goal Overview weightLossGoal.setText(sharedPreferences.getString(Globals.USER_GOAL, "0")); TextView goalWeight = (TextView) v.findViewById(R.id.weightGoal); goalWeight.setText(sharedPreferences.getString(Globals.USER_WEIGHT_GOAL, "") + " lbs"); WeightLogAdapter weightLogAdapter = new WeightLogAdapter(getActivity(), 0, WeightLog.all()); WeightLog weightLogCurrent = weightLogAdapter.getItem(weightLogAdapter.getCount() - 1); TextView currentWeight = (TextView) v.findViewById(R.id.weightCurrent); currentWeight.setText(df.format(weightLogCurrent.getCurrentWeight()) + " lbs"); double weightRemaining = weightLogCurrent.getCurrentWeight() - Double.valueOf(sharedPreferences.getString(Globals.USER_WEIGHT_GOAL, "")); int goalPosition = Integer.valueOf(sharedPreferences.getString(Globals.USER_WEIGHT_LOSS_GOAL, "")); if (goalPosition == 0 || goalPosition == 8) { weightPerWeek = 2;/*from www.jav a 2 s . c o m*/ } if (goalPosition == 1 || goalPosition == 7) { weightPerWeek = 1.5; } if (goalPosition == 2 || goalPosition == 6) { weightPerWeek = 1; } if (goalPosition == 3 || goalPosition == 5) { weightPerWeek = .5; } if (goalPosition == 4) { weightPerWeek = 0; } timeTillGoal = weightRemaining / weightPerWeek; TextView timeRem = (TextView) v.findViewById(R.id.timeGoal); timeRem.setText(df.format(timeTillGoal) + " week(s)"); // Calorie Goal mPersonBMR.setText( dfW.format(Double.valueOf(sharedPreferences.getString(Globals.USER_BASAL_METABOLIC_RATE, "0"))) + " Cal"); mCaloriesToMaintain.setText(dfW .format(Double.valueOf(sharedPreferences.getString(Globals.USER_CALORIES_TO_MAINTAIN_WEIGHT, "0"))) + " Cal"); mCaloriesToLose .setText(dfW.format(Double.valueOf(sharedPreferences.getString(Globals.USER_CALORIES_GIVE_UP, "0"))) + " Cal"); mCalorieGoal.setText( dfW.format(Double.valueOf(sharedPreferences.getString(Globals.USER_CALORIES_TO_REACH_GOAL, "0"))) + " Cal"); // BMI double mBmi = Double.valueOf(sharedPreferences.getString(Globals.USER_BODY_MASS_INDEX, "0")); tvUnderWeight1.setText("19 <"); if (mBmi <= 19) { tvUnderWeight1.setTextColor(getActivity().getResources().getColor(R.color.primary_dark)); tvUnderWeight1.setTypeface(null, Typeface.BOLD); tvUnderWeight.setTextColor(getActivity().getResources().getColor(R.color.primary_dark)); tvUnderWeight.setTypeface(null, Typeface.BOLD); } if (mBmi > 19 && mBmi <= 24) { tvNormal1.setTextColor(getActivity().getResources().getColor(R.color.primary_dark)); tvNormal1.setTypeface(null, Typeface.BOLD); tvNormal.setTextColor(getActivity().getResources().getColor(R.color.primary_dark)); tvNormal.setTypeface(null, Typeface.BOLD); } if (mBmi > 24 && mBmi <= 30) { tvOverWeight1.setTextColor(getActivity().getResources().getColor(R.color.primary_dark)); tvOverWeight1.setTypeface(null, Typeface.BOLD); tvOverWeight.setTextColor(getActivity().getResources().getColor(R.color.primary_dark)); tvOverWeight.setTypeface(null, Typeface.BOLD); } if (mBmi > 30 && mBmi <= 40) { tvObese1.setTextColor(getActivity().getResources().getColor(R.color.primary_dark)); tvObese1.setTypeface(null, Typeface.BOLD); tvObese.setTextColor(getActivity().getResources().getColor(R.color.primary_dark)); tvObese.setTypeface(null, Typeface.BOLD); } if (mBmi > 40) { tvVeryObese1.setTextColor(getActivity().getResources().getColor(R.color.primary_dark)); tvVeryObese1.setTypeface(null, Typeface.BOLD); tvVeryObese.setTextColor(getActivity().getResources().getColor(R.color.primary_dark)); tvVeryObese.setTypeface(null, Typeface.BOLD); } }
From source file:com.kncwallet.wallet.ui.TransactionsListFragment.java
@Override public void onViewCreated(final View view, final Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final SpannableStringBuilder emptyText = new SpannableStringBuilder( getString(direction == Direction.SENT ? R.string.wallet_transactions_fragment_empty_text_sent : R.string.wallet_transactions_fragment_empty_text_received)); emptyText.setSpan(new StyleSpan(Typeface.BOLD), 0, emptyText.length(), SpannableStringBuilder.SPAN_POINT_MARK); if (direction != Direction.SENT) emptyText.append("\n\n").append(getString(R.string.wallet_transactions_fragment_empty_text_howto)); Drawable divider = getResources().getDrawable(R.drawable.transaction_list_divider); this.getListView().setDivider(divider); this.getListView().setDividerHeight(1); setEmptyText(emptyText);/* ww w .j a v a 2 s. com*/ }
From source file:run.ace.TabBar.java
View getCustomTabView(AppBarButton abb, Context themedContext) { float scaleFactor = Utils.getScaleFactor(themedContext); final int IMAGEHEIGHT = (int) (17 * scaleFactor); final int TEXTSIZE = 12; LinearLayout ll = new LinearLayout(themedContext); LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); llp.gravity = Gravity.CENTER_HORIZONTAL; ll.setLayoutParams(llp);/*w w w . jav a2 s .c o m*/ ll.setOrientation(LinearLayout.VERTICAL); if (abb.icon != null) { ImageView iv = new ImageView(themedContext); LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, IMAGEHEIGHT); p.gravity = Gravity.CENTER_HORIZONTAL; p.topMargin = (int) (4 * scaleFactor); p.bottomMargin = (int) (3 * scaleFactor); iv.setLayoutParams(p); Bitmap bitmap = Utils.getBitmapAsset(themedContext, abb.icon.toString()); iv.setImageDrawable(new android.graphics.drawable.BitmapDrawable(bitmap)); ll.addView(iv); } TextView tv = new TextView(themedContext); LinearLayout.LayoutParams tvp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); tvp.gravity = Gravity.CENTER_HORIZONTAL; tv.setLayoutParams(tvp); tv.setTypeface(null, Typeface.BOLD); tv.setTextSize(TEXTSIZE); tv.setText(abb.label.toUpperCase()); ll.addView(tv); return ll; }
From source file:in.co.foodamigo.foodapp.module.common.view.widget.SlidingTabStripView.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}.//from w w w .j ava2s. c om */ protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.SERIF, Typeface.BOLD); textView.setTextColor(context.getResources().getColor(R.color.text_color_Categories)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } //if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style //textView.setAllCaps(true); //} int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, 0, padding, (padding / 2)); return textView; }
From source file:com.cloverstudio.spika.MyProfileActivity.java
private void Initialization() { if (SpikaApp.hasNetworkConnection()) { getLoginUserData();/* ww w . j a va2 s . com*/ } mSvProfile = (ScrollView) findViewById(R.id.svProfile); mRlEditControls = (RelativeLayout) findViewById(R.id.rlEditControls); mRlBirthday = (RelativeLayout) findViewById(R.id.rlBirthday); mRlAbout = (RelativeLayout) findViewById(R.id.rlAbout); mRlGender = (RelativeLayout) findViewById(R.id.rlGender); mRlEmail = (RelativeLayout) findViewById(R.id.rlEmail); mRlOnlineStatus = (RelativeLayout) findViewById(R.id.rlOnlineStatus); mIvProfileImage = (ImageView) findViewById(R.id.ivProfileImage); mPbLoading = (ProgressBar) findViewById(R.id.pbLoadingForImage); mBtnEdit = (Button) findViewById(R.id.btnEdit); mBtnEdit.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); mBtnSave = (Button) findViewById(R.id.btnSave); mBtnSave.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); mTvUserName = (TextView) findViewById(R.id.tvUserName); mEtUserName = (EditText) findViewById(R.id.etUserName); mEtUserName.setTypeface(SpikaApp.getTfMyriadPro()); mEtUserEmail = (EditText) findViewById(R.id.etUserEmail); mEtUserEmail.setTypeface(SpikaApp.getTfMyriadPro()); mEtUserEmail.setInputType(InputType.TYPE_NULL); mSpinnerGender = (Spinner) findViewById(R.id.spinnerGender); final ArrayAdapter<String> genderAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.gender)) { @Override public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); ((TextView) v).setTextSize(16); ((TextView) v).setTypeface(SpikaApp.getTfMyriadPro()); if (position == 2) { ((TextView) v).setTextColor(getResources().getColor(R.color.light_gray_subtext)); ((TextView) v).setText(getResources().getString(R.string.tap_to_add_gender)); } else { ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); } return v; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = super.getDropDownView(position, convertView, parent); ((TextView) v).setTextSize(20); ((TextView) v).setTypeface(SpikaApp.getTfMyriadPro()); ((TextView) v).setPadding(15, 15, 15, 15); if (position == 2) { ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_neutral)); } else { ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); } return v; } }; mSpinnerGender.setAdapter(genderAdapter); mSpinnerGender.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { switch (arg2) { case 0: mNewGender = Const.MALE; break; case 1: mNewGender = Const.FEMALE; break; case 2: mNewGender = null; break; default: break; } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); mSpinnerStatus = (Spinner) findViewById(R.id.spinnerStatus); final ArrayAdapter<String> onlineStatusAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.online_status)) { @Override public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); ((TextView) v).setTextSize(16); ((TextView) v).setTypeface(SpikaApp.getTfMyriadPro()); Drawable statusIcon = null; switch (position) { case 0: statusIcon = getContext().getResources().getDrawable(R.drawable.user_online_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 1: statusIcon = getContext().getResources().getDrawable(R.drawable.user_away_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 2: statusIcon = getContext().getResources().getDrawable(R.drawable.user_busy_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 3: statusIcon = getContext().getResources().getDrawable(R.drawable.user_offline_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; default: ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; } ((TextView) v).setCompoundDrawablePadding(10); ((TextView) v).setCompoundDrawablesWithIntrinsicBounds(statusIcon, null, null, null); return v; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = super.getDropDownView(position, convertView, parent); ((TextView) v).setTextSize(20); ((TextView) v).setTypeface(SpikaApp.getTfMyriadPro()); ((TextView) v).setPadding(15, 15, 15, 15); Drawable statusIcon = null; switch (position) { case 0: statusIcon = getContext().getResources().getDrawable(R.drawable.user_online_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 1: statusIcon = getContext().getResources().getDrawable(R.drawable.user_away_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 2: statusIcon = getContext().getResources().getDrawable(R.drawable.user_busy_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 3: statusIcon = getContext().getResources().getDrawable(R.drawable.user_offline_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; default: ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; } ((TextView) v).setCompoundDrawablePadding(10); ((TextView) v).setCompoundDrawablesWithIntrinsicBounds(statusIcon, null, null, null); return v; } }; mSpinnerStatus.setAdapter(onlineStatusAdapter); mSpinnerStatus.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { switch (arg2) { case 0: mNewOnlineStatus = Const.ONLINE; break; case 1: mNewOnlineStatus = Const.AWAY; break; case 2: mNewOnlineStatus = Const.BUSY; break; case 3: mNewOnlineStatus = Const.OFFLINE; break; default: break; } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); mEtUserPassword = (EditText) findViewById(R.id.etUserPassword); mEtUserPassword.setTypeface(SpikaApp.getTfMyriadPro()); mEtUserAbout = (EditText) findViewById(R.id.etUserAbout); mEtUserAbout.setTypeface(SpikaApp.getTfMyriadPro()); mEtUserBirthday = (EditText) findViewById(R.id.etUserBirthday); mEtUserBirthday.setTypeface(SpikaApp.getTfMyriadPro()); setProfileMode(ProfileMode.CANCEL); }