本文整理汇总了Java中android.provider.CalendarContract.Reminders类的典型用法代码示例。如果您正苦于以下问题:Java Reminders类的具体用法?Java Reminders怎么用?Java Reminders使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Reminders类属于android.provider.CalendarContract包,在下文中一共展示了Reminders类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onInsertComplete
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
@Override
public void onInsertComplete(int token, Object object, Uri uri)
{
if (uri != null)
{
if (BuildConfig.DEBUG)
Log.d(TAG, "Insert complete " + uri.getLastPathSegment());
switch (token)
{
case EVENT:
long eventID = Long.parseLong(uri.getLastPathSegment());
ContentValues values = new ContentValues();
values.put(Reminders.MINUTES, 10);
values.put(Reminders.EVENT_ID, eventID);
values.put(Reminders.METHOD, Reminders.METHOD_ALERT);
startInsert(REMINDER, null, Reminders.CONTENT_URI, values);
break;
}
}
}
开发者ID:billthefarmer,项目名称:diary,代码行数:22,代码来源:QueryHandler.java
示例2: addExpectedMinutes
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
private void addExpectedMinutes(ArrayList<ContentProviderOperation> expectedOps) {
ContentProviderOperation.Builder b;
mValues = new ContentValues();
mValues.clear();
mValues.put(Reminders.MINUTES, 5);
mValues.put(Reminders.METHOD, Reminders.METHOD_DEFAULT);
mValues.put(Reminders.EVENT_ID, TEST_EVENT_ID);
b = ContentProviderOperation.newInsert(Reminders.CONTENT_URI).withValues(mValues);
expectedOps.add(b.build());
mValues.clear();
mValues.put(Reminders.MINUTES, 10);
mValues.put(Reminders.METHOD, Reminders.METHOD_DEFAULT);
mValues.put(Reminders.EVENT_ID, TEST_EVENT_ID);
b = ContentProviderOperation.newInsert(Reminders.CONTENT_URI).withValues(mValues);
expectedOps.add(b.build());
mValues.clear();
mValues.put(Reminders.MINUTES, 15);
mValues.put(Reminders.METHOD, Reminders.METHOD_DEFAULT);
mValues.put(Reminders.EVENT_ID, TEST_EVENT_ID);
b = ContentProviderOperation.newInsert(Reminders.CONTENT_URI).withValues(mValues);
expectedOps.add(b.build());
}
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:26,代码来源:EditEventHelperTest.java
示例3: addExpectedMinutesWithBackRef
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
private void addExpectedMinutesWithBackRef(ArrayList<ContentProviderOperation> expectedOps) {
ContentProviderOperation.Builder b;
mValues = new ContentValues();
mValues.clear();
mValues.put(Reminders.MINUTES, 5);
mValues.put(Reminders.METHOD, Reminders.METHOD_DEFAULT);
b = ContentProviderOperation.newInsert(Reminders.CONTENT_URI).withValues(mValues);
b.withValueBackReference(Reminders.EVENT_ID, TEST_EVENT_INDEX_ID);
expectedOps.add(b.build());
mValues.clear();
mValues.put(Reminders.MINUTES, 10);
mValues.put(Reminders.METHOD, Reminders.METHOD_DEFAULT);
b = ContentProviderOperation.newInsert(Reminders.CONTENT_URI).withValues(mValues);
b.withValueBackReference(Reminders.EVENT_ID, TEST_EVENT_INDEX_ID);
expectedOps.add(b.build());
mValues.clear();
mValues.put(Reminders.MINUTES, 15);
mValues.put(Reminders.METHOD, Reminders.METHOD_DEFAULT);
b = ContentProviderOperation.newInsert(Reminders.CONTENT_URI).withValues(mValues);
b.withValueBackReference(Reminders.EVENT_ID, TEST_EVENT_INDEX_ID);
expectedOps.add(b.build());
}
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:26,代码来源:EditEventHelperTest.java
示例4: getReminders
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
/** Fetch all the reminders of the specified event,
and put them in a JSONArray.
*/
private JSONArray getReminders(long eventId) {
Cursor c = Reminders.query(
context.getContentResolver(),
eventId,
REMINDER_COLUMNS
);
JSONArray result = Tools.rows2JSONArray(c, REMINDER_COLUMNS);
c.close();
return result;
}
开发者ID:cozy,项目名称:cordova-plugin-calendarsync,代码行数:15,代码来源:EventAccessor.java
示例5: populateReminders
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
void populateReminders(Event e) throws RemoteException {
// reminders
Uri remindersUri = Reminders.CONTENT_URI.buildUpon()
.appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true")
.build();
@Cleanup Cursor c = providerClient.query(remindersUri, new String[]{
/* 0 */ Reminders.MINUTES, Reminders.METHOD
}, Reminders.EVENT_ID + "=?", new String[]{String.valueOf(e.getLocalID())}, null);
while (c != null && c.moveToNext()) {
//Duration duration = new Duration.Builder().prior(true).minutes(c.getInt(0)).build();
Duration duration = new Duration.Builder().minutes(c.getInt(0)).build();
Trigger trigger = new Trigger(duration, Related.START);
VAlarm alarm = VAlarm.display(trigger, e.getSummary());
e.addAlarm(alarm);
}
}
开发者ID:eXfio,项目名称:CucumberSync,代码行数:17,代码来源:LocalCalendar.java
示例6: addDataRows
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
@Override
protected void addDataRows(Resource resource, long localID, int backrefIdx) {
Event event = (Event)resource;
for (Attendee attendee : event.getAttendees())
pendingOperations.add(buildAttendee(newDataInsertBuilder(Attendees.CONTENT_URI, Attendees.EVENT_ID, localID, backrefIdx), attendee).build());
for (VAlarm alarm : event.getAlarms())
pendingOperations.add(buildReminder(newDataInsertBuilder(Reminders.CONTENT_URI, Reminders.EVENT_ID, localID, backrefIdx), alarm).build());
}
开发者ID:eXfio,项目名称:CucumberSync,代码行数:9,代码来源:LocalCalendar.java
示例7: removeDataRows
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
@Override
protected void removeDataRows(Resource resource) {
Event event = (Event)resource;
pendingOperations.add(ContentProviderOperation.newDelete(syncAdapterURI(Attendees.CONTENT_URI))
.withSelection(Attendees.EVENT_ID + "=?",
new String[] { String.valueOf(event.getLocalID()) }).build());
pendingOperations.add(ContentProviderOperation.newDelete(syncAdapterURI(Reminders.CONTENT_URI))
.withSelection(Reminders.EVENT_ID + "=?",
new String[]{String.valueOf(event.getLocalID())}).build());
}
开发者ID:eXfio,项目名称:CucumberSync,代码行数:11,代码来源:LocalCalendar.java
示例8: buildReminder
import android.provider.CalendarContract.Reminders; //导入依赖的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);
}
开发者ID:eXfio,项目名称:CucumberSync,代码行数:14,代码来源:LocalCalendar.java
示例9: saveReminders
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
/**
* Saves the reminders, if they changed. Returns true if operations to
* update the database were added.
*
* @param ops the array of ContentProviderOperations
* @param eventId the id of the event whose reminders are being updated
* @param reminders the array of reminders set by the user
* @param originalReminders the original array of reminders
* @param forceSave if true, then save the reminders even if they didn't change
* @return true if operations to update the database were added
*/
public static boolean saveReminders(ArrayList<ContentProviderOperation> ops, long eventId,
ArrayList<ReminderEntry> reminders, ArrayList<ReminderEntry> originalReminders,
boolean forceSave) {
// If the reminders have not changed, then don't update the database
if (reminders.equals(originalReminders) && !forceSave) {
return false;
}
// Delete all the existing reminders for this event
String where = Reminders.EVENT_ID + "=?";
String[] args = new String[] {Long.toString(eventId)};
ContentProviderOperation.Builder b = ContentProviderOperation
.newDelete(Reminders.CONTENT_URI);
b.withSelection(where, args);
ops.add(b.build());
ContentValues values = new ContentValues();
int len = reminders.size();
// Insert the new reminders, if any
for (int i = 0; i < len; i++) {
ReminderEntry re = reminders.get(i);
values.clear();
values.put(Reminders.MINUTES, re.getMinutes());
values.put(Reminders.METHOD, re.getMethod());
values.put(Reminders.EVENT_ID, eventId);
b = ContentProviderOperation.newInsert(Reminders.CONTENT_URI).withValues(values);
ops.add(b.build());
}
return true;
}
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:44,代码来源:EditEventHelper.java
示例10: saveRemindersWithBackRef
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
/**
* Saves the reminders, if they changed. Returns true if operations to
* update the database were added. Uses a reference id since an id isn't
* created until the row is added.
*
* @param ops the array of ContentProviderOperations
* @param eventId the id of the event whose reminders are being updated
* @param reminderMinutes the array of reminders set by the user
* @param originalMinutes the original array of reminders
* @param forceSave if true, then save the reminders even if they didn't change
* @return true if operations to update the database were added
*/
public static boolean saveRemindersWithBackRef(ArrayList<ContentProviderOperation> ops,
int eventIdIndex, ArrayList<ReminderEntry> reminders,
ArrayList<ReminderEntry> originalReminders, boolean forceSave) {
// If the reminders have not changed, then don't update the database
if (reminders.equals(originalReminders) && !forceSave) {
return false;
}
// Delete all the existing reminders for this event
ContentProviderOperation.Builder b = ContentProviderOperation
.newDelete(Reminders.CONTENT_URI);
b.withSelection(Reminders.EVENT_ID + "=?", new String[1]);
b.withSelectionBackReference(0, eventIdIndex);
ops.add(b.build());
ContentValues values = new ContentValues();
int len = reminders.size();
// Insert the new reminders, if any
for (int i = 0; i < len; i++) {
ReminderEntry re = reminders.get(i);
values.clear();
values.put(Reminders.MINUTES, re.getMinutes());
values.put(Reminders.METHOD, re.getMethod());
b = ContentProviderOperation.newInsert(Reminders.CONTENT_URI).withValues(values);
b.withValueBackReference(Reminders.EVENT_ID, eventIdIndex);
ops.add(b.build());
}
return true;
}
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:44,代码来源:EditEventHelper.java
示例11: equals
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ReminderEntry)) {
return false;
}
ReminderEntry re = (ReminderEntry) obj;
if (re.mMinutes != mMinutes) {
return false;
}
// Treat ALERT and DEFAULT as equivalent. This is useful during the "has anything
// "changed" test, so that if DEFAULT is present, but we don't change anything,
// the internal conversion of DEFAULT to ALERT doesn't force a database update.
return re.mMethod == mMethod ||
(re.mMethod == Reminders.METHOD_DEFAULT && mMethod == Reminders.METHOD_ALERT) ||
(re.mMethod == Reminders.METHOD_ALERT && mMethod == Reminders.METHOD_DEFAULT);
}
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:23,代码来源:CalendarEventModel.java
示例12: addOwnerAttendeeToOps
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
private void addOwnerAttendeeToOps(ArrayList<ContentProviderOperation> expectedOps, int id) {
addOwnerAttendee();
ContentProviderOperation.Builder b;
b = ContentProviderOperation.newInsert(Attendees.CONTENT_URI).withValues(mExpectedValues);
b.withValueBackReference(Reminders.EVENT_ID, id);
expectedOps.add(b.build());
}
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:8,代码来源:EditEventHelperTest.java
示例13: syncReminders
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
protected void syncReminders(DbCalendarSensor event) {
if (event == null) {
return;
}
boolean hasAlarm = event.getHasAlarm();
if (hasAlarm) {
long eventId = event.getEventId();
LongSparseArray<DbCalendarReminderSensor> mapExistingReminders = getExistingReminders(eventId);
// optional reminderSelection
String[] selectionArgs = {String.valueOf(eventId)};
Cursor cur = null;
try {
long deviceId = PreferenceProvider.getInstance(context).getCurrentDeviceId();
cur = contentResolver.query(URI_REMINDER, PROJECTION_REMINDERS, reminderSelection, selectionArgs, null);
if (cur == null || cur.getCount() <= 0) {
return;
}
List<DbCalendarReminderSensor> entriesToInsert = new ArrayList<>(cur.getCount());
String created = DateUtils.dateToISO8601String(new Date(), Locale.getDefault());
// Iterate over event
while (cur.moveToNext() && isRunning()) {
DbCalendarReminderSensor reminder = new DbCalendarReminderSensor();
reminder.setReminderId(getLongByColumnName(cur, Reminders._ID));
reminder.setEventId(eventId);
reminder.setMethod(getIntByColumnName(cur, Reminders.METHOD));
reminder.setMinutes(getIntByColumnName(cur, Reminders.MINUTES));
reminder.setIsNew(Boolean.TRUE);
reminder.setIsDeleted(Boolean.FALSE);
reminder.setIsUpdated(Boolean.TRUE);
reminder.setDeviceId(deviceId);
reminder.setCreated(created);
if (checkForReminderChange(mapExistingReminders, reminder)) {
entriesToInsert.add(reminder);
}
}
if (!entriesToInsert.isEmpty()) {
calendarReminderSensorDao.insert(entriesToInsert);
}
} finally {
if (cur != null) {
cur.close();
}
}
}
}
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:64,代码来源:CalendarSensor.java
示例14: startContentObservers
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
/**
* Initialize the multithread handler manager for ContentObservers and
* initialize the context observers for the sensors
*/
@SuppressLint("NewApi")
public void startContentObservers(){
//Register the sensor handler thread with the handler managers
//Multitasking
thread_multitasking.start();
thread_sensor_multi = new Handler(thread_multitasking.getLooper());
multitask_observer = new MultitaskingObserver(thread_sensor_multi, this);
MultitaskingObserver.lastMultiESM = screenOnTime;
MultitaskingObserver.lastEmailESM = screenOnTime;
//Phone
thread_phone.start();
thread_sensor_phone = new Handler(thread_phone.getLooper());
phone_observer = new VoiceCallObserver(thread_sensor_phone, this);
VoiceCallObserver.lastVoiceESM = screenOnTime;
//Text Messaging
thread_messages.start();
thread_sensor_messages = new Handler(thread_messages.getLooper());
messages_observer = new MessageObserver(thread_sensor_messages, this);
MessageObserver.lastMessageESM = screenOnTime;
//Installations
thread_install.start();
thread_sensor_install = new Handler(thread_install.getLooper());
install_observer = new InstallationsObserver(thread_sensor_install, this);
//ESM
thread_esm.start();
thread_sensor_esm = new Handler(thread_esm.getLooper());
esm_observer = new ESMObserver(thread_sensor_esm, this);
//Calendar
thread_calendar.start();
thread_observer_calendar = new Handler(thread_calendar.getLooper());
calendar_observer = new CalendarObserver(thread_observer_calendar, this);
//Screen
thread_screen.start();
thread_sensor_screen = new Handler(thread_screen.getLooper());
//create a context filter for screen
IntentFilter screenFilter = new IntentFilter();
screenFilter.addAction(Screen.ACTION_AWARE_SCREEN_ON);
screenFilter.addAction(Screen.ACTION_AWARE_SCREEN_OFF);
screenListener = new ScreenObserver(this);
//Create a context filter for Activity
thread_activity.start();
thread_sensor_activity = new Handler(thread_activity.getLooper());
IntentFilter activityFilter = new IntentFilter();
activityFilter.addAction(ActivityObserver.ACTION_AWARE_GOOGLE_ACTIVITY_RECOGNITION);
activityListener = new ActivityObserver(this);
ActivityObserver.lastActivityESM = screenOnTime;
//Ambient noise
thread_ambient_noise.start();
thread_sensor_ambient_noise = new Handler(thread_ambient_noise.getLooper());
ambient_noise_observer = new AmbientNoiseObserver(thread_sensor_ambient_noise, this);
AmbientNoiseObserver.lastAmbientESM = screenOnTime;
//Ask Android to register our context receiver
registerReceiver(screenListener, screenFilter, null, thread_sensor_screen);
registerReceiver(activityListener, activityFilter, null, thread_sensor_activity);
//Start listening to changes on the Applications_Foreground, MoT, and NoiseLevel databases
getContentResolver().registerContentObserver(Applications_Foreground.CONTENT_URI, true, multitask_observer);
getContentResolver().registerContentObserver(Installations_Data.CONTENT_URI, true, install_observer);
getContentResolver().registerContentObserver(AmbientNoise_Data.CONTENT_URI, true, ambient_noise_observer);
getContentResolver().registerContentObserver(Calls_Data.CONTENT_URI, true, phone_observer);
getContentResolver().registerContentObserver(Messages_Data.CONTENT_URI, true, messages_observer);
getContentResolver().registerContentObserver(ESM_Data.CONTENT_URI, true, esm_observer);
getContentResolver().registerContentObserver(Reminders.CONTENT_URI, true, calendar_observer);
}
开发者ID:nischalshrestha,项目名称:mobilesensor,代码行数:78,代码来源:Plugin.java
示例15: run
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
@Override
public void run() {
clearAllEvents();
cal = new GregorianCalendar();
Calendar newCal = new GregorianCalendar();
//Reset at 12:30am
int hourOfDay = cal.get(Calendar.HOUR_OF_DAY);
int minOfDay = cal.get(Calendar.MINUTE);
if(hourOfDay == 0 && minOfDay < 30){
newCal.set(Calendar.HOUR_OF_DAY, 0);
newCal.set(Calendar.MINUTE, 30);
newCal.set(Calendar.SECOND, 0);
} else{
newCal.add(Calendar.DAY_OF_WEEK, 1); //recalculates calendar if at the end
newCal.set(Calendar.HOUR_OF_DAY, 0);
newCal.set(Calendar.MINUTE, 30);
newCal.set(Calendar.SECOND, 0);
}
String[] mSelectionArgs = new String[3];
String mSelection = "DELETED = ? AND hasAlarm = ? AND allDay = ?";
long start = cal.getTimeInMillis(); //current time
long stop = newCal.getTimeInMillis(); //end of day
mSelectionArgs[0] = "0";
mSelectionArgs[1] = "1";
mSelectionArgs[2] = "0";
Cursor calendar = getContentResolver().query(Events.CONTENT_URI, null, mSelection, mSelectionArgs, Events.DTSTART+" ASC");
//Go through and grab all events with reminders with our time constraint
if(calendar != null && calendar.moveToFirst()){
do{
String repeating = calendar.getString(calendar.getColumnIndex("rrule"));
long begin = calendar.getLong(calendar.getColumnIndex(Events.DTSTART));
long end = calendar.getLong(calendar.getColumnIndex(Events.DTEND));
if((repeating == null && begin >= start && end <= stop) || (repeating != null)){
String id = calendar.getString(calendar.getColumnIndex(Events._ID));
String name = calendar.getString(calendar.getColumnIndex(Events.TITLE));
//Filter out deleted instances and grab repeating events
String[] INSTANCE_PROJECTION = new String[] {
Instances.EVENT_ID, // 0
Instances.BEGIN, // 1
Instances.END, // 2
Instances.TITLE // 3
};
String selection = Instances.EVENT_ID + " = ?";
String[] selectionArgs = new String[] {id};
Cursor instances = null;
//Uri for events withing start and stop
Uri.Builder builder = Instances.CONTENT_URI.buildUpon();
ContentUris.appendId(builder, start);
ContentUris.appendId(builder, stop);
instances = getContentResolver().query(builder.build(), INSTANCE_PROJECTION, selection, selectionArgs, null);
if(instances == null || instances.getCount() > 0 && instances.moveToNext()){
//Make sure the instance's begin is after current time (since we didn't check it before)
if(instances.getLong(instances.getColumnIndex((Instances.BEGIN))) >= start){
begin = instances.getLong(instances.getColumnIndex(Instances.BEGIN));
end = instances.getLong(instances.getColumnIndex(Instances.END));
String[] toReturn = {""};
toReturn[0] = ""+id;
int maxReminder = 0;
Cursor reminders = getContentResolver().query(Reminders.CONTENT_URI, null, "event_id = ?", toReturn, null);
if(reminders != null && reminders.moveToLast()){
do{
int rem = reminders.getInt(reminders.getColumnIndex(Reminders.MINUTES)) ;
if(rem > maxReminder)
maxReminder = rem;
}while(reminders.moveToPrevious());
}
if(maxReminder >= 1 && maxReminder <= 60){
CalendarEvent e = new CalendarEvent(id,name,begin,end,maxReminder);
eventList.add(e);
}
}
} if(instances != null && ! instances.isClosed() ) instances.close();
}
}while(calendar.moveToNext());
} if(calendar != null && ! calendar.isClosed() ) calendar.close();
//Run this again when you reach 12:30am either today or the next day
long current = System.currentTimeMillis();
if(eventList.size() > 0)
startCalendarAlarm(0);
thread_calSetup.postDelayed(this, (stop-current));
}
开发者ID:nischalshrestha,项目名称:mobilesensor,代码行数:82,代码来源:Plugin.java
示例16: create
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
@SuppressLint("InlinedApi")
public static void create(Account account, ContentResolver resolver, ServerInfo.ResourceInfo info) throws RemoteException {
ContentProviderClient client = resolver.acquireContentProviderClient(CalendarContract.AUTHORITY);
//FIXME - change default colour
int color = 0xFFC3EA6E; // fallback: "DAVdroid green"
if (info.getColor() != null) {
Pattern p = Pattern.compile("#(\\p{XDigit}{6})(\\p{XDigit}{2})?");
Matcher m = p.matcher(info.getColor());
if (m.find()) {
int color_rgb = Integer.parseInt(m.group(1), 16);
int color_alpha = m.group(2) != null ? (Integer.parseInt(m.group(2), 16) & 0xFF) : 0xFF;
color = (color_alpha << 24) | color_rgb;
}
}
ContentValues values = new ContentValues();
values.put(Calendars.ACCOUNT_NAME, account.name);
values.put(Calendars.ACCOUNT_TYPE, account.type);
values.put(Calendars.NAME, info.getCollection());
values.put(Calendars.CALENDAR_DISPLAY_NAME, info.getTitle());
values.put(Calendars.CALENDAR_COLOR, color);
values.put(Calendars.OWNER_ACCOUNT, account.name);
values.put(Calendars.SYNC_EVENTS, 1);
values.put(Calendars.VISIBLE, 1);
values.put(Calendars.ALLOWED_REMINDERS, Reminders.METHOD_ALERT);
if (info.isReadOnly())
values.put(Calendars.CALENDAR_ACCESS_LEVEL, Calendars.CAL_ACCESS_READ);
else {
values.put(Calendars.CALENDAR_ACCESS_LEVEL, Calendars.CAL_ACCESS_OWNER);
values.put(Calendars.CAN_ORGANIZER_RESPOND, 1);
values.put(Calendars.CAN_MODIFY_TIME_ZONE, 1);
}
if (android.os.Build.VERSION.SDK_INT >= 15) {
values.put(Calendars.ALLOWED_AVAILABILITY, Events.AVAILABILITY_BUSY + "," + Events.AVAILABILITY_FREE + "," + Events.AVAILABILITY_TENTATIVE);
values.put(Calendars.ALLOWED_ATTENDEE_TYPES, Attendees.TYPE_NONE + "," + Attendees.TYPE_OPTIONAL + "," + Attendees.TYPE_REQUIRED + "," + Attendees.TYPE_RESOURCE);
}
if (info.getTimezone() != null)
values.put(Calendars.CALENDAR_TIME_ZONE, info.getTimezone());
Log.i(TAG, "Inserting calendar: " + values.toString() + " -> " + calendarsURI(account).toString());
client.insert(calendarsURI(account), values);
}
开发者ID:eXfio,项目名称:CucumberSync,代码行数:47,代码来源:LocalCalendar.java
示例17: testSaveReminders
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
@Smoke
@SmallTest
public void testSaveReminders() {
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
ArrayList<ContentProviderOperation> expectedOps = new ArrayList<ContentProviderOperation>();
long eventId = TEST_EVENT_ID;
ArrayList<ReminderEntry> reminders = new ArrayList<ReminderEntry>();
ArrayList<ReminderEntry> originalReminders = new ArrayList<ReminderEntry>();
boolean forceSave = true;
boolean result;
mActivity = buildTestContext();
mHelper = new EditEventHelper(mActivity, null);
assertNotNull(mHelper);
// First test forcing a delete with no reminders.
String where = Reminders.EVENT_ID + "=?";
String[] args = new String[] {Long.toString(eventId)};
ContentProviderOperation.Builder b =
ContentProviderOperation.newDelete(Reminders.CONTENT_URI);
b.withSelection(where, args);
expectedOps.add(b.build());
result = mHelper.saveReminders(ops, eventId, reminders, originalReminders, forceSave);
assertTrue(result);
assertEquals(expectedOps, ops);
// Now test calling save with identical reminders and no forcing
reminders.add(ReminderEntry.valueOf(5));
reminders.add(ReminderEntry.valueOf(10));
reminders.add(ReminderEntry.valueOf(15));
originalReminders.add(ReminderEntry.valueOf(5));
originalReminders.add(ReminderEntry.valueOf(10));
originalReminders.add(ReminderEntry.valueOf(15));
forceSave = false;
ops.clear();
// Should fail to create any ops since nothing changed
result = mHelper.saveReminders(ops, eventId, reminders, originalReminders, forceSave);
assertFalse(result);
assertEquals(ops.size(), 0);
//Now test adding a single reminder
originalReminders.remove(2);
addExpectedMinutes(expectedOps);
result = mHelper.saveReminders(ops, eventId, reminders, originalReminders, forceSave);
assertTrue(result);
assertEquals(expectedOps, ops);
}
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:54,代码来源:EditEventHelperTest.java
示例18: testSaveRemindersWithBackRef
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
@Smoke
@SmallTest
public void testSaveRemindersWithBackRef() {
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
ArrayList<ContentProviderOperation> expectedOps = new ArrayList<ContentProviderOperation>();
long eventId = TEST_EVENT_ID;
ArrayList<ReminderEntry> reminders = new ArrayList<ReminderEntry>();
ArrayList<ReminderEntry> originalReminders = new ArrayList<ReminderEntry>();
boolean forceSave = true;
boolean result;
mActivity = buildTestContext();
mHelper = new EditEventHelper(mActivity, null);
assertNotNull(mHelper);
// First test forcing a delete with no reminders.
ContentProviderOperation.Builder b =
ContentProviderOperation.newDelete(Reminders.CONTENT_URI);
b.withSelection(Reminders.EVENT_ID + "=?", new String[1]);
b.withSelectionBackReference(0, TEST_EVENT_INDEX_ID);
expectedOps.add(b.build());
result =
mHelper.saveRemindersWithBackRef(ops, TEST_EVENT_INDEX_ID, reminders,
originalReminders, forceSave);
assertTrue(result);
assertEquals(ops, expectedOps);
// Now test calling save with identical reminders and no forcing
reminders.add(ReminderEntry.valueOf(5));
reminders.add(ReminderEntry.valueOf(10));
reminders.add(ReminderEntry.valueOf(15));
originalReminders.add(ReminderEntry.valueOf(5));
originalReminders.add(ReminderEntry.valueOf(10));
originalReminders.add(ReminderEntry.valueOf(15));
forceSave = false;
ops.clear();
result = mHelper.saveRemindersWithBackRef(ops, ops.size(), reminders, originalReminders,
forceSave);
assertFalse(result);
assertEquals(ops.size(), 0);
//Now test adding a single reminder
originalReminders.remove(2);
addExpectedMinutesWithBackRef(expectedOps);
result = mHelper.saveRemindersWithBackRef(ops, ops.size(), reminders, originalReminders,
forceSave);
assertTrue(result);
assertEquals(ops, expectedOps);
}
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:56,代码来源:EditEventHelperTest.java
示例19: valueOf
import android.provider.CalendarContract.Reminders; //导入依赖的package包/类
/**
* Returns a ReminderEntry, with the specified number of minutes and a default alert method.
*
* @param minutes Number of minutes before the start of the event that the alert will fire.
*/
public static ReminderEntry valueOf(int minutes) {
return valueOf(minutes, Reminders.METHOD_DEFAULT);
}
开发者ID:x7hub,项目名称:Calendar_lunar,代码行数:9,代码来源:CalendarEventModel.java
注:本文中的android.provider.CalendarContract.Reminders类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论