use of com.orgzly.org.datetime.OrgRepeater in project orgzly-android by orgzly.
the class TimestampDialogFragment method getCurrentOrgTime.
private OrgDateTime getCurrentOrgTime() {
OrgDateTime.Builder builder = new OrgDateTime.Builder().setIsActive(true).setYear(mCurrentYear).setMonth(mCurrentMonth).setHasTime(mIsTimeUsed.isChecked()).setDay(mCurrentDay).setHour(mCurrentHour).setMinute(mCurrentMinute);
if (mIsRepeaterUsed.isChecked()) {
OrgRepeater repeater = OrgRepeater.parse(mRepeaterPicker.getText().toString());
builder.setHasRepeater(true);
builder.setRepeater(repeater);
}
return builder.build();
}
use of com.orgzly.org.datetime.OrgRepeater in project orgzly-android by orgzly.
the class RepeaterPickerDialog method onClick.
@Override
public void onClick(DialogInterface dialog, int which) {
switch(which) {
case BUTTON_POSITIVE:
if (mRepeaterSetCallback != null) {
OrgRepeater repeater = getRepeaterFromViews();
mRepeaterSetCallback.onRepeaterSet(repeater);
}
break;
case BUTTON_NEGATIVE:
cancel();
break;
}
}
use of com.orgzly.org.datetime.OrgRepeater in project orgzly-android by orgzly.
the class RepeaterPickerDialog method setViewsFromString.
private void setViewsFromString(String repeaterValue) {
OrgRepeater repeater = OrgRepeater.parse(repeaterValue);
mRepeaterType.setValue(repeater.getType().ordinal());
/* Increase the maximum if needed. */
if (mRepeaterValue.getMaxValue() < repeater.getValue()) {
mRepeaterValue.setMaxValue(repeater.getValue());
/* Has to be called after setting minimum and maximum values,
* per http://stackoverflow.com/a/21065844
*/
mRepeaterValue.setWrapSelectorWheel(false);
}
mRepeaterValue.setValue(repeater.getValue());
mRepeaterUnit.setValue(repeater.getUnit().ordinal());
updateRepeaterDescription(mRepeaterType.getValue());
}
Aggregations