• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WXRecyclerView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.taobao.weex.ui.view.listview.WXRecyclerView的典型用法代码示例。如果您正苦于以下问题:Java WXRecyclerView类的具体用法?Java WXRecyclerView怎么用?Java WXRecyclerView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WXRecyclerView类属于com.taobao.weex.ui.view.listview包,在下文中一共展示了WXRecyclerView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getLayoutType

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
public int getLayoutType(){
  Object obj = get(Constants.Name.LAYOUT);
  if (obj == null) {
    return WXRecyclerView.TYPE_LINEAR_LAYOUT;
  }

  try {
    switch(String.valueOf(obj)){
      case Constants.Value.MULTI_COLUMN :
        return  WXRecyclerView.TYPE_STAGGERED_GRID_LAYOUT;
      case Constants.Value.GRID :
        return  WXRecyclerView.TYPE_GRID_LAYOUT;
      default:
        return WXRecyclerView.TYPE_LINEAR_LAYOUT;
    }
  } catch (Exception e) {
    WXLogUtils.e("[WXAttr] getLayoutType:", e);
  }
  return WXRecyclerView.TYPE_LINEAR_LAYOUT;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:21,代码来源:WXAttr.java


示例2: updateProperties

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@Override
public void updateProperties(Map<String, Object> props) {
  super.updateProperties(props);
  if(props.containsKey(Constants.Name.PADDING)
          ||props.containsKey(Constants.Name.PADDING_LEFT)
          || props.containsKey(Constants.Name.PADDING_RIGHT)){

    if(mPaddingLeft !=mDomObject.getPadding().get(Spacing.LEFT)
            || mPaddingRight !=mDomObject.getPadding().get(Spacing.RIGHT)) {

      markComponentUsable();
      updateRecyclerAttr();
      WXRecyclerView wxRecyclerView = getHostView().getInnerView();
      wxRecyclerView.initView(getContext(), mLayoutType, mColumnCount, mColumnGap, getOrientation());
    }
  }

}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:19,代码来源:WXListComponent.java


示例3: onHostViewInitialized

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@Override
protected void onHostViewInitialized(T host) {
  super.onHostViewInitialized(host);

  WXRecyclerView recyclerView = host.getInnerView();
  if (recyclerView == null || recyclerView.getAdapter() == null) {
    WXLogUtils.e(TAG, "RecyclerView is not found or Adapter is not bound");
    return;
  }

  if (mChildren == null) {
    WXLogUtils.e(TAG, "children is null");
    return;
  }

  mDragHelper = new DefaultDragHelper(mChildren, recyclerView, new EventTrigger() {
    @Override
    public void triggerEvent(String type, Map<String, Object> args) {
      fireEvent(type, args);
    }
  });

  mTriggerType = getTriggerType(getDomObject());
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:25,代码来源:BasicListComponent.java


示例4: scrollTo

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@Override
public void scrollTo(WXComponent component,final int offset) {
  if(bounceRecyclerView == null){
    return;
  }

  WXComponent parent = component;
  WXCell cell = null;
  while(parent != null){
    if(parent instanceof WXCell){
      cell = (WXCell) parent;
      break;
    }
    parent = parent.getParent();
  }
  if(cell !=null){
    int pos = mChildren.indexOf(cell);
    final WXRecyclerView view = bounceRecyclerView.getInnerView();
    view.scrollToPosition(pos);
    final WXComponent cellComp = cell;
    //scroll cell to top
    view.postDelayed(new Runnable() {
      @Override
      public void run() {
        if(getOrientation() == Constants.Orientation.VERTICAL){
          int scrollY = cellComp.getHostView().getTop()+offset;
          view.smoothScrollBy(0,scrollY );
        }else{
          int  scrollX = cellComp.getHostView().getLeft()+offset;
          view.smoothScrollBy(scrollX,0);
        }
      }
    },50);

    onPostScrollToPosition(pos);
  }

}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:39,代码来源:WXListComponent.java


示例5: findFirstListByRootView

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
public static View findFirstListByRootView(View  rootView){
    View firstListView = null;
    if(null != rootView){
        allViews = ViewUtil.getAllChildViews(rootView);
        for (View view:allViews
                ) {
            if(view instanceof WXRecyclerView){
                firstListView = view;
                break;
            }
        }
    }
    return firstListView;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:15,代码来源:ScreenShot.java


示例6: WXListComponent

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
public WXListComponent(WXSDKInstance instance, WXDomObject node, WXVContainer parent, boolean lazy) {
  super(instance, node, parent);
  if (node != null && node instanceof WXRecyclerDomObject) {
    mDomObject = (WXRecyclerDomObject) node;
    mDomObject.preCalculateCellWidth();

    if(WXBasicComponentType.WATERFALL.equals(node.getType())){
      mLayoutType = WXRecyclerView.TYPE_STAGGERED_GRID_LAYOUT;
    }else{
      mLayoutType = mDomObject.getLayoutType();
    }
    updateRecyclerAttr();

  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:16,代码来源:WXListComponent.java


示例7: setColumnWidth

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@WXComponentProp(name = Constants.Name.COLUMN_WIDTH)
public void setColumnWidth(int columnCount)  {
  if(mDomObject.getColumnWidth() != mColumnWidth){
    markComponentUsable();
    updateRecyclerAttr();
    WXRecyclerView wxRecyclerView = getHostView().getInnerView();
    wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:10,代码来源:WXListComponent.java


示例8: setColumnCount

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@WXComponentProp(name = Constants.Name.COLUMN_COUNT)
public void setColumnCount(int columnCount){
  if(mDomObject.getColumnCount() != mColumnCount){
    markComponentUsable();
    updateRecyclerAttr();
    WXRecyclerView wxRecyclerView = getHostView().getInnerView();
    wxRecyclerView.initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:10,代码来源:WXListComponent.java


示例9: setColumnGap

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@WXComponentProp(name = Constants.Name.COLUMN_GAP)
public void setColumnGap(float columnGap) throws InterruptedException {
  if(mDomObject.getColumnGap() != mColumnGap) {
    markComponentUsable();
    updateRecyclerAttr();
    WXRecyclerView wxRecyclerView = getHostView().getInnerView();
    wxRecyclerView.initView(getContext(), mLayoutType, mColumnCount, mColumnGap, getOrientation());
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:10,代码来源:WXListComponent.java


示例10: setScrollable

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@WXComponentProp(name = Constants.Name.SCROLLABLE)
public void setScrollable(boolean scrollable) {
  this.isScrollable = scrollable;
  WXRecyclerView inner = getHostView().getInnerView();
  if(inner != null) {
    inner.setScrollable(scrollable);
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:9,代码来源:BasicListComponent.java


示例11: setScrollable

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@WXComponentProp(name = Constants.Name.SCROLLABLE)
public void setScrollable(boolean scrollable) {
  View inner = getHostView().getInnerView();
  if (inner instanceof WXRecyclerView) {
    ((WXRecyclerView) inner).setScrollable(scrollable);
  }
  ;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:9,代码来源:BasicListComponent.java


示例12: computeComponentContentHeight

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
static int computeComponentContentHeight(@NonNull WXComponent component) {
    View view = component.getHostView();
    if(view == null) {
        return 0;
    }
    if(component instanceof WXListComponent) {
        WXListComponent listComponent = (WXListComponent) component;
        BounceRecyclerView bounceRecyclerView = listComponent.getHostView();
        if(bounceRecyclerView == null) {
            return 0;
        }
        WXRecyclerView innerView = bounceRecyclerView.getInnerView();
        if(innerView == null) {
            return bounceRecyclerView.getMeasuredHeight();
        } else {
            return innerView.computeVerticalScrollRange();
        }
    } else if(component instanceof WXScroller) {
        WXScroller scroller = (WXScroller) component;
        if(!ViewUtils.isVerticalScroller(scroller)) {
            return view.getMeasuredHeight();
        }
        ViewGroup group = scroller.getInnerView();
        if(group == null) {
            return view.getMeasuredHeight();
        }
        if(group.getChildCount() != 1) {
            return view.getMeasuredHeight();
        } else {
            return group.getChildAt(0).getMeasuredHeight();
        }
    } else {
        return view.getMeasuredHeight();
    }
}
 
开发者ID:weexteam,项目名称:weex-analyzer-android,代码行数:36,代码来源:ComponentHeightComputer.java


示例13: setInnerView

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@Override
public WXRecyclerView setInnerView(Context context) {
  WXRecyclerView wxRecyclerView = new WXRecyclerView(context);
  wxRecyclerView.initView(context, WXRecyclerView.TYPE_LINEAR_LAYOUT, getOrientation());
  return wxRecyclerView;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:7,代码来源:BounceRecyclerView.java


示例14: setInnerView

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@Override
public WXRecyclerView setInnerView(Context context) {
  WXRecyclerView wxRecyclerView = new WXRecyclerView(context);
  wxRecyclerView.initView(context, mLayoutType,mColumnCount,mColumnGap,getOrientation());
  return wxRecyclerView;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:7,代码来源:BounceRecyclerView.java


示例15: getInnerView

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@Override
public WXRecyclerView getInnerView() {
  return this;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:5,代码来源:SimpleRecyclerView.java


示例16: generateListView

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@Override
protected SimpleRecyclerView generateListView(Context context, int orientation) {
  return generateListView(context,WXRecyclerView.TYPE_LINEAR_LAYOUT,orientation);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:5,代码来源:SimpleListComponent.java


示例17: setScrollable

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@WXComponentProp(name = Constants.Name.SCROLLABLE)
public void setScrollable(boolean scrollable) {
  WXRecyclerView inner = getHostView().getInnerView();
  inner.setScrollable(scrollable);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:6,代码来源:WXListComponent.java


示例18: scrollTo

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@Override
public void scrollTo(WXComponent component, Map<String, Object> options) {
  float offsetFloat = 0;
  boolean smooth = true;

  if (options != null) {
    String offsetStr = options.get(Constants.Name.OFFSET) == null ? "0" : options.get(Constants.Name.OFFSET).toString();
    smooth = WXUtils.getBoolean(options.get(Constants.Name.ANIMATED), true);
    if (offsetStr != null) {
      try {
        offsetFloat = WXViewUtils.getRealPxByWidth(Float.parseFloat(offsetStr), getInstance().getInstanceViewPortWidth());
      }catch (Exception e ){
        WXLogUtils.e("Float parseFloat error :"+e.getMessage());
      }
    }
  }

  final int offset = (int) offsetFloat;

  T bounceRecyclerView = getHostView();
  if (bounceRecyclerView == null) {
    return;
  }

  WXComponent parent = component;
  WXCell cell = null;
  while (parent != null) {
    if (parent instanceof WXCell) {
      cell = (WXCell) parent;
      break;
    }
    parent = parent.getParent();
  }

  if (cell != null) {
    final int pos = mChildren.indexOf(cell);
    final WXRecyclerView view = bounceRecyclerView.getInnerView();

    if (!smooth) {
      RecyclerView.LayoutManager layoutManager = view.getLayoutManager();
      if (layoutManager instanceof LinearLayoutManager) {
        //GridLayoutManager is also instance of LinearLayoutManager
        ((LinearLayoutManager) layoutManager).scrollToPositionWithOffset(pos, -offset);
      } else if (layoutManager instanceof StaggeredGridLayoutManager) {
        ((StaggeredGridLayoutManager) layoutManager).scrollToPositionWithOffset(pos, -offset);
      }
      //Any else?
    } else {
      view.smoothScrollToPosition(pos);
      if (offset != 0) {
        view.addOnScrollListener(new RecyclerView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            if (newState == RecyclerView.SCROLL_STATE_IDLE) {
              if (getOrientation() == Constants.Orientation.VERTICAL) {
                recyclerView.smoothScrollBy(0, offset);
              } else {
                recyclerView.smoothScrollBy(offset, 0);
              }
              recyclerView.removeOnScrollListener(this);
            }
          }
        });
      }
    }
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:68,代码来源:BasicListComponent.java


示例19: addEvent

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@Override
  public void addEvent(String type) {
    super.addEvent(type);
    if (Constants.Event.SCROLL.equals(type) && getHostView() != null && getHostView().getInnerView() != null) {
      WXRecyclerView innerView = getHostView().getInnerView();
      innerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        private int offsetXCorrection, offsetYCorrection;
        private boolean mFirstEvent = true;

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
          super.onScrolled(recyclerView, dx, dy);
//          WXLogUtils.e("SCROLL", dx + ", " + dy + ", " + recyclerView.computeHorizontalScrollRange()
//          + ", " + recyclerView.computeVerticalScrollRange()
//          + ", " + recyclerView.computeHorizontalScrollOffset()
//          + ", " + recyclerView.computeVerticalScrollOffset());

          int offsetX = recyclerView.computeHorizontalScrollOffset();
          int offsetY = recyclerView.computeVerticalScrollOffset();

          if (dx == 0 && dy == 0) {
            offsetXCorrection = offsetX;
            offsetYCorrection = offsetY;
            offsetX = 0;
            offsetY = 0;
          } else {
            offsetX = offsetX - offsetXCorrection;
            offsetY = offsetY - offsetYCorrection;
          }

          if (mFirstEvent) {
            //skip first event
            mFirstEvent = false;
            return;
          }

          if (shouldReport(offsetX, offsetY)) {
            fireScrollEvent(recyclerView, offsetX, offsetY);
          }
        }
      });
    }
  }
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:44,代码来源:BasicListComponent.java


示例20: generateListView

import com.taobao.weex.ui.view.listview.WXRecyclerView; //导入依赖的package包/类
@Override
protected SimpleRecyclerView generateListView(Context context, int orientation) {
  SimpleRecyclerView view = new SimpleRecyclerView(context);
  view.initView(context, WXRecyclerView.TYPE_LINEAR_LAYOUT, orientation);
  return view;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:7,代码来源:SimpleListComponent.java



注:本文中的com.taobao.weex.ui.view.listview.WXRecyclerView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MockService类代码示例发布时间:2022-05-23
下一篇:
Java AppearancePreferencePage类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap