mirror of
https://github.com/etesync/android
synced 2025-01-22 13:40:55 +00:00
Check for null values of Events.ORIGINAL_ALL_DAY (should fix #551)
* fix indentation
This commit is contained in:
parent
654af1eec5
commit
c8cfbd6b07
@ -473,19 +473,19 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
||||
Address address = new Address();
|
||||
address.setLabel(row.getAsString(StructuredPostal.FORMATTED_ADDRESS));
|
||||
if (row.containsKey(StructuredPostal.TYPE))
|
||||
switch (row.getAsInteger(StructuredPostal.TYPE)) {
|
||||
case StructuredPostal.TYPE_HOME:
|
||||
address.addType(AddressType.HOME);
|
||||
break;
|
||||
case StructuredPostal.TYPE_WORK:
|
||||
address.addType(AddressType.WORK);
|
||||
break;
|
||||
case StructuredPostal.TYPE_CUSTOM:
|
||||
String customType = row.getAsString(StructuredPostal.LABEL);
|
||||
if (StringUtils.isNotEmpty(customType))
|
||||
address.addType(AddressType.get(labelToXName(customType)));
|
||||
break;
|
||||
}
|
||||
switch (row.getAsInteger(StructuredPostal.TYPE)) {
|
||||
case StructuredPostal.TYPE_HOME:
|
||||
address.addType(AddressType.HOME);
|
||||
break;
|
||||
case StructuredPostal.TYPE_WORK:
|
||||
address.addType(AddressType.WORK);
|
||||
break;
|
||||
case StructuredPostal.TYPE_CUSTOM:
|
||||
String customType = row.getAsString(StructuredPostal.LABEL);
|
||||
if (StringUtils.isNotEmpty(customType))
|
||||
address.addType(AddressType.get(labelToXName(customType)));
|
||||
break;
|
||||
}
|
||||
address.setStreetAddress(row.getAsString(StructuredPostal.STREET));
|
||||
address.setPoBox(row.getAsString(StructuredPostal.POBOX));
|
||||
address.setExtendedAddress(row.getAsString(StructuredPostal.NEIGHBORHOOD));
|
||||
@ -566,9 +566,9 @@ public class LocalAddressBook extends LocalCollection<Contact> {
|
||||
protected void populateRelation(Contact c, ContentValues row) throws RemoteException {
|
||||
String name = row.getAsString(Relation.NAME);
|
||||
|
||||
// don't process empty relations
|
||||
if (StringUtils.isEmpty(name))
|
||||
return;
|
||||
// don't process empty relations
|
||||
if (StringUtils.isEmpty(name))
|
||||
return;
|
||||
|
||||
// find relation by name or create new one
|
||||
Related related = null;
|
||||
|
@ -165,7 +165,7 @@ public class LocalCalendar extends LocalCollection<Event> {
|
||||
LinkedList<LocalCalendar> calendars = new LinkedList<>();
|
||||
while (cursor != null && cursor.moveToNext())
|
||||
calendars.add(new LocalCalendar(account, providerClient, cursor.getInt(0), cursor.getString(1)));
|
||||
return calendars.toArray(new LocalCalendar[0]);
|
||||
return calendars.toArray(new LocalCalendar[calendars.size()]);
|
||||
}
|
||||
|
||||
public LocalCalendar(Account account, ContentProviderClient providerClient, long id, String url) throws RemoteException {
|
||||
@ -331,7 +331,7 @@ public class LocalCalendar extends LocalCollection<Event> {
|
||||
final long tsStart = values.getAsLong(Events.DTSTART);
|
||||
final String duration = values.getAsString(Events.DURATION);
|
||||
|
||||
String tzId = null;
|
||||
String tzId;
|
||||
Long tsEnd = values.getAsLong(Events.DTEND);
|
||||
if (allDay) {
|
||||
e.setDtStart(tsStart, null);
|
||||
@ -389,7 +389,11 @@ public class LocalCalendar extends LocalCollection<Event> {
|
||||
if (values.containsKey(Events.ORIGINAL_INSTANCE_TIME)) {
|
||||
// this event is an exception of a recurring event
|
||||
long originalInstanceTime = values.getAsLong(Events.ORIGINAL_INSTANCE_TIME);
|
||||
boolean originalAllDay = values.getAsInteger(Events.ORIGINAL_ALL_DAY) != 0;
|
||||
|
||||
boolean originalAllDay = false;
|
||||
if (values.containsKey(Events.ORIGINAL_ALL_DAY))
|
||||
originalAllDay = values.getAsInteger(Events.ORIGINAL_ALL_DAY) != 0;
|
||||
|
||||
Date originalDate = originalAllDay ?
|
||||
new Date(originalInstanceTime) :
|
||||
new DateTime(originalInstanceTime);
|
||||
@ -747,7 +751,7 @@ public class LocalCalendar extends LocalCollection<Event> {
|
||||
*/
|
||||
static String recurrenceSetsToAndroidString(List<? extends DateListProperty> dates) {
|
||||
String tzID = null;
|
||||
List<String> strDates = new LinkedList<String>();
|
||||
List<String> strDates = new LinkedList<>();
|
||||
|
||||
for (DateListProperty dateList : dates) {
|
||||
if (dateList.getTimeZone() != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user