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.fatelon.partyphotobooth.kiosk.KioskPasswordDialogFragment.java

@SuppressLint("NewApi")
@Override/*from w  w  w  .  ja  v  a2  s .com*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder dialogBuilder = null;
    Activity activity = getActivity();

    // AlertDialog.THEME_DEVICE_DEFAULT_LIGHT only available in ICS and above.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        dialogBuilder = new AlertDialog.Builder(activity, AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        dialogBuilder = new AlertDialog.Builder(activity);
    }

    // Inflate EditText for entering the password.
    final EditText passwordView = (EditText) LayoutInflater.from(activity).inflate(R.layout.view_password,
            null);

    return dialogBuilder.setTitle(R.string.kiosk_mode__dialog_title).setView(passwordView)
            .setPositiveButton(R.string.kiosk_mode__dialog_button_positive_text,
                    new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int whichButton) {
                            KioskActivity activity = (KioskActivity) getActivity();
                            if (activity != null) {
                                Editable password = passwordView.getText();
                                KioskModeHelper helper = new KioskModeHelper(activity);
                                if (passwordView != null && helper.verifyPassword(password.toString())) {
                                    activity.exitKioskMode();
                                } else {
                                    Toast.makeText(activity, getString(R.string.kiosk_mode__error_password),
                                            Toast.LENGTH_SHORT).show();
                                }
                            }
                        }
                    })
            .setNegativeButton(R.string.kiosk_mode__dialog_button_negative_text, null).create();
}

From source file:th.in.ffc.app.FFCSearchListDialog.java

@Override
public void afterTextChanged(Editable s) {
    mFilter = s.toString();
    getLoaderManager().restartLoader(0, null, this);
}

From source file:org.rm3l.ddwrt.tiles.admin.nvram.EditNVRAMKeyValueDialogFragment.java

@Override
public void onStart() {
    super.onStart(); //super.onStart() is where dialog.show() is actually called on the underlying dialog, so we have to do it after this point

    final AlertDialog d = (AlertDialog) getDialog();
    if (d != null) {

        ((TextView) d.findViewById(R.id.tile_admin_nvram_edit_key)).setText(this.mKey);
        final EditText valueEditText = (EditText) d.findViewById(R.id.tile_admin_nvram_edit_value);
        valueEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override//w  ww  .j  a  v a2s .c  o m
            public void onFocusChange(View v, boolean hasFocus) {
                ((TextView) d.findViewById(R.id.tile_admin_nvram_edit_value_textview)).setTypeface(null,
                        hasFocus ? Typeface.BOLD_ITALIC : Typeface.NORMAL);
            }
        });
        valueEditText.setText(this.mValue, TextView.BufferType.EDITABLE);

        d.getButton(Dialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //Validate data
                final EditText editText = (EditText) d.findViewById(R.id.tile_admin_nvram_edit_value);
                final Editable newValue = editText.getText();

                if (mValue != null && StringUtils.equals(newValue.toString(), mValue.toString())) {
                    //Crouton
                    Crouton.makeText(getActivity(), "No change", ALERT,
                            (ViewGroup) (d.findViewById(R.id.tile_admin_nvram_edit_notification_viewgroup)))
                            .show();
                    editText.requestFocus();
                    //Open Keyboard
                    final InputMethodManager imm = (InputMethodManager) getActivity()
                            .getSystemService(Context.INPUT_METHOD_SERVICE);
                    if (imm != null) {
                        // only will trigger it if no physical keyboard is open
                        imm.showSoftInput(editText, 0);
                    }
                    return;
                }

                final CharSequence variableKey = ((TextView) d.findViewById(R.id.tile_admin_nvram_edit_key))
                        .getText();

                final Bundle token = new Bundle();
                token.putInt(POSITION, mPosition);
                token.putCharSequence(VALUE, newValue);
                token.putCharSequence(KEY, variableKey);

                //nvram set data changed
                new UndoBarController.UndoBar(getSherlockActivity())
                        .message(String.format("Variable '%s' will be updated", variableKey))
                        .listener(nvramDataRecyclerViewAdapter).token(token).show();

                d.cancel();
            }
        });
    }
}

From source file:fr.nover.yana.assistant_installation.wizard.ui.CustomerInfoFragment.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  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(CustomerInfoPage.NAME_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });

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

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

From source file:com.lastsoft.plog.wizard.ui.CustomerInfoFragment.java

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

    mNameView.addTextChangedListener(new TextWatcher() {
        @Override/* w  w w .  ja v  a 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(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();
        }
    });

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

From source file:org.totschnig.myexpenses.dialog.ExportDialogFragment.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override//from ww  w.j  a  va2 s.  com
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Activity ctx = (Activity) getActivity();
    Context wrappedCtx = DialogUtils.wrapContext1(ctx);
    Bundle args = getArguments();
    Long accountId = args != null ? args.getLong("accountId") : null;
    boolean allP = false;
    String warningText;
    if (accountId == null) {
        allP = true;
        warningText = getString(R.string.warning_reset_account_all);
    } else if (accountId < 0L) {
        allP = true;
        AggregateAccount aa = AggregateAccount.getCachedInstance(accountId);
        if (aa == null)
            throw new DataObjectNotFoundException(accountId);
        warningText = getString(R.string.warning_reset_account_all, " (" + aa.currency.getCurrencyCode() + ")");
    } else {
        warningText = getString(R.string.warning_reset_account);
    }
    LayoutInflater li = LayoutInflater.from(wrappedCtx);
    View view = li.inflate(R.layout.export_dialog, null);
    dateFormatET = (EditText) view.findViewById(R.id.date_format);
    String dateFormatDefault = ((SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT)).toPattern();
    String dateFormat = MyApplication.getInstance().getSettings().getString(PREFKEY_EXPORT_DATE_FORMAT, "");
    if (dateFormat.equals(""))
        dateFormat = dateFormatDefault;
    else {
        try {
            new SimpleDateFormat(dateFormat, Locale.US);
        } catch (IllegalArgumentException e) {
            dateFormat = dateFormatDefault;
        }
    }
    dateFormatET.setText(dateFormat);
    dateFormatET.addTextChangedListener(new TextWatcher() {
        public void afterTextChanged(Editable s) {
            try {
                new SimpleDateFormat(s.toString(), Locale.US);
                mDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);
            } catch (IllegalArgumentException e) {
                dateFormatET.setError(getString(R.string.date_format_illegal));
                mDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
            }
        }

        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }
    });
    notYetExportedCB = (CheckBox) view.findViewById(R.id.export_not_yet_exported);
    deleteCB = (CheckBox) view.findViewById(R.id.export_delete);
    warningTV = (TextView) view.findViewById(R.id.warning_reset);
    formatRB = (RadioButton) view.findViewById(R.id.csv);
    String format = MyApplication.getInstance().getSettings().getString(MyApplication.PREFKEY_EXPORT_FORMAT,
            "QIF");
    boolean deleteP = true;
    if (format.equals("CSV"))
        (formatRB).setChecked(true);
    deleteCB.setOnClickListener(this);
    if (Account.getHasExported(accountId)) {
        deleteP = false;
        deleteCB.setChecked(false);
        notYetExportedCB.setChecked(true);
        notYetExportedCB.setVisibility(View.VISIBLE);
    }
    warningTV.setText(warningText);
    if (deleteP)
        warningTV.setVisibility(View.VISIBLE);
    else
        warningTV.setVisibility(View.GONE);
    AlertDialog.Builder builder = new AlertDialog.Builder(wrappedCtx)
            .setTitle(allP ? R.string.menu_reset_all : R.string.menu_reset).setView(view)
            .setPositiveButton(android.R.string.ok, this).setNegativeButton(android.R.string.cancel, null);
    if (Build.VERSION.SDK_INT < 11)
        builder.setIcon(android.R.drawable.ic_dialog_alert);
    else
        builder.setIconAttribute(android.R.attr.alertDialogIcon);
    mDialog = builder.create();
    return mDialog;
}

From source file:com.justplay1.shoppist.features.goods.add.AddGoodsDialogFragment.java

@Override
public void init(View view) {
    super.init(view);
    TextView categoryLabel = (TextView) view.findViewById(R.id.category_label);
    categoryLabel.setTextColor(preferences.getColorPrimary());
    TextView unitsLabel = (TextView) view.findViewById(R.id.units_label);
    unitsLabel.setTextColor(preferences.getColorPrimary());

    nameEdit = (MaterialEditText) view.findViewById(R.id.goods_name);
    nameEdit.setPrimaryColor(preferences.getColorPrimary());
    nameEdit.setFloatingLabelTextSize(getResources().getDimensionPixelSize(R.dimen.edit_label_text_size));
    nameEdit.addTextChangedListener(new AbstractTextWatcher() {
        @Override/*w  w w . j av  a 2 s . com*/
        public void afterTextChanged(Editable s) {
            presenter.setName(ShoppistUtils.filterSpace(s.toString()));
        }
    });

    initCategoryList(view);
    initUnitList(view);
}

From source file:com.example.com.benasque2014.mercurio.HorasInfoFragment.java

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

    mHoraInicioView.addTextChangedListener(new TextWatcher() {
        @Override/*from  w w  w.  j  a  v  a  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(HorasInfoPage.HORA_INICIO_DATA_KEY,
                    (editable != null) ? editable.toString() : null);

            mPage.notifyDataChanged();
        }
    });

    mHoraFinView.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(HorasInfoPage.HORA_FIN_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });

    mFrecuenciaView.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(HorasInfoPage.FRECUENCIA_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });
}

From source file:com.example.com.benasque2014.mercurio.RecorridoBasicInfoFragment.java

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

    mNameView.addTextChangedListener(new TextWatcher() {
        @Override/*  www  .j  a  va2 s. com*/
        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(RecorridoBasicInfoPage.NAME_DATA_KEY,
                    (editable != null) ? editable.toString() : null);

            mPage.notifyDataChanged();
        }
    });

    mCodigoView.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(RecorridoBasicInfoPage.CODIGO_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });

    mClassView.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(RecorridoBasicInfoPage.CLASE_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });
}

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

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

    mIPView.addTextChangedListener(new TextWatcher() {
        @Override/*  ww w.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) {
            mPage.getData().putString(IPAdress_ExtInfoPage.IPADRESS_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });

    mSSIDView.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(IPAdress_ExtInfoPage.SSID_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });

    mLiensView.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(IPAdress_ExtInfoPage.IPADRESS_EXT_DATA_KEY,
                    (editable != null) ? editable.toString() : null);
            mPage.notifyDataChanged();
        }
    });
}