Search in sources :

Example 1 with WXException

use of com.taobao.weex.common.WXException in project weex-example by KalicyZhou.

the class WXApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    /**
     * Set up for fresco usage.
     * Set<RequestListener> requestListeners = new HashSet<>();
     * requestListeners.add(new RequestLoggingListener());
     * ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
     *     .setRequestListeners(requestListeners)
     *     .build();
     * Fresco.initialize(this,config);
     **/
    //    initDebugEnvironment(true, false, "DEBUG_SERVER_HOST");
    WXSDKEngine.addCustomOptions("appName", "WXSample");
    WXSDKEngine.addCustomOptions("appGroup", "WXApp");
    WXSDKEngine.initialize(this, new InitConfig.Builder().setImgAdapter(new ImageAdapter()).setDebugAdapter(new PlayDebugAdapter()).setWebSocketAdapterFactory(new DefaultWebSocketAdapterFactory()).setJSExceptionAdapter(new JSExceptionAdapter()).build());
    try {
        Fresco.initialize(this);
        WXSDKEngine.registerComponent("synccomponent", WXComponentSyncTest.class);
        WXSDKEngine.registerComponent("richtext", RichText.class);
        WXSDKEngine.registerModule("render", RenderModule.class);
        WXSDKEngine.registerModule("event", WXEventModule.class);
        WXSDKEngine.registerModule("syncTest", SyncTestModule.class);
        WXSDKEngine.registerModule("myModule", MyModule.class);
        WXSDKEngine.registerModule("geolocation", GeolocationModule.class);
    /**
       * override default image tag
       * WXSDKEngine.registerComponent("image", FrescoImageComponent.class);
       */
    } catch (WXException e) {
        e.printStackTrace();
    }
    registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {

        @Override
        public void onActivityCreated(Activity activity, Bundle bundle) {
        }

        @Override
        public void onActivityStarted(Activity activity) {
        }

        @Override
        public void onActivityResumed(Activity activity) {
        }

        @Override
        public void onActivityPaused(Activity activity) {
        }

        @Override
        public void onActivityStopped(Activity activity) {
        }

        @Override
        public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
        }

        @Override
        public void onActivityDestroyed(Activity activity) {
            // The demo code of calling 'notifyTrimMemory()'
            if (false) {
                // We assume that the application is on an idle time.
                WXSDKManager.getInstance().notifyTrimMemory();
            }
        }
    });
}
Also used : DefaultWebSocketAdapterFactory(com.alibaba.weex.commons.adapter.DefaultWebSocketAdapterFactory) JSExceptionAdapter(com.alibaba.weex.commons.adapter.JSExceptionAdapter) ImageAdapter(com.alibaba.weex.commons.adapter.ImageAdapter) Bundle(android.os.Bundle) WXException(com.taobao.weex.common.WXException) Activity(android.app.Activity) PlayDebugAdapter(com.alibaba.weex.extend.PlayDebugAdapter)

Example 2 with WXException

use of com.taobao.weex.common.WXException in project incubator-weex by apache.

the class WXApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    /**
     * Set up for fresco usage.
     * Set<RequestListener> requestListeners = new HashSet<>();
     * requestListeners.add(new RequestLoggingListener());
     * ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
     *     .setRequestListeners(requestListeners)
     *     .build();
     * Fresco.initialize(this,config);
     */
    // initDebugEnvironment(true, false, "DEBUG_SERVER_HOST");
    WXBridgeManager.updateGlobalConfig("wson_on");
    WXEnvironment.setOpenDebugLog(true);
    WXEnvironment.setApkDebugable(true);
    WXSDKEngine.addCustomOptions("appName", "WXSample");
    WXSDKEngine.addCustomOptions("appGroup", "WXApp");
    WXSDKEngine.initialize(this, new InitConfig.Builder().setImgAdapter(new ImageAdapter()).setWebSocketAdapterFactory(new DefaultWebSocketAdapterFactory()).setJSExceptionAdapter(new JSExceptionAdapter()).setHttpAdapter(new InterceptWXHttpAdapter()).build());
    WXSDKManager.getInstance().setAccessibilityRoleAdapter(new DefaultAccessibilityRoleAdapter());
    try {
        Fresco.initialize(this);
        WXSDKEngine.registerComponent("synccomponent", WXComponentSyncTest.class);
        WXSDKEngine.registerComponent(WXParallax.PARALLAX, WXParallax.class);
        WXSDKEngine.registerComponent("richtext", RichText.class);
        WXSDKEngine.registerModule("render", RenderModule.class);
        WXSDKEngine.registerModule("event", WXEventModule.class);
        WXSDKEngine.registerModule("syncTest", SyncTestModule.class);
        WXSDKEngine.registerComponent("mask", WXMask.class);
        WXSDKEngine.registerDomObject("mask", WXMaskDomObject.class);
        WXSDKEngine.registerModule("myModule", MyModule.class);
        WXSDKEngine.registerModule("geolocation", GeolocationModule.class);
        WXSDKEngine.registerModule("titleBar", WXTitleBar.class);
        WXSDKEngine.registerModule("wsonTest", WXWsonTestModule.class);
    /**
     * override default image tag
     * WXSDKEngine.registerComponent("image", FrescoImageComponent.class);
     */
    // Typeface nativeFont = Typeface.createFromAsset(getAssets(), "font/native_font.ttf");
    // WXEnvironment.setGlobalFontFamily("bolezhusun", nativeFont);
    } catch (WXException e) {
        e.printStackTrace();
    }
    registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {

        @Override
        public void onActivityCreated(Activity activity, Bundle bundle) {
        }

        @Override
        public void onActivityStarted(Activity activity) {
        }

        @Override
        public void onActivityResumed(Activity activity) {
        }

        @Override
        public void onActivityPaused(Activity activity) {
        }

        @Override
        public void onActivityStopped(Activity activity) {
        }

        @Override
        public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
        }

        @Override
        public void onActivityDestroyed(Activity activity) {
            // The demo code of calling 'notifyTrimMemory()'
            if (false) {
                // We assume that the application is on an idle time.
                WXSDKManager.getInstance().notifyTrimMemory();
            }
            // The demo code of calling 'notifySerializeCodeCache()'
            if (false) {
                WXSDKManager.getInstance().notifySerializeCodeCache();
            }
        }
    });
}
Also used : DefaultWebSocketAdapterFactory(com.alibaba.weex.commons.adapter.DefaultWebSocketAdapterFactory) JSExceptionAdapter(com.alibaba.weex.commons.adapter.JSExceptionAdapter) ImageAdapter(com.alibaba.weex.commons.adapter.ImageAdapter) Bundle(android.os.Bundle) WXException(com.taobao.weex.common.WXException) Activity(android.app.Activity) InterceptWXHttpAdapter(com.alibaba.weex.extend.adapter.InterceptWXHttpAdapter) DefaultAccessibilityRoleAdapter(com.alibaba.weex.extend.adapter.DefaultAccessibilityRoleAdapter)

Example 3 with WXException

use of com.taobao.weex.common.WXException in project incubator-weex by apache.

the class WXSDKEngine method register.

private static void register() {
    BatchOperationHelper batchHelper = new BatchOperationHelper(WXBridgeManager.getInstance());
    try {
        registerComponent(new SimpleComponentHolder(WXText.class, new WXText.Creator()), false, WXBasicComponentType.TEXT);
        registerComponent(new SimpleComponentHolder(WXDiv.class, new WXDiv.Ceator()), false, WXBasicComponentType.CONTAINER, WXBasicComponentType.DIV, WXBasicComponentType.HEADER, WXBasicComponentType.FOOTER);
        registerComponent(new SimpleComponentHolder(WXImage.class, new WXImage.Ceator()), false, WXBasicComponentType.IMAGE, WXBasicComponentType.IMG);
        registerComponent(new SimpleComponentHolder(WXScroller.class, new WXScroller.Creator()), false, WXBasicComponentType.SCROLLER);
        registerComponent(new SimpleComponentHolder(WXSlider.class, new WXSlider.Creator()), true, WXBasicComponentType.SLIDER, WXBasicComponentType.CYCLE_SLIDER);
        registerComponent(new SimpleComponentHolder(WXSliderNeighbor.class, new WXSliderNeighbor.Creator()), true, WXBasicComponentType.SLIDER_NEIGHBOR);
        String simpleList = "simplelist";
        registerComponent(SimpleListComponent.class, false, simpleList);
        registerComponent(WXListComponent.class, false, WXBasicComponentType.LIST, WXBasicComponentType.VLIST, WXBasicComponentType.RECYCLER, WXBasicComponentType.WATERFALL);
        registerComponent(WXRecyclerTemplateList.class, false, WXBasicComponentType.RECYCLE_LIST);
        registerComponent(HorizontalListComponent.class, false, WXBasicComponentType.HLIST);
        registerComponent(WXBasicComponentType.CELL, WXCell.class, true);
        registerComponent(WXBasicComponentType.CELL_SLOT, WXCell.class, true);
        registerComponent(WXBasicComponentType.INDICATOR, WXIndicator.class, true);
        registerComponent(WXBasicComponentType.VIDEO, WXVideo.class, false);
        registerComponent(WXBasicComponentType.INPUT, WXInput.class, false);
        registerComponent(WXBasicComponentType.TEXTAREA, Textarea.class, false);
        registerComponent(WXBasicComponentType.SWITCH, WXSwitch.class, false);
        registerComponent(WXBasicComponentType.A, WXA.class, false);
        registerComponent(WXBasicComponentType.EMBED, WXEmbed.class, true);
        registerComponent(WXBasicComponentType.WEB, WXWeb.class);
        registerComponent(WXBasicComponentType.REFRESH, WXRefresh.class);
        registerComponent(WXBasicComponentType.LOADING, WXLoading.class);
        registerComponent(WXBasicComponentType.LOADING_INDICATOR, WXLoadingIndicator.class);
        registerComponent(WXBasicComponentType.HEADER, WXHeader.class);
        registerModule("modal", WXModalUIModule.class, false);
        registerModule("instanceWrap", WXInstanceWrap.class, true);
        registerModule("animation", WXAnimationModule.class, false);
        registerModule("webview", WXWebViewModule.class, true);
        registerModule("navigator", WXNavigatorModule.class);
        registerModule("stream", WXStreamModule.class);
        registerModule("timer", WXTimerModule.class, false);
        registerModule("storage", WXStorageModule.class, true);
        registerModule("clipboard", WXClipboardModule.class, true);
        registerModule("globalEvent", WXGlobalEventModule.class);
        registerModule("picker", WXPickersModule.class);
        registerModule("meta", WXMetaModule.class, true);
        registerModule("webSocket", WebSocketModule.class);
        registerModule("locale", WXLocaleModule.class);
        registerDomObject(simpleList, WXListDomObject.class);
        registerDomObject(WXBasicComponentType.INDICATOR, WXIndicator.IndicatorDomNode.class);
        registerDomObject(WXBasicComponentType.TEXT, WXTextDomObject.class);
        registerDomObject(WXBasicComponentType.HEADER, WXCellDomObject.class);
        registerDomObject(WXBasicComponentType.CELL, WXCellDomObject.class);
        registerDomObject(WXBasicComponentType.CELL_SLOT, WXCellDomObject.class);
        registerDomObject(WXBasicComponentType.INPUT, BasicEditTextDomObject.class);
        registerDomObject(WXBasicComponentType.TEXTAREA, TextAreaEditTextDomObject.class);
        registerDomObject(WXBasicComponentType.SWITCH, WXSwitchDomObject.class);
        registerDomObject(WXBasicComponentType.LIST, WXListDomObject.class);
        registerDomObject(WXBasicComponentType.RECYCLE_LIST, WXRecyclerDomObject.class);
        registerDomObject(WXBasicComponentType.VLIST, WXListDomObject.class);
        registerDomObject(WXBasicComponentType.HLIST, WXListDomObject.class);
        registerDomObject(WXBasicComponentType.SCROLLER, WXScrollerDomObject.class);
        registerDomObject(WXBasicComponentType.RECYCLER, WXRecyclerDomObject.class);
        registerDomObject(WXBasicComponentType.WATERFALL, WXRecyclerDomObject.class);
    } catch (WXException e) {
        WXLogUtils.e("[WXSDKEngine] register:", e);
    }
    AutoScanConfigRegister.doScanConfig();
    batchHelper.flush();
}
Also used : WXDiv(com.taobao.weex.ui.component.WXDiv) WXScroller(com.taobao.weex.ui.component.WXScroller) SimpleComponentHolder(com.taobao.weex.ui.SimpleComponentHolder) BatchOperationHelper(com.taobao.weex.utils.batch.BatchOperationHelper) WXSlider(com.taobao.weex.ui.component.WXSlider) WXIndicator(com.taobao.weex.ui.component.WXIndicator) WXException(com.taobao.weex.common.WXException) WXSliderNeighbor(com.taobao.weex.ui.component.WXSliderNeighbor) WXImage(com.taobao.weex.ui.component.WXImage) WXText(com.taobao.weex.ui.component.WXText)

Example 4 with WXException

use of com.taobao.weex.common.WXException in project WeexErosFramework by bmfe.

the class BMWXEngine method initHook.

private static void initHook() {
    try {
        WXSDKEngine.registerComponent(new SimpleComponentHolder(HookWXText.class, new HookWXText.Creator()), false, WXBasicComponentType.TEXT);
        WXSDKEngine.registerComponent(WXBasicComponentType.INPUT, HookInput.class, false);
        WXSDKEngine.registerComponent(WXBasicComponentType.TEXTAREA, HookTextarea.class, false);
        WXSDKEngine.registerComponent(new SimpleComponentHolder(HookImage.class, new HookImage.Ceator()), false, WXBasicComponentType.IMAGE, WXBasicComponentType.IMG);
        WXSDKEngine.registerComponent(HookListComponent.class, false, WXBasicComponentType.LIST, WXBasicComponentType.VLIST, WXBasicComponentType.RECYCLER, WXBasicComponentType.WATERFALL);
        WXSDKEngine.registerComponent(new SimpleComponentHolder(HookWxScroller.class, new HookWxScroller.Creator()), false, WXBasicComponentType.SCROLLER);
        WXSDKEngine.registerComponent(WXBasicComponentType.WEB, HookWeb.class);
    } catch (WXException e) {
        e.printStackTrace();
    }
}
Also used : HookWXText(com.eros.framework.extend.hook.ui.components.HookWXText) HookWxScroller(com.eros.framework.extend.hook.ui.components.HookWxScroller) WXException(com.taobao.weex.common.WXException) SimpleComponentHolder(com.taobao.weex.ui.SimpleComponentHolder) HookImage(com.eros.framework.extend.hook.ui.components.HookImage)

Example 5 with WXException

use of com.taobao.weex.common.WXException in project weex-example by KalicyZhou.

the class WXSDKEngine method register.

private static void register() {
    BatchOperationHelper batchHelper = new BatchOperationHelper(WXBridgeManager.getInstance());
    try {
        registerComponent(new SimpleComponentHolder(WXText.class, new WXText.Creator()), false, WXBasicComponentType.TEXT);
        registerComponent(new SimpleComponentHolder(WXDiv.class, new WXDiv.Ceator()), false, WXBasicComponentType.CONTAINER, WXBasicComponentType.DIV, WXBasicComponentType.HEADER, WXBasicComponentType.FOOTER);
        registerComponent(new SimpleComponentHolder(WXImage.class, new WXImage.Ceator()), false, WXBasicComponentType.IMAGE, WXBasicComponentType.IMG);
        registerComponent(new SimpleComponentHolder(WXScroller.class, new WXScroller.Creator()), false, WXBasicComponentType.SCROLLER);
        registerComponent(new SimpleComponentHolder(WXSlider.class, new WXSlider.Creator()), true, WXBasicComponentType.SLIDER);
        registerComponent(new SimpleComponentHolder(WXSliderNeighbor.class, new WXSliderNeighbor.Creator()), true, WXBasicComponentType.SLIDER_NEIGHBOR);
        registerComponent(SimpleListComponent.class, false, "simplelist");
        registerComponent(WXListComponent.class, false, WXBasicComponentType.LIST, WXBasicComponentType.VLIST);
        registerComponent(HorizontalListComponent.class, false, WXBasicComponentType.HLIST);
        registerComponent(WXBasicComponentType.CELL, WXCell.class, true);
        registerComponent(WXBasicComponentType.INDICATOR, WXIndicator.class, true);
        registerComponent(WXBasicComponentType.VIDEO, WXVideo.class, false);
        registerComponent(WXBasicComponentType.INPUT, WXInput.class, false);
        registerComponent(WXBasicComponentType.TEXTAREA, Textarea.class, false);
        registerComponent(WXBasicComponentType.SWITCH, WXSwitch.class, false);
        registerComponent(WXBasicComponentType.A, WXA.class, false);
        registerComponent(WXBasicComponentType.EMBED, WXEmbed.class, true);
        registerComponent(WXBasicComponentType.WEB, WXWeb.class);
        registerComponent(WXBasicComponentType.REFRESH, WXRefresh.class);
        registerComponent(WXBasicComponentType.LOADING, WXLoading.class);
        registerComponent(WXBasicComponentType.LOADING_INDICATOR, WXLoadingIndicator.class);
        registerComponent(WXBasicComponentType.HEADER, WXHeader.class);
        registerModule("modal", WXModalUIModule.class, false);
        registerModule("instanceWrap", WXInstanceWrap.class, true);
        registerModule("animation", WXAnimationModule.class, true);
        registerModule("webview", WXWebViewModule.class, true);
        registerModule("navigator", WXNavigatorModule.class);
        registerModule("stream", WXStreamModule.class);
        registerModule("timer", WXTimerModule.class, false);
        registerModule("storage", WXStorageModule.class, true);
        registerModule("clipboard", WXClipboardModule.class, true);
        registerModule("globalEvent", WXGlobalEventModule.class);
        registerModule("picker", WXPickersModule.class);
        registerModule("meta", WXMetaModule.class, true);
        registerModule("webSocket", WebSocketModule.class);
        registerDomObject(WXBasicComponentType.INDICATOR, WXIndicator.IndicatorDomNode.class);
        registerDomObject(WXBasicComponentType.TEXT, WXTextDomObject.class);
        registerDomObject(WXBasicComponentType.INPUT, BasicEditTextDomObject.class);
        registerDomObject(WXBasicComponentType.TEXTAREA, TextAreaEditTextDomObject.class);
        registerDomObject(WXBasicComponentType.SWITCH, WXSwitchDomObject.class);
        registerDomObject(WXBasicComponentType.LIST, WXListDomObject.class);
        registerDomObject(WXBasicComponentType.VLIST, WXListDomObject.class);
        registerDomObject(WXBasicComponentType.HLIST, WXListDomObject.class);
        registerDomObject(WXBasicComponentType.SCROLLER, WXScrollerDomObject.class);
    } catch (WXException e) {
        WXLogUtils.e("[WXSDKEngine] register:", e);
    }
    batchHelper.flush();
}
Also used : WXSlider(com.taobao.weex.ui.component.WXSlider) WXDiv(com.taobao.weex.ui.component.WXDiv) WXScroller(com.taobao.weex.ui.component.WXScroller) WXIndicator(com.taobao.weex.ui.component.WXIndicator) WXException(com.taobao.weex.common.WXException) SimpleComponentHolder(com.taobao.weex.ui.SimpleComponentHolder) WXSliderNeighbor(com.taobao.weex.ui.component.WXSliderNeighbor) WXImage(com.taobao.weex.ui.component.WXImage) BatchOperationHelper(com.taobao.weex.utils.batch.BatchOperationHelper) WXText(com.taobao.weex.ui.component.WXText)

Aggregations

WXException (com.taobao.weex.common.WXException)7 Activity (android.app.Activity)3 Bundle (android.os.Bundle)3 ImageAdapter (com.alibaba.weex.commons.adapter.ImageAdapter)3 SimpleComponentHolder (com.taobao.weex.ui.SimpleComponentHolder)3 DefaultWebSocketAdapterFactory (com.alibaba.weex.commons.adapter.DefaultWebSocketAdapterFactory)2 JSExceptionAdapter (com.alibaba.weex.commons.adapter.JSExceptionAdapter)2 WXDiv (com.taobao.weex.ui.component.WXDiv)2 WXImage (com.taobao.weex.ui.component.WXImage)2 WXIndicator (com.taobao.weex.ui.component.WXIndicator)2 WXScroller (com.taobao.weex.ui.component.WXScroller)2 WXSlider (com.taobao.weex.ui.component.WXSlider)2 WXSliderNeighbor (com.taobao.weex.ui.component.WXSliderNeighbor)2 WXText (com.taobao.weex.ui.component.WXText)2 BatchOperationHelper (com.taobao.weex.utils.batch.BatchOperationHelper)2 CustomURIAdapter (com.alibaba.weex.commons.adapter.CustomURIAdapter)1 PlayDebugAdapter (com.alibaba.weex.extend.PlayDebugAdapter)1 DefaultAccessibilityRoleAdapter (com.alibaba.weex.extend.adapter.DefaultAccessibilityRoleAdapter)1 InterceptWXHttpAdapter (com.alibaba.weex.extend.adapter.InterceptWXHttpAdapter)1 HookImage (com.eros.framework.extend.hook.ui.components.HookImage)1