use of com.taobao.luaview.userdata.ui.UDViewGroup in project LuaViewSDK by alibaba.
the class LVPageFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//View封装
//TODO 为什么用mLuaUserData.getmetatable()不行
final UDView page = new UDViewGroup(createPageLayout(), mGlobals, null);
//对外数据封装,必须使用LuaTable
final UDLuaTable pageData = new UDLuaTable(page);
final View pageView = pageData.getView();
//初始化View
initView(pageData, mPosInViewPager);
//绘制数据
renderView(pageData, mPosInViewPager);
return pageView;
}
use of com.taobao.luaview.userdata.ui.UDViewGroup in project LuaViewSDK by alibaba.
the class LVRecyclerViewAdapter method createItemView.
/**
* create item view for view holder
*
* @param viewType
* @return
*/
private View createItemView(final int viewType) {
final UDViewGroup layout = new UDViewGroup(createLayout(), mGlobals, null);
//对外数据封装,必须使用LuaTable
final UDLuaTable cellData = new UDLuaTable(layout);
View itemView = null;
//View封装
if (this.mLuaUserData.hasCellSize(viewType)) {
//有Size的定义
final LVViewGroup cellView = createLayout();
View tmpView = layout.getView();
if (tmpView != null) {
cellView.addView(tmpView);
}
itemView = cellView;
} else {
itemView = layout.getView();
}
itemView.setTag(Constants.RES_LV_TAG, cellData);
return itemView;
}
use of com.taobao.luaview.userdata.ui.UDViewGroup in project LuaViewSDK by alibaba.
the class LVCustomViewPagerIndicator method createView.
/**
* create view
*
* @param pos
* @return
*/
private LuaValue createView(int pos, int currentItem) {
Globals globals = this.mLuaUserdata.getGlobals();
//View封装
final LVViewGroup container = createCellLayout();
final UDViewGroup cell = new UDViewGroup(container, globals, null);
//对外数据封装,必须使用LuaTable
final UDLuaTable cellData = new UDLuaTable(cell);
//call init
globals.saveContainer(container);
//初始化
this.mLuaUserdata.callCellInit(cellData, pos, currentItem);
globals.restoreContainer();
//set tag
View view = cellData.getView();
if (view != null) {
view.setTag(Constants.RES_LV_TAG, cellData);
}
return cellData;
}
use of com.taobao.luaview.userdata.ui.UDViewGroup in project LuaViewSDK by alibaba.
the class LVListViewAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// LogUtil.d("yesong", position, convertView, getItemViewType(position), getViewTypeCount());
//数据封装
UDLuaTable cellData = null;
final int viewType = getItemViewType(position);
final boolean hasCellSize = this.mLuaUserData.hasCellSize(position);
if (convertView == null || ((UDLuaTable) convertView.getTag()).get(KEY_VIEW_TYPE) != LuaValue.valueOf(viewType)) {
//在内部创建好Cell
//TODO 为什么用mLuaUserData.getmetatable()不行
UDView layout = new UDViewGroup(createLayout(), mGlobals, null);
//对外数据封装,必须使用LuaTable
cellData = new UDLuaTable(layout);
//View封装
if (hasCellSize) {
//有Size的定义
final LVViewGroup cellView = createLayout();
View tmp = layout.getView();
if (tmp != null) {
cellView.addView(tmp);
}
convertView = cellView;
} else {
convertView = layout.getView();
}
initView(cellData, position);
convertView.setTag(cellData);
} else {
cellData = (UDLuaTable) convertView.getTag();
}
//更新position
cellData.set(KEY_VIEW_TYPE, viewType);
if (hasCellSize) {
//有Size的定义,每次更新size
//TODO 需要动态更新View的Size,需要在这里调用,否则移动到初始化的时候。这个暂时先去掉,会有问题,复用有问题
initCellSize(cellData, position);
}
//绘制数据
renderView(cellData, position);
return convertView;
}
use of com.taobao.luaview.userdata.ui.UDViewGroup in project LuaViewSDK by alibaba.
the class LVPagerAdapter method newItem.
public Object newItem(ViewGroup container, int position) {
//View封装
//TODO 为什么用mLuaUserData.getmetatable()不行
final UDView page = new UDViewGroup(createPageLayout(), mGlobals, null);
//对外数据封装,必须使用LuaTable
final UDLuaTable pageData = new UDLuaTable(page);
final View pageView = pageData.getView();
//添加view
if (container != null && pageView != null) {
container.addView(pageView);
}
//初始化View
initView(pageData, position);
//绘制数据
renderView(pageData, position);
//add to list
mViews.put(position, new WeakReference<View>(pageView));
return pageView;
}
Aggregations