Automated import from //branches/master/...@142018,142018

This commit is contained in:
Romain Guy authored and The Android Open Source Project committed 2009-03-24 21:22:28 -07:00
1 parent 232f15682d
commit d4185fdddc
3 files changed
+23 -2

No files matched your search

+6
View File
@@ -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>
@@ -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;
@@ -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();
}
}
}
}