summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Lemieux <jplemieux@google.com>2015-07-30 18:22:08 -0700
committerJames Lemieux <jplemieux@google.com>2015-07-30 18:22:08 -0700
commit0750923e1ee389c0987e19801ec12d5de53d4b57 (patch)
tree01f382518451ad2aa3527ceaca4a606397fd769d
parent9c1f508c1f68bbbcb8fc42f8fc7748d63833fe89 (diff)
downloadandroid_packages_apps_DeskClock-0750923e1ee389c0987e19801ec12d5de53d4b57.tar.gz
android_packages_apps_DeskClock-0750923e1ee389c0987e19801ec12d5de53d4b57.tar.bz2
android_packages_apps_DeskClock-0750923e1ee389c0987e19801ec12d5de53d4b57.zip
Remove all references to the selected_cities table
This table was added for future use that never came to pass. Change-Id: I2226a2c54d320ce1f0f20cddc3b5cd715d78e0ea
-rw-r--r--src/com/android/deskclock/provider/City.java194
-rw-r--r--src/com/android/deskclock/provider/ClockContract.java93
-rw-r--r--src/com/android/deskclock/provider/ClockDatabaseHelper.java36
-rw-r--r--src/com/android/deskclock/provider/ClockProvider.java50
4 files changed, 50 insertions, 323 deletions
diff --git a/src/com/android/deskclock/provider/City.java b/src/com/android/deskclock/provider/City.java
deleted file mode 100644
index 761dc3972..000000000
--- a/src/com/android/deskclock/provider/City.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.deskclock.provider;
-
-import android.content.ContentResolver;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.database.Cursor;
-import android.net.Uri;
-
-import java.util.Calendar;
-import java.util.LinkedList;
-import java.util.List;
-
-public final class City implements ClockContract.CitiesColumns {
- private static final String[] QUERY_COLUMNS = {
- CITY_ID,
- CITY_NAME,
- TIMEZONE_NAME,
- TIMEZONE_OFFSET
- };
-
- /**
- * These save calls to cursor.getColumnIndexOrThrow()
- * THEY MUST BE KEPT IN SYNC WITH ABOVE QUERY COLUMNS
- */
- private static final int CITY_ID_INDEX = 0;
- private static final int CITY_NAME_INDEX = 1;
- private static final int TIMEZONE_NAME_INDEX = 2;
- private static final int TIMEZONE_OFFSET_INDEX = 3;
-
- private static final int COLUMN_COUNT = TIMEZONE_OFFSET_INDEX + 1;
-
- public static ContentValues createContentValues(City city) {
- ContentValues values = new ContentValues(COLUMN_COUNT);
- values.put(CITY_ID, city.mCityId);
- values.put(CITY_NAME, city.mCityName);
- values.put(TIMEZONE_NAME, city.mTimezoneName);
- values.put(TIMEZONE_OFFSET, city.mTimezoneOffset);
- return values;
- }
-
- public static String getCityId(Uri contentUri) {
- return contentUri.getLastPathSegment();
- }
-
- /**
- * Return content uri for specific city id.
- *
- * @param cityId to append to content uri
- *
- * @return a new city content uri with the given ID appended to the end of the path
- */
- public static Uri getContentUriForId(String cityId) {
- return CONTENT_URI.buildUpon().appendEncodedPath(cityId).build();
- }
-
-
- /**
- * Get city from cityId.
- *
- * @param contentResolver to perform the query on.
- * @param cityId for the desired city.
- * @return city if found, null otherwise
- */
- public static City getCity(ContentResolver contentResolver, String cityId) {
- Cursor cursor = contentResolver.query(getContentUriForId(cityId),
- QUERY_COLUMNS, null, null, null);
- City result = null;
- if (cursor == null) {
- return result;
- }
-
- try {
- if (cursor.moveToFirst()) {
- result = new City(cursor);
- }
- } finally {
- cursor.close();
- }
-
- return result;
- }
-
- /**
- * Get a list of cities given selection.
- *
- * @param contentResolver to perform the query on.
- * @param selection A filter declaring which rows to return, formatted as an
- * SQL WHERE clause (excluding the WHERE itself). Passing null will
- * return all rows for the given URI.
- * @param selectionArgs You may include ?s in selection, which will be
- * replaced by the values from selectionArgs, in the order that they
- * appear in the selection. The values will be bound as Strings.
- * @return list of alarms matching where clause or empty list if none found.
- */
- public static List<City> getCities(ContentResolver contentResolver,
- String selection, String... selectionArgs) {
- Cursor cursor = contentResolver.query(CONTENT_URI, QUERY_COLUMNS,
- selection, selectionArgs, null);
- List<City> result = new LinkedList<City>();
- if (cursor == null) {
- return result;
- }
-
- try {
- if (cursor.moveToFirst()) {
- do {
- result.add(new City(cursor));
- } while (cursor.moveToNext());
- }
- } finally {
- cursor.close();
- }
-
- return result;
- }
-
- public static City addCity(ContentResolver contentResolver, City city) {
- ContentValues values = createContentValues(city);
- Uri uri = contentResolver.insert(CONTENT_URI, values);
- city.mCityId = getCityId(uri);
- return city;
- }
-
- public static boolean updateCity(ContentResolver contentResolver, City city) {
- ContentValues values = createContentValues(city);
- Uri updateUri = getContentUriForId(city.mCityId);
- long rowsUpdated = contentResolver.update(updateUri, values, null, null);
- return rowsUpdated == 1;
- }
-
- public static boolean deleteCity(ContentResolver contentResolver, String cityId) {
- Uri uri = getContentUriForId(cityId);
- int deletedRows = contentResolver.delete(uri, "", null);
- return deletedRows == 1;
- }
-
- // Public fields
- public String mCityId;
- public String mCityName;
- public String mTimezoneName;
- public int mTimezoneOffset;
-
- public City(String cityId, String cityName, String timezoneName, int timezoneOffset) {
- mCityId = cityId;
- mCityName = cityName;
- mTimezoneName = timezoneName;
- mTimezoneOffset = timezoneOffset;
- }
-
- public City(Cursor c) {
- mCityId = c.getString(CITY_ID_INDEX);
- mCityName = c.getString(CITY_NAME_INDEX);
- mTimezoneName = c.getString(TIMEZONE_NAME_INDEX);
- mTimezoneOffset = c.getInt(TIMEZONE_OFFSET_INDEX);
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof City)) return false;
- final City other = (City) o;
- return mCityId.equals(other.mCityId);
- }
-
- @Override
- public int hashCode() {
- return mCityId.hashCode();
- }
-
- @Override
- public String toString() {
- return "Instance{" +
- "mCityId=" + mCityId +
- ", mCityName=" + mCityName +
- ", mTimezoneName=" + mTimezoneName +
- ", mTimezoneOffset=" + mTimezoneOffset +
- '}';
- }
-}
diff --git a/src/com/android/deskclock/provider/ClockContract.java b/src/com/android/deskclock/provider/ClockContract.java
index 89934796f..98ce4d72b 100644
--- a/src/com/android/deskclock/provider/ClockContract.java
+++ b/src/com/android/deskclock/provider/ClockContract.java
@@ -33,7 +33,6 @@ import android.provider.BaseColumns;
* <li>The {@link InstancesColumns} table holds the current state of each
* alarm in the AlarmsColumn table.
* </li>
- * <li>The {@link CitiesColumns} table holds all user selectable cities</li>
* </ul>
*/
public final class ClockContract {
@@ -55,25 +54,25 @@ public final class ClockContract {
/**
* This string is used to indicate no ringtone.
*/
- public static final Uri NO_RINGTONE_URI = Uri.EMPTY;
+ Uri NO_RINGTONE_URI = Uri.EMPTY;
/**
* This string is used to indicate no ringtone.
*/
- public static final String NO_RINGTONE = NO_RINGTONE_URI.toString();
+ String NO_RINGTONE = NO_RINGTONE_URI.toString();
/**
* True if alarm should vibrate
* <p>Type: BOOLEAN</p>
*/
- public static final String VIBRATE = "vibrate";
+ String VIBRATE = "vibrate";
/**
* Alarm label.
*
* <p>Type: STRING</p>
*/
- public static final String LABEL = "label";
+ String LABEL = "label";
/**
* Audio alert to play when alarm triggers. Null entry
@@ -82,7 +81,7 @@ public final class ClockContract {
*
* <p>Type: STRING</p>
*/
- public static final String RINGTONE = "ringtone";
+ String RINGTONE = "ringtone";
}
/**
@@ -92,26 +91,26 @@ public final class ClockContract {
/**
* The content:// style URL for this table.
*/
- public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/alarms");
+ Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/alarms");
/**
* The content:// style URL for the alarms with instance tables, which is used to get the
* next firing instance and the current state of an alarm.
*/
- public static final Uri ALARMS_WITH_INSTANCES_URI = Uri.parse("content://" + AUTHORITY
+ Uri ALARMS_WITH_INSTANCES_URI = Uri.parse("content://" + AUTHORITY
+ "/alarms_with_instances");
/**
* Hour in 24-hour localtime 0 - 23.
* <p>Type: INTEGER</p>
*/
- public static final String HOUR = "hour";
+ String HOUR = "hour";
/**
* Minutes in localtime 0 - 59.
* <p>Type: INTEGER</p>
*/
- public static final String MINUTES = "minutes";
+ String MINUTES = "minutes";
/**
* Days of the week encoded as a bit set.
@@ -119,19 +118,19 @@ public final class ClockContract {
*
* {@link DaysOfWeek}
*/
- public static final String DAYS_OF_WEEK = "daysofweek";
+ String DAYS_OF_WEEK = "daysofweek";
/**
* True if alarm is active.
* <p>Type: BOOLEAN</p>
*/
- public static final String ENABLED = "enabled";
+ String ENABLED = "enabled";
/**
* Determine if alarm is deleted after it has been used.
* <p>Type: INTEGER</p>
*/
- public static final String DELETE_AFTER_USE = "delete_after_use";
+ String DELETE_AFTER_USE = "delete_after_use";
}
/**
@@ -141,7 +140,7 @@ public final class ClockContract {
/**
* The content:// style URL for this table.
*/
- public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/instances");
+ Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/instances");
/**
* Alarm state when to show no notification.
@@ -149,7 +148,7 @@ public final class ClockContract {
* Can transitions to:
* LOW_NOTIFICATION_STATE
*/
- public static final int SILENT_STATE = 0;
+ int SILENT_STATE = 0;
/**
* Alarm state to show low priority alarm notification.
@@ -159,7 +158,7 @@ public final class ClockContract {
* HIGH_NOTIFICATION_STATE
* DISMISSED_STATE
*/
- public static final int LOW_NOTIFICATION_STATE = 1;
+ int LOW_NOTIFICATION_STATE = 1;
/**
* Alarm state to hide low priority alarm notification.
@@ -167,7 +166,7 @@ public final class ClockContract {
* Can transitions to:
* HIGH_NOTIFICATION_STATE
*/
- public static final int HIDE_NOTIFICATION_STATE = 2;
+ int HIDE_NOTIFICATION_STATE = 2;
/**
* Alarm state to show high priority alarm notification.
@@ -176,7 +175,7 @@ public final class ClockContract {
* DISMISSED_STATE
* FIRED_STATE
*/
- public static final int HIGH_NOTIFICATION_STATE = 3;
+ int HIGH_NOTIFICATION_STATE = 3;
/**
* Alarm state when alarm is in snooze.
@@ -185,7 +184,7 @@ public final class ClockContract {
* DISMISSED_STATE
* FIRED_STATE
*/
- public static final int SNOOZE_STATE = 4;
+ int SNOOZE_STATE = 4;
/**
* Alarm state when alarm is being fired.
@@ -195,7 +194,7 @@ public final class ClockContract {
* SNOOZED_STATE
* MISSED_STATE
*/
- public static final int FIRED_STATE = 5;
+ int FIRED_STATE = 5;
/**
* Alarm state when alarm has been missed.
@@ -203,95 +202,61 @@ public final class ClockContract {
* Can transitions to:
* DISMISSED_STATE
*/
- public static final int MISSED_STATE = 6;
+ int MISSED_STATE = 6;
/**
* Alarm state when alarm is done.
*/
- public static final int DISMISSED_STATE = 7;
+ int DISMISSED_STATE = 7;
/**
* Alarm state when alarm has been dismissed before its intended firing time.
*/
- public static final int PREDISMISSED_STATE = 8;
+ int PREDISMISSED_STATE = 8;
/**
* Alarm year.
*
* <p>Type: INTEGER</p>
*/
- public static final String YEAR = "year";
+ String YEAR = "year";
/**
* Alarm month in year.
*
* <p>Type: INTEGER</p>
*/
- public static final String MONTH = "month";
+ String MONTH = "month";
/**
* Alarm day in month.
*
* <p>Type: INTEGER</p>
*/
- public static final String DAY = "day";
+ String DAY = "day";
/**
* Alarm hour in 24-hour localtime 0 - 23.
* <p>Type: INTEGER</p>
*/
- public static final String HOUR = "hour";
+ String HOUR = "hour";
/**
* Alarm minutes in localtime 0 - 59
* <p>Type: INTEGER</p>
*/
- public static final String MINUTES = "minutes";
+ String MINUTES = "minutes";
/**
* Foreign key to Alarms table
* <p>Type: INTEGER (long)</p>
*/
- public static final String ALARM_ID = "alarm_id";
+ String ALARM_ID = "alarm_id";
/**
* Alarm state
* <p>Type: INTEGER</p>
*/
- public static final String ALARM_STATE = "alarm_state";
- }
-
- /**
- * Constants for the Cities table, which contains all selectable cities.
- */
- protected interface CitiesColumns {
- /**
- * The content:// style URL for this table.
- */
- public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/cities");
-
- /**
- * Primary id for city.
- * <p>Type: STRING</p>
- */
- public static final String CITY_ID = "city_id";
-
- /**
- * City name.
- * <p>Type: STRING</p>
- */
- public static final String CITY_NAME = "city_name";
-
- /**
- * Timezone name of city.
- * <p>Type: STRING</p>
- */
- public static final String TIMEZONE_NAME = "timezone_name";
-
- /**
- * Timezone offset.
- * <p>Type: INTEGER</p>
- */
- public static final String TIMEZONE_OFFSET = "timezone_offset";
+ String ALARM_STATE = "alarm_state";
}
}
diff --git a/src/com/android/deskclock/provider/ClockDatabaseHelper.java b/src/com/android/deskclock/provider/ClockDatabaseHelper.java
index efdb9581b..b75670d01 100644
--- a/src/com/android/deskclock/provider/ClockDatabaseHelper.java
+++ b/src/com/android/deskclock/provider/ClockDatabaseHelper.java
@@ -40,7 +40,6 @@ class ClockDatabaseHelper extends SQLiteOpenHelper {
private static final int VERSION_5 = 5;
/**
- * Introduce:
* Added alarm_instances table
* Added selected_cities table
* Added DELETE_AFTER_USE column to alarms table
@@ -52,6 +51,11 @@ class ClockDatabaseHelper extends SQLiteOpenHelper {
*/
private static final int VERSION_7 = 7;
+ /**
+ * Removed selected_cities table.
+ */
+ private static final int VERSION_8 = 8;
+
// This creates a default alarm at 8:30 for every Mon,Tue,Wed,Thu,Fri
private static final String DEFAULT_ALARM_1 = "(8, 30, 31, 0, 1, '', NULL, 0);";
@@ -63,7 +67,7 @@ class ClockDatabaseHelper extends SQLiteOpenHelper {
static final String OLD_ALARMS_TABLE_NAME = "alarms";
static final String ALARMS_TABLE_NAME = "alarm_templates";
static final String INSTANCES_TABLE_NAME = "alarm_instances";
- static final String CITIES_TABLE_NAME = "selected_cities";
+ private static final String SELECTED_CITIES_TABLE_NAME = "selected_cities";
private static void createAlarmsTable(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + ALARMS_TABLE_NAME + " (" +
@@ -98,24 +102,14 @@ class ClockDatabaseHelper extends SQLiteOpenHelper {
LogUtils.i("Instance table created");
}
- private static void createCitiesTable(SQLiteDatabase db) {
- db.execSQL("CREATE TABLE " + CITIES_TABLE_NAME + " (" +
- ClockContract.CitiesColumns.CITY_ID + " TEXT PRIMARY KEY," +
- ClockContract.CitiesColumns.CITY_NAME + " TEXT NOT NULL, " +
- ClockContract.CitiesColumns.TIMEZONE_NAME + " TEXT NOT NULL, " +
- ClockContract.CitiesColumns.TIMEZONE_OFFSET + " INTEGER NOT NULL);");
- LogUtils.i("Cities table created");
- }
-
public ClockDatabaseHelper(Context context) {
- super(context, DATABASE_NAME, null, VERSION_7);
+ super(context, DATABASE_NAME, null, VERSION_8);
}
@Override
public void onCreate(SQLiteDatabase db) {
createAlarmsTable(db);
createInstanceTable(db);
- createCitiesTable(db);
// insert default alarms
LogUtils.i("Inserting default alarms");
@@ -135,18 +129,20 @@ class ClockDatabaseHelper extends SQLiteOpenHelper {
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int currentVersion) {
- LogUtils.v("Upgrading alarms database from version "
- + oldVersion + " to " + currentVersion);
+ LogUtils.v("Upgrading alarms database from version %d to %d", oldVersion, currentVersion);
+
+ if (oldVersion <= VERSION_7) {
+ // This was not used in VERSION_7 or prior, so we can just drop it.
+ db.execSQL("DROP TABLE IF EXISTS " + SELECTED_CITIES_TABLE_NAME + ";");
+ }
if (oldVersion <= VERSION_6) {
- // These were not used in DB_VERSION_6, so we can just drop them.
+ // This was not used in VERSION_6 or prior, so we can just drop it.
db.execSQL("DROP TABLE IF EXISTS " + INSTANCES_TABLE_NAME + ";");
- db.execSQL("DROP TABLE IF EXISTS " + CITIES_TABLE_NAME + ";");
// Create new alarms table and copy over the data
createAlarmsTable(db);
createInstanceTable(db);
- createCitiesTable(db);
LogUtils.i("Copying old alarms to new table");
final String[] OLD_TABLE_COLUMNS = {
@@ -162,7 +158,7 @@ class ClockDatabaseHelper extends SQLiteOpenHelper {
try (Cursor cursor = db.query(OLD_ALARMS_TABLE_NAME, OLD_TABLE_COLUMNS,
null, null, null, null, null)) {
final Calendar currentTime = Calendar.getInstance();
- while (cursor.moveToNext()) {
+ while (cursor != null && cursor.moveToNext()) {
final Alarm alarm = new Alarm();
alarm.id = cursor.getLong(0);
alarm.hour = cursor.getInt(1);
@@ -180,7 +176,7 @@ class ClockDatabaseHelper extends SQLiteOpenHelper {
TextUtils.isEmpty(alertString) ? null : Uri.parse(alertString);
}
- // Save new version of alarm and create alarminstance for it
+ // Save new version of alarm and create alarm instance for it
db.insert(ALARMS_TABLE_NAME, null, Alarm.createContentValues(alarm));
if (alarm.enabled) {
AlarmInstance newInstance = alarm.createInstanceAfter(currentTime);
diff --git a/src/com/android/deskclock/provider/ClockProvider.java b/src/com/android/deskclock/provider/ClockProvider.java
index 5da4ac2b0..97d7c799b 100644
--- a/src/com/android/deskclock/provider/ClockProvider.java
+++ b/src/com/android/deskclock/provider/ClockProvider.java
@@ -38,15 +38,14 @@ import static com.android.deskclock.provider.ClockDatabaseHelper.ALARMS_TABLE_NA
import static com.android.deskclock.provider.ClockDatabaseHelper.INSTANCES_TABLE_NAME;
public class ClockProvider extends ContentProvider {
+
private ClockDatabaseHelper mOpenHelper;
private static final int ALARMS = 1;
private static final int ALARMS_ID = 2;
private static final int INSTANCES = 3;
private static final int INSTANCES_ID = 4;
- private static final int CITIES = 5;
- private static final int CITIES_ID = 6;
- private static final int ALARMS_WITH_INSTANCES = 7;
+ private static final int ALARMS_WITH_INSTANCES = 5;
/**
* Projection map used by query for snoozed alarms.
@@ -102,8 +101,6 @@ public class ClockProvider extends ContentProvider {
sURIMatcher.addURI(ClockContract.AUTHORITY, "alarms/#", ALARMS_ID);
sURIMatcher.addURI(ClockContract.AUTHORITY, "instances", INSTANCES);
sURIMatcher.addURI(ClockContract.AUTHORITY, "instances/#", INSTANCES_ID);
- sURIMatcher.addURI(ClockContract.AUTHORITY, "cities", CITIES);
- sURIMatcher.addURI(ClockContract.AUTHORITY, "cities/*", CITIES_ID);
sURIMatcher.addURI(ClockContract.AUTHORITY, "alarms_with_instances", ALARMS_WITH_INSTANCES);
}
@@ -141,14 +138,6 @@ public class ClockProvider extends ContentProvider {
qb.appendWhere(InstancesColumns._ID + "=");
qb.appendWhere(uri.getLastPathSegment());
break;
- case CITIES:
- qb.setTables(ClockDatabaseHelper.CITIES_TABLE_NAME);
- break;
- case CITIES_ID:
- qb.setTables(ClockDatabaseHelper.CITIES_TABLE_NAME);
- qb.appendWhere(ClockContract.CitiesColumns.CITY_ID + "=");
- qb.appendWhere(uri.getLastPathSegment());
- break;
case ALARMS_WITH_INSTANCES:
qb.setTables(ALARM_JOIN_INSTANCE_TABLE_STATEMENT);
qb.setProjectionMap(sAlarmsWithInstancesProjection);
@@ -180,10 +169,6 @@ public class ClockProvider extends ContentProvider {
return "vnd.android.cursor.dir/instances";
case INSTANCES_ID:
return "vnd.android.cursor.item/instances";
- case CITIES:
- return "vnd.android.cursor.dir/cities";
- case CITIES_ID:
- return "vnd.android.cursor.item/cities";
default:
throw new IllegalArgumentException("Unknown URI");
}
@@ -207,15 +192,8 @@ public class ClockProvider extends ContentProvider {
InstancesColumns._ID + "=" + alarmId,
null);
break;
- case CITIES_ID:
- alarmId = uri.getLastPathSegment();
- count = db.update(ClockDatabaseHelper.CITIES_TABLE_NAME, values,
- ClockContract.CitiesColumns.CITY_ID + "=" + alarmId,
- null);
- break;
default: {
- throw new UnsupportedOperationException(
- "Cannot update URI: " + uri);
+ throw new UnsupportedOperationException("Cannot update URI: " + uri);
}
}
LogUtils.v("*** notifyChange() id: " + alarmId + " url " + uri);
@@ -234,9 +212,6 @@ public class ClockProvider extends ContentProvider {
case INSTANCES:
rowId = db.insert(INSTANCES_TABLE_NAME, null, initialValues);
break;
- case CITIES:
- rowId = db.insert(ClockDatabaseHelper.CITIES_TABLE_NAME, null, initialValues);
- break;
default:
throw new IllegalArgumentException("Cannot insert from URI: " + uri);
}
@@ -260,8 +235,7 @@ public class ClockProvider extends ContentProvider {
if (TextUtils.isEmpty(where)) {
where = AlarmsColumns._ID + "=" + primaryKey;
} else {
- where = AlarmsColumns._ID + "=" + primaryKey +
- " AND (" + where + ")";
+ where = AlarmsColumns._ID + "=" + primaryKey + " AND (" + where + ")";
}
count = db.delete(ALARMS_TABLE_NAME, where, whereArgs);
break;
@@ -273,24 +247,10 @@ public class ClockProvider extends ContentProvider {
if (TextUtils.isEmpty(where)) {
where = InstancesColumns._ID + "=" + primaryKey;
} else {
- where = InstancesColumns._ID + "=" + primaryKey +
- " AND (" + where + ")";
+ where = InstancesColumns._ID + "=" + primaryKey + " AND (" + where + ")";
}
count = db.delete(INSTANCES_TABLE_NAME, where, whereArgs);
break;
- case CITIES:
- count = db.delete(ClockDatabaseHelper.CITIES_TABLE_NAME, where, whereArgs);
- break;
- case CITIES_ID:
- primaryKey = uri.getLastPathSegment();
- if (TextUtils.isEmpty(where)) {
- where = ClockContract.CitiesColumns.CITY_ID + "=" + primaryKey;
- } else {
- where = ClockContract.CitiesColumns.CITY_ID +"=" + primaryKey +
- " AND (" + where + ")";
- }
- count = db.delete(ClockDatabaseHelper.CITIES_TABLE_NAME, where, whereArgs);
- break;
default:
throw new IllegalArgumentException("Cannot delete from URI: " + uri);
}