use of android.text.TextWatcher in project XhsEmoticonsKeyboard by w446108264.
the class QqEmoticonsKeyBoard method initEditView.
protected void initEditView() {
etChat.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (!etChat.isFocused()) {
etChat.setFocusable(true);
etChat.setFocusableInTouchMode(true);
}
return false;
}
});
etChat.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 (!TextUtils.isEmpty(s)) {
btnSend.setBackgroundResource(R.drawable.btn_send_bg);
} else {
btnSend.setBackgroundResource(R.drawable.btn_send_bg_disable);
}
}
});
}
use of android.text.TextWatcher in project XhsEmoticonsKeyboard by w446108264.
the class XhsEmoticonsKeyBoard method initEditView.
protected void initEditView() {
mEtChat.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (!mEtChat.isFocused()) {
mEtChat.setFocusable(true);
mEtChat.setFocusableInTouchMode(true);
}
return false;
}
});
mEtChat.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 (!TextUtils.isEmpty(s)) {
mBtnSend.setVisibility(VISIBLE);
mBtnMultimedia.setVisibility(GONE);
mBtnSend.setBackgroundResource(com.keyboard.view.R.drawable.btn_send_bg);
} else {
mBtnMultimedia.setVisibility(VISIBLE);
mBtnSend.setVisibility(GONE);
}
}
});
}
use of android.text.TextWatcher in project WordPress-Android by wordpress-mobile.
the class EditCommentActivity method configureViews.
private void configureViews() {
final EditText editContent = (EditText) this.findViewById(R.id.edit_comment_content);
editContent.setText(mComment.getContent());
// show error when comment content is empty
editContent.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) {
boolean hasError = (editContent.getError() != null);
boolean hasText = (s != null && s.length() > 0);
if (!hasText && !hasError) {
editContent.setError(getString(R.string.content_required));
} else if (hasText && hasError) {
editContent.setError(null);
}
}
});
}
use of android.text.TextWatcher in project WordPress-Android by wordpress-mobile.
the class NewBlogFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout containing a title and body text.
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.create_blog_fragment, container, false);
mSignupButton = (WPTextView) rootView.findViewById(R.id.signup_button);
mSignupButton.setOnClickListener(mSignupClickListener);
mSignupButton.setEnabled(false);
mCancelButton = (WPTextView) rootView.findViewById(R.id.cancel_button);
mCancelButton.setOnClickListener(mCancelClickListener);
mProgressTextSignIn = (WPTextView) rootView.findViewById(R.id.nux_sign_in_progress_text);
mProgressBarSignIn = (RelativeLayout) rootView.findViewById(R.id.nux_sign_in_progress_bar);
mSiteUrlTextField = (EditText) rootView.findViewById(R.id.site_url);
mSiteUrlTextField.setOnKeyListener(mSiteUrlKeyListener);
mSiteUrlTextField.setOnEditorActionListener(mEditorAction);
mSiteUrlTextField.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) {
checkIfFieldsFilled();
}
@Override
public void afterTextChanged(Editable editable) {
lowerCaseEditable(editable);
}
});
mSiteTitleTextField = (EditText) rootView.findViewById(R.id.site_title);
mSiteTitleTextField.addTextChangedListener(this);
mSiteTitleTextField.addTextChangedListener(mSiteTitleWatcher);
mSiteTitleTextField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
mAutoCompleteUrl = EditTextUtils.getText(mSiteTitleTextField).equals(EditTextUtils.getText(mSiteUrlTextField)) || EditTextUtils.isEmpty(mSiteUrlTextField);
}
}
});
return rootView;
}
use of android.text.TextWatcher in project WordPress-Android by wordpress-mobile.
the class NewUserFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout containing a title and body text.
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.new_account_user_fragment_screen, container, false);
WPTextView termsOfServiceTextView = (WPTextView) rootView.findViewById(R.id.l_agree_terms_of_service);
termsOfServiceTextView.setText(Html.fromHtml(String.format(getString(R.string.agree_terms_of_service), "<u>", "</u>")));
termsOfServiceTextView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.openUrlExternal(getContext(), getString(R.string.wordpresscom_tos_url));
}
});
mSignupButton = (WPTextView) rootView.findViewById(R.id.signup_button);
mSignupButton.setOnClickListener(mSignupClickListener);
mSignupButton.setEnabled(false);
mProgressTextSignIn = (WPTextView) rootView.findViewById(R.id.nux_sign_in_progress_text);
mProgressBarSignIn = (RelativeLayout) rootView.findViewById(R.id.nux_sign_in_progress_bar);
mEmailTextField = (EditText) rootView.findViewById(R.id.email_address);
mEmailTextField.setText(UserEmailUtils.getPrimaryEmail(getActivity()));
mEmailTextField.setSelection(EditTextUtils.getText(mEmailTextField).length());
mPasswordTextField = (EditText) rootView.findViewById(R.id.password);
mUsernameTextField = (EditText) rootView.findViewById(R.id.username);
mSiteUrlTextField = (EditText) rootView.findViewById(R.id.site_url);
mEmailTextField.addTextChangedListener(this);
mPasswordTextField.addTextChangedListener(this);
mUsernameTextField.addTextChangedListener(this);
mSiteUrlTextField.setOnKeyListener(mSiteUrlKeyListener);
mSiteUrlTextField.setOnEditorActionListener(mEditorAction);
mSiteUrlTextField.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) {
checkIfFieldsFilled();
}
@Override
public void afterTextChanged(Editable editable) {
lowerCaseEditable(editable);
}
});
mUsernameTextField.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) {
// auto fill blog address
mSiteUrlTextField.setError(null);
if (mAutoCompleteUrl) {
mSiteUrlTextField.setText(EditTextUtils.getText(mUsernameTextField));
}
}
@Override
public void afterTextChanged(Editable editable) {
lowerCaseEditable(editable);
}
});
mUsernameTextField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
mAutoCompleteUrl = EditTextUtils.getText(mUsernameTextField).equals(EditTextUtils.getText(mSiteUrlTextField)) || EditTextUtils.isEmpty(mSiteUrlTextField);
}
}
});
mEmailTextField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
autocorrectEmail();
}
}
});
initPasswordVisibilityButton(rootView, mPasswordTextField);
initInfoButton(rootView);
return rootView;
}
Aggregations