1
0
mirror of https://github.com/etesync/android synced 2024-11-16 04:49:06 +00:00

LocalCalendar: Add a function to get calendar by name.

This commit is contained in:
Tom Hacohen 2017-03-23 15:33:31 +00:00
parent ec39aceb1a
commit d98d58360e

View File

@ -83,6 +83,16 @@ public class LocalCalendar extends AndroidCalendar implements LocalCollection {
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) {
ContentValues values = new ContentValues();
values.put(Calendars.NAME, info.url);