Niedzielski has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/238665

Change subject: Allow scrolling when dragging across lead text
......................................................................

Allow scrolling when dragging across lead text

TLDR: Disable text selection of title and subtitle TextViews so the
WebView can handle the touch events.

The lead title and subtitle TextViews allowed text selections. Text
selection was desirable but had the side effect of stealing the scroll
touch events from the WebView.

As a work around, I tried always returning false in
TextView.onTouchEvent() but while this allowed both text selection and
scrolling, it more often than not allowed both to occur simultaneously
which was a poor experience.

The proper implementation seems to be to put the title container within
the WebView (a ViewGroup, after all), or to create a reusable "TouchFilter"
ViewGroup and wrap the WebView and title container, and implement
ScrollView-like functionality. I tried this approach from a couple tacts
but it proved nontrivial to implement natural scrolling robustly.

In one approach, I used SimpleOnGestureListener in
ViewGroup.onInterceptTouchEvent() to listen for scroll and fling events.
Since the TextViews don't scroll or fling, I would manually route these
to the appropriate scrollBy() / flingBy() methods on the WebView and
then intercept subsequent ACTION_MOVE events. This sort of worked but
just didn't feel right. The scrolling felt off because it happened once
in the OnGestureListener callback with any remaining scrolling happening
in ViewGroup.onTouchEvent().

In another approach, I recorded the y position on down events in
ViewGroup.onInterceptTouch(). In subsequent move events, I checked the y
against a scaled touch slop to determine if it was jitter or a scroll,
with the latter returning true. This sort of worked but suffered the
same unnatural feeling as the first.

Bug: T97504
Change-Id: I9e545c9a811840382ab11a022375bbcaf60825fd
---
M app/src/main/res/layout/fragment_page.xml
1 file changed, 0 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/65/238665/1

diff --git a/app/src/main/res/layout/fragment_page.xml 
b/app/src/main/res/layout/fragment_page.xml
index e5c6c47..c720424 100644
--- a/app/src/main/res/layout/fragment_page.xml
+++ b/app/src/main/res/layout/fragment_page.xml
@@ -67,7 +67,6 @@
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
                             style="@style/RtlAwareTextView"
-                            android:textIsSelectable="true"
                             android:fontFamily="serif"
                             android:paddingTop="16dp"
                             
android:paddingRight="@dimen/activity_horizontal_margin"
@@ -79,7 +78,6 @@
                             style="@style/RtlAwareTextView"
                             android:layout_gravity="bottom"
                             android:visibility="invisible"
-                            android:textIsSelectable="true"
                             android:fontFamily="serif"
                             android:textSize="@dimen/descriptionTextSize"
                             android:paddingBottom="16dp"

-- 
To view, visit https://gerrit.wikimedia.org/r/238665
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9e545c9a811840382ab11a022375bbcaf60825fd
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to