Search in sources :

Example 1 with OrgRepeater

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();
}
Also used : OrgDateTime(com.orgzly.org.datetime.OrgDateTime) OrgRepeater(com.orgzly.org.datetime.OrgRepeater)

Example 2 with OrgRepeater

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;
    }
}
Also used : OrgRepeater(com.orgzly.org.datetime.OrgRepeater)

Example 3 with OrgRepeater

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());
}
Also used : OrgRepeater(com.orgzly.org.datetime.OrgRepeater)

Aggregations

OrgRepeater (com.orgzly.org.datetime.OrgRepeater)3 OrgDateTime (com.orgzly.org.datetime.OrgDateTime)1