List of usage examples for android.widget TextView setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:de.azapps.mirakel.adapter.TagAdapter.java
@Override public View newView(final Context ctx, final Cursor c, final ViewGroup parent) { if (c != null && c.getCount() > 0) { final Tag tag = new Tag(c); final LayoutInflater inflater = LayoutInflater.from(ctx); final View v = inflater.inflate(R.layout.tag_list_row, null); final TextView t = (TextView) v.findViewById(R.id.tag_list_name); t.setText(tag.toString());/*from w ww.ja v a 2 s . co m*/ t.setOnClickListener(this.onClick); return v; } return null; }
From source file:cheng.app.cnbeta.AboutFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { PackageManager pm = getActivity().getPackageManager(); String packageName = getActivity().getPackageName(); String versionName;/*w w w. jav a2 s . co m*/ try { PackageInfo info = pm.getPackageInfo(packageName, 0); versionName = info.versionName; } catch (NameNotFoundException e) { versionName = VERSION_NA; } LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); View v = layoutInflater.inflate(R.layout.dialog_about, null); TextView versionText = (TextView) v.findViewById(R.id.dialog_about_version); LinearLayout author = (LinearLayout) v.findViewById(R.id.author); versionText.setText(versionName); author.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://plus.google.com/u/0/114474183775310756510")); startActivity(i); } }); TextView github = (TextView) v.findViewById(R.id.github); github.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/cr1944/CBReader2")); startActivity(i); } }); TextView opensource = (TextView) v.findViewById(R.id.opensource); opensource.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { HelpUtils.showOpenSourceLicenses(getActivity()); } }); return new AlertDialog.Builder(getActivity()).setView(v) .setPositiveButton(android.R.string.cancel, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); }
From source file:de.sourcestream.movieDB.About.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.about, container, false); ImageView sourcestream = (ImageView) rootView.findViewById(R.id.sourcestream); sourcestream.setOnClickListener(this); ImageView tmdb = (ImageView) rootView.findViewById(R.id.tmdb); tmdb.setOnClickListener(this); TextView aboutSupportMail = (TextView) rootView.findViewById(R.id.aboutSupportMail); aboutSupportMail.setOnClickListener(this); res = getResources();// ww w . j a va 2 s. c o m getActivity().getWindow().getDecorView() .setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.aboutBackground)); return rootView; }
From source file:com.example.dididoit.app.MainActivity.java
private TextView makeFooter() { TextView foot = new TextView(this); foot.setText("Add new item"); foot.setClickable(true);/*from w w w .j av a 2 s . c om*/ foot.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DialogFragment dialog = new NewItemDialogFragment(); dialog.show(dialog.getFragmentManager(), "NewItemDialogFragment"); } }); return foot; }
From source file:com.example.linhdq.test.main_menu.ContactActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contact); initToolbar();//from w w w . j a v a 2 s .c o m setToolbarMessage(R.string.pref_title_contact); getSupportActionBar().setDisplayHomeAsUpEnabled(true); TextView email = (TextView) findViewById(R.id.textView_send_mail); email.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = getFeedbackIntent(getString(R.string.feedback_subject), null); startActivity(Intent.createChooser(intent, getString(R.string.feedback_title))); } }); }
From source file:de.fahrgemeinschaft.util.ReoccuringWeekDaysView.java
private TextView makeRecurringDayButton(Context ctx) { TextView day = new UnScrollingTextView(ctx); if (clickable) day.setOnClickListener(toggleSelectedState); LayoutParams lp = new LayoutParams(0, LayoutParams.MATCH_PARENT); lp.weight = 1;// w w w. j a v a2 s . co m day.setLayoutParams(lp); day.setTextAppearance(getContext(), R.style.dark_Bold); day.setBackgroundResource(R.drawable.btn_night); day.setGravity(Gravity.CENTER); day.setFocusable(true); return day; }
From source file:de.wikilab.android.friendica01.activity.GenericContentActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.genericcontentactivity); TextView header_logo = (TextView) findViewById(R.id.header_logo); header_logo.setOnClickListener(new OnClickListener() { @Override/*from ww w .j av a 2s .c om*/ public void onClick(View v) { finish(); } }); header_text = (TextView) findViewById(R.id.header_text); header_text.setText("...GenericContentActivity..."); loadFragment(); }
From source file:com.example.android.support.text.emoji.MainFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_main, container, false); // TextView variant provided by EmojiCompat library mEmojiTextView = view.findViewById(R.id.emoji_text_view); // EditText variant provided by EmojiCompat library mEmojiEditText = view.findViewById(R.id.emoji_edit_text); // Button variant provided by EmojiCompat library mEmojiButton = view.findViewById(R.id.emoji_button); // Regular TextView without EmojiCompat support; you have to manually process the text mRegularTextView = view.findViewById(R.id.regular_text_view); // Custom TextView mCustomTextView = view.findViewById(R.id.emoji_custom_text_view); final TextView emojiListButton = view.findViewById(R.id.emoji_list_button); emojiListButton.setOnClickListener(new View.OnClickListener() { @Override/*w w w . j a va 2 s . c om*/ public void onClick(View v) { ((MainActivity) getActivity()).showAllEmojis(); } }); init(); return view; }
From source file:chrisrenke.drawerarrowdrawable.DrawerArrowSample.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_view);//from w w w . j av a2 s. com final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); final ImageView imageView = (ImageView) findViewById(R.id.drawer_indicator); final Resources resources = getResources(); drawerArrowDrawable = new DrawerArrowDrawable(resources); drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.green)); imageView.setImageDrawable(drawerArrowDrawable); drawer.setDrawerListener(new DrawerLayout.SimpleDrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { offset = slideOffset; // Sometimes slideOffset ends up so close to but not quite 1 or 0. if (slideOffset >= .995) { flipped = true; drawerArrowDrawable.setFlip(flipped); } else if (slideOffset <= .005) { flipped = false; drawerArrowDrawable.setFlip(flipped); } drawerArrowDrawable.setParameter(offset); } }); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (drawer.isDrawerVisible(START)) { drawer.closeDrawer(START); } else { drawer.openDrawer(START); } } }); final TextView styleButton = (TextView) findViewById(R.id.indicator_style); styleButton.setOnClickListener(new View.OnClickListener() { boolean rounded = false; @Override public void onClick(View v) { styleButton.setText(rounded // ? resources.getString(R.string.rounded) // : resources.getString(R.string.squared)); rounded = !rounded; drawerArrowDrawable = new DrawerArrowDrawable(resources, rounded); drawerArrowDrawable.setParameter(offset); drawerArrowDrawable.setFlip(flipped); drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray)); imageView.setImageDrawable(drawerArrowDrawable); } }); }
From source file:com.waz.zclient.pages.main.profile.preferences.dialogs.VerifyEmailPreferenceFragment.java
@Nullable @Override// w ww . ja v a 2 s. c o m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final String email = TextUtils.htmlEncode(getArguments().getString(ARG_EMAIL, "")); final View view = inflater.inflate(R.layout.fragment_preference_email_verification, container, false); final View backButton = ViewUtils.getView(view, R.id.tv__back_button); backButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); final TextView changeNumberButton = ViewUtils.getView(view, R.id.tv__change_email_button); changeNumberButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (getContainer() == null) { return; } dismiss(); getContainer().changeEmail(email); } }); final TextView resendButton = ViewUtils.getView(view, R.id.tv__resend_button); resendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (getStoreFactory() == null || getStoreFactory().isTornDown()) { return; } getStoreFactory().getProfileStore().resendVerificationEmail(email); } }); final String resendHtml = getString(R.string.pref__account_action__email_verification__resend, email); resendButton.setText(Html.fromHtml(resendHtml)); return view; }