use of com.taobao.weex.common.Destroyable in project weex-example by KalicyZhou.
the class WXModuleManager method destroyInstanceModules.
public static void destroyInstanceModules(String instanceId) {
sDomModuleMap.remove(instanceId);
Map<String, WXModule> moduleMap = sInstanceModuleMap.remove(instanceId);
if (moduleMap == null || moduleMap.size() < 1) {
return;
}
Iterator<Entry<String, WXModule>> iterator = moduleMap.entrySet().iterator();
Entry<String, WXModule> entry;
while (iterator.hasNext()) {
entry = iterator.next();
WXModule module = entry.getValue();
if (module instanceof Destroyable) {
((Destroyable) module).destroy();
}
}
}
use of com.taobao.weex.common.Destroyable in project weex-example by KalicyZhou.
the class WXSDKInstance method destroyView.
private void destroyView(View rootView) {
try {
if (rootView instanceof ViewGroup) {
ViewGroup cViewGroup = ((ViewGroup) rootView);
for (int index = 0; index < cViewGroup.getChildCount(); index++) {
destroyView(cViewGroup.getChildAt(index));
}
cViewGroup.removeViews(0, ((ViewGroup) rootView).getChildCount());
// Ensure that the viewgroup's status to be normal
WXReflectionUtils.setValue(rootView, "mChildrenCount", 0);
}
if (rootView instanceof Destroyable) {
((Destroyable) rootView).destroy();
}
} catch (Exception e) {
WXLogUtils.e("WXSDKInstance destroyView Exception: ", e);
}
}
Aggregations