Permalink
Browse files

Merge branch 'v0.10.0-stable' into dev-release095

# Conflicts:
#	README.md
#	android/commons/src/main/java/com/alibaba/weex/commons/AbstractWeexActivity.java
#	android/sdk/src/main/java/com/taobao/weex/appfram/storage/WXSQLiteOpenHelper.java
#	android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXListComponent.java
#	examples/vanilla/index.js
#	ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
  • Loading branch information...
2 parents 966c17d + 235b87f commit 4d9dcc1de20c56aed14467efc33328e56b083924 @sospartan sospartan committed Jan 11, 2017
Showing with 39,884 additions and 4,454 deletions.
  1. +1 −0 .gitignore
  2. +3 −1 android/commons/build.gradle
  3. +2 −0 android/commons/src/main/java/com/alibaba/weex/commons/AbstractWeexActivity.java
  4. +326 −0 android/commons/src/main/java/com/alibaba/weex/commons/adapter/DefaultWebSocketAdapter.java
  5. +9 −14 ...ava → commons/src/main/java/com/alibaba/weex/commons/adapter/DefaultWebSocketAdapterFactory.java}
  6. +13 −3 android/playground/app/build.gradle
  7. +212 −0 android/playground/app/src/androidTest/AndroidManifest.xml
  8. +239 −0 ...oid/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/BenchmarkActivityTestRule.java
  9. +419 −0 android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/BenchmarkTest.java
  10. +270 −0 android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/BoxPlot.java
  11. +219 −0 android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/Repeat.java
  12. +242 −0 android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/RepeatRule.java
  13. +336 −0 android/playground/app/src/androidTest/java/com/alibaba/weex/benchmark/WeexNativeCompareTest.java
  14. +35 −6 android/playground/app/src/main/AndroidManifest.xml
  15. +28 −0 android/playground/app/src/main/assets/hello_weex.js
  16. +413 −0 android/playground/app/src/main/java/com/alibaba/weex/BenchmarkActivity.java
  17. +39 −38 android/playground/app/src/main/java/com/alibaba/weex/IndexActivity.java
  18. +58 −4 android/playground/app/src/main/java/com/alibaba/weex/WXApplication.java
  19. +91 −0 android/playground/app/src/main/java/com/alibaba/weex/WXDebugActivity.java
  20. +114 −101 android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java
  21. +29 −0 android/playground/app/src/main/java/com/alibaba/weex/extend/component/WXComponentSyncTest.java
  22. +4 −4 android/playground/app/src/main/java/com/alibaba/weex/extend/module/GeolocationModule.java
  23. +2 −2 android/playground/app/src/main/java/com/alibaba/weex/extend/module/MyModule.java
  24. +2 −2 android/playground/app/src/main/java/com/alibaba/weex/extend/module/RenderModule.java
  25. +53 −0 android/playground/app/src/main/java/com/alibaba/weex/extend/module/SyncTestModule.java
  26. +8 −8 android/playground/app/src/main/java/com/alibaba/weex/extend/module/WXEventModule.java
  27. +31 −39 android/playground/app/src/main/java_zxing/com/google/zxing/client/android/CaptureActivity.java
  28. +27 −0 android/playground/app/src/main/res/layout/activity_dynamic.xml
  29. +1 −0 android/playground/app/src/main/res/layout/activity_index.xml
  30. +24 −0 android/playground/app/src/main/res/layout/content_dynamic.xml
  31. +223 −0 android/playground/app/src/main/res/layout/hello_weex.xml
  32. +1 −1 android/playground/app/src/main/res/values-zh-rCN/strings.xml
  33. +8 −2 android/playground/app/src/main/res/values/strings.xml
  34. +19,925 −7 android/sdk/assets/main.js
  35. +3 −4 android/sdk/build.gradle
  36. +3 −3 android/sdk/gradle.properties
  37. +1 −1 android/sdk/gradle/wrapper/gradle-wrapper.properties
  38. BIN android/sdk/libs/armeabi/libweexv8.so
  39. BIN android/sdk/libs/x86/libweexv8.so
  40. +1 −1 android/sdk/src/main/AndroidManifest.xml
  41. +2 −0 android/sdk/src/main/java/com/taobao/weex/IWXActivityStateListener.java
  42. +26 −0 android/sdk/src/main/java/com/taobao/weex/InitConfig.java
  43. +253 −0 android/sdk/src/main/java/com/taobao/weex/RenderContainer.java
  44. +13 −1 android/sdk/src/main/java/com/taobao/weex/WXEnvironment.java
  45. +3 −3 android/sdk/src/main/java/com/taobao/weex/WXGlobalEventModule.java
  46. +9 −3 android/sdk/src/main/java/com/taobao/weex/WXGlobalEventReceiver.java
  47. +59 −5 android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
  48. +440 −183 android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
  49. +46 −2 android/sdk/src/main/java/com/taobao/weex/WXSDKManager.java
  50. +213 −0 android/sdk/src/main/java/com/taobao/weex/adapter/DrawableStrategy.java
  51. +219 −0 android/sdk/src/main/java/com/taobao/weex/adapter/IDrawableLoader.java
  52. +1 −1 android/sdk/src/main/java/com/taobao/weex/{common → annotation}/Component.java
  53. +12 −4 android/sdk/src/main/java/com/taobao/weex/appfram/clipboard/WXClipboardModule.java
  54. +114 −68 android/sdk/src/main/java/com/taobao/weex/appfram/navigator/WXNavigatorModule.java
  55. +0 −1 android/sdk/src/main/java/com/taobao/weex/appfram/storage/WXSQLiteOpenHelper.java
  56. +9 −8 android/sdk/src/main/java/com/taobao/weex/appfram/storage/WXStorageModule.java
  57. +234 −0 android/sdk/src/main/java/com/taobao/weex/appfram/websocket/IWebSocketAdapter.java
  58. +213 −0 android/sdk/src/main/java/com/taobao/weex/appfram/websocket/IWebSocketAdapterFactory.java
  59. +237 −0 android/sdk/src/main/java/com/taobao/weex/appfram/websocket/WebSocketCloseCodes.java
  60. +341 −0 android/sdk/src/main/java/com/taobao/weex/appfram/websocket/WebSocketModule.java
  61. +2 −2 android/sdk/src/main/java/com/taobao/weex/bridge/Invoker.java
  62. +4 −3 android/sdk/src/main/java/com/taobao/weex/bridge/{JSCallbackCreator.java → JavascriptInvokable.java}
  63. +10 −8 android/sdk/src/main/java/com/taobao/weex/bridge/MethodInvoker.java
  64. +2 −3 android/sdk/src/main/java/com/taobao/weex/bridge/ModuleFactory.java
  65. +276 −0 android/sdk/src/main/java/com/taobao/weex/bridge/NativeInvokeHelper.java
  66. +48 −3 android/sdk/src/main/java/com/taobao/weex/bridge/WXBridge.java
  67. +160 −85 android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
  68. +38 −10 android/sdk/src/main/java/com/taobao/weex/bridge/WXJSObject.java
  69. +178 −49 android/sdk/src/main/java/com/taobao/weex/bridge/WXModuleManager.java
  70. +19 −0 android/sdk/src/main/java/com/taobao/weex/bridge/WXParams.java
  71. +236 −0 android/sdk/src/main/java/com/taobao/weex/bridge/WXServiceManager.java
  72. +26 −0 android/sdk/src/main/java/com/taobao/weex/common/Constants.java
  73. +6 −0 android/sdk/src/main/java/com/taobao/weex/common/IWXBridge.java
  74. +1 −3 android/sdk/src/main/java/com/taobao/weex/common/IWXDebugProxy.java
  75. +19 −13 android/sdk/src/main/java/com/taobao/weex/common/TypeModuleFactory.java
  76. +270 −0 android/sdk/src/main/java/com/taobao/weex/common/WXCompatModule.java
  77. +1 −0 android/sdk/src/main/java/com/taobao/weex/common/WXConfig.java
  78. +3 −1 android/sdk/src/main/java/com/taobao/weex/common/WXInstanceWrap.java
  79. +258 −121 android/sdk/src/main/java/com/taobao/weex/common/WXModule.java
  80. +4 −1 android/sdk/src/main/java/com/taobao/weex/common/WXModuleAnno.java
  81. +3 −3 android/sdk/src/main/java/com/taobao/weex/dom/BasicEditTextDomObject.java
  82. +216 −0 android/sdk/src/main/java/com/taobao/weex/dom/DomContext.java
  83. +228 −0 android/sdk/src/main/java/com/taobao/weex/dom/ImmutableDomObject.java
  84. +112 −2 android/sdk/src/main/java/com/taobao/weex/dom/WXAttr.java
  85. +1 −1 android/sdk/src/main/java/com/taobao/weex/dom/WXCustomStyleSpan.java
  86. +10 −5 android/sdk/src/main/java/com/taobao/weex/dom/WXDomHandler.java
  87. +5 −4 android/sdk/src/main/java/com/taobao/weex/dom/WXDomManager.java
  88. +49 −33 android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java
  89. +269 −146 android/sdk/src/main/java/com/taobao/weex/dom/WXDomObject.java
  90. +236 −310 android/sdk/src/main/java/com/taobao/weex/dom/WXDomStatement.java
  91. +190 −21 android/sdk/src/main/java/com/taobao/weex/dom/WXStyle.java
  92. +31 −33 android/sdk/src/main/java/com/taobao/weex/dom/WXSwitchDomObject.java
  93. +46 −58 android/sdk/src/main/java/com/taobao/weex/dom/WXTextDomObject.java
  94. +12 −9 android/sdk/src/main/java/com/taobao/weex/http/WXStreamModule.java
  95. +2 −4 android/sdk/src/main/java/com/taobao/weex/ui/IFComponentHolder.java
  96. +3 −4 android/sdk/src/main/java/com/taobao/weex/ui/SimpleComponentHolder.java
  97. +5 −5 android/sdk/src/main/java/com/taobao/weex/ui/WXRenderManager.java
  98. +25 −51 android/sdk/src/main/java/com/taobao/weex/ui/WXRenderStatement.java
  99. +30 −30 android/sdk/src/main/java/com/taobao/weex/ui/animation/WXAnimationBean.java
  100. +26 −7 android/sdk/src/main/java/com/taobao/weex/ui/animation/WXAnimationModule.java
  101. +36 −10 android/sdk/src/main/java/com/taobao/weex/ui/component/AbstractEditComponent.java
  102. +0 −3 android/sdk/src/main/java/com/taobao/weex/ui/component/Scrollable.java
  103. +4 −11 android/sdk/src/main/java/com/taobao/weex/ui/component/WXA.java
  104. +11 −1 android/sdk/src/main/java/com/taobao/weex/ui/component/WXBaseRefresh.java
  105. +384 −251 android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
  106. +2 −3 android/sdk/src/main/java/com/taobao/weex/ui/component/WXDiv.java
  107. +16 −8 android/sdk/src/main/java/com/taobao/weex/ui/component/WXEmbed.java
  108. +1 −1 android/sdk/src/main/java/com/taobao/weex/ui/component/WXHeader.java
  109. +170 −132 android/sdk/src/main/java/com/taobao/weex/ui/component/WXImage.java
  110. +10 −2 android/sdk/src/main/java/com/taobao/weex/ui/component/WXIndicator.java
  111. +1 −1 android/sdk/src/main/java/com/taobao/weex/ui/component/WXInput.java
  112. +19 −3 android/sdk/src/main/java/com/taobao/weex/ui/component/WXLoading.java
  113. +1 −1 android/sdk/src/main/java/com/taobao/weex/ui/component/WXLoadingIndicator.java
  114. +17 −10 android/sdk/src/main/java/com/taobao/weex/ui/component/WXRefresh.java
  115. +43 −23 android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java
  116. +122 −14 android/sdk/src/main/java/com/taobao/weex/ui/component/WXSlider.java
  117. +155 −25 android/sdk/src/main/java/com/taobao/weex/ui/component/WXSliderNeighbor.java
  118. +9 −13 android/sdk/src/main/java/com/taobao/weex/ui/component/WXSwitch.java
  119. +6 −4 android/sdk/src/main/java/com/taobao/weex/ui/component/WXText.java
  120. +172 −12 android/sdk/src/main/java/com/taobao/weex/ui/component/WXVContainer.java
  121. +1 −1 android/sdk/src/main/java/com/taobao/weex/ui/component/WXVideo.java
  122. +13 −10 android/sdk/src/main/java/com/taobao/weex/ui/component/WXWeb.java
  123. +1,104 −0 android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
  124. +1 −1 android/sdk/src/main/java/com/taobao/weex/ui/component/list/HorizontalListComponent.java
  125. +223 −0 android/sdk/src/main/java/com/taobao/weex/ui/component/list/ListComponentView.java
  126. +231 −0 android/sdk/src/main/java/com/taobao/weex/ui/component/list/SimpleListComponent.java
  127. +329 −0 android/sdk/src/main/java/com/taobao/weex/ui/component/list/SimpleRecyclerView.java
  128. +3 −3 android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXCell.java
  129. +69 −883 android/sdk/src/main/java/com/taobao/weex/ui/component/list/WXListComponent.java
  130. +212 −0 android/sdk/src/main/java/com/taobao/weex/ui/component/pesudo/OnActivePseudoListner.java
  131. +317 −0 android/sdk/src/main/java/com/taobao/weex/ui/component/pesudo/PesudoStatus.java
  132. +234 −0 android/sdk/src/main/java/com/taobao/weex/ui/component/pesudo/TouchActivePseudoListener.java
  133. +246 −0 android/sdk/src/main/java/com/taobao/weex/ui/module/WXMetaModule.java
  134. +48 −47 android/sdk/src/main/java/com/taobao/weex/ui/module/WXModalUIModule.java
  135. +5 −5 android/sdk/src/main/java/com/taobao/weex/ui/module/WXTimerModule.java
  136. +4 −4 android/sdk/src/main/java/com/taobao/weex/ui/module/WXWebViewModule.java
  137. +214 −0 android/sdk/src/main/java/com/taobao/weex/ui/view/IRenderStatus.java
  138. +4 −0 android/sdk/src/main/java/com/taobao/weex/ui/view/WXCirclePageAdapter.java
  139. +25 −0 android/sdk/src/main/java/com/taobao/weex/ui/view/WXCircleViewPager.java
  140. +8 −0 android/sdk/src/main/java/com/taobao/weex/ui/view/WXFrameLayout.java
  141. +12 −0 android/sdk/src/main/java/com/taobao/weex/ui/view/WXHorizontalScrollView.java
  142. +54 −116 android/sdk/src/main/java/com/taobao/weex/ui/view/WXImageView.java
  143. +12 −0 android/sdk/src/main/java/com/taobao/weex/ui/view/WXScrollView.java
  144. +3 −0 android/sdk/src/main/java/com/taobao/weex/ui/view/WXSwitchView.java
  145. +17 −1 android/sdk/src/main/java/com/taobao/weex/ui/view/WXTextView.java
  146. +163 −175 android/sdk/src/main/java/com/taobao/weex/ui/view/border/BorderDrawable.java
  147. +293 −0 android/sdk/src/main/java/com/taobao/weex/ui/view/border/BorderUtil.java
  148. +149 −70 android/sdk/src/main/java/com/taobao/weex/ui/view/gesture/WXGesture.java
  149. +4 −1 android/sdk/src/main/java/com/taobao/weex/ui/view/gesture/WXGestureType.java
  150. +33 −1 android/sdk/src/main/java/com/taobao/weex/ui/view/listview/WXRecyclerView.java
  151. +0 −1 android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/circlebar/CircleProgressBar.java
  152. +6 −0 android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/core/WXRefreshView.java
  153. +24 −17 android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/core/WXSwipeLayout.java
  154. +22 −0 android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BaseBounceView.java
  155. +24 −4 android/sdk/src/main/java/com/taobao/weex/ui/view/refresh/wrapper/BounceRecyclerView.java
  156. +224 −0 android/sdk/src/main/java/com/taobao/weex/utils/ATagUtil.java
  157. +15 −0 android/sdk/src/main/java/com/taobao/weex/utils/FunctionParser.java
  158. +326 −0 android/sdk/src/main/java/com/taobao/weex/utils/ImageDrawable.java
  159. +228 −0 android/sdk/src/main/java/com/taobao/weex/utils/ImgURIUtil.java
  160. +268 −0 android/sdk/src/main/java/com/taobao/weex/utils/WXDomUtils.java
  161. +22 −18 android/sdk/src/main/java/com/taobao/weex/utils/WXFileUtils.java
  162. +12 −3 android/sdk/src/main/java/com/taobao/weex/utils/WXJsonUtils.java
  163. +0 −38 android/sdk/src/main/java/com/taobao/weex/utils/WXReflectionUtils.java
  164. +111 −0 android/sdk/src/main/java/com/taobao/weex/utils/WXResourceUtils.java
  165. +2 −5 android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java
  166. +101 −67 android/sdk/src/main/java/com/taobao/weex/utils/WXViewUtils.java
  167. +2 −0 android/sdk/src/test/java/com/taobao/weex/WXSDKEngineTest.java
  168. +54 −11 android/sdk/src/test/java/com/taobao/weex/WXSDKInstanceTest.java
  169. +261 −0 android/sdk/src/test/java/com/taobao/weex/appfram/clipboard/WXClipboardModuleTest.java
  170. +15 −11 android/sdk/src/test/java/com/taobao/weex/appfram/navigator/WXNavigatorModuleTest.java
  171. +263 −0 android/sdk/src/test/java/com/taobao/weex/bridge/WXBridgeTest.java
  172. +1 −1 android/sdk/src/test/java/com/taobao/weex/bridge/WXHashMapTest.java
  173. +0 −2 android/sdk/src/test/java/com/taobao/weex/bridge/WXModuleManagerTest.java
  174. +3 −2 android/sdk/src/test/java/com/taobao/weex/common/TestModule.java
  175. +17 −10 android/sdk/src/test/java/com/taobao/weex/dom/TestDomObject.java
  176. +31 −7 android/sdk/src/test/java/com/taobao/weex/dom/WXAttrTest.java
  177. +1 −2 android/sdk/src/test/java/com/taobao/weex/dom/WXDomModuleTest.java
  178. +15 −2 android/sdk/src/test/java/com/taobao/weex/dom/WXDomStatementTest.java
  179. +80 −0 android/sdk/src/test/java/com/taobao/weex/dom/WXStyleTest.java
  180. +276 −0 android/sdk/src/test/java/com/taobao/weex/dom/WXTextDomObjectTest.java
  181. +4 −0 android/sdk/src/test/java/com/taobao/weex/http/WXStreamModuleTest.java
  182. +0 −6 android/sdk/src/test/java/com/taobao/weex/ui/animation/WXAnimationModuleTest.java
  183. +20 −3 android/sdk/src/test/java/com/taobao/weex/ui/component/ComponentTest.java
  184. +54 −11 android/sdk/src/test/java/com/taobao/weex/ui/component/WXComponentTest.java
  185. +5 −6 android/sdk/src/test/java/com/taobao/weex/ui/component/WXDivTest.java
  186. +259 −0 android/sdk/src/test/java/com/taobao/weex/ui/component/WXEmbedTest.java
  187. +23 −7 android/sdk/src/test/java/com/taobao/weex/ui/component/WXImageTest.java
  188. +259 −0 android/sdk/src/test/java/com/taobao/weex/ui/component/WXLoadingTest.java
  189. +261 −0 android/sdk/src/test/java/com/taobao/weex/ui/component/WXRefreshTest.java
  190. +2 −1 android/sdk/src/test/java/com/taobao/weex/ui/component/WXScrollerTest.java
  191. +288 −0 android/sdk/src/test/java/com/taobao/weex/ui/component/WXSliderNeighborTest.java
  192. +23 −4 android/sdk/src/test/java/com/taobao/weex/ui/component/WXSliderTest.java
  193. +261 −0 android/sdk/src/test/java/com/taobao/weex/ui/component/WXSwitchTest.java
  194. +20 −4 android/sdk/src/test/java/com/taobao/weex/ui/component/WXTextTest.java
  195. +336 −0 android/sdk/src/test/java/com/taobao/weex/ui/component/WXWebTest.java
  196. +18 −3 android/sdk/src/test/java/com/taobao/weex/ui/component/list/WXListComponentTest.java
  197. +263 −0 android/sdk/src/test/java/com/taobao/weex/ui/module/WXMetaModuleTest.java
  198. +1 −1 android/sdk/src/test/java/com/taobao/weex/ui/module/WXModalUIModuleTest.java
  199. +35 −3 android/sdk/src/test/java/com/taobao/weex/ui/view/border/BorderDrawableTest.java
  200. +268 −0 android/sdk/src/test/java/com/taobao/weex/ui/view/gesture/WXGestureTest.java
  201. +225 −0 android/sdk/src/test/java/com/taobao/weex/utils/FunctionParserTest.java
  202. +284 −0 android/sdk/src/test/java/com/taobao/weex/utils/WXLogUtilsTest.java
  203. +17 −1 android/sdk/src/test/java/com/taobao/weex/utils/WXResourceUtilsTest.java
  204. +17 −0 android/sdk/src/test/java/com/taobao/weex/utils/WXUtilsTest.java
  205. +4 −0 android/sdk/unittest.sh
  206. +15 −0 android/weex_debug/src/main/java/com/taobao/weex/bridge/WXWebsocketBridge.java
  207. +57 −0 build/webpack.macacatest.config.js
  208. +13 −6 circle.yml
  209. +9 −3 doc/advanced/integrate-to-android.md
  210. +7 −0 examples/component/slider/index.we
  211. +1 −1 ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
  212. +6 −0 package.json
  213. +28 −0 test/README.md
  214. +0 −42 test/benchmark.html
  215. +0 −16 test/circleci-android/Constants.java
  216. +0 −45 test/event-bubble.we
  217. +0 −26 test/index-item.we
  218. +0 −53 test/index.we
  219. +0 −27 test/input-test.we
  220. 0 test/pages/components/input.we
  221. +27 −0 test/pages/index.we
  222. +28 −0 test/run.sh
  223. +57 −0 test/scripts/index.test.js
  224. +1 −0 test/scripts/test.js
  225. +17 −0 test/scripts/weex-node-map.js
  226. +129 −0 test/scripts/weex.js
  227. +0 −168 test/scroller-demo.we
  228. +4 −0 test/serve.sh
  229. +0 −81 test/sticky-demo.we
  230. +0 −3 test/stream.json
  231. +0 −140 test/stream.we
  232. +0 −85 test/test.we
  233. +0 −13 test/text-word-wrap.we
  234. +0 −28 test/ui-list-item.we
  235. +5 −0 test/update-cli.sh
  236. +0 −30 test/web-demo.we
  237. +0 −42 test/web-inner.html
View
@@ -35,3 +35,4 @@ android/playground/app/gradlew
android/playground/app/gradlew.bat
android/playground/app/gradle/wrapper/gradle-wrapper.jar
android/playground/app/gradle/wrapper/gradle-wrapper.properties
+android/sdk/.externalNativeBuild/ndkBuild/
@@ -24,7 +24,7 @@ android {
defaultConfig {
minSdkVersion 14
- targetSdkVersion 19
+ targetSdkVersion 23
versionCode 1
versionName "1.0"
}
@@ -50,6 +50,8 @@ dependencies {
compile 'com.facebook.fresco:fresco:0.10.0'
provided 'com.taobao.android:weex_analyzer:0.1.0.5'
+ provided 'com.squareup.okhttp:okhttp:2.3.0'
+ provided 'com.squareup.okhttp:okhttp-ws:2.3.0'
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-core:1.3'
@@ -279,6 +279,7 @@ protected void renderPage(String template,String source,String jsonInitData){
AssertUtil.throwIfNull(mContainer,new RuntimeException("Can't render page, container is null"));
Map<String, Object> options = new HashMap<>();
options.put(WXSDKInstance.BUNDLE_URL, source);
+ mInstance.setTrackComponent(true);
mInstance.render(
getPageName(),
template,
@@ -297,6 +298,7 @@ protected void renderPageByURL(String url,String jsonInitData){
AssertUtil.throwIfNull(mContainer,new RuntimeException("Can't render page, container is null"));
Map<String, Object> options = new HashMap<>();
options.put(WXSDKInstance.BUNDLE_URL, url);
+ mInstance.setTrackComponent(true);
mInstance.renderByUrl(
getPageName(),
url,
@@ -0,0 +1,326 @@
+/**
+ *
+ * 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.commons.adapter;
+
+import android.support.annotation.Nullable;
+
+import com.squareup.okhttp.OkHttpClient;
+import com.squareup.okhttp.Request;
+import com.squareup.okhttp.Response;
+import com.squareup.okhttp.ws.WebSocket;
+import com.squareup.okhttp.ws.WebSocketCall;
+import com.squareup.okhttp.ws.WebSocketListener;
+import com.taobao.weex.appfram.websocket.IWebSocketAdapter;
+import com.taobao.weex.appfram.websocket.WebSocketCloseCodes;
+
+import java.io.EOFException;
+import java.io.IOException;
+
+import okio.Buffer;
+import okio.BufferedSource;
+
+/**
+ * Created by moxun on 16/12/27.
+ */
+
+public class DefaultWebSocketAdapter implements IWebSocketAdapter {
+
+ private WebSocket ws;
+ private EventListener eventListener;
+
+ @Override
+ public void connect(String url, @Nullable String protocol, EventListener listener) {
+ this.eventListener = listener;
+ OkHttpClient okHttpClient = new OkHttpClient();
+
+ Request.Builder builder = new Request.Builder();
+
+ if (protocol != null) {
+ builder.addHeader(HEADER_SEC_WEBSOCKET_PROTOCOL, protocol);
+ }
+
+ builder.url(url);
+
+ WebSocketCall.create(okHttpClient, builder.build()).enqueue(new WebSocketListener() {
+ @Override
+ public void onOpen(WebSocket webSocket, Request request, Response response) throws IOException {
+ ws = webSocket;
+ eventListener.onOpen();
+ }
+
+ @Override
+ public void onMessage(BufferedSource payload, WebSocket.PayloadType type) throws IOException {
+ eventListener.onMessage(payload.readUtf8());
+ payload.close();
+ }
+
+ @Override
+ public void onPong(Buffer payload) {
+
+ }
+
+ @Override
+ public void onClose(int code, String reason) {
+ eventListener.onClose(code, reason, true);
+ }
+
+ @Override
+ public void onFailure(IOException e) {
+ e.printStackTrace();
+ if (e instanceof EOFException) {
+ eventListener.onClose(WebSocketCloseCodes.CLOSE_NORMAL.getCode(), WebSocketCloseCodes.CLOSE_NORMAL.name(), true);
+ } else {
+ eventListener.onError(e.getMessage());
+ }
+ }
+ });
+ }
+
+ @Override
+ public void send(String data) {
+ if (ws != null) {
+ try {
+ Buffer buffer = new Buffer().writeUtf8(data);
+ ws.sendMessage(WebSocket.PayloadType.TEXT, buffer.buffer());
+ buffer.flush();
+ buffer.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ reportError(e.getMessage());
+ }
+ } else {
+ reportError("WebSocket is not ready");
+ }
+ }
+
+ @Override
+ public void close(int code, String reason) {
+ if (ws != null) {
+ try {
+ ws.close(code, reason);
+ } catch (Exception e) {
+ e.printStackTrace();
+ reportError(e.getMessage());
+ }
+ }
+ }
+
+ @Override
+ public void destroy() {
+ if (ws != null) {
+ try {
+ ws.close(WebSocketCloseCodes.CLOSE_GOING_AWAY.getCode(), WebSocketCloseCodes.CLOSE_GOING_AWAY.name());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void reportError(String message) {
+ if (eventListener != null) {
+ eventListener.onError(message);
+ }
+ }
+}
@@ -202,23 +202,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.taobao.weex.bridge;
+package com.alibaba.weex.commons.adapter;
-import java.lang.reflect.Method;
+import com.taobao.weex.appfram.websocket.IWebSocketAdapter;
+import com.taobao.weex.appfram.websocket.IWebSocketAdapterFactory;
/**
- * Created by sospartan on 27/10/2016.
+ * Created by moxun on 16/12/28.
*/
-public class BaseMethodInvoker extends MethodInvoker {
- private final boolean mIsRunInUIThread;
- public BaseMethodInvoker(Method method,boolean runInUIThread) {
- super(method);
- mIsRunInUIThread = runInUIThread;
- }
-
- @Override
- public boolean isRunInUIThread() {
- return mIsRunInUIThread;
- }
+public class DefaultWebSocketAdapterFactory implements IWebSocketAdapterFactory {
+ @Override
+ public IWebSocketAdapter createWebSocketAdapter() {
+ return new DefaultWebSocketAdapter();
+ }
}
Oops, something went wrong.

0 comments on commit 4d9dcc1

Please sign in to comment.