From 5e46468ff8bce4c2912b9f5fb64df68f24f281cc Mon Sep 17 00:00:00 2001 From: Mangesh Ghiware Date: Thu, 7 Mar 2013 08:55:18 -0800 Subject: Remove redundant Album NAME (replaced by TITLE) Change-Id: I0482f8b4bd85e07aefe4af02b1e8dab4702eb9f6 --- src/com/android/photos/data/PhotoDatabase.java | 5 ++--- src/com/android/photos/data/PhotoProvider.java | 2 -- tests/src/com/android/photos/data/PhotoDatabaseUtils.java | 5 ++--- tests/src/com/android/photos/data/PhotoProviderTest.java | 15 +++++++-------- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/com/android/photos/data/PhotoDatabase.java b/src/com/android/photos/data/PhotoDatabase.java index 8585edc04..a87f00bfa 100644 --- a/src/com/android/photos/data/PhotoDatabase.java +++ b/src/com/android/photos/data/PhotoDatabase.java @@ -59,14 +59,13 @@ public class PhotoDatabase extends SQLiteOpenHelper { { Albums.ACCOUNT_ID, "INTEGER NOT NULL" }, // Albums.PARENT_ID is a foreign key to Albums._ID { Albums.PARENT_ID, "INTEGER" }, - { Albums.NAME, "Text NOT NULL" }, { Albums.VISIBILITY, "INTEGER NOT NULL" }, { Albums.LOCATION_STRING, "TEXT" }, - { Albums.TITLE, "TEXT" }, + { Albums.TITLE, "TEXT NOT NULL" }, { Albums.SUMMARY, "TEXT" }, { Albums.DATE_PUBLISHED, "INTEGER" }, { Albums.DATE_MODIFIED, "INTEGER" }, - createUniqueConstraint(Albums.PARENT_ID, Albums.NAME), + createUniqueConstraint(Albums.PARENT_ID, Albums.TITLE), }; private static final String[][] CREATE_METADATA = { diff --git a/src/com/android/photos/data/PhotoProvider.java b/src/com/android/photos/data/PhotoProvider.java index a4fe8fdd2..7d751bf95 100644 --- a/src/com/android/photos/data/PhotoProvider.java +++ b/src/com/android/photos/data/PhotoProvider.java @@ -131,8 +131,6 @@ public class PhotoProvider extends ContentProvider { public static final String ACCOUNT_ID = "account_id"; /** Parent directory or null if this is in the root. */ public static final String PARENT_ID = "parent_id"; - /** Column name for the name of the album. String value. */ - public static final String NAME = "name"; /** * Column name for the visibility level of the album. Can be any of the * VISIBILITY_* values. diff --git a/tests/src/com/android/photos/data/PhotoDatabaseUtils.java b/tests/src/com/android/photos/data/PhotoDatabaseUtils.java index 1840eb1be..97db8bf7d 100644 --- a/tests/src/com/android/photos/data/PhotoDatabaseUtils.java +++ b/tests/src/com/android/photos/data/PhotoDatabaseUtils.java @@ -31,7 +31,6 @@ public class PhotoDatabaseUtils { Albums._ID, Albums.ACCOUNT_ID, Albums.PARENT_ID, - Albums.NAME, Albums.VISIBILITY, Albums.LOCATION_STRING, Albums.TITLE, @@ -105,11 +104,11 @@ public class PhotoDatabaseUtils { return db.insert(Photos.TABLE, null, values) != -1; } - public static boolean insertAlbum(SQLiteDatabase db, Long parentId, String name, + public static boolean insertAlbum(SQLiteDatabase db, Long parentId, String title, Integer privacy, Long accountId) { ContentValues values = new ContentValues(); values.put(Albums.PARENT_ID, parentId); - values.put(Albums.NAME, name); + values.put(Albums.TITLE, title); values.put(Albums.VISIBILITY, privacy); values.put(Albums.ACCOUNT_ID, accountId); return db.insert(Albums.TABLE, null, values) != -1; diff --git a/tests/src/com/android/photos/data/PhotoProviderTest.java b/tests/src/com/android/photos/data/PhotoProviderTest.java index 927a9d002..47c6e86b2 100644 --- a/tests/src/com/android/photos/data/PhotoProviderTest.java +++ b/tests/src/com/android/photos/data/PhotoProviderTest.java @@ -34,7 +34,7 @@ public class PhotoProviderTest extends ProviderTestCase2 { private static final String TAG = PhotoProviderTest.class.getSimpleName(); private static final String MIME_TYPE = "test/test"; - private static final String ALBUM_NAME = "My Album"; + private static final String ALBUM_TITLE = "My Album"; private static final long ALBUM_PARENT_ID = 100; private static final String META_KEY = "mykey"; private static final String META_VALUE = "myvalue"; @@ -69,7 +69,7 @@ public class PhotoProviderTest extends ProviderTestCase2 { SQLiteDatabase db = mDBHelper.getWritableDatabase(); db.beginTransaction(); try { - PhotoDatabaseUtils.insertAlbum(db, ALBUM_PARENT_ID, ALBUM_NAME, + PhotoDatabaseUtils.insertAlbum(db, ALBUM_PARENT_ID, ALBUM_TITLE, Albums.VISIBILITY_PRIVATE, 100L); mAlbumId = PhotoDatabaseUtils.queryAlbumIdFromParentId(db, ALBUM_PARENT_ID); PhotoDatabaseUtils.insertPhoto(db, 100, 100, System.currentTimeMillis(), mAlbumId, @@ -188,16 +188,15 @@ public class PhotoProviderTest extends ProviderTestCase2 { public void testInsert() { ContentValues values = new ContentValues(); - values.put(Albums.NAME, "add me"); + values.put(Albums.TITLE, "add me"); values.put(Albums.VISIBILITY, Albums.VISIBILITY_PRIVATE); values.put(Albums.ACCOUNT_ID, 100L); values.put(Albums.DATE_MODIFIED, 100L); values.put(Albums.DATE_PUBLISHED, 100L); values.put(Albums.LOCATION_STRING, "Home"); - values.put(Albums.NAME, "hello world"); + values.put(Albums.TITLE, "hello world"); values.putNull(Albums.PARENT_ID); values.put(Albums.SUMMARY, "Nothing much to say about this"); - values.put(Albums.TITLE, "Title"); Uri insertedUri = mResolver.insert(Albums.CONTENT_URI, values); assertNotNull(insertedUri); Cursor cursor = mResolver.query(insertedUri, PhotoDatabaseUtils.PROJECTION_ALBUMS, null, @@ -210,11 +209,11 @@ public class PhotoProviderTest extends ProviderTestCase2 { public void testUpdate() { ContentValues values = new ContentValues(); // Normal update -- use an album. - values.put(Albums.NAME, "foo"); + values.put(Albums.TITLE, "foo"); Uri albumUri = ContentUris.withAppendedId(Albums.CONTENT_URI, mAlbumId); assertEquals(1, mResolver.update(albumUri, values, null, null)); String[] projection = { - Albums.NAME, + Albums.TITLE, }; Cursor cursor = mResolver.query(albumUri, projection, null, null, null); assertEquals(1, cursor.getCount()); @@ -224,7 +223,7 @@ public class PhotoProviderTest extends ProviderTestCase2 { // Update a row that doesn't exist. Uri noAlbumUri = ContentUris.withAppendedId(Albums.CONTENT_URI, mAlbumId + 1); - values.put(Albums.NAME, "bar"); + values.put(Albums.TITLE, "bar"); assertEquals(0, mResolver.update(noAlbumUri, values, null, null)); // Update a metadata value that exists. -- cgit v1.2.3