summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <>2009-03-24 21:17:50 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-24 21:17:50 -0700
commitd93a7d1716b06cd65f45dfc16232277d0d57c04d (patch)
tree847da142bed07dacc8c550425a5f6e26d91f5851
parent9ffb5439b6e2ffb972086fd237fb3ded3d29ab50 (diff)
downloadandroid_packages_apps_Trebuchet-d93a7d1716b06cd65f45dfc16232277d0d57c04d.tar.gz
android_packages_apps_Trebuchet-d93a7d1716b06cd65f45dfc16232277d0d57c04d.tar.bz2
android_packages_apps_Trebuchet-d93a7d1716b06cd65f45dfc16232277d0d57c04d.zip
Automated import from //branches/donutburger/...@142016,142016
-rw-r--r--res/values/strings.xml6
-rw-r--r--src/com/android/launcher/InstallShortcutReceiver.java12
-rw-r--r--src/com/android/launcher/UninstallShortcutReceiver.java7
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 @@
<string name="add_search">Search</string>
<!-- Error message when user has filled a home screen, possibly not used -->
<string name="out_of_space">No more room on this Home screen.</string>
+ <!-- Message displayed when a shortcut is created by an external application -->
+ <string name="shortcut_installed">Shortcut \"%s\" is installed.</string>
+ <!-- Message displayed when a shortcut is uninstalled by an external application -->
+ <string name="shortcut_uninstalled">Shortcut \"%s\" was removed.</string>
+ <!-- Message displayed when an external application attemps to create a shortcut that already exists -->
+ <string name="shortcut_duplicate">Shortcut \"%s\" already exists.</string>
<!-- Title of dialog when user is selecting shortcut to add to homescreen -->
<string name="title_select_shortcut">Select shortcut</string>
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();
+ }
}
}
}