|
|
|
@ -78,21 +78,23 @@ public class FragmentDialogCalendar extends FragmentDialogBase {
|
|
|
|
|
CalendarContract.Calendars.ACCOUNT_NAME + "," +
|
|
|
|
|
CalendarContract.Calendars.CALENDAR_DISPLAY_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(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));
|
|
|
|
|
if (cursor != null) {
|
|
|
|
|
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(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));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.e(ex);
|
|
|
|
@ -116,10 +118,10 @@ public class FragmentDialogCalendar extends FragmentDialogBase {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
Calendar calendar = calendars.get(which);
|
|
|
|
|
getArguments().putLong("id", calendar.id);
|
|
|
|
|
getArguments().putString("account", calendar.account);
|
|
|
|
|
getArguments().putString("type", calendar.type);
|
|
|
|
|
getArguments().putString("name", calendar.name);
|
|
|
|
|
args.putLong("id", calendar.id);
|
|
|
|
|
args.putString("account", calendar.account);
|
|
|
|
|
args.putString("type", calendar.type);
|
|
|
|
|
args.putString("name", calendar.name);
|
|
|
|
|
sendResult(RESULT_OK);
|
|
|
|
|
dismiss();
|
|
|
|
|
}
|
|
|
|
@ -129,9 +131,9 @@ public class FragmentDialogCalendar extends FragmentDialogBase {
|
|
|
|
|
builder.setNegativeButton(R.string.title_reset, new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
getArguments().putLong("id", -1);
|
|
|
|
|
getArguments().putString("account", null);
|
|
|
|
|
getArguments().putString("type", null);
|
|
|
|
|
args.putLong("id", -1);
|
|
|
|
|
args.putString("account", null);
|
|
|
|
|
args.putString("type", null);
|
|
|
|
|
sendResult(RESULT_OK);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|