本文整理汇总了Java中biweekly.component.VAlarm.getTrigger方法的典型用法代码示例。如果您正苦于以下问题:Java VAlarm.getTrigger方法的具体用法?Java VAlarm.getTrigger怎么用?Java VAlarm.getTrigger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类biweekly.component.VAlarm
的用法示例。
在下文中一共展示了VAlarm.getTrigger方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: determineStartDate
import biweekly.component.VAlarm; //导入方法依赖的package包/类
/**
* Determines what the alarm property's start date should be.
* @param valarm the component that is being converted to a vCal alarm
* property
* @param parent the component's parent
* @return the start date or null if it cannot be determined
*/
private static Date determineStartDate(VAlarm valarm, ICalComponent parent) {
Trigger trigger = valarm.getTrigger();
if (trigger == null) {
return null;
}
Date triggerStart = trigger.getDate();
if (triggerStart != null) {
return triggerStart;
}
Duration triggerDuration = trigger.getDuration();
if (triggerDuration == null) {
return null;
}
if (parent == null) {
return null;
}
Related related = trigger.getRelated();
Date date = null;
if (related == Related.START) {
date = ValuedProperty.getValue(parent.getProperty(DateStart.class));
} else if (related == Related.END) {
date = ValuedProperty.getValue(parent.getProperty(DateEnd.class));
if (date == null) {
Date dateStart = ValuedProperty.getValue(parent.getProperty(DateStart.class));
Duration duration = ValuedProperty.getValue(parent.getProperty(DurationProperty.class));
if (duration != null && dateStart != null) {
date = duration.add(dateStart);
}
}
}
return (date == null) ? null : triggerDuration.add(date);
}
示例2: buildReminder
import biweekly.component.VAlarm; //导入方法依赖的package包/类
protected Builder buildReminder(Builder builder, VAlarm alarm) {
int minutes = 0;
if (alarm.getTrigger() != null && alarm.getTrigger().getDuration() != null)
//minutes = duration.getDays() * 24*60 + duration.getHours()*60 + duration.getMinutes();
minutes = (int)(alarm.getTrigger().getDuration().toMillis()/60000);
Log.d(TAG, "Adding alarm " + minutes + " min before");
return builder
.withValue(Reminders.METHOD, Reminders.METHOD_ALERT)
.withValue(Reminders.MINUTES, minutes);
}