Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Support cleanup of Calendar.java
Browse files Browse the repository at this point in the history
-replaced refs to columns interfaces with the class where possible
-added support for selection/selection args in instance queries
-further cleanup

Change-Id: I97ee0c7ed1703696166fd4a007e232a42cece376
  • Loading branch information
RoboErikG committed Jun 6, 2011
1 parent d284901 commit 2ce7955
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 98 deletions.
8 changes: 4 additions & 4 deletions src/com/android/providers/calendar/CalendarDebug.java
Expand Up @@ -95,20 +95,20 @@ protected List<Map<String, String>> doInBackground(Void... params) {
String displayName = cursor.getString(INDEX_DISPLAY_NAME);

// Compute number of events in the calendar
String where = Calendar.EventsColumns.CALENDAR_ID + "=" + id;
String where = Calendar.Events.CALENDAR_ID + "=" + id;
Cursor eventCursor = Calendar.Events.query(mContentResolver,
EVENTS_PROJECTION, where, null);
EVENTS_PROJECTION, where, null, null);
try {
eventCount = eventCursor.getCount();
} finally {
eventCursor.close();
}

// Compute number of dirty events in the calendar
String dirtyWhere = Calendar.EventsColumns.CALENDAR_ID + "=" + id
String dirtyWhere = Calendar.Events.CALENDAR_ID + "=" + id
+ " AND " + Calendar.Events.DIRTY + "=1";
Cursor dirtyCursor = Calendar.Events.query(mContentResolver,
EVENTS_PROJECTION, dirtyWhere, null);
EVENTS_PROJECTION, dirtyWhere, null, null);
try {
dirtyCount = dirtyCursor.getCount();
} finally {
Expand Down
Expand Up @@ -25,7 +25,6 @@
import android.os.Debug;
import android.pim.EventRecurrence;
import android.pim.RecurrenceSet;
import android.provider.BaseColumns;
import android.provider.Calendar.Calendars;
import android.provider.Calendar.Events;
import android.provider.Calendar.Instances;
Expand Down Expand Up @@ -74,8 +73,8 @@ public static final class InstancesList extends ArrayList<ContentValues> {
" WHERE " + CalendarProvider2.SQL_WHERE_ID;

private static final String SQL_WHERE_ID_FROM_INSTANCES_NOT_SYNCED =
BaseColumns._ID + " IN " +
"(SELECT " + Tables.INSTANCES + "." + BaseColumns._ID + " as _id" +
Instances._ID + " IN " +
"(SELECT " + Tables.INSTANCES + "." + Instances._ID + " as _id" +
" FROM " + Tables.INSTANCES +
" INNER JOIN " + Tables.EVENTS +
" ON (" +
Expand All @@ -84,8 +83,8 @@ public static final class InstancesList extends ArrayList<ContentValues> {
" WHERE " + Tables.EVENTS + "." + Events._ID + "=?)";

private static final String SQL_WHERE_ID_FROM_INSTANCES_SYNCED =
BaseColumns._ID + " IN " +
"(SELECT " + Tables.INSTANCES + "." + BaseColumns._ID + " as _id" +
Instances._ID + " IN " +
"(SELECT " + Tables.INSTANCES + "." + Instances._ID + " as _id" +
" FROM " + Tables.INSTANCES +
" INNER JOIN " + Tables.EVENTS +
" ON (" +
Expand Down

0 comments on commit 2ce7955

Please sign in to comment.