+
+ case R.id.copyURL:
+ // Make sure that actionBar is not null.
+ if (actionBar != null) {
+ EditText urlTextBox = (EditText) actionBar.getCustomView().findViewById(R.id.urlTextBox);
+ clipboard.setPrimaryClip(ClipData.newPlainText("URL", urlTextBox.getText()));
+ }
+ break;
+
+ case R.id.pasteURL:
+ // Make sure that actionBar is not null.
+ if (actionBar != null) {
+ ClipData.Item clipboardData = clipboard.getPrimaryClip().getItemAt(0);
+ EditText urlTextBox = (EditText) actionBar.getCustomView().findViewById(R.id.urlTextBox);
+ urlTextBox.setText(clipboardData.coerceToText(this));
+ try {
+ loadUrlFromTextBox();
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ }
+ break;
+
+ case R.id.shareURL:
+ // Make sure that actionBar is not null.
+ if (actionBar != null) {
+ EditText urlTextBox = (EditText) actionBar.getCustomView().findViewById(R.id.urlTextBox);
+ Intent shareIntent = new Intent();
+ shareIntent.setAction(Intent.ACTION_SEND);
+ shareIntent.putExtra(Intent.EXTRA_TEXT, urlTextBox.getText().toString());
+ shareIntent.setType("text/plain");
+ startActivity(Intent.createChooser(shareIntent, "Share URL"));
+ }
+ break;
+
+ case R.id.downloads:
+ // Launch the system Download Manager.
+ Intent downloadManangerIntent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS);
+
+ // Launch as a new task so that Download Manager and Privacy Browser show as separate windows in the recent tasks list.
+ downloadManangerIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
+ startActivity(downloadManangerIntent);