Example usage for android.text Editable toString

List of usage examples for android.text Editable toString

Introduction

In this page you can find the example usage for android.text Editable toString.

Prototype

public String toString();

Source Link

Document

Returns a string containing the characters in this sequence in the same order as this sequence.

Usage

From source file:fr.nover.yana.assistant_installation.wizard.ui.IPAdressInfoFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    mIPAdressView.addTextChangedListener(new TextWatcher() {
        @Override//ww  w . j  a  v a2  s  .  c o m
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            mPage.getData().putString(IPAdressInfoPage.IPADRESS_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });
}

From source file:pl.arnea.footballadventuremanager.wizardpager.wizard.ui.CustomerInfoFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    mNameView.addTextChangedListener(new TextWatcher() {
        @Override/*from  ww  w . j a va 2 s.c  om*/
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            mPage.getData().putString(CustomerInfoPage.NAME_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });

}

From source file:com.app.blockydemo.ui.dialogs.NewVariableDialog.java

private void handleOnShow(final Dialog dialogNewVariable) {
    final Button positiveButton = ((AlertDialog) dialogNewVariable).getButton(AlertDialog.BUTTON_POSITIVE);
    positiveButton.setEnabled(false);//w  w  w. ja v a  2  s .  c om

    EditText dialogEditText = (EditText) dialogNewVariable
            .findViewById(R.id.dialog_formula_editor_variable_name_edit_text);

    InputMethodManager inputMethodManager = (InputMethodManager) getActivity()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.showSoftInput(dialogEditText, InputMethodManager.SHOW_IMPLICIT);

    dialogEditText.addTextChangedListener(new TextWatcher() {

        @Override
        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 editable) {

            String variableName = editable.toString();
            if (ProjectManager.getInstance().getCurrentProject().getUserVariables()
                    .getUserVariable(variableName, ProjectManager.getInstance().getCurrentSprite()) != null) {

                Toast.makeText(getActivity(), R.string.formula_editor_existing_variable, Toast.LENGTH_SHORT)
                        .show();

                positiveButton.setEnabled(false);
            } else {
                positiveButton.setEnabled(true);
            }

            if (editable.length() == 0) {
                positiveButton.setEnabled(false);
            }
        }
    });
}

From source file:com.example.flashcards.wizardpager.wizard.ui.HandInputFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    mFirstView.addTextChangedListener(new TextWatcher() {
        @Override/*from  w  w  w  . j  a  v a2  s  .  c  o m*/
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            mPage.getData().putString(HandInputWordPage.FIRST, (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });

    mSecondView.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            mPage.getData().putString(HandInputWordPage.SECOND,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });
}

From source file:net.i2p.android.wizard.ui.I2PB64DestinationFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    mFieldView.addTextChangedListener(new TextWatcher() {
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }/*from  ww w .ja  va 2 s .c  om*/

        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        public void afterTextChanged(Editable editable) {
            mPage.getData().putString(Page.SIMPLE_DATA_KEY, (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
            if (mPage.showFeedback()) {
                mFeedbackView.setText(mPage.getFeedback());
            }
        }
    });
}

From source file:com.fatelon.partyphotobooth.kiosk.KioskSetupFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    final KioskActivity activity = (KioskActivity) getActivity();

    /*//from w w  w . j av a2s. c om
     * Initialize and set key event handlers.
     */
    mKeyEventHandler = new KioskActivity.KeyEventHandler() {
        @Override
        public boolean onKeyEvent(KeyEvent event) {
            mPassword.dispatchKeyEvent(event);
            return true;
        }
    };
    activity.setKeyEventHandler(mKeyEventHandler);

    mOkButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // Get password.
            String passwordString = null;
            Editable password = mPassword.getText();
            if (password != null) {
                passwordString = password.toString();
            }

            // Call to client.
            ICallbacks callbacks = getCallbacks();
            if (callbacks != null) {
                callbacks.onKioskSetupComplete(passwordString);
            }
        }
    });
}

From source file:com.learnit.LearnIt.activities.EditWord.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    removeActionBarLabelIfNeeded();//from   w  w  w.j  av  a2  s.c  o m
    dbHelper = FactoryDbHelper.createDbHelper(this, DBHelper.DB_WORDS);
    utils = new Utils();
    oldWord = getIntent().getStringExtra(WORD_TAG);
    String translation = dbHelper.getTranslation(oldWord);
    Log.d(LOG_TAG, "got word to edit = " + oldWord + ", trans = " + translation);

    setContentView(R.layout.edit_word);

    edtWord = (EditText) findViewById(R.id.edtWord);
    edtTrans = (EditText) findViewById(R.id.edtTrans);
    edtWord.setText(oldWord);
    edtTrans.setText(translation);

    btnClearWord = (ImageButton) findViewById(R.id.btn_add_word_clear);
    btnClearTrans = (ImageButton) findViewById(R.id.btn_add_trans_clear);
    MyBtnTouchListener myBtnTouchListener = new MyBtnTouchListener();
    btnClearTrans.setOnClickListener(myBtnTouchListener);
    btnClearWord.setOnClickListener(myBtnTouchListener);

    edtWord.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (editable.toString() != null && !editable.toString().equals("")) {
                btnClearWord.setVisibility(View.VISIBLE);
            }
            if (editable.length() == 0) {
                btnClearWord.setVisibility(View.INVISIBLE);
            }
        }
    });
    edtTrans.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (editable.toString() != null && !editable.toString().equals("")) {
                btnClearTrans.setVisibility(View.VISIBLE);
            }
            if (editable.length() == 0) {
                btnClearTrans.setVisibility(View.INVISIBLE);
            }
        }
    });
}

From source file:org.sufficientlysecure.keychain.ui.CreateKeyInputFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.create_key_input_fragment, container, false);

    mNameEdit = (AutoCompleteTextView) view.findViewById(R.id.create_key_name);
    mEmailEdit = (AutoCompleteTextView) view.findViewById(R.id.create_key_email);
    mPassphraseEdit = (EditText) view.findViewById(R.id.create_key_passphrase);
    mPassphraseEditAgain = (EditText) view.findViewById(R.id.create_key_passphrase_again);
    mCreateButton = view.findViewById(R.id.create_key_button);

    // initial values
    String name = getArguments().getString(ARG_NAME);
    String email = getArguments().getString(ARG_EMAIL);
    mNameEdit.setText(name);/*  ww  w . j  a va2 s.com*/
    mEmailEdit.setText(email);

    // focus non-empty edit fields
    if (name != null && email != null) {
        mPassphraseEdit.requestFocus();
    } else if (name != null) {
        mEmailEdit.requestFocus();
    }

    mEmailEdit.setThreshold(1); // Start working from first character
    mEmailEdit.setAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_dropdown_item,
            ContactHelper.getPossibleUserEmails(getActivity())));
    mEmailEdit.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            String email = editable.toString();
            if (email.length() > 0) {
                Matcher emailMatcher = Patterns.EMAIL_ADDRESS.matcher(email);
                if (emailMatcher.matches()) {
                    mEmailEdit.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.uid_mail_ok, 0);
                } else {
                    mEmailEdit.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.uid_mail_bad, 0);
                }
            } else {
                // remove drawable if email is empty
                mEmailEdit.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
            }
        }
    });

    mNameEdit.setThreshold(1); // Start working from first character
    mNameEdit.setAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_dropdown_item,
            ContactHelper.getPossibleUserNames(getActivity())));

    mCreateButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            createKeyCheck();
        }
    });

    return view;
}

From source file:co.juliansuarez.libwizardpager.wizard.ui.CustomerInfoFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    mNameView.addTextChangedListener(new TextWatcher() {
        @Override//  w w  w  .  java2  s.co  m
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            mPage.getData().putString(CustomerInfoPage.NAME_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });

    mEmailView.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            mPage.getData().putString(CustomerInfoPage.EMAIL_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });
}

From source file:com.djkim.slap.selectionModel.EnterTextFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    mNameView.addTextChangedListener(new TextWatcher() {
        @Override/*from w  ww . j a v  a 2s.  c  om*/
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            mPage.getData().putString(EnterTextPage.NAME_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });
    /*
            mEmailView.addTextChangedListener(new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence charSequence, int i, int i1,
            int i2) {
    }
            
    @Override
    public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
    }
            
    @Override
    public void afterTextChanged(Editable editable) {
        mPage.getData().putString(EnterTextPage.EMAIL_DATA_KEY,
                (editable != null) ? editable.toString() : null);
        mPage.notifyDataChanged();
    }
            });*/
}