diff options
author | Mike Cleron <mcleron@google.com> | 2009-11-05 17:17:42 -0800 |
---|---|---|
committer | Mike Cleron <mcleron@google.com> | 2009-11-05 17:17:50 -0800 |
commit | 3a2b3f2be58843d26549fb0ec6c6533627c7cd19 (patch) | |
tree | 15d8e3949942c9b24e44fd270b9111a0c25b2838 /src/com/android/launcher2/LauncherProvider.java | |
parent | 2d8047699768b1487323ee4603f91268df490d60 (diff) | |
download | packages_apps_trebuchet-3a2b3f2be58843d26549fb0ec6c6533627c7cd19.zip packages_apps_trebuchet-3a2b3f2be58843d26549fb0ec6c6533627c7cd19.tar.gz packages_apps_trebuchet-3a2b3f2be58843d26549fb0ec6c6533627c7cd19.tar.bz2 |
If 3 screens are good 5 will be better
Diffstat (limited to 'src/com/android/launcher2/LauncherProvider.java')
-rw-r--r-- | src/com/android/launcher2/LauncherProvider.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java index 9226c22..942b4be 100644 --- a/src/com/android/launcher2/LauncherProvider.java +++ b/src/com/android/launcher2/LauncherProvider.java @@ -58,7 +58,7 @@ public class LauncherProvider extends ContentProvider { private static final String DATABASE_NAME = "launcher.db"; - private static final int DATABASE_VERSION = 4; + private static final int DATABASE_VERSION = 5; static final String AUTHORITY = "com.android.launcher2.settings"; @@ -393,6 +393,21 @@ public class LauncherProvider extends ContentProvider { } } + if (version < 5) { + // We went from 3 to 5 screens. Move everything 1 to the right + db.beginTransaction(); + try { + db.execSQL("UPDATE favorites SET screen=(screen + 1);"); + db.setTransactionSuccessful(); + version = 5; + } catch (SQLException ex) { + // Old version remains, which means we wipe old data + Log.e(LOG_TAG, ex.getMessage(), ex); + } finally { + db.endTransaction(); + } + } + if (version != DATABASE_VERSION) { Log.w(LOG_TAG, "Destroying all old data."); db.execSQL("DROP TABLE IF EXISTS " + TABLE_FAVORITES); |