summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornebkat <nebkat@teamhacksung.org>2013-01-01 15:53:29 +0000
committernebkat <nebkat@teamhacksung.org>2013-01-01 15:53:29 +0000
commitc8a095f734d520f23ac32184189d5ddc2f9274de (patch)
tree4def9dbed825bcd10eee095a873b584cadc27c54
parentf86587daf576f09d0c0864b3555e8175084972ce (diff)
downloadandroid_packages_apps_Trebuchet-c8a095f734d520f23ac32184189d5ddc2f9274de.tar.gz
android_packages_apps_Trebuchet-c8a095f734d520f23ac32184189d5ddc2f9274de.tar.bz2
android_packages_apps_Trebuchet-c8a095f734d520f23ac32184189d5ddc2f9274de.zip
ShortcutInfo: Save title if itemType shortcut
Change-Id: I7ce0bf8a2aea04131afb423407c09cdcf184febe
-rw-r--r--src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java2
-rw-r--r--src/com/cyanogenmod/trebuchet/LauncherModel.java8
-rw-r--r--src/com/cyanogenmod/trebuchet/ShortcutInfo.java3
3 files changed, 7 insertions, 6 deletions
diff --git a/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java b/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java
index 1d686540a..d8a69ba49 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 12fdb457e..501058e86 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 21d11f242..b1db3ec35 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;