use of android.widget.NumberPicker in project Talon-for-Twitter by klinker24.
the class ConfigurePagerActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
case R.id.menu_select_number_of_pages:
final NumberPicker picker = new NumberPicker(context);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
picker.setLayoutParams(params);
picker.setMaxValue(TimelinePagerAdapter.MAX_EXTRA_PAGES);
picker.setMinValue(0);
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.menu_number_of_pages);
builder.setView(picker);
builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
sharedPrefs.edit().putInt("number_of_extra_pages", picker.getValue()).commit();
dialog.dismiss();
recreate();
}
});
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.create().show();
return true;
default:
return true;
}
}
use of android.widget.NumberPicker in project collect by opendatakit.
the class NumberPickerDialog method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.number_picker_dialog, null);
final NumberPicker numberPicker = view.findViewById(R.id.number_picker);
numberPicker.setMaxValue(((String[]) getArguments().getSerializable(DISPLAYED_VALUES)).length - 1);
numberPicker.setMinValue(0);
numberPicker.setWrapSelectorWheel(false);
numberPicker.setDisplayedValues((String[]) getArguments().getSerializable(DISPLAYED_VALUES));
numberPicker.setValue(((String[]) getArguments().getSerializable(DISPLAYED_VALUES)).length - 1 - getArguments().getInt(PROGRESS));
return new MaterialAlertDialogBuilder(getActivity()).setTitle(R.string.number_picker_title).setView(view).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
listener.onNumberPickerValueSelected(getArguments().getInt(WIDGET_ID), numberPicker.getValue());
}
}).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
}).create();
}
use of android.widget.NumberPicker in project xDrip by NightscoutFoundation.
the class EditAlertActivity method setDefaultSnoozeSpinner.
public void setDefaultSnoozeSpinner(int defaultSnooze) {
editSnooze.setText(String.valueOf(defaultSnooze));
editSnooze.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View mView, MotionEvent mMotionEvent) {
if (mMotionEvent.getAction() == MotionEvent.ACTION_DOWN) {
final Dialog d = new Dialog(mContext);
d.setTitle("Default Snooze");
d.setContentView(R.layout.snooze_picker);
Button b1 = (Button) d.findViewById(R.id.button1);
Button b2 = (Button) d.findViewById(R.id.button2);
final NumberPicker snoozeValue = (NumberPicker) d.findViewById(R.id.numberPicker1);
int defaultSnooze = safeGetDefaultSnooze();
SnoozeActivity.SetSnoozePickerValues(snoozeValue, above, defaultSnooze);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int defaultSnooze = SnoozeActivity.getTimeFromSnoozeValue(snoozeValue.getValue());
editSnooze.setText(String.valueOf(defaultSnooze));
d.dismiss();
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
d.dismiss();
}
});
d.show();
}
return false;
}
});
}
use of android.widget.NumberPicker in project xDrip-plus by jamorham.
the class EditAlertActivity method setPreSnoozeSpinner.
public void setPreSnoozeSpinner() {
buttonPreSnooze.setOnClickListener(new View.OnClickListener() {
@Override
public // public boolean onTouch(View mView, MotionEvent mMotionEvent) {
void onClick(View v) {
final Dialog d = new Dialog(mContext);
d.setTitle("Snooze this alert...");
d.setContentView(R.layout.snooze_picker);
Button b1 = (Button) d.findViewById(R.id.button1);
Button b2 = (Button) d.findViewById(R.id.button2);
b1.setText("pre-Snooze");
final NumberPicker snoozeValue = (NumberPicker) d.findViewById(R.id.numberPicker1);
int defaultSnooze = safeGetDefaultSnooze();
SnoozeActivity.SetSnoozePickerValues(snoozeValue, above, defaultSnooze);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int intValue = SnoozeActivity.getTimeFromSnoozeValue(snoozeValue.getValue());
AlertPlayer.getPlayer().PreSnooze(getApplicationContext(), uuid, intValue);
d.dismiss();
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
d.dismiss();
}
});
d.show();
}
});
}
use of android.widget.NumberPicker in project xDrip by NightscoutFoundation.
the class EditAlertActivity method setPreSnoozeSpinner.
public void setPreSnoozeSpinner() {
buttonPreSnooze.setOnClickListener(new View.OnClickListener() {
@Override
public // public boolean onTouch(View mView, MotionEvent mMotionEvent) {
void onClick(View v) {
final Dialog d = new Dialog(mContext);
d.setTitle("Snooze this alert...");
d.setContentView(R.layout.snooze_picker);
Button b1 = (Button) d.findViewById(R.id.button1);
Button b2 = (Button) d.findViewById(R.id.button2);
b1.setText("pre-Snooze");
final NumberPicker snoozeValue = (NumberPicker) d.findViewById(R.id.numberPicker1);
int defaultSnooze = safeGetDefaultSnooze();
SnoozeActivity.SetSnoozePickerValues(snoozeValue, above, defaultSnooze);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int intValue = SnoozeActivity.getTimeFromSnoozeValue(snoozeValue.getValue());
AlertPlayer.getPlayer().PreSnooze(getApplicationContext(), uuid, intValue);
d.dismiss();
}
});
b2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
d.dismiss();
}
});
d.show();
}
});
}
Aggregations