mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 07:01:05 +00:00
Calendar column indices
This commit is contained in:
parent
8045834c14
commit
5c3082e145
2 changed files with 15 additions and 7 deletions
|
@ -75,13 +75,19 @@ public class FragmentDialogCalendar extends FragmentDialogBase {
|
|||
null,
|
||||
CalendarContract.Calendars.ACCOUNT_NAME)) {
|
||||
|
||||
int colId = cursor.getColumnIndexOrThrow(CalendarContract.Calendars._ID);
|
||||
int colAccount = cursor.getColumnIndexOrThrow(CalendarContract.Calendars.ACCOUNT_NAME);
|
||||
int colType = cursor.getColumnIndexOrThrow(CalendarContract.Calendars.ACCOUNT_TYPE);
|
||||
int colPrimary = cursor.getColumnIndexOrThrow(CalendarContract.Calendars.IS_PRIMARY);
|
||||
int colVisible = cursor.getColumnIndexOrThrow(CalendarContract.Calendars.VISIBLE);
|
||||
int colDisplay = cursor.getColumnIndexOrThrow(CalendarContract.Calendars.CALENDAR_DISPLAY_NAME);
|
||||
while (cursor.moveToNext()) {
|
||||
long id = cursor.getLong(0);
|
||||
String account = cursor.getString(1);
|
||||
String type = cursor.getString(2);
|
||||
boolean primary = (cursor.getInt(3) != 0);
|
||||
boolean visible = (cursor.getInt(4) != 0);
|
||||
String name = cursor.getString(5);
|
||||
long id = cursor.getLong(colId);
|
||||
String account = cursor.getString(colAccount);
|
||||
String type = cursor.getString(colType);
|
||||
boolean primary = (cursor.getInt(colPrimary) != 0);
|
||||
boolean visible = (cursor.getInt(colVisible) != 0);
|
||||
String name = cursor.getString(colDisplay);
|
||||
if (account != null)
|
||||
calendars.add(new Calendar(id, account, type, primary, visible, name));
|
||||
}
|
||||
|
|
|
@ -3973,11 +3973,13 @@ public class MessageHelper {
|
|||
if (cursor.getCount() == 0)
|
||||
EntityLog.log(context, EntityLog.Type.General, message,
|
||||
"Account not found username=" + account.user);
|
||||
|
||||
int colId = cursor.getColumnIndexOrThrow(CalendarContract.Calendars._ID);
|
||||
if (cursor.moveToNext()) {
|
||||
// https://developer.android.com/guide/topics/providers/calendar-provider#add-event
|
||||
// https://developer.android.com/reference/android/provider/CalendarContract.EventsColumns
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(CalendarContract.Events.CALENDAR_ID, cursor.getLong(0));
|
||||
values.put(CalendarContract.Events.CALENDAR_ID, cursor.getLong(colId));
|
||||
if (!TextUtils.isEmpty(uid))
|
||||
values.put(CalendarContract.Events.UID_2445, uid);
|
||||
values.put(CalendarContract.Events.EVENT_TIMEZONE, TimeZone.getDefault().getID());
|
||||
|
|
Loading…
Reference in a new issue