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:com.magizdev.babyoneday.profilewizard.NameFragment.java

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

    mNameView.addTextChangedListener(new TextWatcher() {
        @Override//from w w w. j av  a2 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(Profile.NAME, (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });

}

From source file:com.example.android.wizardpager.wizard.ui.TextareaFragment.java

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

    mMessageView.addTextChangedListener(new TextWatcher() {
        @Override//from   ww  w.  j  ava  2  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(Page.SIMPLE_DATA_KEY, (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });
}

From source file:com.jaymullen.TrailJournal.wizard.ui.BodyFragment.java

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

    mBodyView.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(BodyPage.BODY_DATA_KEY, (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });
}

From source file:org.odk.collect.android.widgets.StringWidget.java

protected void setupChangeListener() {
    answerText.addTextChangedListener(new TextWatcher() {
        private String oldText = "";

        @Override/*from  w  ww .  ja va2  s.co  m*/
        public void afterTextChanged(Editable s) {
            if (!s.toString().equals(oldText)) {
                Collect.getInstance().getActivityLogger().logInstanceAction(this, "answerTextChanged",
                        s.toString(), getPrompt().getIndex());
            }
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            oldText = s.toString();
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }
    });
}

From source file:com.grarak.kerneladiutor.activities.SecurityActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_security);

    final String password = Utils.decodeString(getIntent().getStringExtra(PASSWORD_INTENT));
    AppCompatEditText editText = (AppCompatEditText) findViewById(R.id.edittext);
    mPasswordWrong = findViewById(R.id.password_wrong);
    editText.addTextChangedListener(new TextWatcher() {
        @Override//from   w  ww  .  j a  v a 2s .  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) {
            if (editable.toString().equals(password)) {
                mPasswordWrong.setVisibility(View.GONE);
                setResult(1);
                finish();
            } else {
                mPasswordWrong.setVisibility(editable.toString().isEmpty() ? View.GONE : View.VISIBLE);
            }
        }
    });

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Prefs.getBoolean("fingerprint", false, this)) {
        mFingerprintManagerCompat = FingerprintManagerCompat.from(this);
        if (mFingerprintManagerCompat.isHardwareDetected()
                && mFingerprintManagerCompat.hasEnrolledFingerprints()
                && getSystemService(KeyguardManager.class).isDeviceSecure()) {
            loadFingerprint();
        }
    }
}

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

private void handleOnShow(final Dialog dialogEditName) {
    final Button positiveButton = ((AlertDialog) dialogEditName).getButton(AlertDialog.BUTTON_POSITIVE);
    positiveButton.setEnabled(false);//from  w w w.  j  a  va  2s .  co m

    EditText dialogEditText = (EditText) dialogEditName.findViewById(R.id.dialog_editor_script_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();
            positiveButton.setEnabled(true);
            for (Script local_script : ProjectManager.getInstance().getCurrentSprite().getScriptList()) {
                if (local_script.getName().equals(variableName)
                        && !local_script.getName().equals(script.getName())) {
                    Toast.makeText(getActivity(), R.string.formula_editor_existing_variable, Toast.LENGTH_SHORT)
                            .show();
                    positiveButton.setEnabled(false);
                }
            }

            if (editable.length() == 0) {
                positiveButton.setEnabled(false);
            }
            if (editable.toString().equals(script.getName())) {
                positiveButton.setEnabled(false);
            }
        }
    });
    dialogEditText.setText(script.getName());

}

From source file:th.in.ffc.building.house.HouseListFragment.java

@Override
public void afterTextChanged(Editable arg0) {

    mHouseFilter = arg0.toString();
    getLoaderManager().restartLoader(0, null, this);

}

From source file:com.cse3310.phms.ui.activities.BaseActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getSupportMenuInflater().inflate(R.menu.overflow_menu, menu);
    getSupportMenuInflater().inflate(R.menu.search_menu, menu);
    // set search field view to switch to after clicking the search icon
    mSearchMenuItem = menu.getItem(SEARCH_ICON).setActionView(R.layout.ab_search_layout);

    mAutoCompTextView = (AutoCompleteTextView) mSearchMenuItem.getActionView()
            .findViewById(R.id.act_search_txt_auto_complete);
    mAutoCompTextView.addTextChangedListener(new TextWatcherAdapter() {
        @Override//from w w  w. j a v  a2s .c  om
        public void afterTextChanged(Editable editable) {
            mSearchWord = editable.toString();
        }
    });
    setUpAutoCompleteTextView();
    return true;
}

From source file:com.jaymullen.TrailJournal.wizard.ui.TitleFragment.java

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

    mTitleView.addTextChangedListener(new TextWatcher() {
        @Override//  www.  ja 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(TitlePage.TITLE_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });
}

From source file:com.jaymullen.TrailJournal.wizard.ui.MilesFragment.java

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

    mMilesView.addTextChangedListener(new TextWatcher() {
        @Override/*from w  ww  .  ja  va2  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(MilesPage.MILES_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });
}