diff options
author | nebkat <nebkat@teamhacksung.org> | 2013-01-01 15:53:29 +0000 |
---|---|---|
committer | nebkat <nebkat@teamhacksung.org> | 2013-01-01 15:53:29 +0000 |
commit | c8a095f734d520f23ac32184189d5ddc2f9274de (patch) | |
tree | 4def9dbed825bcd10eee095a873b584cadc27c54 | |
parent | f86587daf576f09d0c0864b3555e8175084972ce (diff) | |
download | packages_apps_trebuchet-c8a095f734d520f23ac32184189d5ddc2f9274de.zip packages_apps_trebuchet-c8a095f734d520f23ac32184189d5ddc2f9274de.tar.gz packages_apps_trebuchet-c8a095f734d520f23ac32184189d5ddc2f9274de.tar.bz2 |
ShortcutInfo: Save title if itemType shortcut
Change-Id: I7ce0bf8a2aea04131afb423407c09cdcf184febe
-rw-r--r-- | src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java | 2 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/LauncherModel.java | 8 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/ShortcutInfo.java | 3 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java b/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java index 1d68654..d8a69ba 100644 --- a/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java +++ b/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java @@ -132,7 +132,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { boolean found = false; synchronized (app) { final ArrayList<ItemInfo> items = LauncherModel.getItemsInLocalCoordinates(context); - final boolean exists = LauncherModel.shortcutExists(context, name, intent); + final boolean exists = LauncherModel.shortcutExists(context, intent); // Try adding to the workspace screens incrementally, starting at the default or center // screen and alternating between +1, -1, +2, -2, etc. (using ~ ceil(i/2f)*(-1)^(i-1)) diff --git a/src/com/cyanogenmod/trebuchet/LauncherModel.java b/src/com/cyanogenmod/trebuchet/LauncherModel.java index 12fdb45..501058e 100644 --- a/src/com/cyanogenmod/trebuchet/LauncherModel.java +++ b/src/com/cyanogenmod/trebuchet/LauncherModel.java @@ -435,13 +435,13 @@ public class LauncherModel extends BroadcastReceiver { /** * Returns true if the shortcuts already exists in the database. - * we identify a shortcut by its title and intent. + * we identify a shortcut by its intent. */ - static boolean shortcutExists(Context context, String title, Intent intent) { + static boolean shortcutExists(Context context, Intent intent) { final ContentResolver cr = context.getContentResolver(); Cursor c = cr.query(LauncherSettings.Favorites.CONTENT_URI, - new String[] { "title", "intent" }, "title=? and intent=?", - new String[] { title, intent.toUri(0) }, null); + new String[] { "intent" }, "intent=?", + new String[] { intent.toUri(0) }, null); boolean result = false; try { result = c.moveToFirst(); diff --git a/src/com/cyanogenmod/trebuchet/ShortcutInfo.java b/src/com/cyanogenmod/trebuchet/ShortcutInfo.java index 21d11f2..b1db3ec 100644 --- a/src/com/cyanogenmod/trebuchet/ShortcutInfo.java +++ b/src/com/cyanogenmod/trebuchet/ShortcutInfo.java @@ -147,7 +147,8 @@ class ShortcutInfo extends ItemInfo { void onAddToDatabase(ContentValues values) { super.onAddToDatabase(values); - String titleStr = title != null && customTitle ? title.toString() : null; + String titleStr = title != null && (customTitle || itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) ? + title.toString() : null; values.put(LauncherSettings.BaseLauncherColumns.TITLE, titleStr); String uri = intent != null ? intent.toUri(0) : null; |