Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[Android] Add "isDragging" property to scroll event of a list compone…
Browse files Browse the repository at this point in the history
…nt. (#2264)

* feature: Add "isDragging" property to scroll event of a list component.
* doc pr: apache/incubator-weex-site#361
  • Loading branch information
sunshl authored and YorkShen committed Apr 1, 2019
1 parent 857c463 commit 04af94a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public interface Name {
String OFFSET_ACCURACY = "offsetAccuracy";
String CONTENT_SIZE = "contentSize";
String CONTENT_OFFSET = "contentOffset";
String ISDRAGGING = "isDragging";
String X = "x";
String Y = "y";
String RETURN_KEY_TYPE = "returnKeyType";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1369,9 +1369,9 @@ public Map<String, Object> getScrollEvent(RecyclerView recyclerView, int offsetX
}
}

Map<String, Object> event = new HashMap<>(2);
Map<String, Object> contentSize = new HashMap<>(2);
Map<String, Object> contentOffset = new HashMap<>(2);
Map<String, Object> event = new HashMap<>(3);
Map<String, Object> contentSize = new HashMap<>(3);
Map<String, Object> contentOffset = new HashMap<>(3);

contentSize.put(Constants.Name.WIDTH, WXViewUtils.getWebPxByWidth(contentWidth, getInstance().getInstanceViewPortWidth()));
contentSize.put(Constants.Name.HEIGHT, WXViewUtils.getWebPxByWidth(contentHeight, getInstance().getInstanceViewPortWidth()));
Expand All @@ -1380,6 +1380,7 @@ public Map<String, Object> getScrollEvent(RecyclerView recyclerView, int offsetX
contentOffset.put(Constants.Name.Y, - WXViewUtils.getWebPxByWidth(offsetY, getInstance().getInstanceViewPortWidth()));
event.put(Constants.Name.CONTENT_SIZE, contentSize);
event.put(Constants.Name.CONTENT_OFFSET, contentOffset);
event.put(Constants.Name.ISDRAGGING, recyclerView.getScrollState() == RecyclerView.SCROLL_STATE_DRAGGING);
return event;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1205,9 +1205,9 @@ public Map<String, Object> getScrollEvent(RecyclerView recyclerView, int offsetX
int contentWidth = recyclerView.getMeasuredWidth() + recyclerView.computeHorizontalScrollRange();
int contentHeight = calcContentSize();

Map<String, Object> event = new HashMap<>(2);
Map<String, Object> contentSize = new HashMap<>(2);
Map<String, Object> contentOffset = new HashMap<>(2);
Map<String, Object> event = new HashMap<>(3);
Map<String, Object> contentSize = new HashMap<>(3);
Map<String, Object> contentOffset = new HashMap<>(3);

contentSize.put(Constants.Name.WIDTH, WXViewUtils.getWebPxByWidth(contentWidth, getInstance().getInstanceViewPortWidth()));
contentSize.put(Constants.Name.HEIGHT, WXViewUtils.getWebPxByWidth(contentHeight, getInstance().getInstanceViewPortWidth()));
Expand All @@ -1216,6 +1216,7 @@ public Map<String, Object> getScrollEvent(RecyclerView recyclerView, int offsetX
contentOffset.put(Constants.Name.Y, - WXViewUtils.getWebPxByWidth(offsetY, getInstance().getInstanceViewPortWidth()));
event.put(Constants.Name.CONTENT_SIZE, contentSize);
event.put(Constants.Name.CONTENT_OFFSET, contentOffset);
event.put(Constants.Name.ISDRAGGING, recyclerView.getScrollState() == RecyclerView.SCROLL_STATE_DRAGGING);
return event;
}

Expand Down

0 comments on commit 04af94a

Please sign in to comment.