37 public static final String TAG =
"ShortcutsActivity";
39 @Override
public void onCreate(Bundle savedInstanceState)
42 super.onCreate(savedInstanceState);
44 Intent intent = getIntent();
45 if (Intent.ACTION_CREATE_SHORTCUT.equals(intent.getAction()))
48 getListView().setOnItemClickListener(
new AdapterView.OnItemClickListener() {
49 public void onItemClick(AdapterView<?> parent, View view, int position, long id)
51 String refStr = view.getTag().toString();
53 ((TextView)(view.findViewById(R.id.bookmark_text1))).getText().toString();
54 setupShortcut(refStr, defLabel);
65 @Override
public void onResume()
69 ArrayList<BookmarkBase> bookmarks = GlobalApp.getManualBookmarkGateway().findAll();
70 BookmarkArrayAdapter bookmarkAdapter =
71 new BookmarkArrayAdapter(
this, android.R.layout.simple_list_item_2, bookmarks);
72 getListView().setAdapter(bookmarkAdapter);
78 getListView().setAdapter(
null);
109 private void setupShortcut(String strRef, String defaultLabel)
111 final String paramStrRef = strRef;
112 final String paramDefaultLabel = defaultLabel;
113 final Context paramContext =
this;
116 final EditText input =
new EditText(
this);
117 input.setText(defaultLabel);
119 AlertDialog.Builder builder =
new AlertDialog.Builder(
this);
120 builder.setTitle(R.string.dlg_title_create_shortcut)
121 .setMessage(R.string.dlg_msg_create_shortcut)
125 new DialogInterface.OnClickListener() {
126 @Override public void onClick(DialogInterface dialog, int which)
128 String label = input.getText().toString();
129 if (label.length() == 0)
130 label = paramDefaultLabel;
132 Intent shortcutIntent = new Intent(Intent.ACTION_VIEW);
133 shortcutIntent.setClassName(paramContext,
134 SessionRequestHandlerActivity.class.getName());
135 shortcutIntent.setData(Uri.parse(paramStrRef));
138 Intent intent = new Intent();
139 intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
140 intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, label);
141 Parcelable iconResource = Intent.ShortcutIconResource.fromContext(
142 paramContext, R.drawable.icon_launcher_freerdp);
143 intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);
146 setResult(RESULT_OK, intent);
150 .setNegativeButton(android.R.string.cancel,
151 new DialogInterface.OnClickListener() {
152 @Override public void onClick(DialogInterface dialog, int which)