From: Soren Stoutner Date: Sat, 6 Feb 2016 18:37:26 +0000 (-0700) Subject: Remove copy and paste menu items (they are now handled by SupportActionBar) and creat... X-Git-Tag: v1.0~6 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=90ec377a834698621227ec37ca7ed37ae7f69851;p=PrivacyBrowserAndroid.git Remove copy and paste menu items (they are now handled by SupportActionBar) and create a submenu for navagation items. --- diff --git a/app/src/main/java/com/stoutner/privacybrowser/MainWebView.java b/app/src/main/java/com/stoutner/privacybrowser/MainWebView.java index 4ca7320a..daaa58a8 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/MainWebView.java +++ b/app/src/main/java/com/stoutner/privacybrowser/MainWebView.java @@ -398,13 +398,10 @@ public class MainWebView extends AppCompatActivity implements CreateHomeScreenSh public boolean onOptionsItemSelected(MenuItem menuItem) { int menuItemId = menuItem.getItemId(); - // Some options need to access the clipboard. - ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); - // Some options need to update the drawable for toggleJavaScript. MenuItem toggleJavaScript = mainMenu.findItem(R.id.toggleJavaScript); - // Sets the commands that relate to the menu entries. + // Set the commands that relate to the menu entries. switch (menuItemId) { case R.id.toggleJavaScript: if (javaScriptEnabled) { @@ -532,6 +529,24 @@ public class MainWebView extends AppCompatActivity implements CreateHomeScreenSh Toast.makeText(getApplicationContext(), "Cookies deleted", Toast.LENGTH_SHORT).show(); return true; + case R.id.addToHomescreen: + // Show the CreateHomeScreenShortcut AlertDialog and name this instance createShortcut. + AppCompatDialogFragment shortcutDialog = new CreateHomeScreenShortcut(); + shortcutDialog.show(getSupportFragmentManager(), "createShortcut"); + + //Everything else will be handled by CreateHomeScreenShortcut and the associated listeners below. + return true; + + 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); + return true; + case R.id.home: mainWebView.loadUrl(homepage); return true; @@ -548,21 +563,7 @@ public class MainWebView extends AppCompatActivity implements CreateHomeScreenSh mainWebView.goForward(); return true; - case R.id.copyURL: - clipboard.setPrimaryClip(ClipData.newPlainText("URL", urlTextBox.getText())); - return true; - - case R.id.pasteURL: - ClipData.Item clipboardData = clipboard.getPrimaryClip().getItemAt(0); - urlTextBox.setText(clipboardData.coerceToText(this)); - try { - loadUrlFromTextBox(); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - return true; - - case R.id.shareURL: + case R.id.share: Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_TEXT, urlTextBox.getText().toString()); @@ -570,24 +571,6 @@ public class MainWebView extends AppCompatActivity implements CreateHomeScreenSh startActivity(Intent.createChooser(shareIntent, "Share URL")); return true; - case R.id.addToHomescreen: - // Show the CreateHomeScreenShortcut AlertDialog and name this instance createShortcut. - AppCompatDialogFragment shortcutDialog = new CreateHomeScreenShortcut(); - shortcutDialog.show(getSupportFragmentManager(), "createShortcut"); - - //Everything else will be handled by CreateHomeScreenShortcut and the associated listeners below. - return true; - - 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); - return true; - case R.id.settings: // Start the Settings activity. Intent intent = new Intent(this, Settings.class); diff --git a/app/src/main/res/layout/activity_webview.xml b/app/src/main/res/layout/activity_webview.xml index 93cab654..f50c3995 100644 --- a/app/src/main/res/layout/activity_webview.xml +++ b/app/src/main/res/layout/activity_webview.xml @@ -18,12 +18,14 @@ You should have received a copy of the GNU General Public License along with Privacy Browser. If not, see . --> + + android:layout_height="match_parent" + android:focusableInTouchMode="true" > - + diff --git a/app/src/main/res/menu/menu_webview.xml b/app/src/main/res/menu/menu_webview.xml index 29a57e55..92bd7c2f 100644 --- a/app/src/main/res/menu/menu_webview.xml +++ b/app/src/main/res/menu/menu_webview.xml @@ -27,13 +27,13 @@ @@ -41,7 +41,7 @@ --> @@ -49,95 +49,87 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e6d9c2fd..ea122f1e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -33,15 +33,14 @@ Cookies Clear DOM Storage Clear Cookies + Add to Home Screen + Downloads + Navigation Home Refresh Back Forward - Copy URL - Paste URL - Share URL - Add to Home Screen - Downloads + Share Settings About Clear and Exit