├── .gitignore
├── CHANGELOG.md
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── benmu
│ │ └── erosframework
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── benmu
│ │ │ └── erosframework
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── benmu
│ └── erosframework
│ └── ExampleUnitTest.java
├── build.gradle
├── eros-framework
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── eros
│ │ └── framework
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ ├── bm-chart.html
│ │ └── echarts.min.js
│ ├── java
│ │ └── com
│ │ │ └── eros
│ │ │ └── framework
│ │ │ ├── BMInitConfig.java
│ │ │ ├── BMWXApplication.java
│ │ │ ├── BMWXEngine.java
│ │ │ ├── PlugManager.java
│ │ │ ├── activity
│ │ │ ├── AbstractWeexActivity.java
│ │ │ ├── AndroidBug5497Workaround.java
│ │ │ ├── BrowseImgActivity.java
│ │ │ ├── DebugActivity.java
│ │ │ ├── GlobalWebViewActivity.java
│ │ │ └── MainActivity.java
│ │ │ ├── adapter
│ │ │ ├── BMDefaultUriAdapter.java
│ │ │ ├── DefaultImageAdapter.java
│ │ │ ├── DefaultNavigationAdapter.java
│ │ │ ├── router
│ │ │ │ └── DefaultRouterAdapter.java
│ │ │ └── ws
│ │ │ │ ├── BMWSCode.java
│ │ │ │ ├── DefaultWebSocketAdapter.java
│ │ │ │ └── WSConfig.java
│ │ │ ├── constant
│ │ │ └── WXConstant.java
│ │ │ ├── debug
│ │ │ └── ws
│ │ │ │ ├── DebuggerWebSocket.java
│ │ │ │ └── Instruction.java
│ │ │ ├── event
│ │ │ ├── EventCommunication.java
│ │ │ ├── GlobalEvent.java
│ │ │ ├── TabbarEvent.java
│ │ │ ├── UpdateJsBundleEvent.java
│ │ │ ├── browse
│ │ │ │ └── EventBrowse.java
│ │ │ ├── camera
│ │ │ │ ├── EventCamera.java
│ │ │ │ └── EventImage.java
│ │ │ ├── http
│ │ │ │ ├── EventFetch.java
│ │ │ │ └── callback
│ │ │ │ │ └── AxiosResponseCallback.java
│ │ │ ├── mediator
│ │ │ │ └── EventCenter.java
│ │ │ ├── modal
│ │ │ │ ├── EventAlert.java
│ │ │ │ ├── EventConfirm.java
│ │ │ │ ├── EventDismissLoading.java
│ │ │ │ ├── EventShowLoading.java
│ │ │ │ └── EventToast.java
│ │ │ ├── nav
│ │ │ │ ├── EventCenterItem.java
│ │ │ │ ├── EventLeftItem.java
│ │ │ │ ├── EventNavigationInfo.java
│ │ │ │ ├── EventRightItem.java
│ │ │ │ └── NavigationEventGate.java
│ │ │ ├── router
│ │ │ │ ├── EventBack.java
│ │ │ │ ├── EventCall.java
│ │ │ │ ├── EventFinish.java
│ │ │ │ ├── EventGetBackParams.java
│ │ │ │ ├── EventGetParams.java
│ │ │ │ ├── EventNav.java
│ │ │ │ ├── EventOpen.java
│ │ │ │ ├── EventOpenBrowser.java
│ │ │ │ ├── EventRefresh.java
│ │ │ │ ├── EventSetHomePage.java
│ │ │ │ ├── EventToMap.java
│ │ │ │ └── EventWebView.java
│ │ │ ├── shorage
│ │ │ │ ├── EventDeleteData.java
│ │ │ │ ├── EventGetData.java
│ │ │ │ ├── EventRemoveData.java
│ │ │ │ └── EventSetData.java
│ │ │ └── tool
│ │ │ │ └── EventTool.java
│ │ │ ├── extend
│ │ │ ├── adapter
│ │ │ │ ├── DefaultTypefaceAdapter.java
│ │ │ │ ├── DefaultWXHttpAdapter.java
│ │ │ │ ├── LightlyWebSocketAdapter.java
│ │ │ │ ├── LightlyWebSocketFactory.java
│ │ │ │ ├── WeexOkhttp3Interceptor.java
│ │ │ │ └── image
│ │ │ │ │ ├── CornerRadiusTransformation.java
│ │ │ │ │ ├── DefaultImageViewTarget.java
│ │ │ │ │ └── DefaultWXImageAdapter.java
│ │ │ ├── comoponents
│ │ │ │ ├── BMCalendar.java
│ │ │ │ ├── BMChart.java
│ │ │ │ ├── BMMask.java
│ │ │ │ ├── BMPop.java
│ │ │ │ ├── BMRich.java
│ │ │ │ ├── BMSpan.java
│ │ │ │ ├── BMView.java
│ │ │ │ ├── BMWXText.java
│ │ │ │ └── view
│ │ │ │ │ ├── BMMaskLayout.java
│ │ │ │ │ ├── BMWXTextView.java
│ │ │ │ │ ├── BMWebView.java
│ │ │ │ │ ├── BMWebViewPool.java
│ │ │ │ │ └── BMWebViewWrapper.java
│ │ │ ├── dom
│ │ │ │ └── richtext
│ │ │ │ │ └── RichTextDomObject.java
│ │ │ ├── hook
│ │ │ │ ├── HookConstants.java
│ │ │ │ ├── TypeFaceHandler.java
│ │ │ │ └── ui
│ │ │ │ │ ├── components
│ │ │ │ │ ├── BMWXWebView.java
│ │ │ │ │ ├── HookImage.java
│ │ │ │ │ ├── HookInput.java
│ │ │ │ │ ├── HookListComponent.java
│ │ │ │ │ ├── HookTextarea.java
│ │ │ │ │ ├── HookWXText.java
│ │ │ │ │ ├── HookWeb.java
│ │ │ │ │ └── HookWxScroller.java
│ │ │ │ │ └── view
│ │ │ │ │ ├── HookBounceRecyclerView.java
│ │ │ │ │ ├── HookBounceScrollerView.java
│ │ │ │ │ ├── HookWXHorizontalScrollView.java
│ │ │ │ │ ├── HookWXImageView.java
│ │ │ │ │ └── refresh
│ │ │ │ │ ├── bmrefresh
│ │ │ │ │ ├── BMBaseRefresh.java
│ │ │ │ │ └── BMLoadingRefresh.java
│ │ │ │ │ └── loadmore
│ │ │ │ │ ├── BaseLoadMore.java
│ │ │ │ │ └── LoadingLoadMore.java
│ │ │ ├── mediator
│ │ │ │ ├── MediatorDocker.java
│ │ │ │ └── MediatorInstance.java
│ │ │ └── module
│ │ │ │ ├── AppConfigModule.java
│ │ │ │ ├── AxiosModule.java
│ │ │ │ ├── BrowserImgModule.java
│ │ │ │ ├── CameraModule.java
│ │ │ │ ├── CommunicationModule.java
│ │ │ │ ├── EventModule.java
│ │ │ │ ├── GeolocationModule.java
│ │ │ │ ├── ImageModule.java
│ │ │ │ ├── ModalModule.java
│ │ │ │ ├── RouterModule.java
│ │ │ │ ├── StorageModule.java
│ │ │ │ ├── TabBarModule.java
│ │ │ │ ├── TitleModule.java
│ │ │ │ ├── ToolModule.java
│ │ │ │ ├── UpdateModule.java
│ │ │ │ └── WebSocketModule.java
│ │ │ ├── fragment
│ │ │ ├── AbstractWeexFragment.java
│ │ │ └── MainWeexFragment.java
│ │ │ ├── manager
│ │ │ └── impl
│ │ │ │ ├── AxiosManager.java
│ │ │ │ ├── CameraManager.java
│ │ │ │ ├── CommunicationManager.java
│ │ │ │ ├── ConnectivityManager.java
│ │ │ │ ├── CustomerEnvOptionManager.java
│ │ │ │ ├── GlobalEventManager.java
│ │ │ │ ├── ImageManager.java
│ │ │ │ ├── LifecycleManager.java
│ │ │ │ ├── ModalManager.java
│ │ │ │ ├── PersistentManager.java
│ │ │ │ ├── RouterManager.java
│ │ │ │ ├── VersionManager.java
│ │ │ │ └── status
│ │ │ │ ├── AndroidMHelper.java
│ │ │ │ ├── FlymeHelper.java
│ │ │ │ ├── Helper.java
│ │ │ │ ├── IHelper.java
│ │ │ │ ├── MIUIHelper.java
│ │ │ │ └── StatusBarManager.java
│ │ │ ├── model
│ │ │ ├── AppConfigBean.java
│ │ │ ├── AxiosGet.java
│ │ │ ├── AxiosPost.java
│ │ │ ├── AxiosResultBean.java
│ │ │ ├── BMScrollBean.java
│ │ │ ├── BroeserImgModuleBean.java
│ │ │ ├── CallPhoneBean.java
│ │ │ ├── CameraResultBean.java
│ │ │ ├── CidBean.java
│ │ │ ├── JsVersionInfoBean.java
│ │ │ ├── Md5MapperModel.java
│ │ │ ├── MedicalMapModel.java
│ │ │ ├── ModalBean.java
│ │ │ ├── NatigatorModel.java
│ │ │ ├── NavModule.java
│ │ │ ├── NavigatorBarModel.java
│ │ │ ├── NavigatorModel.java
│ │ │ ├── RequestUrlBean.java
│ │ │ ├── RouterModel.java
│ │ │ ├── ScanImageBean.java
│ │ │ ├── TabbarBadgeModule.java
│ │ │ ├── TabbarWatchBean.java
│ │ │ ├── TitleModel.java
│ │ │ ├── UpdateOptionBean.java
│ │ │ ├── UploadImageBean.java
│ │ │ ├── UploadResultBean.java
│ │ │ ├── VersionBean.java
│ │ │ ├── WebViewParamBean.java
│ │ │ └── WeexEnvironment.java
│ │ │ ├── proxy
│ │ │ └── SplashActivityProxy.java
│ │ │ ├── receiver
│ │ │ └── NetworkReceiver.java
│ │ │ ├── update
│ │ │ └── VersionChecker.java
│ │ │ ├── utils
│ │ │ ├── AESUtils.java
│ │ │ ├── AppUtils.java
│ │ │ ├── AssetsUtil.java
│ │ │ ├── BMRichUtil.java
│ │ │ ├── BaseJsInjector.java
│ │ │ ├── DateFormatUtil.java
│ │ │ ├── FastXmlSerializer.java
│ │ │ ├── GeoUtils.java
│ │ │ ├── IOUtil.java
│ │ │ ├── ImageCornerUtil.java
│ │ │ ├── InsertEnvUtil.java
│ │ │ ├── Md5Util.java
│ │ │ ├── MultipleFileDownloader.java
│ │ │ ├── NetworkUtil.java
│ │ │ ├── PermissionUtils.java
│ │ │ ├── RouterUtil.java
│ │ │ ├── TabbarListener.java
│ │ │ ├── TextUtil.java
│ │ │ ├── WXAnalyzerDelegate.java
│ │ │ ├── WXCommonUtil.java
│ │ │ └── XmlUtil.java
│ │ │ └── view
│ │ │ ├── CircleTextView.java
│ │ │ ├── NoScrollViewPager.java
│ │ │ ├── TableItemView.java
│ │ │ ├── TableView.java
│ │ │ └── ViewPagerFix.java
│ └── res
│ │ ├── anim
│ │ ├── anim_alhpa_hide.xml
│ │ ├── anim_alpha_show.xml
│ │ ├── anim_bottom_in.xml
│ │ ├── anim_bottom_out.xml
│ │ ├── anim_enlarge.xml
│ │ ├── anim_reduce.xml
│ │ ├── anim_topin.xml
│ │ ├── anim_topout.xml
│ │ ├── bottom_in.xml
│ │ ├── bottom_out.xml
│ │ ├── left_in.xml
│ │ ├── left_out.xml
│ │ ├── right_in.xml
│ │ ├── right_out.xml
│ │ └── view_stay.xml
│ │ ├── drawable-xhdpi
│ │ ├── ic_refresh.png
│ │ ├── icon_share.png
│ │ ├── infowindow_marker_icon.png
│ │ ├── loadding0001.png
│ │ ├── loadding0002.png
│ │ ├── loadding0003.png
│ │ ├── loadding0004.png
│ │ ├── loadding0005.png
│ │ ├── loadding0006.png
│ │ ├── loadding0007.png
│ │ ├── loadding0008.png
│ │ ├── loadding0009.png
│ │ ├── loadding0010.png
│ │ ├── loadding0011.png
│ │ ├── loadding0012.png
│ │ ├── loadding0013.png
│ │ ├── loadding0014.png
│ │ ├── loadding0015.png
│ │ ├── loadding0016.png
│ │ ├── loadding0017.png
│ │ ├── loadding0018.png
│ │ ├── loadding0019.png
│ │ ├── loadding0020.png
│ │ ├── loadding0021.png
│ │ ├── loadding0022.png
│ │ ├── loadding0023.png
│ │ ├── loadding0024.png
│ │ ├── loadding0025.png
│ │ ├── loadding0026.png
│ │ ├── loadding0027.png
│ │ ├── loadding0028.png
│ │ └── shape_red_point.xml
│ │ ├── drawable
│ │ ├── bg_fffff_concer8.xml
│ │ ├── browse_shape_off.xml
│ │ ├── browse_shape_on.xml
│ │ └── sdk_bmloading.xml
│ │ ├── layout
│ │ ├── activity_browse.xml
│ │ ├── activity_debug.xml
│ │ ├── activity_main.xml
│ │ ├── activity_webview.xml
│ │ ├── fragment_base_main_layout.xml
│ │ ├── layout_amap_marker.xml
│ │ ├── layout_amap_window.xml
│ │ ├── layout_root.xml
│ │ ├── sdk_layout_bmloading.xml
│ │ ├── view_tab_item_layout.xml
│ │ ├── view_tab_layout.xml
│ │ └── viewstub_table_layout.xml
│ │ ├── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ │ └── xml
│ │ ├── app_config.xml
│ │ └── filepaths.xml
│ └── test
│ └── java
│ └── com
│ └── eros
│ └── framework
│ └── ExampleUnitTest.java
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | .idea
4 | /local.properties
5 | /.idea/workspace.xml
6 | /.idea/libraries
7 | .DS_Store
8 | /build
9 | /captures
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WeexErosFramework
2 | eros android framework.
3 |
4 | ```
5 | dependencies {
6 | implementation 'com.github.bmfe:WeexErosFramework:1.0.4'
7 | }
8 | ```
9 | [](https://jitpack.io/#bmfe/WeexErosFramework)
10 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | defaultConfig {
6 | applicationId "com.benmu.erosframework"
7 | minSdkVersion 16
8 | targetSdkVersion 25
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | buildToolsVersion '26.0.2'
21 | }
22 |
23 | dependencies {
24 | compile fileTree(include: ['*.jar'], dir: 'libs')
25 | compile 'com.android.support:appcompat-v7:25.3.1'
26 | compile 'com.android.support.constraint:constraint-layout:1.1.0'
27 | testCompile 'junit:junit:4.12'
28 | compile project(':eros-framework')
29 | }
30 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/benmu/erosframework/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.benmu.erosframework;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.benmu.erosframework", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benmu/erosframework/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.benmu.erosframework;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class MainActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/WeexErosFramework/51ac770e8fa5695c2a49d6b9712cdac7476863f6/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/WeexErosFramework/51ac770e8fa5695c2a49d6b9712cdac7476863f6/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/WeexErosFramework/51ac770e8fa5695c2a49d6b9712cdac7476863f6/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/WeexErosFramework/51ac770e8fa5695c2a49d6b9712cdac7476863f6/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/WeexErosFramework/51ac770e8fa5695c2a49d6b9712cdac7476863f6/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/WeexErosFramework/51ac770e8fa5695c2a49d6b9712cdac7476863f6/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/WeexErosFramework/51ac770e8fa5695c2a49d6b9712cdac7476863f6/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/WeexErosFramework/51ac770e8fa5695c2a49d6b9712cdac7476863f6/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/WeexErosFramework/51ac770e8fa5695c2a49d6b9712cdac7476863f6/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmfe/WeexErosFramework/51ac770e8fa5695c2a49d6b9712cdac7476863f6/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | eros-framework
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/benmu/erosframework/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.benmu.erosframework;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/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 | google()
7 | mavenCentral()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.1.3'
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | jcenter()
20 | google()
21 | mavenCentral()
22 | maven { url 'https://jitpack.io' }
23 | }
24 | }
25 |
26 | task clean(type: Delete) {
27 | delete rootProject.buildDir
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/eros-framework/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/eros-framework/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 | group = 'com.github.aa453509345'
4 | android {
5 | compileSdkVersion 25
6 | buildToolsVersion "26.0.2"
7 |
8 |
9 | defaultConfig {
10 | minSdkVersion 16
11 | targetSdkVersion 25
12 | versionCode 1
13 | versionName "1.0"
14 |
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 | javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | lintOptions {
26 | abortOnError false
27 | }
28 |
29 | }
30 |
31 | dependencies {
32 | compile fileTree(include: ['*.jar'], dir: 'libs')
33 | compile 'com.android.support:appcompat-v7:25.3.1'
34 | testCompile 'junit:junit:4.12'
35 | androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.2', {
36 | exclude group: 'com.android.support', module: 'support-annotations'
37 | })
38 | /**
39 | * debug调试要用到的
40 | */
41 | compile 'com.taobao.android.weex_inspection:protocol:1.1.4.1'
42 | compile 'com.taobao.android:weex_inspector:0.13.4'
43 | compile 'com.squareup.okhttp:okhttp-ws:2.3.0'
44 | compile 'com.squareup.okhttp3:okhttp:3.8.0'
45 | compile 'com.lzy.widget:imagepicker:0.6.1'
46 | compile 'com.journeyapps:zxing-android-embedded:3.4.0'
47 | compile 'com.github.chrisbanes.photoview:library:1.2.4'
48 | compile 'com.android.support:multidex:1.0.1'
49 | //bs patch
50 | compile 'me.ele:bspatch:1.0.6'
51 | //weex analyzer
52 | compile 'com.taobao.android:weex_analyzer:0.1.0.5'
53 | //Bindigx
54 | compile 'com.alibaba.android:bindingx-core:1.0.1'
55 | compile 'com.alibaba.android:bindingx_weex_plugin:1.0.2'
56 | compile 'org.weex.plugin:plugin-loader:1.0.0'
57 | compile ('com.github.niorgai:StatusBarCompat:2.1.4', {
58 | exclude group: 'com.android.support'
59 | })
60 | compile project(':nexus')
61 |
62 |
63 | // debugImplementation "com.squareup.leakcanary:leakcanary-android:1.5.4"
64 | // releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:1.5.4"
65 | }
66 |
--------------------------------------------------------------------------------
/eros-framework/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/eros-framework/src/androidTest/java/com/eros/framework/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.benmu.framework;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.benmu.framework.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/eros-framework/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/eros-framework/src/main/assets/bm-chart.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | ECharts
11 |
12 |
13 |
14 |
15 |
16 |
17 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/BMInitConfig.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | /**
7 | * Created by Carry on 2017/8/23.
8 | */
9 |
10 | public class BMInitConfig {
11 |
12 | private Map mEnvs;
13 | private String mActice;
14 |
15 | private BMInitConfig() {
16 | }
17 |
18 | public Map getmEnvs() {
19 | return mEnvs;
20 | }
21 |
22 | public void setmEnvs(Map mEnvs) {
23 | this.mEnvs = mEnvs;
24 | }
25 |
26 | public String getmActice() {
27 | return mActice;
28 | }
29 |
30 | public void setmActice(String mActice) {
31 | this.mActice = mActice;
32 | }
33 |
34 | public static class Builder {
35 | HashMap mCustomerEnv;
36 | private String mActiveInterceptor;
37 |
38 | public Builder setCustomerEnv(HashMap mCustomerEnv) {
39 | this.mCustomerEnv = mCustomerEnv;
40 | return this;
41 | }
42 |
43 | public Builder isActiceInterceptor(String active) {
44 | this.mActiveInterceptor = active;
45 | return this;
46 | }
47 |
48 | public BMInitConfig build() {
49 | BMInitConfig initConfig = new BMInitConfig();
50 | initConfig.mEnvs = this.mCustomerEnv;
51 | initConfig.mActice = this.mActiveInterceptor;
52 | return initConfig;
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/PlugManager.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework;
2 |
3 | import com.eros.framework.constant.Constant;
4 | import com.eros.framework.manager.Manager;
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.impl.CustomerEnvOptionManager;
7 |
8 | import java.util.HashMap;
9 |
10 | /**
11 | * Created by liuyuanxiao on 17/12/5.
12 | */
13 |
14 | public class PlugManager {
15 | public static void initPlug() {
16 | pluginInit("com.plugamap.manager.GeoManager");
17 | pluginInit("com.eros.erosplugingt.manager.PushManager");
18 | }
19 |
20 | private static void pluginInit(String clazzName) {
21 | Manager geoManager = ManagerFactory.getManagerService(clazzName);
22 | if (geoManager != null) {
23 | geoManager.init();
24 | // registerCompnentsAndModules(geoManager.getComponentsAndModules());
25 |
26 | }
27 | }
28 |
29 | /**
30 | * 注册 compent 和 Modules
31 | *
32 | * @param compentAndModules compent 和 Modules 集合
33 | */
34 | private static void registerCompnentsAndModules(HashMap> compentAndModules) {
35 | if (compentAndModules == null) return;
36 | HashMap compents = compentAndModules.get(Constant.CUSTOMER_COMPONETS);
37 | if (compents != null) {
38 | CustomerEnvOptionManager.registerComponents(compents);
39 | }
40 | HashMap modules = compentAndModules.get(Constant.CUSTOMER_MODULES);
41 | if (modules != null) {
42 | CustomerEnvOptionManager.registerModules(compents);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/adapter/ws/BMWSCode.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.adapter.ws;
2 |
3 | /**
4 | * Created by Carry on 2018/1/5.
5 | */
6 |
7 | public enum BMWSCode {
8 | INVALID_INSTANCEID(4001, "无效的实例"), REPEAT_WEBSOCKET(4002, "重复的ws实例"), MODULE_DESTROY(4003,
9 | "module销毁");
10 |
11 |
12 | BMWSCode(int code, String reason) {
13 | this.code = code;
14 | this.reason = reason;
15 | }
16 |
17 | private int code;
18 | private String reason;
19 |
20 |
21 | public int getCode() {
22 | return code;
23 | }
24 |
25 | public void setCode(int code) {
26 | this.code = code;
27 | }
28 |
29 | public String getReason() {
30 | return reason;
31 | }
32 |
33 | public void setReason(String reason) {
34 | this.reason = reason;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/adapter/ws/WSConfig.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.adapter.ws;
2 |
3 | /**
4 | * Created by Carry on 2018/3/15.
5 | */
6 |
7 | public class WSConfig {
8 | private boolean retryOnConnectionFailure;
9 | private long pingInterval;
10 |
11 | public WSConfig(boolean retryOnConnectionFailure, long pingInterval) {
12 | this.retryOnConnectionFailure = retryOnConnectionFailure;
13 | this.pingInterval = pingInterval;
14 | }
15 |
16 | public boolean isRetryOnConnectionFailure() {
17 | return retryOnConnectionFailure;
18 | }
19 |
20 | public void setRetryOnConnectionFailure(boolean retryOnConnectionFailure) {
21 | this.retryOnConnectionFailure = retryOnConnectionFailure;
22 | }
23 |
24 | public long getPingInterval() {
25 | return pingInterval;
26 | }
27 |
28 | public void setPingInterval(long pingInterval) {
29 | this.pingInterval = pingInterval;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/constant/WXConstant.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.constant;
2 |
3 | /**
4 | * Created by Carry on 2017/8/7.
5 | */
6 |
7 | public class WXConstant {
8 |
9 | /**
10 | * -------------调试参数-----------------------
11 | **/
12 | public static final int HOT_REFRESH_CONNECT = 0x111;
13 | public static final int HOT_REFRESH_DISCONNECT = HOT_REFRESH_CONNECT + 1;
14 | public static final int HOT_REFRESH_REFRESH = HOT_REFRESH_DISCONNECT + 1;
15 | public static final int HOT_REFRESH_CONNECT_ERROR = HOT_REFRESH_REFRESH + 1;
16 |
17 | /**
18 | * ----------router moudle回调js参数名--------
19 | **/
20 | public static final String OPEN_PAGE_SUCCESS = "打开页面成功";
21 | public static final String OPNE_PAGE_FAILED = "打开页面失败";
22 |
23 | public static final String BACK_PAGE_SUCCESS = "关闭页面成功";
24 | public static final String BACK_PAGE_FAILED = "关闭页面失败";
25 |
26 | public static final String ACTION_WEEX_REFRESH = "ACTION_WEEX_REFRESH";
27 | //拦截器状态发生变化
28 | public static final String ACTION_INTERCEPTOR_SWTICH = "ACTION_INTERCEPTOR_SWTICH";
29 | //初始化激活中介者
30 | public static final String MEDIATOR_INIT = "MEDIATOR_INIT";
31 | //销毁中介者
32 | public static final String MEDIATOR_DESTROY = "MEDIATOR_DESTROY";
33 | //网络状态变化
34 | public static final String ACTION_NETWORK_CHANGED = "ACTION_NETWORK_CHANGED";
35 | //更新包下载完成
36 | public static final String ACTION_BUNDLE_DOWNLOADED = "ACTION_BUNDLE_DOWNLOADED";
37 | //activity入栈广播
38 | public static final String ACTION_ACTIVITY_ATTACH = "ACTION_ACTIVITY_PUSH";
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/debug/ws/Instruction.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.debug.ws;
2 |
3 | /**
4 | * Created by Carry on 2018/3/15.
5 | */
6 |
7 | public class Instruction {
8 | public static final String REFRESH = "SERVER/JS_BUNDLE_CHANGED";
9 | }
10 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/EventCommunication.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event;
2 |
3 | import android.Manifest;
4 | import android.content.Context;
5 |
6 | import com.alibaba.fastjson.JSON;
7 | import com.eros.framework.constant.WXEventCenter;
8 | import com.eros.framework.manager.ManagerFactory;
9 | import com.eros.framework.manager.impl.CommunicationManager;
10 | import com.eros.framework.manager.impl.PermissionManager;
11 | import com.eros.framework.manager.impl.dispatcher.DispatchEventManager;
12 | import com.eros.framework.model.AxiosResultBean;
13 | import com.eros.framework.model.WeexEventBean;
14 | import com.eros.framework.utils.PermissionUtils;
15 | import com.eros.wxbase.EventGate;
16 | import com.squareup.otto.Subscribe;
17 | import com.taobao.weex.bridge.JSCallback;
18 |
19 | import java.util.List;
20 |
21 | /**
22 | * Created by liuyuanxiao on 17/12/29.
23 | */
24 |
25 | public class EventCommunication extends EventGate {
26 | private JSCallback mContactsCallBack;
27 |
28 | @Override
29 | public void perform(Context context, WeexEventBean weexEventBean, String type) {
30 | if (WXEventCenter.EVENT_COMMUNICATION_SMS.equals(type)) {
31 | sms(weexEventBean.getExpand().toString(), weexEventBean.getJsParams(), context);
32 | } else if (WXEventCenter.EVENT_COMMUNICATION_CONTACTS.equals(type)) {
33 | contacts(context, weexEventBean.getJscallback());
34 | }
35 | }
36 |
37 | public void sms(String recipients, String params, final Context context) {
38 | List rec = JSON.parseArray(recipients, String.class);
39 | StringBuilder smsList = new StringBuilder();
40 | for (int i = 0; i < rec.size(); i++) {
41 | if (i > 0) {
42 | smsList.append(",");
43 | }
44 | smsList.append(rec.get(i));
45 | }
46 | CommunicationManager routerManager = ManagerFactory.getManagerService(CommunicationManager.class);
47 | routerManager.sms(smsList.toString(), params, context);
48 | }
49 |
50 | public void contacts(final Context context, JSCallback callback) {
51 | if (!PermissionUtils.checkPermission(context, Manifest.permission.READ_CONTACTS)) {
52 | return;
53 | }
54 | mContactsCallBack = callback;
55 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().register(this);
56 | CommunicationManager routerManager = ManagerFactory.getManagerService(CommunicationManager.class);
57 | routerManager.contacts(context);
58 | }
59 |
60 | @Subscribe
61 | public void contactsResult(AxiosResultBean uploadResultBean) {
62 | if (uploadResultBean != null && mContactsCallBack != null) {
63 | mContactsCallBack.invoke(uploadResultBean);
64 | }
65 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().unregister(this);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/GlobalEvent.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 |
6 | import com.eros.framework.activity.AbstractWeexActivity;
7 | import com.eros.framework.adapter.router.RouterTracker;
8 | import com.eros.framework.constant.WXEventCenter;
9 | import com.eros.framework.manager.ManagerFactory;
10 | import com.eros.framework.manager.impl.GlobalEventManager;
11 | import com.eros.framework.manager.impl.ParseManager;
12 | import com.eros.framework.model.BaseEventBean;
13 | import com.eros.wxbase.EventGate;
14 | import com.taobao.weex.WXSDKInstance;
15 |
16 | /**
17 | * Created by liuyuanxiao on 18/4/9.
18 | */
19 |
20 | public class GlobalEvent extends EventGate {
21 |
22 |
23 | @Override
24 | public void perform(Context context, BaseEventBean eventBean) {
25 | if (WXEventCenter.EVENT_PUSHMANAGER.equals(eventBean.type)) {
26 | eventPushMessage(context, eventBean);
27 | }
28 | }
29 |
30 | private void eventPushMessage(Context context, BaseEventBean eventBean) {
31 | Activity activity = RouterTracker.peekActivity();
32 | if (activity instanceof AbstractWeexActivity) {
33 | WXSDKInstance instance = ((AbstractWeexActivity) activity).getWXSDkInstance();
34 | ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
35 | GlobalEventManager.pushMessage(instance, parseManager.parseObject(eventBean.param));
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/UpdateJsBundleEvent.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import com.eros.framework.BMWXApplication;
6 | import com.eros.framework.constant.WXConstant;
7 | import com.eros.framework.constant.WXEventCenter;
8 | import com.eros.framework.manager.ManagerFactory;
9 | import com.eros.framework.manager.impl.ParseManager;
10 | import com.eros.framework.manager.impl.dispatcher.DispatchEventManager;
11 | import com.eros.framework.model.UpdateOptionBean;
12 | import com.eros.framework.model.WeexEventBean;
13 | import com.eros.framework.update.VersionChecker;
14 | import com.eros.framework.utils.JsPoster;
15 | import com.eros.wxbase.EventGate;
16 | import com.squareup.otto.Subscribe;
17 | import com.taobao.weex.bridge.JSCallback;
18 |
19 | public class UpdateJsBundleEvent extends EventGate {
20 | private JSCallback mCallback;
21 |
22 | @Override
23 | public void perform(Context context, WeexEventBean weexEventBean, String type) {
24 | if (WXEventCenter.EVENT_DOWNLOAD_BUNDLE.equals(type)) {
25 | downloadBundle(weexEventBean);
26 | }
27 | if (WXEventCenter.EVENT_UPDATE_BUNDLE.equals(type)) {
28 | update();
29 | }
30 | }
31 |
32 | private void update() {
33 | VersionChecker versionChecker = BMWXApplication.getWXApplication().getVersionChecker();
34 | if (versionChecker != null) {
35 | versionChecker.restartApp();
36 | }
37 | }
38 |
39 | private void downloadBundle(WeexEventBean weexEventBean) {
40 | if (weexEventBean == null) return;
41 | UpdateOptionBean updateOptionBean = ManagerFactory.getManagerService(ParseManager.class)
42 | .parseObject(weexEventBean.getJsParams(), UpdateOptionBean.class);
43 | if (updateOptionBean == null) return;
44 | VersionChecker versionChecker = BMWXApplication.getWXApplication().getVersionChecker();
45 | if (versionChecker != null) {
46 | this.mCallback = weexEventBean.getJscallback();
47 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().register(this);
48 | versionChecker.checkVersion(updateOptionBean.getUrl(), updateOptionBean.isDiff());
49 | }
50 |
51 | }
52 |
53 | @Subscribe
54 | public void onUpdateResult(Intent intent) {
55 | if (WXConstant.ACTION_BUNDLE_DOWNLOADED.equals(intent.getAction())) {
56 | int code = intent.getIntExtra("code", -1);
57 | String msg = intent.getStringExtra("msg");
58 | if (code == 0) {
59 | JsPoster.postSuccess(null, msg, mCallback);
60 | } else {
61 | JsPoster.postFailed(msg, mCallback);
62 | }
63 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().unregister(this);
64 | }
65 | }
66 |
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/browse/EventBrowse.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.browse;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 |
6 | import com.eros.framework.activity.BrowseImgActivity;
7 | import com.eros.framework.constant.Constant;
8 | import com.eros.framework.manager.ManagerFactory;
9 | import com.eros.framework.manager.impl.ParseManager;
10 | import com.eros.framework.model.BroeserImgModuleBean;
11 | import com.eros.framework.model.WeexEventBean;
12 | import com.eros.wxbase.EventGate;
13 |
14 | /**
15 | * Created by Carry on 2017/8/21.
16 | */
17 |
18 | public class EventBrowse extends EventGate{
19 |
20 | @Override
21 | public void perform(Context context, WeexEventBean weexEventBean) {
22 | open(weexEventBean.getJsParams(),context);
23 | }
24 |
25 | public void open(String params, Context context) {
26 |
27 | BroeserImgModuleBean bean = ManagerFactory.getManagerService(ParseManager.class)
28 | .parseObject(params, BroeserImgModuleBean.class);
29 | if (bean == null || bean.getImages() == null || bean.getImages().size() == 0) return;
30 |
31 | Intent intent = new Intent().putExtra(Constant.BROWSE_EVENT.BROWSE_IMG_BEAN, bean)
32 | .setClass(context, BrowseImgActivity.class);
33 | context.startActivity(intent);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/http/callback/AxiosResponseCallback.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.http.callback;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.alibaba.fastjson.JSONException;
5 | import com.eros.framework.http.okhttp.callback.Callback;
6 | import com.eros.framework.model.AxiosResultBean;
7 |
8 | import java.util.HashMap;
9 | import java.util.List;
10 | import java.util.Map;
11 |
12 | import okhttp3.Response;
13 |
14 | /**
15 | * Created by Carry on 2018/5/28.
16 | */
17 |
18 | public abstract class AxiosResponseCallback extends Callback {
19 |
20 |
21 | @Override
22 | public AxiosResultBean parseNetworkResponse(Response response, int id) throws Exception {
23 | Map> responseHeader = new HashMap<>();
24 | for (Map.Entry> entry : response.headers().toMultimap()
25 | .entrySet()) {
26 | responseHeader.put(entry.getKey(), entry.getValue());
27 | }
28 | try {
29 | return new AxiosResultBean(response.code(), "", JSON.parse(response.body().string()),
30 | responseHeader);
31 | } catch (JSONException e) {
32 | e.printStackTrace();
33 | return new AxiosResultBean(-1, "json解析错误", null, responseHeader);
34 | }
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/modal/EventAlert.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.modal;
2 |
3 | import android.content.Context;
4 | import android.content.DialogInterface;
5 | import android.text.TextUtils;
6 |
7 | import com.eros.framework.R;
8 | import com.eros.framework.manager.ManagerFactory;
9 | import com.eros.framework.manager.impl.ModalManager;
10 | import com.eros.framework.manager.impl.ParseManager;
11 | import com.eros.framework.model.ModalBean;
12 | import com.eros.framework.model.WeexEventBean;
13 | import com.eros.wxbase.EventGate;
14 | import com.taobao.weex.bridge.JSCallback;
15 |
16 | /**
17 | * Created by Carry on 2017/8/23.
18 | */
19 |
20 | public class EventAlert extends EventGate {
21 |
22 | @Override
23 | public void perform(Context context, WeexEventBean weexEventBean) {
24 | String params = weexEventBean.getJsParams();
25 | if (TextUtils.isEmpty(params)) return;
26 | alert(params, weexEventBean.getJscallback(), context);
27 | }
28 |
29 | public void alert(String options, final JSCallback callback, Context Context) {
30 | ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
31 | ModalBean bean = parseManager.parseObject(options, ModalBean.class);
32 | String okTitle = bean.getOkTitle();
33 | if (TextUtils.isEmpty(okTitle)) {
34 | okTitle = Context.getResources().getString(R.string.str_ensure);
35 | }
36 | ModalManager.BmAlert.showAlert(Context, bean.getTitle(), bean
37 | .getMessage(), okTitle, new DialogInterface.OnClickListener() {
38 | @Override
39 | public void onClick(DialogInterface dialog, int which) {
40 | if (callback != null) {
41 | callback.invoke(null);
42 | }
43 | }
44 | }, null, null, bean.getTitleAlign(), bean.getMessageAlign());
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/modal/EventConfirm.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.modal;
2 |
3 | import android.content.Context;
4 | import android.content.DialogInterface;
5 | import android.text.TextUtils;
6 |
7 | import com.eros.framework.manager.ManagerFactory;
8 | import com.eros.framework.manager.impl.ModalManager;
9 | import com.eros.framework.manager.impl.ParseManager;
10 | import com.eros.framework.model.ModalBean;
11 | import com.eros.framework.model.WeexEventBean;
12 | import com.eros.wxbase.EventGate;
13 | import com.taobao.weex.bridge.JSCallback;
14 |
15 | import java.util.ArrayList;
16 |
17 | /**
18 | * Created by Carry on 2017/8/23.
19 | */
20 |
21 | public class EventConfirm extends EventGate {
22 |
23 | @Override
24 | public void perform(Context context, WeexEventBean weexEventBean) {
25 | String params = weexEventBean.getJsParams();
26 | if (TextUtils.isEmpty(params)) return;
27 | ArrayList callbacks = weexEventBean.getCallbacks();
28 | if (callbacks == null && callbacks.size() < 2) return;
29 | confirm(params, callbacks.get(0), callbacks.get(1), context);
30 | }
31 |
32 | public void confirm(String options, final JSCallback cancel, final JSCallback ok, Context context) {
33 | ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
34 | ModalBean bean = parseManager.parseObject(options, ModalBean.class);
35 | ModalManager.BmAlert.showAlert(context, bean.getTitle(), bean
36 | .getMessage(), bean.getOkTitle(), new DialogInterface.OnClickListener() {
37 | @Override
38 | public void onClick(DialogInterface dialog, int which) {
39 | if (ok != null) {
40 | ok.invoke(null);
41 | }
42 | }
43 | }, bean.getCancelTitle(), new DialogInterface.OnClickListener() {
44 | @Override
45 | public void onClick(DialogInterface dialog, int which) {
46 | if (cancel != null) {
47 | cancel.invoke(null);
48 | }
49 | }
50 | }, bean.getTitleAlign(), bean.getMessageAlign());
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/modal/EventDismissLoading.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.modal;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.manager.impl.ModalManager;
6 | import com.eros.framework.model.WeexEventBean;
7 | import com.eros.wxbase.EventGate;
8 | import com.taobao.weex.bridge.JSCallback;
9 |
10 | /**
11 | * Created by Carry on 2017/9/21.
12 | */
13 |
14 | public class EventDismissLoading extends EventGate{
15 |
16 | @Override
17 | public void perform(Context context, WeexEventBean weexEventBean) {
18 | dismiss(context, weexEventBean.getJscallback());
19 | }
20 |
21 | public void dismiss(Context context, JSCallback jscallback) {
22 | ModalManager.BmLoading.dismissLoading(context);
23 | if (jscallback != null) {
24 | jscallback.invoke(null);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/modal/EventShowLoading.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.modal;
2 |
3 | import android.content.Context;
4 | import android.text.TextUtils;
5 |
6 | import com.eros.framework.manager.ManagerFactory;
7 | import com.eros.framework.manager.impl.ModalManager;
8 | import com.eros.framework.manager.impl.ParseManager;
9 | import com.eros.framework.model.ModalBean;
10 | import com.eros.framework.model.WeexEventBean;
11 | import com.eros.wxbase.EventGate;
12 | import com.taobao.weex.bridge.JSCallback;
13 |
14 | /**
15 | * Created by Carry on 2017/8/23.
16 | */
17 |
18 | public class EventShowLoading extends EventGate {
19 |
20 | @Override
21 | public void perform(Context context, WeexEventBean weexEventBean) {
22 | String params = weexEventBean.getJsParams();
23 | if (TextUtils.isEmpty(params)) return;
24 | JSCallback modal_showloading_callback = weexEventBean.getJscallback();
25 | showLoading(params, modal_showloading_callback, context);
26 | }
27 |
28 | public void showLoading(String options, JSCallback callback, Context Context) {
29 | ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
30 | ModalBean bean = parseManager.parseObject(options, ModalBean.class);
31 | ModalManager.BmLoading.showLoading(Context, bean.getMessage(), false);
32 | if (callback != null) {
33 | callback.invoke(null);
34 | }
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/modal/EventToast.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.modal;
2 |
3 | import android.content.Context;
4 | import android.text.TextUtils;
5 | import android.widget.Toast;
6 |
7 | import com.eros.framework.manager.ManagerFactory;
8 | import com.eros.framework.manager.impl.ModalManager;
9 | import com.eros.framework.manager.impl.ParseManager;
10 | import com.eros.framework.model.ModalBean;
11 | import com.eros.framework.model.WeexEventBean;
12 | import com.eros.wxbase.EventGate;
13 |
14 | /**
15 | * Created by Carry on 2017/8/23.
16 | */
17 |
18 | public class EventToast extends EventGate {
19 |
20 | @Override
21 | public void perform(Context context, WeexEventBean weexEventBean) {
22 | String params = weexEventBean.getJsParams();
23 | if (TextUtils.isEmpty(params)) return;
24 | toast(params, context);
25 | }
26 |
27 | public void toast(String options, Context Context) {
28 | ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
29 | ModalBean bean = parseManager.parseObject(options, ModalBean.class);
30 | ModalManager.BmToast.toast(Context, bean.getMessage(), bean
31 | .getDuration() == 0 ? Toast.LENGTH_SHORT : bean.getDuration());
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/nav/EventCenterItem.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.nav;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.activity.AbstractWeexActivity;
6 | import com.eros.framework.adapter.DefaultNavigationAdapter;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.eros.wxbase.EventGate;
9 | import com.taobao.weex.bridge.JSCallback;
10 |
11 | /**
12 | * Created by Carry on 2017/9/13.
13 | */
14 |
15 | public class EventCenterItem extends NavigationEventGate {
16 |
17 | @Override
18 | public void perform(Context context, WeexEventBean weexEventBean) {
19 | if (!setNavitionListenter(weexEventBean)) {
20 | setCenterItem(weexEventBean.getJsParams(), weexEventBean.getJscallback());
21 | }
22 | }
23 |
24 | public void setCenterItem(String params, JSCallback jscallback) {
25 | DefaultNavigationAdapter.setCenterItem(params, jscallback);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/nav/EventLeftItem.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.nav;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.adapter.DefaultNavigationAdapter;
6 | import com.eros.framework.model.WeexEventBean;
7 | import com.eros.wxbase.EventGate;
8 | import com.taobao.weex.bridge.JSCallback;
9 |
10 | /**
11 | * Created by Carry on 2017/9/13.
12 | */
13 |
14 | public class EventLeftItem extends NavigationEventGate {
15 |
16 | @Override
17 | public void perform(Context context, WeexEventBean weexEventBean) {
18 | if (!setNavitionListenter(weexEventBean)) {
19 | setLeftItem(weexEventBean.getJsParams(), weexEventBean.getJscallback());
20 | }
21 | }
22 |
23 | public void setLeftItem(String params, JSCallback jscallback) {
24 | DefaultNavigationAdapter.setLeftItem(params, jscallback);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/nav/EventNavigationInfo.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.nav;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.activity.AbstractWeexActivity;
6 | import com.eros.framework.adapter.DefaultNavigationAdapter;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.eros.wxbase.EventGate;
9 | import com.taobao.weex.bridge.JSCallback;
10 |
11 | /**
12 | * Created by Carry on 2017/9/13.
13 | */
14 |
15 | public class EventNavigationInfo extends NavigationEventGate {
16 |
17 | @Override
18 | public void perform(Context context, WeexEventBean weexEventBean) {
19 |
20 | if(!setNavitionListenter(weexEventBean)){
21 | setNavigationInfo(weexEventBean.getJsParams(), context, weexEventBean
22 | .getJscallback());
23 |
24 | }
25 | }
26 |
27 | public void setNavigationInfo(String params, Context context, JSCallback jscallback) {
28 | DefaultNavigationAdapter.setNavigationInfo(params, jscallback);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/nav/EventRightItem.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.nav;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.adapter.DefaultNavigationAdapter;
6 | import com.eros.framework.model.WeexEventBean;
7 | import com.eros.wxbase.EventGate;
8 | import com.taobao.weex.bridge.JSCallback;
9 |
10 | /**
11 | * Created by Carry on 2017/9/13.
12 | */
13 |
14 | public class EventRightItem extends NavigationEventGate {
15 |
16 | @Override
17 | public void perform(Context context, WeexEventBean weexEventBean) {
18 | if (!setNavitionListenter(weexEventBean)) {
19 | setRightItem(weexEventBean.getJsParams(), weexEventBean.getJscallback());
20 | }
21 | }
22 |
23 | public void setRightItem(String params, JSCallback jscallback) {
24 | DefaultNavigationAdapter.setRightItem(params, jscallback);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/nav/NavigationEventGate.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.nav;
2 |
3 |
4 | import android.content.Context;
5 |
6 | import com.eros.framework.activity.AbstractWeexActivity;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.eros.wxbase.EventGate;
9 |
10 | /**
11 | * Created by liuyuanxiao on 2018/5/29.
12 | */
13 |
14 | public class NavigationEventGate extends EventGate {
15 |
16 | public boolean setNavitionListenter(WeexEventBean weexEventBean) {
17 | Context context = weexEventBean.getContext();
18 | if (context != null) {
19 | if (context instanceof AbstractWeexActivity) {
20 | AbstractWeexActivity abs = (AbstractWeexActivity) context;
21 | return abs.navigationListenter(weexEventBean);
22 | }
23 | }
24 | return false;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/router/EventBack.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.router;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.constant.WXConstant;
6 | import com.eros.framework.manager.ManagerFactory;
7 | import com.eros.framework.manager.impl.RouterManager;
8 | import com.eros.framework.model.WeexEventBean;
9 | import com.eros.wxbase.EventGate;
10 | import com.taobao.weex.bridge.JSCallback;
11 |
12 | /**
13 | * Created by Carry on 2017/8/21.
14 | */
15 |
16 | public class EventBack extends EventGate {
17 |
18 | @Override
19 | public void perform(Context context, WeexEventBean weexEventBean) {
20 | back(weexEventBean.getJsParams(), context, weexEventBean.getJscallback());
21 | }
22 |
23 | public void back(String params, Context context, JSCallback jscallback) {
24 | RouterManager routerManager = ManagerFactory.getManagerService(RouterManager.class);
25 | boolean result = routerManager.back(context, params);
26 | if (jscallback != null) {
27 | jscallback.invoke(result ? WXConstant.BACK_PAGE_SUCCESS : WXConstant.BACK_PAGE_FAILED);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/router/EventCall.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.router;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.impl.RouterManager;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.eros.wxbase.EventGate;
9 |
10 | /**
11 | * Created by Carry on 2017/8/23.
12 | */
13 |
14 | public class EventCall extends EventGate{
15 | @Override
16 | public void perform(Context context, WeexEventBean weexEventBean) {
17 | call(weexEventBean.getJsParams(),context);
18 | }
19 |
20 | public void call(String params, Context context) {
21 | RouterManager routerManager = ManagerFactory.getManagerService(RouterManager.class);
22 | routerManager.dialing(context,params);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/router/EventFinish.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.router;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.impl.RouterManager;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.eros.wxbase.EventGate;
9 | import com.taobao.weex.bridge.JSCallback;
10 |
11 | /**
12 | * Created by liuyuanxiao on 17/12/6.
13 | */
14 |
15 | public class EventFinish extends EventGate{
16 | @Override
17 | public void perform(Context context, WeexEventBean weexEventBean) {
18 | finish(context, weexEventBean.getJscallback());
19 | }
20 |
21 | public void finish(Context context, JSCallback jscallback) {
22 | RouterManager routerManager = ManagerFactory.getManagerService(RouterManager.class);
23 | boolean result = routerManager.finish(context);
24 |
25 | // if (activity != null && activity instanceof AbsWeexActivity) {
26 | // AbsWeexActivity target = (AbsWeexActivity) activity;
27 | // if (target.mUrl != null) {
28 | // target.refresh();
29 | // if (jscallback != null) {
30 | // BaseResultBean bean = new BaseResultBean();
31 | // bean.resCode = 0;
32 | // bean.msg = activity.getClass().getSimpleName() + "刷新成功";
33 | // jscallback.invoke(bean);
34 | // }
35 | // }
36 | // }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/router/EventGetBackParams.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.router;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.impl.RouterManager;
7 | import com.eros.framework.model.RouterModel;
8 | import com.eros.framework.model.WeexEventBean;
9 | import com.eros.wxbase.EventGate;
10 | import com.taobao.weex.bridge.JSCallback;
11 |
12 | /**
13 | * Created by Carry on 2017/8/23.
14 | */
15 |
16 | public class EventGetBackParams extends EventGate{
17 | @Override
18 | public void perform(Context context, WeexEventBean weexEventBean) {
19 | getBackParams(context, weexEventBean.getJscallback());
20 | }
21 |
22 | public void getBackParams(Context context, JSCallback jscallback) {
23 | RouterManager routerManager = ManagerFactory.getManagerService(RouterManager.class);
24 | RouterModel routerModel = routerManager.getParams(context);
25 | if (routerModel != null && jscallback != null) {
26 | jscallback.invoke(routerModel.params);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/router/EventGetParams.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.router;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.impl.RouterManager;
7 | import com.eros.framework.model.RouterModel;
8 | import com.eros.framework.model.WeexEventBean;
9 | import com.eros.wxbase.EventGate;
10 | import com.taobao.weex.bridge.JSCallback;
11 |
12 | /**
13 | * Created by Carry on 2017/8/23.
14 | */
15 |
16 | public class EventGetParams extends EventGate{
17 | @Override
18 | public void perform(Context context, WeexEventBean weexEventBean) {
19 | getParams(context, weexEventBean.getJscallback());
20 | }
21 |
22 | public void getParams(Context context, JSCallback jscallback) {
23 | RouterManager routerManager = ManagerFactory.getManagerService(RouterManager.class);
24 | RouterModel routerModel = routerManager.getParams(context);
25 | if (routerModel != null && jscallback != null) {
26 | jscallback.invoke(routerModel.params);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/router/EventOpen.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.router;
2 |
3 | import android.content.Context;
4 | import android.text.TextUtils;
5 |
6 | import com.eros.framework.constant.WXConstant;
7 | import com.eros.framework.manager.ManagerFactory;
8 | import com.eros.framework.manager.impl.RouterManager;
9 | import com.eros.framework.model.WeexEventBean;
10 | import com.eros.wxbase.EventGate;
11 | import com.taobao.weex.bridge.JSCallback;
12 |
13 | import java.util.List;
14 |
15 | /**
16 | * Created by Carry on 2017/8/21.
17 | */
18 |
19 | public class EventOpen extends EventGate {
20 |
21 | @Override
22 | public void perform(Context context, WeexEventBean weexEventBean) {
23 | String params = weexEventBean.getJsParams();
24 | if (TextUtils.isEmpty(params)) return;
25 | if (weexEventBean.getCallbacks() != null) {
26 | new EventOpen().open(params, context, weexEventBean.getCallbacks());
27 | } else if (weexEventBean.getJscallback() != null) {
28 | new EventOpen().open(params, context, weexEventBean.getJscallback());
29 | } else {
30 | new EventOpen().open(params, context);
31 | }
32 | }
33 |
34 | public void open(String params, Context context, List callbacks) {
35 | JSCallback backCallback = null;
36 | JSCallback resultCallback = null;
37 | if (callbacks.size() > 1) {
38 | backCallback = callbacks.get(0);
39 | resultCallback = callbacks.get(1);
40 | } else if (callbacks.size() > 0) {
41 | backCallback = callbacks.get(0);
42 | }
43 |
44 | RouterManager routerManager = ManagerFactory.getManagerService(RouterManager.class);
45 | boolean result = routerManager.open(context, params, backCallback);
46 |
47 | if (resultCallback != null) {
48 | resultCallback.invoke(result ? WXConstant.OPEN_PAGE_SUCCESS : WXConstant
49 | .OPNE_PAGE_FAILED);
50 | }
51 | }
52 |
53 | public void open(String params, Context context, JSCallback backCallback) {
54 | RouterManager routerManager = ManagerFactory.getManagerService(RouterManager.class);
55 | routerManager.open(context, params, backCallback);
56 | }
57 |
58 | public void open(String params, Context context) {
59 | RouterManager routerManager = ManagerFactory.getManagerService(RouterManager.class);
60 | routerManager.open(context, params, null);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/router/EventOpenBrowser.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.router;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.impl.RouterManager;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.eros.framework.utils.JsPoster;
9 | import com.eros.wxbase.EventGate;
10 | import com.taobao.weex.bridge.JSCallback;
11 |
12 | /**
13 | * Created by Carry on 2017/12/21.
14 | */
15 |
16 | public class EventOpenBrowser extends EventGate{
17 |
18 | @Override
19 | public void perform(Context context, WeexEventBean weexEventBean) {
20 | openBrowser(context, weexEventBean.getJsParams(), weexEventBean.getJscallback());
21 | }
22 |
23 | public void openBrowser(Context context, String params, JSCallback callback) {
24 | RouterManager managerService = ManagerFactory.getManagerService(RouterManager.class);
25 | boolean b = managerService.openBrowser(context, params);
26 | if (b) {
27 | JsPoster.postSuccess(null,callback);
28 | } else {
29 | JsPoster.postFailed(callback);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/router/EventRefresh.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.router;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.impl.RouterManager;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.eros.wxbase.EventGate;
9 | import com.taobao.weex.bridge.JSCallback;
10 |
11 | /**
12 | * Created by Carry on 2017/8/23.
13 | */
14 |
15 | public class EventRefresh extends EventGate{
16 | @Override
17 | public void perform(Context context, WeexEventBean weexEventBean) {
18 | refresh(context, weexEventBean.getJscallback());
19 | }
20 |
21 | public void refresh(Context context, JSCallback jscallback) {
22 | RouterManager routerManager = ManagerFactory.getManagerService(RouterManager.class);
23 | boolean result = routerManager.refresh(context);
24 |
25 | // if (activity != null && activity instanceof AbsWeexActivity) {
26 | // AbsWeexActivity target = (AbsWeexActivity) activity;
27 | // if (target.mUrl != null) {
28 | // target.refresh();
29 | // if (jscallback != null) {
30 | // BaseResultBean bean = new BaseResultBean();
31 | // bean.resCode = 0;
32 | // bean.msg = activity.getClass().getSimpleName() + "刷新成功";
33 | // jscallback.invoke(bean);
34 | // }
35 | // }
36 | // }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/router/EventSetHomePage.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.router;
2 |
3 |
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.net.Uri;
7 | import android.text.TextUtils;
8 |
9 | import com.eros.framework.BMWXEnvironment;
10 | import com.eros.framework.adapter.router.DefaultRouterAdapter;
11 | import com.eros.framework.constant.Constant;
12 | import com.eros.framework.manager.ManagerFactory;
13 | import com.eros.framework.manager.StorageManager;
14 | import com.eros.framework.model.RouterModel;
15 | import com.eros.framework.model.WeexEventBean;
16 | import com.eros.wxbase.EventGate;
17 |
18 | /**
19 | * Created by liuyuanxiao on 18/1/4.
20 | */
21 |
22 | public class EventSetHomePage extends EventGate{
23 |
24 | @Override
25 | public void perform(Context context, WeexEventBean weexEventBean) {
26 | setHomePage(context, weexEventBean.getJsParams());
27 | }
28 |
29 | @SuppressWarnings("WrongConstant")
30 | public void setHomePage(Context context, String params) {
31 | StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
32 | storageManager.setData(context, Constant.SP.SP_HOMEPAGE_URL, params);
33 |
34 |
35 | String homePage = BMWXEnvironment.mPlatformConfig.getPage().getHomePage(context);
36 | RouterModel router = new RouterModel(homePage, Constant.ACTIVITIES_ANIMATION
37 | .ANIMATION_PUSH, null, null, false, null);
38 | Intent intent = performStartActivity(router,DefaultRouterAdapter.getInstance().getPageCategory(context));
39 | context.startActivity(intent);
40 | // PendingIntent restartIntent = PendingIntent.getActivity(
41 | // context.getApplicationContext(), 0, intent, Intent.FLAG_ACTIVITY_CLEAR_TASK);
42 | // AlarmManager mgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
43 | // mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100,
44 | // restartIntent);
45 | }
46 |
47 | private Intent performStartActivity(RouterModel routerModel, String bmpageCategory) {
48 | String pathUrl = routerModel.url;
49 | if (TextUtils.isEmpty(pathUrl)) return null;
50 | Uri pathUri = Uri.parse(pathUrl);
51 | if (!TextUtils.equals("http", pathUri.getScheme()) && !TextUtils.equals("https", pathUri
52 | .getScheme())) {
53 | pathUri = Uri.parse(BMWXEnvironment.mPlatformConfig.getUrl().getJsServer() +
54 | "/dist/js" + pathUrl);
55 | }
56 | Intent intent = new Intent(Intent.ACTION_VIEW);
57 | intent.putExtra(Constant.ROUTERPARAMS, routerModel);
58 | intent.setData(pathUri);
59 | intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
60 | intent.addCategory(bmpageCategory);
61 | return intent;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/router/EventToMap.java:
--------------------------------------------------------------------------------
1 | package com.benmu.framework.event.router;
2 |
3 | import android.content.Context;
4 |
5 | import com.taobao.weex.bridge.JSCallback;
6 |
7 | /**
8 | * Created by Carry on 2017/8/23.
9 | */
10 |
11 | public class EventToMap {
12 | public void toMap(String params, Context context, JSCallback jscallback) {
13 |
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/router/EventWebView.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.router;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.impl.RouterManager;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.eros.wxbase.EventGate;
9 |
10 | /**
11 | * Created by Carry on 2017/8/23.
12 | */
13 |
14 | public class EventWebView extends EventGate{
15 | @Override
16 | public void perform(Context context, WeexEventBean weexEventBean) {
17 | toWebView(weexEventBean.getJsParams(),context);
18 | }
19 |
20 | public void toWebView(String params, Context context) {
21 | RouterManager routerManager = ManagerFactory.getManagerService(RouterManager.class);
22 | routerManager.toWebView(context,params);
23 |
24 | // WebViewParamBean webViewParamBean = BMJsonParsManager.parseObject(params,
25 | // WebViewParamBean.class);
26 | // BMRouterManager.toWebView(context, webViewParamBean, AppConstant.WEBVIEW_CATEGORY, new
27 | // TitleModel(webViewParamBean.getTitle(), null, false, "#07ae9c", true));
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/shorage/EventDeleteData.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.shorage;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.StorageManager;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.eros.framework.utils.JsPoster;
9 | import com.eros.wxbase.EventGate;
10 | import com.taobao.weex.bridge.JSCallback;
11 |
12 | import java.util.ArrayList;
13 |
14 | /**
15 | * Created by Carry on 2017/5/21.
16 | */
17 |
18 | public class EventDeleteData extends EventGate{
19 |
20 | @Override
21 | public void perform(Context context, WeexEventBean weexEventBean) {
22 | deleteData(context, weexEventBean.getParamsList(),
23 | weexEventBean.getJscallback());
24 | }
25 |
26 | public void deleteData(Context context, ArrayList paramsList, JSCallback jscallback) {
27 | String key = paramsList.get(0);
28 | StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
29 | boolean result = storageManager.deleteData(context, key);
30 | if (result) {
31 | JsPoster.postSuccess(null, jscallback);
32 | } else {
33 | JsPoster.postFailed("删除" + key + "失败", jscallback);
34 | }
35 | }
36 |
37 | public Object deleteDataSync(Context context, ArrayList paramsList) {
38 | String key = paramsList.get(0);
39 | StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
40 | boolean result = storageManager.deleteData(context, key);
41 | return result ? JsPoster.getSuccess() : JsPoster.getFailed("删除" + key + "失败");
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/shorage/EventGetData.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.shorage;
2 |
3 | import android.content.Context;
4 | import android.text.TextUtils;
5 |
6 | import com.eros.framework.manager.ManagerFactory;
7 | import com.eros.framework.manager.StorageManager;
8 | import com.eros.framework.model.WeexEventBean;
9 | import com.eros.framework.utils.JsPoster;
10 | import com.eros.wxbase.EventGate;
11 | import com.taobao.weex.bridge.JSCallback;
12 |
13 | import java.util.ArrayList;
14 |
15 | /**
16 | * Created by Carry on 2017/5/21.
17 | */
18 |
19 | public class EventGetData extends EventGate{
20 |
21 | @Override
22 | public void perform(Context context, WeexEventBean weexEventBean) {
23 | getData(context, weexEventBean.getParamsList(), weexEventBean
24 | .getJscallback());
25 | }
26 |
27 | public void getData(Context context, ArrayList paramsList, JSCallback jscallback) {
28 | String key = paramsList.get(0);
29 | StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
30 | String result = storageManager.getData(context, key);
31 | if (TextUtils.isEmpty(result)) {
32 | JsPoster.postFailed(jscallback);
33 | } else {
34 | JsPoster.postSuccess(result, jscallback);
35 | }
36 | }
37 |
38 | public Object getDataSync(Context context, ArrayList list) {
39 | String key = list.get(0);
40 | StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
41 | String result = storageManager.getData(context, key);
42 | return result == null ? JsPoster.getFailed() : JsPoster.getSuccess(result);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/shorage/EventRemoveData.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.shorage;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.StorageManager;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.eros.framework.utils.JsPoster;
9 | import com.eros.wxbase.EventGate;
10 | import com.taobao.weex.bridge.JSCallback;
11 |
12 | /**
13 | * Created by Carry on 2017/5/21.
14 | */
15 |
16 | public class EventRemoveData extends EventGate{
17 |
18 | @Override
19 | public void perform(Context context, WeexEventBean weexEventBean) {
20 | removeData(context, weexEventBean.getJscallback());
21 | }
22 |
23 | public void removeData(Context context, JSCallback jscallback) {
24 | StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
25 | boolean result = storageManager.removeData(context);
26 |
27 | if (result) {
28 | JsPoster.postSuccess(null, jscallback);
29 | } else {
30 | JsPoster.postFailed(jscallback);
31 | }
32 |
33 | }
34 |
35 | public Object removeDataSync(Context context) {
36 | StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
37 | boolean result = storageManager.removeData(context);
38 | return result ? JsPoster.getSuccess(null) : JsPoster.getFailed();
39 | }
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/shorage/EventSetData.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.shorage;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.StorageManager;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.eros.framework.utils.JsPoster;
9 | import com.eros.wxbase.EventGate;
10 | import com.taobao.weex.bridge.JSCallback;
11 |
12 | import java.util.ArrayList;
13 |
14 | /**
15 | * Created by Carry on 2017/5/21.
16 | */
17 |
18 | public class EventSetData extends EventGate {
19 |
20 | @Override
21 | public void perform(Context context, WeexEventBean weexEventBean) {
22 | setData(context, weexEventBean.getParamsList(), weexEventBean
23 | .getJscallback());
24 | }
25 |
26 | public void setData(Context context, ArrayList paramsList, JSCallback jscallback) {
27 | StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
28 | String key = paramsList.get(0);
29 | String value = paramsList.get(1);
30 | boolean result = storageManager.setData(context, key, value);
31 | if (result) {
32 | JsPoster.postSuccess(null, jscallback);
33 | } else {
34 | JsPoster.postFailed("存储失败", jscallback);
35 | }
36 | }
37 |
38 |
39 | public Object setDataSync(Context context, ArrayList paramsList) {
40 | StorageManager storageManager = ManagerFactory.getManagerService(StorageManager.class);
41 | String key = paramsList.get(0);
42 | String value = paramsList.get(1);
43 | boolean result = storageManager.setData(context, key, value);
44 | return result ? JsPoster.getSuccess() : JsPoster.getFailed("存储失败");
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/event/tool/EventTool.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.event.tool;
2 |
3 | import android.content.Context;
4 | import android.text.TextUtils;
5 |
6 | import com.eros.framework.constant.WXEventCenter;
7 | import com.eros.framework.model.CidBean;
8 | import com.eros.framework.model.WeexEventBean;
9 | import com.eros.framework.utils.JsPoster;
10 | import com.eros.framework.utils.SharePreferenceUtil;
11 | import com.eros.widget.utils.BaseCommonUtil;
12 | import com.eros.wxbase.EventGate;
13 | import com.taobao.weex.bridge.JSCallback;
14 |
15 | /**
16 | * Created by Carry on 2017/9/18.
17 | */
18 |
19 | public class EventTool extends EventGate {
20 |
21 | @Override
22 | public void perform(Context context, WeexEventBean weexEventBean, String type) {
23 | if (WXEventCenter.EVENT_RESIGNKEYBOARD.equals(type)) {
24 | resignKeyboard(context, weexEventBean.getJscallback());
25 | } else if (WXEventCenter.EVENT_ISINSTALLWXAPP.equals(type)) {
26 | isWXInstall(context, weexEventBean.getJscallback());
27 | } else if (WXEventCenter.EVENT_GETCID.equals(type)) {
28 | getCid(context, weexEventBean.getJscallback());
29 | } else if (WXEventCenter.EVENT_COPYSTRING.equals(type)) {
30 | copyString(context, weexEventBean.getJsParams(), weexEventBean.getJscallback());
31 | }
32 | }
33 |
34 | public void resignKeyboard(Context context, JSCallback jscallback) {
35 | if (BaseCommonUtil.getKeyBoardState(context)) {
36 | JsPoster.postSuccess(null, jscallback);
37 | } else {
38 | JsPoster.postFailed(jscallback);
39 | }
40 | }
41 |
42 |
43 | public void isWXInstall(Context context, JSCallback jsCallback) {
44 | boolean weChatInstall = BaseCommonUtil.isWeChatInstall(context);
45 |
46 | if (weChatInstall) {
47 | JsPoster.postSuccess(true, jsCallback);
48 | } else {
49 | JsPoster.postFailed(jsCallback);
50 | }
51 |
52 | }
53 |
54 | public void copyString(Context context, String params, JSCallback callback) {
55 | BaseCommonUtil.copyString(context, params);
56 | JsPoster.postSuccess(null, "复制成功", callback);
57 | }
58 |
59 | public void getCid(Context context, JSCallback callback) {
60 | CidBean cidBean = new CidBean();
61 | String clientId = SharePreferenceUtil.getClientId(context);
62 | if (!TextUtils.isEmpty(clientId)) {
63 | cidBean.setCid(clientId);
64 | JsPoster.postSuccess(cidBean, callback);
65 | } else {
66 | JsPoster.postFailed(callback);
67 | }
68 | }
69 |
70 | }
71 |
72 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/adapter/DefaultTypefaceAdapter.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.adapter;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.BMWXEnvironment;
6 | import com.eros.framework.constant.Constant;
7 | import com.eros.framework.manager.impl.FileManager;
8 | import com.eros.framework.utils.SharePreferenceUtil;
9 |
10 | import java.io.File;
11 |
12 | /**
13 | * Created by Carry on 2017/10/26.
14 | */
15 |
16 | public class DefaultTypefaceAdapter{
17 | private Context mContext;
18 |
19 | public DefaultTypefaceAdapter(Context context) {
20 | this.mContext = context;
21 | }
22 |
23 | public File getTypefaceDir() {
24 | return FileManager.getIconDir(mContext);
25 | }
26 |
27 | public boolean isInterceptor() {
28 | return Constant.INTERCEPTOR_ACTIVE.equals(SharePreferenceUtil.getInterceptorActive
29 | (mContext));
30 | }
31 |
32 | public String getJsServer() {
33 | return BMWXEnvironment.mPlatformConfig.getUrl().getJsServer();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/adapter/LightlyWebSocketFactory.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.adapter;
2 |
3 | import com.taobao.weex.appfram.websocket.IWebSocketAdapter;
4 | import com.taobao.weex.appfram.websocket.IWebSocketAdapterFactory;
5 |
6 | /**
7 | * Created by Carry on 2018/1/4.
8 | */
9 |
10 | public class LightlyWebSocketFactory implements IWebSocketAdapterFactory {
11 | @Override
12 | public IWebSocketAdapter createWebSocketAdapter() {
13 | return new LightlyWebSocketAdapter();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/comoponents/BMSpan.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.comoponents;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.text.TextPaint;
6 | import android.text.style.ClickableSpan;
7 | import android.view.View;
8 |
9 | import com.taobao.weex.WXSDKInstance;
10 | import com.taobao.weex.dom.WXDomObject;
11 | import com.taobao.weex.ui.component.WXComponent;
12 | import com.taobao.weex.ui.component.WXVContainer;
13 |
14 | import java.util.HashSet;
15 | import java.util.Set;
16 |
17 | /**
18 | * Created by Carry on 2017/6/14.
19 | */
20 |
21 | public class BMSpan extends WXComponent {
22 | private Set mAppendEvents = new HashSet<>();
23 |
24 | public BMSpan(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String
25 | instanceId, boolean isLazy) {
26 | super(instance, dom, parent, instanceId, isLazy);
27 | }
28 |
29 | public BMSpan(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, boolean isLazy) {
30 | super(instance, dom, parent, isLazy);
31 | }
32 |
33 | public BMSpan(WXSDKInstance instance, WXDomObject dom, WXVContainer parent) {
34 | super(instance, dom, parent);
35 | postBubbleEvent(parent, dom);
36 | }
37 |
38 |
39 | public void postBubbleEvent(WXComponent parent, WXDomObject object) {
40 | if (parent == null) return;
41 | if (parent instanceof BMRich) {
42 | BMRich bmRichText = (BMRich) parent;
43 | bmRichText.receiveBubbleEvent(object);
44 | } else {
45 | postBubbleEvent(parent.getParent(), object);
46 | }
47 | }
48 |
49 |
50 | @Override
51 | protected View initComponentHostView(@NonNull Context context) {
52 | return new View(context);
53 | }
54 |
55 | @Override
56 | public void updateExtra(Object extra) {
57 | super.updateExtra(extra);
58 | }
59 |
60 | static class BMRichClickSpan extends ClickableSpan {
61 | private final View.OnClickListener mListener;
62 |
63 | public BMRichClickSpan(View.OnClickListener mListener) {
64 | this.mListener = mListener;
65 | }
66 |
67 | @Override
68 | public void onClick(View v) {
69 | mListener.onClick(v);
70 | }
71 |
72 | @Override
73 | public void updateDrawState(TextPaint ds) {
74 | ds.setUnderlineText(false); //去除超链接的下划线
75 | }
76 | }
77 | }
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/comoponents/BMView.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.comoponents;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 | import android.view.View;
6 |
7 | import com.taobao.weex.WXSDKInstance;
8 | import com.taobao.weex.dom.WXDomObject;
9 | import com.taobao.weex.ui.component.WXComponentProp;
10 | import com.taobao.weex.ui.component.WXVContainer;
11 | import com.taobao.weex.ui.view.WXFrameLayout;
12 |
13 | /**
14 | * Created by Carry on 17/1/19.
15 | */
16 |
17 | public class BMView extends WXVContainer {
18 | private WXFrameLayout layout;
19 |
20 | public BMView(WXSDKInstance instance, WXDomObject dom, WXVContainer parent) {
21 | super(instance, dom, parent);
22 |
23 | }
24 |
25 | @Override
26 | protected WXFrameLayout initComponentHostView(@NonNull Context context) {
27 | layout = new WXFrameLayout(context);
28 | return layout;
29 | }
30 |
31 | @WXComponentProp(name = "hidden")
32 | public void setVisibility(Boolean visibility) {
33 | if (visibility) {
34 | layout.setVisibility(View.GONE);
35 | } else {
36 | layout.setVisibility(View.VISIBLE);
37 | }
38 |
39 |
40 | }
41 |
42 |
43 | @Override
44 | protected void onFinishLayout() {
45 | super.onFinishLayout();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/comoponents/view/BMWXTextView.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.comoponents.view;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.text.Layout;
6 | import android.view.MotionEvent;
7 | import android.view.View;
8 |
9 | import com.eros.framework.extend.comoponents.BMWXText;
10 | import com.taobao.weex.ui.view.IRenderStatus;
11 | import com.taobao.weex.ui.view.IWXTextView;
12 | import com.taobao.weex.ui.view.gesture.WXGesture;
13 | import com.taobao.weex.ui.view.gesture.WXGestureObservable;
14 |
15 | import java.lang.ref.WeakReference;
16 |
17 | /**
18 | * Created by Carry on 17/3/27.
19 | */
20 |
21 | public class BMWXTextView extends View implements WXGestureObservable, IWXTextView,
22 | IRenderStatus {
23 | private WeakReference mWeakReference;
24 | private WXGesture wxGesture;
25 | private Layout textLayout;
26 |
27 | public BMWXTextView(Context context) {
28 | super(context);
29 | }
30 |
31 | @Override
32 | protected void onDraw(Canvas canvas) {
33 | super.onDraw(canvas);
34 | canvas.save();
35 | Layout layout = getTextLayout();
36 | if (layout != null) {
37 | canvas.translate(getPaddingLeft(), getPaddingTop());
38 | layout.draw(canvas);
39 | }
40 | canvas.restore();
41 | }
42 |
43 | @Override
44 | public boolean onTouchEvent(MotionEvent event) {
45 | boolean result = super.onTouchEvent(event);
46 | if (wxGesture != null) {
47 | result |= wxGesture.onTouch(this, event);
48 | }
49 | return result;
50 | }
51 |
52 | @Override
53 | public void registerGestureListener(WXGesture wxGesture) {
54 | this.wxGesture = wxGesture;
55 | }
56 |
57 | @Override
58 | public CharSequence getText() {
59 | return textLayout.getText();
60 | }
61 |
62 | public Layout getTextLayout() {
63 | return textLayout;
64 | }
65 |
66 | public void setTextLayout(Layout layout) {
67 | this.textLayout = layout;
68 | if (layout != null) {
69 | setContentDescription(layout.getText());
70 | }
71 | if (mWeakReference != null) {
72 | BMWXText wxText = mWeakReference.get();
73 | if (wxText != null) {
74 | wxText.readyToRender();
75 | }
76 | }
77 | }
78 |
79 |
80 | @Override
81 | public void holdComponent(BMWXText component) {
82 | mWeakReference = new WeakReference<>(component);
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/comoponents/view/BMWebViewPool.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.comoponents.view;
2 |
3 | /**
4 | * Created by Carry on 2017/12/27.
5 | */
6 |
7 | public class BMWebViewPool {
8 | }
9 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/comoponents/view/BMWebViewWrapper.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.comoponents.view;
2 |
3 | /**
4 | * Created by Carry on 2017/12/27.
5 | */
6 |
7 | public class BMWebViewWrapper {
8 | }
9 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/hook/HookConstants.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.hook;
2 |
3 | /**
4 | * Created by Carry on 2018/4/17.
5 | */
6 |
7 | public interface HookConstants {
8 | interface NAME {
9 | String SHOW_REFRESH = "showRefresh";
10 | String TINTCOLOR = "tintColor";
11 | String PAGINGENABLED = "pagingEnabled";
12 |
13 | String SHOW_LOADMORE = "showLoadMore";
14 |
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/hook/ui/components/HookInput.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.hook.ui.components;
2 |
3 | import android.graphics.PorterDuff;
4 | import android.graphics.drawable.Drawable;
5 | import android.text.TextUtils;
6 | import android.util.Log;
7 | import android.widget.EditText;
8 | import android.widget.TextView;
9 |
10 | import com.eros.framework.extend.hook.HookConstants;
11 | import com.taobao.weex.WXSDKInstance;
12 | import com.taobao.weex.dom.WXDomObject;
13 | import com.taobao.weex.ui.component.WXComponentProp;
14 | import com.taobao.weex.ui.component.WXInput;
15 | import com.taobao.weex.ui.component.WXVContainer;
16 | import com.taobao.weex.utils.WXResourceUtils;
17 |
18 | import java.lang.reflect.Field;
19 |
20 | /**
21 | * Created by Carry on 2018/4/17.
22 | */
23 |
24 | public class HookInput extends WXInput {
25 | private String TAG = getClass().getName();
26 |
27 | public HookInput(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String
28 | instanceId, boolean isLazy) {
29 | super(instance, dom, parent, instanceId, isLazy);
30 | Log.e(TAG, TAG + "init");
31 | }
32 |
33 | public HookInput(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, boolean isLazy) {
34 | super(instance, dom, parent, isLazy);
35 | Log.e(TAG, TAG + "init");
36 | }
37 |
38 |
39 | //benmu.org
40 | @WXComponentProp(name = HookConstants.NAME.TINTCOLOR)
41 | public void setTintColor(String tintColor) {
42 |
43 | if (TextUtils.isEmpty(tintColor)) return;
44 | try {
45 | EditText editText = getHostView();
46 | Field cursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
47 | cursorDrawableRes.setAccessible(true);
48 | int drawableId = cursorDrawableRes.getInt(editText);
49 | Field mEditor = TextView.class.getDeclaredField("mEditor");
50 | mEditor.setAccessible(true);
51 | Object editor = mEditor.get(editText);
52 | Class> clazz = editor.getClass();
53 | Field mCursorDrawable = clazz.getDeclaredField("mCursorDrawable");
54 | mCursorDrawable.setAccessible(true);
55 | Drawable[] drawables = new Drawable[1];
56 | drawables[0] = editText.getContext().getResources().getDrawable(drawableId);
57 | drawables[0].setColorFilter(WXResourceUtils.getColor(tintColor), PorterDuff.Mode
58 | .SRC_IN);
59 | mCursorDrawable.set(editor, drawables);
60 | } catch (NoSuchFieldException e) {
61 | e.printStackTrace();
62 | } catch (IllegalAccessException e) {
63 | e.printStackTrace();
64 | }
65 | }
66 |
67 | //benmu.org
68 |
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/hook/ui/components/HookTextarea.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.hook.ui.components;
2 |
3 | import android.graphics.PorterDuff;
4 | import android.graphics.drawable.Drawable;
5 | import android.text.TextUtils;
6 | import android.util.Log;
7 | import android.widget.EditText;
8 | import android.widget.TextView;
9 |
10 | import com.eros.framework.extend.hook.HookConstants;
11 | import com.taobao.weex.WXSDKInstance;
12 | import com.taobao.weex.dom.WXDomObject;
13 | import com.taobao.weex.ui.component.Textarea;
14 | import com.taobao.weex.ui.component.WXComponentProp;
15 | import com.taobao.weex.ui.component.WXVContainer;
16 | import com.taobao.weex.utils.WXResourceUtils;
17 |
18 | import java.lang.reflect.Field;
19 |
20 | /**
21 | * Created by Carry on 2018/4/17.
22 | */
23 |
24 | public class HookTextarea extends Textarea {
25 | private String TAG = getClass().getName();
26 |
27 | public HookTextarea(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, boolean
28 | isLazy) {
29 | super(instance, dom, parent, isLazy);
30 | Log.e(TAG, TAG + "init");
31 | }
32 |
33 |
34 | //benmu.org
35 | @WXComponentProp(name = HookConstants.NAME.TINTCOLOR)
36 | public void setTintColor(String tintColor) {
37 |
38 | if (TextUtils.isEmpty(tintColor)) return;
39 | try {
40 | EditText editText = getHostView();
41 | Field cursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
42 | cursorDrawableRes.setAccessible(true);
43 | int drawableId = cursorDrawableRes.getInt(editText);
44 | Field mEditor = TextView.class.getDeclaredField("mEditor");
45 | mEditor.setAccessible(true);
46 | Object editor = mEditor.get(editText);
47 | Class> clazz = editor.getClass();
48 | Field mCursorDrawable = clazz.getDeclaredField("mCursorDrawable");
49 | mCursorDrawable.setAccessible(true);
50 | Drawable[] drawables = new Drawable[1];
51 | drawables[0] = editText.getContext().getResources().getDrawable(drawableId);
52 | drawables[0].setColorFilter(WXResourceUtils.getColor(tintColor), PorterDuff.Mode
53 | .SRC_IN);
54 | mCursorDrawable.set(editor, drawables);
55 | } catch (NoSuchFieldException e) {
56 | e.printStackTrace();
57 | } catch (IllegalAccessException e) {
58 | e.printStackTrace();
59 | }
60 | }
61 |
62 | //benmu.org
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/hook/ui/view/HookBounceRecyclerView.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.hook.ui.view;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import com.taobao.weex.ui.view.refresh.wrapper.BounceRecyclerView;
7 | import com.taobao.weex.utils.WXViewUtils;
8 |
9 | /**
10 | * Created by Carry on 2018/4/17.
11 | */
12 |
13 | public class HookBounceRecyclerView extends BounceRecyclerView {
14 | public HookBounceRecyclerView(Context context, int type, int columnCount, float columnGap,
15 | int orientation) {
16 | super(context, type, columnCount, columnGap, orientation);
17 | }
18 |
19 | public HookBounceRecyclerView(Context context, int type, int orientation) {
20 | super(context, type, orientation);
21 | }
22 |
23 |
24 | //benmu.org
25 | public void setCustomHeaderView(View view){
26 | setRefreshEnable(true);
27 | swipeLayout.setRefreshHeight(WXViewUtils.dip2px(40));
28 | swipeLayout.getHeaderView().setRefreshView(view);
29 | }
30 | //benmu.org
31 |
32 | public void setCustomFootView(View view){ // iCoastline 下拉加载更多
33 | setLoadmoreEnable(true);
34 | swipeLayout.setLoadingHeight(WXViewUtils.dip2px(40));
35 | swipeLayout.getFooterView().setRefreshView(view);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/hook/ui/view/HookBounceScrollerView.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.hook.ui.view;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import com.taobao.weex.ui.component.WXScroller;
7 | import com.taobao.weex.ui.view.refresh.wrapper.BounceScrollerView;
8 | import com.taobao.weex.utils.WXViewUtils;
9 |
10 | /**
11 | * Created by Carry on 2018/4/20.
12 | */
13 |
14 | public class HookBounceScrollerView extends BounceScrollerView {
15 | public HookBounceScrollerView(Context context, int orientation, WXScroller waScroller) {
16 | super(context, orientation, waScroller);
17 | }
18 |
19 |
20 | //benmu.org
21 | public void setCustomHeaderView(View view) {
22 | setRefreshEnable(true);
23 | swipeLayout.setRefreshHeight(WXViewUtils.dip2px(40));
24 | swipeLayout.getHeaderView().setRefreshView(view);
25 | }
26 | //benmu.org
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/hook/ui/view/refresh/loadmore/BaseLoadMore.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.hook.ui.view.refresh.loadmore;
2 |
3 | import android.content.Context;
4 | import android.widget.FrameLayout;
5 |
6 | import com.taobao.weex.ui.component.WXComponent;
7 | import com.taobao.weex.ui.view.refresh.core.WXSwipeLayout;
8 |
9 | import java.lang.ref.WeakReference;
10 |
11 | /**
12 | * Created by Carry on 2017/5/10.
13 | */
14 |
15 | public abstract class BaseLoadMore extends FrameLayout implements WXSwipeLayout
16 | .WXOnLoadingListener {
17 | protected WeakReference mWeakReference;
18 | public static final int STATE_IDLE = 0;
19 | public static final int STATE_REFRESHING = 1;
20 | public int mCurrentState = STATE_IDLE;
21 |
22 | public BaseLoadMore(Context context, WXComponent component) {
23 | super(context);
24 | if (mWeakReference == null) {
25 | mWeakReference = new WeakReference(component);
26 | }
27 | }
28 |
29 |
30 | public abstract void onLoadComplete();
31 |
32 | }
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/mediator/MediatorInstance.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.mediator;
2 |
3 | import android.content.Context;
4 |
5 | import com.taobao.weex.WXSDKInstance;
6 |
7 | import static com.eros.framework.extend.mediator.MediatorDocker.STATUS_DESTORY;
8 | import static com.eros.framework.extend.mediator.MediatorDocker.STATUS_INIT;
9 |
10 | /**
11 | * Created by Carry on 2018/1/4.
12 | */
13 |
14 | public class MediatorInstance {
15 | private WXSDKInstance mInstance;
16 | private int status;
17 |
18 | public MediatorInstance(Context context) {
19 | this.mInstance = new WXSDKInstance(context);
20 | this.status = STATUS_INIT;
21 | }
22 |
23 | public void destory() {
24 | this.mInstance.destroy();
25 | this.mInstance = null;
26 | this.status = STATUS_DESTORY;
27 | }
28 |
29 |
30 | public WXSDKInstance getmInstance() {
31 | return mInstance;
32 | }
33 |
34 | public void setmInstance(WXSDKInstance mInstance) {
35 | this.mInstance = mInstance;
36 | }
37 |
38 | public int getStatus() {
39 | return status;
40 | }
41 |
42 | public void setStatus(int status) {
43 | this.status = status;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/module/AppConfigModule.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.module;
2 |
3 | import android.content.Intent;
4 | import android.support.v4.content.LocalBroadcastManager;
5 |
6 | import com.eros.framework.constant.Constant;
7 | import com.eros.framework.manager.ManagerFactory;
8 | import com.eros.framework.manager.impl.ParseManager;
9 | import com.eros.framework.model.AppConfigBean;
10 | import com.eros.framework.utils.JsPoster;
11 | import com.eros.framework.utils.SharePreferenceUtil;
12 | import com.eros.widget.utils.BaseCommonUtil;
13 | import com.taobao.weex.annotation.JSMethod;
14 | import com.taobao.weex.bridge.JSCallback;
15 | import com.taobao.weex.common.WXModule;
16 |
17 | /**
18 | * 获取应用参数,环境配置
19 | */
20 | public class AppConfigModule extends WXModule {
21 | private AppConfigBean mFontSizeBean;
22 |
23 | @JSMethod(uiThread = false)
24 | public void changeFontSize(String options, JSCallback jsCallback) {
25 | initFontSize();
26 | if (options == null) {
27 | JsPoster.postSuccess(mFontSizeBean, jsCallback);
28 | return;
29 | }
30 | Object obj = ManagerFactory.getManagerService(ParseManager.class).parseObject(options)
31 | .get("fontSize");
32 | if (obj != null && obj instanceof String) {
33 | String fontSize = (String) obj;
34 | if (fontSize.equals(mFontSizeBean.fontSize)) {
35 | JsPoster.postSuccess(mFontSizeBean, jsCallback);
36 | return;
37 | }
38 |
39 | mFontSizeBean.fontSize = fontSize;
40 | Intent intent = new Intent(Constant.Action.ACTION_GOBALFONTSIZE_CHANGE);
41 | intent.putExtra("currentFontSize", fontSize);
42 | LocalBroadcastManager.getInstance(mWXSDKInstance.getContext()).sendBroadcast(intent);
43 | SharePreferenceUtil.setAppFontSizeOption(mWXSDKInstance.getContext(), fontSize);
44 | }
45 |
46 | JsPoster.postSuccess(mFontSizeBean, jsCallback);
47 | }
48 |
49 |
50 | @JSMethod(uiThread = false)
51 | public void getFontSize(JSCallback jsCallback) {
52 | initFontSize();
53 | JsPoster.postSuccess(mFontSizeBean, jsCallback);
54 | }
55 |
56 | private void initFontSize() {
57 | if (mFontSizeBean == null) {
58 | String fontSize = SharePreferenceUtil.getAppFontSizeOption(mWXSDKInstance.getContext());
59 | mFontSizeBean = new AppConfigBean();
60 | mFontSizeBean.fontSize = fontSize;
61 | mFontSizeBean.scale = BaseCommonUtil.getScaleByFontsize(fontSize);
62 | }
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/module/AxiosModule.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.module;
2 |
3 |
4 | import com.eros.framework.constant.WXConstant;
5 | import com.eros.framework.constant.WXEventCenter;
6 | import com.eros.framework.manager.ManagerFactory;
7 | import com.eros.framework.manager.impl.dispatcher.DispatchEventManager;
8 | import com.eros.framework.model.WeexEventBean;
9 | import com.taobao.weex.annotation.JSMethod;
10 | import com.taobao.weex.bridge.JSCallback;
11 | import com.taobao.weex.common.WXModule;
12 |
13 |
14 | /**
15 | * Created by Carry on 17/1/16.
16 | */
17 |
18 | public class AxiosModule extends WXModule {
19 |
20 | @JSMethod(uiThread = false)
21 | public void fetch(String params, final JSCallback jsCallback) {
22 | WeexEventBean eventBean = new WeexEventBean();
23 | eventBean.setContext(mWXSDKInstance.getContext());
24 | eventBean.setKey( WXEventCenter.EVENT_FETCH);
25 | eventBean.setJsParams(params);
26 | eventBean.setJscallback(jsCallback);
27 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post
28 | (eventBean);
29 | }
30 | @JSMethod
31 | public void uploadImage(String params, final JSCallback jsCallback) {
32 | WeexEventBean eventBean = new WeexEventBean();
33 | eventBean.setContext(mWXSDKInstance.getContext());
34 | eventBean.setKey( WXEventCenter.EVENT_IMAGE_UPLOAD);
35 | eventBean.setJsParams(params);
36 | eventBean.setJscallback(jsCallback);
37 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post
38 | (eventBean);
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/module/BrowserImgModule.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.module;
2 |
3 | import com.eros.framework.constant.WXConstant;
4 | import com.eros.framework.constant.WXEventCenter;
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.impl.dispatcher.DispatchEventManager;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.taobao.weex.annotation.JSMethod;
9 | import com.taobao.weex.common.WXModule;
10 |
11 | /**
12 | * 点击跳转查看大图。
13 | */
14 |
15 | public class BrowserImgModule extends WXModule {
16 |
17 | @JSMethod(uiThread = true)
18 | public void open(String json) {
19 | WeexEventBean eventBean = new WeexEventBean();
20 | eventBean.setContext(mWXSDKInstance.getContext());
21 | eventBean.setKey(WXEventCenter.EVENT_BROWSERIMG);
22 | eventBean.setJsParams(json);
23 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(eventBean);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/module/CameraModule.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.module;
2 |
3 | import android.support.v7.app.AlertDialog;
4 |
5 | import com.eros.framework.constant.WXEventCenter;
6 | import com.eros.framework.manager.ManagerFactory;
7 | import com.eros.framework.manager.impl.dispatcher.DispatchEventManager;
8 | import com.eros.framework.model.WeexEventBean;
9 | import com.taobao.weex.annotation.JSMethod;
10 | import com.taobao.weex.bridge.JSCallback;
11 | import com.taobao.weex.common.WXModule;
12 |
13 | /**
14 | * Created by Carry on 17/2/8.
15 | */
16 |
17 | public class CameraModule extends WXModule {
18 | private JSCallback mScanCallback;
19 | private AlertDialog dialog;
20 | private JSCallback mUploadAvatar;
21 | private JSCallback mScreenShotCallback;
22 | private int size;
23 |
24 |
25 | @JSMethod(uiThread = true)
26 | public void scan(JSCallback callback) {
27 | WeexEventBean eventBean = new WeexEventBean();
28 | eventBean.setContext(mWXSDKInstance.getContext());
29 | eventBean.setKey(WXEventCenter.EVENT_CAMERA);
30 | eventBean.setJscallback(callback);
31 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(eventBean);
32 | }
33 |
34 |
35 | @JSMethod
36 | public void uploadImage(String params, JSCallback jsCallback) {
37 | WeexEventBean eventBean = new WeexEventBean();
38 | eventBean.setContext(mWXSDKInstance.getContext());
39 | eventBean.setKey(WXEventCenter.EVENT_CAMERA_UPLOADIMAGE);
40 | eventBean.setJsParams(params);
41 | eventBean.setJscallback(jsCallback);
42 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(eventBean);
43 | }
44 |
45 | @JSMethod
46 | public void cameraUpload(String params, JSCallback jsCallback) {
47 | WeexEventBean eventBean = new WeexEventBean();
48 | eventBean.setContext(mWXSDKInstance.getContext());
49 | eventBean.setKey(WXEventCenter.EVENT_CAMERA_PATH);
50 | eventBean.setJsParams(params);
51 | eventBean.setJscallback(jsCallback);
52 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(eventBean);
53 | }
54 |
55 |
56 | @JSMethod(uiThread = true)
57 | public void uploadScreenshot(JSCallback callback) {
58 | WeexEventBean eventBean = new WeexEventBean();
59 | eventBean.setContext(mWXSDKInstance.getContext());
60 | eventBean.setKey(WXEventCenter.EVENT_CAMERA_UPLOADSCREENSHOT);
61 | eventBean.setJscallback(callback);
62 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(eventBean);
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/module/CommunicationModule.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.module;
2 |
3 | import com.eros.framework.constant.WXConstant;
4 | import com.eros.framework.constant.WXEventCenter;
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.impl.dispatcher.DispatchEventManager;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.taobao.weex.annotation.JSMethod;
9 | import com.taobao.weex.bridge.JSCallback;
10 | import com.taobao.weex.common.WXModule;
11 |
12 | /**
13 | * Created by liuyuanxiao on 17/12/29.
14 | */
15 |
16 | public class CommunicationModule extends WXModule {
17 | @JSMethod
18 | public void call(String params) {
19 | WeexEventBean weexEventBean = new WeexEventBean();
20 | weexEventBean.setKey( WXEventCenter.EVENT_CALL);
21 | weexEventBean.setContext(mWXSDKInstance.getContext());
22 | weexEventBean.setJsParams(params);
23 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(weexEventBean);
24 | }
25 |
26 | @JSMethod
27 | public void sms(String recipients, String params, JSCallback callback) {
28 | WeexEventBean weexEventBean = new WeexEventBean();
29 | weexEventBean.setKey( WXEventCenter.EVENT_COMMUNICATION_SMS);
30 | weexEventBean.setContext(mWXSDKInstance.getContext());
31 | weexEventBean.setJsParams(params);
32 | weexEventBean.setJscallback(callback);
33 | weexEventBean.setExpand(recipients);
34 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(weexEventBean);
35 | }
36 |
37 | @JSMethod
38 | public void contacts(JSCallback callback) {
39 | WeexEventBean weexEventBean = new WeexEventBean();
40 | weexEventBean.setKey( WXEventCenter.EVENT_COMMUNICATION_CONTACTS);
41 | weexEventBean.setContext(mWXSDKInstance.getContext());
42 | weexEventBean.setJscallback(callback);
43 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(weexEventBean);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/module/EventModule.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.module;
2 |
3 | import android.content.Intent;
4 | import android.text.TextUtils;
5 |
6 | import com.eros.framework.constant.WXConstant;
7 | import com.eros.framework.constant.WXEventCenter;
8 | import com.eros.framework.event.mediator.EventCenter;
9 | import com.eros.framework.manager.ManagerFactory;
10 | import com.eros.framework.manager.impl.dispatcher.DispatchEventManager;
11 | import com.taobao.weex.annotation.JSMethod;
12 | import com.taobao.weex.bridge.JSCallback;
13 | import com.taobao.weex.common.WXModule;
14 |
15 | /**
16 | * Created by Carry on 17/3/30.
17 | */
18 |
19 | public class EventModule extends WXModule {
20 | @JSMethod
21 | public void on(String type, JSCallback callback) {
22 | if (!TextUtils.isEmpty(type) && callback != null) {
23 | EventCenter.Event event = new EventCenter.Event(mWXSDKInstance.getInstanceId(),
24 | false, callback, mWXSDKInstance.getBundleUrl(), type);
25 | Intent on = new Intent( WXEventCenter.EVENT_JS_ON);
26 | on.putExtra("data", event);
27 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(on);
28 | }
29 | }
30 |
31 | @JSMethod
32 | public void once(String type, JSCallback callback) {
33 | if (!TextUtils.isEmpty(type) && callback != null) {
34 | EventCenter.Event event = new EventCenter.Event(mWXSDKInstance.getInstanceId(), true
35 | , callback, mWXSDKInstance.getBundleUrl(), type);
36 | Intent once = new Intent( WXEventCenter.EVENT_JS_ON);
37 | once.putExtra("data", event);
38 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(once);
39 | }
40 | }
41 |
42 | @JSMethod
43 | public void emit(String type, Object params) {
44 | if (!TextUtils.isEmpty(type)) {
45 | Intent emit = new Intent( WXEventCenter.EVENT_JS_EMIT);
46 | emit.putExtra("data", new EventCenter.Emit(type, params));
47 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(emit);
48 | }
49 | }
50 |
51 | @JSMethod
52 | public void off(String type, JSCallback callback) {
53 | if (!TextUtils.isEmpty(type) && callback != null) {
54 | Intent off = new Intent( WXEventCenter.EVENT_JS_OFF);
55 | off.putExtra("data", new EventCenter.Off(type, callback));
56 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(off);
57 | }
58 | }
59 |
60 | @JSMethod
61 | public void offall() {
62 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(new Intent
63 | ( WXEventCenter
64 | .EVENT_JS_OFFALL));
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/module/GeolocationModule.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.module;
2 |
3 | import com.eros.framework.constant.WXConstant;
4 | import com.eros.framework.constant.WXEventCenter;
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.impl.dispatcher.DispatchEventManager;
7 | import com.eros.framework.model.WeexEventBean;
8 | import com.taobao.weex.annotation.JSMethod;
9 | import com.taobao.weex.bridge.JSCallback;
10 | import com.taobao.weex.common.WXModule;
11 |
12 | /**
13 | * Created by Carry on 17/1/19.
14 | */
15 |
16 | public class GeolocationModule extends WXModule {
17 | private JSCallback mGeoCallback;
18 |
19 | @JSMethod(uiThread = true)
20 | public void getGeolocation(JSCallback callback) {
21 | WeexEventBean eventBean = new WeexEventBean();
22 | eventBean.setContext(mWXSDKInstance.getContext());
23 | eventBean.setKey(WXEventCenter.EVENT_GEOLOCATION_GET);
24 | eventBean.setJscallback(callback);
25 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(eventBean);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/extend/module/UpdateModule.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.extend.module;
2 |
3 | import com.eros.framework.constant.WXEventCenter;
4 | import com.eros.framework.manager.ManagerFactory;
5 | import com.eros.framework.manager.impl.dispatcher.DispatchEventManager;
6 | import com.eros.framework.model.WeexEventBean;
7 | import com.eros.framework.utils.AppUtils;
8 | import com.taobao.weex.annotation.JSMethod;
9 | import com.taobao.weex.bridge.JSCallback;
10 | import com.taobao.weex.common.WXModule;
11 |
12 | public class UpdateModule extends WXModule {
13 |
14 | @JSMethod
15 | public void download(String params, JSCallback jsCallback) {
16 | WeexEventBean weexEventBean = new WeexEventBean();
17 | weexEventBean.setKey(WXEventCenter.EVENT_DOWNLOAD_BUNDLE);
18 | weexEventBean.setJsParams(params);
19 | weexEventBean.setContext(mWXSDKInstance.getContext());
20 | weexEventBean.setJscallback(jsCallback);
21 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(weexEventBean);
22 | }
23 |
24 | @JSMethod
25 | public void update() {
26 | WeexEventBean weexEventBean = new WeexEventBean();
27 | weexEventBean.setKey(WXEventCenter.EVENT_UPDATE_BUNDLE);
28 | weexEventBean.setContext(mWXSDKInstance.getContext());
29 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(weexEventBean);
30 | }
31 |
32 | @JSMethod(uiThread = true)
33 | public void getJsVersion(JSCallback jsCallback) {
34 | if (jsCallback != null) {
35 | jsCallback.invoke(AppUtils.getJsVersion(mWXSDKInstance.getContext()));
36 | }
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/manager/impl/CommunicationManager.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.manager.impl;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.provider.ContactsContract;
7 | import android.text.TextUtils;
8 |
9 | import com.eros.framework.activity.AbstractWeexActivity;
10 | import com.eros.framework.constant.Constant;
11 | import com.eros.framework.manager.Manager;
12 |
13 | /**
14 | * Created by liuyuanxiao on 17/12/29.
15 | */
16 |
17 | public class CommunicationManager extends Manager {
18 |
19 | public void sms(String recipients, String params, final Context context) {
20 | if (TextUtils.isEmpty(recipients)) return;
21 | Uri smsToUri = Uri.parse("smsto:" + recipients);
22 |
23 | Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri);
24 |
25 | intent.putExtra("sms_body", params);
26 |
27 | context.startActivity(intent);
28 | }
29 |
30 | public void contacts(final Context context) {
31 | if (context instanceof AbstractWeexActivity) {
32 | ((AbstractWeexActivity) context).startActivityForResult(new Intent(
33 | Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI), Constant.REQUEST_CODE.REQUEST_CODE_CONTRACT);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/manager/impl/GlobalEventManager.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.manager.impl;
2 |
3 | import com.eros.framework.manager.Manager;
4 | import com.taobao.weex.WXSDKInstance;
5 |
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | /**
10 | * Created by Carry on 2017/8/7.
11 | */
12 |
13 | public class GlobalEventManager extends Manager {
14 | public static final String TYPE_OPEN = "open";
15 | public static final String TYPE_BACK = "back";
16 | public static final String TYPE_REFRESH = "refresh";
17 |
18 | public static void onViewWillAppear(WXSDKInstance instance, String type) {
19 | Map map = new HashMap<>();
20 | map.put("type", type);
21 | instance.fireGlobalEventCallback("viewWillAppear", map);
22 | }
23 |
24 | public static void onViewDidAppear(WXSDKInstance instance, String type) {
25 | Map map = new HashMap<>();
26 | map.put("type", type);
27 | instance.fireGlobalEventCallback("viewDidAppear", map);
28 |
29 | }
30 |
31 | public static void onViewWillDisappear(WXSDKInstance instance, String type) {
32 | Map map = new HashMap<>();
33 | map.put("type", type);
34 | instance.fireGlobalEventCallback("viewWillDisappear", map);
35 | }
36 |
37 | public static void onViewDidDisappear(WXSDKInstance instance, String type) {
38 | Map map = new HashMap<>();
39 | map.put("type", type);
40 | instance.fireGlobalEventCallback("viewDidDisappear", map);
41 | }
42 |
43 |
44 | public static void appDeactive(WXSDKInstance instance) {
45 | if (instance != null) {
46 | instance.fireGlobalEventCallback("appDeactive", null);
47 | }
48 |
49 | }
50 |
51 |
52 | public static void appActive(WXSDKInstance instance) {
53 | if (instance != null) {
54 | instance.fireGlobalEventCallback("appActive", null);
55 | }
56 |
57 | }
58 |
59 | public static void pushMessage(WXSDKInstance instance, Map map) {
60 | if (instance != null) {
61 | instance.fireGlobalEventCallback("pushMessage", map);
62 | }
63 |
64 | }
65 |
66 | public static void homeBack(WXSDKInstance instance){
67 | if (instance != null) {
68 | instance.fireGlobalEventCallback("homeBack", null);
69 | }
70 | }
71 |
72 | public static void screenShotFinish(WXSDKInstance instance) {
73 | if (instance != null) {
74 | instance.fireGlobalEventCallback("screenshotFeedback", null);
75 | }
76 | }
77 |
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/manager/impl/ImageManager.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.manager.impl;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.adapter.DefaultImageAdapter;
6 | import com.eros.framework.manager.Manager;
7 | import com.eros.framework.model.UploadImageBean;
8 | import com.lzy.imagepicker.bean.ImageItem;
9 |
10 | import java.util.ArrayList;
11 |
12 | /**
13 | * Created by Carry on 2017/8/7.
14 | */
15 |
16 | public class ImageManager extends Manager {
17 |
18 |
19 | /**
20 | * 选择多张图片上传
21 | *
22 | * @param context 上线文对象
23 | * @param bean Js 返回的数据集合
24 | */
25 | public void pickPhoto(final Context context, UploadImageBean bean,int requestCode) {
26 | DefaultImageAdapter.getInstance().pickPhoto(context, bean,requestCode);
27 | }
28 |
29 | /**
30 | * 上传单张图片,裁剪
31 | */
32 | public void pickAvatar(final Context context, UploadImageBean bean,int requestCode) {
33 | DefaultImageAdapter.getInstance().pickAvatar(context, bean,requestCode);
34 | }
35 |
36 |
37 | /**
38 | * 上传多张图片
39 | *
40 | * @param items 选择图片集合
41 | * @param bean uplaod 参数对象
42 | */
43 | public void UpMultipleImageData(Context context, ArrayList items, UploadImageBean
44 | bean) {
45 | DefaultImageAdapter.getInstance().UpMultipleImageData(context, items, bean);
46 |
47 |
48 | }
49 |
50 | /**
51 | * 打开照相器 拍照
52 | */
53 | public void openCamera(Context context, UploadImageBean
54 | bean) {
55 | DefaultImageAdapter.getInstance().openCamera(context, bean);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/manager/impl/LifecycleManager.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.manager.impl;
2 |
3 | import android.app.Activity;
4 | import android.app.Application;
5 | import android.os.Bundle;
6 |
7 | import com.eros.framework.manager.Manager;
8 |
9 | /**
10 | * Created by Carry on 2017/9/4. app lifecycle manager
11 | */
12 |
13 | public class LifecycleManager extends Manager implements Application.ActivityLifecycleCallbacks {
14 | private int mCount = 0;
15 | private OnTaskSwitchListener mOnTaskSwitchListener;
16 |
17 | public LifecycleManager register(Application application) {
18 | application.registerActivityLifecycleCallbacks(this);
19 | return this;
20 | }
21 |
22 |
23 | @Override
24 | public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
25 |
26 | }
27 |
28 | @Override
29 | public void onActivityStarted(Activity activity) {
30 | if (mCount++ == 0) {
31 | mOnTaskSwitchListener.onTaskSwitchToForeground();
32 | }
33 | }
34 |
35 | @Override
36 | public void onActivityResumed(Activity activity) {
37 |
38 | }
39 |
40 | @Override
41 | public void onActivityPaused(Activity activity) {
42 |
43 | }
44 |
45 | @Override
46 | public void onActivityStopped(Activity activity) {
47 | if (--mCount == 0) {
48 | mOnTaskSwitchListener.onTaskSwitchToBackground();
49 | }
50 | }
51 |
52 | @Override
53 | public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
54 |
55 | }
56 |
57 | @Override
58 | public void onActivityDestroyed(Activity activity) {
59 |
60 | }
61 |
62 | public interface OnTaskSwitchListener {
63 |
64 | void onTaskSwitchToForeground();
65 |
66 | void onTaskSwitchToBackground();
67 | }
68 |
69 | public void setOnTaskSwitchListenner(OnTaskSwitchListener listenner) {
70 | this.mOnTaskSwitchListener = listenner;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/manager/impl/RouterManager.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.manager.impl;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.text.TextUtils;
7 |
8 | import com.eros.framework.adapter.router.DefaultRouterAdapter;
9 | import com.eros.framework.manager.Manager;
10 | import com.eros.framework.model.RouterModel;
11 | import com.taobao.weex.bridge.JSCallback;
12 |
13 | /**
14 | * Created by Carry on 2017/8/7. manage router
15 | */
16 |
17 | public class RouterManager extends Manager {
18 |
19 | public static void finish(Activity activity) {
20 | //TODO
21 | }
22 |
23 |
24 | public void dialing(final Context context, final String params) {
25 | //TODO
26 | DefaultRouterAdapter.getInstance().dialing(context, params);
27 | }
28 |
29 | public static void startActivity(Context context, Intent intent) {
30 | context.startActivity(intent);
31 | }
32 |
33 |
34 | public boolean open(Context context, String params, JSCallback callback) {
35 | return !(context == null || TextUtils.isEmpty(params)) && DefaultRouterAdapter
36 | .getInstance().open(context, params,callback);
37 | }
38 |
39 | public boolean back(Context context, String params) {
40 | return !(context == null || TextUtils.isEmpty(params)) && DefaultRouterAdapter
41 | .getInstance().back(context, params);
42 | }
43 |
44 | public RouterModel getParams(Context context) {
45 | return DefaultRouterAdapter.getInstance().getParams(context);
46 | }
47 |
48 | public boolean refresh(Context context) {
49 | return context != null && DefaultRouterAdapter.refresh(context);
50 |
51 | }
52 |
53 | public boolean finish(Context context){
54 | return context != null && DefaultRouterAdapter.finish(context);
55 | }
56 | public void toWebView(Context context, String params) {
57 | DefaultRouterAdapter.getInstance().toWebView(context, params);
58 | }
59 |
60 | public boolean openBrowser(Context context,String params){
61 | return DefaultRouterAdapter.getInstance().openBrowser(context, params);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/manager/impl/status/AndroidMHelper.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.manager.impl.status;
2 |
3 | import android.app.Activity;
4 | import android.os.Build;
5 | import android.view.View;
6 |
7 | /**
8 | * Created by kzl on 2016/5/17
9 | */
10 | public class AndroidMHelper implements IHelper {
11 | /**
12 | * @return if version is lager than M
13 | */
14 | @Override
15 | public boolean setStatusBarLightMode(Activity activity, boolean isFontColorDark) {
16 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
17 | if (isFontColorDark) {
18 | // 沉浸式
19 | // activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
20 | //非沉浸式
21 | activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
22 | } else {
23 | //非沉浸式
24 | activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
25 | }
26 | return true;
27 | }
28 | return false;
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/manager/impl/status/FlymeHelper.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.manager.impl.status;
2 |
3 | import android.app.Activity;
4 | import android.view.Window;
5 | import android.view.WindowManager;
6 |
7 | import java.lang.reflect.Field;
8 |
9 | /**
10 | * Created by kzl on 2016/5/17
11 | */
12 | public class FlymeHelper implements IHelper {
13 |
14 | /**
15 | * 设置状态栏图标为深色和魅族特定的文字风格
16 | * 可以用来判断是否为Flyme用户
17 | *
18 | * @param isFontColorDark 是否把状态栏字体及图标颜色设置为深色
19 | * @return boolean 成功执行返回true
20 | */
21 | @Override
22 | public boolean setStatusBarLightMode(Activity activity, boolean isFontColorDark) {
23 | Window window = activity.getWindow();
24 | boolean result = false;
25 | if (window != null) {
26 | try {
27 | WindowManager.LayoutParams lp = window.getAttributes();
28 | Field darkFlag = WindowManager.LayoutParams.class
29 | .getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
30 | Field meizuFlags = WindowManager.LayoutParams.class
31 | .getDeclaredField("meizuFlags");
32 | darkFlag.setAccessible(true);
33 | meizuFlags.setAccessible(true);
34 | int bit = darkFlag.getInt(null);
35 | int value = meizuFlags.getInt(lp);
36 | if (isFontColorDark) {
37 | value |= bit;
38 | } else {
39 | value &= ~bit;
40 | }
41 | meizuFlags.setInt(lp, value);
42 | window.setAttributes(lp);
43 | result = true;
44 | } catch (Exception e) {
45 | e.printStackTrace();
46 | }
47 | }
48 | return result;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/manager/impl/status/Helper.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.manager.impl.status;
2 |
3 | import android.app.Activity;
4 | import android.os.Build;
5 | import android.support.annotation.IntDef;
6 |
7 | import java.lang.annotation.Retention;
8 | import java.lang.annotation.RetentionPolicy;
9 |
10 | /**
11 | * Created by kzl on 2016/5/17
12 | */
13 | public class Helper {
14 | @IntDef({
15 | OTHER,
16 | MIUI,
17 | FLYME,
18 | ANDROID_M
19 | })
20 | @Retention(RetentionPolicy.SOURCE)
21 | public @interface SystemType {
22 |
23 | }
24 |
25 | public static final int OTHER = -1;
26 | public static final int MIUI = 1;
27 | public static final int FLYME = 2;
28 | public static final int ANDROID_M = 3;
29 |
30 |
31 | /**
32 | * 设置状态栏黑色字体图标,
33 | * 适配4.4以上版本MIUIV、Flyme和6.0以上版本其他Android
34 | *
35 | * @return 1:MIUI 2:Flyme 3:android6.0
36 | */
37 | public static int statusBarLightMode(Activity activity) {
38 | @SystemType int result = 0;
39 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
40 | if (new MIUIHelper().setStatusBarLightMode(activity, true)) {
41 | result = MIUI;
42 | } else if (new FlymeHelper().setStatusBarLightMode(activity, true)) {
43 | result = FLYME;
44 | } else if (new AndroidMHelper().setStatusBarLightMode(activity, true)) {
45 | result = ANDROID_M;
46 | }
47 | }
48 | return result;
49 | }
50 |
51 | /**
52 | * 已知系统类型时,设置状态栏黑色字体图标。
53 | * 适配4.4以上版本MIUI6、Flyme和6.0以上版本其他Android
54 | *
55 | * @param type 1:MIUI 2:Flyme 3:android6.0
56 | */
57 | public static void statusBarLightMode(Activity activity, @SystemType int type) {
58 | statusBarMode(activity, type, true);
59 |
60 | }
61 |
62 | /**
63 | * 清除MIUI或flyme或6.0以上版本状态栏黑色字体
64 | */
65 | public static void statusBarDarkMode(Activity activity, @SystemType int type) {
66 | statusBarMode(activity, type, false);
67 | }
68 |
69 | private static void statusBarMode(Activity activity, @SystemType int type, boolean isFontColorDark) {
70 | if (type == MIUI) {
71 | new MIUIHelper().setStatusBarLightMode(activity, isFontColorDark);
72 | } else if (type == FLYME) {
73 | new FlymeHelper().setStatusBarLightMode(activity, isFontColorDark);
74 | } else if (type == ANDROID_M) {
75 | new AndroidMHelper().setStatusBarLightMode(activity, isFontColorDark);
76 | }
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/manager/impl/status/IHelper.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.manager.impl.status;
2 |
3 | import android.app.Activity;
4 |
5 | /**
6 | * Created by kzl on 2016/5/17
7 | */
8 | public interface IHelper {
9 | boolean setStatusBarLightMode(Activity activity, boolean isFontColorDark);
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/manager/impl/status/MIUIHelper.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.manager.impl.status;
2 |
3 | import android.app.Activity;
4 | import android.view.View;
5 | import android.view.Window;
6 |
7 | import java.lang.reflect.Field;
8 | import java.lang.reflect.Method;
9 |
10 | /**
11 | * Created by kzl on 2016/5/17
12 | */
13 | public class MIUIHelper implements IHelper {
14 |
15 | /**
16 | * 设置状态栏字体图标为深色,需要MIUI6以上
17 | *
18 | * @param isFontColorDark 是否把状态栏字体及图标颜色设置为深色
19 | * @return boolean 成功执行返回true
20 | */
21 | @Override
22 | public boolean setStatusBarLightMode(Activity activity, boolean isFontColorDark) {
23 | Window window = activity.getWindow();
24 | boolean result = false;
25 | if (window != null) {
26 | Class clazz = window.getClass();
27 | try {
28 | int darkModeFlag = 0;
29 | Class layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
30 | Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
31 | darkModeFlag = field.getInt(layoutParams);
32 | Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
33 | if (isFontColorDark) {
34 | extraFlagField.invoke(window, darkModeFlag, darkModeFlag);//状态栏透明且黑色字体
35 | window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
36 | } else {
37 | extraFlagField.invoke(window, 0, darkModeFlag);//清除黑色字体
38 | int flag = window.getDecorView().getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
39 | window.getDecorView().setSystemUiVisibility(flag);
40 | }
41 | result = true;
42 | } catch (Exception e) {
43 | e.printStackTrace();
44 | }
45 | }
46 | return result;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/AppConfigBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 |
4 | /**
5 | * Js回调Bean
6 | */
7 | public class AppConfigBean {
8 | public String fontSize;
9 | public float scale;
10 | }
11 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/AxiosGet.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.util.HashMap;
4 |
5 | /**
6 | * Js get请求联网所需参数
7 | */
8 | public class AxiosGet {
9 | public String method;
10 | public String url;
11 | public HashMap header;
12 | public boolean noRepeat;
13 | public HashMap data;
14 | public long timeout;
15 | }
16 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/AxiosPost.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.HashMap;
5 |
6 | /**
7 | * Js post请求联网所需参数
8 | */
9 | public class AxiosPost implements Serializable {
10 | public String method;
11 | public String url;
12 | public HashMap header;
13 | public boolean noRepeat;
14 | public String data;
15 | public long timeout;
16 | }
17 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/AxiosResultBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Axios 数据返回类
7 | */
8 | public class AxiosResultBean implements Serializable {
9 | public Object status;
10 | public String errorMsg = "";
11 | public Object data;
12 | public Object header;
13 |
14 | public AxiosResultBean() {
15 | }
16 |
17 | public AxiosResultBean(Object status, String errorMsg, Object data, Object header) {
18 | this.status = status;
19 | this.errorMsg = errorMsg;
20 | this.data = data;
21 | this.header = header;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/BMScrollBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * js 滑动漂移量获取
7 | */
8 | public class BMScrollBean implements Serializable {
9 | public static class OffSet {
10 | public int x;
11 | public int y;
12 |
13 | public OffSet(int x, int y) {
14 | this.x = x;
15 | this.y = y;
16 | }
17 | }
18 |
19 | public static class Size {
20 | public int height;
21 | public int width;
22 |
23 | public Size(int height, int width) {
24 | this.height = height;
25 | this.width = width;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/BroeserImgModuleBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.List;
5 |
6 | /**
7 | * 图片预览数据解析
8 | */
9 | public class BroeserImgModuleBean implements Serializable {
10 |
11 |
12 | private int index; // 所点击图片下标
13 | private int type;// 图片的来源是本地还是网路
14 | private List images;//图片的网络地址
15 |
16 | public int getIndex() {
17 | return index;
18 | }
19 |
20 | public void setIndex(int index) {
21 | this.index = index;
22 | }
23 |
24 | public int getType() {
25 | return type;
26 | }
27 |
28 | public void setType(String stingType) {
29 | if (stingType == null) return;
30 | if (stingType.equals("local")) {
31 | //源于本地
32 | this.type = 1;
33 | } else if (stingType.equals("network")) {
34 | //源于网络
35 | this.type = 2;
36 | }
37 | }
38 |
39 | public List getImages() {
40 | return images;
41 | }
42 |
43 | public void setImages(List images) {
44 | this.images = images;
45 | }
46 |
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/CallPhoneBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | /**
4 | * Created by liuyuanxiao on 18/1/10.
5 | */
6 |
7 | public class CallPhoneBean {
8 | public String to;
9 | public boolean tip;
10 | }
11 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/CameraResultBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 |
4 | /**
5 | * 扫描二维码,结果返回Js
6 | */
7 | public class CameraResultBean {
8 | public String text;
9 | }
10 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/CidBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | /**
4 | * Created by Carry on 2017/11/15.
5 | */
6 |
7 | public class CidBean {
8 | private String cid;
9 |
10 | public String getCid() {
11 | return cid;
12 | }
13 |
14 | public void setCid(String cid) {
15 | this.cid = cid;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/JsVersionInfoBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by Carry on 2017/7/12.
7 | */
8 |
9 | public class JsVersionInfoBean implements Serializable {
10 | private String jsVersion;
11 | private String android;
12 | private String timestamp;
13 |
14 | public JsVersionInfoBean(String jsVersion, String android, String timestamp) {
15 | this.jsVersion = jsVersion;
16 | this.android = android;
17 | this.timestamp = timestamp;
18 | }
19 |
20 | public JsVersionInfoBean() {
21 | }
22 |
23 | public String getJsVersion() {
24 | return jsVersion;
25 | }
26 |
27 | public void setJsVersion(String jsVersion) {
28 | this.jsVersion = jsVersion;
29 | }
30 |
31 | public String getAndroid() {
32 | return android;
33 | }
34 |
35 | public void setAndroid(String android) {
36 | this.android = android;
37 | }
38 |
39 | public String getTimestamp() {
40 | return timestamp;
41 | }
42 |
43 | public void setTimestamp(String timestamp) {
44 | this.timestamp = timestamp;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/Md5MapperModel.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.List;
5 |
6 | /**
7 | * 验证更新包,解析Json,Md5
8 | */
9 | public class Md5MapperModel implements Serializable {
10 | private List- filesMd5;
11 | private String android;
12 | private String appName;
13 | private String jsVersion;
14 | private String timestamp;
15 |
16 | public String getTimestamp() {
17 | return timestamp;
18 | }
19 |
20 | public void setTimestamp(String timestamp) {
21 | this.timestamp = timestamp;
22 | }
23 |
24 | public String getAndroid() {
25 | return android;
26 | }
27 |
28 | public void setAndroid(String android) {
29 | this.android = android;
30 | }
31 |
32 | public String getAppName() {
33 | return appName;
34 | }
35 |
36 | public void setAppName(String appName) {
37 | this.appName = appName;
38 | }
39 |
40 | public String getJsVersion() {
41 | return jsVersion;
42 | }
43 |
44 | public void setJsVersion(String jsVersion) {
45 | this.jsVersion = jsVersion;
46 | }
47 |
48 | public List
- getFilesMd5() {
49 | return filesMd5;
50 | }
51 |
52 | public void setFilesMd5(List
- filesMd5) {
53 | this.filesMd5 = filesMd5;
54 | }
55 |
56 | public static class Item implements Comparable
- {
57 | private String android;
58 | private String page;
59 | private String md5;
60 |
61 | public String getAndroid() {
62 | return android;
63 | }
64 |
65 | public void setAndroid(String android) {
66 | this.android = android;
67 | }
68 |
69 | public String getPage() {
70 | return page;
71 | }
72 |
73 | public void setPage(String page) {
74 | this.page = page;
75 | }
76 |
77 | public String getMd5() {
78 | return md5;
79 | }
80 |
81 | public void setMd5(String md5) {
82 | this.md5 = md5;
83 | }
84 |
85 |
86 | @Override
87 | public int compareTo(Item another) {
88 | if(this.md5.compareTo(another.getMd5())>0){
89 | return 1;
90 | }else if(this.md5.compareTo(another.getMd5())==0){
91 | return 0;
92 | }else if(this.md5.compareTo(another.getMd5())<0){
93 | return -1;
94 | }else {
95 | return 0;
96 | }
97 | }
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/MedicalMapModel.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by Carry on 2017/6/7.
7 | */
8 |
9 | public class MedicalMapModel implements Serializable {
10 | private String type;
11 | private String title;
12 | private NavigationInfo navigationInfo;
13 |
14 | public static class NavigationInfo implements Serializable{
15 | private String title;
16 | private String address;
17 | private String longitude;
18 | private String latitude;
19 |
20 | public String getTitle() {
21 | return title;
22 | }
23 |
24 | public void setTitle(String title) {
25 | this.title = title;
26 | }
27 |
28 | public String getAddress() {
29 | return address;
30 | }
31 |
32 | public void setAddress(String address) {
33 | this.address = address;
34 | }
35 |
36 | public String getLongitude() {
37 | return longitude;
38 | }
39 |
40 | public void setLongitude(String longitude) {
41 | this.longitude = longitude;
42 | }
43 |
44 | public String getLatitude() {
45 | return latitude;
46 | }
47 |
48 | public void setLatitude(String latitude) {
49 | this.latitude = latitude;
50 | }
51 | }
52 |
53 | public String getType() {
54 | return type;
55 | }
56 |
57 | public void setType(String type) {
58 | this.type = type;
59 | }
60 |
61 | public String getTitle() {
62 | return title;
63 | }
64 |
65 | public void setTitle(String title) {
66 | this.title = title;
67 | }
68 |
69 | public NavigationInfo getNavigationInfo() {
70 | return navigationInfo;
71 | }
72 |
73 | public void setNavigationInfo(NavigationInfo navigationInfo) {
74 | this.navigationInfo = navigationInfo;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/ModalBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 |
5 |
6 | /**
7 | * 弹窗内容Json 解析
8 | */
9 | public class ModalBean implements Serializable {
10 | private String message;
11 | private String okTitle;
12 | private String cancelTitle;
13 | private String title;
14 | private int duration;
15 | private String titleAlign;
16 | private String messageAlign;
17 |
18 | public String getTitleAlign() {
19 | return titleAlign;
20 | }
21 |
22 | public void setTitleAlign(String titleAlign) {
23 | this.titleAlign = titleAlign;
24 | }
25 |
26 | public String getMessageAlign() {
27 | return messageAlign;
28 | }
29 |
30 | public void setMessageAlign(String messageAlign) {
31 | this.messageAlign = messageAlign;
32 | }
33 |
34 | public int getDuration() {
35 | return duration;
36 | }
37 |
38 | public void setDuration(int duration) {
39 | this.duration = duration;
40 | }
41 |
42 | public String getMessage() {
43 | return message;
44 | }
45 |
46 | public void setMessage(String message) {
47 | this.message = message;
48 | }
49 |
50 | public String getOkTitle() {
51 | return okTitle;
52 | }
53 |
54 | public void setOkTitle(String okTitle) {
55 | this.okTitle = okTitle;
56 | }
57 |
58 | public String getCancelTitle() {
59 | return cancelTitle;
60 | }
61 |
62 | public void setCancelTitle(String cancelTitle) {
63 | this.cancelTitle = cancelTitle;
64 | }
65 |
66 | public String getTitle() {
67 | return title;
68 | }
69 |
70 | public void setTitle(String title) {
71 | this.title = title;
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/NatigatorModel.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by Carry on 2017/9/14.
7 | */
8 |
9 | public class NatigatorModel implements Serializable {
10 | private String title;
11 | private boolean navShow;
12 | private String statusBarStyle;
13 |
14 | public String getTitle() {
15 | return title;
16 | }
17 |
18 | public void setTitle(String title) {
19 | this.title = title;
20 | }
21 |
22 | public boolean isNavShow() {
23 | return navShow;
24 | }
25 |
26 | public void setNavShow(boolean navShow) {
27 | this.navShow = navShow;
28 | }
29 |
30 | public String getStatusBarStyle() {
31 | return statusBarStyle;
32 | }
33 |
34 | public void setStatusBarStyle(String statusBarStyle) {
35 | this.statusBarStyle = statusBarStyle;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/NavModule.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by Carry on 2018/1/10.
7 | */
8 |
9 | public class NavModule implements Serializable {
10 | //导航方式
11 | private String type;
12 | //目的地名称
13 | private String title;
14 | //目的地纬度
15 | private String longitude;
16 | //目的地经度
17 | private String latitude;
18 | //当前纬度
19 | private String currentLongitude;
20 | //当前经度
21 | private String currentLatitude;
22 |
23 |
24 | public String getCurrentLongitude() {
25 | return currentLongitude;
26 | }
27 |
28 | public void setCurrentLongitude(String currentLongitude) {
29 | this.currentLongitude = currentLongitude;
30 | }
31 |
32 | public String getCurrentLatitude() {
33 | return currentLatitude;
34 | }
35 |
36 | public void setCurrentLatitude(String currentLatitude) {
37 | this.currentLatitude = currentLatitude;
38 | }
39 |
40 | public String getType() {
41 | return type;
42 | }
43 |
44 | public void setType(String type) {
45 | this.type = type;
46 | }
47 |
48 | public String getTitle() {
49 | return title;
50 | }
51 |
52 | public void setTitle(String title) {
53 | this.title = title;
54 | }
55 |
56 | public String getLongitude() {
57 | return longitude;
58 | }
59 |
60 | public void setLongitude(String longitude) {
61 | this.longitude = longitude;
62 | }
63 |
64 | public String getLatitude() {
65 | return latitude;
66 | }
67 |
68 | public void setLatitude(String latitude) {
69 | this.latitude = latitude;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/NavigatorBarModel.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by Carry on 2018/1/5.
7 | */
8 |
9 | public class NavigatorBarModel implements Serializable {
10 | //导航栏标题
11 | private String navTitle;
12 | //是否显示导航
13 | private boolean navShow;
14 | //状态栏样式
15 | private String statusBarStyle;
16 | private String text;
17 | private String textColor;
18 | private String fontSize="32";
19 | //是否加粗
20 | private String fontWeight="normal";
21 | private String image;
22 |
23 | public String getNavTitle() {
24 | return navTitle;
25 | }
26 |
27 | public void setNavTitle(String navTitle) {
28 | this.navTitle = navTitle;
29 | }
30 |
31 | public boolean isNavShow() {
32 | return navShow;
33 | }
34 |
35 | public void setNavShow(boolean navShow) {
36 | this.navShow = navShow;
37 | }
38 |
39 | public String getStatusBarStyle() {
40 | return statusBarStyle;
41 | }
42 |
43 | public void setStatusBarStyle(String statusBarStyle) {
44 | this.statusBarStyle = statusBarStyle;
45 | }
46 |
47 | public String getText() {
48 | return text;
49 | }
50 |
51 | public void setText(String text) {
52 | this.text = text;
53 | }
54 |
55 | public String getTextColor() {
56 | return textColor;
57 | }
58 |
59 | public void setTextColor(String textColor) {
60 | this.textColor = textColor;
61 | }
62 |
63 | public String getFontSize() {
64 | return fontSize;
65 | }
66 |
67 | public void setFontSize(String fontSize) {
68 | this.fontSize = fontSize;
69 | }
70 |
71 | public String getFontWeight() {
72 | return fontWeight;
73 | }
74 |
75 | public void setFontWeight(String fontWeight) {
76 | this.fontWeight = fontWeight;
77 | }
78 |
79 | public String getImage() {
80 | return image;
81 | }
82 |
83 | public void setImage(String image) {
84 | this.image = image;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/NavigatorModel.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import com.taobao.weex.bridge.JSCallback;
4 |
5 | /**
6 | * Created by liuyuanxiao on 2018/5/29.
7 | */
8 |
9 | public class NavigatorModel {
10 | public String navigatorModel;
11 |
12 | public String leftNavigatorbarModel;
13 | public JSCallback leftItemJsCallback;
14 |
15 | public String rightNavigatorbarModel;
16 | public JSCallback rightItemJsCallback;
17 |
18 | public String centerNavigatorBarModel;
19 | public JSCallback centerItemJsCallback;
20 |
21 |
22 | // //setNavigationInfo
23 | // public String infoTitle;
24 | // public boolean navShow;
25 | // public String statusBarStyle;
26 | // //setLeftItem
27 | // public String leftItemText;
28 | // public String leftItemtextColor;
29 | // public String leftItemfontWeight;
30 | // public String leftItemImag;
31 | // public JSCallback leftItemJsCallback;
32 | // //setRightItem
33 | // public String rightItemText;
34 | // public String rightItemtextColor;
35 | // public String rightItemfontWeight;
36 | // public String rightItemImag;
37 | // public JSCallback rightItemJsCallback;
38 | //
39 | // //setCenterItem
40 | // public String centerItemText;
41 | // public String centerItemtextColor;
42 | // public String centerItemfontWeight;
43 | // public String centerItemImag;
44 | // public JSCallback centerItemJsCallback;
45 |
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/RequestUrlBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 |
4 | /**
5 | * 帮助Js拼装参数,返回Js
6 | */
7 | public class RequestUrlBean extends BaseResultBean {
8 | public Result data;
9 |
10 | public static class Result {
11 | public String url;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/RouterModel.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import com.taobao.weex.bridge.SimpleJSCallback;
4 |
5 | import java.io.Serializable;
6 |
7 |
8 | /**
9 | * 导航解析Bean
10 | */
11 | public class RouterModel implements Serializable {
12 | public String url;
13 | public String type;
14 | public Object params;
15 | public int length;
16 | public boolean canBack = true;
17 | public String navTitle;
18 | public boolean navShow;
19 | public String statusBarStyle = "Default";
20 | public boolean isRunBackCallback;
21 | public SimpleJSCallback backCallback;
22 | public String backgroundColor;
23 |
24 |
25 | public RouterModel() {
26 | }
27 |
28 |
29 | public RouterModel(String url, String type, Object params, String title, boolean navShow,
30 | String statusBarStyle, String backgroundColor) {
31 | this.url = url;
32 | this.type = type;
33 | this.params = params;
34 | this.navTitle = title;
35 | this.navShow = navShow;
36 | this.statusBarStyle = statusBarStyle;
37 | this.backgroundColor = backgroundColor;
38 | }
39 |
40 |
41 | public RouterModel(String url, String type, Object params, String title, boolean navShow,
42 | String statusBarStyle) {
43 | this.url = url;
44 | this.type = type;
45 | this.params = params;
46 | this.navTitle = title;
47 | this.navShow = navShow;
48 | this.statusBarStyle = statusBarStyle;
49 | }
50 |
51 |
52 | public RouterModel(String url, String type, Object params, String title, boolean navShow,
53 | String statusBarStyle, boolean canBack) {
54 | this.url = url;
55 | this.type = type;
56 | this.params = params;
57 | this.navTitle = title;
58 | this.navShow = navShow;
59 | this.canBack = canBack;
60 | this.statusBarStyle = statusBarStyle;
61 | }
62 |
63 |
64 | public RouterModel(String url, String type, Object params, int length, boolean canBack,
65 | String title, boolean navShow, String statusBarStyle, boolean
66 | isRunBackCallback) {
67 | this.url = url;
68 | this.type = type;
69 | this.params = params;
70 | this.length = length;
71 | this.canBack = canBack;
72 | this.navTitle = title;
73 | this.navShow = navShow;
74 | this.statusBarStyle = statusBarStyle;
75 | this.isRunBackCallback = isRunBackCallback;
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/ScanImageBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.List;
5 |
6 | /**
7 | * 识别图片,解析Bean
8 | */
9 | public class ScanImageBean implements Serializable {
10 | public String path;
11 | }
12 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/TabbarBadgeModule.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by liuyuanxiao on 2018/6/21.
7 | */
8 |
9 | public class TabbarBadgeModule implements Serializable {
10 | public int index;
11 | public int value;
12 | public String textColor;
13 | public String bgColor;
14 |
15 | public int getIndex() {
16 | return index;
17 | }
18 |
19 | public void setIndex(int index) {
20 | this.index = index;
21 | }
22 |
23 | public int getValue() {
24 | return value;
25 | }
26 |
27 | public void setValue(int value) {
28 | this.value = value;
29 | }
30 |
31 | public String getTextColor() {
32 | return textColor;
33 | }
34 |
35 | public void setTextColor(String textColor) {
36 | this.textColor = textColor;
37 | }
38 |
39 | public String getBgColor() {
40 | return bgColor;
41 | }
42 |
43 | public void setBgColor(String bgColor) {
44 | this.bgColor = bgColor;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/TabbarWatchBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | /**
4 | * Created by liuyuanxiao on 2018/7/25.
5 | */
6 |
7 | public class TabbarWatchBean {
8 | public int index;
9 | public int hsCode;
10 | public boolean isClear;
11 | public TabbarWatchBean(int index) {
12 | this.index = index;
13 | }
14 |
15 | public int getIndex() {
16 | return index;
17 | }
18 |
19 | public void setIndex(int index) {
20 | this.index = index;
21 | }
22 |
23 | public int getHsCode() {
24 | return hsCode;
25 | }
26 |
27 | public void setHsCode(int hsCode) {
28 | this.hsCode = hsCode;
29 | }
30 |
31 | public boolean isClear() {
32 | return isClear;
33 | }
34 |
35 | public void setClear(boolean clear) {
36 | isClear = clear;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/TitleModel.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 |
5 |
6 | /**
7 | * Title 数据解析Bean
8 | */
9 | public class TitleModel implements Serializable {
10 | public String title;
11 | public String subTitle;
12 | public boolean hideNavbar;
13 | public String bgColor;
14 | public boolean addStatusBar;
15 | private boolean navShow;
16 | private String statusBarStyle;
17 |
18 | public boolean isNavShow() {
19 | return navShow;
20 | }
21 |
22 | public void setNavShow(boolean navShow) {
23 | this.navShow = navShow;
24 | }
25 |
26 | public String getStatusBarStyle() {
27 | return statusBarStyle;
28 | }
29 |
30 | public void setStatusBarStyle(String statusBarStyle) {
31 | this.statusBarStyle = statusBarStyle;
32 | }
33 |
34 | private String text;
35 | private String textColor;
36 | private String image;
37 | private String fontSize;
38 | private String fontWeight;
39 |
40 | public String getFontSize() {
41 | return fontSize;
42 | }
43 |
44 | public void setFontSize(String fontSize) {
45 | this.fontSize = fontSize;
46 | }
47 |
48 | public String getFontWeight() {
49 | return fontWeight;
50 | }
51 |
52 | public void setFontWeight(String fontWeight) {
53 | this.fontWeight = fontWeight;
54 | }
55 |
56 | public TitleModel() {
57 | }
58 |
59 | public TitleModel(String title, String subTitle, boolean hideNavbar, String bgColor, boolean
60 | addStatusBar) {
61 | this.title = title;
62 | this.subTitle = subTitle;
63 | this.hideNavbar = hideNavbar;
64 | this.bgColor = bgColor;
65 | this.addStatusBar = addStatusBar;
66 | }
67 |
68 | public String getText() {
69 | return text;
70 | }
71 |
72 | public void setText(String text) {
73 | this.text = text;
74 | }
75 |
76 | public String getTextColor() {
77 | return textColor;
78 | }
79 |
80 | public void setTextColor(String textColor) {
81 | this.textColor = textColor;
82 | }
83 |
84 | public String getImage() {
85 | return image;
86 | }
87 |
88 | public void setImage(String image) {
89 | this.image = image;
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/UpdateOptionBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 |
5 | public class UpdateOptionBean implements Serializable {
6 | private String url;
7 | private boolean diff;
8 |
9 | public String getUrl() {
10 | return url;
11 | }
12 |
13 | public void setUrl(String url) {
14 | this.url = url;
15 | }
16 |
17 | public boolean isDiff() {
18 | return diff;
19 | }
20 |
21 | public void setDiff(boolean diff) {
22 | this.diff = diff;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/UploadImageBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.List;
5 |
6 | /**
7 | * 选择图片,数据,解析Bean
8 | */
9 | public class UploadImageBean implements Serializable {
10 | public String url;
11 | public int maxCount; //最大可选择几张
12 | public double imageWidth;// 压缩后,图片最大宽度
13 | public boolean allowCrop;//是否需要剪切为圆形
14 | public String params; //上传附带参数 json
15 | public String header;
16 | public List images; // 上传图片本地地址列表
17 | }
18 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/UploadResultBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Js,上传文件成功,返回数据
7 | */
8 |
9 | public class UploadResultBean extends BaseResultBean {
10 | public List data;
11 |
12 | public void setData(List data) {
13 | this.data = data;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/VersionBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * 版本信息等解析Bean
7 | */
8 | public class VersionBean extends BaseResultBean {
9 | public Data data;
10 |
11 | public VersionBean(int resCode, String msg) {
12 | super(resCode, msg);
13 | }
14 |
15 | public VersionBean(){}
16 |
17 | public static class Data implements Serializable {
18 | public String path;
19 | public boolean diff;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/WebViewParamBean.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.List;
5 |
6 | /**
7 | * Created by Carry on 2017/4/20.
8 | */
9 |
10 | public class WebViewParamBean implements Serializable {
11 | private String url;
12 | private String title;
13 | // private ShareInfoBean shareInfo;
14 | private boolean navShow;
15 | private String type;
16 |
17 | public String getType() {
18 | return type;
19 | }
20 |
21 | public void setType(String type) {
22 | this.type = type;
23 | }
24 |
25 | public boolean isNavShow() {
26 | return navShow;
27 | }
28 |
29 | public void setNavShow(boolean navShow) {
30 | this.navShow = navShow;
31 | }
32 |
33 | public String getUrl() {
34 | return url;
35 | }
36 |
37 | public void setUrl(String url) {
38 | this.url = url;
39 | }
40 |
41 | public String getTitle() {
42 | return title;
43 | }
44 |
45 | public void setTitle(String title) {
46 | this.title = title;
47 | }
48 |
49 | // public ShareInfoBean getShareInfo() {
50 | // return shareInfo;
51 | // }
52 | // public void setShareInfo(ShareInfoBean shareInfo) {
53 | // this.shareInfo = shareInfo;
54 | // }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/model/WeexEnvironment.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Map;
5 |
6 | /**
7 | * Created by Carry on 2017/10/23.
8 | */
9 |
10 | public class WeexEnvironment implements Serializable {
11 | private Map eros;
12 |
13 | public WeexEnvironment(Map eros) {
14 | this.eros = eros;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/receiver/NetworkReceiver.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.receiver;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.net.ConnectivityManager;
7 |
8 | import com.eros.framework.constant.WXConstant;
9 | import com.eros.framework.manager.ManagerFactory;
10 | import com.eros.framework.manager.impl.dispatcher.DispatchEventManager;
11 |
12 | /**
13 | * Created by Carry on 2018/5/30.
14 | */
15 |
16 | public class NetworkReceiver extends BroadcastReceiver {
17 |
18 | @Override
19 | public void onReceive(Context context, Intent intent) {
20 | if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) {
21 | ManagerFactory.getManagerService(DispatchEventManager.class).getBus().post(new Intent
22 | (WXConstant.ACTION_NETWORK_CHANGED));
23 | }
24 | }
25 |
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/utils/GeoUtils.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.utils;
2 |
3 | /**
4 | * Created by Carry on 2018/1/10.
5 | */
6 |
7 | public class GeoUtils {
8 | //GCJ坐标系转百度坐标系
9 | public static double[] gcj02_To_Bd09(double lat, double lon) {
10 | double x_pi = 3.14159265358979324 * 3000.0 / 180.0;
11 | double x = lon, y = lat;
12 | double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
13 | double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
14 | double tempLon = z * Math.cos(theta) + 0.0065;
15 | double tempLat = z * Math.sin(theta) + 0.006;
16 | return new double[]{tempLat, tempLon};
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/utils/IOUtil.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.utils;
2 |
3 | import java.io.ByteArrayOutputStream;
4 | import java.io.IOException;
5 | import java.io.InputStream;
6 |
7 | /**
8 | * Created by Carry on 2017/10/25.
9 | */
10 |
11 | public class IOUtil {
12 |
13 | public static byte[] readInputStream(InputStream inputStream) {
14 |
15 | // 1.建立通道对象
16 | ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
17 | // 2.定义存储空间
18 | byte[] buffer = new byte[1024];
19 | // 3.开始读文件
20 | int len = -1;
21 | try {
22 | if (inputStream != null) {
23 | while ((len = inputStream.read(buffer)) != -1) {
24 | // 将Buffer中的数据写到outputStream对象中
25 | outputStream.write(buffer, 0, len);
26 | }
27 | }
28 | // 4.关闭流
29 | outputStream.close();
30 | inputStream.close();
31 | } catch (IOException e) {
32 | e.printStackTrace();
33 | }
34 | return outputStream.toByteArray();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/utils/ImageCornerUtil.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.utils;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Canvas;
5 | import android.graphics.Paint;
6 | import android.graphics.PorterDuff;
7 | import android.graphics.PorterDuffXfermode;
8 | import android.graphics.Rect;
9 | import android.graphics.RectF;
10 | import android.util.Log;
11 |
12 | public class ImageCornerUtil {
13 | public static final int CORNER_TOP_LEFT = 1;
14 | public static final int CORNER_TOP_RIGHT = 1 << 1;
15 | public static final int CORNER_BOTTOM_LEFT = 1 << 2;
16 | public static final int CORNER_BOTTOM_RIGHT = 1 << 3;
17 | public static final int CORNER_ALL = CORNER_TOP_LEFT | CORNER_TOP_RIGHT | CORNER_BOTTOM_LEFT
18 | | CORNER_BOTTOM_RIGHT;
19 |
20 | /**
21 | * 把图片某固定角变成圆角
22 | *
23 | * @param bitmap 需要修改的图片
24 | * @param pixels 圆角的弧度
25 | * @param corners 需要显示圆弧的位置
26 | * @return 圆角图片
27 | */
28 | public static Bitmap toRoundCorner(Bitmap bitmap, int pixels, int corners) {
29 | //创建一个等大的画布
30 | Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config
31 | .ARGB_8888);
32 | Canvas canvas = new Canvas(output);
33 | final int color = 0xff424242;
34 | final Paint paint = new Paint();
35 | //获取一个跟图片相同大小的矩形
36 | final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
37 | //生成包含坐标的矩形对象
38 | final RectF rectF = new RectF(rect);
39 | //圆角的半径
40 | final float roundPx = pixels;
41 |
42 | paint.setAntiAlias(true); //去锯齿
43 | canvas.drawARGB(0, 0, 0, 0);
44 | paint.setColor(color);
45 | //绘制圆角矩形
46 | canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
47 | //异或将需要变为圆角的位置的二进制变为0
48 | int notRoundedCorners = corners ^ CORNER_ALL;
49 |
50 | //哪个角不是圆角我再把你用矩形画出来
51 | if ((notRoundedCorners & CORNER_TOP_LEFT) != 0) {
52 | canvas.drawRect(0, 0, roundPx, roundPx, paint);
53 | }
54 | if ((notRoundedCorners & CORNER_TOP_RIGHT) != 0) {
55 | canvas.drawRect(rectF.right - roundPx, 0, rectF.right, roundPx, paint);
56 | }
57 | if ((notRoundedCorners & CORNER_BOTTOM_LEFT) != 0) {
58 | canvas.drawRect(0, rectF.bottom - roundPx, roundPx, rectF.bottom, paint);
59 | }
60 | if ((notRoundedCorners & CORNER_BOTTOM_RIGHT) != 0) {
61 | canvas.drawRect(rectF.right - roundPx, rectF.bottom - roundPx, rectF.right, rectF
62 | .bottom, paint);
63 | }
64 | //通过SRC_IN的模式取源图片和圆角矩形重叠部分
65 | paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
66 | //绘制成Bitmap对象
67 | canvas.drawBitmap(bitmap, rect, rect, paint);
68 | return output;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/utils/InsertEnvUtil.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.utils;
2 |
3 | import com.eros.framework.BMWXEnvironment;
4 |
5 | import java.util.HashMap;
6 | import java.util.Map;
7 |
8 | /**
9 | * Created by Carry on 2017/10/23.
10 | */
11 |
12 | public class InsertEnvUtil {
13 | private static Map mEros=new HashMap<>();
14 |
15 | public static void customerRender(Map options) {
16 | if (options != null) {
17 | mEros.clear();
18 | if (BMWXEnvironment.mCustomer != null) {
19 | mEros.putAll(BMWXEnvironment.mCustomer);
20 | options.put("eros", mEros);
21 | }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/utils/PermissionUtils.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.utils;
2 |
3 | import android.content.Context;
4 |
5 | import com.eros.framework.manager.ManagerFactory;
6 | import com.eros.framework.manager.impl.PermissionManager;
7 |
8 | /**
9 | * 权限相关 工具类
10 | * Created by liuyuanxiao on 18/1/30.
11 | */
12 |
13 | public class PermissionUtils {
14 | /**
15 | * 查询权限并申请,未做回调处理
16 | */
17 | public static boolean checkPermission(Context context, String permission) {
18 | PermissionManager permissionManager = ManagerFactory.getManagerService(PermissionManager
19 | .class);
20 | boolean hasPermisson = permissionManager.hasPermissions(context, permission);
21 | if (!hasPermisson) {
22 | permissionManager.requestPermissions(context, null, permission);
23 | // ModalManager.BmToast.toast(context, "读取sd卡存储权限未授予,请到应用设置页面开启权限!", Toast.LENGTH_SHORT);
24 | }
25 | return hasPermisson;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/utils/TabbarListener.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.utils;
2 |
3 | /**
4 | * Created by liuyuanxiao on 2018/7/17.
5 | */
6 |
7 | public interface TabbarListener {
8 | void onPageSelected(int index);
9 | }
10 |
--------------------------------------------------------------------------------
/eros-framework/src/main/java/com/eros/framework/utils/TextUtil.java:
--------------------------------------------------------------------------------
1 | package com.eros.framework.utils;
2 |
3 | import com.alibaba.fastjson.JSON;
4 |
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 | import okio.Buffer;
9 |
10 | /**
11 | * Created by liuyuanxiao on 18/1/16.
12 | */
13 |
14 | public class TextUtil {
15 | public static List