use of android.widget.Button in project android-betterpickers by code-troopers.
the class TimePickerDialogFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.time_picker_dialog, container, false);
Button doneButton = (Button) view.findViewById(R.id.done_button);
Button cancelButton = (Button) view.findViewById(R.id.cancel_button);
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
cancelButton.setTextColor(mTextColor);
doneButton.setTextColor(mTextColor);
doneButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
for (TimePickerDialogHandler handler : mTimePickerDialogHandlers) {
handler.onDialogTimeSet(mReference, mPicker.getHours(), mPicker.getMinutes());
}
final Activity activity = getActivity();
final Fragment fragment = getTargetFragment();
if (activity instanceof TimePickerDialogHandler) {
final TimePickerDialogHandler act = (TimePickerDialogHandler) activity;
act.onDialogTimeSet(mReference, mPicker.getHours(), mPicker.getMinutes());
} else if (fragment instanceof TimePickerDialogHandler) {
final TimePickerDialogHandler frag = (TimePickerDialogHandler) fragment;
frag.onDialogTimeSet(mReference, mPicker.getHours(), mPicker.getMinutes());
}
dismiss();
}
});
mPicker = (TimePicker) view.findViewById(R.id.time_picker);
mPicker.setSetButton(doneButton);
mPicker.setTheme(mTheme);
getDialog().getWindow().setBackgroundDrawableResource(mDialogBackgroundResId);
return view;
}
use of android.widget.Button in project android-betterpickers by code-troopers.
the class SampleHmsThemeLight method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.text_and_button);
mResultTextView = (TextView) findViewById(R.id.text);
Button button = (Button) findViewById(R.id.button);
mResultTextView.setText(R.string.no_value);
button.setText(R.string.hms_picker_set);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
HmsPickerBuilder hpb = new HmsPickerBuilder().setFragmentManager(getSupportFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment_Light);
hpb.show();
}
});
}
use of android.widget.Button in project android-betterpickers by code-troopers.
the class SampleNumberBasicUsage method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.text_and_button);
mResultTextView = (TextView) findViewById(R.id.text);
Button button = (Button) findViewById(R.id.button);
mResultTextView.setText(R.string.no_value);
button.setText(R.string.number_picker_set);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NumberPickerBuilder npb = new NumberPickerBuilder().setFragmentManager(getSupportFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment);
npb.show();
}
});
}
use of android.widget.Button in project android-betterpickers by code-troopers.
the class SampleNumberMaxValue method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.text_and_button);
mResultTextView = (TextView) findViewById(R.id.text);
Button button = (Button) findViewById(R.id.button);
final BigDecimal maxNumberAllowed = new BigDecimal("1227");
mResultTextView.setText(R.string.no_value);
button.setText("Set Number below " + maxNumberAllowed);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NumberPickerBuilder npb = new NumberPickerBuilder().setFragmentManager(getSupportFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment).setMaxNumber(maxNumberAllowed);
npb.show();
}
});
}
use of android.widget.Button in project android-betterpickers by code-troopers.
the class SampleNumberMinValue method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.text_and_button);
mResultTextView = (TextView) findViewById(R.id.text);
Button button = (Button) findViewById(R.id.button);
final BigDecimal minNumberAllowed = new BigDecimal("1227");
mResultTextView.setText(R.string.no_value);
button.setText("Set Number above " + minNumberAllowed);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NumberPickerBuilder npb = new NumberPickerBuilder().setFragmentManager(getSupportFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment).setMinNumber(minNumberAllowed);
npb.show();
}
});
}
Aggregations