List of usage examples for android.widget TextView setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:com.jbirdvegas.mgerrit.cards.PatchSetPropertiesCard.java
private void setupUserDetails(final TextView view, final int id, final String email, final String name) { view.setTag(id);/*w w w .j av a 2 s. co m*/ // attach owner's gravatar GravatarHelper.attachGravatarToTextView(view, email, mRequestQuery); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setTrackingUser((Integer) view.getTag()); } }); setImageCaption(view, R.string.commit_owner, name); }
From source file:com.handpoint.headstart.client.ui.LoginActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); HeadstartService.removeProperty("last_activity"); mPreferences = PreferenceManager.getDefaultSharedPreferences(this); long elapsedTime = SystemClock.elapsedRealtime(); long lastAttempt = getLastAttempt(); if (elapsedTime > lastAttempt && lastAttempt > 0 && lastAttempt + ATTEMPT_DELAY > elapsedTime) { long timeToWait = ATTEMPT_DELAY - (elapsedTime - lastAttempt); Toast.makeText(this, getString(R.string.warn_wait_message, formatTime(timeToWait)), Toast.LENGTH_LONG) .show();/* www. j a v a 2 s .co m*/ finish(); return; } setLastAttempt(0); setContentView(R.layout.login); Button loginButton = (Button) findViewById(R.id.login_button); loginButton.setOnClickListener(this); TextView forgotLink = (TextView) findViewById(R.id.forgot_password_link); SpannableString content = new SpannableString(getString(R.string.forgot_password_link_label)); content.setSpan(new UnderlineSpan(), 0, content.length(), 0); forgotLink.setText(content); forgotLink.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DialogFragment newFragment = new ForgotPasscodeDialog(); newFragment.show(getSupportFragmentManager(), "forgot_passcode"); } }); }
From source file:io.github.hidroh.materialistic.ComposeActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mParentId = getIntent().getStringExtra(EXTRA_PARENT_ID); if (TextUtils.isEmpty(mParentId)) { finish();// w w w. j a v a 2s . co m return; } AppUtils.setStatusBarColor(getWindow(), ContextCompat.getColor(this, R.color.blackT12)); setContentView(R.layout.activity_compose); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); //noinspection ConstantConditions getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP); mEditText = (EditText) findViewById(R.id.edittext_body); if (savedInstanceState == null) { mEditText.setText(Preferences.getDraft(this, mParentId)); } findViewById(R.id.empty).setOnClickListener(v -> mEditText.requestFocus()); findViewById(R.id.empty).setOnLongClickListener(v -> { mEditText.requestFocus(); return mEditText.performLongClick(); }); mParentText = getIntent().getStringExtra(EXTRA_PARENT_TEXT); if (!TextUtils.isEmpty(mParentText)) { findViewById(R.id.quote).setVisibility(View.VISIBLE); final TextView toggle = (TextView) findViewById(R.id.toggle); final TextView textView = (TextView) findViewById(R.id.text); AppUtils.setTextWithLinks(textView, AppUtils.fromHtml(mParentText)); toggle.setOnClickListener(v -> { if (textView.getVisibility() == View.VISIBLE) { toggle.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_expand_more_white_24dp, 0); textView.setVisibility(View.GONE); } else { toggle.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_expand_less_white_24dp, 0); textView.setVisibility(View.VISIBLE); } }); } }
From source file:com.sunmeng.educationaladministration.animateview.GoogleCardsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_extra_curricular); httpUtils = new HttpUtils(); listView = (ListView) findViewById(R.id.activity_googlecards_listview); mGoogleCardsAdapter = new GoogleCardsAdapter(this); getData();//from w w w . j a va 2 s. co m SwingBottomInAnimationAdapter swingBottomInAnimationAdapter = new SwingBottomInAnimationAdapter( new SwipeDismissAdapter(mGoogleCardsAdapter, this)); swingBottomInAnimationAdapter.setListView(listView); listView.setAdapter(swingBottomInAnimationAdapter); TextView tvadd = (TextView) findViewById(R.id.tvadd); tvadd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(GoogleCardsActivity.this, AddExtraActivity.class); GoogleCardsActivity.this.startActivity(intent); GoogleCardsActivity.this.finish(); } }); getDetails(); img_back2 = (ImageView) findViewById(R.id.img_back); img_back2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(GoogleCardsActivity.this, MainActivity.class); GoogleCardsActivity.this.startActivity(intent); GoogleCardsActivity.this.finish(); } }); }
From source file:com.metinkale.prayerapp.vakit.AddCity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.vakit_addcity); mFab = (FloatingActionButton) findViewById(R.id.search); mFab.setOnClickListener(this); ListView listView = (ListView) findViewById(R.id.listView); listView.setFastScrollEnabled(true); listView.setOnItemClickListener(this); listView.addFooterView(View.inflate(this, R.layout.vakit_addcity_addcsv, null)); mAdapter = new MyAdapter(this); listView.setAdapter(mAdapter);/*from ww w . j av a2 s . c o m*/ TextView legacy = (TextView) findViewById(R.id.legacySwitch); legacy.setText(R.string.oldAddCity); legacy.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); startActivity(new Intent(AddCity.this, AddCityLegacy.class)); } }); checkLocation(); }
From source file:com.todoroo.astrid.welcome.tutorial.WelcomeWalkthrough.java
private void initializeSimpleUI(final String email) { Button simpleLogin = (Button) findViewById(R.id.quick_login_google); simpleLogin.setText(getString(R.string.actfm_quick_login, email)); simpleLogin.setOnClickListener(new OnClickListener() { @Override//from w w w. ja va2 s . c o m public void onClick(View v) { StatisticsService.reportEvent(StatisticsConstants.ACTFM_LOGIN_SIMPLE); final ProgressDialog pd = DialogUtilities.progressDialog(WelcomeWalkthrough.this, getString(R.string.gtasks_GLA_authenticating)); pd.show(); getAuthToken(email, pd); } private void getAuthToken(final String e, final ProgressDialog pd) { final GoogleAccountManager accountManager = new GoogleAccountManager(WelcomeWalkthrough.this); Account a = accountManager.getAccountByName(e); AccountManagerCallback<Bundle> callback = new AccountManagerCallback<Bundle>() { public void run(final AccountManagerFuture<Bundle> future) { new Thread() { @Override public void run() { try { Bundle bundle = future.getResult(30, TimeUnit.SECONDS); if (bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) { authToken = bundle.getString(AccountManager.KEY_AUTHTOKEN); if (!onSuccess) { accountManager.manager.invalidateAuthToken( ActFmGoogleAuthActivity.AUTH_TOKEN_TYPE, authToken); getAuthToken(e, pd); onSuccess = true; } else { onAuthTokenSuccess(e, authToken); dismissDialog = true; } } else { dismissDialog = true; } } catch (final Exception e) { Log.e("actfm-google-auth", "Login Error", e); //$NON-NLS-1$ //$NON-NLS-2$ runOnUiThread(new Runnable() { @Override public void run() { int error = e instanceof IOException ? R.string.gtasks_GLA_errorIOAuth : R.string.gtasks_GLA_errorAuth; Toast.makeText(WelcomeWalkthrough.this, error, Toast.LENGTH_LONG) .show(); onAuthError(); } }); } finally { if (dismissDialog) DialogUtilities.dismissDialog(WelcomeWalkthrough.this, pd); } } }.start(); } }; accountManager.manager.getAuthToken(a, ActFmGoogleAuthActivity.AUTH_TOKEN_TYPE, null, WelcomeWalkthrough.this, callback, null); } }); TextView rejectQuickLogin = (TextView) findViewById(R.id.quick_login_reject); rejectQuickLogin.setText(getString(R.string.actfm_quick_login_reject, email)); rejectQuickLogin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { StatisticsService.reportEvent(StatisticsConstants.ACTFM_LOGIN_SIMPLE_REJECTED); switchToLoginPage(); } }); errors = (TextView) findViewById(R.id.error); }
From source file:com.posagent.fragments.RegisterFragment.java
private void initViews(View view) { if (userKind == Constants.UserConstant.USER_KIND_PESONAL) { View company1 = view.findViewById(R.id.company_content1); company1.setVisibility(View.GONE); View company2 = view.findViewById(R.id.company_content2); company2.setVisibility(View.GONE); }/*from w ww.j av a 2 s. c om*/ view.findViewById(R.id.mi_select_city).setOnClickListener(this); view.findViewById(R.id.btn_submit).setOnClickListener(this); tvCityName = (TextView) view.findViewById(R.id.tv_city_name); //photo TextView tv_card_photo = (TextView) view.findViewById(R.id.tv_card_photo); tv_card_photo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentKind = "card"; photoManager.prompt(); } }); TextView tv_license_photo = (TextView) view.findViewById(R.id.tv_license_photo); tv_license_photo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentKind = "license"; photoManager.prompt(); } }); TextView tv_tax_photo = (TextView) view.findViewById(R.id.tv_tax_photo); tv_tax_photo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentKind = "tax"; photoManager.prompt(); } }); ImageView iv_card_photo = (ImageView) view.findViewById(R.id.iv_card_photo); iv_card_photo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentKind = "card"; Intent i = new Intent(getActivity(), ImageViewer.class); i.putExtra("url", cardIdPhotoPath); startActivityForResult(i, Constants.REQUEST_CODE); } }); ImageView iv_license_photo = (ImageView) view.findViewById(R.id.iv_license_photo); iv_license_photo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentKind = "license"; Intent i = new Intent(getActivity(), ImageViewer.class); i.putExtra("url", licenseNoPicPath); startActivityForResult(i, Constants.REQUEST_CODE); } }); ImageView iv_tax_photo = (ImageView) view.findViewById(R.id.iv_tax_photo); iv_tax_photo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentKind = "tax"; Intent i = new Intent(getActivity(), ImageViewer.class); i.putExtra("url", taxNoPicPath); startActivityForResult(i, Constants.REQUEST_CODE); } }); }
From source file:com.nasageek.utexasutilities.activities.AboutMeActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.aboutme_layout); actionbar = getSupportActionBar();//from w w w.j a v a2 s . c o m actionbar.setTitle("About"); actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionbar.setHomeButtonEnabled(true); actionbar.setDisplayHomeAsUpEnabled(true); // force the License Dialog link to be underlined so it looks "linky" TextView licenseView = (TextView) findViewById(R.id.library_license_link); SpannableString underlinedLicenseLink = new SpannableString(getString(R.string.library_license_link)); underlinedLicenseLink.setSpan(new UnderlineSpan(), 0, underlinedLicenseLink.length(), 0); licenseView.setText(underlinedLicenseLink); licenseView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { FragmentManager fm = getSupportFragmentManager(); LibraryLicenseDialog libraryLicenseDlg = new LibraryLicenseDialog(); libraryLicenseDlg.show(fm, "fragment_license"); } }); // do the same thing with the Privacy Policy link TextView policyView = (TextView) findViewById(R.id.privacy_policy_link); SpannableString underlinedPolicyLink = new SpannableString(getString(R.string.privacy_policy_link)); underlinedPolicyLink.setSpan(new UnderlineSpan(), 0, underlinedPolicyLink.length(), 0); policyView.setText(underlinedPolicyLink); policyView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { FragmentManager fm = getSupportFragmentManager(); PrivacyPolicyDialog privacyPolicyDlg = new PrivacyPolicyDialog(); privacyPolicyDlg.show(fm, "fragment_privacy_policy"); } }); TextView versionNumberView = (TextView) findViewById(R.id.version); String versionName = ""; try { versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName; } catch (NameNotFoundException e) { // of course UTilities is installed... e.printStackTrace(); } versionNumberView.setText(versionName); }
From source file:com.prey.activities.InitActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); this.setContentView(R.layout.home); PreyLogger.i("onCreate of MenuActivity"); onboardingPagerAdapter = new OnboardingPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(onboardingPagerAdapter); Button buttonHome = (Button) findViewById(R.id.buttonHome); buttonHome.setOnClickListener(new View.OnClickListener() { @Override/*from w w w .j a v a2s .com*/ public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), SignUpActivity.class); startActivity(intent); finish(); } }); TextView textView = (TextView) findViewById(R.id.linkHome); textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), SignInActivity.class); startActivity(intent); finish(); } }); Typeface titilliumWebBold = Typeface.createFromAsset(getAssets(), "fonts/Titillium_Web/TitilliumWeb-Bold.ttf"); buttonHome.setTypeface(titilliumWebBold); final LinearLayout larr = (LinearLayout) findViewById(R.id.larr); final LinearLayout rarr = (LinearLayout) findViewById(R.id.rarr); larr.setVisibility(View.GONE); larr.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int currentItem = mViewPager.getCurrentItem(); larr.setVisibility(View.VISIBLE); rarr.setVisibility(View.VISIBLE); if (currentItem == 0) { larr.setVisibility(View.GONE); } mViewPager.setCurrentItem(currentItem - 1); } }); rarr.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int currentItem = mViewPager.getCurrentItem(); larr.setVisibility(View.VISIBLE); rarr.setVisibility(View.VISIBLE); if (currentItem >= 5) { rarr.setVisibility(View.GONE); onboardingCompleted(); } mViewPager.setCurrentItem(currentItem + 1); } }); mViewPager.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int currentItem = mViewPager.getCurrentItem(); larr.setVisibility(View.VISIBLE); rarr.setVisibility(View.VISIBLE); PreyLogger.i("currentItem:" + currentItem); if (currentItem == 0) { larr.setVisibility(View.GONE); } if (currentItem >= 5) { rarr.setVisibility(View.GONE); onboardingCompleted(); } return false; } }); onboardingInit(); }
From source file:com.sbgapps.simplenumberpicker.decimal.DecimalPickerDialog.java
@SuppressLint("SetTextI18n") @NonNull// ww w . ja v a 2s . com @Override public Dialog onCreateDialog(Bundle savedInstanceState) { TypedArray attributes = getContext().obtainStyledAttributes(theme, R.styleable.SimpleNumberPicker); LayoutInflater inflater = getActivity().getLayoutInflater(); @SuppressLint("InflateParams") View view = inflater.inflate(R.layout.snp_dialog_decimal_picker, null); // Init number int color = attributes.getColor(R.styleable.SimpleNumberPicker_snpKeyColor, ContextCompat.getColor(getContext(), android.R.color.secondary_text_light)); numberTextView = (TextView) view.findViewById(R.id.tv_hex_number); numberTextView.setTextColor(color); if (null != savedInstanceState && savedInstanceState.containsKey(ARG_SAVED_VALUE)) numberTextView.setText(savedInstanceState.getString(ARG_SAVED_VALUE)); // Init backspace color = attributes.getColor(R.styleable.SimpleNumberPicker_snpBackspaceColor, ContextCompat.getColor(getContext(), android.R.color.secondary_text_light)); backspaceButton = (ImageButton) view.findViewById(R.id.key_backspace); backspaceButton.setImageDrawable( ThemeUtil.makeSelector(getContext(), R.drawable.snp_ic_backspace_black_24dp, color)); backspaceButton.setOnClickListener(v -> { CharSequence number = numberTextView.getText().subSequence(0, numberTextView.getText().length() - 1); if (1 == number.length() && '-' == number.charAt(0)) number = ""; numberTextView.setText(number); onNumberChanged(); }); backspaceButton.setOnLongClickListener(v -> { numberTextView.setText(""); onNumberChanged(); return true; }); // Create dialog dialog = new AlertDialog.Builder(getContext(), theme).setView(view) .setPositiveButton(android.R.string.ok, (dialog, which) -> { String result = numberTextView.getText().toString(); if (result.isEmpty()) result = "0"; final float number = Float.parseFloat(result); final Activity activity = getActivity(); final Fragment fragment = getParentFragment(); if (activity instanceof DecimalPickerHandler) { final DecimalPickerHandler handler = (DecimalPickerHandler) activity; handler.onDecimalNumberPicked(reference, number); } else if (fragment instanceof DecimalPickerHandler) { final DecimalPickerHandler handler = (DecimalPickerHandler) fragment; handler.onDecimalNumberPicked(reference, number); } dismiss(); }).setNegativeButton(android.R.string.cancel, (dialog, which) -> dismiss()).create(); // Init dialog color = attributes.getColor(R.styleable.SimpleNumberPicker_snpDialogBackground, ContextCompat.getColor(getContext(), android.R.color.white)); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(color)); // Init keys View.OnClickListener listener = v -> { int key = (int) v.getTag(); String id = numberTextView.getText() + Integer.toString(key); numberTextView.setText(id); onNumberChanged(); }; color = attributes.getColor(R.styleable.SimpleNumberPicker_snpKeyColor, ThemeUtil.getThemeAccentColor(getContext())); TypedArray ids = getResources().obtainTypedArray(R.array.snp_key_ids); for (int i = 0; i < NB_KEYS; i++) { TextView key = (TextView) view.findViewById(ids.getResourceId(i, -1)); key.setTag(i); key.setOnClickListener(listener); key.setTextColor(color); } // Init sign TextView sign = (TextView) view.findViewById(R.id.key_sign); if (relative) { sign.setTextColor(color); sign.setOnClickListener(v -> { String number = numberTextView.getText().toString(); if (number.startsWith("-")) { numberTextView.setText(number.substring(1)); } else { numberTextView.setText("-" + number); } onNumberChanged(); }); } else { sign.setVisibility(View.INVISIBLE); } // Init point TextView point = (TextView) view.findViewById(R.id.key_point); if (natural) { point.setVisibility(View.INVISIBLE); } else { point.setTextColor(color); point.setOnClickListener(v -> { if (numberTextView.getText().toString().contains(".")) return; String number = numberTextView.getText().toString(); numberTextView.setText(number + "."); onNumberChanged(); }); } ids.recycle(); attributes.recycle(); return dialog; }