Skip to content

Commit

Permalink
Added new option ShowPickerAfterRecurrencePicker
Browse files Browse the repository at this point in the history
- added new option to set if the date/time picker should be shown after
the recurrencepicker
  • Loading branch information
chrisonline committed Jan 17, 2017
1 parent 3297076 commit 18a1d65
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ public class SublimePicker extends FrameLayout
// Keeps the start date / time if only RecurrencePicker is used
private Calendar startDateTime;

private boolean mShowPickerAfterRecurrencePicker;

// Listener for recurrence picker
private final SublimeRecurrencePicker.OnRepeatOptionSetListener mRepeatOptionSetListener = new SublimeRecurrencePicker.OnRepeatOptionSetListener() {
@Override
Expand All @@ -121,7 +123,8 @@ public void onRepeatOptionSet(SublimeRecurrencePicker.RecurrenceOption option, S

@Override
public void onDone() {
if (mDatePickerEnabled || mTimePickerEnabled) {
if (mShowPickerAfterRecurrencePicker &&
(mDatePickerEnabled || mTimePickerEnabled)) {
updateCurrentPicker();
updateDisplay();
} else { /* No other picker is activated. Dismiss. */
Expand Down Expand Up @@ -572,6 +575,7 @@ private void processOptions() {
mDatePickerEnabled = mOptions.isDatePickerActive();
mTimePickerEnabled = mOptions.isTimePickerActive();
mRecurrencePickerEnabled = mOptions.isRecurrencePickerActive();
mShowPickerAfterRecurrencePicker = mOptions.getShowPickerAfterRecurrencePicker();

if (mDatePickerEnabled) {
//int[] dateParams = mOptions.getDateParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public enum Picker {DATE_PICKER, TIME_PICKER, REPEAT_OPTION_PICKER, INVALID}
private long mMinDate = Long.MIN_VALUE, mMaxDate = Long.MIN_VALUE;
private boolean mAnimateLayoutChanges, mIs24HourView;
private int mFirstDayOfWeek = Calendar.SUNDAY;
private boolean mShowPickerAfterRecurrencePicker = true;

private SublimeRecurrencePicker.RecurrenceOption mRecurrenceOption
= SublimeRecurrencePicker.RecurrenceOption.DOES_NOT_REPEAT;
Expand Down Expand Up @@ -221,6 +222,22 @@ public SublimeOptions setRecurrenceParams(SublimeRecurrencePicker.RecurrenceOpti
return this;
}

/**
* set if the date or time picker should be shown after close of the recurrence picker
* @param mShowPickerAfterRecurrencePicker <code>false</code> if it should not be shown
*/
public void setShowPickerAfterRecurrencePicker(boolean mShowPickerAfterRecurrencePicker) {
this.mShowPickerAfterRecurrencePicker = mShowPickerAfterRecurrencePicker;
}

/**
* get if the date / time picker should be shown after the recurrence picker
* @return true or false
*/
public boolean getShowPickerAfterRecurrencePicker() {
return mShowPickerAfterRecurrencePicker;
}

@SuppressWarnings("unused")
public String getRecurrenceRule() {
return mRecurrenceRule == null ?
Expand Down

0 comments on commit 18a1d65

Please sign in to comment.