Dbrant has uploaded a new change for review.
https://gerrit.wikimedia.org/r/178206
Change subject: Fix scrolling in the "read more" list.
......................................................................
Fix scrolling in the "read more" list.
Also don't fetch images for list items if images are disabled in
preferences.
Bug: T76934
Change-Id: Ib1917c992d62f02af5137b53cead33b33d059f9b
---
M
wikipedia/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
1 file changed, 56 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia
refs/changes/06/178206/1
diff --git
a/wikipedia/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
b/wikipedia/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
index 3f05955..4f116f7 100644
---
a/wikipedia/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
+++
b/wikipedia/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
@@ -3,7 +3,9 @@
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
+import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.AdapterView;
@@ -61,7 +63,7 @@
private FullSearchArticlesTask.FullSearchResults readMoreItems;
public BottomContentHandler(final PageViewFragment parentFragment,
CommunicationBridge bridge,
- ObservableWebView webview, LinkHandler
linkHandler,
+ final ObservableWebView webview, LinkHandler
linkHandler,
ViewGroup hidingView, PageTitle pageTitle) {
this.parentFragment = parentFragment;
this.bridge = bridge;
@@ -79,6 +81,58 @@
pageLastUpdatedText =
(TextView)bottomContentContainer.findViewById(R.id.page_last_updated_text);
pageLicenseText =
(TextView)bottomContentContainer.findViewById(R.id.page_license_text);
readMoreList =
(ListView)bottomContentContainer.findViewById(R.id.read_more_list);
+
+ // set up pass-through scroll functionality for the ListView
+ readMoreList.setOnTouchListener(new View.OnTouchListener() {
+ private int touchSlop =
ViewConfiguration.get(parentFragment.getActivity())
+ .getScaledTouchSlop();
+ private boolean slopReached;
+ private boolean doingSlopEvent;
+ private boolean isPressed = false;
+ private float startY;
+ private float amountScrolled;
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ int action = event.getActionMasked() & MotionEvent.ACTION_MASK;
+ switch (action) {
+ case MotionEvent.ACTION_DOWN:
+ isPressed = true;
+ startY = event.getY();
+ amountScrolled = 0;
+ slopReached = false;
+ break;
+ case MotionEvent.ACTION_MOVE:
+ if (isPressed && !doingSlopEvent) {
+ int contentHeight =
(int)(webView.getContentHeight() * displayDensity);
+ int maxScroll = contentHeight -
webView.getScrollY()
+ - webView.getHeight();
+ int scrollAmount = Math.min((int) (startY -
event.getY()), maxScroll);
+ // manually scroll the WebView that's underneath
us...
+ webView.scrollBy(0, scrollAmount);
+ amountScrolled += scrollAmount;
+ if (Math.abs(amountScrolled) > touchSlop &&
!slopReached) {
+ slopReached = true;
+ // send an artificial Move event that scrolls
it by an amount
+ // that's greater than the touch slop, so that
the currently
+ // highlighted item is unselected.
+ MotionEvent moveEvent =
MotionEvent.obtain(event);
+ moveEvent.setLocation(event.getX(),
event.getY() + touchSlop * 2);
+ doingSlopEvent = true;
+ readMoreList.dispatchTouchEvent(moveEvent);
+ doingSlopEvent = false;
+ }
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_CANCEL:
+ isPressed = false;
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
+ });
funnel = new SuggestedPagesFunnel(app, pageTitle.getSite());
@@ -289,7 +343,7 @@
ImageView imageView = (ImageView)
convertView.findViewById(R.id.result_image);
String thumbnail = result.getThumbUrl();
- if (thumbnail == null) {
+ if (!app.showImages() || thumbnail == null) {
Picasso.with(parent.getContext())
.load(R.drawable.ic_pageimage_placeholder)
.into(imageView);
--
To view, visit https://gerrit.wikimedia.org/r/178206
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1917c992d62f02af5137b53cead33b33d059f9b
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits