use of com.taobao.luaview.userdata.ui.UDView in project LuaViewSDK by alibaba.
the class UIViewGroupMethodMapper method flexChildren.
/**
* Flexbox 设置childViews
*
* @param view
* @param varargs
* @return
*/
public LuaValue flexChildren(U view, Varargs varargs) {
ArrayList<UDView> flexChildren = new ArrayList<UDView>();
for (int i = 2; i <= varargs.narg(); i++) {
LuaValue luaValue = varargs.optvalue(i, null);
if (luaValue != null && luaValue instanceof UDView) {
flexChildren.add((UDView) luaValue);
}
}
view.setChildNodeViews(flexChildren);
return view;
}
use of com.taobao.luaview.userdata.ui.UDView 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.UDView in project LuaViewSDK by alibaba.
the class LVViewGroup method clearChildNodeViews.
private void clearChildNodeViews() {
if (mChildNodeViews == null) {
return;
}
int childNodeViewsCount = mChildNodeViews.size();
for (int i = 0; i < childNodeViewsCount; i++) {
UDView nodeView = mChildNodeViews.get(i);
View view = nodeView.getView();
removeView(view);
}
getCssNode().resetChildren();
}
use of com.taobao.luaview.userdata.ui.UDView in project LuaViewSDK by alibaba.
the class LVViewGroup method generateNodeViewTree.
private void generateNodeViewTree() {
if (mChildNodeViews == null) {
return;
}
int childNodeViewsCount = mChildNodeViews.size();
for (int i = 0; i < childNodeViewsCount; i++) {
UDView nodeView = mChildNodeViews.get(i);
View view = nodeView.getView();
LuaViewUtil.addView(this, view, null);
getCssNode().addChild(nodeView.getCssNode());
}
}
use of com.taobao.luaview.userdata.ui.UDView in project LuaViewSDK by alibaba.
the class DestroyUtil method onDestroyTable.
public static void onDestroyTable(LuaTable table) {
if (table != null) {
LuaValue isDestroy = table.get(KEY_DESTROY);
if (isDestroy == null || !LuaBoolean.TRUE.eq_b(isDestroy)) {
//标志位
table.set(KEY_DESTROY, LuaBoolean.TRUE);
LuaValue value = null;
View view = null;
for (LuaValue key : table.keys()) {
value = table.get(key);
if (value instanceof UDView) {
view = ((UDView) value).getView();
if (view instanceof ViewGroup) {
clearViews((ViewGroup) view);
} else {
((UDView) value).onDestroy();
}
} else if (value instanceof BaseUserdata) {
((BaseUserdata) value).onDestroy();
} else if (value instanceof LuaTable) {
onDestroyTable((LuaTable) value);
}
}
}
}
}
Aggregations