Search in sources :

Example 71 with TextWatcher

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);
            }
        }
    });
}
Also used : TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) EmoticonsFuncView(sj.keyboard.widget.EmoticonsFuncView) ImageView(android.widget.ImageView) View(android.view.View) EmoticonsToolBarView(sj.keyboard.widget.EmoticonsToolBarView) EmoticonsIndicatorView(sj.keyboard.widget.EmoticonsIndicatorView) MotionEvent(android.view.MotionEvent)

Example 72 with TextWatcher

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);
            }
        }
    });
}
Also used : TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) EmoticonsFuncView(sj.keyboard.widget.EmoticonsFuncView) ImageView(android.widget.ImageView) View(android.view.View) EmoticonsToolBarView(sj.keyboard.widget.EmoticonsToolBarView) EmoticonsIndicatorView(sj.keyboard.widget.EmoticonsIndicatorView) MotionEvent(android.view.MotionEvent)

Example 73 with TextWatcher

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);
            }
        }
    });
}
Also used : EditText(android.widget.EditText) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable)

Example 74 with TextWatcher

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;
}
Also used : ViewGroup(android.view.ViewGroup) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) View(android.view.View) WPTextView(org.wordpress.android.widgets.WPTextView) TextView(android.widget.TextView)

Example 75 with TextWatcher

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;
}
Also used : ViewGroup(android.view.ViewGroup) OnClickListener(android.view.View.OnClickListener) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) WPTextView(org.wordpress.android.widgets.WPTextView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) WPTextView(org.wordpress.android.widgets.WPTextView)

Aggregations

TextWatcher (android.text.TextWatcher)192 Editable (android.text.Editable)158 View (android.view.View)96 TextView (android.widget.TextView)75 Paint (android.graphics.Paint)37 ImageView (android.widget.ImageView)30 TextPaint (android.text.TextPaint)28 EditText (android.widget.EditText)28 Intent (android.content.Intent)25 KeyEvent (android.view.KeyEvent)24 AdapterView (android.widget.AdapterView)21 ListView (android.widget.ListView)17 RecyclerView (android.support.v7.widget.RecyclerView)15 DialogInterface (android.content.DialogInterface)13 SuppressLint (android.annotation.SuppressLint)12 OnClickListener (android.view.View.OnClickListener)12 Button (android.widget.Button)12 InputMethodManager (android.view.inputmethod.InputMethodManager)11 AlertDialog (android.app.AlertDialog)10 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)9