From 78cad683711ec7c34494616fe60498cda202dea8 Mon Sep 17 00:00:00 2001 From: miomin <691292118@qq.com> Date: Thu, 26 Apr 2018 11:18:11 +0800 Subject: [PATCH 1/7] * [android] Merge WeexCore-master to master. --- 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 +- .../uitest/WeexUiTestCaseTcElementOpt.java | 6 +- .../com/alibaba/weex/BenchmarkActivity.java | 29 +- .../java/com/alibaba/weex/WXApplication.java | 3 - .../java/com/alibaba/weex/WXPageActivity.java | 11 +- .../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 +- .../java/com/taobao/weex/RenderContainer.java | 46 +- .../java/com/taobao/weex/WXEnvironment.java | 14 +- .../java/com/taobao/weex/WXSDKEngine.java | 206 +- .../java/com/taobao/weex/WXSDKInstance.java | 484 +- .../java/com/taobao/weex/WXSDKManager.java | 13 +- .../com/taobao/weex/WeexFrameRateControl.java | 88 + .../weex/adapter/ClassLoaderAdapter.java | 1 - .../websocket/WebSocketCloseCodes.java | 2 +- .../IWXTask.java => base/CalledByNative.java} | 9 +- .../java/com/taobao/weex/base/FloatUtil.java} | 17 +- .../weex/base/SystemMessageHandler.java | 106 + .../com/taobao/weex/bridge/JSCallback.java | 2 - .../taobao/weex/bridge/ModuleFactoryImpl.java | 21 +- .../weex/bridge/NativeInvokeHelper.java | 16 +- .../java/com/taobao/weex/bridge/WXBridge.java | 689 +- .../taobao/weex/bridge/WXBridgeManager.java | 1619 ++--- .../com/taobao/weex/bridge/WXJSObject.java | 1 - .../com/taobao/weex/bridge/WXJsFunctions.java | 110 + .../taobao/weex/bridge/WXModuleManager.java | 32 +- .../weex/bridge/WXValidateProcessor.java | 4 +- .../com/taobao/weex/common/Constants.java | 23 +- .../com/taobao/weex/common/IWXBridge.java | 110 +- .../com/taobao/weex/common/IWXDebugProxy.java | 2 +- .../taobao/weex/common/IWXJsFunctions.java | 72 + .../com/taobao/weex/common/WXErrorCode.java | 16 +- .../taobao/weex/common/WXJSExceptionInfo.java | 18 +- .../com/taobao/weex/common/WXPerformance.java | 125 +- .../taobao/weex/dom/ApplyStyleConsumer.java | 59 - .../weex/dom/BasicEditTextDomObject.java | 107 - .../com/taobao/weex/dom/CSSAlignConvert.java | 60 - .../dom/{DOMAction.java => CSSConstants.java} | 18 +- .../weex/dom/CSSFlexDirectionConvert.java | 42 - .../taobao/weex/dom/CSSJustifyConvert.java | 42 - .../weex/dom/CSSPositionTypeConvert.java | 36 - .../com/taobao/weex/dom/CSSShorthand.java | 112 + .../com/taobao/weex/dom/CSSWrapConvert.java | 36 - .../com/taobao/weex/dom/DOMActionContext.java | 71 - .../taobao/weex/dom/DOMActionContextImpl.java | 461 -- .../java/com/taobao/weex/dom/DomContext.java | 30 - .../taobao/weex/dom/ImmutableDomObject.java | 63 - .../com/taobao/weex/dom/RenderAction.java | 29 - .../com/taobao/weex/dom/RenderActionTask.java | 65 - ...rActionContext.java => RenderContext.java} | 2 +- .../weex/dom/TextAreaEditTextDomObject.java | 58 - .../main/java/com/taobao/weex/dom/WXAttr.java | 109 +- .../com/taobao/weex/dom/WXCellDomObject.java | 124 - .../com/taobao/weex/dom/WXDomHandler.java | 146 - .../com/taobao/weex/dom/WXDomManager.java | 237 - .../java/com/taobao/weex/dom/WXDomModule.java | 175 - .../java/com/taobao/weex/dom/WXDomObject.java | 936 --- .../taobao/weex/dom/WXDomObjectFactory.java | 58 - .../com/taobao/weex/dom/WXDomRegistry.java | 59 - .../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 - .../java/com/taobao/weex/dom/WXStyle.java | 463 +- .../taobao/weex/dom/WXSwitchDomObject.java | 58 - .../com/taobao/weex/dom/WXTextDomObject.java | 601 -- .../dom/action/AbstractAddElementAction.java | 182 - .../action/AbstractLayoutFinishAction.java | 52 - .../com/taobao/weex/dom/action/Actions.java | 237 - .../weex/dom/action/AddElementAction.java | 155 - .../weex/dom/action/AddEventAction.java | 109 - .../weex/dom/action/CreateBodyAction.java | 144 - .../weex/dom/action/CreateFinishAction.java | 64 - .../dom/action/ExecutableRenderAction.java | 48 - .../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/TraceableAction.java | 83 - .../dom/action/UpdateAttributeAction.java | 83 - .../dom/action/UpdateComponentDataAction.java | 69 - .../weex/dom/action/UpdateStyleAction.java | 118 - .../com/taobao/weex/dom/flex/CSSAlign.java | 14 - .../taobao/weex/dom/flex/CSSConstants.java | 15 - .../taobao/weex/dom/flex/CSSDirection.java | 12 - .../weex/dom/flex/CSSFlexDirection.java | 13 - .../com/taobao/weex/dom/flex/CSSJustify.java | 14 - .../com/taobao/weex/dom/flex/CSSLayout.java | 76 - .../weex/dom/flex/CSSLayoutContext.java | 18 - .../com/taobao/weex/dom/flex/CSSNode.java | 642 -- .../taobao/weex/dom/flex/CSSPositionType.java | 11 - .../com/taobao/weex/dom/flex/CSSStyle.java | 123 - .../com/taobao/weex/dom/flex/CSSWrap.java | 11 - .../taobao/weex/dom/flex/CachedCSSLayout.java | 18 - .../com/taobao/weex/dom/flex/FloatUtil.java | 18 - .../taobao/weex/dom/flex/LayoutEngine.java | 934 --- .../taobao/weex/dom/flex/MeasureOutput.java | 15 - .../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 + .../MeasureMode.java} | 22 +- .../MeasureSize.java} | 36 +- .../TextContentBoxMeasurement.java | 472 ++ .../performance/WXAnalyzerDataTransfer.java | 22 +- .../com/taobao/weex/tracing/WXTracing.java | 2 +- .../com/taobao/weex/ui/ComponentCreator.java | 4 +- .../ui/ExternalLoaderComponentHolder.java | 14 +- .../com/taobao/weex/ui/IWXRenderTask.java | 26 - ...ontextImpl.java => RenderContextImpl.java} | 60 +- .../taobao/weex/ui/SimpleComponentHolder.java | 24 +- .../taobao/weex/ui/WXComponentRegistry.java | 1 + .../com/taobao/weex/ui/WXRenderHandler.java | 24 +- .../com/taobao/weex/ui/WXRenderManager.java | 138 +- .../action/ActionAddRule.java} | 50 +- .../action/ActionGetComponentRect.java} | 52 +- .../action/ActionInvokeMethod.java} | 34 +- .../action/ActionReloadPage.java} | 43 +- .../weex/ui/action/BasicComponentData.java | 265 + .../weex/ui/action/BasicGraphicAction.java | 69 + .../GraphicActionAbstractAddElement.java | 94 + .../ui/action/GraphicActionAddElement.java | 115 + .../weex/ui/action/GraphicActionAddEvent.java | 53 + .../action/GraphicActionAnimation.java} | 157 +- .../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 + .../action/GraphicActionScrollToElement.java} | 40 +- .../action/GraphicActionUpdateAttr.java} | 49 +- .../ui/action/GraphicActionUpdateStyle.java | 134 + .../weex/ui/action/GraphicPosition.java} | 62 +- .../taobao/weex/ui/action/GraphicSize.java} | 34 +- .../action/IExecutable.java} | 15 +- .../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 +- .../taobao/weex/ui/component/Textarea.java | 41 +- .../com/taobao/weex/ui/component/WXA.java | 25 +- .../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 +- .../taobao/weex/ui/component/WXHeader.java | 12 +- .../com/taobao/weex/ui/component/WXImage.java | 236 +- .../taobao/weex/ui/component/WXIndicator.java | 47 +- .../com/taobao/weex/ui/component/WXInput.java | 15 +- .../taobao/weex/ui/component/WXLoading.java | 18 +- .../weex/ui/component/WXLoadingIndicator.java | 7 +- .../taobao/weex/ui/component/WXRefresh.java | 23 +- .../taobao/weex/ui/component/WXScroller.java | 95 +- .../taobao/weex/ui/component/WXSlider.java | 28 +- .../weex/ui/component/WXSliderNeighbor.java | 10 +- .../taobao/weex/ui/component/WXSwitch.java | 76 +- .../com/taobao/weex/ui/component/WXText.java | 127 +- .../weex/ui/component/WXVContainer.java | 183 +- .../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 +- .../helper/ScrollStartEndHelper.java | 15 +- .../component/helper/WXTimeInputHelper.java | 70 +- .../ui/component/list/BasicListComponent.java | 305 +- .../ui/component/list/GapItemDecoration.java | 52 +- .../list/HorizontalListComponent.java | 6 +- .../component/list/SimpleListComponent.java | 6 +- .../ui/component/list/StickyHeaderHelper.java | 46 +- .../taobao/weex/ui/component/list/WXCell.java | 71 +- .../ui/component/list/WXListComponent.java | 250 +- .../list/template/AsyncCellLoadTask.java | 2 +- .../list/template/CellDataManager.java | 3 +- .../list/template/TemplateCache.java | 2 + .../list/template/TemplateStickyHelper.java | 14 +- .../list/template/TemplateViewHolder.java | 32 +- .../list/template/WXRecyclerTemplateList.java | 217 +- ...stener.java => OnActivePseudoListner.java} | 2 +- .../pesudo/TouchActivePseudoListener.java | 12 +- .../weex/ui/config/ConfigComponentHolder.java | 6 +- .../weex/ui/config/ConfigModuleFactory.java | 1 - .../taobao/weex/ui/flat/FlatComponent.java | 4 +- .../taobao/weex/ui/flat/FlatGUIContext.java | 62 +- .../taobao/weex/ui/flat/WidgetContainer.java | 15 +- .../ui/flat/widget/AndroidViewWidget.java | 14 +- .../weex/ui/flat/widget/BaseWidget.java | 4 +- .../weex/ui/flat/widget/TextWidget.java | 1 + .../taobao/weex/ui/flat/widget/Widget.java | 10 +- .../weex/ui/flat/widget/WidgetGroup.java | 4 +- .../taobao/weex/ui/module/WXDomModule.java | 161 + .../taobao/weex/ui/module/WXMetaModule.java | 10 +- .../taobao/weex/ui/module/WXTimerModule.java | 57 +- .../com/taobao/weex/ui/view/IWebView.java | 4 +- .../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 +- .../weex/ui/view/border/BorderEdge.java | 82 +- .../weex/ui/view/border/BorderStyle.java | 23 +- .../weex/ui/view/border/BorderUtil.java | 53 +- .../border/BorderWidthStyleColorType.java | 38 - .../weex/ui/view/border/BottomLeftCorner.java | 77 +- .../ui/view/border/BottomRightCorner.java | 81 +- .../weex/ui/view/border/TopLeftCorner.java | 74 +- .../weex/ui/view/border/TopRightCorner.java | 77 +- .../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 +- .../view/refresh/wrapper/BaseBounceView.java | 51 +- .../com/taobao/weex/utils/FunctionParser.java | 20 +- .../com/taobao/weex/utils/ImageDrawable.java | 10 +- .../weex/utils/SingleFunctionParser.java | 2 +- .../taobao/weex/utils/StaticLayoutProxy.java | 8 +- .../com/taobao/weex/utils/TypefaceUtil.java | 4 +- .../com/taobao/weex/utils/WXDomUtils.java | 64 +- .../taobao/weex/utils/WXExceptionUtils.java | 124 +- .../com/taobao/weex/utils/WXJsonUtils.java | 37 - .../com/taobao/weex/utils/WXLogUtils.java | 66 +- .../taobao/weex/utils/WXReflectionUtils.java | 18 +- .../taobao/weex/utils/WXResourceUtils.java | 106 +- .../taobao/weex/utils/WXSoInstallMgrSdk.java | 63 +- .../java/com/taobao/weex/utils/WXUtils.java | 135 +- .../com/taobao/weex/utils/WXViewUtils.java | 37 +- .../main/java/com/taobao/weex/wson/Wson.java | 820 --- .../java/com/taobao/weex/WXSDKEngineTest.java | 7 - .../com/taobao/weex/WXSDKInstanceTest.java | 1 - .../weex/adapter/DefaultUriAdapterTest.java | 2 +- .../weex/bridge/WXBridgeManagerTest.java | 10 +- .../com/taobao/weex/bridge/WXBridgeTest.java | 5 +- .../com/taobao/weex/dom/TestDomObject.java | 55 - .../com/taobao/weex/dom/WXDomModuleTest.java | 131 - .../com/taobao/weex/dom/WXDomObjectTest.java | 108 - .../taobao/weex/dom/WXDomStatementTest.java | 9 +- .../taobao/weex/dom/WXTextDomObjectTest.java | 5 +- .../taobao/weex/dom/action/TestActions.java | 77 - .../weex/dom/transition/WXTransitionTest.java | 96 - .../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 +- .../taobao/weex/ui/ComponentHolderTest.java | 3 - .../taobao/weex/ui/WXRenderStatementTest.java | 4 +- .../ui/animation/WXAnimationModuleTest.java | 5 +- .../weex/ui/component/ComponentTest.java | 9 +- .../weex/ui/component/EditComponentTest.java | 1 - .../weex/ui/component/TestComponent.java | 4 - .../weex/ui/component/WXComponentTest.java | 2 +- .../taobao/weex/ui/component/WXDivTest.java | 11 +- .../taobao/weex/ui/component/WXEmbedTest.java | 6 +- .../weex/ui/component/WXHeaderTest.java | 4 - .../taobao/weex/ui/component/WXImageTest.java | 2 - .../weex/ui/component/WXLoadingTest.java | 3 - .../weex/ui/component/WXRefreshTest.java | 1 - .../weex/ui/component/WXScrollerTest.java | 5 - .../ui/component/WXSliderNeighborTest.java | 1 - .../weex/ui/component/WXSliderTest.java | 1 - .../weex/ui/component/WXSwitchTest.java | 3 - .../taobao/weex/ui/component/WXTextTest.java | 22 +- .../taobao/weex/ui/component/WXVideoTest.java | 4 - .../taobao/weex/ui/component/WXWebTest.java | 3 - .../component/binding/BindingValueTest.java | 65 - .../ui/component/binding/StatementTest.java | 186 - .../component/list/DefaultDragHelperTest.java | 3 - .../component/list/WXListComponentTest.java | 5 +- .../weex/ui/module/WXModalUIModuleTest.java | 9 +- .../weex/ui/module/WXTimerModuleTest.java | 45 +- .../ui/view/border/BorderDrawableTest.java | 1 - .../weex/ui/view/gesture/WXGestureTest.java | 5 - .../weex/utils/WXExceptionUtilsTest.java | 74 - .../taobao/weex/utils/WXFileUtilsTest.java | 9 - .../com/taobao/weex/utils/WXLogUtilsTest.java | 17 +- .../weex/utils/WXReflectionUtilsTest.java | 9 - .../com/taobao/weex/utils/WXUtilsTest.java | 3 +- .../java/com/taobao/weex/wson/AnnoTest.java | 41 - 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 .../Source/android/base/base64/base64.cpp | 33 + weex_core/Source/android/base/base64/base64.h | 9 + .../base/base64/modp_base64/modp_b64.cc | 265 + .../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 + .../Source/android/base/jni/android_jni.h | 45 + .../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 + .../android/base/string/scoped_jstring.h | 27 + .../base/string/scoped_jstring_utf8.cpp | 20 + .../android/base/string/scoped_jstring_utf8.h | 31 + .../Source/android/base/string/string_utils.h | 132 + .../bridge/impl/bridge_impl_android.cpp | 875 +++ .../android/bridge/impl/bridge_impl_android.h | 106 + .../content_box_measurement_impl_android.cpp | 36 + .../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 ++ .../bridge/impl/weexcore_impl_android.h | 37 + .../Source/android/jniprebuild/__init__.py | 0 .../android/jniprebuild/android_jar.classes | 98 + .../Source/android/jniprebuild/jni_files | 5 + .../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 ++ .../jsengine/multiprocess/ExtendJSApi.h | 87 + .../multiprocess/WeexJSConnection.cpp | 411 ++ .../jsengine/multiprocess/WeexJSConnection.h | 25 + .../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 + .../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 + .../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 + .../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 + .../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 + .../action/render_action_createbody.cpp | 29 + .../render/action/render_action_createbody.h | 27 + .../action/render_action_createfinish.cpp | 19 + .../action/render_action_createfinish.h | 20 + .../render/action/render_action_layout.cpp | 33 + .../core/render/action/render_action_layout.h | 31 + .../action/render_action_move_element.cpp | 22 + .../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 + .../action/render_action_remove_event.h | 22 + .../action/render_action_update_attr.cpp | 22 + .../render/action/render_action_update_attr.h | 23 + .../action/render_action_update_style.cpp | 29 + .../action/render_action_update_style.h | 30 + .../core/render/manager/render_manager.cpp | 196 + .../core/render/manager/render_manager.h | 73 + .../render/node/factory/i_render_factory.h | 13 + .../render/node/factory/i_render_object.h | 42 + .../node/factory/render_appbar_factory.h | 18 + .../render/node/factory/render_cell_factory.h | 17 + .../render/node/factory/render_creator.cpp | 53 + .../core/render/node/factory/render_creator.h | 45 + .../node/factory/render_indicator_factory.h | 18 + .../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 + .../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 + .../node/factory/simple_render_factory.h | 19 + .../Source/core/render/node/render_appbar.h | 68 + .../Source/core/render/node/render_cell.h | 12 + .../core/render/node/render_indicator.h | 12 + .../Source/core/render/node/render_input.h | 12 + .../Source/core/render/node/render_list.h | 217 + .../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 + .../Source/core/render/node/render_text.h | 26 + .../Source/core/render/node/render_textarea.h | 12 + .../Source/core/render/page/render_page.cpp | 631 ++ .../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 + .../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 +++++++++++++++++ 507 files changed, 47534 insertions(+), 16893 deletions(-) delete mode 100644 android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/BenchmarkActivityTestRule.java delete mode 100644 android/playground/app/src/main/java/com/alibaba/weex/extend/component/dom/WXMaskDomObject.java create mode 100644 android/sdk/gradle/wrapper/gradle-wrapper.jar create mode 100644 android/sdk/gradle/wrapper/gradle-wrapper.properties delete mode 100755 android/sdk/libs/armeabi/libweexjsc.so mode change 100755 => 100644 android/sdk/libs/x86/libweexjsb.so delete mode 100755 android/sdk/libs/x86/libweexjsc.so mode change 100755 => 100644 android/sdk/libs/x86/libweexjss.so create mode 100644 android/sdk/src/main/java/com/taobao/weex/WeexFrameRateControl.java rename android/sdk/src/main/java/com/taobao/weex/{common/IWXTask.java => base/CalledByNative.java} (91%) rename android/sdk/src/{test/java/com/taobao/weex/wson/Person.java => main/java/com/taobao/weex/base/FloatUtil.java} (72%) mode change 100644 => 100755 create mode 100644 android/sdk/src/main/java/com/taobao/weex/base/SystemMessageHandler.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/bridge/WXJsFunctions.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/common/IWXJsFunctions.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/ApplyStyleConsumer.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/BasicEditTextDomObject.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/CSSAlignConvert.java rename android/sdk/src/main/java/com/taobao/weex/dom/{DOMAction.java => CSSConstants.java} (81%) mode change 100644 => 100755 delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/CSSFlexDirectionConvert.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/CSSJustifyConvert.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/CSSPositionTypeConvert.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/CSSShorthand.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/CSSWrapConvert.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/DOMActionContext.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/DOMActionContextImpl.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/DomContext.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/ImmutableDomObject.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/RenderAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/RenderActionTask.java rename android/sdk/src/main/java/com/taobao/weex/dom/{RenderActionContext.java => RenderContext.java} (96%) delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/TextAreaEditTextDomObject.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/WXCellDomObject.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/WXDomHandler.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/WXDomObjectFactory.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/WXDomRegistry.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/WXListDomObject.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/WXRecyclerDomObject.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/WXScrollerDomObject.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/WXSwitchDomObject.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/AbstractAddElementAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/AbstractLayoutFinishAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/Actions.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/AddElementAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/AddEventAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/CreateBodyAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/CreateFinishAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/ExecutableRenderAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/ModuleInvocationAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/MoveElementAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/RefreshFinishAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/ReloadPageAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/RemoveElementAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/RemoveEventAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/TraceableAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateAttributeAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateComponentDataAction.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateStyleAction.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSAlign.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSConstants.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSDirection.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSFlexDirection.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSJustify.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSLayout.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSLayoutContext.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSNode.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSPositionType.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSStyle.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSWrap.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/CachedCSSLayout.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/FloatUtil.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/LayoutEngine.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/MeasureOutput.java delete mode 100755 android/sdk/src/main/java/com/taobao/weex/dom/flex/Spacing.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/dom/text/FontBroadcastReceiver.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/layout/ContentBoxMeasurement.java rename android/sdk/src/main/java/com/taobao/weex/{LayoutFinishListener.java => layout/MeasureMode.java} (67%) rename android/sdk/src/main/java/com/taobao/weex/{dom/WXDomTask.java => layout/MeasureSize.java} (66%) create mode 100644 android/sdk/src/main/java/com/taobao/weex/layout/measurefunc/TextContentBoxMeasurement.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/IWXRenderTask.java rename android/sdk/src/main/java/com/taobao/weex/ui/{RenderActionContextImpl.java => RenderContextImpl.java} (52%) rename android/sdk/src/main/java/com/taobao/weex/{dom/action/AddRuleAction.java => ui/action/ActionAddRule.java} (59%) rename android/sdk/src/main/java/com/taobao/weex/{dom/action/GetComponentRectAction.java => ui/action/ActionGetComponentRect.java} (77%) rename android/sdk/src/main/java/com/taobao/weex/{dom/action/InvokeMethodAction.java => ui/action/ActionInvokeMethod.java} (63%) rename android/sdk/src/main/java/com/taobao/weex/{dom/action/UpdateFinishAction.java => ui/action/ActionReloadPage.java} (54%) create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/action/BasicComponentData.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/action/BasicGraphicAction.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionAbstractAddElement.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionAddElement.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionAddEvent.java rename android/sdk/src/main/java/com/taobao/weex/{dom/action/AnimationAction.java => ui/action/GraphicActionAnimation.java} (64%) create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionCreateBody.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionCreateFinish.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionLayout.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionMoveElement.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionRefreshFinish.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionRemoveElement.java create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionRemoveEvent.java rename android/sdk/src/main/java/com/taobao/weex/{dom/action/ScrollToElementAction.java => ui/action/GraphicActionScrollToElement.java} (57%) rename android/sdk/src/main/java/com/taobao/weex/{dom/SafePutConcurrentHashMap.java => ui/action/GraphicActionUpdateAttr.java} (53%) create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionUpdateStyle.java rename android/sdk/src/{test/java/com/taobao/weex/ui/component/PriorityQueueTest.java => main/java/com/taobao/weex/ui/action/GraphicPosition.java} (50%) rename android/sdk/src/{test/java/com/taobao/weex/ui/animation/TransformParserTest.java => main/java/com/taobao/weex/ui/action/GraphicSize.java} (63%) rename android/sdk/src/main/java/com/taobao/weex/{dom/action/Action.java => ui/action/IExecutable.java} (87%) create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/component/basic/WXBasicComponent.java rename android/sdk/src/main/java/com/taobao/weex/ui/component/pesudo/{OnActivePseudoListener.java => OnActivePseudoListner.java} (95%) create mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/module/WXDomModule.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/ui/view/border/BorderWidthStyleColorType.java delete mode 100644 android/sdk/src/main/java/com/taobao/weex/wson/Wson.java delete mode 100644 android/sdk/src/test/java/com/taobao/weex/dom/TestDomObject.java delete mode 100644 android/sdk/src/test/java/com/taobao/weex/dom/WXDomModuleTest.java delete mode 100644 android/sdk/src/test/java/com/taobao/weex/dom/WXDomObjectTest.java delete mode 100644 android/sdk/src/test/java/com/taobao/weex/dom/action/TestActions.java delete mode 100644 android/sdk/src/test/java/com/taobao/weex/dom/transition/WXTransitionTest.java delete mode 100644 android/sdk/src/test/java/com/taobao/weex/el/FailedCaseTest.java delete mode 100644 android/sdk/src/test/java/com/taobao/weex/el/IfStatementTest.java delete mode 100644 android/sdk/src/test/java/com/taobao/weex/el/ParserTest.java delete mode 100644 android/sdk/src/test/java/com/taobao/weex/ui/component/binding/BindingValueTest.java delete mode 100644 android/sdk/src/test/java/com/taobao/weex/ui/component/binding/StatementTest.java delete mode 100644 android/sdk/src/test/java/com/taobao/weex/utils/WXExceptionUtilsTest.java delete mode 100644 android/sdk/src/test/java/com/taobao/weex/wson/AnnoTest.java create mode 100644 weex_core/.clang-format create mode 100644 weex_core/.gitignore create mode 100644 weex_core/CMakeLists.txt create mode 100644 weex_core/Source/CMakeLists.txt create mode 100644 weex_core/Source/IPC/Buffering/IPCBuffer.h create mode 100644 weex_core/Source/IPC/CMakeLists.txt create mode 100644 weex_core/Source/IPC/IPCArguments.h create mode 100644 weex_core/Source/IPC/IPCByteArray.h create mode 100644 weex_core/Source/IPC/IPCCheck.cpp create mode 100644 weex_core/Source/IPC/IPCCheck.h create mode 100644 weex_core/Source/IPC/IPCCommunicator.cpp create mode 100644 weex_core/Source/IPC/IPCCommunicator.h create mode 100644 weex_core/Source/IPC/IPCException.cpp create mode 100644 weex_core/Source/IPC/IPCException.h create mode 100644 weex_core/Source/IPC/IPCFutexPageQueue.cpp create mode 100644 weex_core/Source/IPC/IPCFutexPageQueue.h create mode 100644 weex_core/Source/IPC/IPCHandler.cpp create mode 100644 weex_core/Source/IPC/IPCHandler.h create mode 100644 weex_core/Source/IPC/IPCListener.cpp create mode 100644 weex_core/Source/IPC/IPCListener.h create mode 100644 weex_core/Source/IPC/IPCLog.h create mode 100644 weex_core/Source/IPC/IPCMessageJS.h create mode 100644 weex_core/Source/IPC/IPCResult.cpp create mode 100644 weex_core/Source/IPC/IPCResult.h create mode 100644 weex_core/Source/IPC/IPCSender.cpp create mode 100644 weex_core/Source/IPC/IPCSender.h create mode 100644 weex_core/Source/IPC/IPCString.h create mode 100644 weex_core/Source/IPC/IPCType.h create mode 100644 weex_core/Source/IPC/Serializing/IPCSerializer.cpp create mode 100644 weex_core/Source/IPC/Serializing/IPCSerializer.h create mode 100644 weex_core/Source/IPC/ashmem.c create mode 100644 weex_core/Source/IPC/ashmem.h create mode 100644 weex_core/Source/IPC/futex.h create mode 100644 weex_core/Source/__init__.py create mode 100644 weex_core/Source/android/__init__.py create mode 100644 weex_core/Source/android/base/base64/base64.cpp create mode 100644 weex_core/Source/android/base/base64/base64.h create mode 100644 weex_core/Source/android/base/base64/modp_base64/modp_b64.cc create mode 100644 weex_core/Source/android/base/base64/modp_base64/modp_b64.h create mode 100644 weex_core/Source/android/base/base64/modp_base64/modp_b64_data.h create mode 100644 weex_core/Source/android/base/jni/android_jni.cpp create mode 100644 weex_core/Source/android/base/jni/android_jni.h create mode 100644 weex_core/Source/android/base/jni/scoped_java_ref.cpp create mode 100644 weex_core/Source/android/base/jni/scoped_java_ref.h create mode 100644 weex_core/Source/android/base/log_utils.h create mode 100644 weex_core/Source/android/base/string/scoped_jstring.cpp create mode 100644 weex_core/Source/android/base/string/scoped_jstring.h create mode 100644 weex_core/Source/android/base/string/scoped_jstring_utf8.cpp create mode 100644 weex_core/Source/android/base/string/scoped_jstring_utf8.h create mode 100644 weex_core/Source/android/base/string/string_utils.h create mode 100644 weex_core/Source/android/bridge/impl/bridge_impl_android.cpp create mode 100644 weex_core/Source/android/bridge/impl/bridge_impl_android.h create mode 100644 weex_core/Source/android/bridge/impl/content_box_measurement_impl_android.cpp create mode 100644 weex_core/Source/android/bridge/impl/content_box_measurement_impl_android.h create mode 100644 weex_core/Source/android/bridge/impl/measure_mode_impl_android.cpp create mode 100644 weex_core/Source/android/bridge/impl/measure_mode_impl_android.h create mode 100644 weex_core/Source/android/bridge/impl/weexcore_impl_android.cpp create mode 100644 weex_core/Source/android/bridge/impl/weexcore_impl_android.h create mode 100644 weex_core/Source/android/jniprebuild/__init__.py create mode 100644 weex_core/Source/android/jniprebuild/android_jar.classes create mode 100644 weex_core/Source/android/jniprebuild/jni_files create mode 100644 weex_core/Source/android/jniprebuild/jni_generator.py create mode 100644 weex_core/Source/android/jniprebuild/jni_load.cc create mode 100644 weex_core/Source/android/jniprebuild/jniheader/ContentBoxMeasurement_jni.h create mode 100644 weex_core/Source/android/jniprebuild/jniheader/MeasureMode_jni.h create mode 100644 weex_core/Source/android/jniprebuild/jniheader/SystemMessageHandler_jni.h create mode 100644 weex_core/Source/android/jniprebuild/jniheader/WXBridge_jni.h create mode 100755 weex_core/Source/android/jniprebuild/prebuild.sh create mode 100644 weex_core/Source/android/jsengine/multiprocess/ExtendJSApi.cpp create mode 100644 weex_core/Source/android/jsengine/multiprocess/ExtendJSApi.h create mode 100644 weex_core/Source/android/jsengine/multiprocess/WeexJSConnection.cpp create mode 100644 weex_core/Source/android/jsengine/multiprocess/WeexJSConnection.h create mode 100644 weex_core/Source/android/jsengine/multiprocess/WeexProxy.cpp create mode 100644 weex_core/Source/android/jsengine/multiprocess/WeexProxy.h create mode 100644 weex_core/Source/base/Compatible.cpp create mode 100644 weex_core/Source/base/CoreConstants.h create mode 100644 weex_core/Source/base/TimeUtils.h create mode 100644 weex_core/Source/base/ViewUtils.h create mode 100755 weex_core/Source/base/fpconv.cpp create mode 100755 weex_core/Source/base/fpconv.h create mode 100755 weex_core/Source/base/powers.h create mode 100644 weex_core/Source/core/bridge/bridge.h create mode 100644 weex_core/Source/core/config/core_environment.cpp create mode 100644 weex_core/Source/core/config/core_environment.h create mode 100644 weex_core/Source/core/css/constants_name.h create mode 100644 weex_core/Source/core/css/constants_value.h create mode 100644 weex_core/Source/core/css/css_value_getter.cpp create mode 100644 weex_core/Source/core/css/css_value_getter.h create mode 100644 weex_core/Source/core/layout/flex_enum.h create mode 100644 weex_core/Source/core/layout/layout.cpp create mode 100644 weex_core/Source/core/layout/layout.h create mode 100644 weex_core/Source/core/layout/style.cpp create mode 100644 weex_core/Source/core/layout/style.h create mode 100644 weex_core/Source/core/moniter/render_performance.cpp create mode 100644 weex_core/Source/core/moniter/render_performance.h create mode 100644 weex_core/Source/core/parser/dom_parser.cpp create mode 100644 weex_core/Source/core/parser/dom_parser.h create mode 100644 weex_core/Source/core/render/action/render_action.h create mode 100644 weex_core/Source/core/render/action/render_action_add_element.cpp create mode 100644 weex_core/Source/core/render/action/render_action_add_element.h create mode 100644 weex_core/Source/core/render/action/render_action_add_event.cpp create mode 100644 weex_core/Source/core/render/action/render_action_add_event.h create mode 100644 weex_core/Source/core/render/action/render_action_createbody.cpp create mode 100644 weex_core/Source/core/render/action/render_action_createbody.h create mode 100644 weex_core/Source/core/render/action/render_action_createfinish.cpp create mode 100644 weex_core/Source/core/render/action/render_action_createfinish.h create mode 100644 weex_core/Source/core/render/action/render_action_layout.cpp create mode 100644 weex_core/Source/core/render/action/render_action_layout.h create mode 100644 weex_core/Source/core/render/action/render_action_move_element.cpp create mode 100644 weex_core/Source/core/render/action/render_action_move_element.h create mode 100644 weex_core/Source/core/render/action/render_action_remove_element.cpp create mode 100644 weex_core/Source/core/render/action/render_action_remove_element.h create mode 100644 weex_core/Source/core/render/action/render_action_remove_event.cpp create mode 100644 weex_core/Source/core/render/action/render_action_remove_event.h create mode 100644 weex_core/Source/core/render/action/render_action_update_attr.cpp create mode 100644 weex_core/Source/core/render/action/render_action_update_attr.h create mode 100644 weex_core/Source/core/render/action/render_action_update_style.cpp create mode 100644 weex_core/Source/core/render/action/render_action_update_style.h create mode 100644 weex_core/Source/core/render/manager/render_manager.cpp create mode 100644 weex_core/Source/core/render/manager/render_manager.h create mode 100644 weex_core/Source/core/render/node/factory/i_render_factory.h create mode 100644 weex_core/Source/core/render/node/factory/i_render_object.h create mode 100644 weex_core/Source/core/render/node/factory/render_appbar_factory.h create mode 100644 weex_core/Source/core/render/node/factory/render_cell_factory.h create mode 100644 weex_core/Source/core/render/node/factory/render_creator.cpp create mode 100644 weex_core/Source/core/render/node/factory/render_creator.h create mode 100644 weex_core/Source/core/render/node/factory/render_indicator_factory.h create mode 100644 weex_core/Source/core/render/node/factory/render_input_factory.h create mode 100644 weex_core/Source/core/render/node/factory/render_list_factory.h create mode 100644 weex_core/Source/core/render/node/factory/render_mask_factory.h create mode 100644 weex_core/Source/core/render/node/factory/render_scroller_factory.h create mode 100644 weex_core/Source/core/render/node/factory/render_switch_factory.h create mode 100644 weex_core/Source/core/render/node/factory/render_text_factory.h create mode 100644 weex_core/Source/core/render/node/factory/render_textarea_factory.h create mode 100644 weex_core/Source/core/render/node/factory/render_type.h create mode 100644 weex_core/Source/core/render/node/factory/simple_render_factory.h create mode 100644 weex_core/Source/core/render/node/render_appbar.h create mode 100644 weex_core/Source/core/render/node/render_cell.h create mode 100644 weex_core/Source/core/render/node/render_indicator.h create mode 100644 weex_core/Source/core/render/node/render_input.h create mode 100644 weex_core/Source/core/render/node/render_list.h create mode 100644 weex_core/Source/core/render/node/render_mask.h create mode 100644 weex_core/Source/core/render/node/render_object.cpp create mode 100644 weex_core/Source/core/render/node/render_object.h create mode 100644 weex_core/Source/core/render/node/render_scroller.h create mode 100644 weex_core/Source/core/render/node/render_switch.h create mode 100644 weex_core/Source/core/render/node/render_text.h create mode 100644 weex_core/Source/core/render/node/render_textarea.h create mode 100644 weex_core/Source/core/render/page/render_page.cpp create mode 100644 weex_core/Source/core/render/page/render_page.h create mode 100644 weex_core/Source/rapidjson/allocators.h create mode 100644 weex_core/Source/rapidjson/document.h create mode 100644 weex_core/Source/rapidjson/encodedstream.h create mode 100644 weex_core/Source/rapidjson/encodings.h create mode 100644 weex_core/Source/rapidjson/error/en.h create mode 100644 weex_core/Source/rapidjson/error/error.h create mode 100644 weex_core/Source/rapidjson/filereadstream.h create mode 100644 weex_core/Source/rapidjson/filewritestream.h create mode 100644 weex_core/Source/rapidjson/fwd.h create mode 100644 weex_core/Source/rapidjson/internal/biginteger.h create mode 100644 weex_core/Source/rapidjson/internal/diyfp.h create mode 100644 weex_core/Source/rapidjson/internal/dtoa.h create mode 100644 weex_core/Source/rapidjson/internal/ieee754.h create mode 100644 weex_core/Source/rapidjson/internal/itoa.h create mode 100644 weex_core/Source/rapidjson/internal/meta.h create mode 100644 weex_core/Source/rapidjson/internal/pow10.h create mode 100644 weex_core/Source/rapidjson/internal/regex.h create mode 100644 weex_core/Source/rapidjson/internal/stack.h create mode 100644 weex_core/Source/rapidjson/internal/strfunc.h create mode 100644 weex_core/Source/rapidjson/internal/strtod.h create mode 100644 weex_core/Source/rapidjson/internal/swap.h create mode 100644 weex_core/Source/rapidjson/istreamwrapper.h create mode 100644 weex_core/Source/rapidjson/memorybuffer.h create mode 100644 weex_core/Source/rapidjson/memorystream.h create mode 100644 weex_core/Source/rapidjson/msinttypes/inttypes.h create mode 100644 weex_core/Source/rapidjson/msinttypes/stdint.h create mode 100644 weex_core/Source/rapidjson/ostreamwrapper.h create mode 100644 weex_core/Source/rapidjson/pointer.h create mode 100644 weex_core/Source/rapidjson/prettywriter.h create mode 100644 weex_core/Source/rapidjson/rapidjson.h create mode 100644 weex_core/Source/rapidjson/reader.h create mode 100644 weex_core/Source/rapidjson/schema.h create mode 100644 weex_core/Source/rapidjson/stream.h create mode 100644 weex_core/Source/rapidjson/stringbuffer.h create mode 100644 weex_core/Source/rapidjson/writer.h create mode 100644 weex_core/Source/weexjsc_version_script.txt create mode 100644 weex_core/__init__.py create mode 100755 weex_core/tools/cpplint.py diff --git a/android/commons/build.gradle b/android/commons/build.gradle index 9f5c82cc4b..cbf02b0e59 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' 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 3627b8c012..8854ce2072 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 @@ protected void renderPage(String template,String source,String jsonInitData){ template, options, jsonInitData, - ScreenUtil.getDisplayWidth(this), - ScreenUtil.getDisplayHeight(this), WXRenderStrategy.APPEND_ASYNC); } @@ -143,8 +141,6 @@ protected void renderPageByURL(String url,String jsonInitData){ url, options, jsonInitData, - ScreenUtil.getDisplayWidth(this), - ScreenUtil.getDisplayHeight(this), WXRenderStrategy.APPEND_ASYNC); } 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 109302f7cf..56e9a253c2 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.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 @@ */ 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 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 5a7a311f85..c6f2e64804 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 void run() { 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()); diff --git a/android/playground/app/build.gradle b/android/playground/app/build.gradle index 422dd2500c..f8b870cef6 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") +} 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 492b4c48bd..0000000000 --- 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 { - - BenchmarkActivityTestRule(Class activityClass) { - this(activityClass,true); - } - - BenchmarkActivityTestRule(Class 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); - } - -} 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 2c5f8e773b..27a90f2ad6 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 @@ 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.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.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 @@ 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 firstScreenRenderTime = new LinkedList<>(); + private static List firstScreenLayoutTime = new LinkedList<>(); private static List flingFrameSeconds = new LinkedList<>(); private static List 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 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 localTotalTime = new ArrayList<>(TIMES); + List 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 static void count() { 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 @@ private void processGfxInfo(List container) { 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 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 @@ private long calcTime() { (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 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 transformToLong(String[] string) { - List 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() { + @Override + public Boolean call() throws Exception { + return benchmarkActivity.isRenderFinish(); } - } - return array; - }*/ + }); + return benchmarkActivity; + } } 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 bd573666a0..31085deb6d 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 mActivityRule = new ActivityTestRule( BenchmarkActivity.class); @Rule public RepeatRule repeatRule = new RepeatRule(); 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 34fa40e178..c020fa54e6 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 void run() { // 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 void run() { wenbenClickAndThenAddText1.requestFocus(); wenbenClickAndThenAddText1.performClick(); - Log.e(TAG, "点击我,addEvent click 1!!"); + Log.e(TAG, "点击我,applyEvent click 1!!"); } }); 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 63e0ee53cc..8e7db0010e 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 void onViewCreated(WXSDKInstance instance, View view) { @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 void onException(WXSDKInstance instance, String errCode, String msg) { } + 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 void run() { Map 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 void run() { WXFileUtils.loadAsset("hello.js", BenchmarkActivity.this), options, null, - root.getWidth(), - root.getHeight(), WXRenderStrategy.APPEND_ASYNC); } else { root.removeAllViews(); @@ -196,6 +197,7 @@ public void loadWeexPage() { } public void loadWeexPage(final String url) { + perfEnd = false; runOnUiThread(new Runnable() { @Override public void run() { @@ -206,16 +208,11 @@ public void run() { Map 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); } }); 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 e41c5cb3e9..35fd36a0bd 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.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 void onCreate() { 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); 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 0c18d2a891..3169fc822d 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 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.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 @@ private void loadWXfromService(final String url) { } 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 void onSuccess(WXHttpTask task) { 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 @@ private static void collectId(WXComponent comp, Map map){ 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 pair = Utility.nextID(); view.setId(pair.second); 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 a42f9ac4e0..3b4b53f3a1 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.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 { - 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 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 d41fd3f3eb..0adeed43da 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 @@ 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 @@ 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 void testSyncCall(){ public void testAsyncCall(){ WXLogUtils.e("22WXComponentSynTest :"+ Thread.currentThread().getName() ); } -} +} \ No newline at end of file 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 5a26542797..036216cfbb 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 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 @@ private void fireVisibleChangedEvent(boolean visible) { @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 @@ protected void setHostLayoutParams(View host, int width, int height, int left, i 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 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 eae6c01b69..46e265fc95 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.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 @@ private void initTransform(Object propStr) { @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) { 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 1de289b02d..0000000000 --- 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/ - *

- * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - *

- * 1. Definitions. - *

- * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - *

- * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - *

- * "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. - *

- * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - *

- * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - *

- * "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. - *

- * "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). - *

- * "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. - *

- * "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." - *

- * "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. - *

- * 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. - *

- * 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. - *

- * 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: - *

- * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - *

- * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - *

- * (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 - *

- * (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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * 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. - *

- * END OF TERMS AND CONDITIONS - *

- * APPENDIX: How to apply the Apache License to your work. - *

- * 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. - *

- * Copyright 2016 Alibaba Group - *

- * 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 - *

- * 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.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 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 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; - } -} 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 b01867870e..f3fb1ff6fd 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.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. diff --git a/android/playground/app/src/main/java_zxing/com/google/zxing/client/android/CaptureActivity.java b/android/playground/app/src/main/java_zxing/com/google/zxing/client/android/CaptureActivity.java index 407434f983..6cf57f2a34 100755 --- a/android/playground/app/src/main/java_zxing/com/google/zxing/client/android/CaptureActivity.java +++ b/android/playground/app/src/main/java_zxing/com/google/zxing/client/android/CaptureActivity.java @@ -73,12 +73,12 @@ * thread. It draws a viewfinder to help the user place the barcode correctly, * shows feedback as the image processing is happening, and then overlays the * results when a scan is successful. - * + * * @author dswitkin@google.com (Daniel Switkin) * @author Sean Owen */ public final class CaptureActivity extends Activity implements - SurfaceHolder.Callback { + SurfaceHolder.Callback { private static final String TAG = CaptureActivity.class.getSimpleName(); @@ -86,15 +86,15 @@ public final class CaptureActivity extends Activity implements private static final long BULK_MODE_SCAN_DELAY_MS = 1000L; private static final String[] ZXING_URLS = { - "http://zxing.appspot.com/scan", "zxing://scan/" }; + "http://zxing.appspot.com/scan", "zxing://scan/" }; public static final int HISTORY_REQUEST_CODE = 0x0000bacc; private static final Collection DISPLAYABLE_METADATA_TYPES = EnumSet - .of(ResultMetadataType.ISSUE_NUMBER, - ResultMetadataType.SUGGESTED_PRICE, - ResultMetadataType.ERROR_CORRECTION_LEVEL, - ResultMetadataType.POSSIBLE_COUNTRY); + .of(ResultMetadataType.ISSUE_NUMBER, + ResultMetadataType.SUGGESTED_PRICE, + ResultMetadataType.ERROR_CORRECTION_LEVEL, + ResultMetadataType.POSSIBLE_COUNTRY); private CameraManager cameraManager; private CaptureActivityHandler handler; @@ -142,12 +142,12 @@ public void onCreate(Bundle icicle) { ambientLightManager = new AmbientLightManager(this); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); - + if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - } else { - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - } + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + } else { + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); + } } @Override @@ -178,7 +178,7 @@ protected void onResume() { lastResult = null; SharedPreferences prefs = PreferenceManager - .getDefaultSharedPreferences(this); + .getDefaultSharedPreferences(this); // if (prefs.getBoolean(PreferencesActivity.KEY_DISABLE_AUTO_ORIENTATION, // true)) { @@ -197,8 +197,8 @@ protected void onResume() { Intent intent = getIntent(); copyToClipboard = prefs.getBoolean( - PreferencesActivity.KEY_COPY_TO_CLIPBOARD, true) - && (intent == null || intent.getBooleanExtra( + PreferencesActivity.KEY_COPY_TO_CLIPBOARD, true) + && (intent == null || intent.getBooleanExtra( Intents.Scan.SAVE_HISTORY, true)); source = IntentSource.NONE; @@ -221,7 +221,7 @@ protected void onResume() { decodeHints = DecodeHintManager.parseDecodeHints(intent); if (intent.hasExtra(Intents.Scan.WIDTH) - && intent.hasExtra(Intents.Scan.HEIGHT)) { + && intent.hasExtra(Intents.Scan.HEIGHT)) { int width = intent.getIntExtra(Intents.Scan.WIDTH, 0); int height = intent.getIntExtra(Intents.Scan.HEIGHT, 0); if (width > 0 && height > 0) { @@ -231,21 +231,21 @@ protected void onResume() { if (intent.hasExtra(Intents.Scan.CAMERA_ID)) { int cameraId = intent.getIntExtra(Intents.Scan.CAMERA_ID, - -1); + -1); if (cameraId >= 0) { cameraManager.setManualCameraId(cameraId); } } String customPromptMessage = intent - .getStringExtra(Intents.Scan.PROMPT_MESSAGE); + .getStringExtra(Intents.Scan.PROMPT_MESSAGE); if (customPromptMessage != null) { statusView.setText(customPromptMessage); } } else if (dataString != null - && dataString.contains("http://www.google") - && dataString.contains("/m/products/scan")) { + && dataString.contains("http://www.google") + && dataString.contains("/m/products/scan")) { // Scan only products and send the result to mobile Product // Search. @@ -264,7 +264,7 @@ protected void onResume() { Uri inputUri = Uri.parse(dataString); scanFromWebPageManager = new ScanFromWebPageManager(inputUri); decodeFormats = DecodeFormatManager - .parseDecodeFormats(inputUri); + .parseDecodeFormats(inputUri); // Allow a sub-set of the hints to be specified by the caller. decodeHints = DecodeHintManager.parseDecodeHints(inputUri); @@ -292,19 +292,19 @@ private int getCurrentOrientation() { int rotation = getWindowManager().getDefaultDisplay().getRotation(); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { switch (rotation) { - case Surface.ROTATION_0: - case Surface.ROTATION_90: - return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; - default: - return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; + case Surface.ROTATION_0: + case Surface.ROTATION_90: + return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; + default: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; } } else { switch (rotation) { - case Surface.ROTATION_0: - case Surface.ROTATION_270: - return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; - default: - return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; + case Surface.ROTATION_0: + case Surface.ROTATION_270: + return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + default: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; } } } @@ -349,29 +349,29 @@ protected void onDestroy() { @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { - case KeyEvent.KEYCODE_BACK: - if (source == IntentSource.NATIVE_APP_INTENT) { - setResult(RESULT_CANCELED); - finish(); - return true; - } - if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK) - && lastResult != null) { - restartPreviewAfterDelay(0L); + case KeyEvent.KEYCODE_BACK: + if (source == IntentSource.NATIVE_APP_INTENT) { + setResult(RESULT_CANCELED); + finish(); + return true; + } + if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK) + && lastResult != null) { + restartPreviewAfterDelay(0L); + return true; + } + break; + case KeyEvent.KEYCODE_FOCUS: + case KeyEvent.KEYCODE_CAMERA: + // Handle these events so they don't launch the Camera app return true; - } - break; - case KeyEvent.KEYCODE_FOCUS: - case KeyEvent.KEYCODE_CAMERA: - // Handle these events so they don't launch the Camera app - return true; // Use volume up/down to turn on light - case KeyEvent.KEYCODE_VOLUME_DOWN: - cameraManager.setTorch(false); - return true; - case KeyEvent.KEYCODE_VOLUME_UP: - cameraManager.setTorch(true); - return true; + case KeyEvent.KEYCODE_VOLUME_DOWN: + cameraManager.setTorch(false); + return true; + case KeyEvent.KEYCODE_VOLUME_UP: + cameraManager.setTorch(true); + return true; } return super.onKeyDown(keyCode, event); } @@ -409,12 +409,12 @@ public boolean onOptionsItemSelected(MenuItem item) { @Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (resultCode == RESULT_OK && requestCode == HISTORY_REQUEST_CODE - && historyManager != null) { + && historyManager != null) { int itemNumber = intent - .getIntExtra(Intents.History.ITEM_NUMBER, -1); + .getIntExtra(Intents.History.ITEM_NUMBER, -1); if (itemNumber >= 0) { HistoryItem historyItem = historyManager - .buildHistoryItem(itemNumber); + .buildHistoryItem(itemNumber); decodeOrStoreSavedBitmap(null, historyItem.getResult()); } } @@ -430,7 +430,7 @@ private void decodeOrStoreSavedBitmap(Bitmap bitmap, Result result) { } if (savedResultToShow != null) { Message message = Message.obtain(handler, - R.id.decode_succeeded, savedResultToShow); + R.id.decode_succeeded, savedResultToShow); handler.sendMessage(message); } savedResultToShow = null; @@ -441,7 +441,7 @@ private void decodeOrStoreSavedBitmap(Bitmap bitmap, Result result) { public void surfaceCreated(SurfaceHolder holder) { if (holder == null) { Log.e(TAG, - "*** WARNING *** surfaceCreated() gave us a null surface!"); + "*** WARNING *** surfaceCreated() gave us a null surface!"); } if (!hasSurface) { hasSurface = true; @@ -456,14 +456,14 @@ public void surfaceDestroyed(SurfaceHolder holder) { @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, - int height) { + int height) { } /** * A valid barcode has been found, so give an indication of success and show * the results. - * + * * @param rawResult * The contents of the barcode. * @param scaleFactor @@ -475,7 +475,7 @@ public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) { inactivityTimer.onActivity(); lastResult = rawResult; ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler( - this, rawResult); + this, rawResult); boolean fromLiveScan = barcode != null; if (fromLiveScan) { @@ -487,44 +487,44 @@ public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) { } switch (source) { - case NATIVE_APP_INTENT: - case PRODUCT_SEARCH_LINK: - handleDecodeExternally(rawResult, resultHandler, barcode); - break; - case ZXING_LINK: - if (scanFromWebPageManager == null - || !scanFromWebPageManager.isScanFromWebPage()) { - handleDecodeInternally(rawResult, resultHandler, barcode); - } else { + case NATIVE_APP_INTENT: + case PRODUCT_SEARCH_LINK: handleDecodeExternally(rawResult, resultHandler, barcode); - } - break; - case NONE: - SharedPreferences prefs = PreferenceManager - .getDefaultSharedPreferences(this); - if (fromLiveScan - && prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, - false)) { - Toast.makeText( - getApplicationContext(), - getResources() - .getString(R.string.msg_bulk_mode_scanned) - + " (" + rawResult.getText() + ')', - Toast.LENGTH_SHORT).show(); - // Wait a moment or else it will scan the same barcode - // continuously about 3 times - restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS); - } else { - handleDecodeInternally(rawResult, resultHandler, barcode); - } - break; + break; + case ZXING_LINK: + if (scanFromWebPageManager == null + || !scanFromWebPageManager.isScanFromWebPage()) { + handleDecodeInternally(rawResult, resultHandler, barcode); + } else { + handleDecodeExternally(rawResult, resultHandler, barcode); + } + break; + case NONE: + SharedPreferences prefs = PreferenceManager + .getDefaultSharedPreferences(this); + if (fromLiveScan + && prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, + false)) { + Toast.makeText( + getApplicationContext(), + getResources() + .getString(R.string.msg_bulk_mode_scanned) + + " (" + rawResult.getText() + ')', + Toast.LENGTH_SHORT).show(); + // Wait a moment or else it will scan the same barcode + // continuously about 3 times + restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS); + } else { + handleDecodeInternally(rawResult, resultHandler, barcode); + } + break; } } /** * Superimpose a line for 1D or dots for 2D to highlight the key features of * the barcode. - * + * * @param barcode * A bitmap of the captured image. * @param scaleFactor @@ -533,7 +533,7 @@ public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) { * The decoded results which contains the points to draw. */ private void drawResultPoints(Bitmap barcode, float scaleFactor, - Result rawResult) { + Result rawResult) { ResultPoint[] points = rawResult.getResultPoints(); if (points != null && points.length > 0) { Canvas canvas = new Canvas(barcode); @@ -543,7 +543,7 @@ private void drawResultPoints(Bitmap barcode, float scaleFactor, paint.setStrokeWidth(4.0f); drawLine(canvas, paint, points[0], points[1], scaleFactor); } else if (points.length == 4 - && (rawResult.getBarcodeFormat() == BarcodeFormat.UPC_A || rawResult + && (rawResult.getBarcodeFormat() == BarcodeFormat.UPC_A || rawResult .getBarcodeFormat() == BarcodeFormat.EAN_13)) { // Hacky special case -- draw two lines, for the barcode and // metadata @@ -554,7 +554,7 @@ private void drawResultPoints(Bitmap barcode, float scaleFactor, for (ResultPoint point : points) { if (point != null) { canvas.drawPoint(scaleFactor * point.getX(), - scaleFactor * point.getY(), paint); + scaleFactor * point.getY(), paint); } } } @@ -562,44 +562,43 @@ private void drawResultPoints(Bitmap barcode, float scaleFactor, } private static void drawLine(Canvas canvas, Paint paint, ResultPoint a, - ResultPoint b, float scaleFactor) { + ResultPoint b, float scaleFactor) { if (a != null && b != null) { canvas.drawLine(scaleFactor * a.getX(), scaleFactor * a.getY(), - scaleFactor * b.getX(), scaleFactor * b.getY(), paint); + scaleFactor * b.getX(), scaleFactor * b.getY(), paint); + } + } + + // Put up our own UI for how to handle the decoded contents. + private void handleDecodeInternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) { + String code = rawResult.getText(); + if (!TextUtils.isEmpty(code)) { + Uri uri = Uri.parse(code); + if (uri.getPath().contains("dynamic/replace")) { + Intent intent = new Intent("weex.intent.action.dynamic", uri); + intent.addCategory("weex.intent.category.dynamic"); + startActivity(intent); + finish(); + } else if (uri.getQueryParameterNames().contains("_wx_devtool")) { + WXEnvironment.sRemoteDebugProxyUrl = uri.getQueryParameter("_wx_devtool"); + WXEnvironment.sDebugServerConnectable = true; + WXSDKEngine.reload(); + Toast.makeText(this, "devtool", Toast.LENGTH_SHORT).show(); + finish(); + return; + } else { + Toast.makeText(this, rawResult.getText(), Toast.LENGTH_SHORT).show(); + Intent intent = new Intent(CaptureActivity.this, WXPageActivity.class); + intent.setData(Uri.parse(code)); + startActivity(intent); + } } } - // Put up our own UI for how to handle the decoded contents. - private void handleDecodeInternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) { - String code = rawResult.getText(); - if (!TextUtils.isEmpty(code)) { - Uri uri = Uri.parse(code); - if (uri.getPath().contains("dynamic/replace")) { - Intent intent = new Intent("weex.intent.action.dynamic", uri); - intent.addCategory("weex.intent.category.dynamic"); - startActivity(intent); - finish(); - } else if (uri.getQueryParameterNames().contains("_wx_devtool")) { - WXEnvironment.sRemoteDebugProxyUrl = uri.getQueryParameter("_wx_devtool"); - WXEnvironment.sDebugServerConnectable = true; - WXSDKEngine.reload(); - Toast.makeText(this, "devtool", Toast.LENGTH_SHORT).show(); - finish(); - return; - } else { - Toast.makeText(this, rawResult.getText(), Toast.LENGTH_SHORT).show(); - Intent intent = new Intent(CaptureActivity.this, WXPageActivity.class); - intent.setData(Uri.parse(code)); - startActivity(intent); - } - } - } - - - // Briefly show the contents of the barcode, then handle the result outside + // Briefly show the contents of the barcode, then handle the result outside // Barcode Scanner. private void handleDecodeExternally(Result rawResult, - ResultHandler resultHandler, Bitmap barcode) { + ResultHandler resultHandler, Bitmap barcode) { if (barcode != null) { viewfinderView.drawResultBitmap(barcode); @@ -610,8 +609,8 @@ private void handleDecodeExternally(Result rawResult, resultDurationMS = DEFAULT_INTENT_RESULT_DURATION_MS; } else { resultDurationMS = getIntent().getLongExtra( - Intents.Scan.RESULT_DISPLAY_DURATION_MS, - DEFAULT_INTENT_RESULT_DURATION_MS); + Intents.Scan.RESULT_DISPLAY_DURATION_MS, + DEFAULT_INTENT_RESULT_DURATION_MS); } if (resultDurationMS > 0) { @@ -620,7 +619,7 @@ private void handleDecodeExternally(Result rawResult, rawResultString = rawResultString.substring(0, 32) + " ..."; } statusView.setText(getString(resultHandler.getDisplayTitle()) - + " : " + rawResultString); + + " : " + rawResultString); } if (copyToClipboard && !resultHandler.areContentsSecure()) { @@ -637,7 +636,7 @@ private void handleDecodeExternally(Result rawResult, intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.putExtra(Intents.Scan.RESULT, rawResult.toString()); intent.putExtra(Intents.Scan.RESULT_FORMAT, rawResult - .getBarcodeFormat().toString()); + .getBarcodeFormat().toString()); byte[] rawBytes = rawResult.getRawBytes(); if (rawBytes != null && rawBytes.length > 0) { intent.putExtra(Intents.Scan.RESULT_BYTES, rawBytes); @@ -646,30 +645,30 @@ private void handleDecodeExternally(Result rawResult, if (metadata != null) { if (metadata.containsKey(ResultMetadataType.UPC_EAN_EXTENSION)) { intent.putExtra(Intents.Scan.RESULT_UPC_EAN_EXTENSION, - metadata.get(ResultMetadataType.UPC_EAN_EXTENSION) - .toString()); + metadata.get(ResultMetadataType.UPC_EAN_EXTENSION) + .toString()); } Number orientation = (Number) metadata - .get(ResultMetadataType.ORIENTATION); + .get(ResultMetadataType.ORIENTATION); if (orientation != null) { intent.putExtra(Intents.Scan.RESULT_ORIENTATION, - orientation.intValue()); + orientation.intValue()); } String ecLevel = (String) metadata - .get(ResultMetadataType.ERROR_CORRECTION_LEVEL); + .get(ResultMetadataType.ERROR_CORRECTION_LEVEL); if (ecLevel != null) { intent.putExtra(Intents.Scan.RESULT_ERROR_CORRECTION_LEVEL, - ecLevel); + ecLevel); } @SuppressWarnings("unchecked") Iterable byteSegments = (Iterable) metadata - .get(ResultMetadataType.BYTE_SEGMENTS); + .get(ResultMetadataType.BYTE_SEGMENTS); if (byteSegments != null) { int i = 0; for (byte[] byteSegment : byteSegments) { intent.putExtra( - Intents.Scan.RESULT_BYTE_SEGMENTS_PREFIX + i, - byteSegment); + Intents.Scan.RESULT_BYTE_SEGMENTS_PREFIX + i, + byteSegment); i++; } } @@ -683,19 +682,19 @@ private void handleDecodeExternally(Result rawResult, // TLD as the scan URL. int end = sourceUrl.lastIndexOf("/scan"); String replyURL = sourceUrl.substring(0, end) + "?q=" - + resultHandler.getDisplayContents() + "&source=zxing"; + + resultHandler.getDisplayContents() + "&source=zxing"; sendReplyMessage(R.id.launch_product_query, replyURL, - resultDurationMS); + resultDurationMS); } else if (source == IntentSource.ZXING_LINK) { if (scanFromWebPageManager != null - && scanFromWebPageManager.isScanFromWebPage()) { + && scanFromWebPageManager.isScanFromWebPage()) { String replyURL = scanFromWebPageManager.buildReplyURL( - rawResult, resultHandler); + rawResult, resultHandler); scanFromWebPageManager = null; sendReplyMessage(R.id.launch_product_query, replyURL, - resultDurationMS); + resultDurationMS); } } @@ -718,7 +717,7 @@ private void initCamera(SurfaceHolder surfaceHolder) { } if (cameraManager.isOpen()) { Log.w(TAG, - "initCamera() while already open -- late SurfaceView callback?"); + "initCamera() while already open -- late SurfaceView callback?"); return; } try { @@ -727,7 +726,7 @@ private void initCamera(SurfaceHolder surfaceHolder) { // RuntimeException. if (handler == null) { handler = new CaptureActivityHandler(this, decodeFormats, - decodeHints, characterSet, cameraManager); + decodeHints, characterSet, cameraManager); } decodeOrStoreSavedBitmap(null, null); } catch (IOException ioe) { diff --git a/android/playground/app/src/main/java_zxing/com/google/zxing/client/android/result/WifiResultHandler.java b/android/playground/app/src/main/java_zxing/com/google/zxing/client/android/result/WifiResultHandler.java index e1bd882e09..ab76af3822 100755 --- a/android/playground/app/src/main/java_zxing/com/google/zxing/client/android/result/WifiResultHandler.java +++ b/android/playground/app/src/main/java_zxing/com/google/zxing/client/android/result/WifiResultHandler.java @@ -61,7 +61,7 @@ public int getButtonText(int index) { public void handleButtonPress(int index) { if (index == 0) { WifiParsedResult wifiResult = (WifiParsedResult) getResult(); - WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE); + WifiManager wifiManager = (WifiManager) getActivity().getApplicationContext().getSystemService(Context.WIFI_SERVICE); if (wifiManager == null) { Log.w(TAG, "No WifiManager available from device"); return; diff --git a/android/sdk/.gitignore b/android/sdk/.gitignore index 8311cb9f66..2a5a057771 100755 --- a/android/sdk/.gitignore +++ b/android/sdk/.gitignore @@ -12,4 +12,5 @@ gen *.iml lint.xml project.properties -assets/main.js \ No newline at end of file +assets/main.js +.externalNativeBuild \ No newline at end of file diff --git a/android/sdk/assets/main.js b/android/sdk/assets/main.js index fa6fdde692..307922d340 100644 --- a/android/sdk/assets/main.js +++ b/android/sdk/assets/main.js @@ -1,2 +1,2 @@ (this.nativeLog||function(e){console.log(e)})("START JS FRAMEWORK 0.24.4, Build 2018-02-07 17:13. (Vue: 2.5.13-weex.5, Rax: 0.4.20)");var global=this,process={env:{}},setTimeout=global.setTimeout;!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";var e,t,n,r;function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i(e,t){return e(t={exports:{}},t.exports),t.exports}Array.from||(Array.from=(e=Object.prototype.toString,t=function(t){return"function"==typeof t||"[object Function]"===e.call(t)},n=Math.pow(2,53)-1,r=function(e){var t,r=(t=Number(e),isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t);return Math.min(Math.max(r,0),n)},function(e){var n=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var o,i=arguments.length>1?arguments[1]:void 0;if(void 0!==i){if(!t(i))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(o=arguments[2])}for(var a,s=r(n.length),u=t(this)?Object(new this(s)):new Array(s),c=0;c0?F:D)(e)},V=Math.min,W=function(e){return e>0?V(L(e),9007199254740991):0},U=Math.max,B=Math.min,q="__core-js_shared__",J=a[q]||(a[q]={}),z=function(e){return J[e]||(J[e]={})},H=z("keys"),G=function(e){return H[e]||(H[e]=k(e))},X=(I=!1,function(e,t,n){var r,o,i,a=R(e),s=W(a.length),u=(o=s,(r=L(r=n))<0?U(r+o,0):B(r,o));if(I&&t!=t){for(;s>u;)if((i=a[u++])!=i)return!0}else for(;s>u;u++)if((I||u in a)&&a[u]===t)return I||u||0;return!I&&-1}),K=G("IE_PROTO"),Z="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Q=Object.keys||function(e){return function(e,t){var n,r=R(e),o=0,i=[];for(n in r)n!=K&&w(r,n)&&i.push(n);for(;t.length>o;)w(r,n=t[o++])&&(~X(i,n)||i.push(n));return i}(e,Z)},Y={f:Object.getOwnPropertySymbols},ee={f:{}.propertyIsEnumerable},te=function(e){return Object($(e))},ne=Object.assign,re=!ne||l(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=ne({},e)[n]||Object.keys(ne({},t)).join("")!=r})?function(e,t){for(var n=arguments,r=te(e),o=arguments.length,i=1,a=Y.f,s=ee.f;o>i;)for(var u,c=M(n[i++]),l=a?Q(c).concat(a(c)):Q(c),f=l.length,p=0;f>p;)s.call(c,u=l[p++])&&(r[u]=c[u]);return r}:ne;T(T.S+T.F,"Object",{assign:re});s.Object.assign;Object.setPrototypeOf||(Object.setPrototypeOf=function(e,t){var n;function r(e,t){return n.call(e,t),e}try{(n=e.getOwnPropertyDescriptor(e.prototype,t).set).call({},null)}catch(o){if(e.prototype!=={}[t])return;n=function(e){this[t]=e},r.polyfill=r(r({},null),e.prototype)instanceof e}return r}(Object,"__proto__"));var oe=global.WXEnvironment;oe&&"iOS"===oe.platform&&(global.Promise=void 0);var ie=i(function(e){var t=z("wks"),n=a.Symbol,r="function"==typeof n;(e.exports=function(e){return t[e]||(t[e]=r&&n[e]||(r?n:k)("Symbol."+e))}).store=t}),ae=ie("toStringTag"),se="Arguments"==N(function(){return arguments}()),ue=function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),ae))?n:se?N(t):"Object"==(r=N(t))&&"function"==typeof t.callee?"Arguments":r},ce={};ce[ie("toStringTag")]="z",ce+""!="[object z]"&&C(Object.prototype,"toString",function(){return"[object "+ue(this)+"]"},!0);var le={},fe=f?Object.defineProperties:function(e,t){c(e);for(var n,r=Q(t),o=r.length,i=0;o>i;)m.f(e,n=r[i++],t[n]);return e},pe=a.document,de=pe&&pe.documentElement,he=G("IE_PROTO"),ve=function(){},ye="prototype",me=function(){var e,t=h("iframe"),n=Z.length;for(t.style.display="none",de.appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("