├── MyApplication ├── .gitignore ├── .idea │ ├── .name │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── misc.xml │ ├── modules.xml │ └── runConfigurations.xml ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ └── dist │ │ │ └── home │ │ │ └── home-live.js │ │ ├── java │ │ └── com │ │ │ └── test │ │ │ └── www │ │ │ └── myapplication │ │ │ ├── ContextUtil.java │ │ │ ├── WeexConstants.java │ │ │ ├── ZhiboApplication.java │ │ │ ├── adapter │ │ │ ├── FrescoImageAdapter.java │ │ │ ├── PlayDebugAdapter.java │ │ │ └── WXOkHttpAdapter.java │ │ │ ├── component │ │ │ ├── FrescoImageComponent.java │ │ │ ├── RichTextview.java │ │ │ ├── WXNewSlider.java │ │ │ └── view │ │ │ │ ├── FrescoImageView.java │ │ │ │ └── WXSwipeRefreshView.java │ │ │ ├── event │ │ │ └── WXRefreshEvent.java │ │ │ ├── manager │ │ │ └── WeexConfigManager.java │ │ │ ├── module │ │ │ ├── IWXEventModule.java │ │ │ └── impl │ │ │ │ └── WXEventModule.java │ │ │ ├── network │ │ │ ├── BaseNetworkEvent.java │ │ │ ├── HttpConnector.java │ │ │ └── retrofit │ │ │ │ ├── ByteArrayConverterFactory.java │ │ │ │ └── StringConverterFactory.java │ │ │ ├── util │ │ │ └── WeexFileUtil.java │ │ │ └── view │ │ │ ├── FirstActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── PageActivity.java │ │ │ └── base │ │ │ └── WXBaseActivity.java │ │ └── res │ │ ├── layout │ │ ├── activity_first.xml │ │ ├── activity_main.xml │ │ └── activity_page.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── assets.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lib_ui │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── eastmoney │ │ │ └── live │ │ │ └── ui │ │ │ ├── CircleImageView.java │ │ │ ├── CircularCoverView.java │ │ │ ├── ContextUtil.java │ │ │ ├── DensityUtil.java │ │ │ ├── ThemeUtils.java │ │ │ ├── ToastUtil.java │ │ │ └── refreshlayout │ │ │ ├── LionRefreshDrawable.java │ │ │ ├── PullRefreshLayout.java │ │ │ └── RefreshDrawable.java │ │ └── res │ │ ├── anim │ │ ├── activity_tobottom.xml │ │ ├── activity_totop.xml │ │ ├── slide_in_bottom.xml │ │ ├── slide_out_bottom.xml │ │ ├── swipeback_activity_close_enter.xml │ │ ├── swipeback_activity_close_exit.xml │ │ ├── swipeback_activity_open_enter.xml │ │ └── swipeback_activity_open_exit.xml │ │ ├── drawable-xhdpi │ │ ├── avatar_default.png │ │ ├── icon_frame_vip.png │ │ └── img_me_circle.png │ │ ├── drawable-xxhdpi │ │ ├── avatar_default.png │ │ ├── btn_minus_click.png │ │ ├── btn_minus_disable.png │ │ ├── btn_minus_normal.png │ │ ├── btn_plus_click.png │ │ ├── btn_plus_disable.png │ │ ├── btn_plus_normal.png │ │ ├── icon_circle_frame_arrow_normal.png │ │ ├── icon_discover_vip_border.png │ │ ├── icon_frame_vip.png │ │ ├── icon_level_crown_high_02.png │ │ ├── icon_level_crown_high_03.png │ │ ├── icon_level_crown_high_04.png │ │ ├── icon_level_crown_high_05.png │ │ ├── icon_level_crown_high_circle.png │ │ ├── icon_level_crown_low_circle.png │ │ ├── icon_level_crown_middle_circle.png │ │ ├── icon_level_luna_circle.png │ │ ├── icon_level_star_circle.png │ │ ├── icon_level_sun_circle.png │ │ ├── icon_live_message_alert_arrow.png │ │ ├── icon_live_no1.png │ │ ├── icon_live_no2.png │ │ ├── icon_live_no3.png │ │ ├── icon_pic_vip.png │ │ ├── icon_vip_outline.png │ │ ├── img_me_circle.png │ │ ├── lion_anim_frame_001.png │ │ ├── lion_anim_frame_002.png │ │ ├── lion_anim_frame_003.png │ │ ├── lion_anim_frame_004.png │ │ ├── lion_anim_frame_005.png │ │ ├── lion_anim_frame_006.png │ │ ├── lion_anim_frame_007.png │ │ ├── lion_anim_frame_008.png │ │ ├── lion_anim_frame_009.png │ │ ├── lion_anim_frame_010.png │ │ ├── lion_redpacket.png │ │ └── selector_pickerview_btn.xml │ │ ├── drawable │ │ ├── backgroud_grey_corner.xml │ │ ├── badgeview_red_background.xml │ │ ├── bg_item_edit_text_view.xml │ │ ├── btn_minus.xml │ │ ├── btn_plus.xml │ │ └── lion_anim.xml │ │ ├── layout │ │ ├── bg_blur_image.xml │ │ ├── comui_tab_view.xml │ │ ├── header_toast.xml │ │ ├── include_pickerview_topbar.xml │ │ ├── item_edit_text_view.xml │ │ ├── kprogresshud_hud.xml │ │ ├── layout_basepickerview.xml │ │ ├── layout_live_message.xml │ │ ├── layout_plus_minus_btn.xml │ │ ├── pickerview_options.xml │ │ ├── pickerview_time.xml │ │ └── tab_top.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── bools.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── integers.xml │ │ ├── strings.xml │ │ ├── styles.xml │ │ └── themes.xml ├── settings.gradle └── weex_sdk │ ├── .gitignore │ ├── NOTICE │ ├── README.md │ ├── assets │ ├── .gitkeep │ ├── .gitkeeper │ └── main.js │ ├── build.gradle │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ ├── libs │ ├── armeabi │ │ └── libweexv8.so │ └── x86 │ │ └── libweexv8.so │ ├── license │ ├── LICENSE │ ├── license-gradle-plugin-0.12.1.jar │ ├── maven-license-plugin-1.10.b1.jar │ └── plexus-utils-3.0.24.jar │ ├── proguard-rules.pro │ ├── publish.sh │ └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── taobao │ │ └── weex │ │ ├── IWXActivityStateListener.java │ │ ├── IWXRenderListener.java │ │ ├── InitConfig.java │ │ ├── RenderContainer.java │ │ ├── WXEnvironment.java │ │ ├── WXGlobalEventModule.java │ │ ├── WXGlobalEventReceiver.java │ │ ├── WXRenderErrorCode.java │ │ ├── WXSDKEngine.java │ │ ├── WXSDKInstance.java │ │ ├── WXSDKManager.java │ │ ├── adapter │ │ ├── DefaultUriAdapter.java │ │ ├── DefaultWXHttpAdapter.java │ │ ├── DrawableStrategy.java │ │ ├── IDrawableLoader.java │ │ ├── IWXDebugAdapter.java │ │ ├── IWXHttpAdapter.java │ │ ├── IWXImgLoaderAdapter.java │ │ ├── IWXJSExceptionAdapter.java │ │ ├── IWXUserTrackAdapter.java │ │ └── URIAdapter.java │ │ ├── annotation │ │ ├── Component.java │ │ └── JSMethod.java │ │ ├── appfram │ │ ├── clipboard │ │ │ ├── IWXClipboard.java │ │ │ └── WXClipboardModule.java │ │ ├── navigator │ │ │ ├── IActivityNavBarSetter.java │ │ │ └── WXNavigatorModule.java │ │ ├── pickers │ │ │ ├── DatePickerImpl.java │ │ │ └── WXPickersModule.java │ │ ├── storage │ │ │ ├── DefaultWXStorage.java │ │ │ ├── IWXStorage.java │ │ │ ├── IWXStorageAdapter.java │ │ │ ├── StorageResultHandler.java │ │ │ ├── WXSQLiteOpenHelper.java │ │ │ └── WXStorageModule.java │ │ └── websocket │ │ │ ├── IWebSocketAdapter.java │ │ │ ├── IWebSocketAdapterFactory.java │ │ │ ├── WebSocketCloseCodes.java │ │ │ └── WebSocketModule.java │ │ ├── bridge │ │ ├── Invoker.java │ │ ├── JSCallback.java │ │ ├── JavascriptInvokable.java │ │ ├── MethodInvoker.java │ │ ├── ModuleFactory.java │ │ ├── NativeInvokeHelper.java │ │ ├── SimpleJSCallback.java │ │ ├── WXBridge.java │ │ ├── WXBridgeManager.java │ │ ├── WXHashMap.java │ │ ├── WXJSObject.java │ │ ├── WXModuleManager.java │ │ ├── WXParams.java │ │ ├── WXServiceManager.java │ │ └── WXTask.java │ │ ├── common │ │ ├── Constants.java │ │ ├── Destroyable.java │ │ ├── IWXBridge.java │ │ ├── IWXDebugProxy.java │ │ ├── IWXObject.java │ │ ├── IWXTask.java │ │ ├── OnWXScrollListener.java │ │ ├── TypeModuleFactory.java │ │ ├── WXCompatModule.java │ │ ├── WXConfig.java │ │ ├── WXErrorCode.java │ │ ├── WXException.java │ │ ├── WXImageSharpen.java │ │ ├── WXImageStrategy.java │ │ ├── WXInstanceWrap.java │ │ ├── WXJSBridgeMsgType.java │ │ ├── WXJSEngineListener.java │ │ ├── WXJSExceptionInfo.java │ │ ├── WXModule.java │ │ ├── WXModuleAnno.java │ │ ├── WXPerformance.java │ │ ├── WXRefreshData.java │ │ ├── WXRenderStrategy.java │ │ ├── WXRequest.java │ │ ├── WXRequestListener.java │ │ ├── WXResponse.java │ │ ├── WXRuntimeException.java │ │ └── WXThread.java │ │ ├── dom │ │ ├── BasicEditTextDomObject.java │ │ ├── CSSAlignConvert.java │ │ ├── CSSFlexDirectionConvert.java │ │ ├── CSSJustifyConvert.java │ │ ├── CSSPositionTypeConvert.java │ │ ├── CSSWrapConvert.java │ │ ├── DomContext.java │ │ ├── ImmutableDomObject.java │ │ ├── SafePutConcurrentHashMap.java │ │ ├── TextAreaEditTextDomObject.java │ │ ├── WXAttr.java │ │ ├── WXCustomStyleSpan.java │ │ ├── WXDomHandler.java │ │ ├── WXDomManager.java │ │ ├── WXDomModule.java │ │ ├── WXDomObject.java │ │ ├── WXDomObjectFactory.java │ │ ├── WXDomRegistry.java │ │ ├── WXDomStatement.java │ │ ├── WXDomTask.java │ │ ├── WXEvent.java │ │ ├── WXImageQuality.java │ │ ├── WXLineHeightSpan.java │ │ ├── WXListDomObject.java │ │ ├── WXScrollerDomObject.java │ │ ├── WXStyle.java │ │ ├── WXSwitchDomObject.java │ │ ├── WXTextDomObject.java │ │ └── flex │ │ │ ├── CSSAlign.java │ │ │ ├── CSSConstants.java │ │ │ ├── CSSDirection.java │ │ │ ├── CSSFlexDirection.java │ │ │ ├── CSSJustify.java │ │ │ ├── CSSLayout.java │ │ │ ├── CSSLayoutContext.java │ │ │ ├── CSSNode.java │ │ │ ├── CSSPositionType.java │ │ │ ├── CSSStyle.java │ │ │ ├── CSSWrap.java │ │ │ ├── CachedCSSLayout.java │ │ │ ├── FloatUtil.java │ │ │ ├── LayoutEngine.java │ │ │ ├── MeasureOutput.java │ │ │ └── Spacing.java │ │ ├── http │ │ ├── Options.java │ │ ├── Status.java │ │ ├── WXHttpUtil.java │ │ └── WXStreamModule.java │ │ ├── ui │ │ ├── ComponentCreator.java │ │ ├── ExternalLoaderComponentHolder.java │ │ ├── IExternalComponentGetter.java │ │ ├── IFComponentHolder.java │ │ ├── IWXRenderTask.java │ │ ├── SimpleComponentHolder.java │ │ ├── WXComponentRegistry.java │ │ ├── WXRenderHandler.java │ │ ├── WXRenderManager.java │ │ ├── WXRenderStatement.java │ │ ├── animation │ │ │ ├── DimensionUpdateListener.java │ │ │ ├── WXAnimationBean.java │ │ │ └── WXAnimationModule.java │ │ ├── component │ │ │ ├── AbstractEditComponent.java │ │ │ ├── AppearanceHelper.java │ │ │ ├── NestedContainer.java │ │ │ ├── Scrollable.java │ │ │ ├── Textarea.java │ │ │ ├── WXA.java │ │ │ ├── WXBaseRefresh.java │ │ │ ├── WXBasicComponentType.java │ │ │ ├── WXComponent.java │ │ │ ├── WXComponentFactory.java │ │ │ ├── WXComponentProp.java │ │ │ ├── WXDiv.java │ │ │ ├── WXEmbed.java │ │ │ ├── WXHeader.java │ │ │ ├── WXImage.java │ │ │ ├── WXIndicator.java │ │ │ ├── WXInput.java │ │ │ ├── WXLoading.java │ │ │ ├── WXLoadingIndicator.java │ │ │ ├── WXRefresh.java │ │ │ ├── WXScroller.java │ │ │ ├── WXSlider.java │ │ │ ├── WXSliderNeighbor.java │ │ │ ├── WXSwitch.java │ │ │ ├── WXText.java │ │ │ ├── WXTextDecoration.java │ │ │ ├── WXVContainer.java │ │ │ ├── WXVideo.java │ │ │ ├── WXWeb.java │ │ │ ├── helper │ │ │ │ ├── WXStickyHelper.java │ │ │ │ └── WXTimeInputHelper.java │ │ │ ├── list │ │ │ │ ├── BasicListComponent.java │ │ │ │ ├── HorizontalListComponent.java │ │ │ │ ├── ListComponentView.java │ │ │ │ ├── SimpleListComponent.java │ │ │ │ ├── SimpleRecyclerView.java │ │ │ │ ├── WXCell.java │ │ │ │ └── WXListComponent.java │ │ │ └── pesudo │ │ │ │ ├── OnActivePseudoListner.java │ │ │ │ ├── PesudoStatus.java │ │ │ │ └── TouchActivePseudoListener.java │ │ ├── module │ │ │ ├── WXMetaModule.java │ │ │ ├── WXModalUIModule.java │ │ │ ├── WXTimerModule.java │ │ │ └── WXWebViewModule.java │ │ └── view │ │ │ ├── IRenderStatus.java │ │ │ ├── IWXScroller.java │ │ │ ├── IWXTextView.java │ │ │ ├── IWebView.java │ │ │ ├── WXBaseCircleIndicator.java │ │ │ ├── WXBaseRefreshLayout.java │ │ │ ├── WXCircleIndicator.java │ │ │ ├── WXCirclePageAdapter.java │ │ │ ├── WXCircleViewPager.java │ │ │ ├── WXEditText.java │ │ │ ├── WXFrameLayout.java │ │ │ ├── WXHorizontalScrollView.java │ │ │ ├── WXImageView.java │ │ │ ├── WXLoadingLayout.java │ │ │ ├── WXRefreshLayout.java │ │ │ ├── WXScrollView.java │ │ │ ├── WXSmoothScroller.java │ │ │ ├── WXSwitchView.java │ │ │ ├── WXTextView.java │ │ │ ├── WXVideoView.java │ │ │ ├── WXWebView.java │ │ │ ├── border │ │ │ ├── BorderCorner.java │ │ │ ├── BorderDrawable.java │ │ │ ├── BorderEdge.java │ │ │ ├── BorderStyle.java │ │ │ ├── BorderUtil.java │ │ │ ├── BottomLeftCorner.java │ │ │ ├── BottomRightCorner.java │ │ │ ├── TopLeftCorner.java │ │ │ └── TopRightCorner.java │ │ │ ├── gesture │ │ │ ├── WXGesture.java │ │ │ ├── WXGestureObservable.java │ │ │ └── WXGestureType.java │ │ │ ├── listview │ │ │ ├── WXRecyclerView.java │ │ │ └── adapter │ │ │ │ ├── IOnLoadMoreListener.java │ │ │ │ ├── IRecyclerAdapterListener.java │ │ │ │ ├── ListBaseViewHolder.java │ │ │ │ ├── RecyclerViewBaseAdapter.java │ │ │ │ ├── TransformItemDecoration.java │ │ │ │ └── WXRecyclerViewOnScrollListener.java │ │ │ └── refresh │ │ │ ├── circlebar │ │ │ ├── CircleProgressBar.java │ │ │ └── MaterialProgressDrawable.java │ │ │ ├── core │ │ │ ├── WXRefreshView.java │ │ │ └── WXSwipeLayout.java │ │ │ └── wrapper │ │ │ ├── BaseBounceView.java │ │ │ ├── BounceRecyclerView.java │ │ │ └── BounceScrollerView.java │ │ └── utils │ │ ├── ATagUtil.java │ │ ├── FontDO.java │ │ ├── FunctionParser.java │ │ ├── ImageDrawable.java │ │ ├── ImgURIUtil.java │ │ ├── LogLevel.java │ │ ├── SingleFunctionParser.java │ │ ├── TypefaceUtil.java │ │ ├── WXDataStructureUtil.java │ │ ├── WXDomUtils.java │ │ ├── WXFileUtils.java │ │ ├── WXHack.java │ │ ├── WXInterception.java │ │ ├── WXJsonUtils.java │ │ ├── WXLogUtils.java │ │ ├── WXReflectionUtils.java │ │ ├── WXResourceUtils.java │ │ ├── WXSoInstallMgrSdk.java │ │ ├── WXUtils.java │ │ ├── WXViewUtils.java │ │ └── batch │ │ ├── BactchExecutor.java │ │ ├── BatchOperationHelper.java │ │ └── Interceptor.java │ └── res │ ├── drawable │ └── error.png │ ├── layout │ └── item_load.xml │ └── values │ ├── colors.xml │ └── strings.xml ├── README.md ├── Weex.pptx ├── apk └── release-700000.apk ├── photo ├── app_pro.png ├── page1.jpg ├── page2.jpg └── weexfeed_pro.png └── weexfeed ├── README.md ├── dist ├── home │ ├── home-live.js │ └── view │ │ ├── banner-view.js │ │ ├── channel-item.js │ │ ├── home-live-page.js │ │ ├── page-ad.js │ │ └── page-item.js ├── me │ └── loading-button.js └── weexfeed.js ├── index.html ├── package.json ├── src ├── common │ ├── api.js │ └── base64.js ├── home │ ├── home-live.we │ ├── homeConstants.js │ └── view │ │ ├── banner-view.we │ │ ├── channel-item.we │ │ ├── home-live-page.we │ │ ├── page-ad.we │ │ └── page-item.we ├── me │ └── loading-button.we └── weexfeed.we └── webpack.config.js /MyApplication/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /MyApplication/.idea/.name: -------------------------------------------------------------------------------- 1 | MyApplication -------------------------------------------------------------------------------- /MyApplication/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /MyApplication/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /MyApplication/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MyApplication/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /MyApplication/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Class structureJava 12 | 13 | 14 | Code maturity issuesJava 15 | 16 | 17 | Java 18 | 19 | 20 | Java language level migration aidsJava 21 | 22 | 23 | Javadoc issuesJava 24 | 25 | 26 | Performance issuesJava 27 | 28 | 29 | TestNGJava 30 | 31 | 32 | Threading issuesJava 33 | 34 | 35 | 36 | 37 | Android 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 1.8 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /MyApplication/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MyApplication/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /MyApplication/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /MyApplication/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion parent.ext.compileSdkVersion 5 | buildToolsVersion parent.ext.buildToolsVersion 6 | 7 | defaultConfig { 8 | applicationId parent.ext.applicationId 9 | minSdkVersion parent.ext.minSdkVersion 10 | targetSdkVersion parent.ext.targetSdkVersion 11 | versionCode parent.ext.versionCode 12 | versionName parent.ext.versionName 13 | 14 | ndk { 15 | abiFilters "armeabi" 16 | } 17 | 18 | } 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | 26 | lintOptions { 27 | abortOnError false 28 | ignoreWarnings true 29 | } 30 | } 31 | 32 | repositories { 33 | flatDir { 34 | dirs 'libs' 35 | } 36 | } 37 | 38 | dependencies { 39 | compile fileTree(dir: 'libs', include: ['*.jar']) 40 | compile project(':weex_sdk') 41 | 42 | compile parent.ext.libRetrofit 43 | compile parent.ext.libRetrofitGsonConverter 44 | compile parent.ext.libOkHttp3LogInterceptor 45 | compile parent.ext.libIo 46 | 47 | compile parent.ext.libV7 48 | compile parent.ext.libDesign 49 | compile parent.ext.libRecyclerview 50 | compile parent.ext.libEventBus 51 | compile parent.ext.libCardView 52 | compile parent.ext.libGridLayout 53 | compile parent.ext.libGson 54 | compile parent.ext.libIo 55 | compile parent.ext.libRecyclerViewAnimator 56 | compile parent.ext.libGridLayout 57 | compile parent.ext.libProgress 58 | compile parent.ext.libFresco 59 | compile parent.ext.libFrescoOkHttp 60 | } 61 | -------------------------------------------------------------------------------- /MyApplication/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/alexwangweiqi/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | //Normal Permissions users cannnot revoke these permissions 6 | 7 | 8 | 9 | 10 | 11 | //Special Permissions must send an intent requesting user's authorization 12 | 13 | 14 | // 15 | 16 | //Dangerous Permissions needs to check whether our app has the permissions every time it runs 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | //bugly need 31 | 32 | // 悬浮窗 33 | 34 | 35 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/ContextUtil.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication; 2 | 3 | import android.content.Context; 4 | 5 | /** 6 | * ContextUtil,为Android程序提供全局Context对象,要在Application.onCreate中初始化。 7 | */ 8 | public class ContextUtil { 9 | private static Context context; 10 | 11 | public static void init(Context appContext) { 12 | context = appContext.getApplicationContext(); 13 | } 14 | 15 | public static Context getContext() { 16 | return context; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/WeexConstants.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication; 2 | 3 | /** 4 | * 常量配置 5 | * Created by alexwangweiqi on 16/11/14. 6 | */ 7 | public class WeexConstants { 8 | 9 | /** 10 | * js链接最大缓存时间 11 | */ 12 | public static final int JS_MAX_STALE_YEAR = 60 * 60 * 24 * 365; 13 | 14 | public static final String ENDPOINT_SNS_CDN_OFFICIAL = "official"; 15 | public static final String ENDPOINT_SNS_CDN_TEST = "test"; 16 | public static String ENDPOINT_SNS_CDN = ENDPOINT_SNS_CDN_TEST;//weex为线上环境 17 | 18 | public static final String HTTPS = "https"; 19 | public static final String HTTP = "http"; 20 | public static final String FILE = "file"; 21 | public static final String EMLIVE = "emlive"; 22 | 23 | public static final String BUNDLE_URL = "bundleUrl"; 24 | public static final String TITLE = "title"; 25 | public static final String JS_FILE_PATH = "jsFilePath"; 26 | public static final String CONTENT_HEIGHT = "contentHeight"; 27 | public static final String ENDPOINT_CDN = "endPointCdn"; 28 | public static final String PARAMS = "params"; 29 | 30 | // 页面自定义 params keys 31 | public static final String UID = "uid"; 32 | public static final String PID = "pid"; 33 | 34 | 35 | //hot refresh 36 | public static final int HOT_REFRESH_CONNECT = 0x111; 37 | public static final int HOT_REFRESH_DISCONNECT = 0x112; 38 | public static final int HOT_REFRESH_REFRESH = 0x113; 39 | public static final int HOT_REFRESH_CONNECT_ERROR = 0x114; 40 | 41 | //weex js file download 42 | public static final String PATH_DOWNLOADER_WEEX_JS = "/api/GetWeex"; 43 | 44 | public static class KEY { 45 | public static final String CODE = "code"; 46 | public static final String RESULT = "result"; 47 | public static final String DATA = "data"; 48 | public static final String INDEX = "index"; 49 | } 50 | 51 | public static class VALUE { 52 | public static final int FAILURE = 0x0; 53 | public static final int SUCCESS = 0x01; 54 | public static final int CANCEL = 0x02; 55 | } 56 | 57 | public static class KEY_PAY { 58 | public static final String IS_TEST = "is_test"; 59 | public static final String COIN_NUMBER = "coin_number"; 60 | public static final String CTOKEN = "ctoken"; 61 | public static final String UTOKEN = "utoken"; 62 | public static final String NETWORK = "network"; 63 | public static final String VERSION = "version"; 64 | public static final String DEVICE_ID = "device_id"; 65 | } 66 | 67 | public static class KEY_PAY_RESULT { 68 | public static final String RESULT = "result"; 69 | public static final String PAY_RESULT_STATUS = "payResultStatus"; 70 | public static final String ORDR_NO = "ordr_no"; 71 | 72 | public static final String CALL_BACK_CODE = "callBackCode"; 73 | } 74 | 75 | // params keys 76 | public static final String PLAT = "plat"; 77 | public static final String PRODUCT = "product"; 78 | public static final String DEVICE_ID = "device_id"; 79 | public static final String VERSION = "version"; 80 | public static final String UTOKEN = "utoken"; 81 | public static final String CTOKEN = "ctoken"; 82 | public static final String NETWORK = "network"; 83 | public static final String MODEL = "model"; 84 | public static final String OS_VERSION = "osversion"; 85 | public static final String IS_TEST = "is_test"; 86 | public static final String END_POINT_CDN = "endPointCdn"; 87 | } 88 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/ZhiboApplication.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | 6 | import com.facebook.drawee.backends.pipeline.Fresco; 7 | import com.facebook.imagepipeline.backends.okhttp3.OkHttpImagePipelineConfigFactory; 8 | import com.facebook.imagepipeline.core.ImagePipelineConfig; 9 | import com.facebook.imagepipeline.listener.RequestListener; 10 | import com.facebook.imagepipeline.listener.RequestLoggingListener; 11 | import com.test.www.myapplication.network.HttpConnector; 12 | 13 | import java.util.HashSet; 14 | import java.util.Set; 15 | 16 | 17 | /** 18 | * Application 19 | * Created by fengshzh on 4/22/16. 20 | */ 21 | public class ZhiboApplication extends Application { 22 | 23 | private static final String TAG = ZhiboApplication.class.getSimpleName(); 24 | 25 | @Override 26 | protected void attachBaseContext(Context base) { 27 | super.attachBaseContext(base); 28 | } 29 | 30 | @Override 31 | public void onCreate() { 32 | super.onCreate(); 33 | 34 | 35 | boolean debug = BuildConfig.DEBUG; 36 | 37 | ContextUtil.init(this.getApplicationContext()); 38 | HttpConnector.initNetworkConnector(this, debug); 39 | 40 | Set requestListeners = new HashSet<>(); 41 | requestListeners.add(new RequestLoggingListener()); 42 | ImagePipelineConfig config = 43 | OkHttpImagePipelineConfigFactory.newBuilder(this, HttpConnector.getHttpClient()) 44 | .setDownsampleEnabled(true) 45 | .setRequestListeners(requestListeners) 46 | .build(); 47 | Fresco.initialize(this, config); 48 | 49 | // WeexConfigManager.initSdk(debug, this); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/adapter/PlayDebugAdapter.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.adapter; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | 8 | import com.taobao.weex.IWXActivityStateListener; 9 | import com.taobao.weex.WXSDKInstance; 10 | import com.taobao.weex.WXSDKManager; 11 | import com.taobao.weex.adapter.IWXDebugAdapter; 12 | import com.taobao.weex.utils.WXLogUtils; 13 | 14 | import java.lang.reflect.Constructor; 15 | import java.lang.reflect.Method; 16 | import java.util.HashMap; 17 | import java.util.Map; 18 | 19 | /** 20 | * Created by lixinke on 16/6/15. 21 | */ 22 | public class PlayDebugAdapter implements IWXDebugAdapter { 23 | 24 | public static final String SHOW_3D_LAYER = "show_3d_layer"; 25 | private Map options; 26 | 27 | 28 | @Override 29 | public void initDebug(final Application application) { 30 | WXSDKManager.getInstance().postOnUiThread(new Runnable() { 31 | @Override 32 | public void run() { 33 | try { 34 | Class cls = Class.forName("com.taobao.weex.WXPrettyFish"); 35 | Method m = cls.getMethod("init", new Class[]{Application.class}); 36 | m.invoke(cls, new Object[]{application}); 37 | } catch (Exception e) { 38 | WXLogUtils.d("weex", "WXPrettyFish not found!"); 39 | } 40 | putDebugOptions(SHOW_3D_LAYER, "true"); 41 | } 42 | }, 0); 43 | } 44 | 45 | @Override 46 | public View wrapContainer(WXSDKInstance instance, View wxView) { 47 | try { 48 | Class scalpelClas = Class.forName("com.taobao.weex.scalpel.ScalpelFrameLayout"); 49 | Constructor constructor = scalpelClas.getConstructor(new Class[]{Context.class}); 50 | ViewGroup container = (ViewGroup) constructor.newInstance(wxView.getContext()); 51 | if (container != null) { 52 | container.addView(wxView); 53 | Class cls = Class.forName("com.taobao.weex.WXDebugTool"); 54 | Method m = cls.getMethod("updateScapleView", new Class[]{Object.class}); 55 | m.invoke(null, new Object[]{container}); 56 | instance.registerActivityStateListener(new DebugActivityState(wxView)); 57 | return container; 58 | } 59 | } catch (Exception e) { 60 | } 61 | 62 | return wxView; 63 | } 64 | 65 | @Override 66 | public void putDebugOptions(String key, String value) { 67 | if (options == null) { 68 | options = new HashMap<>(); 69 | } 70 | options.put(key, value); 71 | } 72 | @Override 73 | public String getDebugOptions(String key) { 74 | if (options != null) { 75 | return options.get(key); 76 | } 77 | return null; 78 | } 79 | 80 | static class DebugActivityState implements IWXActivityStateListener { 81 | 82 | private View mWXView; 83 | 84 | public DebugActivityState(View wxView) { 85 | mWXView = wxView; 86 | } 87 | 88 | @Override 89 | public void onActivityCreate() { 90 | 91 | } 92 | 93 | @Override 94 | public void onActivityStart() { 95 | 96 | } 97 | 98 | @Override 99 | public void onActivityPause() { 100 | try { 101 | Class cls = Class.forName("com.taobao.weex.WXDebugTool"); 102 | Method m = cls.getMethod("updateScapleView", new Class[]{Object.class}); 103 | m.invoke(null, new Object[]{}); 104 | } catch (Exception e){ 105 | } 106 | } 107 | 108 | @Override 109 | public void onActivityResume() { 110 | if (mWXView != null && mWXView.getParent()!=null && mWXView.getParent().getClass().getName().equals("com.taobao.weex.scalpel.ScalpelFrameLayout")) { 111 | try { 112 | Class cls = Class.forName("com.taobao.weex.WXDebugTool"); 113 | Method m = cls.getMethod("updateScapleView", new Class[]{Object.class}); 114 | m.invoke(null, new Object[]{mWXView.getParent()}); 115 | } catch (Exception e) { 116 | e.printStackTrace(); 117 | } 118 | } 119 | } 120 | 121 | @Override 122 | public void onActivityStop() { 123 | 124 | } 125 | 126 | @Override 127 | public void onActivityDestroy() { 128 | 129 | } 130 | 131 | @Override 132 | public boolean onActivityBack() { 133 | return false; 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/adapter/WXOkHttpAdapter.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.adapter; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | import com.taobao.weex.adapter.IWXHttpAdapter; 6 | import com.taobao.weex.common.WXRequest; 7 | import com.taobao.weex.common.WXResponse; 8 | import com.test.www.myapplication.network.HttpConnector; 9 | 10 | import java.io.IOException; 11 | 12 | import okhttp3.Call; 13 | import okhttp3.Callback; 14 | import okhttp3.MediaType; 15 | import okhttp3.Request; 16 | import okhttp3.RequestBody; 17 | import okhttp3.Response; 18 | 19 | /** 20 | * weex 网络接口处理 21 | * Created by alexwangweiqi on 16/12/21. 22 | */ 23 | public class WXOkHttpAdapter implements IWXHttpAdapter { 24 | 25 | private static final String METHOD_GET = "GET"; 26 | private static final String METHOD_POST = "POST"; 27 | 28 | private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8"); 29 | 30 | public static final int REQUEST_FAILURE = -100; 31 | 32 | @Override 33 | public void sendRequest(@NonNull final WXRequest request, final OnHttpListener listener) { 34 | if (listener != null) { 35 | listener.onHttpStart(); 36 | } 37 | 38 | if (METHOD_GET.equalsIgnoreCase(request.method)) { 39 | Request.Builder builder = new Request.Builder().url(request.url); 40 | Request okHttpRequest = builder.build(); 41 | HttpConnector.getHttpClient().newCall(okHttpRequest).enqueue(new Callback() { 42 | @Override 43 | public void onFailure(Call call, IOException e) { 44 | if (listener != null) { 45 | WXResponse wxResponse = new WXResponse(); 46 | wxResponse.errorCode = String.valueOf(REQUEST_FAILURE); 47 | wxResponse.statusCode = String.valueOf(REQUEST_FAILURE); 48 | wxResponse.errorMsg = e.getMessage(); 49 | 50 | listener.onHttpFinish(wxResponse); 51 | } 52 | } 53 | 54 | @Override 55 | public void onResponse(Call call, Response response) throws IOException { 56 | if (listener != null) { 57 | 58 | WXResponse wxResponse = new WXResponse(); 59 | wxResponse.statusCode = String.valueOf(response.code()); 60 | if (requestSuccess(Integer.parseInt(wxResponse.statusCode))) { 61 | wxResponse.originalData = response.body() != null ? response.body() 62 | .bytes() : null; 63 | } else { 64 | wxResponse.errorCode = String.valueOf(response.code()); 65 | wxResponse.errorMsg = response.body() != null ? response.body() 66 | .string() : null; 67 | } 68 | 69 | listener.onHttpFinish(wxResponse); 70 | } 71 | } 72 | }); 73 | } else if (METHOD_POST.equalsIgnoreCase(request.method)) { 74 | Request okHttpRequest = new Request.Builder() 75 | .url(request.url) 76 | .post(RequestBody.create(JSON, request.body)) 77 | .build(); 78 | 79 | HttpConnector.getHttpClient().newCall(okHttpRequest).enqueue(new Callback() { 80 | @Override 81 | public void onFailure(Call call, IOException e) { 82 | if (listener != null) { 83 | WXResponse wxResponse = new WXResponse(); 84 | wxResponse.errorCode = String.valueOf(REQUEST_FAILURE); 85 | wxResponse.statusCode = String.valueOf(REQUEST_FAILURE); 86 | wxResponse.errorMsg = e.getMessage(); 87 | 88 | listener.onHttpFinish(wxResponse); 89 | } 90 | } 91 | 92 | @Override 93 | public void onResponse(Call call, Response response) throws IOException { 94 | if (listener != null) { 95 | 96 | WXResponse wxResponse = new WXResponse(); 97 | wxResponse.statusCode = String.valueOf(response.code()); 98 | if (requestSuccess(Integer.parseInt(wxResponse.statusCode))) { 99 | wxResponse.originalData = response.body() != null ? response.body() 100 | .bytes() : null; 101 | } else { 102 | wxResponse.errorCode = String.valueOf(response.code()); 103 | wxResponse.errorMsg = response.body() != null ? response.body() 104 | .string() : null; 105 | } 106 | 107 | listener.onHttpFinish(wxResponse); 108 | } 109 | } 110 | }); 111 | } 112 | } 113 | 114 | private boolean requestSuccess(int statusCode) { 115 | return statusCode >= 200 && statusCode <= 299; 116 | } 117 | } -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/component/RichTextview.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.component; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | import android.text.SpannableString; 6 | import android.text.Spanned; 7 | import android.text.method.LinkMovementMethod; 8 | import android.text.style.URLSpan; 9 | import android.widget.TextView; 10 | 11 | import com.taobao.weex.WXSDKInstance; 12 | import com.taobao.weex.dom.WXDomObject; 13 | import com.taobao.weex.ui.component.WXComponent; 14 | import com.taobao.weex.ui.component.WXComponentProp; 15 | import com.taobao.weex.ui.component.WXVContainer; 16 | 17 | /** 18 | * 自定义 富文本 19 | * Created by alexwangweiqi on 16/11/15. 20 | */ 21 | public class RichTextview extends WXComponent { 22 | 23 | public RichTextview(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, boolean isLazy) { 24 | super(instance, dom, parent, isLazy); 25 | } 26 | 27 | @Override 28 | protected TextView initComponentHostView(@NonNull Context context) { 29 | TextView view = new TextView(context); 30 | 31 | view.setMovementMethod(LinkMovementMethod.getInstance()); 32 | return view; 33 | } 34 | 35 | @WXComponentProp(name = "tel") 36 | public void setTelLink(String tel){ 37 | SpannableString spannable=new SpannableString(tel); 38 | spannable.setSpan(new URLSpan("tel:"+tel),0,tel.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); 39 | ((TextView)getHostView()).setText(spannable); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/component/WXNewSlider.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.component; 2 | 3 | import com.taobao.weex.WXSDKInstance; 4 | import com.taobao.weex.dom.WXDomObject; 5 | import com.taobao.weex.ui.component.WXSlider; 6 | import com.taobao.weex.ui.component.WXVContainer; 7 | 8 | /** 9 | * Created by alexwangweiqi on 16/12/7. 10 | */ 11 | public class WXNewSlider extends WXSlider { 12 | 13 | @Deprecated 14 | public WXNewSlider(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String instanceId) { 15 | this(instance, dom, parent); 16 | } 17 | 18 | public WXNewSlider(WXSDKInstance instance, WXDomObject node, WXVContainer parent) { 19 | super(instance, node, parent); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/component/view/WXSwipeRefreshView.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.component.view; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | import android.support.v4.widget.SwipeRefreshLayout; 6 | import android.view.ViewGroup; 7 | import android.widget.ScrollView; 8 | 9 | import com.taobao.weex.WXSDKInstance; 10 | import com.taobao.weex.common.Constants; 11 | import com.taobao.weex.dom.WXDomObject; 12 | import com.taobao.weex.ui.component.WXComponentProp; 13 | import com.taobao.weex.ui.component.WXVContainer; 14 | import com.test.www.myapplication.R; 15 | import com.test.www.myapplication.event.WXRefreshEvent; 16 | 17 | import de.greenrobot.event.EventBus; 18 | 19 | 20 | /** 21 | * Created by cxy on 2016/12/16. 22 | */ 23 | public class WXSwipeRefreshView extends WXVContainer { 24 | 25 | private SwipeRefreshLayout mSwipeRefreshLayout; 26 | private ScrollView mScrollView; 27 | 28 | private String eventName; 29 | 30 | 31 | public WXSwipeRefreshView(WXSDKInstance instance, WXDomObject node, WXVContainer parent, boolean lazy) { 32 | super(instance, node, parent, lazy); 33 | } 34 | 35 | @Override 36 | protected SwipeRefreshLayout initComponentHostView(@NonNull Context context) { 37 | mSwipeRefreshLayout = new SwipeRefreshLayout(context); 38 | mSwipeRefreshLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 39 | ViewGroup.LayoutParams.MATCH_PARENT)); 40 | mSwipeRefreshLayout.setColorSchemeResources(R.color.colorAccent); 41 | mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { 42 | @Override 43 | public void onRefresh() { 44 | EventBus.getDefault().post(new WXRefreshEvent() 45 | .type(WXRefreshEvent.TYPE.PAY_REFRESH) 46 | .success() 47 | .data(eventName)); 48 | } 49 | }); 50 | 51 | // mScrollView = new ScrollView(context); 52 | // mScrollView .setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 53 | // ViewGroup.LayoutParams.MATCH_PARENT)); 54 | // 55 | // mSwipeRefreshLayout.addView(mScrollView); 56 | 57 | return mSwipeRefreshLayout; 58 | } 59 | 60 | @WXComponentProp(name = Constants.Name.COLOR) 61 | public void setColor(String color) { 62 | 63 | switch (color) { 64 | case "blue": 65 | mSwipeRefreshLayout.setColorSchemeResources(R.color.colorAccent); 66 | break; 67 | case "black": 68 | mSwipeRefreshLayout.setColorSchemeResources(R.color.black); 69 | default: 70 | if (color.contains("#")) { 71 | String colorStr = color.substring(color.indexOf("#")); 72 | int colorHex; 73 | try { 74 | colorHex = Integer.parseInt(colorStr, 16); 75 | mSwipeRefreshLayout.setColorSchemeColors(colorHex); 76 | } catch (NumberFormatException e) { 77 | e.printStackTrace(); 78 | } 79 | } 80 | } 81 | } 82 | 83 | @WXComponentProp(name = "eventname") 84 | public void setEventName(String name) { 85 | eventName = name; 86 | } 87 | 88 | @WXComponentProp(name = "refreshing") 89 | public void setRefreshing(String isRefreshing) { 90 | // LogUtil.d("WXSwipe", "refreshing " + isRefreshing); 91 | switch (isRefreshing){ 92 | case "true": 93 | mSwipeRefreshLayout.setRefreshing(true); 94 | break; 95 | case "false": 96 | mSwipeRefreshLayout.setRefreshing(false); 97 | break; 98 | default: 99 | mSwipeRefreshLayout.setRefreshing(false); 100 | } 101 | 102 | } 103 | 104 | 105 | } 106 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/event/WXRefreshEvent.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.event; 2 | 3 | 4 | import com.test.www.myapplication.network.BaseNetworkEvent; 5 | 6 | /** 7 | * Created by cxy on 2016/12/16. 8 | */ 9 | public class WXRefreshEvent extends BaseNetworkEvent { 10 | 11 | public static class TYPE { 12 | public static final int PAY_REFRESH = 0; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/manager/WeexConfigManager.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.manager; 2 | 3 | import android.app.Application; 4 | 5 | import com.taobao.weex.InitConfig; 6 | import com.taobao.weex.WXSDKEngine; 7 | import com.taobao.weex.common.WXException; 8 | import com.test.www.myapplication.adapter.FrescoImageAdapter; 9 | import com.test.www.myapplication.adapter.PlayDebugAdapter; 10 | import com.test.www.myapplication.adapter.WXOkHttpAdapter; 11 | import com.test.www.myapplication.component.WXNewSlider; 12 | import com.test.www.myapplication.component.view.WXSwipeRefreshView; 13 | import com.test.www.myapplication.module.impl.WXEventModule; 14 | 15 | /** 16 | * weex 管理类 17 | * Created by alexwangweiqi on 16/11/28. 18 | */ 19 | public class WeexConfigManager { 20 | 21 | 22 | public static void initSdk(boolean debug, Application context) { 23 | InitConfig weexConfig = new InitConfig.Builder() 24 | .setHttpAdapter(new WXOkHttpAdapter()) 25 | .setImgAdapter(new FrescoImageAdapter()) 26 | .setDebugAdapter(new PlayDebugAdapter()) 27 | .build(); 28 | WXSDKEngine.initialize(debug, context, weexConfig); 29 | try { 30 | WXSDKEngine.registerModule("event", WXEventModule.class); 31 | // WXSDKEngine.registerModule("payModule", WXPayModule.class); 32 | // WXSDKEngine.registerModule("utilModule", WXUtilModule.class); 33 | // WXSDKEngine.registerComponent("image", FrescoImageComponent.class); 34 | // WXSDKEngine.registerComponent("clickview", ClickView.class); 35 | WXSDKEngine.registerComponent("slider", WXNewSlider.class); 36 | // WXSDKEngine.registerComponent("loadingbutton", WXLoadingButton.class); 37 | // WXSDKEngine.registerComponent("progresswheel", WXProgressWheel.class); 38 | WXSDKEngine.registerComponent("swiperefresh", WXSwipeRefreshView.class); 39 | } catch (WXException e) { 40 | e.printStackTrace(); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/module/IWXEventModule.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.module; 2 | 3 | import com.taobao.weex.bridge.JSCallback; 4 | 5 | /** 6 | * Created by alexwangweiqi on 16/11/15. 7 | */ 8 | public interface IWXEventModule { 9 | 10 | /** 11 | * 打开具体页面 12 | * 规则如下: 13 | * 1、使用emlive: 打开本地页面 14 | * 2、使用file:XXX 加载本地页面 15 | * @param url 16 | */ 17 | void openSpecifiedPage(String url); 18 | 19 | void openSpecifiedPage(String url, JSCallback callback); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/module/impl/WXEventModule.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.module.impl; 2 | 3 | import android.content.Intent; 4 | import android.text.TextUtils; 5 | 6 | import com.taobao.weex.annotation.JSMethod; 7 | import com.taobao.weex.bridge.JSCallback; 8 | import com.taobao.weex.common.WXModule; 9 | import com.test.www.myapplication.WeexConstants; 10 | import com.test.www.myapplication.module.IWXEventModule; 11 | import com.test.www.myapplication.view.PageActivity; 12 | 13 | import java.util.HashMap; 14 | import java.util.Map; 15 | 16 | 17 | /** 18 | * 交互接口类 19 | */ 20 | public class WXEventModule extends WXModule implements IWXEventModule { 21 | 22 | private static final String TAG = WXEventModule.class.getSimpleName(); 23 | private static final String WEEX_CATEGORY = "com.eastmoney.android.intent.category.WEEXFEED"; 24 | 25 | boolean isPhotoCrop; 26 | 27 | @JSMethod(uiThread = true) 28 | public void openSpecifiedPage(String url) { 29 | // LogUtil.d(TAG, "openSpecifiedPage url:" + url); 30 | openSpecifiedPage(url, null); 31 | } 32 | 33 | @JSMethod(uiThread = true) 34 | public void openSpecifiedPage(String url, JSCallback callback) { 35 | // LogUtil.d(TAG, "openSpecifiedPage callback url:" + url); 36 | int returnCode = WeexConstants.VALUE.FAILURE; 37 | if (!TextUtils.isEmpty(url)) { 38 | mWXSDKInstance.getContext().startActivity(new Intent(mWXSDKInstance.getContext(), 39 | PageActivity.class)); 40 | } 41 | callJsBack(callback, returnCode); 42 | } 43 | 44 | 45 | private void callJsBack(JSCallback callback, int code) { 46 | if (callback != null) { 47 | Map resp = new HashMap(); 48 | resp.put(WeexConstants.KEY.CODE, code); 49 | callback.invoke(resp); 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/network/BaseNetworkEvent.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.network; 2 | 3 | /** 4 | * EventBus的基本事件定义,其他业务事件都继承该类进行拓展 5 | * 6 | * Created by fengshzh on 15/7/29. 7 | */ 8 | public class BaseNetworkEvent { 9 | 10 | // Socket请求和类Socket请求的三种结果状态:成功、异常和网络错误 11 | public static final int NETWORK_SUCCESS = 0; 12 | public static final int NETWORK_DATA_EXCEPTION = -1; 13 | public static final int NETWORK_ERROR = -2; 14 | public int status = NETWORK_ERROR; 15 | 16 | 17 | public int requestId; // 请求Id,全局唯一 18 | public int type; // 请求类型,见EventType 19 | 20 | public boolean success = false; // Http请求的两种结果状态:成功、失败,默认失败 21 | private boolean isCache = false; // 是否缓存数据 22 | public int code; // 网络请求返回码,对应网络请求里rc,网络请求不成功返回-1 23 | public String msg; // 返回消息,对应网络请求里me 24 | public Object data; // 返回数据 25 | public Object ext; // 扩展字段,若有多个扩展字段使用数组或者list 26 | 27 | public BaseNetworkEvent id(int id) { 28 | requestId = id; 29 | return this; 30 | } 31 | 32 | public BaseNetworkEvent type(int type) { 33 | this.type = type; 34 | return this; 35 | } 36 | 37 | public BaseNetworkEvent success() { 38 | success = true; 39 | return this; 40 | } 41 | 42 | public BaseNetworkEvent code(int code) { 43 | this.code = code; 44 | return this; 45 | } 46 | 47 | public BaseNetworkEvent msg(String msg) { 48 | this.msg = msg; 49 | return this; 50 | } 51 | 52 | public BaseNetworkEvent data(Object data) { 53 | this.data = data; 54 | return this; 55 | } 56 | 57 | public BaseNetworkEvent ext(Object ext) { 58 | this.ext = ext; 59 | return this; 60 | } 61 | 62 | public BaseNetworkEvent setCache(boolean isCache) { 63 | this.isCache = isCache; 64 | return this; 65 | } 66 | 67 | public boolean isCache() { 68 | return isCache; 69 | } 70 | 71 | @Override 72 | public String toString() { 73 | return success + ", " + requestId + ", " + type + ", " + code + ", " + msg + ", " + data + ", " + ext; 74 | } 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/network/HttpConnector.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.network; 2 | 3 | import android.content.Context; 4 | 5 | import com.test.www.myapplication.ContextUtil; 6 | import com.test.www.myapplication.network.retrofit.ByteArrayConverterFactory; 7 | import com.test.www.myapplication.network.retrofit.StringConverterFactory; 8 | 9 | import okhttp3.Cache; 10 | import okhttp3.OkHttpClient; 11 | import retrofit2.Retrofit; 12 | import retrofit2.converter.gson.GsonConverterFactory; 13 | 14 | 15 | /** 16 | * HTTP网络连接器,初始化Context和创建网络栈 17 | * 18 | * Created by fengshzh on 15/7/29. 19 | */ 20 | public class HttpConnector { 21 | 22 | private static boolean sDebug; 23 | 24 | public static void initNetworkConnector(Context context, boolean debug) { 25 | // init FiDu, FiDu与Retrofit共用同一个OkHttp线程池 26 | sDebug = debug; 27 | } 28 | 29 | // 静态内部类实现单例 30 | public static class InstanceHolder { 31 | 32 | 33 | 34 | private static final OkHttpClient httpClient = new OkHttpClient.Builder() 35 | .cache(new Cache(ContextUtil.getContext().getCacheDir(), 10 * 1024 * 1024)) 36 | .build(); 37 | 38 | public static final Retrofit retrofit = new Retrofit.Builder() 39 | .baseUrl("http://eastmoney.com") 40 | .addConverterFactory(new StringConverterFactory()) 41 | .addConverterFactory(new ByteArrayConverterFactory()) 42 | .addConverterFactory(GsonConverterFactory.create()) 43 | .client(httpClient) 44 | .build(); 45 | 46 | } 47 | 48 | /** 49 | * 获取网络库使用的OkHttpClient 50 | */ 51 | public static OkHttpClient getHttpClient() { 52 | return InstanceHolder.httpClient; 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/network/retrofit/ByteArrayConverterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Square, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.test.www.myapplication.network.retrofit; 17 | 18 | import java.io.IOException; 19 | import java.lang.annotation.Annotation; 20 | import java.lang.reflect.Type; 21 | 22 | import okhttp3.MediaType; 23 | import okhttp3.RequestBody; 24 | import okhttp3.ResponseBody; 25 | import retrofit2.Converter; 26 | import retrofit2.Retrofit; 27 | 28 | /** 29 | * Response body为byte[]时用 30 | */ 31 | public class ByteArrayConverterFactory extends Converter.Factory { 32 | static final MediaType MEDIA_TYPE = MediaType.parse("text/plain"); 33 | 34 | @Override 35 | public Converter responseBodyConverter(Type type, Annotation[] annotations, 36 | Retrofit retrofit) { 37 | if ("byte[]".equals(type.toString())) { 38 | return new Converter() { 39 | @Override 40 | public byte[] convert(ResponseBody value) throws IOException { 41 | return value.source().readByteArray(); 42 | } 43 | }; 44 | } 45 | return null; 46 | } 47 | 48 | @Override 49 | public Converter, RequestBody> requestBodyConverter(Type type, 50 | Annotation[] parameterAnnotations, 51 | Annotation[] methodAnnotations, 52 | Retrofit retrofit) { 53 | if ("byte[]".equals(type.toString())) { 54 | return new Converter() { 55 | @Override 56 | public RequestBody convert(byte[] value) throws IOException { 57 | return RequestBody.create(MEDIA_TYPE, value); 58 | } 59 | }; 60 | } 61 | return null; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/network/retrofit/StringConverterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Square, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.test.www.myapplication.network.retrofit; 17 | 18 | import java.io.IOException; 19 | import java.lang.annotation.Annotation; 20 | import java.lang.reflect.Type; 21 | 22 | import okhttp3.MediaType; 23 | import okhttp3.RequestBody; 24 | import okhttp3.ResponseBody; 25 | import retrofit2.Converter; 26 | import retrofit2.Retrofit; 27 | 28 | /** 29 | * POST Body为raw string时用 30 | */ 31 | public class StringConverterFactory extends Converter.Factory { 32 | static final MediaType MEDIA_TYPE = MediaType.parse("text/plain"); 33 | 34 | @Override 35 | public Converter responseBodyConverter(Type type, Annotation[] annotations, 36 | Retrofit retrofit) { 37 | if (String.class.equals(type)) { 38 | return new Converter() { 39 | @Override 40 | public String convert(ResponseBody value) throws IOException { 41 | return value.string(); 42 | } 43 | }; 44 | } 45 | return null; 46 | } 47 | 48 | @Override 49 | public Converter, RequestBody> requestBodyConverter(Type type, 50 | Annotation[] parameterAnnotations, 51 | Annotation[] methodAnnotations, 52 | Retrofit retrofit) { 53 | if (String.class.equals(type)) { 54 | return new Converter() { 55 | @Override 56 | public RequestBody convert(String value) throws IOException { 57 | return RequestBody.create(MEDIA_TYPE, value); 58 | } 59 | }; 60 | } 61 | return null; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/util/WeexFileUtil.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.util; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | import android.text.TextUtils; 6 | 7 | import java.io.BufferedReader; 8 | import java.io.File; 9 | import java.io.FileReader; 10 | import java.io.IOException; 11 | import java.io.InputStream; 12 | import java.io.InputStreamReader; 13 | 14 | /** 15 | * 文件处理 16 | * Created by alexwangweiqi on 16/11/29. 17 | */ 18 | public class WeexFileUtil { 19 | private static final String TAG = WeexFileUtil.class.getSimpleName(); 20 | 21 | public static String loadWeexJs(String path, Context context) { 22 | if (TextUtils.isEmpty(path) || context == null) { 23 | return null; 24 | } 25 | if (path.startsWith("assets/dist/")) { 26 | return loadAsset(path, context); 27 | } else { 28 | return loadSdCard(path); 29 | } 30 | } 31 | 32 | /** 33 | * 读取sd卡文件 34 | * 35 | * @param filePath 36 | * @return 37 | */ 38 | private static String loadSdCard(String filePath) { 39 | // LogUtil.d(TAG, "loadSdCard:" + filePath); 40 | 41 | StringBuilder builder; 42 | BufferedReader bufferedReader = null; 43 | 44 | try { 45 | builder = new StringBuilder(); 46 | 47 | File file = new File(filePath); 48 | bufferedReader = new BufferedReader(new FileReader(file)); 49 | char[] data = new char[2048]; 50 | int len = -1; 51 | while ((len = bufferedReader.read(data)) > 0) { 52 | builder.append(data, 0, len); 53 | } 54 | return builder.toString(); 55 | } catch (IOException e) { 56 | e.printStackTrace(); 57 | } finally { 58 | try { 59 | if (bufferedReader != null) { 60 | bufferedReader.close(); 61 | } 62 | } catch (IOException e) { 63 | e.printStackTrace(); 64 | } 65 | } 66 | 67 | return ""; 68 | } 69 | 70 | /** 71 | * 读取assets文件 72 | * 73 | * @param filePath 74 | * @param context 75 | * @return 76 | */ 77 | private static String loadAsset(String filePath, Context context) { 78 | // LogUtil.d(TAG, "loadAsset:" + filePath); 79 | 80 | StringBuilder builder; 81 | InputStream in = null; 82 | BufferedReader bufferedReader = null; 83 | try { 84 | in = context.getClassLoader().getResourceAsStream(filePath); 85 | builder = new StringBuilder(in.available() + 10); 86 | 87 | bufferedReader = new BufferedReader(new InputStreamReader(in, "UTF-8")); 88 | char[] data = new char[2048]; 89 | int len = -1; 90 | while ((len = bufferedReader.read(data)) > 0) { 91 | builder.append(data, 0, len); 92 | } 93 | return builder.toString(); 94 | } catch (IOException e) { 95 | e.printStackTrace(); 96 | } finally { 97 | try { 98 | if (bufferedReader != null) { 99 | bufferedReader.close(); 100 | } 101 | if (in != null) { 102 | in.close(); 103 | } 104 | } catch (IOException e) { 105 | e.printStackTrace(); 106 | } 107 | } 108 | return ""; 109 | } 110 | 111 | public static void deleteFile(File file) { 112 | if (file.isFile()) { 113 | file.delete(); 114 | return; 115 | } 116 | if (file.isDirectory()) { 117 | File[] childFile = file.listFiles(); 118 | if (childFile == null || childFile.length == 0) { 119 | file.delete(); 120 | return; 121 | } 122 | for (File f : childFile) { 123 | deleteFile(f); 124 | } 125 | file.delete(); 126 | } 127 | } 128 | 129 | /** 130 | * 判断文件或目录是否存在. 131 | * 132 | * @param filePath 路径 133 | * @return true - 存在,false - 不存在 134 | */ 135 | public static boolean isExist(@NonNull String filePath) { 136 | if (filePath.startsWith("assets/dist/")) { 137 | return true; 138 | } else { 139 | File file = new File(filePath); 140 | return file.exists(); 141 | } 142 | } 143 | 144 | /** 145 | * 判断地址是否为assets 146 | * 147 | * @param filePath 路径 148 | */ 149 | public static boolean isAssets(@NonNull String filePath) { 150 | if (filePath != null && filePath.startsWith("assets")) { 151 | return true; 152 | } else { 153 | return false; 154 | } 155 | } 156 | 157 | /** 158 | * 判断地址是否为http https 159 | * 160 | * @param filePath 路径 161 | */ 162 | public static boolean isHttp(@NonNull String filePath) { 163 | if (filePath != null && (filePath.startsWith("https") || filePath.startsWith("http"))) { 164 | return true; 165 | } else { 166 | return false; 167 | } 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/view/FirstActivity.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.view; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.View; 7 | import android.widget.Button; 8 | 9 | import com.test.www.myapplication.R; 10 | import com.test.www.myapplication.manager.WeexConfigManager; 11 | 12 | public class FirstActivity extends AppCompatActivity { 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_first); 18 | ((Button) findViewById(R.id.btn_next)).setOnClickListener(new View.OnClickListener() { 19 | @Override 20 | public void onClick(View v) { 21 | WeexConfigManager.initSdk(true, FirstActivity.this.getApplication()); 22 | FirstActivity.this.startActivity(new Intent(FirstActivity.this, MainActivity 23 | .class)); 24 | } 25 | }); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/view/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.view; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | import android.widget.FrameLayout; 7 | import android.widget.ProgressBar; 8 | 9 | import com.taobao.weex.WXSDKInstance; 10 | import com.test.www.myapplication.R; 11 | import com.test.www.myapplication.view.base.WXBaseActivity; 12 | 13 | public class MainActivity extends WXBaseActivity { 14 | 15 | private static final String TAG = MainActivity.class.getSimpleName(); 16 | private static final String JS_PATH = "assets/dist/home/home-live.js"; 17 | 18 | private FrameLayout mContainer; 19 | private ProgressBar mProgressBar; 20 | private View mWAView; 21 | 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.activity_main); 27 | findView(); 28 | } 29 | 30 | @Override 31 | protected String getPageName() { 32 | return TAG; 33 | } 34 | 35 | @Override 36 | protected String getAssembleFilePath() { 37 | return JS_PATH; 38 | } 39 | 40 | @Override 41 | protected void refreshWithJsFile(String filePath) { 42 | 43 | } 44 | 45 | @Override 46 | protected ViewGroup getContainerLayout() { 47 | return mContainer; 48 | } 49 | 50 | @Override 51 | public void onViewCreated(WXSDKInstance instance, View view) { 52 | // LogUtil.i(TAG, "weex onViewCreated"); 53 | if (mWAView != null && mContainer != null && mWAView.getParent() == mContainer) { 54 | mContainer.removeView(mWAView); 55 | } 56 | 57 | if (mContainer != null) { 58 | mWAView = view; 59 | mContainer.removeAllViews(); 60 | mContainer.addView(view); 61 | mContainer.requestLayout(); 62 | // LogUtil.i(TAG, "weex renderSuccess"); 63 | } 64 | } 65 | 66 | @Override 67 | public void onRenderSuccess(WXSDKInstance instance, int width, int height) { 68 | mProgressBar.setVisibility(View.INVISIBLE); 69 | } 70 | 71 | @Override 72 | public void onRefreshSuccess(WXSDKInstance instance, int width, int height) { 73 | mProgressBar.setVisibility(View.GONE); 74 | } 75 | 76 | @Override 77 | public void onException(WXSDKInstance instance, String errCode, 78 | String msg) { 79 | super.onException(instance, errCode, msg); 80 | mProgressBar.setVisibility(View.GONE); 81 | } 82 | 83 | // @Override 84 | // protected Map getPageParams() { 85 | // Map params = new HashMap<>(); 86 | // params.put(WeexConstants.KEY.INDEX, 0); 87 | // 88 | // return params; 89 | // } 90 | 91 | public void findView() { 92 | mContainer = (FrameLayout) findViewById(R.id.container); 93 | mProgressBar = (ProgressBar) findViewById(R.id.progress); 94 | 95 | setView(); 96 | } 97 | 98 | private void setView() { 99 | setViewGlobalLayoutListener(mContainer); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/java/com/test/www/myapplication/view/PageActivity.java: -------------------------------------------------------------------------------- 1 | package com.test.www.myapplication.view; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | 6 | import com.test.www.myapplication.R; 7 | 8 | public class PageActivity extends AppCompatActivity { 9 | 10 | @Override 11 | protected void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | setContentView(R.layout.activity_page); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/activity_first.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 18 | 19 | 27 | 28 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 15 | 16 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/layout/activity_page.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 17 | 18 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/values/assets.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #808080 7 | #dc3839 8 | #000000 9 | #ffffff 10 | #00FF00 11 | #ffd700 12 | @color/colorAccent 13 | #8a6aff 14 | #fc3b3b 15 | #3864be 16 | 17 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Weex demo 3 | 4 | -------------------------------------------------------------------------------- /MyApplication/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /MyApplication/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.1.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | 20 | ext { 21 | 22 | // Application Version Config 23 | compileSdkVersion = 23 24 | buildToolsVersion = '23.0.3' 25 | applicationId = 'com.test.www.myapplication' 26 | minSdkVersion = 16 27 | targetSdkVersion = 23 28 | versionCode = 17002 29 | versionName = "1.7.2" 30 | weexZipVersionCode = 0 31 | 32 | // Android Library 33 | libSupportV4 = 'com.android.support:support-v4:25.0.1' 34 | libV7 = 'com.android.support:appcompat-v7:25.0.1' 35 | libDesign = 'com.android.support:design:25.0.1' 36 | libRecyclerview = 'com.android.support:recyclerview-v7:25.0.1' 37 | libCardView = 'com.android.support:cardview-v7:25.0.1' 38 | libGridLayout = 'com.android.support:gridlayout-v7:25.0.1' 39 | libMultiDex = 'com.android.support:multidex:1.0.0' 40 | 41 | // Third Library 42 | libProgress = 'com.pnikosis:materialish-progress:1.7' 43 | libCircleImageView = 'de.hdodenhof:circleimageview:2.0.0' 44 | libEventBus = 'de.greenrobot:eventbus:2.4.0' 45 | libFresco = 'com.facebook.fresco:fresco:0.14.1' 46 | libFrescoOkHttp = "com.facebook.fresco:imagepipeline-okhttp3:1.2.0" 47 | libRetrofit = 'com.squareup.retrofit2:retrofit:2.1.0' 48 | libRetrofitGsonConverter = 'com.squareup.retrofit2:converter-gson:2.1.0' 49 | libOkHttp3LogInterceptor = 'com.squareup.okhttp3:logging-interceptor:3.6.0' 50 | libIo = 'commons-io:commons-io:2.4' 51 | libGson = 'com.google.code.gson:gson:2.7' 52 | libRecyclerViewAnimator = 'jp.wasabeef:recyclerview-animators:1.3.0' 53 | 54 | // Weex Library 55 | libFastjson = 'com.alibaba:fastjson:1.1.46.android' 56 | libViewPagerTransforms = 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.2.32@aar' 57 | } 58 | } 59 | 60 | task clean(type: Delete) { 61 | delete rootProject.buildDir 62 | } 63 | -------------------------------------------------------------------------------- /MyApplication/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true -------------------------------------------------------------------------------- /MyApplication/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /MyApplication/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /MyApplication/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /MyApplication/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | 5 | compileSdkVersion parent.ext.compileSdkVersion 6 | buildToolsVersion parent.ext.buildToolsVersion 7 | 8 | defaultConfig { 9 | minSdkVersion parent.ext.minSdkVersion 10 | targetSdkVersion parent.ext.targetSdkVersion 11 | } 12 | 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | 20 | lintOptions { 21 | abortOnError false 22 | ignoreWarnings true 23 | } 24 | } 25 | 26 | dependencies { 27 | compile fileTree(dir: 'libs', include: ['*.jar']) 28 | compile parent.ext.libSupportV4 29 | compile parent.ext.libDesign 30 | compile parent.ext.libProgress 31 | compile parent.ext.libFresco 32 | 33 | } 34 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/cihaibo/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/java/com/eastmoney/live/ui/ContextUtil.java: -------------------------------------------------------------------------------- 1 | package com.eastmoney.live.ui; 2 | 3 | import android.content.Context; 4 | 5 | /** 6 | * ContextUtil,为Android程序提供全局Context对象,要在Application.onCreate中初始化。 7 | */ 8 | public class ContextUtil { 9 | private static Context context; 10 | 11 | public static void init(Context appContext) { 12 | context = appContext.getApplicationContext(); 13 | } 14 | 15 | public static Context getContext() { 16 | return context; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/java/com/eastmoney/live/ui/DensityUtil.java: -------------------------------------------------------------------------------- 1 | package com.eastmoney.live.ui; 2 | 3 | 4 | import android.annotation.TargetApi; 5 | import android.app.Activity; 6 | import android.content.Context; 7 | import android.graphics.Point; 8 | import android.os.Build; 9 | import android.util.DisplayMetrics; 10 | import android.view.Display; 11 | import android.view.WindowManager; 12 | 13 | /** 14 | * 设备屏幕工具类 15 | * 16 | */ 17 | public class DensityUtil { 18 | 19 | private static int[] deviceWidthHeight = new int[2]; 20 | 21 | public static int[] getDeviceInfo(Context context) { 22 | if ((deviceWidthHeight[0] == 0) && (deviceWidthHeight[1] == 0)) { 23 | DisplayMetrics metrics = new DisplayMetrics(); 24 | ((Activity) context).getWindowManager().getDefaultDisplay() 25 | .getMetrics(metrics); 26 | 27 | deviceWidthHeight[0] = metrics.widthPixels; 28 | deviceWidthHeight[1] = metrics.heightPixels; 29 | } 30 | return deviceWidthHeight; 31 | } 32 | 33 | /** 34 | * 获取屏幕宽度的方法 35 | * 36 | * @param context 37 | * @return 38 | */ 39 | public static int getScreenWith(Context context) { 40 | WindowManager wm = (WindowManager) context 41 | .getSystemService(Context.WINDOW_SERVICE); 42 | return wm.getDefaultDisplay().getWidth(); 43 | } 44 | 45 | /** 46 | * 获取屏幕高度的方法 47 | * 48 | * @param context 49 | * @return 50 | */ 51 | public static int getScreenHeight(Context context) { 52 | WindowManager wm = (WindowManager) context 53 | .getSystemService(Context.WINDOW_SERVICE); 54 | return wm.getDefaultDisplay().getHeight(); 55 | } 56 | 57 | public static int getStatusBarHeight(Context context) { 58 | int statusBarHeight = -1; 59 | try { 60 | Class> clazz = Class.forName("com.android.internal.R$dimen"); 61 | Object object = clazz.newInstance(); 62 | int height = Integer.parseInt(clazz.getField("status_bar_height") 63 | .get(object).toString()); 64 | statusBarHeight = context.getResources().getDimensionPixelSize(height); 65 | } catch (Exception e) { 66 | e.printStackTrace(); 67 | } 68 | 69 | return statusBarHeight; 70 | } 71 | 72 | /** 73 | * 获取屏幕尺寸 74 | */ 75 | @SuppressWarnings("deprecation") 76 | @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) 77 | public static Point getScreenSize() { 78 | WindowManager windowManager = (WindowManager) ContextUtil.getContext().getSystemService 79 | (Context 80 | .WINDOW_SERVICE); 81 | Display display = windowManager.getDefaultDisplay(); 82 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2) { 83 | return new Point(display.getWidth(), display.getHeight()); 84 | } else { 85 | Point point = new Point(); 86 | display.getSize(point); 87 | return point; 88 | } 89 | } 90 | 91 | /** 92 | * dp -> px 93 | * 94 | * @param dpValue dp数值 95 | * @return dp to px 96 | */ 97 | public static int dip2px(float dpValue) { 98 | final float scale = ContextUtil.getContext().getResources().getDisplayMetrics().density; 99 | return (int) (dpValue * scale + 0.5f); 100 | } 101 | 102 | /** 103 | * px -> dp 104 | * 105 | * @param pxValue px的数值 106 | * @return px to dp 107 | */ 108 | public static int px2dip(float pxValue) { 109 | final float scale = ContextUtil.getContext().getResources().getDisplayMetrics().density; 110 | return (int) (pxValue / scale + 0.5f); 111 | 112 | } 113 | 114 | /** 115 | * px -> sp 116 | * 117 | * @param pxValue px的数值 118 | * @return px to sp 119 | */ 120 | public static int px2sp(float pxValue) { 121 | final float fontScale = ContextUtil.getContext().getResources().getDisplayMetrics().scaledDensity; 122 | return (int) (pxValue / fontScale + 0.5f); 123 | } 124 | 125 | /** 126 | * sp -> px 127 | * 128 | * @param spValue dp数值 129 | * @return sp to px 130 | */ 131 | public static int sp2px(float spValue) { 132 | final float fontScale = ContextUtil.getContext().getResources().getDisplayMetrics().scaledDensity; 133 | return (int) (spValue * fontScale + 0.5f); 134 | } 135 | 136 | } -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/java/com/eastmoney/live/ui/ThemeUtils.java: -------------------------------------------------------------------------------- 1 | package com.eastmoney.live.ui; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | 6 | /** 7 | * Created by peijiadi on 16/5/6. 8 | */ 9 | public class ThemeUtils { 10 | 11 | private static final int[] APPCOMPAT_CHECK_ATTRS = {R.attr.colorPrimary}; 12 | 13 | public static void checkAppCompatTheme(Context context) { 14 | TypedArray a = context.obtainStyledAttributes(APPCOMPAT_CHECK_ATTRS); 15 | final boolean failed = !a.hasValue(0); 16 | if (a != null) { 17 | a.recycle(); 18 | } 19 | if (failed) { 20 | throw new IllegalArgumentException("You need to use a Theme.AppCompat theme " 21 | + "(or descendant) with the design library."); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/java/com/eastmoney/live/ui/ToastUtil.java: -------------------------------------------------------------------------------- 1 | package com.eastmoney.live.ui; 2 | 3 | import android.content.Context; 4 | import android.os.Build; 5 | import android.support.annotation.StringRes; 6 | import android.widget.Toast; 7 | 8 | 9 | 10 | /** 11 | * Toast工具类 12 | * 13 | * Created by fengshzh on 4/21/16. 14 | */ 15 | public class ToastUtil { 16 | private static Context mContext; 17 | private static boolean sUseSystemToast = true; 18 | 19 | public static void init(Context context) { 20 | mContext = context; 21 | sUseSystemToast = useSystemToast(); 22 | } 23 | 24 | public static void show(String content) { 25 | } 26 | 27 | public static void show(String content, int flag) { 28 | } 29 | 30 | public static void show(@StringRes int strResId) { 31 | } 32 | 33 | public static void showSlide(String content) { 34 | } 35 | 36 | public static void showSlide(@StringRes int strResId) { 37 | } 38 | 39 | public static void showNetworkError() { 40 | } 41 | 42 | // 是否应该使用系统默认Toast 43 | private static boolean useSystemToast() { 44 | return /*CheckPhoneSystemUtil.isMIUI() ||*/ Build.VERSION.SDK_INT >= 25; 45 | } 46 | 47 | public static void showSysToast(String content) { 48 | Toast.makeText(mContext, content, Toast.LENGTH_SHORT).show(); 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/java/com/eastmoney/live/ui/refreshlayout/LionRefreshDrawable.java: -------------------------------------------------------------------------------- 1 | package com.eastmoney.live.ui.refreshlayout; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.BitmapFactory; 6 | import android.graphics.Canvas; 7 | import android.graphics.Matrix; 8 | import android.graphics.Paint; 9 | import android.graphics.Rect; 10 | 11 | import com.eastmoney.live.ui.DensityUtil; 12 | import com.eastmoney.live.ui.R; 13 | 14 | 15 | /** 16 | * 红包刷新动画 17 | * Created by jiao.js on 2016/12/22. 18 | */ 19 | 20 | public class LionRefreshDrawable extends RefreshDrawable { 21 | // private final float MOUTH_WIDTH = DensityUtil.dip2px(114); 22 | // private final float MOUTH_HEIGHT = DensityUtil.dip2px(68); 23 | private final float RED_PACKET_WIDTH = DensityUtil.dip2px(36); 24 | private final float RED_PACKET_HEIGHT = DensityUtil.dip2px(46.5f); 25 | 26 | private Bitmap mRedPacketBitmap; 27 | private Context mContext; 28 | private float mPercent; 29 | private int mWidth; 30 | private int mHeight; 31 | private Matrix mMouthMatrix; 32 | private Matrix mRedPacketMatrix; 33 | private boolean isRefreshing; 34 | private float mRedPacketPosY; 35 | private Paint mRedPacketPaint; 36 | 37 | 38 | public LionRefreshDrawable(Context context, PullRefreshLayout layout) { 39 | super(context, layout); 40 | init(context); 41 | } 42 | 43 | private void init(Context context) { 44 | mContext = context; 45 | mRedPacketBitmap = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(context.getResources(), 46 | R.drawable.lion_redpacket), (int) RED_PACKET_WIDTH, (int) RED_PACKET_HEIGHT, false); 47 | mMouthMatrix = new Matrix(); 48 | mRedPacketMatrix = new Matrix(); 49 | mRedPacketPaint = new Paint(); 50 | 51 | } 52 | 53 | @Override 54 | protected void onBoundsChange(Rect bounds) { 55 | super.onBoundsChange(bounds); 56 | 57 | mWidth = bounds.width(); 58 | } 59 | 60 | @Override 61 | public void setPercent(float percent) { 62 | mPercent = percent; 63 | invalidateSelf(); 64 | } 65 | 66 | @Override 67 | public void offsetTopAndBottom(int offset) { 68 | invalidateSelf(); 69 | } 70 | 71 | @Override 72 | public void setHeight(int height) { 73 | mHeight = height; 74 | } 75 | 76 | @Override 77 | public void start() { 78 | isRefreshing = true; 79 | mRedPacketPosY = 0; 80 | mPercent = 1; 81 | invalidateSelf(); 82 | } 83 | 84 | @Override 85 | public void stop() { 86 | isRefreshing = false; 87 | mRedPacketPosY = 0; 88 | invalidateSelf(); 89 | } 90 | 91 | @Override 92 | public boolean isRunning() { 93 | return isRefreshing; 94 | } 95 | 96 | 97 | @Override 98 | public void draw(Canvas canvas) { 99 | 100 | canvas.clipRect(0, 0, mWidth, mHeight); 101 | 102 | canvas.save(); 103 | if (isRefreshing && mRedPacketPosY - RED_PACKET_HEIGHT * (0.8f - mPercent) * 1.25f <= mHeight) { 104 | // float alpha = (mHeight + RED_PACKET_HEIGHT * (0.8f - mPercent) * 1.25f - mRedPacketPosY) / 105 | // (mHeight + RED_PACKET_HEIGHT * (0.8f - mPercent) * 1.25f); 106 | float[] redpacketSrc = { 107 | 0, 0, 108 | 0, RED_PACKET_HEIGHT, 109 | RED_PACKET_WIDTH, RED_PACKET_HEIGHT, 110 | RED_PACKET_WIDTH, 0 111 | }; 112 | float[] redpacketDst = { 113 | (mWidth - RED_PACKET_WIDTH) / 2, -RED_PACKET_HEIGHT * (0.8f - mPercent) * 1.25f + mRedPacketPosY, 114 | (mWidth - RED_PACKET_WIDTH) / 2, RED_PACKET_HEIGHT * (mPercent) * 1.25f + mRedPacketPosY, 115 | (mWidth + RED_PACKET_WIDTH) / 2, RED_PACKET_HEIGHT * (mPercent) * 1.25f + mRedPacketPosY, 116 | (mWidth + RED_PACKET_WIDTH) / 2, -RED_PACKET_HEIGHT * (0.8f - mPercent) * 1.25f + mRedPacketPosY, 117 | }; 118 | // mRedPacketPaint.setAlpha((int) (alpha * 255)); 119 | mRedPacketMatrix.setPolyToPoly(redpacketSrc, 0, redpacketDst, 0, 4); 120 | canvas.drawBitmap(mRedPacketBitmap, mRedPacketMatrix, mRedPacketPaint); 121 | canvas.restore(); 122 | mRedPacketPosY = mRedPacketPosY + (mHeight + RED_PACKET_HEIGHT * (0.8f - mPercent) * 1.25f) / 5; 123 | invalidateSelf(); 124 | } 125 | 126 | if (!isRefreshing) { 127 | float[] redpacketSrc = { 128 | 0, 0, 129 | 0, RED_PACKET_HEIGHT, 130 | RED_PACKET_WIDTH, RED_PACKET_HEIGHT, 131 | RED_PACKET_WIDTH, 0 132 | }; 133 | 134 | 135 | float[] redpacketDst = { 136 | (mWidth - RED_PACKET_WIDTH) / 2, -RED_PACKET_HEIGHT * (0.8f - mPercent) * 1.25f, 137 | (mWidth - RED_PACKET_WIDTH) / 2, RED_PACKET_HEIGHT * (mPercent) * 1.25f, 138 | (mWidth + RED_PACKET_WIDTH) / 2, RED_PACKET_HEIGHT * (mPercent) * 1.25f, 139 | (mWidth + RED_PACKET_WIDTH) / 2, -RED_PACKET_HEIGHT * (0.8f - mPercent) * 1.25f 140 | }; 141 | mRedPacketMatrix.setPolyToPoly(redpacketSrc, 0, redpacketDst, 0, 4); 142 | // canvas.translate(0, -(0.9f - mPercent) * 2.5f * RED_PACKET_HEIGHT); 143 | canvas.drawBitmap(mRedPacketBitmap, mRedPacketMatrix, null); 144 | canvas.restore(); 145 | } 146 | 147 | 148 | } 149 | 150 | } 151 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/java/com/eastmoney/live/ui/refreshlayout/RefreshDrawable.java: -------------------------------------------------------------------------------- 1 | package com.eastmoney.live.ui.refreshlayout; 2 | 3 | import android.content.Context; 4 | import android.graphics.ColorFilter; 5 | import android.graphics.PixelFormat; 6 | import android.graphics.drawable.Animatable; 7 | import android.graphics.drawable.Drawable; 8 | 9 | /** 10 | * Created by baoyz on 14/10/29. 11 | */ 12 | public abstract class RefreshDrawable extends Drawable implements Drawable.Callback, Animatable { 13 | 14 | private PullRefreshLayout mRefreshLayout; 15 | 16 | public RefreshDrawable(Context context, PullRefreshLayout layout) { 17 | mRefreshLayout = layout; 18 | } 19 | 20 | public Context getContext() { 21 | return mRefreshLayout != null ? mRefreshLayout.getContext() : null; 22 | } 23 | 24 | public PullRefreshLayout getRefreshLayout() { 25 | return mRefreshLayout; 26 | } 27 | 28 | public abstract void setPercent(float percent); 29 | // public abstract void setColorSchemeColors(int[] colorSchemeColors); 30 | 31 | public abstract void offsetTopAndBottom(int offset); 32 | 33 | public abstract void setHeight(int height); 34 | 35 | @Override 36 | public void invalidateDrawable(Drawable who) { 37 | final Callback callback = getCallback(); 38 | if (callback != null) { 39 | callback.invalidateDrawable(this); 40 | } 41 | } 42 | 43 | @Override 44 | public void scheduleDrawable(Drawable who, Runnable what, long when) { 45 | final Callback callback = getCallback(); 46 | if (callback != null) { 47 | callback.scheduleDrawable(this, what, when); 48 | } 49 | } 50 | 51 | @Override 52 | public void unscheduleDrawable(Drawable who, Runnable what) { 53 | final Callback callback = getCallback(); 54 | if (callback != null) { 55 | callback.unscheduleDrawable(this, what); 56 | } 57 | } 58 | 59 | @Override 60 | public int getOpacity() { 61 | return PixelFormat.TRANSLUCENT; 62 | } 63 | 64 | @Override 65 | public void setAlpha(int alpha) { 66 | 67 | } 68 | 69 | @Override 70 | public void setColorFilter(ColorFilter cf) { 71 | 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/anim/activity_tobottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 11 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/anim/activity_totop.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 10 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/anim/slide_in_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/anim/slide_out_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/anim/swipeback_activity_close_enter.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 23 | 27 | 28 | 32 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/anim/swipeback_activity_close_exit.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 23 | 26 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/anim/swipeback_activity_open_enter.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 23 | 24 | 29 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/anim/swipeback_activity_open_exit.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 26 | 30 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xhdpi/avatar_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xhdpi/avatar_default.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xhdpi/icon_frame_vip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xhdpi/icon_frame_vip.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xhdpi/img_me_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xhdpi/img_me_circle.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/avatar_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/avatar_default.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/btn_minus_click.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/btn_minus_click.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/btn_minus_disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/btn_minus_disable.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/btn_minus_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/btn_minus_normal.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/btn_plus_click.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/btn_plus_click.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/btn_plus_disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/btn_plus_disable.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/btn_plus_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/btn_plus_normal.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_circle_frame_arrow_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_circle_frame_arrow_normal.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_discover_vip_border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_discover_vip_border.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_frame_vip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_frame_vip.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_high_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_high_02.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_high_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_high_03.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_high_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_high_04.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_high_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_high_05.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_high_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_high_circle.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_low_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_low_circle.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_middle_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_crown_middle_circle.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_luna_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_luna_circle.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_star_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_star_circle.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_sun_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_level_sun_circle.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_live_message_alert_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_live_message_alert_arrow.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_live_no1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_live_no1.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_live_no2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_live_no2.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_live_no3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_live_no3.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_pic_vip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_pic_vip.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_vip_outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/icon_vip_outline.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/img_me_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/img_me_circle.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_001.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_002.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_003.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_004.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_005.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_006.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_007.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_008.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_009.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_anim_frame_010.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_redpacket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/lib_ui/src/main/res/drawable-xxhdpi/lion_redpacket.png -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable-xxhdpi/selector_pickerview_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable/backgroud_grey_corner.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable/badgeview_red_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable/bg_item_edit_text_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 8 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable/btn_minus.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable/btn_plus.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/drawable/lion_anim.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/layout/bg_blur_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/layout/comui_tab_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 20 | 21 | 31 | 32 | 43 | 44 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/layout/header_toast.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 16 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/layout/include_pickerview_topbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 16 | 17 | 29 | 30 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/layout/item_edit_text_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 17 | 18 | 21 | 22 | 23 | 26 | 27 | 28 | 31 | 32 | 33 | 36 | 37 | 38 | 41 | 42 | 43 | 44 | 49 | 50 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/layout/kprogresshud_hud.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 19 | 20 | 28 | 29 | 36 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/layout/layout_basepickerview.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/layout/layout_live_message.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 16 | 17 | 31 | 32 | 33 | 34 | 41 | 42 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/layout/layout_plus_minus_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | 24 | 25 | 32 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/layout/pickerview_options.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 18 | 19 | 25 | 26 | 31 | 32 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/layout/pickerview_time.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 18 | 19 | 24 | 25 | 30 | 31 | 36 | 37 | 42 | 43 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/layout/tab_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/values/bools.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #212121 4 | 5 | #FF6827 6 | #52b8f8 7 | #52b8f8 8 | #f252b8f8 9 | 10 | @color/white 11 | 12 | #99b2c4 13 | 14 | #B2333333 15 | #ccff0000 16 | 17 | #D0D0D0 18 | #00000000 19 | #ffffff 20 | 21 | #1E000000 22 | #33019285 23 | 24 | #33000000 25 | 26 | #ECECEC 27 | #019285 28 | #FFFFFF 29 | #aaaaaa 30 | #ffd700 31 | 32 | #60000000 33 | #449E9E9E 34 | 35 | #E5FFFFFF 36 | #FF333333 37 | 38 | #808080 39 | 40 | #057dff 41 | #c2daf5 42 | #f5f5f5 43 | #000000 44 | #a8a8a8 45 | #2a2a2a 46 | #d5d5d5 47 | 48 | #60000000 49 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 262dp 5 | 380dp 6 | 7 | 44dp 8 | 9 | 10dp 10 | 11 | 30dp 12 | 13 | 20sp 14 | 21sp 15 | 16 | 20sp 17 | 18 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/values/integers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 300 5 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 确定 4 | 年 5 | 月 6 | 日 7 | 时 8 | 分 9 | 10 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | 17 | 27 | 28 | -------------------------------------------------------------------------------- /MyApplication/lib_ui/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | -------------------------------------------------------------------------------- /MyApplication/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', 2 | 'lib_ui', 3 | 'weex_sdk' 4 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .idea 3 | build 4 | captures 5 | local.properties 6 | target 7 | bin 8 | .classpath 9 | .project 10 | .settings 11 | gen 12 | *.iml 13 | lint.xml 14 | project.properties -------------------------------------------------------------------------------- /MyApplication/weex_sdk/NOTICE: -------------------------------------------------------------------------------- 1 | Weex Sdk Android 2 | Copyright 2016 Alibaba Group 3 | 4 | This product includes software developed at Alibaba Group. (http://www.alibabagroup.com) 5 | 6 | This product contains software css-layout(https://github.com/facebook/css-layout) developed 7 | by Facebook Inc., licensed under the BSD License. 8 | 9 | This product contains software React Native(https://github.com/facebook/react-native) developed 10 | by Facebook Inc., licensed under the BSD License. 11 | 12 | This product contains software Guava(https://github.com/google/guava) developed 13 | by Google Inc. , licensed under the Apache License. 14 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/README.md: -------------------------------------------------------------------------------- 1 | ## Unit Test 2 | 3 | Unit test code is under 'src/test'. You can run unit test use command: 4 | ```bash 5 | ./gradlew clean testDebugUnitTest jacocoTestReportDebug 6 | ``` 7 | This task will run all unit test and produce both unit test report and jacoco test coverage report in 'build/reports'. 8 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/weex_sdk/assets/.gitkeep -------------------------------------------------------------------------------- /MyApplication/weex_sdk/assets/.gitkeeper: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/weex_sdk/assets/.gitkeeper -------------------------------------------------------------------------------- /MyApplication/weex_sdk/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | jcenter() 5 | } 6 | dependencies { 7 | classpath files('license/license-gradle-plugin-0.12.1.jar') 8 | classpath files('license/maven-license-plugin-1.10.b1.jar') 9 | classpath files('license/plexus-utils-3.0.24.jar') 10 | classpath 'com.vanniktech:gradle-android-junit-jacoco-plugin:0.5.0' 11 | } 12 | } 13 | 14 | 15 | allprojects { 16 | repositories { 17 | mavenCentral() 18 | jcenter() 19 | } 20 | } 21 | 22 | apply plugin: 'com.android.library' 23 | apply plugin: 'com.github.hierynomus.license' 24 | 25 | ext.disableCov = project.hasProperty('disableCov') ? project.getProperty('disableCov') : 'false' 26 | 27 | if(!disableCov.toBoolean()){ 28 | apply plugin: 'com.vanniktech.android.junit.jacoco' 29 | junitJacoco { 30 | excludes = ['com/taobao/weex/dom/flex/**','com/taobao/weex/ui/view/refresh/circlebar/**'] 31 | } 32 | } 33 | 34 | version = "0.9.4" 35 | 36 | android { 37 | compileSdkVersion parent.ext.compileSdkVersion 38 | buildToolsVersion parent.ext.buildToolsVersion 39 | resourcePrefix "weex" 40 | 41 | useLibrary 'org.apache.http.legacy' 42 | 43 | def jsfmVersion = "0.15.2" 44 | try{ 45 | def line 46 | new File("assets/main.js").withReader { line = it.readLine() } 47 | def m = line =~ /[A-Z\s]+\:\s+([0-9\.]+)\s+Build\s+[0-9]+/; 48 | jsfmVersion = m[0][1] 49 | println jsfmVersion 50 | } catch (java.lang.Exception e) { 51 | 52 | } 53 | 54 | defaultConfig { 55 | buildConfigField "String", "buildJavascriptFrameworkVersion", "\"${jsfmVersion}\"" 56 | buildConfigField "String", "buildVersion", "\"${version}\"" 57 | minSdkVersion parent.ext.minSdkVersion 58 | targetSdkVersion parent.ext.targetSdkVersion 59 | versionCode 1 60 | versionName "1.0" 61 | ndk { 62 | abiFilters "armeabi","x86" 63 | } 64 | } 65 | buildTypes { 66 | release { 67 | minifyEnabled false 68 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 69 | } 70 | 71 | debug { 72 | testCoverageEnabled true 73 | } 74 | } 75 | 76 | sourceSets { 77 | main { 78 | assets.srcDirs = ['assets'] 79 | jniLibs.srcDir(['libs']) 80 | java { 81 | srcDirs = ["src/main/java"]; 82 | } 83 | } 84 | debug.setRoot('build-types/debug') 85 | release.setRoot('build-types/release') 86 | } 87 | 88 | compileOptions.encoding = "UTF-8" 89 | lintOptions { 90 | abortOnError false 91 | } 92 | compileOptions { 93 | sourceCompatibility JavaVersion.VERSION_1_7 94 | targetCompatibility JavaVersion.VERSION_1_7 95 | } 96 | testOptions { 97 | unitTests.all { 98 | maxHeapSize = "1024m" 99 | jvmArgs += ['-XX:-UseSplitVerifier', '-noverify','-Xverify:none']/* fix VerifyError */ 100 | } 101 | } 102 | } 103 | 104 | dependencies { 105 | compile fileTree(include: ['*.jar'], dir: 'libs') 106 | compile project(':lib_ui') 107 | compile parent.ext.libV7 108 | compile parent.ext.libSupportV4 109 | compile parent.ext.libRecyclerview 110 | compile parent.ext.libFastjson 111 | 112 | } 113 | 114 | license{ 115 | header=file('license/LICENSE') 116 | excludes (["**/WXDataStructureUtil.java", 117 | "**/Spacing.java", 118 | "**/MeasureOutput.java", 119 | "**/LayoutEngine.java", 120 | "**/FloatUtil.java", 121 | "**/CSSWrap.java", 122 | "**/CSSStyle.java", 123 | "**/CSSPositionType.java", 124 | "**/CSSNode.java", 125 | "**/CSSLayoutContext.java", 126 | "**/CSSLayout.java", 127 | "**/CSSJustify.java", 128 | "**/CSSFlexDirection.java", 129 | "**/CSSDirection.java", 130 | "**/CSSConstants.java", 131 | "**/CSSAlign.java", 132 | "**/CachedCSSLayout.java", 133 | "**/CSSAlignConvert.java", 134 | "**/CSSFlexDirectionConvert.java", 135 | "**/CSSJustifyConvert.java", 136 | "**/CSSPositionTypeConvert.java", 137 | "**/CSSTransformFromStyle.java", 138 | "**/CSSWrapConvert.java", 139 | "**/WXTextDomObject.java", 140 | "**/WXCustomStyleSpan.java"]) 141 | } 142 | preBuild.dependsOn licenseFormat 143 | 144 | task wrapper(type: Wrapper) { 145 | gradleVersion = '2.10' 146 | } -------------------------------------------------------------------------------- /MyApplication/weex_sdk/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true 21 | org.gradle.daemon=false 22 | org.gradle.parallel=false 23 | org.gradle.jvmargs=-Xmx2048M -------------------------------------------------------------------------------- /MyApplication/weex_sdk/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/libs/armeabi/libweexv8.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/weex_sdk/libs/armeabi/libweexv8.so -------------------------------------------------------------------------------- /MyApplication/weex_sdk/libs/x86/libweexv8.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/weex_sdk/libs/x86/libweexv8.so -------------------------------------------------------------------------------- /MyApplication/weex_sdk/license/license-gradle-plugin-0.12.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/weex_sdk/license/license-gradle-plugin-0.12.1.jar -------------------------------------------------------------------------------- /MyApplication/weex_sdk/license/maven-license-plugin-1.10.b1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/weex_sdk/license/maven-license-plugin-1.10.b1.jar -------------------------------------------------------------------------------- /MyApplication/weex_sdk/license/plexus-utils-3.0.24.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/weex_sdk/license/plexus-utils-3.0.24.jar -------------------------------------------------------------------------------- /MyApplication/weex_sdk/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/ouy/Library/AndroidStudio/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -keep class com.taobao.weex.bridge.** { *; } 19 | -dontwarn com.taobao.weex.bridge.** 20 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/publish.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ./gradlew clean assemble publish -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/CSSAlignConvert.java: -------------------------------------------------------------------------------- 1 | package com.taobao.weex.dom; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.taobao.weex.dom.flex.CSSAlign; 6 | 7 | final class CSSAlignConvert { 8 | 9 | public static CSSAlign convert2AlignItems(String s) { 10 | CSSAlign align = CSSAlign.STRETCH; 11 | if (TextUtils.isEmpty(s)) { 12 | align = CSSAlign.STRETCH; 13 | } else if (s.equals("stretch")) { 14 | align = CSSAlign.STRETCH; 15 | } else if (s.equals("flex-end")) { 16 | align = CSSAlign.FLEX_END; 17 | } else if (s.equals("auto")) { 18 | align = CSSAlign.AUTO; 19 | } else if (s.equals("center")) { 20 | align = CSSAlign.CENTER; 21 | } 22 | 23 | return align; 24 | } 25 | 26 | public static CSSAlign convert2AlignSelf(String s) { 27 | CSSAlign align = CSSAlign.AUTO; 28 | if (TextUtils.isEmpty(s)) { 29 | align = CSSAlign.AUTO; 30 | } else if (s.equals("flex-start")) { 31 | align = CSSAlign.FLEX_START; 32 | } else if (s.equals("flex-end")) { 33 | align = CSSAlign.FLEX_END; 34 | } else if (s.equals("stretch")) { 35 | align = CSSAlign.STRETCH; 36 | } else if (s.equals("center")) { 37 | align = CSSAlign.CENTER; 38 | } 39 | 40 | return align; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/CSSFlexDirectionConvert.java: -------------------------------------------------------------------------------- 1 | package com.taobao.weex.dom; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.taobao.weex.dom.flex.CSSFlexDirection; 6 | 7 | class CSSFlexDirectionConvert { 8 | 9 | public static CSSFlexDirection convert(String s) { 10 | CSSFlexDirection cssFlexDirection = CSSFlexDirection.ROW; 11 | if (TextUtils.isEmpty(s)) { 12 | cssFlexDirection = CSSFlexDirection.ROW; 13 | } else if (s.equals("column")) { 14 | cssFlexDirection = CSSFlexDirection.COLUMN; 15 | } else if (s.equals("column-reverse")) { 16 | cssFlexDirection = CSSFlexDirection.COLUMN_REVERSE; 17 | } else if (s.equals("row")) { 18 | cssFlexDirection = CSSFlexDirection.ROW; 19 | } else if (s.equals("row-reverse")) { 20 | cssFlexDirection = CSSFlexDirection.ROW_REVERSE; 21 | } 22 | return cssFlexDirection; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/CSSJustifyConvert.java: -------------------------------------------------------------------------------- 1 | package com.taobao.weex.dom; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.taobao.weex.dom.flex.CSSJustify; 6 | 7 | class CSSJustifyConvert { 8 | 9 | public static CSSJustify convert(String s) { 10 | CSSJustify cssJustify = CSSJustify.FLEX_START; 11 | if (TextUtils.isEmpty(s) || s.equals("flex-start")) { 12 | cssJustify = CSSJustify.FLEX_START; 13 | } else if (s.equals("flex-end")) { 14 | cssJustify = CSSJustify.FLEX_END; 15 | } else if (s.equals("center")) { 16 | cssJustify = CSSJustify.CENTER; 17 | } else if (s.equals("space-between")) { 18 | cssJustify = CSSJustify.SPACE_BETWEEN; 19 | } else if (s.equals("space-around")) { 20 | cssJustify = CSSJustify.SPACE_AROUND; 21 | } 22 | return cssJustify; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/CSSPositionTypeConvert.java: -------------------------------------------------------------------------------- 1 | package com.taobao.weex.dom; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.taobao.weex.dom.flex.CSSPositionType; 6 | 7 | class CSSPositionTypeConvert { 8 | 9 | public static CSSPositionType convert(String s) { 10 | CSSPositionType position = CSSPositionType.RELATIVE; 11 | if (TextUtils.isEmpty(s) || s.equals("relative") || s.equals("sticky")) { 12 | position = CSSPositionType.RELATIVE; 13 | } else if (s.equals("absolute") || s.equals("fixed")) { 14 | position = CSSPositionType.ABSOLUTE; 15 | } 16 | return position; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/CSSWrapConvert.java: -------------------------------------------------------------------------------- 1 | package com.taobao.weex.dom; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.taobao.weex.dom.flex.CSSWrap; 6 | 7 | class CSSWrapConvert { 8 | 9 | public static CSSWrap convert(String s) { 10 | CSSWrap cssWrap = CSSWrap.NOWRAP; 11 | if (TextUtils.isEmpty(s)) { 12 | return cssWrap; 13 | } else if (s.equals("wrap")) { 14 | return CSSWrap.WRAP; 15 | } 16 | return cssWrap; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/WXCustomStyleSpan.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | * This source code is licensed under the BSD-style license found in the LICENSE file in the root 5 | * directory of this source tree. An additional grant of patent rights can be found in the PATENTS 6 | * file in the same directory. 7 | */ 8 | package com.taobao.weex.dom; 9 | 10 | import android.graphics.Typeface; 11 | import android.text.TextPaint; 12 | import android.text.style.MetricAffectingSpan; 13 | import com.taobao.weex.utils.TypefaceUtil; 14 | 15 | public class WXCustomStyleSpan extends MetricAffectingSpan { 16 | 17 | private final int mStyle; 18 | private final int mWeight; 19 | private final String mFontFamily; 20 | 21 | public WXCustomStyleSpan(int fontStyle, int fontWeight, String fontFamily) { 22 | mStyle = fontStyle; 23 | mWeight = fontWeight; 24 | mFontFamily = fontFamily; 25 | } 26 | 27 | @Override 28 | public void updateDrawState(TextPaint ds) { 29 | TypefaceUtil.applyFontStyle(ds, mStyle, mWeight, mFontFamily); 30 | } 31 | 32 | @Override 33 | public void updateMeasureState(TextPaint paint) { 34 | TypefaceUtil.applyFontStyle(paint, mStyle, mWeight, mFontFamily); 35 | } 36 | 37 | /** 38 | * Returns {@link Typeface#NORMAL} or {@link Typeface#ITALIC}. 39 | */ 40 | public int getStyle() { 41 | return (mStyle == WXStyle.UNSET ? 0 : mStyle); 42 | } 43 | 44 | /** 45 | * Returns {@link Typeface#NORMAL} or {@link Typeface#BOLD}. 46 | */ 47 | public int getWeight() { 48 | return (mWeight == WXStyle.UNSET ? 0 : mWeight); 49 | } 50 | 51 | /** 52 | * Returns the font family set for this StyleSpan. 53 | */ 54 | public String getFontFamily() { 55 | return mFontFamily; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/flex/CSSAlign.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. All rights reserved. This source code is licensed under 3 | * the BSD-style license found in the LICENSE file in the root directory of this source tree. An 4 | * additional grant of patent rights can be found in the PATENTS file in the same directory. 5 | */ 6 | package com.taobao.weex.dom.flex; 7 | 8 | public enum CSSAlign { 9 | AUTO, 10 | FLEX_START, 11 | CENTER, 12 | FLEX_END, 13 | STRETCH, 14 | } 15 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/flex/CSSConstants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. All rights reserved. This source code is licensed under 3 | * the BSD-style license found in the LICENSE file in the root directory of this source tree. An 4 | * additional grant of patent rights can be found in the PATENTS file in the same directory. 5 | */ 6 | package com.taobao.weex.dom.flex; 7 | 8 | public class CSSConstants { 9 | 10 | public static final float UNDEFINED = Float.NaN; 11 | 12 | public static boolean isUndefined(float value) { 13 | return Float.compare(value, UNDEFINED) == 0; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/flex/CSSDirection.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. All rights reserved. This source code is licensed under 3 | * the BSD-style license found in the LICENSE file in the root directory of this source tree. An 4 | * additional grant of patent rights can be found in the PATENTS file in the same directory. 5 | */ 6 | package com.taobao.weex.dom.flex; 7 | 8 | public enum CSSDirection { 9 | INHERIT, 10 | LTR, 11 | RTL, 12 | } 13 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/flex/CSSFlexDirection.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. All rights reserved. This source code is licensed under 3 | * the BSD-style license found in the LICENSE file in the root directory of this source tree. An 4 | * additional grant of patent rights can be found in the PATENTS file in the same directory. 5 | */ 6 | package com.taobao.weex.dom.flex; 7 | 8 | public enum CSSFlexDirection { 9 | COLUMN, 10 | COLUMN_REVERSE, 11 | ROW, 12 | ROW_REVERSE 13 | } 14 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/flex/CSSJustify.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. All rights reserved. This source code is licensed under 3 | * the BSD-style license found in the LICENSE file in the root directory of this source tree. An 4 | * additional grant of patent rights can be found in the PATENTS file in the same directory. 5 | */ 6 | package com.taobao.weex.dom.flex; 7 | 8 | public enum CSSJustify { 9 | FLEX_START, 10 | CENTER, 11 | FLEX_END, 12 | SPACE_BETWEEN, 13 | SPACE_AROUND, 14 | } 15 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/flex/CSSLayout.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. All rights reserved. This source code is licensed under 3 | * the BSD-style license found in the LICENSE file in the root directory of this source tree. An 4 | * additional grant of patent rights can be found in the PATENTS file in the same directory. 5 | */ 6 | package com.taobao.weex.dom.flex; 7 | 8 | import java.util.Arrays; 9 | 10 | /** 11 | * Where the output of {@link LayoutEngine#layoutNode(CSSLayoutContext, CSSNode, float, 12 | * CSSDirection)} will go in the CSSNode. 13 | */ 14 | public class CSSLayout { 15 | 16 | public static final int POSITION_LEFT = 0; 17 | public static final int POSITION_TOP = 1; 18 | public static final int POSITION_RIGHT = 2; 19 | public static final int POSITION_BOTTOM = 3; 20 | 21 | public static final int DIMENSION_WIDTH = 0; 22 | public static final int DIMENSION_HEIGHT = 1; 23 | 24 | public float[] position = new float[4]; 25 | public float[] dimensions = new float[2]; 26 | public CSSDirection direction = CSSDirection.LTR; 27 | 28 | /** 29 | * This should always get called before calling {@link LayoutEngine#layoutNode(CSSLayoutContext, 30 | * CSSNode, float, CSSDirection)} 31 | */ 32 | public void resetResult() { 33 | Arrays.fill(position, 0); 34 | Arrays.fill(dimensions, CSSConstants.UNDEFINED); 35 | direction = CSSDirection.LTR; 36 | } 37 | 38 | public void copy(CSSLayout layout) { 39 | position[POSITION_LEFT] = layout.position[POSITION_LEFT]; 40 | position[POSITION_TOP] = layout.position[POSITION_TOP]; 41 | position[POSITION_RIGHT] = layout.position[POSITION_RIGHT]; 42 | position[POSITION_BOTTOM] = layout.position[POSITION_BOTTOM]; 43 | dimensions[DIMENSION_WIDTH] = layout.dimensions[DIMENSION_WIDTH]; 44 | dimensions[DIMENSION_HEIGHT] = layout.dimensions[DIMENSION_HEIGHT]; 45 | direction = layout.direction; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return "layout: {" + 51 | "left: " + position[POSITION_LEFT] + ", " + 52 | "top: " + position[POSITION_TOP] + ", " + 53 | "width: " + dimensions[DIMENSION_WIDTH] + ", " + 54 | "height: " + dimensions[DIMENSION_HEIGHT] + ", " + 55 | "direction: " + direction + 56 | "}"; 57 | } 58 | 59 | @Override 60 | public boolean equals(Object o) { 61 | if(this == o){ 62 | return true; 63 | } 64 | if(o instanceof CSSLayout){ 65 | CSSLayout cl = (CSSLayout)o; 66 | return FloatUtil.floatsEqual(cl.position[POSITION_LEFT],this.position[POSITION_LEFT]) && 67 | FloatUtil.floatsEqual(cl.position[POSITION_TOP],this.position[POSITION_TOP]) && 68 | FloatUtil.floatsEqual(cl.position[POSITION_RIGHT],this.position[POSITION_RIGHT]) && 69 | FloatUtil.floatsEqual(cl.position[POSITION_BOTTOM],this.position[POSITION_BOTTOM]) && 70 | FloatUtil.floatsEqual(cl.dimensions[DIMENSION_HEIGHT],this.dimensions[DIMENSION_HEIGHT]) && 71 | FloatUtil.floatsEqual(cl.dimensions[DIMENSION_WIDTH],this.dimensions[DIMENSION_WIDTH]); 72 | 73 | } 74 | return false; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/flex/CSSLayoutContext.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. All rights reserved. This source code is licensed under 3 | * the BSD-style license found in the LICENSE file in the root directory of this source tree. An 4 | * additional grant of patent rights can be found in the PATENTS file in the same directory. 5 | */ 6 | package com.taobao.weex.dom.flex; 7 | 8 | /** 9 | * A context for holding values local to a given instance of layout computation. 10 | * 11 | * This is necessary for making layout thread-safe. A separate instance should 12 | * be used when {@link CSSNode#calculateLayout} is called concurrently on 13 | * different node hierarchies. 14 | */ 15 | public class CSSLayoutContext { 16 | 17 | /*package*/ final MeasureOutput measureOutput = new MeasureOutput(); 18 | } 19 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/flex/CSSPositionType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. All rights reserved. This source code is licensed under 3 | * the BSD-style license found in the LICENSE file in the root directory of this source tree. An 4 | * additional grant of patent rights can be found in the PATENTS file in the same directory. 5 | */ 6 | package com.taobao.weex.dom.flex; 7 | 8 | public enum CSSPositionType { 9 | RELATIVE, 10 | ABSOLUTE, 11 | } 12 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/flex/CSSStyle.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. All rights reserved. This source code is licensed under 3 | * the BSD-style license found in the LICENSE file in the root directory of this source tree. An 4 | * additional grant of patent rights can be found in the PATENTS file in the same directory. 5 | */ 6 | package com.taobao.weex.dom.flex; 7 | 8 | import java.util.Arrays; 9 | 10 | import static com.taobao.weex.dom.flex.CSSLayout.DIMENSION_HEIGHT; 11 | import static com.taobao.weex.dom.flex.CSSLayout.DIMENSION_WIDTH; 12 | import static com.taobao.weex.dom.flex.CSSLayout.POSITION_BOTTOM; 13 | import static com.taobao.weex.dom.flex.CSSLayout.POSITION_LEFT; 14 | import static com.taobao.weex.dom.flex.CSSLayout.POSITION_RIGHT; 15 | import static com.taobao.weex.dom.flex.CSSLayout.POSITION_TOP; 16 | 17 | /** 18 | * The CSS style definition for a {@link CSSNode}. 19 | */ 20 | public class CSSStyle { 21 | 22 | public CSSDirection direction; 23 | public CSSFlexDirection flexDirection; 24 | public CSSJustify justifyContent; 25 | public CSSAlign alignContent; 26 | public CSSAlign alignItems; 27 | public CSSAlign alignSelf; 28 | public CSSPositionType positionType; 29 | public CSSWrap flexWrap; 30 | public float flex; 31 | 32 | public Spacing margin = new Spacing(); 33 | public Spacing padding = new Spacing(); 34 | public Spacing border = new Spacing(); 35 | 36 | public float[] position = new float[4]; 37 | public float[] dimensions = new float[2]; 38 | 39 | public float minWidth = CSSConstants.UNDEFINED; 40 | public float minHeight = CSSConstants.UNDEFINED; 41 | 42 | public float maxWidth = CSSConstants.UNDEFINED; 43 | public float maxHeight = CSSConstants.UNDEFINED; 44 | 45 | CSSStyle() { 46 | reset(); 47 | } 48 | 49 | void reset() { 50 | direction = CSSDirection.INHERIT; 51 | flexDirection = CSSFlexDirection.COLUMN; 52 | justifyContent = CSSJustify.FLEX_START; 53 | alignContent = CSSAlign.FLEX_START; 54 | alignItems = CSSAlign.STRETCH; 55 | alignSelf = CSSAlign.AUTO; 56 | positionType = CSSPositionType.RELATIVE; 57 | flexWrap = CSSWrap.NOWRAP; 58 | flex = 0f; 59 | 60 | margin.reset(); 61 | padding.reset(); 62 | border.reset(); 63 | 64 | Arrays.fill(position, CSSConstants.UNDEFINED); 65 | Arrays.fill(dimensions, CSSConstants.UNDEFINED); 66 | 67 | minWidth = CSSConstants.UNDEFINED; 68 | minHeight = CSSConstants.UNDEFINED; 69 | 70 | maxWidth = CSSConstants.UNDEFINED; 71 | maxHeight = CSSConstants.UNDEFINED; 72 | } 73 | 74 | public void copy(CSSStyle cssStyle) { 75 | direction = cssStyle.direction; 76 | flexDirection = cssStyle.flexDirection; 77 | justifyContent = cssStyle.justifyContent; 78 | alignContent = cssStyle.alignContent; 79 | alignItems = cssStyle.alignItems; 80 | alignSelf = cssStyle.alignSelf; 81 | positionType = cssStyle.positionType; 82 | flexWrap = cssStyle.flexWrap; 83 | flex = cssStyle.flex; 84 | margin = cssStyle.margin; 85 | padding = cssStyle.padding; 86 | border = cssStyle.border; 87 | position[POSITION_TOP] = cssStyle.position[POSITION_TOP]; 88 | position[POSITION_BOTTOM] = cssStyle.position[POSITION_BOTTOM]; 89 | position[POSITION_LEFT] = cssStyle.position[POSITION_LEFT]; 90 | position[POSITION_RIGHT] = cssStyle.position[POSITION_RIGHT]; 91 | dimensions[DIMENSION_WIDTH] = cssStyle.dimensions[DIMENSION_WIDTH]; 92 | dimensions[DIMENSION_HEIGHT] = cssStyle.dimensions[DIMENSION_HEIGHT]; 93 | minWidth = cssStyle.minWidth; 94 | minHeight = cssStyle.minHeight; 95 | maxWidth = cssStyle.maxWidth; 96 | maxHeight = cssStyle.maxHeight; 97 | } 98 | 99 | public String toString() { 100 | return "direction =" + direction + "\n" 101 | + "flexDirection =" + flexDirection + "\n" 102 | + "justifyContent=" + justifyContent + "\n" 103 | + "alignContent =" + alignContent + "\n" 104 | + "alignItems =" + alignItems + "\n" 105 | + "alignSelf =" + alignSelf + "\n" 106 | + "positionType =" + positionType + "\n" 107 | + "flexWrap =" + flexWrap + "\n" 108 | + "flex =" + flex + "\n" 109 | + "margin =" + margin + "\n" 110 | + "padding =" + padding + "\n" 111 | + "border =" + border + "\n" 112 | + "position[POSITION_TOP] =" + position[POSITION_TOP] + "\n" 113 | + "position[POSITION_BOTTOM] =" + position[POSITION_BOTTOM] + "\n" 114 | + "position[POSITION_LEFT] =" + position[POSITION_LEFT] + "\n" 115 | + "position[POSITION_RIGHT] =" + position[POSITION_RIGHT] + "\n" 116 | + "position[DIMENSION_WIDTH] =" + position[DIMENSION_WIDTH] + "\n" 117 | + "position[DIMENSION_HEIGHT] =" + position[DIMENSION_HEIGHT] + "\n" 118 | + "minWidth =" + minWidth + "\n" 119 | + "minHeight =" + minHeight + "\n" 120 | + "maxWidth =" + maxWidth + "\n" 121 | + "maxHeight =" + maxHeight + "\n"; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/flex/CSSWrap.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. All rights reserved. This source code is licensed under 3 | * the BSD-style license found in the LICENSE file in the root directory of this source tree. An 4 | * additional grant of patent rights can be found in the PATENTS file in the same directory. 5 | */ 6 | package com.taobao.weex.dom.flex; 7 | 8 | public enum CSSWrap { 9 | NOWRAP, 10 | WRAP, 11 | } 12 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/flex/CachedCSSLayout.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. All rights reserved. This source code is licensed under 3 | * the BSD-style license found in the LICENSE file in the root directory of this source tree. An 4 | * additional grant of patent rights can be found in the PATENTS file in the same directory. 5 | */ 6 | package com.taobao.weex.dom.flex; 7 | 8 | /** 9 | * CSSLayout with additional information about the conditions under which it was generated. 10 | * {@link #requestedWidth} and {@link #requestedHeight} are the width and height the parent set on 11 | * this node before calling layout visited us. 12 | */ 13 | public class CachedCSSLayout extends CSSLayout { 14 | 15 | public float requestedWidth = CSSConstants.UNDEFINED; 16 | public float requestedHeight = CSSConstants.UNDEFINED; 17 | public float parentMaxWidth = CSSConstants.UNDEFINED; 18 | } 19 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/flex/FloatUtil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. All rights reserved. This source code is licensed under 3 | * the BSD-style license found in the LICENSE file in the root directory of this source tree. An 4 | * additional grant of patent rights can be found in the PATENTS file in the same directory. 5 | */ 6 | package com.taobao.weex.dom.flex; 7 | 8 | public class FloatUtil { 9 | 10 | private static final float EPSILON = .00001f; 11 | 12 | public static boolean floatsEqual(float f1, float f2) { 13 | if (Float.isNaN(f1) || Float.isNaN(f2)) { 14 | return Float.isNaN(f1) && Float.isNaN(f2); 15 | } 16 | return Math.abs(f2 - f1) < EPSILON; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/dom/flex/MeasureOutput.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, Facebook, Inc. All rights reserved. This source code is licensed under 3 | * the BSD-style license found in the LICENSE file in the root directory of this source tree. An 4 | * additional grant of patent rights can be found in the PATENTS file in the same directory. 5 | */ 6 | package com.taobao.weex.dom.flex; 7 | 8 | /** 9 | * POJO to hold the output of the measure function. 10 | */ 11 | public class MeasureOutput { 12 | 13 | public float width; 14 | public float height; 15 | } 16 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/java/com/taobao/weex/utils/WXDataStructureUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.taobao.weex.utils; 17 | 18 | import java.util.HashMap; 19 | 20 | public class WXDataStructureUtil { 21 | 22 | /** 23 | * The largest power of two that can be represented as an {@code int}. 24 | */ 25 | private static final int MAX_POWER_OF_TWO = 1 << (Integer.SIZE - 2); 26 | 27 | /** 28 | * Creates a {@code HashMap} instance, with a high enough "initial capacity" that it should 29 | * hold {@code expectedSize} elements without growth. This behavior cannot be broadly guaranteed, 30 | * but it is observed to be true for OpenJDK 1.7. It also can't be guaranteed that the method 31 | * isn't inadvertently oversizing the returned map. 32 | * 33 | * @param expectedSize the number of entries you expect to add to the returned map 34 | * @return a new, empty {@code HashMap} with enough capacity to hold {@code expectedSize} entries 35 | * without resizing 36 | * @throws IllegalArgumentException if {@code expectedSize} is negative 37 | */ 38 | public static HashMap newHashMapWithExpectedSize(int expectedSize) { 39 | return new HashMap<>(capacity(expectedSize)); 40 | } 41 | 42 | /** 43 | * Returns a capacity that is sufficient to keep the map from being resized as long as it grows no 44 | * larger than expectedSize and the load factor is >= its default (0.75). 45 | */ 46 | private static int capacity(int expectedSize) { 47 | if (expectedSize < 3) { 48 | checkNonnegative(expectedSize, "expectedSize"); 49 | return expectedSize + 1; 50 | } 51 | if (expectedSize < MAX_POWER_OF_TWO) { 52 | // This is the calculation used in JDK8 to resize when a putAll 53 | // happens; it seems to be the most conservative calculation we 54 | // can make. 0.75 is the default load factor. 55 | return (int) ((float) expectedSize / 0.75F + 1.0F); 56 | } 57 | return Integer.MAX_VALUE; // any large value 58 | } 59 | 60 | private static int checkNonnegative(int value, String name) { 61 | if (value < 0) { 62 | throw new IllegalArgumentException(name + " cannot be negative but was: " + value); 63 | } 64 | return value; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /MyApplication/weex_sdk/src/main/res/drawable/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/MyApplication/weex_sdk/src/main/res/drawable/error.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WeexDemo 2 | 3 | ``` 4 | 自己学weex时写的demo -功能齐全(Fresco图片加载、okHttp的网络请求、viewpager效果实现、js与native交互等等) 5 | ``` 6 | 7 | 8 | 9 | --- 10 | 11 | 12 |   13 | 14 | 15 | ## 目录说明: 16 | weexfeed 为weex源文件 17 | MyApplication 为android工程 18 | 19 | ## 依赖: 20 | weexfeed依赖 weex0.8.0 21 | MyApplication 中weexSDk是 0.10.0的基础上做了修改 22 | 23 | ## 功能实现: 24 | Fresco图片加载、okHttp的网络请求、viewpager效果实现、js与native交互等等 25 | 26 | ## 支持: 27 | [我的技术博客](http://www.jianshu.com/u/884c2e4b6e38) 28 | 参考Android工程 [MyApplication](https://github.com/wangweiqi23/WeexDemo/tree/master/MyApplication) 或者移步 [wiki](https://github.com/wangweiqi23/WeexDemo/wiki) 还有提 issues吧 29 | -------------------------------------------------------------------------------- /Weex.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/Weex.pptx -------------------------------------------------------------------------------- /apk/release-700000.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/apk/release-700000.apk -------------------------------------------------------------------------------- /photo/app_pro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/photo/app_pro.png -------------------------------------------------------------------------------- /photo/page1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/photo/page1.jpg -------------------------------------------------------------------------------- /photo/page2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/photo/page2.jpg -------------------------------------------------------------------------------- /photo/weexfeed_pro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangweiqi23/WeexDemo/b9384bdb190500314f453182968aad2070a084d0/photo/weexfeed_pro.png -------------------------------------------------------------------------------- /weexfeed/README.md: -------------------------------------------------------------------------------- 1 | # langkeWeex 2 | 3 | ## How to start 4 | 5 | ### Install dependencies 6 | cd path/to/project and install dependencies. 7 | 8 | ``` 9 | npm install 10 | ``` 11 | 进入项目根目录,执行install命令,安装package.json中相关的依赖。 12 | ### Development 13 | 14 | * `npm run build`: build `src/main.we` into `build/main.js` 15 | * `npm run dev`: watch file changes of `src/main.we` and automatically build into `build/main.js` 16 | * `npm run serve`: preview in html5 renderer through `http://localhost:8080/` 17 | 18 | *note: the entry file can be configured in `webpack.config.js`, learn more from [weex-loader](https://www.npmjs.com/package/weex-loader)* 19 | 20 | Finally the generated code will be found in `src/build/` folder. 21 | 22 | --- 23 | 24 | 1,将.we源文件转换为对应的js文件,位于src/build目录。 25 | 26 | ``` 27 | npm run build 28 | ``` 29 | 2,监控文件变化,改动代码后自动build,实时看效果。 30 | 31 | ``` 32 | npm run dev 33 | ``` 34 | 35 | 3,开启本地server服务,端口可自定义,可用pc浏览器调试H5页面。 36 | 37 | ``` 38 | npm run serve 39 | ``` 40 | 41 | ### debug and run 42 | 43 | 开启server后,浏览器输入http://localhost:8888/,可以预览页面。localhost改为自己电脑的ip地址,方便pc和app中查看效果。 44 | 45 | 3.1,在APP中渲染: 46 | 47 | build后的目标代码,将对应的url生成二维码后,用官方的playground扫描二维码,可以在app中渲染: 48 | http://192.168.100.47:8080/src/build/main.js 49 | 50 | 3.2,在浏览器中预览页面效果: 51 | 52 | http://192.168.100.47:8080/index.html?page=./src/build/main.js 53 | 54 | 55 | 4,js文件打包上传说明 dist文件夹下全部文件打zip包 包名为weex.zip 取md5值 版本值需大于发出版本 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /weexfeed/dist/home/view/page-ad.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ({ 44 | 45 | /***/ 0: 46 | /***/ function(module, exports, __webpack_require__) { 47 | 48 | var __weex_template__ = __webpack_require__(97) 49 | var __weex_style__ = __webpack_require__(98) 50 | var __weex_script__ = __webpack_require__(99) 51 | 52 | __weex_define__('@weex-component/d78fe96b487c3ab276917f8be1513214', [], function(__weex_require__, __weex_exports__, __weex_module__) { 53 | 54 | __weex_script__(__weex_module__, __weex_exports__, __weex_require__) 55 | if (__weex_exports__.__esModule && __weex_exports__.default) { 56 | __weex_module__.exports = __weex_exports__.default 57 | } 58 | 59 | __weex_module__.exports.template = __weex_template__ 60 | 61 | __weex_module__.exports.style = __weex_style__ 62 | 63 | }) 64 | 65 | __weex_bootstrap__('@weex-component/d78fe96b487c3ab276917f8be1513214',undefined,undefined) 66 | 67 | /***/ }, 68 | 69 | /***/ 97: 70 | /***/ function(module, exports) { 71 | 72 | module.exports = { 73 | "type": "div", 74 | "classList": [ 75 | "root" 76 | ], 77 | "children": [ 78 | { 79 | "type": "div", 80 | "classList": [ 81 | "item" 82 | ], 83 | "repeat": { 84 | "expression": function () {return this.items}, 85 | "value": "item" 86 | }, 87 | "attr": { 88 | "url": function () {return this.item.and_link_url} 89 | }, 90 | "events": { 91 | "click": "onItemClick" 92 | }, 93 | "children": [ 94 | { 95 | "type": "image", 96 | "classList": [ 97 | "image" 98 | ], 99 | "attr": { 100 | "src": function () {return this.item.img_url}, 101 | "quality": "normal" 102 | } 103 | }, 104 | { 105 | "type": "text", 106 | "classList": [ 107 | "title" 108 | ], 109 | "attr": { 110 | "value": function () {return this.item.name} 111 | } 112 | } 113 | ] 114 | } 115 | ] 116 | } 117 | 118 | /***/ }, 119 | 120 | /***/ 98: 121 | /***/ function(module, exports) { 122 | 123 | module.exports = { 124 | "root": { 125 | "flexDirection": "row" 126 | }, 127 | "item": { 128 | "alignItems": "center", 129 | "padding": 10, 130 | "flex": 1 131 | }, 132 | "image": { 133 | "justifyContent": "center", 134 | "width": 80, 135 | "height": 80 136 | }, 137 | "title": { 138 | "justifyContent": "center", 139 | "fontSize": 22, 140 | "color": "#333333", 141 | "paddingTop": 10 142 | } 143 | } 144 | 145 | /***/ }, 146 | 147 | /***/ 99: 148 | /***/ function(module, exports) { 149 | 150 | module.exports = function(module, exports, __weex_require__){"use strict"; 151 | 152 | var event = __weex_require__('@weex-module/event'); 153 | module.exports = { 154 | data: function () {return { 155 | items: [] 156 | }}, 157 | methods: { 158 | onItemClick: function onItemClick(e) { 159 | console.log("mothod onItemClick and_link_url:" + e.target.attr.url); 160 | event.openSpecifiedPage(e.target.attr.url, null); 161 | } 162 | } 163 | };} 164 | /* generated by weex-loader */ 165 | 166 | 167 | /***/ } 168 | 169 | /******/ }); -------------------------------------------------------------------------------- /weexfeed/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Weex HTML5 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /weexfeed/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "langkeWeex", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "webpack", 8 | "dev": "webpack --watch", 9 | "serve": "serve -p 8888", 10 | "devserve": "webpack --watch & serve -p 8888", 11 | "test": "echo \"Error: no test specified\" && exit 1" 12 | }, 13 | "keywords": [], 14 | "author": "", 15 | "license": "ISC", 16 | "devDependencies": { 17 | "babel-core": "^6.18.0", 18 | "babel-loader": "^6.2.5", 19 | "babel-plugin-transform-runtime": "^6.15.0", 20 | "babel-preset-es2015": "^6.14.0", 21 | "babel-runtime": "^6.11.6", 22 | "serve": "^1.4.0", 23 | "webpack": "^1.13.1", 24 | "weex-html5": "^0.4.1", 25 | "weex-loader": "^0.3.4", 26 | "weex-components": "^0.2.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /weexfeed/src/common/api.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by weiqi on 16/6/8. 3 | * 网络接口 4 | */ 5 | 6 | 7 | // var stream = require('@weex-module/stream');//说是0.15已经支持,但是我没生效 8 | 9 | var stream 10 | __weex_define__('@weex-temp/api', function (__weex_require__) { 11 | stream = __weex_require__('@weex-module/stream') 12 | }); 13 | 14 | var endPointCdn = { 15 | baseUrlOfficial: 'https://sns..com', 16 | baseUrlTest: 'https://qas..com:8101', 17 | baseCdnUrlOfficial: 'http://cdn..com', 18 | baseCdnUrlTest: 'http://51jinyi.top' 19 | }; 20 | 21 | var apiURL = { 22 | feedBack: '/LVBPages/api/ApiSuggest/Suggest?reqtype=Server', 23 | mostHotLive: '/Home/Channel/GetMostHotLive', 24 | bannerList: '/Home/Channel/GetBannerList', 25 | getHomePageOperation: '/Home/Channel/GetHomePageOperation' 26 | }; 27 | 28 | exports.postFeedback = function (env, body, callback) { 29 | postData(getEndPoint(env, endPointCdn.baseUrlOfficial, endPointCdn.baseUrlTest) + apiURL.feedBack, body, callback); 30 | }; 31 | exports.getMostHotLive = function (env, flag, callback) { 32 | getData(getEndPoint(env, endPointCdn.baseCdnUrlOfficial, endPointCdn.baseCdnUrlTest) + apiURL.mostHotLive + flag, callback); 33 | }; 34 | exports.getBannerList = function (env, callback) { 35 | getData(getEndPoint(env, endPointCdn.baseCdnUrlOfficial, endPointCdn.baseCdnUrlTest) + apiURL.bannerList, callback); 36 | }; 37 | exports.getHomePageOperation = function (env, callback) { 38 | getData(getEndPoint(env, endPointCdn.baseCdnUrlOfficial, endPointCdn.baseCdnUrlTest)+ apiURL.getHomePageOperation, callback); 39 | }; 40 | exports.postPayPageInfo = function (env, body, callback) { 41 | postData(getEndPoint(env, endPointCdn.basePayUrlOfficial, endPointCdn.basePayUrlTest) + apiURL.payPageInfo, body, callback); 42 | }; 43 | exports.postCreateOrderInfoAli = function (env, body, callback) { 44 | postData(getEndPoint(env, endPointCdn.basePayUrlOfficial, endPointCdn.basePayUrlTest) + apiURL.createOrderInfoAli, body, callback); 45 | }; 46 | exports.postCreateOrderInfoWechat = function (env, body, callback) { 47 | postData(getEndPoint(env, endPointCdn.basePayUrlOfficial, endPointCdn.basePayUrlTest)+ apiURL.createOrderInfoWechat, body, callback); 48 | }; 49 | exports.postPayCallBackAli = function (env, body, callback) { 50 | postData(getEndPoint(env, endPointCdn.basePayUrlOfficial, endPointCdn.basePayUrlTest) + apiURL.payCallBackAli, body, callback); 51 | }; 52 | exports.postPayCallBackWechat = function (env, body, callback) { 53 | postData(getEndPoint(env, endPointCdn.basePayUrlOfficial, endPointCdn.basePayUrlTest) + apiURL.payCallBackWechat, body, callback); 54 | }; 55 | 56 | function getData(url, callback) { 57 | console.log("https get url="+url); 58 | stream.fetch({ 59 | method: 'GET', 60 | type:'json', 61 | url: url 62 | }, function (ret) { 63 | // var retdata = JSON.parse(ret); 64 | callback(ret.data); 65 | }); 66 | } 67 | function postData(url, body, callback) { 68 | console.log("https post url="+url+" body="+body); 69 | stream.fetch({ 70 | method: 'POST', 71 | url: url, 72 | type:'json', 73 | body: body 74 | }, function (ret) { 75 | //var retdata = JSON.stringify(ret.data); 76 | callback(ret.data); 77 | }); 78 | } 79 | 80 | function getEndPoint(env, officialUrl, testUrl) { 81 | env = new String(env); 82 | if('official' == env){ 83 | return officialUrl; 84 | }else{ 85 | return testUrl; 86 | } 87 | } 88 | 89 | exports.getBaseUrl = function (bundleUrl, isnav) { 90 | bundleUrl = new String(bundleUrl); 91 | var nativeBase; 92 | var isAndroidAssets = bundleUrl.indexOf('file://assets/') >= 0; 93 | 94 | var isiOSAssets = bundleUrl.indexOf('file:///') >= 0 && bundleUrl.indexOf('WeexFeed.app') > 0; 95 | if (isAndroidAssets) { 96 | nativeBase = 'file://assets/dist/'; 97 | } 98 | else if (isiOSAssets) { 99 | nativeBase = bundleUrl.substring(0, bundleUrl.lastIndexOf('/') + 1); 100 | } 101 | else { 102 | var host = 'localhost:8888'; 103 | var matches = /\/\/([^\/]+?)\//.exec(bundleUrl); 104 | if (matches && matches.length >= 2) { 105 | host = matches[1]; 106 | } 107 | 108 | //此处需注意一下,tabbar 用的直接是jsbundle 的路径,但是navigator是直接跳转到新页面上的. 109 | if (typeof window === 'object') { 110 | nativeBase = isnav ? 'http://' + host + '/index.html?page=./dist/' : '/dist/'; 111 | } else { 112 | nativeBase = 'http://' + host + '/dist/'; 113 | } 114 | } 115 | 116 | return nativeBase; 117 | }; -------------------------------------------------------------------------------- /weexfeed/src/home/home-live.we: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 83 | 84 | 99 | -------------------------------------------------------------------------------- /weexfeed/src/home/homeConstants.js: -------------------------------------------------------------------------------- 1 | /** 2 | *create by 2016-11-28 3 | *@author weiqi 4 | *BASE64 Encode and Decode By UTF-8 unicode 5 | *可以和java的BASE64编码和解码互相转化 6 | */ 7 | exports.CHANNEL_TYPE_LIVE = 0; 8 | exports.CHANNEL_TYPE_VOD = 1; -------------------------------------------------------------------------------- /weexfeed/src/home/view/banner-view.we: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 33 | 34 | 53 | -------------------------------------------------------------------------------- /weexfeed/src/home/view/page-ad.we: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{item.name}} 7 | 8 | 9 | 10 | 11 | 25 | 26 | -------------------------------------------------------------------------------- /weexfeed/src/home/view/page-item.we: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{pages[0].title}} 6 | {{pages[1].title}} 7 | {{pages[2].title}} 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 97 | 98 | -------------------------------------------------------------------------------- /weexfeed/src/me/loading-button.we: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 45 | 46 | 100 | 101 | -------------------------------------------------------------------------------- /weexfeed/src/weexfeed.we: -------------------------------------------------------------------------------- 1 | 2 | 跳转 3 | 4 | 5 | 40 | -------------------------------------------------------------------------------- /weexfeed/webpack.config.js: -------------------------------------------------------------------------------- 1 | require('webpack') 2 | require('weex-loader') 3 | 4 | var path = require('path') 5 | var fs = require('fs') 6 | 7 | var entry = {}; 8 | function walk(dir, root) { 9 | var directory = path.join(__dirname, root, dir) 10 | fs.readdirSync(directory) 11 | .forEach(function (file) { 12 | var fullpath = path.join(directory, file) 13 | var stat = fs.statSync(fullpath) 14 | 15 | if (stat.isFile() && 16 | path.extname(fullpath) === '.we') { 17 | var name = path.join(dir, path.basename(file, '.we')) 18 | entry[name] = fullpath + '?entry=true' 19 | } else if (stat.isDirectory()) { 20 | var subdir = path.join(dir, file) 21 | walk(subdir, root) 22 | } 23 | }) 24 | } 25 | walk('./', 'src'); 26 | module.exports = { 27 | entry: entry, 28 | output: { 29 | path: 'dist', 30 | filename: '[name].js' 31 | }, 32 | module: { 33 | loaders: [ 34 | { 35 | test: /\.we(\?[^?]+)?$/, 36 | loaders: ['weex-loader'] 37 | } 38 | ] 39 | } 40 | }; 41 | --------------------------------------------------------------------------------