Search in sources :

Example 81 with EditText

use of android.widget.EditText in project weiciyuan by qii.

the class AddFilterDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    final EditText et = new EditText(getActivity());
    builder.setView(et).setTitle(getString(R.string.input_filter_word)).setPositiveButton(getString(R.string.add), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String word = et.getText().toString().trim();
            if (!TextUtils.isEmpty(word)) {
                AbstractFilterFragment filterFragment = (AbstractFilterFragment) getTargetFragment();
                filterFragment.addFilter(word);
            }
        }
    }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    AlertDialog dialog = builder.create();
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    return dialog;
}
Also used : AlertDialog(android.app.AlertDialog) EditText(android.widget.EditText) AbstractFilterFragment(org.qii.weiciyuan.ui.preference.filter.AbstractFilterFragment) DialogInterface(android.content.DialogInterface)

Example 82 with EditText

use of android.widget.EditText in project weiciyuan by qii.

the class FollowTopicDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    final EditText et = new EditText(getActivity());
    et.setHint(getString(R.string.add_topic_hint));
    builder.setView(et).setTitle(getString(R.string.add_topic)).setPositiveButton(getString(R.string.add), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            String word = et.getText().toString().trim();
            if (!TextUtils.isEmpty(word)) {
                UserTopicListFragment userTopicListFragment = (UserTopicListFragment) getTargetFragment();
                userTopicListFragment.addTopic(word);
            }
        }
    }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    AlertDialog dialog = builder.create();
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    return dialog;
}
Also used : AlertDialog(android.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface)

Example 83 with EditText

use of android.widget.EditText in project android-saripaar by ragunathjawahar.

the class RemoveRulesActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_remove_rules);
    // UI References
    mEmailEditText = (EditText) findViewById(R.id.emailEditText);
    mAddQuickRuleRadioButton = (RadioButton) findViewById(R.id.addQuickRuleRadioButton);
    mRemoveRulesRadioButton = (RadioButton) findViewById(R.id.removeRulesRadioButton);
    mResultTextView = (TextView) findViewById(R.id.resultTextView);
    mSaripaarButton = (Button) findViewById(R.id.saripaarButton);
    // Validator
    mValidator = new Validator(this);
    // Event listeners
    mSaripaarButton.setOnClickListener(this);
    mValidator.setValidationListener(this);
    mAddQuickRuleRadioButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mValidator.put(mEmailEditText, new QuickRule<EditText>() {

                @Override
                public boolean isValid(EditText editText) {
                    String email = editText.getText().toString();
                    return email.endsWith("mobsandgeeks.com");
                }

                @Override
                public String getMessage(Context context) {
                    return "Only allow emails from \"mobsandgeeks.com\" :P";
                }
            });
        }
    });
    mRemoveRulesRadioButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mValidator.removeRules(mEmailEditText);
        }
    });
}
Also used : QuickRule(com.mobsandgeeks.saripaar.QuickRule) EditText(android.widget.EditText) Context(android.content.Context) Validator(com.mobsandgeeks.saripaar.Validator) CompoundButton(android.widget.CompoundButton)

Example 84 with EditText

use of android.widget.EditText in project robolectric by robolectric.

the class ShadowAlertDialogTest method shouldSetView.

@Test
public void shouldSetView() throws Exception {
    AlertDialog.Builder builder = new AlertDialog.Builder(application);
    EditText view = new EditText(application);
    builder.setView(view);
    AlertDialog alert = builder.create();
    assertThat(shadowOf(alert).getView()).isEqualTo(view);
}
Also used : AlertDialog(android.app.AlertDialog) EditText(android.widget.EditText) Test(org.junit.Test)

Example 85 with EditText

use of android.widget.EditText in project robolectric by robolectric.

the class ShadowEditTextTest method whenInitializingWithoutAttributeSet_thenTextLengthShouldHaveNoRestrictions.

@Test
public void whenInitializingWithoutAttributeSet_thenTextLengthShouldHaveNoRestrictions() {
    EditText editText = new EditText(RuntimeEnvironment.application);
    String input = anyString();
    editText.setText(input);
    assertThat(editText.getText().toString()).isEqualTo(input);
}
Also used : EditText(android.widget.EditText) Test(org.junit.Test)

Aggregations

EditText (android.widget.EditText)655 View (android.view.View)309 TextView (android.widget.TextView)220 DialogInterface (android.content.DialogInterface)143 AlertDialog (android.app.AlertDialog)126 Button (android.widget.Button)126 Intent (android.content.Intent)99 LinearLayout (android.widget.LinearLayout)79 ImageView (android.widget.ImageView)61 AlertDialog (android.support.v7.app.AlertDialog)54 ScrollView (android.widget.ScrollView)52 LayoutInflater (android.view.LayoutInflater)48 AdapterView (android.widget.AdapterView)46 ViewGroup (android.view.ViewGroup)42 Editable (android.text.Editable)41 Context (android.content.Context)40 RecyclerView (android.support.v7.widget.RecyclerView)40 ListView (android.widget.ListView)39 Dialog (android.app.Dialog)36 Bundle (android.os.Bundle)36