@@ -32,6 +32,7 @@ public class DatePickerFragment extends Fragment implements DatePickerDialog.OnD
3232 private CheckBox switchOrientation ;
3333 private CheckBox limitSelectableDays ;
3434 private CheckBox highlightDays ;
35+ private CheckBox defaultSelection ;
3536 private DatePickerDialog dpd ;
3637
3738 public DatePickerFragment () {
@@ -57,6 +58,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
5758 switchOrientation = view .findViewById (R .id .switch_orientation );
5859 limitSelectableDays = view .findViewById (R .id .limit_dates );
5960 highlightDays = view .findViewById (R .id .highlight_dates );
61+ defaultSelection = view .findViewById (R .id .default_selection );
6062
6163 view .findViewById (R .id .original_button ).setOnClickListener (v -> {
6264 Calendar now = Calendar .getInstance ();
@@ -72,6 +74,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
7274 // Show a datepicker when the dateButton is clicked
7375 dateButton .setOnClickListener (v -> {
7476 Calendar now = Calendar .getInstance ();
77+ if (defaultSelection .isChecked ()) {
78+ now .add (Calendar .DATE , 7 );
79+ }
7580 /*
7681 It is recommended to always create a new instance whenever you need to show a Dialog.
7782 The sample app is reusing them because it is useful when looking for regressions
0 commit comments