List of usage examples for android.widget TextView addTextChangedListener
public void addTextChangedListener(TextWatcher watcher)
From source file:fiskinfoo.no.sintef.fiskinfoo.MyToolsFragment.java
private void setupTextChangedListenerOnHeaderDate(final TextView headerDate, final String currentDate, final Button arrowRightButton) { headerDate.addTextChangedListener(new TextWatcher() { @Override//from w ww .j ava 2 s . c om public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { //generateDiaryTableDataOnCurrentlySelectedDate(rootView, headerDate, haulLogSpecies, speciesHeader, haulLogLayout); if (!headerDate.getText().toString().equals(currentDate)) { arrowRightButton.setVisibility(View.VISIBLE); } } }); }
From source file:eu.geopaparazzi.core.maptools.FeaturePageAdapter.java
private TextView getEditView(final Feature feature, final String fieldName, EDataType type, String value) { final TextView editView; switch (type) { case DATE:/*ww w.j a v a2 s .c o m*/ editView = new TextView(context); editView.setInputType(InputType.TYPE_CLASS_DATETIME); editView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { FeaturePageAdapter.this.openDatePicker((EditText) view); } }); if (value == null || value.equals("")) { value = "____-__-__"; } break; default: editView = new EditText(context); break; } editView.setText(value); switch (type) { case DOUBLE: case FLOAT: editView.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); break; case PHONE: editView.setInputType(InputType.TYPE_CLASS_PHONE); break; case DATE: editView.setInputType(InputType.TYPE_CLASS_DATETIME); editView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { FeaturePageAdapter.this.openDatePicker((TextView) view); } }); break; case INTEGER: editView.setInputType(InputType.TYPE_CLASS_NUMBER); break; default: break; } editView.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { // ignore } public void beforeTextChanged(CharSequence s, int start, int count, int after) { // ignore } public void afterTextChanged(Editable s) { String text = editView.getText().toString(); feature.setAttribute(fieldName, text); } }); return editView; }
From source file:org.chromium.chrome.browser.ntp.NewTabPageView.java
/** * Sets up the hint text and event handlers for the search box text view. */// w w w . ja va 2 s. c o m private void initializeSearchBoxTextView() { final TextView searchBoxTextView = (TextView) mSearchBoxView.findViewById(R.id.search_box_text); String hintText = getResources().getString(R.string.search_or_type_url); if (!DeviceFormFactor.isTablet(getContext()) || mManager.isFakeOmniboxTextEnabledTablet()) { searchBoxTextView.setHint(hintText); } else { searchBoxTextView.setContentDescription(hintText); } searchBoxTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mManager.focusSearchBox(false, null); } }); searchBoxTextView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (s.length() == 0) return; mManager.focusSearchBox(false, s.toString()); searchBoxTextView.setText(""); } }); }
From source file:com.benefit.buy.library.http.query.AbstractAQuery.java
/** * Register a callback method for when a textview text is changed. Method must have signature of method(CharSequence * s, int start, int before, int count)). * @param handler The handler that has the public callback method. * @param method The method name of the callback. * @return self// w ww . j a v a 2 s. c o m */ public T textChanged(Object handler, String method) { if (view instanceof TextView) { TextView tv = (TextView) view; Common common = new Common().forward(handler, method, true, TEXT_CHANGE_SIG); tv.addTextChangedListener(common); } return self(); }
From source file:com.androidquery.AQuery.java
/** * Register a callback method for when a textview text is changed. Method must have signature of method(CharSequence s, int start, int before, int count)). * * @param handler The handler that has the public callback method. * @param method The method name of the callback. * @return self/*w ww. j a v a2 s .c o m*/ */ public AQuery textChanged(Object handler, String method) { if (view instanceof TextView) { TextView tv = (TextView) view; Common common = new Common().forward(handler, method, true, TEXT_CHANGE_SIG); tv.addTextChangedListener(common); } return self(); }
From source file:com.androidquery.AbstractAQuery.java
/** * Register a callback method for when a textview text is changed. Method must have signature of method(CharSequence s, int start, int before, int count)). * * @param handler The handler that has the public callback method. * @param method The method name of the callback. * @return self//from ww w . j a va2 s. c o m */ public T textChanged(Object handler, String method) { if (view instanceof TextView) { TextView tv = (TextView) view; Common common = new Common().forward(handler, method, true, TEXT_CHANGE_SIG); tv.addTextChangedListener(common); } return self(); }