You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2019/03/11 08:46:52 UTC
[GitHub] [incubator-weex] win80540 commented on a change in pull request
#2198: [iOS][Android] fix scrollToElement performance incorrect offset
win80540 commented on a change in pull request #2198: [iOS][Android] fix scrollToElement performance incorrect offset
URL: https://github.com/apache/incubator-weex/pull/2198#discussion_r264131989
##########
File path: android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java
##########
@@ -482,44 +485,45 @@ public void onScrollChanged(WXHorizontalScrollView scrollView, int x, int y, int
scrollView.addView(mRealView, layoutParams);
scrollView.setHorizontalScrollBarEnabled(false);
mScrollerView = scrollView;
- final WXScroller component = this;
- final View.OnLayoutChangeListener listener = new View.OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View view, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
- final View frameLayout = view;
- scrollView.post(new Runnable() {
- @Override
- public void run() {
- if (isLayoutRTL()) {
- int mw = frameLayout.getMeasuredWidth();
- scrollView.scrollTo(mw, component.getScrollY());
- } else {
- boolean scrollToBegin = true;
- Object scrollToBeginOnLTR = getAttrs().get("scrollToBegin");
- if (scrollToBeginOnLTR instanceof String){
- if("false".equalsIgnoreCase((String)scrollToBeginOnLTR)){
- scrollToBegin = false;
- }
- }
- if (scrollToBegin){
- scrollView.scrollTo(0, component.getScrollY());
- }
+ final WXScroller component = this;
+ final View.OnLayoutChangeListener listener = new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View view, final int left, int top, final int right, int bottom, final int oldLeft, int oldTop, final int oldRight, int oldBottom) {
+ final View frameLayout = view;
+ scrollView.post(new Runnable() {
+ @Override
+ public void run() {
+ if (mIslastDirectionRTL != null && isLayoutRTL() != mIslastDirectionRTL.booleanValue()) {
Review comment:
if use boolean, default is false, is not what i want.
I need record direction when last layout change occur, it not always false, and i need distinct is layout change trigger first or not.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services