mirror of
https://github.com/etesync/android
synced 2025-06-16 13:09:05 +00:00
LocalCalendar: Add a function to get calendar by name.
This commit is contained in:
parent
ec39aceb1a
commit
d98d58360e
@ -83,6 +83,16 @@ public class LocalCalendar extends AndroidCalendar implements LocalCollection {
|
|||||||
update(valuesFromCollectionInfo(info, updateColor));
|
update(valuesFromCollectionInfo(info, updateColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static LocalCalendar findByName(Account account, ContentProviderClient provider, AndroidCalendarFactory factory, String name) throws FileNotFoundException, CalendarStorageException {
|
||||||
|
AndroidCalendar ret[] = LocalCalendar.find(account, provider, factory, Calendars.NAME + "==?", new String[]{name});
|
||||||
|
if (ret.length == 1) {
|
||||||
|
return (LocalCalendar) ret[0];
|
||||||
|
} else {
|
||||||
|
App.log.severe("No calendar found for name " + name);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static ContentValues valuesFromCollectionInfo(CollectionInfo info, boolean withColor) {
|
private static ContentValues valuesFromCollectionInfo(CollectionInfo info, boolean withColor) {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(Calendars.NAME, info.url);
|
values.put(Calendars.NAME, info.url);
|
||||||
|
Loading…
Reference in New Issue
Block a user