diff options
author | nebkat <nebkat@teamhacksung.org> | 2012-12-23 11:57:11 +0000 |
---|---|---|
committer | nebkat <nebkat@teamhacksung.org> | 2012-12-23 12:16:02 +0000 |
commit | 10a908a32cab20d5fc0ee944a3b34b98a9648f68 (patch) | |
tree | e0780a7b9dc7ed2dc36719ff538955fb1c0c4b48 /src/com/cyanogenmod/trebuchet/Launcher.java | |
parent | a8d6d217e05240f4108227c0f19f3a9bfd1fc73a (diff) | |
download | packages_apps_trebuchet-10a908a32cab20d5fc0ee944a3b34b98a9648f68.zip packages_apps_trebuchet-10a908a32cab20d5fc0ee944a3b34b98a9648f68.tar.gz packages_apps_trebuchet-10a908a32cab20d5fc0ee944a3b34b98a9648f68.tar.bz2 |
Workspace: Shortcut renaming
Change-Id: I67e7441b3d6ba4eba70936c2fbdc9d854b706948
Diffstat (limited to 'src/com/cyanogenmod/trebuchet/Launcher.java')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Launcher.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java index 3450db6..e43029d 100644 --- a/src/com/cyanogenmod/trebuchet/Launcher.java +++ b/src/com/cyanogenmod/trebuchet/Launcher.java @@ -29,6 +29,7 @@ import android.animation.ValueAnimator.AnimatorUpdateListener; import android.app.Activity; import android.app.ActivityManager; import android.app.ActivityOptions; +import android.app.AlertDialog; import android.app.SearchManager; import android.appwidget.AppWidgetHostView; import android.appwidget.AppWidgetManager; @@ -39,6 +40,7 @@ import android.content.ComponentCallbacks2; import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; @@ -89,6 +91,7 @@ import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.inputmethod.InputMethodManager; import android.widget.Advanceable; +import android.widget.EditText; import android.widget.ImageView; import android.widget.PopupMenu; import android.widget.TextView; @@ -983,6 +986,31 @@ public final class Launcher extends Activity } /** + * Starts shortcut rename dialog. + * + * @param info The shortcut to be edited + */ + void updateShortcut(final ShortcutInfo info) { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + View layout = mInflater.inflate(R.layout.dialog_edit, null); + ImageView icon = (ImageView) layout.findViewById(R.id.dialog_edit_icon); + icon.setImageBitmap(info.getIcon(mIconCache)); + final EditText title = (EditText) layout.findViewById(R.id.dialog_edit_text); + title.setText(info.title); + builder.setView(layout) + .setTitle(info.title) + .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + info.setTitle(title.getText()); + LauncherModel.updateItemInDatabase(Launcher.this, info); + } + }) + .setNegativeButton(android.R.string.cancel, null); + builder.show(); + } + + /** * Creates a view representing a shortcut. * * @param info The data structure describing the shortcut. |