Merge branch 'open_source_no_contributions' into google_internal
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b0421b2..db9e658 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 a1e954a..fd2789c 100644
--- a/src/com/android/launcher/InstallShortcutReceiver.java
+++ b/src/com/android/launcher/InstallShortcutReceiver.java
@@ -21,6 +21,7 @@
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 @@
}
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 @@
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 @@
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 e490f9c..334fbc2 100644
--- a/src/com/android/launcher/UninstallShortcutReceiver.java
+++ b/src/com/android/launcher/UninstallShortcutReceiver.java
@@ -22,6 +22,7 @@
import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
+import android.widget.Toast;
import java.net.URISyntaxException;
@@ -62,7 +63,11 @@
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();
+ }
}
}
}