use of android.widget.EditText in project EventBus by greenrobot.
the class TestSetupActivity method startClick.
public void startClick(View v) {
TestParams params = new TestParams();
Spinner spinnerThread = (Spinner) findViewById(R.id.spinnerThread);
String threadModeStr = spinnerThread.getSelectedItem().toString();
ThreadMode threadMode = ThreadMode.valueOf(threadModeStr);
params.setThreadMode(threadMode);
params.setEventInheritance(((CheckBox) findViewById(R.id.checkBoxEventBusEventHierarchy)).isChecked());
params.setIgnoreGeneratedIndex(((CheckBox) findViewById(R.id.checkBoxEventBusIgnoreGeneratedIndex)).isChecked());
EditText editTextEvent = (EditText) findViewById(R.id.editTextEvent);
params.setEventCount(Integer.parseInt(editTextEvent.getText().toString()));
EditText editTextSubscriber = (EditText) findViewById(R.id.editTextSubscribe);
params.setSubscriberCount(Integer.parseInt(editTextSubscriber.getText().toString()));
Spinner spinnerTestToRun = (Spinner) findViewById(R.id.spinnerTestToRun);
int testPos = spinnerTestToRun.getSelectedItemPosition();
params.setTestNumber(testPos + 1);
ArrayList<Class<? extends Test>> testClasses = initTestClasses(testPos);
params.setTestClasses(testClasses);
Intent intent = new Intent();
intent.setClass(this, TestRunnerActivity.class);
intent.putExtra("params", params);
startActivity(intent);
}
use of android.widget.EditText in project android-topeka by googlesamples.
the class TextInputQuizView method createEditText.
protected final EditText createEditText() {
EditText editText = (EditText) getLayoutInflater().inflate(R.layout.quiz_edit_text, this, false);
editText.addTextChangedListener(this);
editText.setOnEditorActionListener(this);
return editText;
}
use of android.widget.EditText in project android-maps-utils by googlemaps.
the class HeatmapsPlacesDemoActivity method startDemo.
@Override
protected void startDemo() {
EditText editText = (EditText) findViewById(R.id.input_text);
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_GO) {
submit();
handled = true;
}
return handled;
}
});
mCheckboxLayout = (LinearLayout) findViewById(R.id.checkboxes);
setUpMap();
}
use of android.widget.EditText in project flexbox-layout by google.
the class FlexItemEditFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_flex_item_edit, container, false);
getDialog().setTitle(String.valueOf(mFlexItem.index + 1));
final TextInputLayout orderTextInput = (TextInputLayout) view.findViewById(R.id.input_layout_order);
EditText orderEdit = (EditText) view.findViewById(R.id.edit_text_order);
orderEdit.setText(String.valueOf(mFlexItem.order));
orderEdit.addTextChangedListener(new FlexEditTextWatcher(orderTextInput, new IntegerInputValidator(), R.string.must_be_integer));
final TextInputLayout flexGrowInput = (TextInputLayout) view.findViewById(R.id.input_layout_flex_grow);
final EditText flexGrowEdit = (EditText) view.findViewById(R.id.edit_text_flex_grow);
flexGrowEdit.setText(String.valueOf(mFlexItem.flexGrow));
flexGrowEdit.addTextChangedListener(new FlexEditTextWatcher(flexGrowInput, new NonNegativeDecimalInputValidator(), R.string.must_be_non_negative_float));
final TextInputLayout flexShrinkInput = (TextInputLayout) view.findViewById(R.id.input_layout_flex_shrink);
EditText flexShrinkEdit = (EditText) view.findViewById(R.id.edit_text_flex_shrink);
flexShrinkEdit.setText(String.valueOf(mFlexItem.flexShrink));
flexShrinkEdit.addTextChangedListener(new FlexEditTextWatcher(flexShrinkInput, new NonNegativeDecimalInputValidator(), R.string.must_be_non_negative_float));
final TextInputLayout flexBasisPercentInput = (TextInputLayout) view.findViewById(R.id.input_layout_flex_basis_percent);
EditText flexBasisPercentEdit = (EditText) view.findViewById(R.id.edit_text_flex_basis_percent);
if (mFlexItem.flexBasisPercent != FlexboxLayout.LayoutParams.FLEX_BASIS_PERCENT_DEFAULT) {
flexBasisPercentEdit.setText(String.valueOf(Math.round(mFlexItem.flexBasisPercent * 100)));
} else {
flexBasisPercentEdit.setText(String.valueOf((int) mFlexItem.flexBasisPercent));
}
flexBasisPercentEdit.addTextChangedListener(new FlexEditTextWatcher(flexBasisPercentInput, new FlexBasisPercentInputValidator(), R.string.must_be_minus_one_or_non_negative_integer));
final TextInputLayout widthInput = (TextInputLayout) view.findViewById(R.id.input_layout_width);
EditText widthEdit = (EditText) view.findViewById(R.id.edit_text_width);
widthEdit.setText(String.valueOf(mFlexItem.width));
widthEdit.addTextChangedListener(new FlexEditTextWatcher(widthInput, new DimensionInputValidator(), R.string.must_be_minus_one_or_minus_two_or_non_negative_integer));
final TextInputLayout heightInput = (TextInputLayout) view.findViewById(R.id.input_layout_height);
EditText heightEdit = (EditText) view.findViewById(R.id.edit_text_height);
heightEdit.setText(String.valueOf(mFlexItem.height));
heightEdit.addTextChangedListener(new FlexEditTextWatcher(heightInput, new DimensionInputValidator(), R.string.must_be_minus_one_or_minus_two_or_non_negative_integer));
final TextInputLayout minWidthInput = (TextInputLayout) view.findViewById(R.id.input_layout_min_width);
EditText minWidthEdit = (EditText) view.findViewById(R.id.edit_text_min_width);
minWidthEdit.setText(String.valueOf(mFlexItem.minWidth));
minWidthEdit.addTextChangedListener(new FlexEditTextWatcher(minWidthInput, new FixedDimensionInputValidator(), R.string.must_be_non_negative_integer));
final TextInputLayout minHeightInput = (TextInputLayout) view.findViewById(R.id.input_layout_min_height);
EditText minHeightEdit = (EditText) view.findViewById(R.id.edit_text_min_height);
minHeightEdit.setText(String.valueOf(mFlexItem.minHeight));
minHeightEdit.addTextChangedListener(new FlexEditTextWatcher(minHeightInput, new FixedDimensionInputValidator(), R.string.must_be_non_negative_integer));
final TextInputLayout maxWidthInput = (TextInputLayout) view.findViewById(R.id.input_layout_max_width);
EditText maxWidthEdit = (EditText) view.findViewById(R.id.edit_text_max_width);
maxWidthEdit.setText(String.valueOf(mFlexItem.maxWidth));
maxWidthEdit.addTextChangedListener(new FlexEditTextWatcher(maxWidthInput, new FixedDimensionInputValidator(), R.string.must_be_non_negative_integer));
final TextInputLayout maxHeightInput = (TextInputLayout) view.findViewById(R.id.input_layout_max_height);
EditText maxHeightEdit = (EditText) view.findViewById(R.id.edit_text_max_height);
maxHeightEdit.setText(String.valueOf(mFlexItem.maxHeight));
maxHeightEdit.addTextChangedListener(new FlexEditTextWatcher(maxHeightInput, new FixedDimensionInputValidator(), R.string.must_be_non_negative_integer));
setNextFocusesOnEnterDown(orderEdit, flexGrowEdit, flexShrinkEdit, flexBasisPercentEdit, widthEdit, heightEdit, minWidthEdit, minHeightEdit, maxWidthEdit, maxHeightEdit);
Spinner alignSelfSpinner = (Spinner) view.findViewById(R.id.spinner_align_self);
ArrayAdapter<CharSequence> arrayAdapter = ArrayAdapter.createFromResource(getActivity(), R.array.array_align_self, R.layout.spinner_item);
alignSelfSpinner.setAdapter(arrayAdapter);
alignSelfSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String selected = parent.getItemAtPosition(position).toString();
if (selected.equals(ALIGN_SELF_AUTO)) {
mFlexItem.alignSelf = FlexboxLayout.LayoutParams.ALIGN_SELF_AUTO;
} else if (selected.equals(ALIGN_SELF_FLEX_START)) {
mFlexItem.alignSelf = FlexboxLayout.LayoutParams.ALIGN_SELF_FLEX_START;
} else if (selected.equals(ALIGN_SELF_FLEX_END)) {
mFlexItem.alignSelf = FlexboxLayout.LayoutParams.ALIGN_SELF_FLEX_END;
} else if (selected.equals(ALIGN_SELF_CENTER)) {
mFlexItem.alignSelf = FlexboxLayout.LayoutParams.ALIGN_SELF_CENTER;
} else if (selected.equals(ALIGN_SELF_BASELINE)) {
mFlexItem.alignSelf = FlexboxLayout.LayoutParams.ALIGN_SELF_BASELINE;
} else if (selected.equals(ALIGN_SELF_STRETCH)) {
mFlexItem.alignSelf = FlexboxLayout.LayoutParams.ALIGN_SELF_STRETCH;
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
// No op
}
});
CheckBox wrapBeforeCheckBox = (CheckBox) view.findViewById(R.id.checkbox_wrap_before);
wrapBeforeCheckBox.setChecked(mFlexItem.wrapBefore);
wrapBeforeCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mFlexItem.wrapBefore = isChecked;
}
});
int alignSelfPosition = arrayAdapter.getPosition(alignSelfAsString(mFlexItem.alignSelf));
alignSelfSpinner.setSelection(alignSelfPosition);
view.findViewById(R.id.button_cancel).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
final Button okButton = (Button) view.findViewById(R.id.button_ok);
okButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (orderTextInput.isErrorEnabled() || flexGrowInput.isErrorEnabled() || flexBasisPercentInput.isErrorEnabled() || widthInput.isErrorEnabled() || heightInput.isErrorEnabled() || minWidthInput.isErrorEnabled() || minHeightInput.isErrorEnabled() || maxWidthInput.isErrorEnabled() || maxHeightInput.isErrorEnabled()) {
Toast.makeText(getActivity(), R.string.invalid_values_exist, Toast.LENGTH_SHORT).show();
return;
}
if (mFlexItemChangedListener != null) {
mFlexItemChangedListener.onFlexItemChanged(mFlexItem);
}
dismiss();
}
});
return view;
}
use of android.widget.EditText in project newsrob by marianokamp.
the class ArticleViewHelper method showShareWithNoteDialog.
private static void showShareWithNoteDialog(final Context context, final EntryManager entryManager, final Entry selectedEntry) {
final LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(LinearLayout.VERTICAL);
linearLayout.setPadding(5, 5, 5, 5);
final TextView noteLabel = new TextView(context);
noteLabel.setText("Note");
noteLabel.setTextColor(context.getResources().getColor(android.R.color.primary_text_dark));
linearLayout.addView(noteLabel);
final EditText noteEntry = new EditText(context);
noteEntry.setLines(2);
noteEntry.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
linearLayout.addView(noteEntry);
final LinearLayout shareNoteContainer = new LinearLayout(context);
final CheckBox shareNoteCheckBox = new CheckBox(context);
shareNoteCheckBox.setChecked(true);
shareNoteContainer.addView(shareNoteCheckBox);
final TextView shareLabel = new TextView(context);
shareLabel.setText("Also share the new note");
shareLabel.setTextColor(context.getResources().getColor(android.R.color.primary_text_dark));
shareNoteContainer.addView(shareLabel);
linearLayout.addView(shareNoteContainer);
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Share With Note").setView(linearLayout).setCancelable(true);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, final int which) {
selectedEntry.setNote(noteEntry.getText().toString().trim());
selectedEntry.setShouldNoteBeShared(shareNoteCheckBox.isChecked());
entryManager.update(selectedEntry);
entryManager.fireModelUpdated();
}
});
builder.setNegativeButton(android.R.string.cancel, null);
// .getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
builder.show();
}
Aggregations