use of com.taobao.weex.ui.component.WXComponent in project weex-example by KalicyZhou.
the class WXRenderStatement method generateComponentTree.
private WXComponent generateComponentTree(WXDomObject dom, WXVContainer parent) {
if (dom == null) {
return null;
}
WXComponent component = WXComponentFactory.newInstance(mWXSDKInstance, dom, parent);
mRegistry.put(dom.getRef(), component);
if (component instanceof WXVContainer) {
WXVContainer parentC = (WXVContainer) component;
int count = dom.childCount();
WXDomObject child = null;
for (int i = 0; i < count; ++i) {
child = dom.getChild(i);
if (child != null) {
parentC.addChild(generateComponentTree(child, parentC));
}
}
}
return component;
}
use of com.taobao.weex.ui.component.WXComponent in project weex-example by KalicyZhou.
the class WXRenderStatement method updateStyle.
/**
* @see com.taobao.weex.dom.WXDomStatement#updateStyle(String, JSONObject)
*/
void updateStyle(String ref, Map<String, Object> style) {
WXComponent component = mRegistry.get(ref);
if (component == null) {
return;
}
component.updateProperties(style);
}
use of com.taobao.weex.ui.component.WXComponent in project weex-example by KalicyZhou.
the class WXRenderStatement method move.
/**
* @see com.taobao.weex.dom.WXDomStatement#moveDom(String, String, int)
*/
void move(String ref, String parentRef, int index) {
WXComponent component = mRegistry.get(ref);
WXComponent newParent = mRegistry.get(parentRef);
if (component == null || component.getParent() == null || newParent == null || !(newParent instanceof WXVContainer)) {
return;
}
WXVContainer oldParent = component.getParent();
oldParent.remove(component, false);
((WXVContainer) newParent).addChild(component, index);
}
use of com.taobao.weex.ui.component.WXComponent in project weex-example by KalicyZhou.
the class WXScrollView method procSticky.
private View procSticky(Map<String, HashMap<String, WXComponent>> mStickyMap) {
if (mStickyMap == null) {
return null;
}
HashMap<String, WXComponent> stickyMap = mStickyMap.get(mWAScroller.getRef());
if (stickyMap == null) {
return null;
}
Iterator<Entry<String, WXComponent>> iterator = stickyMap.entrySet().iterator();
Entry<String, WXComponent> entry = null;
WXComponent stickyData;
while (iterator.hasNext()) {
entry = iterator.next();
stickyData = entry.getValue();
getLocationOnScreen(stickyScrollerP);
stickyData.getHostView().getLocationOnScreen(stickyViewP);
int parentH = 0;
if (stickyData.getParent() != null && stickyData.getParent().getRealView() != null) {
parentH = stickyData.getParent().getRealView().getHeight();
}
int stickyViewH = stickyData.getHostView().getHeight();
int stickyShowPos = stickyScrollerP[1];
int stickyStartHidePos = -parentH + stickyScrollerP[1] + stickyViewH;
if (stickyViewP[1] <= stickyShowPos && stickyViewP[1] >= (stickyStartHidePos - stickyViewH)) {
mStickyOffset = stickyViewP[1] - stickyStartHidePos;
stickyData.setStickyOffset(stickyViewP[1] - stickyScrollerP[1]);
return stickyData.getHostView();
} else {
stickyData.setStickyOffset(0);
}
}
return null;
}
use of com.taobao.weex.ui.component.WXComponent in project weex-example by KalicyZhou.
the class BasicListComponent method onBindViewHolder.
/**
* Bind the component of the position to the holder. Then flush the view.
*
* @param holder viewHolder, which holds reference to the view
* @param position position of component in WXListComponent
*/
@Override
public void onBindViewHolder(ListBaseViewHolder holder, int position) {
if (holder == null)
return;
holder.setComponentUsing(true);
WXComponent component = getChild(position);
if (component == null || (component instanceof WXRefresh) || (component instanceof WXLoading) || (component.getDomObject() != null && component.getDomObject().isFixed())) {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.d(TAG, "Bind WXRefresh & WXLoading " + holder);
}
return;
}
if (holder.getComponent() != null && holder.getComponent() instanceof WXCell) {
holder.getComponent().bindData(component);
// holder.getComponent().refreshData(component);
}
}
Aggregations