List of usage examples for android.widget TextView setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:com.optimusinfo.elasticpath.cortex.profile.ProfileFragment.java
public void setUpViews() { mLayout.setVisibility(View.VISIBLE); TextView tvUserName = (TextView) mViewParent.findViewById(R.id.tvUserName); tvUserName.setText(mObjProfile.mGivenName.concat(" ").concat(mObjProfile.mFamilyName)); TextView tvUserFullName = (TextView) mViewParent.findViewById(R.id.tvUserFullName); tvUserFullName.setText(mObjProfile.mFamilyName.concat(", ").concat(mObjProfile.mGivenName)); TextView tvEmail = (TextView) mViewParent.findViewById(R.id.tvEmail); tvEmail.setText(getUserName());//w ww . j a v a 2s .c o m TextView tvContinueShopping = (TextView) mViewParent.findViewById(R.id.tvContinueShopping); tvContinueShopping.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { getActivity().onBackPressed(); } }); showAddressGridView(); showPaymentMethodsGridView(); showPurchaseHistory(); }
From source file:com.optimusinfo.elasticpath.cortex.purchase.PurchaseFragment.java
public void setUpViews() { mLayout.setVisibility(View.VISIBLE); TextView tvOrderNumber = (TextView) mViewParent.findViewById(R.id.tvOrderNumber); tvOrderNumber.setText(mObjOrder.mOrderNumber); TextView tvBillingAddress = (TextView) mViewParent.findViewById(R.id.tvBillingAddress); tvBillingAddress.setText(OrderModel.getAddressLine(mObjOrder.mBillingInfo[0])); TextView tvPaymentCard = (TextView) mViewParent.findViewById(R.id.tvPaymentCard); tvPaymentCard.setText(mObjOrder.mPaymentMeans[0].mElements[0].mDisplayValue); TextView tvOrderStatus = (TextView) mViewParent.findViewById(R.id.tvOrderStatus); tvOrderStatus.setText(mObjOrder.mStatus); TextView tvOrderContent = (TextView) mViewParent.findViewById(R.id.tvOrderContent); tvOrderContent.setText(OrderModel.getOrderContents(mObjOrder.mLineItems[0].mItems)); TextView tvOrderSubtotal = (TextView) mViewParent.findViewById(R.id.tvOrderSubtotal); tvOrderSubtotal.setText(mObjOrder.mTotal[0].mDisplayValue); TextView tvOrderTax = (TextView) mViewParent.findViewById(R.id.tvOrderTax); tvOrderTax.setText(mObjOrder.mTax.mDisplayValue); /*//from w w w . j ava 2 s.co m * TextView tvOrderShipping = (TextView) * mViewParent.findViewById(R.id.tvOrderShipping); * tvOrderShipping.setText(mObjOrder.mTax.mDisplayValue); */ TextView tvOrderTotal = (TextView) mViewParent.findViewById(R.id.tvOrderTotal); tvOrderTotal.setText(mObjOrder.mTotal[0].mDisplayValue); TextView tvContinue = (TextView) mViewParent.findViewById(R.id.tvContinueShopping); tvContinue.setText(mBackTitle); tvContinue.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { getActivity().onBackPressed(); } }); }
From source file:com.example.android.saddacampus.MainActivity.java
@Override public boolean onCreateOptionsMenu(final Menu menu) { getMenuInflater().inflate(R.menu.menu_home, menu); final View notificaitons = menu.findItem(R.id.actionNotifications).getActionView(); TextView txtViewCount = (TextView) notificaitons.findViewById(R.id.txtCount); updateHotCount(count++, notificaitons); txtViewCount.setOnClickListener(new View.OnClickListener() { @Override//from www . j a va 2 s .c om public void onClick(View v) { updateHotCount(count++, v); } }); notificaitons.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO } }); return super.onCreateOptionsMenu(menu); }
From source file:com.yahala.ui.LoginActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.group_create_menu, menu); SupportMenuItem doneItem = (SupportMenuItem) menu.findItem(R.id.done_menu_item); TextView doneTextView = (TextView) doneItem.getActionView().findViewById(R.id.done_button); doneTextView.setText(LocaleController.getString("Done", R.string.Done)); doneTextView.setOnClickListener(new View.OnClickListener() { @Override//from w w w. java 2 s . c o m public void onClick(View view) { onNextAction(); } }); return super.onCreateOptionsMenu(menu); }
From source file:com.money.manager.ex.assetallocation.AssetClassEditFragment.java
private void initializeSortOrderInput(View view) { TextView textView = (TextView) view.findViewById(R.id.sortOrderEdit); if (textView == null) return;/* w w w . jav a2 s. c o m*/ textView.setText(assetClass.getSortOrder().toString()); textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Money number = MoneyFactory.fromString(Integer.toString(assetClass.getSortOrder())); Calculator.forFragment(AssetClassEditFragment.this).amount(number).roundToCurrency(false) .show(RequestCodes.SORT_ORDER); } }); }
From source file:com.waz.zclient.pages.main.profile.preferences.dialogs.VerifyPhoneNumberPreferenceFragment.java
@Nullable @Override//from w w w .ja v a 2 s . co m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final String number = PhoneNumberUtils.formatNumber(getArguments().getString(ARG_PHONE, "")); final View view = inflater.inflate(R.layout.fragment_preference_phone_number_verification, container, false); final TextInputLayout verificationCodeInputLayout = ViewUtils.getView(view, R.id.til__verification_code); verificationCodeInputLayout.setErrorEnabled(true); final View backButton = ViewUtils.getView(view, R.id.tv__back_button); backButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); final View okButton = ViewUtils.getView(view, R.id.tv__ok_button); okButton.setEnabled(false); okButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String code = getVerificationCode(); getStoreFactory().getProfileStore().submitCode(number, code, new ZMessagingApi.PhoneNumberVerificationListener() { @Override public void onVerified(KindOfVerification kindOfVerification) { dismiss(); } @Override public void onVerificationFailed(KindOfVerification kindOfVerification, int errorCode, String message, String label) { if (AppEntryError.PHONE_INVALID_REGISTRATION_CODE.correspondsTo(errorCode, label)) { verificationCodeInputLayout.setError(getString( AppEntryError.PHONE_INVALID_REGISTRATION_CODE.headerResource)); } else { verificationCodeInputLayout.setError( getString(AppEntryError.PHONE_REGISTER_GENERIC_ERROR.headerResource)); } } }); } }); final TextView changeNumberButton = ViewUtils.getView(view, R.id.tv__change_number_button); changeNumberButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (getContainer() == null) { return; } dismiss(); getContainer().changePhoneNumber(number); } }); final TextView resendButton = ViewUtils.getView(view, R.id.tv__resend_button); resendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { resendButton.animate().alpha(0f).start(); getStoreFactory().getProfileStore().resendPhoneVerificationCode(number, new ZMessagingApi.PhoneConfirmationCodeRequestListener() { @Override public void onConfirmationCodeSent(KindOfAccess kindOfAccess) { resendButton.animate().alpha(1f).start(); } @Override public void onPasswordExists(KindOfAccess kindOfAccess) { } @Override public void onConfirmationCodeSendingFailed(KindOfAccess kindOfAccess, int code, String message, String label) { resendButton.animate().alpha(1f).start(); AppEntryUtil.showErrorDialog(getActivity(), AppEntryError.PHONE_REGISTER_GENERIC_ERROR, null); } }); } }); final TextView verificationDescription = ViewUtils.getView(view, R.id.tv__verification_description); verificationDescription .setText(getString(R.string.pref__account_action__phone_verification__description, number)); final EditText firstNumberEditText = ViewUtils.getView(view, R.id.et__verification_code__1); final EditText secondNumberEditText = ViewUtils.getView(view, R.id.et__verification_code__2); final EditText thirdNumberEditText = ViewUtils.getView(view, R.id.et__verification_code__3); final EditText fourthNumberEditText = ViewUtils.getView(view, R.id.et__verification_code__4); final EditText fifthNumberEditText = ViewUtils.getView(view, R.id.et__verification_code__5); final EditText sixthNumberEditText = ViewUtils.getView(view, R.id.et__verification_code__6); textBoxes = new LinkedList<>(Arrays.asList(firstNumberEditText, secondNumberEditText, thirdNumberEditText, fourthNumberEditText, fifthNumberEditText, sixthNumberEditText)); for (int i = 0; i < textBoxes.size(); i++) { final EditText textBox = textBoxes.get(i); final int finalI = i; textBox.setTypeface(TypefaceUtils.getTypeface(getString(R.string.wire__typeface__bold))); textBox.addTextChangedListener(new OnTextChangedListener() { @Override public void afterTextChanged(Editable s) { verificationCodeInputLayout.setError(null); final String val = textBox.getText().toString().trim(); final char c; if (TextUtils.isEmpty(val)) { c = ' '; } else { c = val.charAt(0); } verificationCode[finalI] = c; final boolean wasDelete = c == ' '; if (!jumpToNextEmptyTextBox(wasDelete)) { okButton.setEnabled(true); if (finalI == textBoxes.size()) { okButton.requestFocus(); } } else { okButton.setEnabled(false); } } }); } return view; }
From source file:com.micabyte.android.app.BaseFragment.java
@SuppressWarnings("ConstantConditions") public TextView setTextView(int resId, Typeface font) { final TextView t = (TextView) getView().findViewById(resId); if (t != null) { if (font != null) t.setTypeface(font);//from w ww . j av a 2 s . co m t.setOnClickListener(this); } return t; }
From source file:com.orangemoo.com.beta.widget.ViewPagerTabs.java
private void addTab(CharSequence tabTitle, final int position) { final TextView textView = new TextView(getContext()); textView.setText(tabTitle);/*from w w w . j ava 2s .c om*/ // textView.setBackgroundResource(R.drawable.view_pager_tab_background); textView.setGravity(Gravity.CENTER); textView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mPager.setCurrentItem(getRtlPosition(position)); } }); textView.setOnLongClickListener(new OnTabLongClickListener(position)); // Assign various text appearance related attributes to child views. if (mTextStyle > 0) { textView.setTypeface(textView.getTypeface(), mTextStyle); } if (mTextSize > 0) { textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize); } if (mTextColor != null) { textView.setTextColor(mTextColor); } textView.setAllCaps(mTextAllCaps); // textView.setPadding(mSidePadding, 0, mSidePadding, 0); mTabStrip.addView(textView, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1)); // Default to the first child being selected if (position == 0) { mPrevSelected = 0; textView.setSelected(true); } }
From source file:com.ymt.demo1.main.sign.SignUpFragment.java
/** * ???/*from ww w . j ava2 s . c o m*/ * ????????? */ protected void initView(View view) { /* */ //? final EditText phoneTxt = (EditText) view.findViewById(R.id.input_phone_num); final EditText accountTxt = (EditText) view.findViewById(R.id.input_account); final EditText pswTxt = (EditText) view.findViewById(R.id.input_psw); final EditText rePswTxt = (EditText) view.findViewById(R.id.re_input_psw); final TextView licenseTxt = (TextView) view.findViewById(R.id.licence_txt); /*???? ?? */ final TextView getCheckNums = (TextView) view.findViewById(R.id.get_check_nums); final EditText inputCheckNums = (EditText) view.findViewById(R.id.input_check_nums); getCheckNums.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //todo ???? } }); /** * todo spannableString * ? */ SpannableString spannableString = new SpannableString(getString(R.string.license)); ForegroundColorSpan span = new ForegroundColorSpan(getResources().getColor(R.color.material_blue_grey_800)); spannableString.setSpan(span, 0, 7, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); licenseTxt.setText(spannableString); //switch(??) myCheckView = (MyCheckView) view.findViewById(R.id.switch_liscense); // Button signUpBtn = (Button) view.findViewById(R.id.do_sign_btn); signUpBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // String phoneNum = phoneTxt.getText().toString(); String account = accountTxt.getText().toString(); String psw = pswTxt.getText().toString(); String rePsw = rePswTxt.getText().toString(); //?? String checkNums = inputCheckNums.getText().toString(); //todo if(){}else{} ?? if (!TextUtils.isEmpty(phoneNum) && !TextUtils.isEmpty(account) && !TextUtils.isEmpty(psw) && psw.equals(rePsw)) { //? if (myCheckView.isChecked()) { queue.add(signUpRequest(account, psw, phoneNum, NORMAL_USER)); } else { Toast.makeText(getActivity(), "?????", Toast.LENGTH_SHORT).show(); } } else if (TextUtils.isEmpty(phoneNum)) { //??? Toast.makeText(getActivity(), "???", Toast.LENGTH_SHORT).show(); } else if (TextUtils.isEmpty(account)) { //??? Toast.makeText(getActivity(), "???", Toast.LENGTH_SHORT).show(); } else { //??? Toast.makeText(getActivity(), "???", Toast.LENGTH_SHORT) .show(); } } }); LinearLayout licence = (LinearLayout) view.findViewById(R.id.liscense_layout); licence.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { myCheckView.callOnClick(); } }); }
From source file:br.com.frs.foodrestrictions.FoodMessages.java
@SuppressLint("SetTextI18n") private void refreshMessages(View v) { int nAllergic = 0; int nDontEat = 0; llAllergic.removeAllViews();/*from w w w . j a v a 2 s . co m*/ llDontEat.removeAllViews(); for (final FoodIconItem iconItem : restrictList) { final String foodName = getResources().getString(iconItem.getNameId()); final String allergic_text = getResources().getString(R.string.allergic_to) + " " + foodName; final String dont_eat_text = getResources().getString(R.string.dont_eat) + " " + foodName; TextView tv = new TextView(v.getContext()); tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tv.setTypeface(null, Typeface.BOLD_ITALIC); tv.setText("* " + foodName); tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { switch (iconItem.getRestrictionType()) { case FoodIconList.FOOD_RESTRICTION_TYPE_ALLERGIC: Snackbar.make(v, allergic_text, Snackbar.LENGTH_LONG).setAction("Action", null).show(); break; case FoodIconList.FOOD_RESTRICTION_TYPE_DONT_EAT: Snackbar.make(v, dont_eat_text, Snackbar.LENGTH_LONG).setAction("Action", null).show(); break; } } }); if (iconItem.getRestrictionType() == FoodIconList.FOOD_RESTRICTION_TYPE_ALLERGIC) { llAllergic.addView(tv); ++nAllergic; } else { llDontEat.addView(tv); ++nDontEat; } } if (nAllergic == 0) { allergicText.setVisibility(View.GONE); TextView tv = new TextView(v.getContext()); tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tv.setTypeface(null, Typeface.BOLD_ITALIC); tv.setText("* " + getResources().getString(R.string.food_msg_not_allergic)); llAllergic.addView(tv); } else { allergicText.setText(getResources().getString(R.string.message_allergic_to)); } if (nDontEat == 0) { dontEatText.setVisibility(View.GONE); TextView tv = new TextView(v.getContext()); tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tv.setTypeface(null, Typeface.BOLD_ITALIC); tv.setText("* " + getResources().getString(R.string.food_msg_not_picker)); llDontEat.addView(tv); } else { dontEatText.setText(getResources().getString(R.string.message_dont_eat)); } }