List of usage examples for android.widget TextView setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:com.gh4a.activities.ReleaseInfoActivity.java
private void fillData() { ImageView gravatar = (ImageView) findViewById(R.id.iv_gravatar); AvatarHandler.assignAvatar(gravatar, mRelease.getAuthor()); StyleableTextView details = (StyleableTextView) findViewById(R.id.tv_releaseinfo); String detailsText = getString(R.string.release_details, ApiHelpers.getUserLogin(this, mRelease.getAuthor()), StringUtils.formatRelativeTime(this, mRelease.getCreatedAt(), true)); StringUtils.applyBoldTagsAndSetText(details, detailsText); TextView releaseType = (TextView) findViewById(R.id.tv_releasetype); if (mRelease.isDraft()) { releaseType.setText(R.string.release_type_draft); } else if (mRelease.isPrerelease()) { releaseType.setText(R.string.release_type_prerelease); } else {//from www. ja v a 2s . c o m releaseType.setText(R.string.release_type_final); } TextView tag = (TextView) findViewById(R.id.tv_releasetag); tag.setText(getString(R.string.release_tag, mRelease.getTagName())); tag.setOnClickListener(this); if (mRelease.getAssets() != null && !mRelease.getAssets().isEmpty()) { RecyclerView downloadsList = (RecyclerView) findViewById(R.id.download_list); DownloadAdapter adapter = new DownloadAdapter(this); adapter.addAll(mRelease.getAssets()); adapter.setOnItemClickListener(this); downloadsList.setLayoutManager(new LinearLayoutManager(this)); downloadsList.setNestedScrollingEnabled(false); downloadsList.setAdapter(adapter); } else { findViewById(R.id.downloads).setVisibility(View.GONE); } }
From source file:com.autoparts.buyers.view.viewpagerindicator.TabPageMessageIndicator.java
private void addTab(int index, CharSequence text, int iconResId) { // final TabView tabView = new TabView(getContext()); // tabView.mIndex = index; // tabView.setFocusable(true); // tabView.setOnClickListener(mTabClickListener); // tabView.setText(text); ///*from w w w . j av a2 s . co m*/ // if (iconResId != 0) { // tabView.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0); // } View view = LayoutInflater.from(context).inflate(R.layout.tab_page_view, null); TextView textView = (TextView) view.findViewById(R.id.tab_page_textView); textView.setFocusable(true); textView.setOnClickListener(mTabClickListener); textView.setText(text); mTabLayout.addView(view, new LinearLayout.LayoutParams(0, MATCH_PARENT, 1)); }
From source file:mad.codeforcommunity.CalendarView.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.calendar);//from w w w . j a va2 s . c o m month = Calendar.getInstance(); // onNewIntent(getIntent()); items = new ArrayList<String>(); adapter = new CalendarAdapter(this, month); GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(adapter); handler = new Handler(); handler.post(calendarUpdater); TextView title = (TextView) findViewById(R.id.title); title.setText(android.text.format.DateFormat.format("MMMM yyyy", month)); TextView previous = (TextView) findViewById(R.id.previous); previous.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (month.get(Calendar.MONTH) == month.getActualMinimum(Calendar.MONTH)) { month.set((month.get(Calendar.YEAR) - 1), month.getActualMaximum(Calendar.MONTH), 1); } else { month.set(Calendar.MONTH, month.get(Calendar.MONTH) - 1); } refreshCalendar(); } }); TextView next = (TextView) findViewById(R.id.next); next.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (month.get(Calendar.MONTH) == month.getActualMaximum(Calendar.MONTH)) { month.set((month.get(Calendar.YEAR) + 1), month.getActualMinimum(Calendar.MONTH), 1); } else { month.set(Calendar.MONTH, month.get(Calendar.MONTH) + 1); } refreshCalendar(); } }); gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { TextView date = (TextView) v.findViewById(R.id.date); ImageView image = (ImageView) v.findViewById(R.id.date_icon); if (date instanceof TextView && !date.getText().equals("")) { if (image.getVisibility() == View.VISIBLE) { /*OLD CODE * Intent intent = new Intent(); String day = date.getText().toString(); if(day.length()==1) { day = "0"+day; } // return chosen date as string format intent.putExtra("date", android.text.format.DateFormat.format("yyyy-MM", month)+"-"+day); setResult(RESULT_OK, intent); finish(); */ Bundle extras = new Bundle(); String day = date.getText().toString(); if (day.length() == 1) { day = "0" + day; } // return chosen date as string format extras.putString("date", android.text.format.DateFormat.format("yyyy-MM", month) + "-" + day); Intent intent = new Intent(CalendarView.this, EventView.class); intent.putExtras(extras); startActivity(intent); } } } }); }
From source file:io.upnext.beaconcontrol.app.LoginActivity.java
private void wireViews() { emailEditText = (EditText) findViewById(R.id.email); passwordEditText = (EditText) findViewById(R.id.password); passwordEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override/* ww w . j ava 2 s . c o m*/ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { logIn(); } return false; } }); progressBar = (ProgressBar) findViewById(R.id.progress_bar); Button loginButton = (Button) findViewById(R.id.login_btn); loginButton.setOnClickListener(loginButtonListener); TextView createAccountLink = (TextView) findViewById(R.id.create_account); createAccountLink.setPaintFlags(createAccountLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); createAccountLink.setOnClickListener(createAccountListener); }
From source file:edu.ucsb.cs.cs185.inspirante.editentry.SelectCoverFragment.java
protected void setAddImageButton() { // TODO: making a TextView is a walk around, think about another way. TextView addPic = (TextView) rootView.findViewById(R.id.add_image); if (mItemCard.hasMaxNumOfImages()) { addPic.setVisibility(View.GONE); } else {// w w w . j av a2 s.c o m addPic.setVisibility(View.VISIBLE); addPic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ImagePicker.getInstance().setSelectLimit(24 - mItemCard.getImages().size()); Intent intent = new Intent(getContext(), ImageGridActivity.class); startActivityForResult(intent, FRAGMENT_PICK_IMAGE); } }); } }
From source file:com.zipzapd.DreamPinsActivity.java
@Override public void onSaveSelected() { closeMenu();// w ww. j a va2 s .c o m LayoutInflater inf = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inf.inflate(R.layout.popsave_layout, null, false); final PopupWindow pw = new PopupWindow(v); pw.setFocusable(true); pw.setWidth(RelativeLayout.LayoutParams.WRAP_CONTENT); pw.setHeight(RelativeLayout.LayoutParams.WRAP_CONTENT); final EditText edt = (EditText) v.findViewById(R.id.edtFileName); TextView saveTxt = (TextView) v.findViewById(R.id.dlgSave); TextView cancelTxt = (TextView) v.findViewById(R.id.dlgCancel); cancelTxt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pw.dismiss(); } }); saveTxt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pw.dismiss(); Bitmap b = pinTableFrag.createBitmap(); try { /////////////// ImageUtility.saveImage(b, edt.getEditableText().toString(), DreamPinsActivity.this); sync.putZipZapData(); /////////////// } catch (SaveFileException sfe) { Toast.makeText(DreamPinsActivity.this, getResources().getText(R.string.msgSaveFileError), Toast.LENGTH_LONG).show(); } } }); pw.showAtLocation(v, Gravity.CENTER, 0, 0); }
From source file:net.olejon.mdapp.LvhCategoriesAdapter.java
@Override public void onBindViewHolder(CategoryViewHolder viewHolder, int i) { try {/*from w w w .j a va 2s . c om*/ final JSONObject categoriesJsonObject = mCategories.getJSONObject(i); viewHolder.card.setCardBackgroundColor(Color.parseColor(mColor)); switch (mIcon) { case "lvh_urgent": { viewHolder.icon.setImageResource(R.drawable.ic_favorite_white_24dp); break; } case "lvh_symptoms": { viewHolder.icon.setImageResource(R.drawable.ic_stethoscope); break; } case "lvh_injuries": { viewHolder.icon.setImageResource(R.drawable.ic_healing_white_24dp); break; } case "lvh_administrative": { viewHolder.icon.setImageResource(R.drawable.ic_my_library_books_white_24dp); break; } } viewHolder.title.setText(categoriesJsonObject.getString("title")); viewHolder.categories.removeAllViews(); final JSONArray itemsJsonArray = categoriesJsonObject.getJSONArray("items"); for (int f = 0; f < itemsJsonArray.length(); f++) { final JSONObject categoryJsonObject = itemsJsonArray.getJSONObject(f); final String name = categoryJsonObject.getString("name"); final String uri = categoryJsonObject.getString("uri"); TextView textView = (TextView) mLayoutInflater .inflate(R.layout.activity_lvh_categories_card_categories_item, null); textView.setText(name); textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(mContext, MainWebViewActivity.class); intent.putExtra("title", name); intent.putExtra("uri", uri); mContext.startActivity(intent); } }); viewHolder.categories.addView(textView); } animateView(viewHolder.card, i); } catch (Exception e) { Log.e("LvhCategoriesAdapter", Log.getStackTraceString(e)); } }
From source file:com.cybrosys.scientific.ScientificActivity.java
@Override public void onStart() { super.onStart(); getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); ctx = getActivity();//from w w w . j ava2 s . c o m init(); mDisplay = (CalculatorDisplay) getView().findViewById(R.id.display); imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); mDisplay = (CalculatorDisplay) getView().findViewById(R.id.display); metrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); inDispheight = (int) (metrics.heightPixels * .6f); inDispwidth = (int) (metrics.widthPixels * .8f); mPersist = new Persist(ctx); mPersist.load(); mHistory = mPersist.history; mLogic = new Logic(ctx, mHistory, mDisplay); mLogic.setDeleteMode(mPersist.getDeleteMode()); mLogic.setLineLength(mDisplay.getMaxDigits()); HistoryAdapter historyAdapter = new HistoryAdapter(ctx, mHistory, mLogic); mHistory.setObserver(historyAdapter); mListener.setHandler(mLogic, mPager); mDisplay.setOnKeyListener(mListener); // tablelayout for the functions TableLayout tblltPad = (TableLayout) getView().findViewById(R.id.tableLayout1); int inPadCount = tblltPad.getChildCount(); for (int inI = 0; inI < inPadCount; inI++) { View vwView = tblltPad.getChildAt(inI); if (vwView instanceof TableRow) { TableRow tblrRow = (TableRow) vwView; int inRowCount = tblrRow.getChildCount(); for (int inR = 0; inR < inRowCount; inR++) { View v2 = tblrRow.getChildAt(inR); if (v2 instanceof Button) { Button b = (Button) v2; // setting listeners for the function buttons b.setOnClickListener(mListener); b.setOnLongClickListener(mListener); } else if (v2 instanceof TextView) { TextView txtv = (TextView) v2; txtv.setOnClickListener(null); } } } } // tablelayout for the numbers TableLayout tblltNum = (TableLayout) getView().findViewById(R.id.tableLayout2); int inNumcount = tblltNum.getChildCount(); mDisplay.setText(myString, null); txtvFSE.setText(strFSEstate); txtvShift.setText(strAlt); txtvDeg.setText(strDeg); txtvHyp.setText(strHyp); for (int inI = 0; inI < inNumcount; inI++) { View vw1 = tblltNum.getChildAt(inI); if (vw1 instanceof TableRow) { TableRow tblrRow = (TableRow) vw1; int inRowCount = tblrRow.getChildCount(); for (int inR = 0; inR < inRowCount; inR++) { View vw2 = tblrRow.getChildAt(inR); if (vw2 instanceof Button) { Button b = (Button) vw2; // setting listeners for the buttons b.setOnClickListener(mListener); b.setOnLongClickListener(mListener); } else if (vw2 instanceof TextView) { TextView txtv = (TextView) vw2; txtv.setOnClickListener(null); } } } } }
From source file:com.androzic.About.java
private void updateAboutInfo(final View view) { // version/*from w w w. j av a 2 s.c o m*/ String versionName = null; int versionBuild = 0; try { versionName = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName; versionBuild = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionCode; } catch (NameNotFoundException ex) { versionName = "unable to retreive version"; } final TextView version = (TextView) view.findViewById(R.id.version); version.setText(getString(R.string.version, versionName, versionBuild)); // home links StringBuilder links = new StringBuilder(); links.append("<a href=\""); links.append(": http://androzic.com"); links.append("\">"); links.append(getString(R.string.homepage)); links.append("</a><br /><a href=\""); links.append(getString(R.string.faquri)); links.append("\">"); links.append(getString(R.string.faq)); links.append("</a><br /><a href=\""); links.append(getString(R.string.featureuri)); links.append("\">"); links.append(getString(R.string.feedback)); links.append("</a>"); final TextView homelinks = (TextView) view.findViewById(R.id.homelinks); homelinks.setText(Html.fromHtml(links.toString())); homelinks.setMovementMethod(LinkMovementMethod.getInstance()); // community links StringBuilder communities = new StringBuilder(); communities.append("<a href=\""); communities.append(getString(R.string.googleplusuri)); communities.append("\">"); communities.append(getString(R.string.googleplus)); communities.append("</a><br /><a href=\""); communities.append(getString(R.string.facebookuri)); communities.append("\">"); communities.append(getString(R.string.facebook)); communities.append("</a><br /><a href=\""); communities.append(getString(R.string.twitteruri)); communities.append("\">"); communities.append(getString(R.string.twitter)); communities.append("</a>"); final TextView communitylinks = (TextView) view.findViewById(R.id.communitylinks); communitylinks.setText(Html.fromHtml(communities.toString())); communitylinks.setMovementMethod(LinkMovementMethod.getInstance()); // donations StringBuilder donations = new StringBuilder(); donations.append("<a href=\""); donations.append(getString(R.string.playuri)); donations.append("\">"); donations.append(getString(R.string.donate_google)); donations.append("</a><br /><a href=\""); donations.append(getString(R.string.paypaluri)); donations.append("\">"); donations.append(getString(R.string.donate_paypal)); donations.append("</a>"); final TextView donationlinks = (TextView) view.findViewById(R.id.donationlinks); donationlinks.setText(Html.fromHtml(donations.toString())); donationlinks.setMovementMethod(LinkMovementMethod.getInstance()); Androzic application = Androzic.getApplication(); if (application.isPaid) { view.findViewById(R.id.donations).setVisibility(View.GONE); view.findViewById(R.id.donationtext).setVisibility(View.GONE); donationlinks.setVisibility(View.GONE); } // license final SpannableString message = new SpannableString( Html.fromHtml(getString(R.string.app_eula).replace("/n", "<br/>"))); Linkify.addLinks(message, Linkify.WEB_URLS); final TextView license = (TextView) view.findViewById(R.id.license); license.setText(message); license.setMovementMethod(LinkMovementMethod.getInstance()); // credits String[] names = getResources().getStringArray(R.array.credit_names); String[] merits = getResources().getStringArray(R.array.credit_merits); StringBuilder credits = new StringBuilder(); for (int i = 0; i < names.length; i++) { credits.append("<b>"); credits.append(merits[i]); credits.append("</b> — "); credits.append(names[i]); credits.append("<br />"); } final TextView creditlist = (TextView) view.findViewById(R.id.credits); creditlist.setText(Html.fromHtml(credits.toString())); // dedication final TextView dedicated = (TextView) view.findViewById(R.id.dedicated); dedicated.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { clicks = 1; dedicated.setVisibility(View.GONE); View photo = view.findViewById(R.id.photo); photo.setVisibility(View.VISIBLE); photo.setOnClickListener(redirect); } }); }
From source file:com.vose.fragment.action.RulesFragment.java
private void setPrivacyPolicyView() { TextView privacyView = (TextView) fRootView.findViewById(R.id.privacy_policy); privacyView.setOnClickListener(new View.OnClickListener() { @Override/*from w ww. java 2s .co m*/ public void onClick(View v) { setOnClickListener(getString(R.string.privacy_policy_title), getPrivacyPolicy()); } }); }