com.taobao.weex.WXSDKEngine Java Examples
The following examples show how to use
com.taobao.weex.WXSDKEngine.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WXNavigatorModule.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@JSMethod(uiThread = true) public void setNavBarMoreItem(String param, JSCallback callback) { if (!TextUtils.isEmpty(param)) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().setNavBarMoreItem(param)) { if (callback != null) { callback.invoke(MSG_SUCCESS); } return; } } } if (callback != null) { callback.invoke(MSG_FAILED); } }
Example #2
Source File: WXNavigatorModule.java From weex with Apache License 2.0 | 6 votes |
@WXModuleAnno public void setNavBarLeftItem(String param, final String callbackId) { if (!TextUtils.isEmpty(param)) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().setNavBarLeftItem(param)) { WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId, WXConst.MSG_SUCCESS); return; } } } WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId, WXConst.MSG_FAILED); }
Example #3
Source File: WXApplication.java From yanxuan-weex-demo with MIT License | 6 votes |
@Override public void onCreate() { super.onCreate(); WXSDKEngine.addCustomOptions("appName", "WXSample"); WXSDKEngine.addCustomOptions("appGroup", "WXApp"); WXSDKEngine.initialize(this, new InitConfig.Builder().setImgAdapter(new ImageAdapter()).build() ); try { WXSDKEngine.registerModule("event", WXEventModule.class); } catch (WXException e) { e.printStackTrace(); } AppConfig.init(this); WeexPluginContainer.loadAll(this); }
Example #4
Source File: UWXNavigatorModule2.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@JSMethod(uiThread = true) public void pop(String param, JSCallback callback) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().pop(param)) { if (callback != null) { callback.invoke(MSG_SUCCESS); } return; } } if (mWXSDKInstance.getContext() instanceof Activity) { if (callback != null) { callback.invoke(MSG_SUCCESS); } ((Activity) mWXSDKInstance.getContext()).finish(); } }
Example #5
Source File: WeappJsBaseTestCase.java From incubator-weex-playground with Apache License 2.0 | 6 votes |
public void setUp() throws Exception { if (testApplication == null){ createApplication(); // 创建 application testApplication = getApplication(); WXSDKEngine.init(testApplication, null); // WXSDKEngine.registerComponent("latestVisitView", WXLatestVisitView.class); // WXSDKEngine.registerComponent("marquee", WXMarquee.class); // WXSDKEngine.registerComponent("countdown", WXCountDown.class); // WXSDKEngine.registerComponent("tabheader", WXTabHeader.class); } // assertNotNull(testApplication); }
Example #6
Source File: SliceTestActivity.java From incubator-weex-playground with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { WXSDKEngine.registerModule("searchEvent", SearchModule.class); } catch (WXException e) { e.printStackTrace(); } setContentView(R.layout.activity_slice_test); mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view); mReportTextView = (TextView) findViewById(R.id.report_text); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL)); mAdapter = new WXInstanceAdapter(); mRecyclerView.setAdapter(mAdapter); }
Example #7
Source File: WXApplication.java From weex with Apache License 2.0 | 6 votes |
@Override public void onCreate() { super.onCreate(); initDebugEnvironment(false, "DEBUG_SERVER_HOST"); WXSDKEngine.addCustomOptions("appName", "WXSample"); WXSDKEngine.addCustomOptions("appGroup", "WXApp"); WXSDKEngine.initialize(this, new InitConfig.Builder() .setImgAdapter(new ImageAdapter()) .setDebugAdapter(new PlayDebugAdapter()) .build() ); try { Fresco.initialize(this); WXSDKEngine.registerComponent("richtext", RichText.class); WXSDKEngine.registerModule("render", RenderModule.class); WXSDKEngine.registerModule("event", WXEventModule.class); WXSDKEngine.registerModule("myModule", MyModule.class); } catch (WXException e) { e.printStackTrace(); } }
Example #8
Source File: WeappJsBaseTestCase.java From weex with Apache License 2.0 | 6 votes |
public void setUp() throws Exception { if (testApplication == null){ createApplication(); // 创建 application testApplication = getApplication(); WXSDKEngine.init(testApplication, null); // WXSDKEngine.registerComponent("latestVisitView", WXLatestVisitView.class); // WXSDKEngine.registerComponent("marquee", WXMarquee.class); // WXSDKEngine.registerComponent("countdown", WXCountDown.class); // WXSDKEngine.registerComponent("tabheader", WXTabHeader.class); } // assertNotNull(testApplication); }
Example #9
Source File: App.java From CrazyDaily with Apache License 2.0 | 6 votes |
/** * 初始化Weex */ private void initWeex() { InitConfig config = new InitConfig.Builder() .setImgAdapter(new WXImageAdapter()) .setHttpAdapter(new WXHttpAdapter(mAppComponent.provideOkhttpClient())) .build(); WXSDKEngine.initialize(this, config); try { WXSDKEngine.registerComponent("tabPager", WXTabPagerComponent.class); WXSDKEngine.registerComponent(WXBasicComponentType.WEB, WXWebComponent.class); WXSDKEngine.registerModule("crazyDaily", CrazyDailyModule.class); WXSDKEngine.registerModule("webview", WXWebViewModule.class, true); WXSDKEngine.registerModule("log", LogModule.class); } catch (WXException e) { LoggerUtil.d(e.getMessage()); } }
Example #10
Source File: UWXNavigatorModule2.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@JSMethod(uiThread = true) public void setNavBarRightItem(String param, JSCallback callback) { if (!TextUtils.isEmpty(param)) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().setNavBarRightItem(param)) { if (callback != null) { callback.invoke(MSG_SUCCESS); } return; } } } if (callback != null) { callback.invoke(MSG_FAILED); } }
Example #11
Source File: UWXNavigatorModule2.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@JSMethod(uiThread = true) public void setNavBarTitle(String param, JSCallback callback) { if (!TextUtils.isEmpty(param)) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().setNavBarTitle(param)) { if (callback != null) { callback.invoke(MSG_SUCCESS); } return; } } } if (callback != null) { callback.invoke(MSG_FAILED); } }
Example #12
Source File: WeappJsBaseTestCase.java From WeexOne with MIT License | 6 votes |
public void setUp() throws Exception { if (testApplication == null){ createApplication(); // 创建 application testApplication = getApplication(); WXSDKEngine.init(testApplication, null); // WXSDKEngine.registerComponent("latestVisitView", WXLatestVisitView.class); // WXSDKEngine.registerComponent("marquee", WXMarquee.class); // WXSDKEngine.registerComponent("countdown", WXCountDown.class); // WXSDKEngine.registerComponent("tabheader", WXTabHeader.class); } // assertNotNull(testApplication); }
Example #13
Source File: UWXInit.java From ucar-weex-core with Apache License 2.0 | 6 votes |
public static void init(Application context) { UWXSDKManager.initialize(context); // WXSDKEngine.addCustomOptions("scheme", "portal"); // WXSDKEngine.addCustomOptions(WXConfig.appGroup, "portal"); // WXSDKEngine.addCustomOptions(WXConfig.appName, "portal"); WXSDKEngine.initialize(context, new InitConfig.Builder() .setImgAdapter(new FrescoImageAdapter()) .setJSExceptionAdapter(new JSExceptionAdapter()) .setDebugAdapter(new DebugAdapter()) .build() ); try { WXSDKEngine.registerModule("UNavigator", UWXNavigatorModule.class); WXSDKEngine.registerModule("UScheme", UWXSchemeModule.class); WXSDKEngine.registerModule("UGlobalEvent", UWXGlobalEventModule.class); WXSDKEngine.registerModule("navigator", UWXNavigatorModule2.class); } catch (WXException e) { e.printStackTrace(); } Fresco.initialize(context); }
Example #14
Source File: WXApplication.java From WeexOne with MIT License | 6 votes |
@Override public void onCreate() { super.onCreate(); // initDebugEnvironment(false, "DEBUG_SERVER_HOST"); WXSDKEngine.addCustomOptions("appName", "WXSample"); WXSDKEngine.addCustomOptions("appGroup", "WXApp"); WXSDKEngine.initialize(this, new InitConfig.Builder() .setImgAdapter(new ImageAdapter()) .build() ); Fresco.initialize(this); AppConfig.init(this); ExtensionManager.registerComponents(AppConfig.getComponents()); ExtensionManager.registerModules(AppConfig.getModules()); }
Example #15
Source File: WXNavigatorModule.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@JSMethod(uiThread = true) public void pop(String param, JSCallback callback) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().pop(param)) { if (callback != null) { callback.invoke(MSG_SUCCESS); } return; } } if (mWXSDKInstance.getContext() instanceof Activity) { if (callback != null) { callback.invoke(MSG_SUCCESS); } ((Activity) mWXSDKInstance.getContext()).finish(); } }
Example #16
Source File: WXNavigatorModule.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@JSMethod(uiThread = true) public void setNavBarRightItem(String param, JSCallback callback) { if (!TextUtils.isEmpty(param)) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().setNavBarRightItem(param)) { if (callback != null) { callback.invoke(MSG_SUCCESS); } return; } } } if (callback != null) { callback.invoke(MSG_FAILED); } }
Example #17
Source File: WXNavigatorModule.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@JSMethod(uiThread = true) public void setNavBarLeftItem(String param, JSCallback callback) { if (!TextUtils.isEmpty(param)) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().setNavBarLeftItem(param)) { if (callback != null) { callback.invoke(MSG_SUCCESS); } return; } } } if (callback != null) { callback.invoke(MSG_FAILED); } }
Example #18
Source File: UWXNavigatorModule2.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@JSMethod(uiThread = true) public void setNavBarMoreItem(String param, JSCallback callback) { if (!TextUtils.isEmpty(param)) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().setNavBarMoreItem(param)) { if (callback != null) { callback.invoke(MSG_SUCCESS); } return; } } } if (callback != null) { callback.invoke(MSG_FAILED); } }
Example #19
Source File: WXNavigatorModule.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@JSMethod(uiThread = true) public void setNavBarTitle(String param, JSCallback callback) { if (!TextUtils.isEmpty(param)) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().setNavBarTitle(param)) { if (callback != null) { callback.invoke(MSG_SUCCESS); } return; } } } if (callback != null) { callback.invoke(MSG_FAILED); } }
Example #20
Source File: UWXNavigatorModule2.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@JSMethod(uiThread = true) public void setNavBarLeftItem(String param, JSCallback callback) { if (!TextUtils.isEmpty(param)) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().setNavBarLeftItem(param)) { if (callback != null) { callback.invoke(MSG_SUCCESS); } return; } } } if (callback != null) { callback.invoke(MSG_FAILED); } }
Example #21
Source File: WXNavigatorModule.java From weex-uikit with MIT License | 5 votes |
@JSMethod(uiThread = true) public void setNavBarMoreItem(String param, JSCallback callback) { if (!TextUtils.isEmpty(param)) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().setNavBarMoreItem(param)) { callback.invoke(MSG_SUCCESS); return; } } } callback.invoke(MSG_FAILED); }
Example #22
Source File: WXNavigatorModule.java From weex-uikit with MIT License | 5 votes |
@JSMethod(uiThread = true) public void setNavBarRightItem(String param, JSCallback callback) { if (!TextUtils.isEmpty(param)) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().setNavBarRightItem(param)) { callback.invoke(MSG_SUCCESS); return; } } } callback.invoke(MSG_FAILED); }
Example #23
Source File: WXNavigatorModule.java From weex-uikit with MIT License | 5 votes |
@JSMethod(uiThread = true) public void clearNavBarRightItem(String param, JSCallback callback) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().clearNavBarRightItem(param)) { callback.invoke(MSG_SUCCESS); return; } } callback.invoke(MSG_FAILED); }
Example #24
Source File: WXNavigatorModule.java From weex-uikit with MIT License | 5 votes |
@JSMethod(uiThread = true) public void setNavBarLeftItem(String param, JSCallback callback) { if (!TextUtils.isEmpty(param)) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().setNavBarLeftItem(param)) { callback.invoke(MSG_SUCCESS); return; } } } callback.invoke(MSG_FAILED); }
Example #25
Source File: WXNavigatorModule.java From weex-uikit with MIT License | 5 votes |
@JSMethod(uiThread = true) public void setNavBarTitle(String param, JSCallback callback) { if (!TextUtils.isEmpty(param)) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().setNavBarTitle(param)) { callback.invoke(MSG_SUCCESS); return; } } } callback.invoke(MSG_FAILED); }
Example #26
Source File: WXPageActivity.java From yanxuan-weex-demo with MIT License | 5 votes |
private void handleDecodeInternally(String code) { if (!TextUtils.isEmpty(code)) { Uri uri = Uri.parse(code); if (uri.getQueryParameterNames().contains("bundle")) { WXEnvironment.sDynamicMode = uri.getBooleanQueryParameter("debug", false); WXEnvironment.sDynamicUrl = uri.getQueryParameter("bundle"); String tip = WXEnvironment.sDynamicMode ? "Has switched to Dynamic Mode" : "Has switched to Normal Mode"; Toast.makeText(this, tip, Toast.LENGTH_SHORT).show(); finish(); return; } else if (uri.getQueryParameterNames().contains("_wx_devtool")) { WXEnvironment.sRemoteDebugProxyUrl = uri.getQueryParameter("_wx_devtool"); WXEnvironment.sDebugServerConnectable = true; WXSDKEngine.reload(); Toast.makeText(this, "devtool", Toast.LENGTH_SHORT).show(); return; } else if (code.contains("_wx_debug")) { uri = Uri.parse(code); String debug_url = uri.getQueryParameter("_wx_debug"); WXSDKEngine.switchDebugModel(true, debug_url); finish(); } else { JSONObject data = new JSONObject(); try { data.put("WeexBundle", Uri.parse(code).toString()); Intent intent = new Intent(WXPageActivity.this, WXPageActivity.class); intent.setData(Uri.parse(data.toString())); startActivity(intent); } catch (JSONException e) { e.printStackTrace(); } } } }
Example #27
Source File: WXNavigatorModuleTest.java From weex-uikit with MIT License | 5 votes |
@Before public void setUp() throws Exception { mockStatic(WXSDKEngine.class); callback = Mockito.mock(JSCallback.class); module = new WXNavigatorModule(); module.mWXSDKInstance = WXSDKInstanceTest.createInstance(); }
Example #28
Source File: WXNavigatorModule.java From weex-uikit with MIT License | 5 votes |
@JSMethod(uiThread = true) public void pop(String param, JSCallback callback) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().pop(param)) { callback.invoke(MSG_SUCCESS); return; } } if (mWXSDKInstance.getContext() instanceof Activity) { callback.invoke(MSG_SUCCESS); ((Activity) mWXSDKInstance.getContext()).finish(); } }
Example #29
Source File: WXNavigatorModule.java From weex-uikit with MIT License | 5 votes |
@JSMethod(uiThread = true) public void clearNavBarLeftItem(String param, JSCallback callback) { if (WXSDKEngine.getActivityNavBarSetter() != null) { if (WXSDKEngine.getActivityNavBarSetter().clearNavBarLeftItem(param)) { callback.invoke(MSG_SUCCESS); return; } } callback.invoke(MSG_FAILED); }
Example #30
Source File: WXModuleManagerTest.java From weex-uikit with MIT License | 5 votes |
@Before public void setUp() throws Exception { WXSDKEngine.initialize(RuntimeEnvironment.application,new InitConfig.Builder().build()); instance = WXSDKInstanceTest.createInstance(); WXModuleManager.registerModule("test",null,false); WXModuleManager.registerModule("test1",new TypeModuleFactory<>(TestModule.class),true); WXModuleManager.registerModule("test2",new TypeModuleFactory<>(TestModule.class),false); WXBridgeManagerTest.getLooper().idle(); }