From dab795a417200c6094da1b1aa25c7bb3e638c686 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Wed, 25 Mar 2020 15:58:50 -0700 Subject: [PATCH] Add a Bookmarks entry to the options menu. https://redmine.stoutner.com/issues/507 --- .../activities/MainWebViewActivity.java | 11 ++ .../main/res/menu/webview_options_menu.xml | 116 +++++++++--------- 2 files changed, 72 insertions(+), 55 deletions(-) diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index 8034dd68..182a23f9 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -316,6 +316,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Remove the warning about needing to override `performClick()` when using an `OnTouchListener` with `WebView`. @SuppressLint("ClickableViewAccessibility") protected void onCreate(Bundle savedInstanceState) { + // Enable the drawing of the entire webpage. This makes it possible to save a website image. This must be done before anything else happens with the WebView. if (Build.VERSION.SDK_INT >= 21) { WebView.enableSlowWholeDocumentDraw(); } @@ -1003,6 +1004,16 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Consume the event. return true; + case R.id.bookmarks: + // Get a handle for the drawer layout. + DrawerLayout drawerLayout = findViewById(R.id.drawerlayout); + + // Open the bookmarks drawer. + drawerLayout.openDrawer(GravityCompat.END); + + // Consume the event. + return true; + case R.id.toggle_first_party_cookies: // Switch the first-party cookie status. cookieManager.setAcceptCookie(!cookieManager.acceptCookie()); diff --git a/app/src/main/res/menu/webview_options_menu.xml b/app/src/main/res/menu/webview_options_menu.xml index df2a6f20..a5c5f4f3 100644 --- a/app/src/main/res/menu/webview_options_menu.xml +++ b/app/src/main/res/menu/webview_options_menu.xml @@ -37,10 +37,16 @@ android:orderInCategory="200" app:showAsAction="never" /> + + @@ -48,14 +54,14 @@ @@ -63,33 +69,33 @@ @@ -97,56 +103,56 @@ @@ -155,7 +161,7 @@ @@ -163,25 +169,25 @@ @@ -190,14 +196,14 @@ @@ -205,79 +211,79 @@ @@ -286,71 +292,71 @@ @@ -358,13 +364,13 @@ @@ -372,26 +378,26 @@ @@ -399,12 +405,12 @@ \ No newline at end of file -- 2.45.2