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;
}
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;
}
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);
}
});
}
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);
}
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);
}
Aggregations