1
0
mirror of https://github.com/etesync/android synced 2024-12-23 15:18:14 +00:00

ViewCollection: use the new LocalCalendar.findByName to get calendar.

This commit is contained in:
Tom Hacohen 2017-03-24 14:52:27 +00:00
parent 19ceab96b0
commit 7562a7a76b

View File

@ -29,6 +29,7 @@ import com.etesync.syncadapter.resource.LocalAddressBook;
import com.etesync.syncadapter.resource.LocalCalendar;
import com.etesync.syncadapter.ui.journalviewer.ListEntriesFragment;
import java.io.FileNotFoundException;
import java.util.Locale;
import at.bitfire.ical4android.CalendarStorageException;
@ -77,11 +78,10 @@ public class ViewCollectionActivity extends AppCompatActivity implements Refresh
}
try {
LocalCalendar resource = (LocalCalendar) LocalCalendar.find(account, this.getContentResolver().acquireContentProviderClient(CalendarContract.CONTENT_URI),
LocalCalendar.Factory.INSTANCE, CalendarContract.Calendars.NAME + "=?", new String[]{info.url})[0];
LocalCalendar resource = LocalCalendar.findByName(account, getContentResolver().acquireContentProviderClient(CalendarContract.CONTENT_URI), LocalCalendar.Factory.INSTANCE, info.url);
long count = resource.count();
stats.setText(String.format(Locale.getDefault(), "Events: %d, Journal entries: %d", count, entryCount));
} catch (CalendarStorageException e) {
} catch (FileNotFoundException|CalendarStorageException e) {
e.printStackTrace();
stats.setText("Stats loading error.");
}