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:cn.newgxu.android.bbs.ui.TopicFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    if (this.sendReply != null) {
        Editable text = this.sendReply.getText();
        if (text != null) {
            outState.putString(REPLY_CONTENT, text.toString());
        }//w  ww.j  a  v a2s. c  o  m
    }
    super.onSaveInstanceState(outState);
}

From source file:org.catnut.plugin.zhihu.ZhihuItemsFragment.java

@Override
public void afterTextChanged(Editable s) {
    String keywords = s.toString().trim();
    if (keywords.length() > 0) {
        if (mSearchAdapter == null) {
            initSearchLoader();/*  w ww.j  a  v  a 2s  .  c om*/
        }
        Bundle args = new Bundle();
        args.putString(Constants.KEYWORDS, keywords);
        getLoaderManager().restartLoader(1, args, mSearchLoader);
        mClear.setVisibility(View.VISIBLE);
    } else {
        mClear.setVisibility(View.GONE);
    }
}

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

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

    mNameView.addTextChangedListener(new TextWatcher() {
        @Override//  w  w w  .  j  a  v a 2s .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(ProfessorContactInfoPage.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(ProfessorContactInfoPage.EMAIL_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });

    mPhoneView.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(ProfessorContactInfoPage.PHONE_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });
}

From source file:de.dmxcontrol.fragment.PanelSelectorFragment.java

private void updateEntitySelection(Editable et) {
    String s = et.toString();

    if (mActiveInputType == ACTIVE_INPUT_TYPE_DEVICE) {
        mEntitySelection.parse(Type.DEVICE, s);
    } else {//w ww. ja  v  a2s. c o  m
        mEntitySelection.parse(Type.GROUP, s);
    }
}

From source file:com.sharpcart.android.wizardpager.wizard.ui.CustomerInfoFragment.java

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

    mPasswordView.addTextChangedListener(new TextWatcher() {
        @Override//from  w w w.j  ava2s. c  om
        public void beforeTextChanged(final CharSequence charSequence, final int i, final int i1,
                final int i2) {
        }

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

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

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

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

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

    mZipCodeView.addTextChangedListener(new TextWatcher() {

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

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

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

From source file:com.magizdev.babyoneday.profilewizard.BirthDataFragment.java

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

    mHeightView.addTextChangedListener(new TextWatcher() {
        @Override/* w w  w . ja  va 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) {
            float height = 0;
            try {
                height = Float.parseFloat(editable.toString());
            } catch (Exception e) {
            }
            mPage.getData().putFloat(Profile.HEIGHT, (editable != null) ? height : 0);
            mPage.notifyDataChanged();
        }
    });

    mWeightView.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
            // TODO Auto-generated method stub

        }

        @Override
        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
            // TODO Auto-generated method stub

        }

        @Override
        public void afterTextChanged(Editable arg0) {
            float weight = 0;
            try {
                weight = Float.parseFloat(arg0.toString());
            } catch (Exception e) {

            }
            mPage.getData().putFloat(Profile.WEIGHT, (arg0 != null) ? weight : 0);
            mPage.notifyDataChanged();
        }
    });
}

From source file:com.guidewithme.ArticleInfoListFragment.java

@Override
public void afterTextChanged(Editable s) {
    search(s.toString());
}

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

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

    mStartingLocation.addTextChangedListener(new TextWatcher() {
        @Override//from w w  w  . j a  v  a 2  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(LocationPage.START_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });

    mEndingLocation.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(LocationPage.DESTINATION_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });
}

From source file:com.permutassep.presentation.view.wizard.ui.ProfessorContactInfoFragment.java

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

    mNameView.addTextChangedListener(new TextWatcher() {
        @Override/*from  w  w w.  j  a  v a  2 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(ProfessorContactInfoPage.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(ProfessorContactInfoPage.EMAIL_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });

    mPhoneView.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(ProfessorContactInfoPage.PHONE_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });

    UserModel user = PrefUtils.getUser(getActivity());

    if (user != null) {
        mNameView.setText(!TextUtils.isEmpty(user.getName()) ? user.getName() : "");
        mNameView.setFocusable(!TextUtils.isEmpty(user.getName()));

        mEmailView.setText(!TextUtils.isEmpty(user.getEmail()) ? user.getEmail() : "");
        mEmailView.setFocusable(!TextUtils.isEmpty(user.getEmail()));

        mPhoneView.setText(!TextUtils.isEmpty(user.getPhone()) ? user.getPhone() : "");
        mPhoneView.setFocusable(!TextUtils.isEmpty(user.getPhone()));
    }
}