本文整理汇总了Java中com.taobao.weex.common.WXModule类的典型用法代码示例。如果您正苦于以下问题:Java WXModule类的具体用法?Java WXModule怎么用?Java WXModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WXModule类属于com.taobao.weex.common包,在下文中一共展示了WXModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findModule
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
private static WXModule findModule(String instanceId, String moduleStr,ModuleFactory factory) {
// find WXModule
WXModule wxModule = sGlobalModuleMap.get(moduleStr);
//not global module
if (wxModule == null) {
HashMap<String, WXModule> moduleMap = sInstanceModuleMap.get(instanceId);
if (moduleMap == null) {
moduleMap = new HashMap<>();
sInstanceModuleMap.put(instanceId, moduleMap);
}
// if cannot find the Module, create a new Module and save it
wxModule = moduleMap.get(moduleStr);
if (wxModule == null) {
try {
wxModule = factory.buildInstance();
} catch (Exception e) {
WXLogUtils.e(moduleStr + " module build instace failed.", e);
return null;
}
moduleMap.put(moduleStr, wxModule);
}
}
return wxModule;
}
示例2: destroyInstanceModules
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
public static void destroyInstanceModules(String instanceId) {
HashMap<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();
}
}
}
示例3: onActivityCreate
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
/**Hook Activity life cycle callback begin***/
public static void onActivityCreate(String instanceId){
Map<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
if(modules!=null) {
for (String key : modules.keySet()) {
WXModule module = modules.get(key);
if (module != null) {
module.onActivityCreate();
} else {
WXLogUtils.w("onActivityCreate can not find the " + key + " module");
}
}
}
}
示例4: destroyInstanceModules
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
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();
}
}
}
示例5: fireModuleEvent
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
/**
* Notifies WEEX that this event has occurred
* @param eventName WEEX register event
* @param module Events occur in this Module
* @param params The parameters to be notified to WEEX are required
*/
public void fireModuleEvent(String eventName, WXModule module,Map<String, Object> params) {
if (TextUtils.isEmpty(eventName) || module == null) {
return;
}
Map<String, Object> event = new HashMap<>();
event.put("type", eventName);
event.put("module", module.getModuleName());
event.put("data", params);
List<String> callbacks = module.getEventCallbacks(eventName);
if (callbacks != null) {
for (String callback : callbacks) {
SimpleJSCallback jsCallback = new SimpleJSCallback(mInstanceId, callback);
if (module.isOnce(callback)) {
jsCallback.invoke(event);
} else {
jsCallback.invokeAndKeepAlive(event);
}
}
}
}
示例6: onActivityCreate
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
/**Hook Activity life cycle callback begin***/
public static void onActivityCreate(String instanceId){
HashMap<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
if(modules!=null) {
for (String key : modules.keySet()) {
WXModule module = modules.get(key);
if (module != null) {
module.onActivityCreate();
} else {
WXLogUtils.w("onActivityCreate can not find the " + key + " module");
}
}
}
}
示例7: destroyInstanceModules
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
public static void destroyInstanceModules(String instanceId) {
sDomModuleMap.remove(instanceId);
HashMap<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();
}
}
}
示例8: fireModuleEvent
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
/**
* Notifies WEEX that this event has occurred
* @param eventName WEEX register event
* @param module Events occur in this Module
* @param params The parameters to be notified to WEEX are required
*/
public void fireModuleEvent(String eventName, WXModule module,Map<String, Object> params) {
if (TextUtils.isEmpty(eventName) || module == null) {
return;
}
List<String> callbacks = module.getEventCallbacks(eventName);
if (callbacks != null) {
for (String callback : callbacks) {
SimpleJSCallback jsCallback = new SimpleJSCallback(mInstanceId, callback);
if (module.isOnce(callback)) {
jsCallback.invokeAndKeepAlive(params);
} else {
jsCallback.invoke(params);
}
}
}
}
示例9: calCategory
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
private static String calCategory(IWXObject plugin) {
if (plugin != null) {
if (plugin instanceof WXModule) {
return Constants.CATEGORY_MODULE;
} else if (plugin instanceof WXComponent) {
return Constants.CATEGORY_COMPONENT;
}
}
return Constants.CATEGORY_MODULE;
}
示例10: dispatchCallModuleMethod
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
private static Object dispatchCallModuleMethod(@NonNull WXSDKInstance instance, @NonNull WXModule wxModule,
@NonNull JSONArray args, @NonNull Invoker invoker) throws Exception{
if(!instance.isPreRenderMode()) {
return instance.getNativeInvokeHelper().invoke(wxModule,invoker,args);
}
// we are in preRender mode
if(invoker.isRunOnUIThread()) {/*ASYNC CALL*/
DOMAction moduleInvocationAction = Actions.getModuleInvocationAction(wxModule,args,invoker);
WXSDKManager.getInstance().getWXDomManager().postAction(instance.getInstanceId(), moduleInvocationAction,false);
return null;
} else {/*SYNC CALL*/
return instance.getNativeInvokeHelper().invoke(wxModule,invoker,args);
}
}
示例11: findModule
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
private static WXModule findModule(String instanceId, String moduleStr,ModuleFactory factory) {
// find WXModule
WXModule wxModule = sGlobalModuleMap.get(moduleStr);
//not global module
if (wxModule == null) {
Map<String, WXModule> moduleMap = sInstanceModuleMap.get(instanceId);
if (moduleMap == null) {
moduleMap = new ConcurrentHashMap<>();
sInstanceModuleMap.put(instanceId, moduleMap);
}
// if cannot find the Module, create a new Module and save it
wxModule = moduleMap.get(moduleStr);
if (wxModule == null) {
try {
wxModule = factory.buildInstance();
wxModule.setModuleName(moduleStr);
} catch (Exception e) {
WXLogUtils.e(moduleStr + " module build instace failed.", e);
return null;
}
moduleMap.put(moduleStr, wxModule);
}
}
return wxModule;
}
示例12: onActivityStart
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
public static void onActivityStart(String instanceId){
Map<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
if(modules!=null) {
for (String key : modules.keySet()) {
WXModule module = modules.get(key);
if (module != null) {
module.onActivityStart();
} else {
WXLogUtils.w("onActivityStart can not find the " + key + " module");
}
}
}
}
示例13: onActivityPause
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
public static void onActivityPause(String instanceId){
Map<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
if(modules!=null) {
for (String key : modules.keySet()) {
WXModule module = modules.get(key);
if (module != null) {
module.onActivityPause();
} else {
WXLogUtils.w("onActivityPause can not find the " + key + " module");
}
}
}
}
示例14: onActivityResume
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
public static void onActivityResume(String instanceId){
Map<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
if(modules!=null) {
for (String key : modules.keySet()) {
WXModule module = modules.get(key);
if (module != null) {
module.onActivityResume();
} else {
WXLogUtils.w("onActivityResume can not find the " + key + " module");
}
}
}
}
示例15: onActivityStop
import com.taobao.weex.common.WXModule; //导入依赖的package包/类
public static void onActivityStop(String instanceId){
Map<String, WXModule> modules = sInstanceModuleMap.get(instanceId);
if(modules!=null) {
for (String key : modules.keySet()) {
WXModule module = modules.get(key);
if (module != null) {
module.onActivityStop();
} else {
WXLogUtils.w("onActivityStop can not find the " + key + " module");
}
}
}
}