* [android] Merge WeexCore-master to master.
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/2f8caedb Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/2f8caedb Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/2f8caedb Branch: refs/heads/master Commit: 2f8caedb147b13182647a1dab473ba9cb31e54e4 Parents: 62439ca Author: miomin <[email protected]> Authored: Thu Apr 26 11:18:11 2018 +0800 Committer: YorkShen <[email protected]> Committed: Sat Apr 28 14:51:47 2018 +0800 ---------------------------------------------------------------------- android/commons/build.gradle | 12 +- .../weex/commons/AbstractWeexActivity.java | 4 - .../commons/adapter/FrescoImageComponent.java | 6 +- .../weex/commons/adapter/ImageAdapter.java | 4 - android/playground/app/build.gradle | 24 +- .../benchmark/BenchmarkActivityTestRule.java | 53 - .../alibaba/weex/benchmark/BenchmarkTest.java | 106 +- .../weex/benchmark/WeexNativeCompareTest.java | 22 +- .../weex/uitest/WeexUiTestCaseTcElementOpt.java | 6 +- .../com/alibaba/weex/BenchmarkActivity.java | 29 +- .../java/com/alibaba/weex/WXApplication.java | 3 - .../java/com/alibaba/weex/WXPageActivity.java | 11 +- .../alibaba/weex/extend/component/RichText.java | 6 +- .../extend/component/WXComponentSyncTest.java | 8 +- .../alibaba/weex/extend/component/WXMask.java | 33 +- .../weex/extend/component/WXParallax.java | 17 +- .../extend/component/dom/WXMaskDomObject.java | 254 - .../weex/extend/module/WXWsonTestModule.java | 1 - .../zxing/client/android/CaptureActivity.java | 289 +- .../android/result/WifiResultHandler.java | 2 +- android/sdk/.gitignore | 3 +- android/sdk/assets/main.js | 2 +- android/sdk/assets/weex-main-jsfm.js | 2 +- android/sdk/assets/weex-rax-api.js | 2 +- android/sdk/build.gradle | 42 +- android/sdk/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 52266 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + android/sdk/libs/armeabi/libweexjsc.so | Bin 276000 -> 0 bytes android/sdk/libs/armeabi/libweexjss.so | Bin 2965608 -> 3758132 bytes android/sdk/libs/x86/libweexjsb.so | Bin android/sdk/libs/x86/libweexjsc.so | Bin 655556 -> 0 bytes android/sdk/libs/x86/libweexjss.so | Bin 8373712 -> 10928784 bytes android/sdk/proguard-rules.pro | 5 +- android/sdk/src/main/AndroidManifest.xml | 5 +- .../main/java/com/taobao/weex/InitConfig.java | 2 +- .../com/taobao/weex/LayoutFinishListener.java | 26 - .../java/com/taobao/weex/RenderContainer.java | 46 +- .../java/com/taobao/weex/WXEnvironment.java | 14 +- .../main/java/com/taobao/weex/WXSDKEngine.java | 206 +- .../java/com/taobao/weex/WXSDKInstance.java | 484 +- .../main/java/com/taobao/weex/WXSDKManager.java | 13 +- .../com/taobao/weex/WeexFrameRateControl.java | 88 + .../taobao/weex/adapter/ClassLoaderAdapter.java | 1 - .../appfram/websocket/WebSocketCloseCodes.java | 2 +- .../com/taobao/weex/base/CalledByNative.java | 22 + .../java/com/taobao/weex/base/FloatUtil.java | 31 + .../taobao/weex/base/SystemMessageHandler.java | 106 + .../java/com/taobao/weex/bridge/JSCallback.java | 2 - .../taobao/weex/bridge/ModuleFactoryImpl.java | 21 +- .../taobao/weex/bridge/NativeInvokeHelper.java | 16 +- .../java/com/taobao/weex/bridge/WXBridge.java | 689 +- .../com/taobao/weex/bridge/WXBridgeManager.java | 1619 ++--- .../java/com/taobao/weex/bridge/WXJSObject.java | 1 - .../com/taobao/weex/bridge/WXJsFunctions.java | 110 + .../com/taobao/weex/bridge/WXModuleManager.java | 32 +- .../taobao/weex/bridge/WXValidateProcessor.java | 4 +- .../java/com/taobao/weex/common/Constants.java | 23 +- .../java/com/taobao/weex/common/IWXBridge.java | 110 +- .../com/taobao/weex/common/IWXDebugProxy.java | 2 +- .../com/taobao/weex/common/IWXJsFunctions.java | 72 + .../java/com/taobao/weex/common/IWXTask.java | 23 - .../com/taobao/weex/common/WXErrorCode.java | 16 +- .../taobao/weex/common/WXJSExceptionInfo.java | 18 +- .../com/taobao/weex/common/WXPerformance.java | 125 +- .../com/taobao/weex/dom/ApplyStyleConsumer.java | 59 - .../taobao/weex/dom/BasicEditTextDomObject.java | 107 - .../com/taobao/weex/dom/CSSAlignConvert.java | 60 - .../java/com/taobao/weex/dom/CSSConstants.java | 28 + .../weex/dom/CSSFlexDirectionConvert.java | 42 - .../com/taobao/weex/dom/CSSJustifyConvert.java | 42 - .../taobao/weex/dom/CSSPositionTypeConvert.java | 36 - .../java/com/taobao/weex/dom/CSSShorthand.java | 112 + .../com/taobao/weex/dom/CSSWrapConvert.java | 36 - .../java/com/taobao/weex/dom/DOMAction.java | 30 - .../com/taobao/weex/dom/DOMActionContext.java | 71 - .../taobao/weex/dom/DOMActionContextImpl.java | 461 -- .../java/com/taobao/weex/dom/DomContext.java | 30 - .../com/taobao/weex/dom/ImmutableDomObject.java | 63 - .../java/com/taobao/weex/dom/RenderAction.java | 29 - .../taobao/weex/dom/RenderActionContext.java | 32 - .../com/taobao/weex/dom/RenderActionTask.java | 65 - .../java/com/taobao/weex/dom/RenderContext.java | 32 + .../weex/dom/SafePutConcurrentHashMap.java | 51 - .../weex/dom/TextAreaEditTextDomObject.java | 58 - .../main/java/com/taobao/weex/dom/WXAttr.java | 109 +- .../com/taobao/weex/dom/WXCellDomObject.java | 124 - .../java/com/taobao/weex/dom/WXDomHandler.java | 146 - .../java/com/taobao/weex/dom/WXDomManager.java | 237 - .../java/com/taobao/weex/dom/WXDomModule.java | 175 - .../java/com/taobao/weex/dom/WXDomObject.java | 936 --- .../com/taobao/weex/dom/WXDomObjectFactory.java | 58 - .../java/com/taobao/weex/dom/WXDomRegistry.java | 59 - .../java/com/taobao/weex/dom/WXDomTask.java | 34 - .../main/java/com/taobao/weex/dom/WXEvent.java | 6 +- .../com/taobao/weex/dom/WXListDomObject.java | 51 - .../taobao/weex/dom/WXRecyclerDomObject.java | 281 - .../taobao/weex/dom/WXScrollerDomObject.java | 49 - .../main/java/com/taobao/weex/dom/WXStyle.java | 463 +- .../com/taobao/weex/dom/WXSwitchDomObject.java | 58 - .../com/taobao/weex/dom/WXTextDomObject.java | 601 -- .../dom/action/AbstractAddElementAction.java | 182 - .../dom/action/AbstractLayoutFinishAction.java | 52 - .../java/com/taobao/weex/dom/action/Action.java | 26 - .../com/taobao/weex/dom/action/Actions.java | 237 - .../weex/dom/action/AddElementAction.java | 155 - .../taobao/weex/dom/action/AddEventAction.java | 109 - .../taobao/weex/dom/action/AddRuleAction.java | 68 - .../taobao/weex/dom/action/AnimationAction.java | 299 - .../weex/dom/action/CreateBodyAction.java | 144 - .../weex/dom/action/CreateFinishAction.java | 64 - .../weex/dom/action/ExecutableRenderAction.java | 48 - .../weex/dom/action/GetComponentRectAction.java | 116 - .../weex/dom/action/InvokeMethodAction.java | 50 - .../weex/dom/action/ModuleInvocationAction.java | 76 - .../weex/dom/action/MoveElementAction.java | 103 - .../weex/dom/action/RefreshFinishAction.java | 39 - .../weex/dom/action/ReloadPageAction.java | 66 - .../weex/dom/action/RemoveElementAction.java | 109 - .../weex/dom/action/RemoveEventAction.java | 80 - .../weex/dom/action/ScrollToElementAction.java | 67 - .../taobao/weex/dom/action/TraceableAction.java | 83 - .../weex/dom/action/UpdateAttributeAction.java | 83 - .../dom/action/UpdateComponentDataAction.java | 69 - .../weex/dom/action/UpdateFinishAction.java | 46 - .../weex/dom/action/UpdateStyleAction.java | 118 - .../java/com/taobao/weex/dom/flex/CSSAlign.java | 14 - .../com/taobao/weex/dom/flex/CSSConstants.java | 15 - .../com/taobao/weex/dom/flex/CSSDirection.java | 12 - .../taobao/weex/dom/flex/CSSFlexDirection.java | 13 - .../com/taobao/weex/dom/flex/CSSJustify.java | 14 - .../com/taobao/weex/dom/flex/CSSLayout.java | 76 - .../taobao/weex/dom/flex/CSSLayoutContext.java | 18 - .../java/com/taobao/weex/dom/flex/CSSNode.java | 642 -- .../taobao/weex/dom/flex/CSSPositionType.java | 11 - .../java/com/taobao/weex/dom/flex/CSSStyle.java | 123 - .../java/com/taobao/weex/dom/flex/CSSWrap.java | 11 - .../taobao/weex/dom/flex/CachedCSSLayout.java | 18 - .../com/taobao/weex/dom/flex/FloatUtil.java | 18 - .../com/taobao/weex/dom/flex/LayoutEngine.java | 934 --- .../com/taobao/weex/dom/flex/MeasureOutput.java | 15 - .../java/com/taobao/weex/dom/flex/Spacing.java | 237 - .../weex/dom/text/FontBroadcastReceiver.java | 79 - .../weex/dom/transition/WXTransition.java | 317 +- .../com/taobao/weex/el/parse/Operators.java | 17 +- .../java/com/taobao/weex/el/parse/Parser.java | 3 +- .../java/com/taobao/weex/http/WXHttpUtil.java | 8 +- .../com/taobao/weex/http/WXStreamModule.java | 20 +- .../weex/layout/ContentBoxMeasurement.java | 78 + .../com/taobao/weex/layout/MeasureMode.java | 40 + .../com/taobao/weex/layout/MeasureSize.java | 42 + .../measurefunc/TextContentBoxMeasurement.java | 472 ++ .../performance/WXAnalyzerDataTransfer.java | 22 +- .../java/com/taobao/weex/tracing/WXTracing.java | 2 +- .../com/taobao/weex/ui/ComponentCreator.java | 4 +- .../weex/ui/ExternalLoaderComponentHolder.java | 14 +- .../java/com/taobao/weex/ui/IWXRenderTask.java | 26 - .../taobao/weex/ui/RenderActionContextImpl.java | 113 - .../com/taobao/weex/ui/RenderContextImpl.java | 75 + .../taobao/weex/ui/SimpleComponentHolder.java | 24 +- .../com/taobao/weex/ui/WXComponentRegistry.java | 1 + .../com/taobao/weex/ui/WXRenderHandler.java | 24 +- .../com/taobao/weex/ui/WXRenderManager.java | 138 +- .../taobao/weex/ui/action/ActionAddRule.java | 78 + .../weex/ui/action/ActionGetComponentRect.java | 120 + .../weex/ui/action/ActionInvokeMethod.java | 54 + .../taobao/weex/ui/action/ActionReloadPage.java | 49 + .../weex/ui/action/BasicComponentData.java | 265 + .../weex/ui/action/BasicGraphicAction.java | 69 + .../action/GraphicActionAbstractAddElement.java | 94 + .../weex/ui/action/GraphicActionAddElement.java | 115 + .../weex/ui/action/GraphicActionAddEvent.java | 53 + .../weex/ui/action/GraphicActionAnimation.java | 266 + .../weex/ui/action/GraphicActionCreateBody.java | 99 + .../ui/action/GraphicActionCreateFinish.java | 70 + .../weex/ui/action/GraphicActionLayout.java | 51 + .../ui/action/GraphicActionMoveElement.java | 52 + .../ui/action/GraphicActionRefreshFinish.java | 55 + .../ui/action/GraphicActionRemoveElement.java | 56 + .../ui/action/GraphicActionRemoveEvent.java | 49 + .../ui/action/GraphicActionScrollToElement.java | 51 + .../weex/ui/action/GraphicActionUpdateAttr.java | 52 + .../ui/action/GraphicActionUpdateStyle.java | 134 + .../taobao/weex/ui/action/GraphicPosition.java | 66 + .../com/taobao/weex/ui/action/GraphicSize.java | 46 + .../com/taobao/weex/ui/action/IExecutable.java | 25 + .../weex/ui/animation/TransformParser.java | 25 +- .../weex/ui/animation/WXAnimationBean.java | 12 +- .../weex/ui/animation/WXAnimationModule.java | 27 +- .../ui/component/AbstractEditComponent.java | 149 +- .../weex/ui/component/ComponentUtils.java | 125 +- .../com/taobao/weex/ui/component/Textarea.java | 41 +- .../java/com/taobao/weex/ui/component/WXA.java | 25 +- .../taobao/weex/ui/component/WXBaseRefresh.java | 6 +- .../taobao/weex/ui/component/WXComponent.java | 1555 ++--- .../weex/ui/component/WXComponentFactory.java | 37 +- .../weex/ui/component/WXComponentProp.java | 5 +- .../com/taobao/weex/ui/component/WXDiv.java | 25 +- .../com/taobao/weex/ui/component/WXEmbed.java | 64 +- .../com/taobao/weex/ui/component/WXHeader.java | 12 +- .../com/taobao/weex/ui/component/WXImage.java | 238 +- .../taobao/weex/ui/component/WXIndicator.java | 47 +- .../com/taobao/weex/ui/component/WXInput.java | 15 +- .../com/taobao/weex/ui/component/WXLoading.java | 18 +- .../weex/ui/component/WXLoadingIndicator.java | 7 +- .../com/taobao/weex/ui/component/WXRefresh.java | 23 +- .../taobao/weex/ui/component/WXScroller.java | 95 +- .../com/taobao/weex/ui/component/WXSlider.java | 28 +- .../weex/ui/component/WXSliderNeighbor.java | 10 +- .../com/taobao/weex/ui/component/WXSwitch.java | 76 +- .../com/taobao/weex/ui/component/WXText.java | 127 +- .../taobao/weex/ui/component/WXVContainer.java | 182 +- .../com/taobao/weex/ui/component/WXVideo.java | 18 +- .../com/taobao/weex/ui/component/WXWeb.java | 18 +- .../ui/component/basic/WXBasicComponent.java | 215 + .../weex/ui/component/binding/Layouts.java | 135 +- .../weex/ui/component/binding/Statements.java | 74 +- .../component/helper/ScrollStartEndHelper.java | 15 +- .../ui/component/helper/WXTimeInputHelper.java | 70 +- .../ui/component/list/BasicListComponent.java | 305 +- .../ui/component/list/GapItemDecoration.java | 52 +- .../component/list/HorizontalListComponent.java | 6 +- .../ui/component/list/SimpleListComponent.java | 6 +- .../ui/component/list/StickyHeaderHelper.java | 46 +- .../taobao/weex/ui/component/list/WXCell.java | 71 +- .../weex/ui/component/list/WXListComponent.java | 250 +- .../list/template/AsyncCellLoadTask.java | 2 +- .../list/template/CellDataManager.java | 3 +- .../component/list/template/TemplateCache.java | 2 + .../list/template/TemplateStickyHelper.java | 14 +- .../list/template/TemplateViewHolder.java | 32 +- .../list/template/WXRecyclerTemplateList.java | 217 +- .../pesudo/OnActivePseudoListener.java | 26 - .../component/pesudo/OnActivePseudoListner.java | 26 + .../pesudo/TouchActivePseudoListener.java | 12 +- .../weex/ui/config/ConfigComponentHolder.java | 6 +- .../weex/ui/config/ConfigModuleFactory.java | 1 - .../com/taobao/weex/ui/flat/FlatComponent.java | 4 +- .../com/taobao/weex/ui/flat/FlatGUIContext.java | 62 +- .../taobao/weex/ui/flat/WidgetContainer.java | 15 +- .../weex/ui/flat/widget/AndroidViewWidget.java | 14 +- .../taobao/weex/ui/flat/widget/BaseWidget.java | 4 +- .../taobao/weex/ui/flat/widget/TextWidget.java | 1 + .../com/taobao/weex/ui/flat/widget/Widget.java | 10 +- .../taobao/weex/ui/flat/widget/WidgetGroup.java | 4 +- .../com/taobao/weex/ui/module/WXDomModule.java | 161 + .../com/taobao/weex/ui/module/WXMetaModule.java | 10 +- .../taobao/weex/ui/module/WXTimerModule.java | 57 +- .../java/com/taobao/weex/ui/view/IWebView.java | 4 +- .../taobao/weex/ui/view/WXCircleViewPager.java | 4 +- .../com/taobao/weex/ui/view/WXImageView.java | 34 +- .../com/taobao/weex/ui/view/WXScrollView.java | 8 +- .../com/taobao/weex/ui/view/WXSwitchView.java | 35 - .../com/taobao/weex/ui/view/WXTextView.java | 4 +- .../com/taobao/weex/ui/view/WXVideoView.java | 8 +- .../weex/ui/view/border/BorderCorner.java | 207 +- .../weex/ui/view/border/BorderDrawable.java | 332 +- .../taobao/weex/ui/view/border/BorderEdge.java | 82 +- .../taobao/weex/ui/view/border/BorderStyle.java | 23 +- .../taobao/weex/ui/view/border/BorderUtil.java | 53 +- .../view/border/BorderWidthStyleColorType.java | 38 - .../weex/ui/view/border/BottomLeftCorner.java | 77 +- .../weex/ui/view/border/BottomRightCorner.java | 81 +- .../weex/ui/view/border/TopLeftCorner.java | 74 +- .../weex/ui/view/border/TopRightCorner.java | 77 +- .../taobao/weex/ui/view/gesture/WXGesture.java | 38 +- .../ui/view/gesture/WXGestureObservable.java | 4 +- .../ui/view/refresh/core/WXRefreshView.java | 4 +- .../ui/view/refresh/core/WXSwipeLayout.java | 40 +- .../ui/view/refresh/wrapper/BaseBounceView.java | 51 +- .../com/taobao/weex/utils/FunctionParser.java | 20 +- .../com/taobao/weex/utils/ImageDrawable.java | 10 +- .../taobao/weex/utils/SingleFunctionParser.java | 2 +- .../taobao/weex/utils/StaticLayoutProxy.java | 8 +- .../com/taobao/weex/utils/TypefaceUtil.java | 4 +- .../java/com/taobao/weex/utils/WXDomUtils.java | 64 +- .../com/taobao/weex/utils/WXExceptionUtils.java | 124 +- .../java/com/taobao/weex/utils/WXJsonUtils.java | 37 - .../java/com/taobao/weex/utils/WXLogUtils.java | 66 +- .../taobao/weex/utils/WXReflectionUtils.java | 18 +- .../com/taobao/weex/utils/WXResourceUtils.java | 106 +- .../taobao/weex/utils/WXSoInstallMgrSdk.java | 63 +- .../java/com/taobao/weex/utils/WXUtils.java | 135 +- .../java/com/taobao/weex/utils/WXViewUtils.java | 37 +- .../main/java/com/taobao/weex/wson/Wson.java | 820 --- .../java/com/taobao/weex/WXSDKEngineTest.java | 7 - .../java/com/taobao/weex/WXSDKInstanceTest.java | 1 - .../weex/adapter/DefaultUriAdapterTest.java | 2 +- .../taobao/weex/bridge/WXBridgeManagerTest.java | 10 +- .../com/taobao/weex/bridge/WXBridgeTest.java | 5 +- .../java/com/taobao/weex/dom/TestDomObject.java | 55 - .../com/taobao/weex/dom/WXDomModuleTest.java | 131 - .../com/taobao/weex/dom/WXDomObjectTest.java | 108 - .../com/taobao/weex/dom/WXDomStatementTest.java | 9 +- .../taobao/weex/dom/WXTextDomObjectTest.java | 5 +- .../com/taobao/weex/dom/action/TestActions.java | 77 - .../weex/dom/transition/WXTransitionTest.java | 96 - .../java/com/taobao/weex/el/FailedCaseTest.java | 50 - .../com/taobao/weex/el/IfStatementTest.java | 155 - .../java/com/taobao/weex/el/ParserTest.java | 244 - .../taobao/weex/http/WXStreamModuleTest.java | 15 +- .../com/taobao/weex/ui/ComponentHolderTest.java | 3 - .../taobao/weex/ui/WXRenderStatementTest.java | 4 +- .../weex/ui/animation/TransformParserTest.java | 38 - .../ui/animation/WXAnimationModuleTest.java | 5 +- .../taobao/weex/ui/component/ComponentTest.java | 9 +- .../weex/ui/component/EditComponentTest.java | 1 - .../weex/ui/component/PriorityQueueTest.java | 56 - .../taobao/weex/ui/component/TestComponent.java | 4 - .../weex/ui/component/WXComponentTest.java | 2 +- .../com/taobao/weex/ui/component/WXDivTest.java | 11 +- .../taobao/weex/ui/component/WXEmbedTest.java | 6 +- .../taobao/weex/ui/component/WXHeaderTest.java | 4 - .../taobao/weex/ui/component/WXImageTest.java | 2 - .../taobao/weex/ui/component/WXLoadingTest.java | 3 - .../taobao/weex/ui/component/WXRefreshTest.java | 1 - .../weex/ui/component/WXScrollerTest.java | 5 - .../weex/ui/component/WXSliderNeighborTest.java | 1 - .../taobao/weex/ui/component/WXSliderTest.java | 1 - .../taobao/weex/ui/component/WXSwitchTest.java | 3 - .../taobao/weex/ui/component/WXTextTest.java | 22 +- .../taobao/weex/ui/component/WXVideoTest.java | 4 - .../com/taobao/weex/ui/component/WXWebTest.java | 3 - .../ui/component/binding/BindingValueTest.java | 65 - .../ui/component/binding/StatementTest.java | 186 - .../component/list/DefaultDragHelperTest.java | 3 - .../ui/component/list/WXListComponentTest.java | 5 +- .../weex/ui/module/WXModalUIModuleTest.java | 9 +- .../weex/ui/module/WXTimerModuleTest.java | 45 +- .../weex/ui/view/border/BorderDrawableTest.java | 1 - .../weex/ui/view/gesture/WXGestureTest.java | 5 - .../taobao/weex/utils/WXExceptionUtilsTest.java | 74 - .../com/taobao/weex/utils/WXFileUtilsTest.java | 9 - .../com/taobao/weex/utils/WXLogUtilsTest.java | 17 +- .../weex/utils/WXReflectionUtilsTest.java | 9 - .../java/com/taobao/weex/utils/WXUtilsTest.java | 3 +- .../java/com/taobao/weex/wson/AnnoTest.java | 41 - .../test/java/com/taobao/weex/wson/Person.java | 30 - weex_core/.clang-format | 2 + weex_core/.gitignore | 5 + weex_core/CMakeLists.txt | 5 + weex_core/Source/CMakeLists.txt | 91 + weex_core/Source/IPC/Buffering/IPCBuffer.h | 13 + weex_core/Source/IPC/CMakeLists.txt | 22 + weex_core/Source/IPC/IPCArguments.h | 30 + weex_core/Source/IPC/IPCByteArray.h | 8 + weex_core/Source/IPC/IPCCheck.cpp | 17 + weex_core/Source/IPC/IPCCheck.h | 16 + weex_core/Source/IPC/IPCCommunicator.cpp | 363 ++ weex_core/Source/IPC/IPCCommunicator.h | 30 + weex_core/Source/IPC/IPCException.cpp | 32 + weex_core/Source/IPC/IPCException.h | 16 + weex_core/Source/IPC/IPCFutexPageQueue.cpp | 191 + weex_core/Source/IPC/IPCFutexPageQueue.h | 48 + weex_core/Source/IPC/IPCHandler.cpp | 36 + weex_core/Source/IPC/IPCHandler.h | 18 + weex_core/Source/IPC/IPCListener.cpp | 60 + weex_core/Source/IPC/IPCListener.h | 14 + weex_core/Source/IPC/IPCLog.h | 12 + weex_core/Source/IPC/IPCMessageJS.h | 41 + weex_core/Source/IPC/IPCResult.cpp | 347 + weex_core/Source/IPC/IPCResult.h | 34 + weex_core/Source/IPC/IPCSender.cpp | 76 + weex_core/Source/IPC/IPCSender.h | 15 + weex_core/Source/IPC/IPCString.h | 7 + weex_core/Source/IPC/IPCType.h | 29 + .../Source/IPC/Serializing/IPCSerializer.cpp | 206 + .../Source/IPC/Serializing/IPCSerializer.h | 26 + weex_core/Source/IPC/ashmem.c | 100 + weex_core/Source/IPC/ashmem.h | 46 + weex_core/Source/IPC/futex.h | 109 + weex_core/Source/__init__.py | 0 weex_core/Source/android/__init__.py | 0 weex_core/Source/android/base/base64/base64.cpp | 33 + weex_core/Source/android/base/base64/base64.h | 9 + .../android/base/base64/modp_base64/modp_b64.cc | 265 + .../android/base/base64/modp_base64/modp_b64.h | 165 + .../base/base64/modp_base64/modp_b64_data.h | 285 + .../Source/android/base/jni/android_jni.cpp | 90 + weex_core/Source/android/base/jni/android_jni.h | 45 + .../Source/android/base/jni/scoped_java_ref.cpp | 57 + .../Source/android/base/jni/scoped_java_ref.h | 104 + weex_core/Source/android/base/log_utils.h | 37 + .../android/base/string/scoped_jstring.cpp | 29 + .../Source/android/base/string/scoped_jstring.h | 27 + .../android/base/string/scoped_jstring_utf8.cpp | 20 + .../android/base/string/scoped_jstring_utf8.h | 31 + .../Source/android/base/string/string_utils.h | 132 + .../android/bridge/impl/bridge_impl_android.cpp | 875 +++ .../android/bridge/impl/bridge_impl_android.h | 106 + .../content_box_measurement_impl_android.cpp | 36 + .../impl/content_box_measurement_impl_android.h | 23 + .../bridge/impl/measure_mode_impl_android.cpp | 18 + .../bridge/impl/measure_mode_impl_android.h | 15 + .../bridge/impl/weexcore_impl_android.cpp | 443 ++ .../android/bridge/impl/weexcore_impl_android.h | 37 + .../Source/android/jniprebuild/__init__.py | 0 .../android/jniprebuild/android_jar.classes | 98 + weex_core/Source/android/jniprebuild/jni_files | 5 + .../Source/android/jniprebuild/jni_generator.py | 1469 +++++ .../Source/android/jniprebuild/jni_load.cc | 24 + .../jniheader/ContentBoxMeasurement_jni.h | 165 + .../jniprebuild/jniheader/MeasureMode_jni.h | 85 + .../jniheader/SystemMessageHandler_jni.h | 132 + .../jniprebuild/jniheader/WXBridge_jni.h | 345 + .../Source/android/jniprebuild/prebuild.sh | 13 + .../jsengine/multiprocess/ExtendJSApi.cpp | 662 ++ .../android/jsengine/multiprocess/ExtendJSApi.h | 87 + .../jsengine/multiprocess/WeexJSConnection.cpp | 411 ++ .../jsengine/multiprocess/WeexJSConnection.h | 25 + .../android/jsengine/multiprocess/WeexProxy.cpp | 690 ++ .../android/jsengine/multiprocess/WeexProxy.h | 76 + weex_core/Source/base/Compatible.cpp | 122 + weex_core/Source/base/CoreConstants.h | 10 + weex_core/Source/base/TimeUtils.h | 12 + weex_core/Source/base/ViewUtils.h | 102 + weex_core/Source/base/fpconv.cpp | 332 + weex_core/Source/base/fpconv.h | 33 + weex_core/Source/base/powers.h | 129 + weex_core/Source/core/bridge/bridge.h | 81 + .../Source/core/config/core_environment.cpp | 63 + weex_core/Source/core/config/core_environment.h | 68 + weex_core/Source/core/css/constants_name.h | 63 + weex_core/Source/core/css/constants_value.h | 45 + weex_core/Source/core/css/css_value_getter.cpp | 88 + weex_core/Source/core/css/css_value_getter.h | 23 + weex_core/Source/core/layout/flex_enum.h | 107 + weex_core/Source/core/layout/layout.cpp | 1034 +++ weex_core/Source/core/layout/layout.h | 1073 +++ weex_core/Source/core/layout/style.cpp | 247 + weex_core/Source/core/layout/style.h | 285 + .../Source/core/moniter/render_performance.cpp | 32 + .../Source/core/moniter/render_performance.h | 51 + weex_core/Source/core/parser/dom_parser.cpp | 564 ++ weex_core/Source/core/parser/dom_parser.h | 129 + .../Source/core/render/action/render_action.h | 20 + .../render/action/render_action_add_element.cpp | 33 + .../render/action/render_action_add_element.h | 31 + .../render/action/render_action_add_event.cpp | 24 + .../render/action/render_action_add_event.h | 22 + .../render/action/render_action_createbody.cpp | 29 + .../render/action/render_action_createbody.h | 27 + .../action/render_action_createfinish.cpp | 19 + .../render/action/render_action_createfinish.h | 20 + .../core/render/action/render_action_layout.cpp | 33 + .../core/render/action/render_action_layout.h | 31 + .../action/render_action_move_element.cpp | 22 + .../render/action/render_action_move_element.h | 24 + .../action/render_action_remove_element.cpp | 19 + .../action/render_action_remove_element.h | 20 + .../action/render_action_remove_event.cpp | 24 + .../render/action/render_action_remove_event.h | 22 + .../render/action/render_action_update_attr.cpp | 22 + .../render/action/render_action_update_attr.h | 23 + .../action/render_action_update_style.cpp | 29 + .../render/action/render_action_update_style.h | 30 + .../core/render/manager/render_manager.cpp | 196 + .../Source/core/render/manager/render_manager.h | 73 + .../core/render/node/factory/i_render_factory.h | 13 + .../core/render/node/factory/i_render_object.h | 42 + .../render/node/factory/render_appbar_factory.h | 18 + .../render/node/factory/render_cell_factory.h | 17 + .../core/render/node/factory/render_creator.cpp | 53 + .../core/render/node/factory/render_creator.h | 45 + .../node/factory/render_indicator_factory.h | 18 + .../render/node/factory/render_input_factory.h | 18 + .../render/node/factory/render_list_factory.h | 18 + .../render/node/factory/render_mask_factory.h | 18 + .../node/factory/render_scroller_factory.h | 18 + .../render/node/factory/render_switch_factory.h | 18 + .../render/node/factory/render_text_factory.h | 18 + .../node/factory/render_textarea_factory.h | 18 + .../core/render/node/factory/render_type.h | 23 + .../render/node/factory/simple_render_factory.h | 19 + .../Source/core/render/node/render_appbar.h | 68 + weex_core/Source/core/render/node/render_cell.h | 12 + .../Source/core/render/node/render_indicator.h | 12 + .../Source/core/render/node/render_input.h | 12 + weex_core/Source/core/render/node/render_list.h | 217 + weex_core/Source/core/render/node/render_mask.h | 37 + .../Source/core/render/node/render_object.cpp | 139 + .../Source/core/render/node/render_object.h | 394 ++ .../Source/core/render/node/render_scroller.h | 47 + .../Source/core/render/node/render_switch.h | 12 + weex_core/Source/core/render/node/render_text.h | 26 + .../Source/core/render/node/render_textarea.h | 12 + .../Source/core/render/page/render_page.cpp | 631 ++ weex_core/Source/core/render/page/render_page.h | 180 + weex_core/Source/rapidjson/allocators.h | 271 + weex_core/Source/rapidjson/document.h | 2618 ++++++++ weex_core/Source/rapidjson/encodedstream.h | 299 + weex_core/Source/rapidjson/encodings.h | 716 +++ weex_core/Source/rapidjson/error/en.h | 74 + weex_core/Source/rapidjson/error/error.h | 161 + weex_core/Source/rapidjson/filereadstream.h | 99 + weex_core/Source/rapidjson/filewritestream.h | 104 + weex_core/Source/rapidjson/fwd.h | 151 + .../Source/rapidjson/internal/biginteger.h | 290 + weex_core/Source/rapidjson/internal/diyfp.h | 258 + weex_core/Source/rapidjson/internal/dtoa.h | 245 + weex_core/Source/rapidjson/internal/ieee754.h | 78 + weex_core/Source/rapidjson/internal/itoa.h | 304 + weex_core/Source/rapidjson/internal/meta.h | 181 + weex_core/Source/rapidjson/internal/pow10.h | 55 + weex_core/Source/rapidjson/internal/regex.h | 734 +++ weex_core/Source/rapidjson/internal/stack.h | 231 + weex_core/Source/rapidjson/internal/strfunc.h | 69 + weex_core/Source/rapidjson/internal/strtod.h | 269 + weex_core/Source/rapidjson/internal/swap.h | 46 + weex_core/Source/rapidjson/istreamwrapper.h | 115 + weex_core/Source/rapidjson/memorybuffer.h | 70 + weex_core/Source/rapidjson/memorystream.h | 71 + .../Source/rapidjson/msinttypes/inttypes.h | 316 + weex_core/Source/rapidjson/msinttypes/stdint.h | 300 + weex_core/Source/rapidjson/ostreamwrapper.h | 81 + weex_core/Source/rapidjson/pointer.h | 1358 ++++ weex_core/Source/rapidjson/prettywriter.h | 277 + weex_core/Source/rapidjson/rapidjson.h | 628 ++ weex_core/Source/rapidjson/reader.h | 2221 +++++++ weex_core/Source/rapidjson/schema.h | 2026 ++++++ weex_core/Source/rapidjson/stream.h | 179 + weex_core/Source/rapidjson/stringbuffer.h | 121 + weex_core/Source/rapidjson/writer.h | 711 ++ weex_core/Source/weexjsc_version_script.txt | 4 + weex_core/__init__.py | 0 weex_core/tools/cpplint.py | 6086 ++++++++++++++++++ 525 files changed, 48301 insertions(+), 17659 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/commons/build.gradle ---------------------------------------------------------------------- diff --git a/android/commons/build.gradle b/android/commons/build.gradle index 9f5c82c..cbf02b0 100644 --- a/android/commons/build.gradle +++ b/android/commons/build.gradle @@ -2,6 +2,8 @@ apply plugin: 'com.android.library' android { + + publishNonDefault true compileSdkVersion project.compileSdkVersion buildToolsVersion project.buildToolsVersion resourcePrefix "weexcomm" @@ -27,6 +29,12 @@ android { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } + + debug { + jniDebuggable true + debuggable true + + } } } @@ -34,7 +42,9 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile "com.android.support:support-v4:${project.supportLibVersion}" compile "com.android.support:appcompat-v7:${project.supportLibVersion}" - compile project(':weex_sdk') + // compile project(':weex_sdk') + debugCompile project(path: ':weex_sdk', configuration: 'debug') + releaseCompile project(path: ':weex_sdk', configuration: 'release') compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.facebook.fresco:fresco:0.10.0' compile 'com.taobao.android.weex_inspection:protocol:1.1.4.1' http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/commons/src/main/java/com/alibaba/weex/commons/AbstractWeexActivity.java ---------------------------------------------------------------------- diff --git a/android/commons/src/main/java/com/alibaba/weex/commons/AbstractWeexActivity.java b/android/commons/src/main/java/com/alibaba/weex/commons/AbstractWeexActivity.java index 3627b8c..8854ce2 100644 --- a/android/commons/src/main/java/com/alibaba/weex/commons/AbstractWeexActivity.java +++ b/android/commons/src/main/java/com/alibaba/weex/commons/AbstractWeexActivity.java @@ -124,8 +124,6 @@ public abstract class AbstractWeexActivity extends AppCompatActivity implements template, options, jsonInitData, - ScreenUtil.getDisplayWidth(this), - ScreenUtil.getDisplayHeight(this), WXRenderStrategy.APPEND_ASYNC); } @@ -143,8 +141,6 @@ public abstract class AbstractWeexActivity extends AppCompatActivity implements url, options, jsonInitData, - ScreenUtil.getDisplayWidth(this), - ScreenUtil.getDisplayHeight(this), WXRenderStrategy.APPEND_ASYNC); } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/commons/src/main/java/com/alibaba/weex/commons/adapter/FrescoImageComponent.java ---------------------------------------------------------------------- diff --git a/android/commons/src/main/java/com/alibaba/weex/commons/adapter/FrescoImageComponent.java b/android/commons/src/main/java/com/alibaba/weex/commons/adapter/FrescoImageComponent.java index 109302f..56e9a25 100644 --- a/android/commons/src/main/java/com/alibaba/weex/commons/adapter/FrescoImageComponent.java +++ b/android/commons/src/main/java/com/alibaba/weex/commons/adapter/FrescoImageComponent.java @@ -22,7 +22,7 @@ import android.content.Context; import android.support.annotation.NonNull; import android.widget.ImageView; import com.taobao.weex.WXSDKInstance; -import com.taobao.weex.dom.WXDomObject; +import com.taobao.weex.ui.action.BasicComponentData; import com.taobao.weex.ui.component.WXImage; import com.taobao.weex.ui.component.WXVContainer; @@ -31,8 +31,8 @@ import com.taobao.weex.ui.component.WXVContainer; */ public class FrescoImageComponent extends WXImage { - public FrescoImageComponent(WXSDKInstance instance, WXDomObject node, WXVContainer parent) { - super(instance, node, parent); + public FrescoImageComponent(WXSDKInstance instance, WXVContainer parent, BasicComponentData basicComponentData) { + super(instance, parent, basicComponentData); } @Override http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/commons/src/main/java/com/alibaba/weex/commons/adapter/ImageAdapter.java ---------------------------------------------------------------------- diff --git a/android/commons/src/main/java/com/alibaba/weex/commons/adapter/ImageAdapter.java b/android/commons/src/main/java/com/alibaba/weex/commons/adapter/ImageAdapter.java index 5a7a311..c6f2e64 100644 --- a/android/commons/src/main/java/com/alibaba/weex/commons/adapter/ImageAdapter.java +++ b/android/commons/src/main/java/com/alibaba/weex/commons/adapter/ImageAdapter.java @@ -54,10 +54,6 @@ public class ImageAdapter implements IWXImgLoaderAdapter { if (url.startsWith("//")) { temp = "http:" + url; } - if (view.getLayoutParams().width <= 0 || view.getLayoutParams().height <= 0) { - return; - } - if(!TextUtils.isEmpty(strategy.placeHolder)){ Picasso.Builder builder=new Picasso.Builder(WXEnvironment.getApplication()); http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/build.gradle ---------------------------------------------------------------------- diff --git a/android/playground/app/build.gradle b/android/playground/app/build.gradle index 422dd25..f8b870c 100755 --- a/android/playground/app/build.gradle +++ b/android/playground/app/build.gradle @@ -11,9 +11,9 @@ android { versionCode 17 versionName "0.18.0-beta-3" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + multiDexEnabled true ndk{ - abiFilters "x86" - abiFilters "armeabi" + abiFilters "armeabi","x86" } } applicationVariants.all { variant -> @@ -35,7 +35,8 @@ android { } buildTypes { debug { - testCoverageEnabled false + jniDebuggable true + debuggable true } } sourceSets { @@ -59,6 +60,7 @@ android { dexOptions { preDexLibraries false } + } @@ -66,6 +68,8 @@ dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile "com.android.support:support-annotations:${project.supportLibVersion}" androidTestCompile 'junit:junit:4.12' + androidTestCompile 'org.awaitility:awaitility:3.0.0' + androidTestCompile 'org.awaitility:awaitility-proxy:3.0.0' androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' @@ -79,7 +83,12 @@ dependencies { androidTestCompile 'org.hamcrest:hamcrest-library:1.3' androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2' /*source dependency*/ - compile project(':weex_sdk') + + debugCompile project(path: ':commons', configuration: 'debug') + releaseCompile project(path: ':commons', configuration: 'release') + + debugCompile project(path: ':weex_sdk', configuration: 'debug') + releaseCompile project(path: ':weex_sdk', configuration: 'release') //https://github.com/weexteam/weex-analyzer-android //Weex-Analyzer provides several convenient tools such as Memory Monitor @@ -87,7 +96,7 @@ dependencies { // set WXAnalyzerDelegate#DEBUG==true to enable it debugCompile 'com.taobao.android:weex_analyzer:0.1.0.5' - compile project(':commons') + compile 'com.taobao.android:dexposed:0.1.8' compile 'com.loopj.android:android-async-http:1.4.9@aar' compile 'com.facebook.fresco:fresco:0.12.0+' @@ -104,5 +113,6 @@ dependencies { compile 'com.jakewharton.scalpel:scalpel:1.1.2' compile 'com.taobao.android.weex_inspection:urlconnection_interceptor:1.0.0' compile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2' - compile 'com.taobao.android:weex_inspector:0.13.5-multicontext' -} \ No newline at end of file + compile 'com.taobao.android:weex_inspector:0.11.0' + //compile project(":weex_inspector") +} http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/BenchmarkActivityTestRule.java ---------------------------------------------------------------------- diff --git a/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/BenchmarkActivityTestRule.java b/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/BenchmarkActivityTestRule.java deleted file mode 100644 index 492b4c4..0000000 --- a/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/BenchmarkActivityTestRule.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package com.alibaba.weex.benchmark; - -import android.support.test.espresso.Espresso; -import android.support.test.espresso.idling.CountingIdlingResource; -import android.support.test.rule.ActivityTestRule; - -import com.alibaba.weex.BenchmarkActivity; - -class BenchmarkActivityTestRule extends ActivityTestRule<BenchmarkActivity> { - - BenchmarkActivityTestRule(Class<BenchmarkActivity> activityClass) { - this(activityClass,true); - } - - BenchmarkActivityTestRule(Class<BenchmarkActivity> activityClass,boolean launchActivity) { - super(activityClass,false,launchActivity); - } - - @Override - protected void beforeActivityLaunched() { - if(BenchmarkActivity.countingIdlingResource==null) { - BenchmarkActivity.countingIdlingResource = new CountingIdlingResource - ("TC_Monitor_List_With_Append_Tree"); - } - Espresso.registerIdlingResources(BenchmarkActivity.countingIdlingResource); - } - - @Override - protected void afterActivityFinished() { - super.afterActivityLaunched(); - Espresso.unregisterIdlingResources(BenchmarkActivity.countingIdlingResource); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/BenchmarkTest.java ---------------------------------------------------------------------- diff --git a/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/BenchmarkTest.java b/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/BenchmarkTest.java index 2c5f8e7..27a90f2 100644 --- a/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/BenchmarkTest.java +++ b/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/BenchmarkTest.java @@ -22,10 +22,12 @@ package com.alibaba.weex.benchmark; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.matcher.ViewMatchers.withClassName; import static org.hamcrest.MatcherAssert.assertThat; - +import static org.awaitility.Awaitility.await; +import static org.hamcrest.MatcherAssert.assertThat; +import android.support.annotation.NonNull; import android.support.test.InstrumentationRegistry; -import android.support.test.espresso.contrib.RecyclerViewActions; import android.support.test.filters.SdkSuppress; +import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.support.test.uiautomator.By; import android.support.test.uiautomator.Direction; @@ -35,7 +37,8 @@ import android.support.test.uiautomator.Until; import android.text.TextUtils; import android.util.Log; import com.alibaba.weex.BenchmarkActivity; -import com.taobao.weex.ui.view.listview.WXRecyclerView; +import com.taobao.weex.WXEnvironment; +import com.taobao.weex.common.WXPerformance; import com.taobao.weex.utils.WXLogUtils; import java.io.BufferedReader; import java.io.IOException; @@ -43,6 +46,7 @@ import java.io.StringReader; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; import org.hamcrest.Matchers; import org.junit.AfterClass; @@ -55,14 +59,15 @@ import org.junit.runner.RunWith; public class BenchmarkTest { private static final String TAG = "benchmark"; - private static final int TIMES = 20; + private static final int TIMES = 50; private static final int FLING_SPEED = 10000; private static final int SCROLL_SPEED = 5000; private static final int FRAMES = 120; private static final long WAIT_TIMEOUT = 10000; private static final float FPS = 30; - private static final float FIRST_SCREEN_RENDER_TIME = 600F; + private static final float FIRST_SCREEN_RENDER_TIME = 5000F; private static List<Long> firstScreenRenderTime = new LinkedList<>(); + private static List<Long> firstScreenLayoutTime = new LinkedList<>(); private static List<Long> flingFrameSeconds = new LinkedList<>(); private static List<Long> scrollFrameSeconds = new LinkedList<>(); private static final String DUMP_START = "QueueBufferDuration,\n"; @@ -70,36 +75,47 @@ public class BenchmarkTest { private static final String DUMP_COMMAND = "dumpsys gfxinfo com.alibaba.weex framestats reset"; @Rule - public BenchmarkActivityTestRule mActivityRule = new BenchmarkActivityTestRule( - BenchmarkActivity.class); + public ActivityTestRule<BenchmarkActivity> mActivityRule = new ActivityTestRule(BenchmarkActivity.class); @Rule public RepeatRule repeatRule = new RepeatRule(); private UiDevice mUiDevice; @Before public void init() { + WXEnvironment.isPerf = true; mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); } @Test public void testFirstScreenPerformance() { List<Long> localTotalTime = new ArrayList<>(TIMES); + List<Long> localLayoutTime = new ArrayList<>(TIMES); for (int i = 0; i < TIMES; i++) { - long currentTime = calcTime(); + WXPerformance performance = fetchPerformance(); + long currentTime = performance.screenRenderTime; + long layoutTime = performance.cssLayoutTime; localTotalTime.add(currentTime); + localLayoutTime.add(layoutTime); Log.d(TAG, "FIRST_SCREEN_RENDER_TIME (activity not kill) " + currentTime + "ms"); + Log.d(TAG, "FIRST_SCREEN_LAYOUT_TIME (activity not kill) " + layoutTime + "ms"); } - BoxPlot boxPlot = new BoxPlot(localTotalTime); - Log.i(TAG, "Average firstScreenRenderTime (activity not kill) " + boxPlot.draw()); - assertThat(boxPlot.getAverage(), Matchers.lessThan(FIRST_SCREEN_RENDER_TIME)); + BoxPlot render = new BoxPlot(localTotalTime); + BoxPlot layout = new BoxPlot(localLayoutTime); + Log.i(TAG, "Average firstScreenRenderTime (activity not kill) " + render.draw()); + Log.i(TAG, "Average firstScreenLayoutTime (activity not kill) " + layout.draw()); + assertThat(render.getAverage(), Matchers.lessThan(FIRST_SCREEN_RENDER_TIME)); } @Repeat(TIMES) @Test public void testFirstFirstScreenPerformance() { - long currentTime = calcTime(); + WXPerformance performance = fetchPerformance(); + long currentTime = performance.screenRenderTime; + long layoutTime = performance.cssLayoutTime; firstScreenRenderTime.add(currentTime); + firstScreenLayoutTime.add(layoutTime); Log.d(TAG, "FIRST_SCREEN_RENDER_TIME (activity killed) " + currentTime + " ms"); + Log.d(TAG, "FIRST_SCREEN_Layout_TIME (activity killed) " + layoutTime + " ms"); } @Repeat(TIMES) @@ -132,18 +148,22 @@ public class BenchmarkTest { BoxPlot boxPlot = new BoxPlot(firstScreenRenderTime); Log.i(TAG, "Average firstScreenRenderTime (activity killed) " + boxPlot.draw()); assertThat(boxPlot.getAverage(), Matchers.lessThan(FIRST_SCREEN_RENDER_TIME)); - BoxPlot flingPlot = new BoxPlot(flingFrameSeconds); - Log.i(TAG, "Average Fling FPS : " + flingPlot.draw()); - assertThat(1000 / flingPlot.getMedian(), Matchers.greaterThan(FPS)); - BoxPlot scrollPlot = new BoxPlot(scrollFrameSeconds); - Log.i(TAG, "Average Scroll FPS : " + scrollPlot.draw()); - assertThat(1000 / scrollPlot.getMedian(), Matchers.greaterThan(FPS)); + BoxPlot layout = new BoxPlot(firstScreenLayoutTime); + Log.i(TAG, "Average firstScreenLayoutTime (activity killed) " + layout.draw()); + if (!flingFrameSeconds.isEmpty()) { + BoxPlot flingPlot = new BoxPlot(flingFrameSeconds); + Log.i(TAG, "Average Fling FPS : " + flingPlot.draw()); + assertThat(1000 / flingPlot.getMedian(), Matchers.greaterThan(FPS)); + } + if (!scrollFrameSeconds.isEmpty()) { + BoxPlot scrollPlot = new BoxPlot(scrollFrameSeconds); + Log.i(TAG, "Average Scroll FPS : " + scrollPlot.draw()); + assertThat(1000 / scrollPlot.getMedian(), Matchers.greaterThan(FPS)); + } } private UiObject2 loadPageForFPS() { - BenchmarkActivity benchmarkActivity = mActivityRule.getActivity(); - benchmarkActivity.loadWeexPage(); - onView(withClassName(Matchers.is(WXRecyclerView.class.getName()))).perform(RecyclerViewActions.scrollToPosition(0)); + BenchmarkActivity benchmarkActivity = loadWeexPage(); return mUiDevice.wait(Until.findObject(By.desc(BenchmarkActivity.ROOT)), WAIT_TIMEOUT); } @@ -153,13 +173,10 @@ public class BenchmarkTest { String[] columns; long timeStart, timeEnd, duration; String result = mUiDevice.executeShellCommand(DUMP_COMMAND); - //histogramGfxInfo(result); result = result.substring(result.indexOf(DUMP_START), result.lastIndexOf(DUMP_END)); result = result.substring(DUMP_START.length()); BufferedReader bufferedReader = new BufferedReader(new StringReader(result)); List<Long> list = createList(bufferedReader); - //Collections.sort(list); - //Log.d(TAG, list.toString()); container.addAll(list); BoxPlot boxPlot = new BoxPlot(list); boxPlot.draw(); @@ -195,34 +212,21 @@ public class BenchmarkTest { (RecyclerViewActions.scrollToPosition(0)); return benchmarkActivity.getWXInstance().getWXPerformance().screenRenderTime; } - -/* private void histogramGfxInfo(String result) { - try { - String start = "HISTOGRAM: "; - result = result.substring(result.indexOf(start)); - result = result.substring(start.length()); - BufferedReader bufferedReader = new BufferedReader(new StringReader(result)); - result = bufferedReader.readLine(); - List<Long> list = transformToLong(result.split("\\s")); - Log.d(TAG, list.toString()); - } catch (IOException e) { - WXLogUtils.e(TAG, WXLogUtils.getStackTrace(e)); - } + + private WXPerformance fetchPerformance() { + return loadWeexPage().getWXInstance().getWXPerformance(); } - private List<Long> transformToLong(String[] string) { - List<Long> array = new LinkedList<>(); - int count; - long value; - for (String item : string) { - value = Long.parseLong(item.substring(0, item.indexOf("ms"))); - if (value > 0) { - count = parseInt(item.substring(item.indexOf('=') + 1)); - for (int i = 0; i < count; i++) { - array.add(value); - } + @NonNull + private BenchmarkActivity loadWeexPage() { + final BenchmarkActivity benchmarkActivity = mActivityRule.getActivity(); + benchmarkActivity.loadWeexPage(); + await().atMost(WAIT_TIMEOUT, TimeUnit.MILLISECONDS).until(new Callable<Boolean>() { + @Override + public Boolean call() throws Exception { + return benchmarkActivity.isRenderFinish(); } - } - return array; - }*/ + }); + return benchmarkActivity; + } } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/WeexNativeCompareTest.java ---------------------------------------------------------------------- diff --git a/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/WeexNativeCompareTest.java b/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/WeexNativeCompareTest.java index bd57366..31085de 100644 --- a/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/WeexNativeCompareTest.java +++ b/android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/WeexNativeCompareTest.java @@ -19,33 +19,31 @@ package com.alibaba.weex.benchmark; +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.matcher.ViewMatchers.withClassName; + import android.support.test.InstrumentationRegistry; import android.support.test.espresso.action.ViewActions; +import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.support.test.uiautomator.UiDevice; import android.text.TextUtils; import android.util.Log; import android.widget.TextView; - import com.alibaba.weex.BenchmarkActivity; import com.taobao.weex.ui.view.WXFrameLayout; import com.taobao.weex.utils.WXLogUtils; - -import org.hamcrest.Matchers; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; - import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; - -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.matcher.ViewMatchers.withClassName; +import org.hamcrest.Matchers; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class WeexNativeCompareTest { @@ -60,7 +58,7 @@ public class WeexNativeCompareTest { private static final String DUMP_COMMAND = "dumpsys gfxinfo com.alibaba.weex framestats reset"; @Rule - public BenchmarkActivityTestRule mActivityRule = new BenchmarkActivityTestRule( + public ActivityTestRule<BenchmarkActivity> mActivityRule = new ActivityTestRule( BenchmarkActivity.class); @Rule public RepeatRule repeatRule = new RepeatRule(); http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/src/androidTest/java/com/alibaba/weex/uitest/WeexUiTestCaseTcElementOpt.java ---------------------------------------------------------------------- diff --git a/android/playground/app/src/androidTest/java/com/alibaba/weex/uitest/WeexUiTestCaseTcElementOpt.java b/android/playground/app/src/androidTest/java/com/alibaba/weex/uitest/WeexUiTestCaseTcElementOpt.java index 34fa40e..c020fa5 100644 --- a/android/playground/app/src/androidTest/java/com/alibaba/weex/uitest/WeexUiTestCaseTcElementOpt.java +++ b/android/playground/app/src/androidTest/java/com/alibaba/weex/uitest/WeexUiTestCaseTcElementOpt.java @@ -330,9 +330,9 @@ public class WeexUiTestCaseTcElementOpt extends ActivityInstrumentationTestCase2 // screenShot("TC_Event_ElementOpt_04_finish"); // Log.e(TAG, "TC_Event_ElementOpt_04_finish"); } - if(childValue.equals("ç¹å»æï¼addEvent")){ + if(childValue.equals("ç¹å»æï¼applyEvent")){ - Log.e(TAG, "ç¹å»æï¼addEvent find"); + Log.e(TAG, "ç¹å»æï¼applyEvent find"); final View wenbenClickAndThenAddText1 = child; mInstrumentation.runOnMainSync(new Runnable() { @Override @@ -343,7 +343,7 @@ public class WeexUiTestCaseTcElementOpt extends ActivityInstrumentationTestCase2 wenbenClickAndThenAddText1.requestFocus(); wenbenClickAndThenAddText1.performClick(); - Log.e(TAG, "ç¹å»æï¼addEvent click 1!!"); + Log.e(TAG, "ç¹å»æï¼applyEvent click 1!!"); } }); http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/src/main/java/com/alibaba/weex/BenchmarkActivity.java ---------------------------------------------------------------------- diff --git a/android/playground/app/src/main/java/com/alibaba/weex/BenchmarkActivity.java b/android/playground/app/src/main/java/com/alibaba/weex/BenchmarkActivity.java index 63e0ee5..8e7db00 100644 --- a/android/playground/app/src/main/java/com/alibaba/weex/BenchmarkActivity.java +++ b/android/playground/app/src/main/java/com/alibaba/weex/BenchmarkActivity.java @@ -45,8 +45,7 @@ public class BenchmarkActivity extends AppCompatActivity implements IWXRenderLis public final static String ROOT = "root"; private final static String TAG = "WEEX"; private final static String URL = - "http://h5.waptest.taobao.com/app/weextc031/build/TC_Monitor_List_WithAppendTree.js"; - public static CountingIdlingResource countingIdlingResource; + "http://h5.m.taobao.com/js/src/weexlist.js"; private WXSDKInstance mInstance; private LinearLayout root; private long startTime; @@ -135,10 +134,12 @@ public class BenchmarkActivity extends AppCompatActivity implements IWXRenderLis @Override public void onRenderSuccess(WXSDKInstance instance, int width, int height) { - if (countingIdlingResource != null) { - countingIdlingResource.decrement(); - } - perfEnd = true; + root.postDelayed(new Runnable() { + @Override + public void run() { + perfEnd = true; + } + }, 1000); } @Override @@ -151,12 +152,17 @@ public class BenchmarkActivity extends AppCompatActivity implements IWXRenderLis } + public boolean isRenderFinish(){ + return perfEnd; + } + public WXSDKInstance getWXInstance() { return mInstance; } public void loadWeexPage(final boolean weex) { isWeex=weex; + perfEnd = false; runOnUiThread(new Runnable() { @Override public void run() { @@ -168,9 +174,6 @@ public class BenchmarkActivity extends AppCompatActivity implements IWXRenderLis Map<String, Object> options = new HashMap<>(); options.put(WXSDKInstance.BUNDLE_URL, "file://assets/hello_weex.js"); mInstance.registerRenderListener(BenchmarkActivity.this); - if (countingIdlingResource != null) { - countingIdlingResource.increment(); - } perfStart = true; Log.v(TAG, "Start: " + startTime); startTime = System.currentTimeMillis(); @@ -178,8 +181,6 @@ public class BenchmarkActivity extends AppCompatActivity implements IWXRenderLis WXFileUtils.loadAsset("hello.js", BenchmarkActivity.this), options, null, - root.getWidth(), - root.getHeight(), WXRenderStrategy.APPEND_ASYNC); } else { root.removeAllViews(); @@ -196,6 +197,7 @@ public class BenchmarkActivity extends AppCompatActivity implements IWXRenderLis } public void loadWeexPage(final String url) { + perfEnd = false; runOnUiThread(new Runnable() { @Override public void run() { @@ -206,16 +208,11 @@ public class BenchmarkActivity extends AppCompatActivity implements IWXRenderLis Map<String, Object> options = new HashMap<>(); options.put(WXSDKInstance.BUNDLE_URL, url); mInstance.registerRenderListener(BenchmarkActivity.this); - if (countingIdlingResource != null) { - countingIdlingResource.increment(); - } mInstance.renderByUrl( TAG, url, options, null, - root.getWidth(), - root.getHeight(), WXRenderStrategy.APPEND_ASYNC); } }); http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/src/main/java/com/alibaba/weex/WXApplication.java ---------------------------------------------------------------------- diff --git a/android/playground/app/src/main/java/com/alibaba/weex/WXApplication.java b/android/playground/app/src/main/java/com/alibaba/weex/WXApplication.java index e41c5cb..35fd36a 100644 --- a/android/playground/app/src/main/java/com/alibaba/weex/WXApplication.java +++ b/android/playground/app/src/main/java/com/alibaba/weex/WXApplication.java @@ -31,7 +31,6 @@ import com.alibaba.weex.extend.component.RichText; import com.alibaba.weex.extend.component.WXComponentSyncTest; import com.alibaba.weex.extend.component.WXMask; import com.alibaba.weex.extend.component.WXParallax; -import com.alibaba.weex.extend.component.dom.WXMaskDomObject; import com.alibaba.weex.extend.module.GeolocationModule; import com.alibaba.weex.extend.module.MyModule; import com.alibaba.weex.extend.module.RenderModule; @@ -91,8 +90,6 @@ public class WXApplication extends Application { 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); http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java ---------------------------------------------------------------------- diff --git a/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java b/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java index 0c18d2a..3169fc8 100644 --- a/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java +++ b/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java @@ -47,7 +47,6 @@ import android.widget.Toast; import com.alibaba.fastjson.JSON; import com.alibaba.weex.commons.WXAnalyzerDelegate; -import com.alibaba.weex.commons.util.ScreenUtil; import com.alibaba.weex.constants.Constants; import com.alibaba.weex.https.HotRefreshManager; import com.alibaba.weex.https.WXHttpManager; @@ -62,7 +61,6 @@ import com.taobao.weex.appfram.navigator.IActivityNavBarSetter; import com.taobao.weex.bridge.WXBridgeManager; import com.taobao.weex.common.IWXDebugProxy; import com.taobao.weex.common.WXRenderStrategy; -import com.taobao.weex.dom.ImmutableDomObject; import com.taobao.weex.ui.component.NestedContainer; import com.taobao.weex.ui.component.WXComponent; import com.taobao.weex.ui.component.WXVContainer; @@ -232,14 +230,13 @@ public class WXPageActivity extends WXBaseActivity implements IWXRenderListener, } RenderContainer renderContainer = new RenderContainer(this); - mContainer.addView(renderContainer); - mInstance = new WXSDKInstance(this); mInstance.setRenderContainer(renderContainer); mInstance.registerRenderListener(this); mInstance.setNestedInstanceInterceptor(this); mInstance.setBundleUrl(url); mInstance.setTrackComponent(true); + mContainer.addView(renderContainer); WXHttpTask httpTask = new WXHttpTask(); httpTask.url = url; @@ -250,7 +247,7 @@ public class WXPageActivity extends WXBaseActivity implements IWXRenderListener, Log.i(TAG, "into--[http:onSuccess] url:" + url); try { mConfigMap.put("bundleUrl", url); - mInstance.render(TAG, new String(task.response.data, "utf-8"), mConfigMap, null, ScreenUtil.getDisplayWidth(WXPageActivity.this), ScreenUtil.getDisplayHeight(WXPageActivity.this), WXRenderStrategy.APPEND_ASYNC); + mInstance.render(TAG, new String(task.response.data, "utf-8"), mConfigMap, null, WXRenderStrategy.APPEND_ASYNC); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } @@ -306,12 +303,10 @@ public class WXPageActivity extends WXBaseActivity implements IWXRenderListener, if(comp == null){ return; } - ImmutableDomObject dom; String id; View view; if((view = comp.getHostView())!=null && - (dom = comp.getDomObject()) != null && - (id = (String) dom.getAttrs().get("testId"))!=null && + (id = (String) comp.getAttrs().get("testId"))!=null && !map.containsKey(id)){ Pair<String,Integer> pair = Utility.nextID(); view.setId(pair.second); http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/src/main/java/com/alibaba/weex/extend/component/RichText.java ---------------------------------------------------------------------- diff --git a/android/playground/app/src/main/java/com/alibaba/weex/extend/component/RichText.java b/android/playground/app/src/main/java/com/alibaba/weex/extend/component/RichText.java index a42f9ac..3b4b53f 100644 --- a/android/playground/app/src/main/java/com/alibaba/weex/extend/component/RichText.java +++ b/android/playground/app/src/main/java/com/alibaba/weex/extend/component/RichText.java @@ -27,15 +27,15 @@ import android.text.style.URLSpan; import android.widget.TextView; import com.taobao.weex.WXSDKInstance; -import com.taobao.weex.dom.WXDomObject; +import com.taobao.weex.ui.action.BasicComponentData; import com.taobao.weex.ui.component.WXComponent; import com.taobao.weex.ui.component.WXComponentProp; import com.taobao.weex.ui.component.WXVContainer; public class RichText extends WXComponent<TextView> { - public RichText(WXSDKInstance instance, WXDomObject dom, WXVContainer parent) { - super(instance, dom, parent); + public RichText(WXSDKInstance instance, WXVContainer parent, BasicComponentData basicComponentData) { + super(instance, parent, basicComponentData); } @Override http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXComponentSyncTest.java ---------------------------------------------------------------------- diff --git a/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXComponentSyncTest.java b/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXComponentSyncTest.java index d41fd3f..0adeed4 100644 --- a/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXComponentSyncTest.java +++ b/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXComponentSyncTest.java @@ -20,7 +20,7 @@ package com.alibaba.weex.extend.component; import com.taobao.weex.WXSDKInstance; import com.taobao.weex.annotation.JSMethod; -import com.taobao.weex.dom.WXDomObject; +import com.taobao.weex.ui.action.BasicComponentData; import com.taobao.weex.ui.component.WXDiv; import com.taobao.weex.ui.component.WXVContainer; import com.taobao.weex.utils.WXLogUtils; @@ -31,8 +31,8 @@ import com.taobao.weex.utils.WXLogUtils; public class WXComponentSyncTest extends WXDiv { - public WXComponentSyncTest(WXSDKInstance instance, WXDomObject dom, WXVContainer parent) { - super(instance, dom, parent); + public WXComponentSyncTest(WXSDKInstance instance, WXVContainer parent, BasicComponentData basicComponentData) { + super(instance, parent, basicComponentData); } @JSMethod (uiThread = false) @@ -44,4 +44,4 @@ public class WXComponentSyncTest extends WXDiv { public void testAsyncCall(){ WXLogUtils.e("22WXComponentSynTest :"+ Thread.currentThread().getName() ); } -} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXMask.java ---------------------------------------------------------------------- diff --git a/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXMask.java b/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXMask.java index 5a26542..036216c 100644 --- a/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXMask.java +++ b/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXMask.java @@ -124,10 +124,10 @@ import android.widget.PopupWindow; import com.alibaba.weex.extend.view.WXMaskView; import com.taobao.weex.WXSDKInstance; -import com.taobao.weex.dom.ImmutableDomObject; -import com.taobao.weex.dom.WXDomObject; +import com.taobao.weex.dom.CSSShorthand; import com.taobao.weex.dom.WXStyle; -import com.taobao.weex.dom.flex.Spacing; +import com.taobao.weex.ui.action.BasicComponentData; +import com.taobao.weex.ui.component.WXComponent; import com.taobao.weex.ui.component.WXVContainer; import java.util.HashMap; @@ -142,8 +142,8 @@ public class WXMask extends WXVContainer { private PopupWindow mPopupWindow; private WXMaskView mContainerView; - public WXMask(WXSDKInstance instance, WXDomObject dom, WXVContainer parent) { - super(instance, dom, parent); + public WXMask(WXSDKInstance instance, WXVContainer parent, BasicComponentData basicComponentData) { + super(instance, parent, basicComponentData); } @Override @@ -211,11 +211,10 @@ public class WXMask extends WXVContainer { @Override protected void setHostLayoutParams(View host, int width, int height, int left, int right, int top, int bottom) { - ImmutableDomObject domObject = getDomObject(); - left = get(LEFT, domObject); - right = get(RIGHT, domObject); - top = get(TOP, domObject); - bottom = get(BOTTOM, domObject); + left = get(LEFT); + right = get(RIGHT); + top = get(TOP); + bottom = get(BOTTOM); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(width, height); params.setMargins(left, top, right, bottom); getHostView().setLayoutParams(params); @@ -226,19 +225,19 @@ public class WXMask extends WXVContainer { private static final int TOP = 2; private static final int BOTTOM = 3; - private int get(int type, ImmutableDomObject domObject) { + private int get(int type) { try { - Spacing margin = domObject.getMargin(); - WXStyle style = domObject.getStyles(); + CSSShorthand margin = getMargin(); + WXStyle style = getStyles(); switch (type) { case LEFT: - return add(style.getLeft(), margin.get(Spacing.LEFT)); + return add(style.getLeft(), margin.get(CSSShorthand.EDGE.LEFT)); case RIGHT: - return add(style.getRight(), margin.get(Spacing.RIGHT)); + return add(style.getRight(), margin.get(CSSShorthand.EDGE.RIGHT)); case TOP: - return add(style.getTop(), margin.get(Spacing.TOP)); + return add(style.getTop(), margin.get(CSSShorthand.EDGE.TOP)); case BOTTOM: - return add(style.getBottom(), margin.get(Spacing.BOTTOM)); + return add(style.getBottom(), margin.get(CSSShorthand.EDGE.BOTTOM)); } } catch (Throwable t) { //ignore http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXParallax.java ---------------------------------------------------------------------- diff --git a/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXParallax.java b/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXParallax.java index eae6c01..46e265f 100644 --- a/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXParallax.java +++ b/android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXParallax.java @@ -37,7 +37,7 @@ import com.taobao.weex.WXSDKInstance; import com.taobao.weex.common.Constants; import com.taobao.weex.common.ICheckBindingScroller; import com.taobao.weex.common.OnWXScrollListener; -import com.taobao.weex.dom.WXDomObject; +import com.taobao.weex.ui.action.BasicComponentData; import com.taobao.weex.ui.animation.WXAnimationBean; import com.taobao.weex.ui.component.Scrollable; import com.taobao.weex.ui.component.WXComponent; @@ -72,17 +72,16 @@ public class WXParallax extends WXDiv implements OnWXScrollListener, ICheckBindi private int mBackGroundColor = 0; private float mOffsetY = 0; - public WXParallax(WXSDKInstance instance, WXDomObject dom, WXVContainer parent) { - super(instance, dom, parent); - initTransform(dom.getAttrs().get(WX_TRANSFORM)); - initOpacity(dom.getAttrs().get(Constants.Name.OPACITY)); - initBackgroundColor(dom.getAttrs().get(Constants.Name.BACKGROUND_COLOR)); + public WXParallax(WXSDKInstance instance, WXVContainer parent, BasicComponentData basicComponentData) { + super(instance, parent, basicComponentData); + initTransform(getAttrs().get(WX_TRANSFORM)); + initOpacity(getAttrs().get(Constants.Name.OPACITY)); + initBackgroundColor(getAttrs().get(Constants.Name.BACKGROUND_COLOR)); - mBindingRef = (String) (dom.getAttrs().get(BINDING_SCROLLER)); + mBindingRef = (String) (getAttrs().get(BINDING_SCROLLER)); instance.registerOnWXScrollListener(this); } - private void initBackgroundColor(Object obj) { if (obj == null) return; @@ -136,7 +135,7 @@ public class WXParallax extends WXDiv implements OnWXScrollListener, ICheckBindi @Override public boolean isNeedScroller(String ref, Object option) { - mBindingRef = (String) (getDomObject().getAttrs().get(BINDING_SCROLLER)); + mBindingRef = (String) (getAttrs().get(BINDING_SCROLLER)); if (TextUtils.isEmpty(mBindingRef)) { WXComponent root = getInstance().getRootComponent(); if (root != null && root instanceof WXVContainer) { http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/src/main/java/com/alibaba/weex/extend/component/dom/WXMaskDomObject.java ---------------------------------------------------------------------- diff --git a/android/playground/app/src/main/java/com/alibaba/weex/extend/component/dom/WXMaskDomObject.java b/android/playground/app/src/main/java/com/alibaba/weex/extend/component/dom/WXMaskDomObject.java deleted file mode 100644 index 1de289b..0000000 --- a/android/playground/app/src/main/java/com/alibaba/weex/extend/component/dom/WXMaskDomObject.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * <p> - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * <p> - * 1. Definitions. - * <p> - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * <p> - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * <p> - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * <p> - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * <p> - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * <p> - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * <p> - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * <p> - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * <p> - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * <p> - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * <p> - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * <p> - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * <p> - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * <p> - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * <p> - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * <p> - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * <p> - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * <p> - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * <p> - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * <p> - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * <p> - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * <p> - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * <p> - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * <p> - * END OF TERMS AND CONDITIONS - * <p> - * APPENDIX: How to apply the Apache License to your work. - * <p> - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "[]" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * <p> - * Copyright 2016 Alibaba Group - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alibaba.weex.extend.component.dom; - -import android.app.Application; -import android.content.res.Resources; - -import com.taobao.weex.WXEnvironment; -import com.taobao.weex.common.Constants; -import com.taobao.weex.dom.WXDomObject; -import com.taobao.weex.utils.WXViewUtils; - -import java.util.HashMap; -import java.util.Map; - -/** - * Created by lixinke on 2016/12/28. - */ - -public class WXMaskDomObject extends WXDomObject { - - @Override - protected Map<String, String> getDefaultStyle() { - if (getDomContext() == null || getDomContext().getUIContext() == null) { - return super.getDefaultStyle(); - } - - int height = WXViewUtils.getScreenHeight(getDomContext().getUIContext()); - int width = WXViewUtils.getScreenWidth(getDomContext().getUIContext()); - Resources resources = getDomContext().getUIContext().getResources(); - if (resources != null) { - width = resources.getDisplayMetrics().widthPixels; - height = resources.getDisplayMetrics().heightPixels; - } - - if (WXEnvironment.getApplication() != null) { - Application context = WXEnvironment.getApplication(); - int statusBarHeight = 0; - int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); - if (resourceId > 0) { - statusBarHeight = context.getResources().getDimensionPixelSize(resourceId); - height -= statusBarHeight; - } - } - - Map<String, String> styles = new HashMap<>(); - styles.put(Constants.Name.POSITION, "absolute"); - styles.put(Constants.Name.WIDTH, String.valueOf(WXViewUtils.getWebPxByWidth(width, getViewPortWidth()))); - styles.put(Constants.Name.HEIGHT, String.valueOf(WXViewUtils.getWebPxByWidth(height, getViewPortWidth()))); - styles.put(Constants.Name.TOP, "0"); - return styles; - } -} http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/playground/app/src/main/java/com/alibaba/weex/extend/module/WXWsonTestModule.java ---------------------------------------------------------------------- diff --git a/android/playground/app/src/main/java/com/alibaba/weex/extend/module/WXWsonTestModule.java b/android/playground/app/src/main/java/com/alibaba/weex/extend/module/WXWsonTestModule.java index b018678..f3fb1ff 100644 --- a/android/playground/app/src/main/java/com/alibaba/weex/extend/module/WXWsonTestModule.java +++ b/android/playground/app/src/main/java/com/alibaba/weex/extend/module/WXWsonTestModule.java @@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject; import com.taobao.weex.annotation.JSMethod; import com.taobao.weex.bridge.JSCallback; import com.taobao.weex.common.WXModule; -import com.taobao.weex.wson.Wson; /** * Created by furture on 2018/1/18.
