From d93a7d1716b06cd65f45dfc16232277d0d57c04d Mon Sep 17 00:00:00 2001 From: Romain Guy <> Date: Tue, 24 Mar 2009 21:17:50 -0700 Subject: Automated import from //branches/donutburger/...@142016,142016 --- res/values/strings.xml | 6 ++++++ src/com/android/launcher/InstallShortcutReceiver.java | 12 +++++++++++- src/com/android/launcher/UninstallShortcutReceiver.java | 7 ++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index a7945cba7..734ea0a72 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -72,6 +72,12 @@ Search No more room on this Home screen. + + Shortcut \"%s\" is installed. + + Shortcut \"%s\" was removed. + + Shortcut \"%s\" already exists. Select shortcut diff --git a/src/com/android/launcher/InstallShortcutReceiver.java b/src/com/android/launcher/InstallShortcutReceiver.java index a1e954a05..fd2789ceb 100644 --- a/src/com/android/launcher/InstallShortcutReceiver.java +++ b/src/com/android/launcher/InstallShortcutReceiver.java @@ -21,6 +21,7 @@ import android.content.Context; import android.content.Intent; import android.content.ContentResolver; import android.database.Cursor; +import android.widget.Toast; public class InstallShortcutReceiver extends BroadcastReceiver { private final int[] mCoordinates = new int[2]; @@ -37,6 +38,8 @@ public class InstallShortcutReceiver extends BroadcastReceiver { } private boolean installShortcut(Context context, Intent data, int screen) { + String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); + if (findEmptyCell(context, mCoordinates, screen)) { CellLayout.CellInfo cell = new CellLayout.CellInfo(); cell.cellX = mCoordinates[0]; @@ -44,7 +47,6 @@ public class InstallShortcutReceiver extends BroadcastReceiver { cell.screen = screen; Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); - String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); if (intent.getAction() == null) { intent.setAction(Intent.ACTION_VIEW); @@ -55,9 +57,17 @@ public class InstallShortcutReceiver extends BroadcastReceiver { boolean duplicate = data.getBooleanExtra(Launcher.EXTRA_SHORTCUT_DUPLICATE, true); if (duplicate || !LauncherModel.shortcutExists(context, name, intent)) { Launcher.addShortcut(context, data, cell, true); + Toast.makeText(context, context.getString(R.string.shortcut_installed, name), + Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(context, context.getString(R.string.shortcut_duplicate, name), + Toast.LENGTH_SHORT).show(); } return true; + } else { + Toast.makeText(context, context.getString(R.string.out_of_space), + Toast.LENGTH_SHORT).show(); } return false; diff --git a/src/com/android/launcher/UninstallShortcutReceiver.java b/src/com/android/launcher/UninstallShortcutReceiver.java index e490f9c0f..334fbc285 100644 --- a/src/com/android/launcher/UninstallShortcutReceiver.java +++ b/src/com/android/launcher/UninstallShortcutReceiver.java @@ -22,6 +22,7 @@ import android.content.Intent; import android.content.ContentResolver; import android.database.Cursor; import android.net.Uri; +import android.widget.Toast; import java.net.URISyntaxException; @@ -62,7 +63,11 @@ public class UninstallShortcutReceiver extends BroadcastReceiver { c.close(); } - if (changed) cr.notifyChange(LauncherSettings.Favorites.CONTENT_URI, null); + if (changed) { + cr.notifyChange(LauncherSettings.Favorites.CONTENT_URI, null); + Toast.makeText(context, context.getString(R.string.shortcut_uninstalled, name), + Toast.LENGTH_SHORT).show(); + } } } } -- cgit v1.2.3