From: Soren Stoutner Date: Thu, 22 Apr 2021 22:34:38 +0000 (-0700) Subject: Prevent tapping on the bookmarks header from activating the buttons beneath it. https... X-Git-Tag: v3.8~10 X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff_plain;h=af8631a31e1eeec0cb3e102f33c27008b93e6c80;hp=8d4d8f41d729dd0354d12fd99bd7d91b436feee5 Prevent tapping on the bookmarks header from activating the buttons beneath it. https://redmine.stoutner.com/issues/622 --- 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 d47cb5ae..bc31f566 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -3110,7 +3110,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook break; } } - + + // Remove the warning that `OnTouchListener()` needs to override `performClick()`, as the only purpose of setting the `OnTouchListener()` is to make it do nothing. + @SuppressLint("ClickableViewAccessibility") private void initializeApp() { // Get a handle for the input method. InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); @@ -3220,6 +3222,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook this.registerReceiver(orbotStatusBroadcastReceiver, new IntentFilter("org.torproject.android.intent.action.STATUS")); // Get handles for views that need to be modified. + LinearLayout bookmarksHeaderLinearLayout = findViewById(R.id.bookmarks_header_linearlayout); ListView bookmarksListView = findViewById(R.id.bookmarks_drawer_listview); FloatingActionButton launchBookmarksActivityFab = findViewById(R.id.launch_bookmarks_activity_fab); FloatingActionButton createBookmarkFolderFab = findViewById(R.id.create_bookmark_folder_fab); @@ -3286,6 +3289,12 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } }); + // Set a touch listener on the bookmarks header linear layout so that touches don't pass through to the button underneath. + bookmarksHeaderLinearLayout.setOnTouchListener((view, motionEvent) -> { + // Consume the touch. + return true; + }); + // Set the launch bookmarks activity FAB to launch the bookmarks activity. launchBookmarksActivityFab.setOnClickListener(v -> { // Get a copy of the favorite icon bitmap. diff --git a/app/src/main/res/layout-w900dp/bookmarks_drawer.xml b/app/src/main/res/layout-w900dp/bookmarks_drawer.xml index 9ff91e7c..03c30f36 100644 --- a/app/src/main/res/layout-w900dp/bookmarks_drawer.xml +++ b/app/src/main/res/layout-w900dp/bookmarks_drawer.xml @@ -36,6 +36,7 @@