├── .gitignore
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
├── release
│ ├── output.json
│ └── quickhybrid101.apk
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── quick
│ │ └── quickhybrid
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ ├── dist
│ │ │ ├── quick.h5.js
│ │ │ ├── quick.h5.min.js
│ │ │ ├── quick.js
│ │ │ ├── quick.min.js
│ │ │ ├── quick.native.js
│ │ │ └── quick.native.min.js
│ │ ├── examples
│ │ │ ├── api
│ │ │ │ ├── auth.html
│ │ │ │ ├── custom.html
│ │ │ │ ├── device.html
│ │ │ │ ├── navigator.html
│ │ │ │ ├── page.html
│ │ │ │ ├── runtime.html
│ │ │ │ ├── ui.html
│ │ │ │ └── util.html
│ │ │ ├── callapi.html
│ │ │ ├── common
│ │ │ │ ├── common.css
│ │ │ │ ├── common.js
│ │ │ │ ├── mui.picker
│ │ │ │ │ ├── mui.picker.css
│ │ │ │ │ ├── mui.picker.js
│ │ │ │ │ ├── mui.picker.min.css
│ │ │ │ │ └── mui.picker.min.js
│ │ │ │ ├── mui.poppicker
│ │ │ │ │ ├── mui.poppicker.css
│ │ │ │ │ ├── mui.poppicker.js
│ │ │ │ │ ├── mui.poppicker.min.css
│ │ │ │ │ └── mui.poppicker.min.js
│ │ │ │ └── mui
│ │ │ │ │ ├── fonts
│ │ │ │ │ └── mui.ttf
│ │ │ │ │ ├── mui.css
│ │ │ │ │ ├── mui.extend.css
│ │ │ │ │ ├── mui.js
│ │ │ │ │ └── mui修改记录.md
│ │ │ ├── h5
│ │ │ │ ├── fileinput.js
│ │ │ │ └── fileinput2.html
│ │ │ ├── index.html
│ │ │ ├── promise.html
│ │ │ └── simple.html
│ │ └── modules.properties
│ ├── java
│ │ └── com
│ │ │ └── quick
│ │ │ └── quickhybrid
│ │ │ ├── AboutActivity.java
│ │ │ ├── AppApplication.java
│ │ │ ├── MainActivity.java
│ │ │ └── api
│ │ │ └── PayApi.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── about_activity.xml
│ │ └── 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
│ └── quick
│ └── quickhybrid
│ └── ExampleUnitTest.java
├── build.gradle
├── core
├── .gitignore
├── build.gradle
├── libs
│ └── org.apache.http.legacy.jar
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── quick
│ │ └── core
│ │ ├── application
│ │ ├── CrashHandler.java
│ │ └── FrmApplication.java
│ │ ├── baseapp
│ │ ├── baseactivity
│ │ │ ├── FrmBaseActivity.java
│ │ │ ├── FrmBaseCompatActivity.java
│ │ │ ├── FrmBaseFragment.java
│ │ │ ├── FrmFragmentActivity.java
│ │ │ ├── FrmV4FragmentActivity.java
│ │ │ └── control
│ │ │ │ ├── NbControl.java
│ │ │ │ ├── PageControl.java
│ │ │ │ └── StatusControl.java
│ │ ├── component
│ │ │ ├── FileChooseActivity.java
│ │ │ └── scan
│ │ │ │ └── ScanCaptureActivity.java
│ │ └── theme
│ │ │ └── BaseThemeControl.java
│ │ ├── net
│ │ └── HttpUtil.java
│ │ ├── ui
│ │ ├── app
│ │ │ ├── IErrorControl.java
│ │ │ ├── INbControl.java
│ │ │ ├── IPageControl.java
│ │ │ ├── IThemeControl.java
│ │ │ └── ThemeBean.java
│ │ └── widget
│ │ │ ├── DrawableText.java
│ │ │ ├── NbImageView.java
│ │ │ ├── NbTextView.java
│ │ │ ├── SegActionCallBack.java
│ │ │ ├── ToastUtil.java
│ │ │ ├── dialog
│ │ │ ├── ActionSheet.java
│ │ │ ├── DialogSelectAdapter.java
│ │ │ ├── QuickDatePickerDialog.java
│ │ │ ├── QuickDialog.java
│ │ │ └── QuickImageDialog.java
│ │ │ ├── popmenu
│ │ │ ├── FrmPopMenu.java
│ │ │ ├── PopChangedListener.java
│ │ │ └── PopClickListener.java
│ │ │ └── segbar
│ │ │ ├── ActionBarSeg.java
│ │ │ └── SegActionCallBack.java
│ │ └── util
│ │ ├── app
│ │ └── AppUtil.java
│ │ ├── common
│ │ ├── DateUtil.java
│ │ ├── DialogUtil.java
│ │ ├── JsonUtil.java
│ │ ├── QuickUtil.java
│ │ └── RuntimeUtil.java
│ │ ├── device
│ │ ├── DensityUtil.java
│ │ ├── DeviceUtil.java
│ │ └── PhotoSelector.java
│ │ ├── gis
│ │ ├── CoordMath.java
│ │ └── MyLatLngPoint.java
│ │ ├── io
│ │ ├── FileSavePath.java
│ │ ├── FileSorter.java
│ │ ├── FileUtil.java
│ │ └── IOUtil.java
│ │ ├── jsbridge
│ │ └── QuickModulesUtil.java
│ │ ├── reflect
│ │ ├── ReflectUtil.java
│ │ └── ResManager.java
│ │ └── security
│ │ └── MD5Util.java
│ └── res
│ ├── drawable
│ ├── actionsheet_bottom_normal.9.png
│ ├── actionsheet_bottom_pressed.9.png
│ ├── actionsheet_middle_normal.9.png
│ ├── actionsheet_middle_pressed.9.png
│ ├── actionsheet_single_normal.9.png
│ ├── actionsheet_single_pressed.9.png
│ ├── actionsheet_top_normal.9.png
│ ├── actionsheet_top_pressed.9.png
│ ├── frm_as_ios7_cancel_bt.xml
│ ├── frm_as_ios7_other_bt_bottom.xml
│ ├── frm_as_ios7_other_bt_middle.xml
│ ├── frm_as_ios7_other_bt_single.xml
│ ├── frm_as_ios7_other_bt_top.xml
│ ├── frm_blue_btn_bg.xml
│ ├── frm_click_dialog_left_btn_bg.xml
│ ├── frm_click_dialog_right_btn_bg.xml
│ ├── frm_click_dialog_single_btn_bg.xml
│ ├── frm_click_dialog_update_bg.xml
│ ├── frm_dialog_bg.xml
│ ├── frm_dialog_btn_bg.xml
│ ├── frm_dialog_btn_press_bg.xml
│ ├── frm_dialog_left_btn_bg.xml
│ ├── frm_dialog_left_btn_press_bg.xml
│ ├── frm_dialog_press_bg.xml
│ ├── frm_dialog_right_btn_bg.xml
│ ├── frm_dialog_right_btn_press_bg.xml
│ ├── frm_dialog_title_bg.xml
│ ├── frm_dialog_updatebtn_bg.xml
│ ├── frm_dialog_updatebtn_press_bg.xml
│ ├── frm_edittext_bg.xml
│ ├── frm_edittext_cursor_color.xml
│ ├── frm_nav_tab_bg.xml
│ └── frm_nav_tab_btn_bg.xml
│ ├── layout
│ ├── frm_base.xml
│ ├── frm_dialog.xml
│ ├── frm_image_dialog.xml
│ ├── frm_list_pop_adapter.xml
│ ├── frm_localfilelist_activity.xml
│ ├── frm_localfilelist_adapter.xml
│ ├── frm_nb_style1.xml
│ ├── frm_prompt.xml
│ ├── frm_scan_activity.xml
│ ├── frm_select_adapter.xml
│ ├── frm_simple_adapter.xml
│ └── frm_status.xml
│ ├── mipmap
│ ├── img_arrow_black_down.png
│ ├── img_arrow_black_up.png
│ ├── img_arrow_blue_down.png
│ ├── img_arrow_blue_up.png
│ ├── img_arrows_btn.png
│ ├── img_back_nav_btn.png
│ ├── img_back_nav_btn_white.png
│ ├── img_checked_btn.png
│ ├── img_default.png
│ ├── img_exit_btn.png
│ ├── img_exit_nav_btn.png
│ ├── img_fc_back.png
│ ├── img_fc_dir.png
│ ├── img_fc_file.png
│ ├── img_fc_sdcard.png
│ ├── img_fc_system.png
│ ├── img_file.png
│ ├── img_net_none_bg.png
│ ├── img_net_wrong_bg.png
│ ├── img_server_wrong_bg.png
│ └── img_unchecked_btn.png
│ └── values
│ ├── frm_attrs.xml
│ ├── frm_colors.xml
│ ├── frm_dimens.xml
│ ├── frm_strings.xml
│ ├── frm_styles.xml
│ └── strings.xml
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── jsbridge
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── quick
│ │ └── jsbridge
│ │ ├── api
│ │ ├── AuthApi.java
│ │ ├── DeviceApi.java
│ │ ├── NavigatorApi.java
│ │ ├── PageApi.java
│ │ ├── RuntimeApi.java
│ │ ├── UIApi.java
│ │ └── UtilApi.java
│ │ ├── bean
│ │ └── QuickBean.java
│ │ ├── bridge
│ │ ├── Callback.java
│ │ ├── IBridgeImpl.java
│ │ └── JSBridge.java
│ │ ├── control
│ │ ├── AutoCallbackDefined.java
│ │ ├── AutoCallbackEvent.java
│ │ ├── FileChooser.java
│ │ ├── PageLoad.java
│ │ └── WebloaderControl.java
│ │ └── view
│ │ ├── IQuickFragment.java
│ │ ├── QuickFragment.java
│ │ ├── QuickWebLoader.java
│ │ └── webview
│ │ ├── IActivityResult.java
│ │ ├── IFileChooser.java
│ │ ├── ILoadPage.java
│ │ ├── IWebviewScrollChanged.java
│ │ ├── QuickWebChromeClient.java
│ │ ├── QuickWebView.java
│ │ └── QuickWebviewClient.java
│ └── res
│ ├── drawable
│ └── quick_progress_bar_states.xml
│ ├── layout
│ ├── quick_activity.xml
│ └── quick_fragment.xml
│ └── values
│ └── strings.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | .project
8 |
9 | # Runtime data
10 | pids
11 | *.pid
12 | *.seed
13 | *.pid.lock
14 |
15 | # Directory for instrumented libs generated by jscoverage/JSCover
16 | lib-cov
17 |
18 | # Coverage directory used by tools like istanbul
19 | coverage
20 |
21 | # nyc test coverage
22 | .nyc_output
23 |
24 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
25 | .grunt
26 |
27 | # Bower dependency directory (https://bower.io/)
28 | bower_components
29 |
30 | # node-waf configuration
31 | .lock-wscript
32 |
33 | # Compiled binary addons (http://nodejs.org/api/addons.html)
34 | build/Release
35 |
36 | # Dependency directories
37 | node_modules/
38 | jspm_packages/
39 |
40 | # Typescript v1 declaration files
41 | typings/
42 |
43 | # Optional npm cache directory
44 | .npm
45 |
46 | # Optional eslint cache
47 | .eslintcache
48 |
49 | # Optional REPL history
50 | .node_repl_history
51 |
52 | # Output of 'npm pack'
53 | *.tgz
54 |
55 | # Yarn Integrity file
56 | .yarn-integrity
57 |
58 | # dotenv environment variables file
59 | .env
60 |
61 | *.iml
62 | .gradle
63 | /local.properties
64 | /.idea/workspace.xml
65 | /.idea/libraries
66 | /.idea/misc.xml
67 | /.idea/modules.xml
68 | /.idea/vcs.xml
69 | .idea
70 | .DS_Store
71 | /build
72 | /captures
73 | .externalNativeBuild
74 |
75 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2017, quickhybrid
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | * Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | * Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # quickhybrid-android
2 | 混合开发框架quickhybrid的android版本
3 |
--------------------------------------------------------------------------------
/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.quick.quickhybrid"
7 | minSdkVersion 16
8 | targetSdkVersion 22
9 | versionCode 1
10 | versionName "1.0.1"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation project(':core')
23 | implementation project(':jsbridge')
24 | implementation fileTree(dir: 'libs', include: ['*.jar'])
25 | // implementation 'com.jakewharton:butterknife:8.6.0'
26 | // butterknife8.0+版本支持控件注解必须在可运行的model加上
27 | annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
28 |
29 | testImplementation 'junit:junit:4.12'
30 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
31 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/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/release/output.json:
--------------------------------------------------------------------------------
1 | [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"app-release.apk","properties":{"packageId":"com.quick.quickhybrid","split":"","minSdkVersion":"16"}}]
--------------------------------------------------------------------------------
/app/release/quickhybrid101.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/app/release/quickhybrid101.apk
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/quick/quickhybrid/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.quick.quickhybrid;
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.quick.quickhybrid", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/app/src/main/assets/examples/api/auth.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | auth
11 |
12 |
13 |
14 |
15 |
16 |
17 |
24 |
25 |
26 |
27 |
28 |
29 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/assets/examples/api/custom.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | auth
11 |
12 |
13 |
14 |
15 |
16 |
17 |
24 |
25 |
26 |
27 |
28 |
29 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/assets/examples/callapi.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 组件(自定义)API
11 |
12 |
13 |
14 |
15 |
16 |
17 |
30 |
31 |
32 |
33 |
34 |
35 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/app/src/main/assets/examples/common/common.css:
--------------------------------------------------------------------------------
1 | /**
2 | * 作者: 郭天琦
3 | * 创建时间: 2017/06/27
4 | * 版本: [1.0, 2017/06/27 ]
5 | * 版权: 江苏国泰新点软件有限公司
6 | * 描述: 拓展框架的一些通用样式
7 | * 为了方便维护,单独提取出来了,打包时会与mui.css合并
8 | */
9 |
10 | ul,
11 | li {
12 | padding: 0;
13 | margin: 0;
14 | list-style: none;
15 | }
16 |
17 | em,
18 | u {
19 | font-style: normal;
20 | }
21 |
22 | .l {
23 | float: left;
24 | }
25 |
26 | .r {
27 | float: right;
28 | }
29 |
30 | .center-block {
31 | display: block;
32 | margin-left: auto;
33 | margin-right: auto;
34 | }
35 |
36 | .clearfix:before,
37 | .clearfix:after {
38 | display: table;
39 | line-height: 0;
40 | content: "";
41 | }
42 |
43 | .clearfix:after {
44 | clear: both;
45 | }
46 |
47 | .hidden {
48 | display: none !important;
49 | }
50 |
51 | .invisible {
52 | visibility: hidden;
53 | }
54 |
55 | .can-select {
56 | -webkit-user-select: text;
57 | }
58 |
59 | .fullscreen {
60 | position: absolute;
61 | top: 0;
62 | right: 0;
63 | bottom: 0;
64 | left: 0;
65 | }
66 |
67 | .text-center {
68 | text-align: center !important;
69 | }
70 |
71 | .text-left {
72 | text-align: left !important;
73 | }
74 |
75 | .text-right {
76 | text-align: right !important;
77 | }
78 |
79 | .text-justify {
80 | text-align: justify !important;
81 | }
82 |
83 | .text-nowrap {
84 | white-space: nowrap !important;
85 | }
86 |
87 | .text-ellipsis {
88 | white-space: nowrap;
89 | text-overflow: ellipsis;
90 | overflow: hidden;
91 | }
92 |
93 | .bg-gray {
94 | background-color: #f5f5f5;
95 | }
96 |
97 | .bg-white {
98 | background-color: #fff;
99 | }
100 |
101 | .padding10 {
102 | padding: 10px;
103 | }
104 |
105 | .padding0 {
106 | padding: 0;
107 | }
108 |
109 | .pt10 {
110 | padding: 10px;
111 | }
112 |
113 | .pl10 {
114 | padding-left: 10px;
115 | }
116 |
117 | .pr10 {
118 | padding-right: 10px;
119 | }
120 |
121 | .pb10 {
122 | padding-bottom: 10px;
123 | }
124 |
125 | .margin10 {
126 | margin: 10px;
127 | }
128 |
129 | .margin0 {
130 | margin: 0;
131 | }
132 |
133 | .mt10 {
134 | margin-top: 10px;
135 | }
136 |
137 | .ml10 {
138 | margin-left: 10px;
139 | }
140 |
141 | .mb10 {
142 | margin-bottom: 10px;
143 | }
144 |
145 | .mr10 {
146 | margin-right: 10px;
147 | }
148 |
149 | .border-none {
150 | border: none;
151 | }
152 |
153 | .clamp2 {
154 | display: -webkit-box;
155 | -webkit-line-clamp: 2;
156 | overflow: hidden;
157 | -webkit-box-orient: vertical;
158 | text-overflow: ellipsis;
159 | }
160 |
161 | .uppercase {
162 | text-transform: uppercase;
163 | }
164 |
165 | .lowercase {
166 | text-transform: lowercase;
167 | }
168 |
--------------------------------------------------------------------------------
/app/src/main/assets/examples/common/common.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | if (!quick.os.h5) {
3 | document.querySelector('.mui-content').style.paddingTop = 0;
4 | } else {
5 | var html = ' \
6 | \
11 | ';
12 |
13 | var fileName = window.location.href.match(/([^/]+).html/)[1];
14 |
15 | if (!fileName || fileName === 'index') {
16 | fileName = 'Quick Hybrid API';
17 | }
18 |
19 | html = html.replace('{{TITLE}}', fileName);
20 |
21 | var div = document.createElement('div');
22 |
23 | div.innerHTML = html;
24 |
25 | document.body.insertBefore(div, document.body.children[0]);
26 | document.querySelector('.mui-content').style.paddingTop = '45px';
27 | }
28 |
29 | mui('.mui-table-view').on('tap', '.api-class', function() {
30 | window.runApi && runApi(this.id);
31 | });
32 |
33 | window.showTips = function(msg, isAlert) {
34 | if (isAlert) {
35 | quick.ui.alert(msg, '提示');
36 | } else {
37 | quick.ui.toast(msg);
38 | }
39 | };
40 | })();
--------------------------------------------------------------------------------
/app/src/main/assets/examples/common/mui.poppicker/mui.poppicker.css:
--------------------------------------------------------------------------------
1 | .mui-poppicker {
2 | position: fixed;
3 | left: 0px;
4 | width: 100%;
5 | z-index: 999;
6 | background-color: #eee;
7 | border-top: solid 1px #ccc;
8 | box-shadow: 0px -5px 7px 0px rgba(0, 0, 0, 0.1);
9 | -webkit-transition: .3s;
10 | bottom: 0px;
11 | -webkit-transform: translateY(300px);
12 | }
13 |
14 | .mui-poppicker.mui-active {
15 | -webkit-transform: translateY(0px);
16 | }
17 |
18 | .mui-android-5-1 .mui-poppicker {
19 | bottom: -300px;
20 | -webkit-transition-property: bottom;
21 | -webkit-transform: none;
22 | }
23 |
24 | .mui-android-5-1 .mui-poppicker.mui-active {
25 | bottom: 0px;
26 | -webkit-transition-property: bottom;
27 | -webkit-transform: none;
28 | }
29 |
30 | .mui-poppicker-header {
31 | padding: 6px;
32 | font-size: 14px;
33 | color: #888;
34 | }
35 |
36 | .mui-poppicker-header .mui-btn {
37 | font-size: 12px;
38 | padding: 5px 10px;
39 | }
40 |
41 | .mui-poppicker-btn-cancel {
42 | float: left;
43 | }
44 |
45 | .mui-poppicker-btn-ok {
46 | float: right;
47 | }
48 |
49 | .mui-poppicker-clear {
50 | clear: both;
51 | height: 0px;
52 | line-height: 0px;
53 | font-size: 0px;
54 | overflow: hidden;
55 | }
56 |
57 | .mui-poppicker-body {
58 | position: relative;
59 | width: 100%;
60 | height: 200px;
61 | border-top: solid 1px #ddd;
62 | /*-webkit-perspective: 1200px;
63 | perspective: 1200px;
64 | -webkit-transform-style: preserve-3d;
65 | transform-style: preserve-3d;*/
66 | }
67 |
68 | .mui-poppicker-body .mui-picker {
69 | width: 100%;
70 | height: 100%;
71 | margin: 0px;
72 | border: none;
73 | float: left;
74 | }
--------------------------------------------------------------------------------
/app/src/main/assets/examples/common/mui.poppicker/mui.poppicker.min.css:
--------------------------------------------------------------------------------
1 | .mui-poppicker{position:fixed;left:0;width:100%;z-index:999;background-color:#eee;border-top:solid 1px #ccc;box-shadow:0 -5px 7px 0 rgba(0,0,0,.1);-webkit-transition:.3s;bottom:0;-webkit-transform:translateY(300px)}.mui-poppicker.mui-active{-webkit-transform:translateY(0)}.mui-android-5-1 .mui-poppicker{bottom:-300px;-webkit-transition-property:bottom;-webkit-transform:none}.mui-android-5-1 .mui-poppicker.mui-active{bottom:0;-webkit-transition-property:bottom;-webkit-transform:none}.mui-poppicker-header{padding:6px;font-size:14px;color:#888}.mui-poppicker-header .mui-btn{font-size:12px;padding:5px 10px}.mui-poppicker-btn-cancel{float:left}.mui-poppicker-btn-ok{float:right}.mui-poppicker-clear{clear:both;height:0;line-height:0;font-size:0;overflow:hidden}.mui-poppicker-body{position:relative;width:100%;height:200px;border-top:solid 1px #ddd}.mui-poppicker-body .mui-picker{width:100%;height:100%;margin:0;border:none;float:left}
--------------------------------------------------------------------------------
/app/src/main/assets/examples/common/mui.poppicker/mui.poppicker.min.js:
--------------------------------------------------------------------------------
1 | !function(e,t){e.dom=function(i){return"string"!=typeof i?i instanceof Array||i[0]&&i.length?[].slice.call(i):[i]:(e.__create_dom_div__||(e.__create_dom_div__=t.createElement("div")),e.__create_dom_div__.innerHTML=i,[].slice.call(e.__create_dom_div__.childNodes))};var i='',c='';e.PopPicker=e.Class.extend({init:function(c){var a=this;a.options=c||{},a.options.buttons=a.options.buttons||["取消","确定"],a.panel=e.dom(i)[0],t.body.appendChild(a.panel),a.ok=a.panel.querySelector(".mui-poppicker-btn-ok"),a.cancel=a.panel.querySelector(".mui-poppicker-btn-cancel"),a.body=a.panel.querySelector(".mui-poppicker-body"),a.mask=e.createMask(),a.cancel.innerText=a.options.buttons[0],a.ok.innerText=a.options.buttons[1],a.cancel.addEventListener("tap",function(e){a.hide()},!1),a.ok.addEventListener("tap",function(e){if(a.callback){var t=a.callback(a.getSelectedItems());t!==!1&&a.hide()}},!1),a.mask[0].addEventListener("tap",function(){a.hide()},!1),a._createPicker(),a.panel.addEventListener("touchstart",function(e){e.preventDefault()},!1),a.panel.addEventListener("touchmove",function(e){e.preventDefault()},!1)},_createPicker:function(){var t=this,i=t.options.layer||1,a=100/i+"%";t.pickers=[];for(var n=1;n<=i;n++){var s=e.dom(c)[0];s.style.width=a,t.body.appendChild(s);var r=e(s).picker();t.pickers.push(r),s.addEventListener("change",function(e){var t=this.nextSibling;if(t&&t.picker){var i=e.detail||{},c=i.item||{};t.picker.setItems(c.children)}},!1)}},setData:function(e){var t=this;e=e||[],t.pickers[0].setItems(e)},getSelectedItems:function(){var e=this,t=[];for(var i in e.pickers){var c=e.pickers[i];t.push(c.getSelectedItem()||{})}return t},show:function(i){var c=this;c.callback=i,c.mask.show(),t.body.classList.add(e.className("poppicker-active-for-page")),c.panel.classList.add(e.className("active")),c.__back=e.back,e.back=function(){c.hide()}},hide:function(){var i=this;i.disposed||(i.panel.classList.remove(e.className("active")),i.mask.close(),t.body.classList.remove(e.className("poppicker-active-for-page")),e.back=i.__back)},dispose:function(){var e=this;e.hide(),setTimeout(function(){e.panel.parentNode.removeChild(e.panel);for(var t in e)e[t]=null,delete e[t];e.disposed=!0},300)}})}(mui,document);
--------------------------------------------------------------------------------
/app/src/main/assets/examples/common/mui/fonts/mui.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/app/src/main/assets/examples/common/mui/fonts/mui.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/examples/common/mui/mui.extend.css:
--------------------------------------------------------------------------------
1 | /**
2 | * 作者: 郭天琦
3 | * 创建时间: 2017/06/27
4 | * 版本: [1.0, 2017/06/27 ]
5 | * 版权: 江苏国泰新点软件有限公司
6 | * 描述: 拓展框架的一些通用样式
7 | * 为了方便维护,单独提取出来了,打包时会与mui.css合并
8 | */
9 |
10 | ul,
11 | li {
12 | padding: 0;
13 | margin: 0;
14 | list-style: none;
15 | }
16 |
17 | em,
18 | u {
19 | font-style: normal;
20 | }
21 |
22 | .l {
23 | float: left;
24 | }
25 |
26 | .r {
27 | float: right;
28 | }
29 |
30 | .center-block {
31 | display: block;
32 | margin-left: auto;
33 | margin-right: auto;
34 | }
35 |
36 | .clearfix:before,
37 | .clearfix:after {
38 | display: table;
39 | line-height: 0;
40 | content: "";
41 | }
42 |
43 | .clearfix:after {
44 | clear: both;
45 | }
46 |
47 | .hidden {
48 | display: none !important;
49 | }
50 |
51 | .invisible {
52 | visibility: hidden;
53 | }
54 |
55 | .can-select {
56 | -webkit-user-select: text;
57 | }
58 |
59 | .fullscreen {
60 | position: absolute;
61 | top: 0;
62 | right: 0;
63 | bottom: 0;
64 | left: 0;
65 | }
66 |
67 | .text-center {
68 | text-align: center !important;
69 | }
70 |
71 | .text-left {
72 | text-align: left !important;
73 | }
74 |
75 | .text-right {
76 | text-align: right !important;
77 | }
78 |
79 | .text-justify {
80 | text-align: justify !important;
81 | }
82 |
83 | .text-nowrap {
84 | white-space: nowrap !important;
85 | }
86 |
87 | .text-ellipsis {
88 | white-space: nowrap;
89 | text-overflow: ellipsis;
90 | overflow: hidden;
91 | }
92 |
93 | .bg-gray {
94 | background-color: #f5f5f5;
95 | }
96 |
97 | .bg-white {
98 | background-color: #fff;
99 | }
100 |
101 | .padding10 {
102 | padding: 10px;
103 | }
104 |
105 | .padding0 {
106 | padding: 0;
107 | }
108 |
109 | .pt10 {
110 | padding: 10px;
111 | }
112 |
113 | .pl10 {
114 | padding-left: 10px;
115 | }
116 |
117 | .pr10 {
118 | padding-right: 10px;
119 | }
120 |
121 | .pb10 {
122 | padding-bottom: 10px;
123 | }
124 |
125 | .margin10 {
126 | margin: 10px;
127 | }
128 |
129 | .margin0 {
130 | margin: 0;
131 | }
132 |
133 | .mt10 {
134 | margin-top: 10px;
135 | }
136 |
137 | .ml10 {
138 | margin-left: 10px;
139 | }
140 |
141 | .mb10 {
142 | margin-bottom: 10px;
143 | }
144 |
145 | .mr10 {
146 | margin-right: 10px;
147 | }
148 |
149 | .border-none {
150 | border: none;
151 | }
152 |
153 | .clamp2 {
154 | display: -webkit-box;
155 | -webkit-line-clamp: 2;
156 | overflow: hidden;
157 | -webkit-box-orient: vertical;
158 | text-overflow: ellipsis;
159 | }
160 |
161 | .uppercase {
162 | text-transform: uppercase;
163 | }
164 |
165 | .lowercase {
166 | text-transform: lowercase;
167 | }
168 |
--------------------------------------------------------------------------------
/app/src/main/assets/examples/common/mui/mui修改记录.md:
--------------------------------------------------------------------------------
1 | ### mui重新编译修改记录
2 |
3 | 在集成到`hybrid`框架时,mui中有很多功能可以进行删除或者独立提取,以此来减少核心代码的体积,以下是修改记录
4 |
5 | 项目svn: `svn://192.168.0.51/2014/T10/新点微门户平台/trunk/dcloud/跨平台框架/code/mui`
6 |
7 | #### 删除的文件
8 |
9 | | 文件名| 功能 | 删除原因|
10 | | :------------- |:-------------:| -----:|
11 | | xxx.5+.js | 5+相关的js文件 | 遗弃5+ |
12 | | mui.dialog.xxx.js | mui的弹窗 | 采用ejs的弹窗 |
13 | | mui.popup.js | mui模拟弹窗的实现 | 采用ejs的弹窗 |
14 | | mui.pullrefresh.js | mui的下拉刷新 | 采用框架基于IScroll5的下拉刷新 |
15 | | mui.class.scroll.pullrefresh.js | iscroll里的下拉刷新实现 | 遗弃mui下拉刷新 |
16 | | mui.init.pullrefresh.js | 下拉刷新初始化相关 | 遗弃mui下拉刷新 |
17 | | mui.jsonp.js | mui ajax的jsonp实现 | 采用CROS方法 |
18 | | mui.transparent.js | mui 头部渐变功能 | 采用原生导航栏 |
19 | | mui.ajax.js | ajax请求 | 改用了Zepto的ajax |
20 |
21 | #### 提取的文件
22 |
23 | 将一些不常用的组件提取出去,单独按需引入
24 |
25 | | 文件名| 功能 | 提取原因|
26 | | :------------- |:-------------:| -----:|
27 | | mui.offcanvas.js | 侧滑相关 | 侧滑很少用到 |
28 |
29 | #### 修改的文件
30 |
31 | | 文件名| 功能 | 修改原因|
32 | | :------------- |:-------------:| -----:|
33 | | mui.class.js | mui的基础类 | 修改严格模式下的calllee报错 |
34 | | tableviews.js | 包括一些列表ui等操作 | 兼容严格模式 |
35 | | mui.js | mui核心代码 | 在es6下暴露mui全局变量 |
36 | | mui.class.scroll.js | mui的iscroll4代码 | 兼容严格模式 |
37 | | mui.init.js | mui的init文件 | 删除iframe创建代码 |
38 | | input.plugin.js | input的插件 | 删除5+相关的语言插件功能 |
39 |
40 |
41 | ### 更新记录
42 |
43 | * 2017/06/06
44 | * 重新编译mui.js
45 | * 去除了5+代码
46 | * 去除了下拉刷新,去除了弹窗相关
47 | * 将offcanvas等单独提取
48 | * 兼容严格模式,修改mui.class、scroll、tableview、ajax等文件
49 | * 2017/06/16
50 | * init文件删除iframe代码
--------------------------------------------------------------------------------
/app/src/main/assets/examples/h5/fileinput2.html:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | File Input
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/app/src/main/assets/examples/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Quick Hybrid API
11 |
12 |
13 |
14 |
15 |
16 |
50 |
51 |
52 |
53 |
54 |
55 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/app/src/main/assets/examples/promise.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Promise调用
11 |
12 |
13 |
14 |
15 |
16 |
17 |
28 |
29 |
30 |
31 |
32 |
33 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/app/src/main/assets/examples/simple.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 示例页面
11 |
12 |
13 |
14 |
15 |
16 |
17 |
30 |
31 |
32 |
33 |
34 |
35 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/app/src/main/assets/modules.properties:
--------------------------------------------------------------------------------
1 | ui = com.quick.jsbridge.api.UIApi
2 | page = com.quick.jsbridge.api.PageApi
3 | pay = com.quick.quickhybrid.api.PayApi
--------------------------------------------------------------------------------
/app/src/main/java/com/quick/quickhybrid/AboutActivity.java:
--------------------------------------------------------------------------------
1 | package com.quick.quickhybrid;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import com.quick.core.baseapp.baseactivity.FrmBaseActivity;
7 |
8 | public class AboutActivity extends FrmBaseActivity {
9 |
10 |
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setLayout(R.layout.about_activity);
16 |
17 | setTitle(getString(R.string.about_title));
18 |
19 | }
20 |
21 | public static void go(Context context) {
22 | context.startActivity(new Intent(context, AboutActivity.class));
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/quick/quickhybrid/AppApplication.java:
--------------------------------------------------------------------------------
1 | package com.quick.quickhybrid;
2 |
3 |
4 | import com.quick.core.application.FrmApplication;
5 | import com.quick.core.baseapp.theme.BaseThemeControl;
6 |
7 |
8 | public class AppApplication extends FrmApplication {
9 |
10 | @Override
11 | public void onCreate() {
12 | super.onCreate();
13 |
14 | if (BuildConfig.BUILD_TYPE.equals("release")) {
15 | // 可以防止二次打包
16 |
17 | } else {
18 |
19 | //保存所有log日志,调试时可开启,正式包不允许开启
20 | // LogUtil.autoLog();
21 |
22 | //开启ButterKnife的日志输出
23 | // ButterKnife.setDebug(true);
24 |
25 | //是否开启下载日志
26 | // FileDownloadLog.NEED_LOG = true;
27 |
28 |
29 | }
30 |
31 | //初始化默认主题
32 | BaseThemeControl.getInstance().initTheme(BaseThemeControl.getDefaultThemes());
33 |
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/quick/quickhybrid/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.quick.quickhybrid;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 |
7 | import com.google.zxing.integration.android.IntentIntegrator;
8 | import com.google.zxing.integration.android.IntentResult;
9 | import com.quick.core.baseapp.baseactivity.FrmBaseActivity;
10 | import com.quick.core.baseapp.component.scan.ScanCaptureActivity;
11 | import com.quick.core.ui.widget.ToastUtil;
12 | import com.quick.jsbridge.bean.QuickBean;
13 | import com.quick.jsbridge.view.QuickWebLoader;
14 |
15 | import butterknife.OnClick;
16 |
17 | public class MainActivity extends FrmBaseActivity {
18 |
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setLayout(R.layout.activity_main);
24 |
25 | pageControl.getNbBar().hideNbBack();
26 | setTitle("Quick Hybrid");
27 | }
28 |
29 |
30 | @OnClick(R.id.btn)
31 | public void openPage() {
32 | // 打开一个新的混合开发页面
33 | ToastUtil.toastShort(MainActivity.this, "open2");
34 |
35 | Intent mintent = new Intent(MainActivity.this, QuickWebLoader.class);
36 | QuickBean bean = new QuickBean("file:///android_asset/examples/index.html");
37 | mintent.putExtra("bean", bean);
38 | startActivity(mintent);
39 | }
40 |
41 | @OnClick(R.id.btn_scan)
42 | public void scan() {
43 | IntentIntegrator integrator = null;
44 | Activity activity = MainActivity.this;
45 |
46 | integrator = new IntentIntegrator(activity);
47 |
48 | if (integrator != null) {
49 | integrator.setCaptureActivity(ScanCaptureActivity.class);
50 | integrator.initiateScan();
51 | }
52 | }
53 |
54 | @OnClick(R.id.btn_about)
55 | public void about() {
56 | AboutActivity.go(MainActivity.this);
57 | }
58 |
59 | @Override
60 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
61 | if (resultCode == RESULT_OK) {
62 |
63 | if (requestCode == IntentIntegrator.REQUEST_CODE) {
64 | // 扫描二维码回传值
65 | IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
66 | String ewmString = result.getContents();
67 |
68 | Intent mintent = new Intent(MainActivity.this, QuickWebLoader.class);
69 | QuickBean bean = new QuickBean(ewmString);
70 | mintent.putExtra("bean", bean);
71 | startActivity(mintent);
72 | }
73 | }
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/app/src/main/java/com/quick/quickhybrid/api/PayApi.java:
--------------------------------------------------------------------------------
1 | package com.quick.quickhybrid.api;
2 |
3 | import android.webkit.WebView;
4 |
5 | import com.quick.jsbridge.bridge.Callback;
6 | import com.quick.jsbridge.bridge.IBridgeImpl;
7 | import com.quick.jsbridge.view.IQuickFragment;
8 |
9 | import org.json.JSONObject;
10 |
11 | import java.util.HashMap;
12 | import java.util.Map;
13 |
14 |
15 | /**
16 | * Created by dailichun on 2017/12/6.
17 | * 测试的支付组件(自定义)API
18 | */
19 | public class PayApi implements IBridgeImpl {
20 |
21 | /**
22 | * 注册API的别名
23 | */
24 | public static String RegisterName = "pay";
25 |
26 | /**
27 | * 测试支付
28 | *
29 | * 返回:
30 | * access_token
31 | */
32 | public static void testPay(IQuickFragment webLoader, WebView wv, JSONObject param, Callback callback) {
33 | Map map = new HashMap<>();
34 | map.put("message", "pay success");
35 | callback.applySuccess(map);
36 | }
37 |
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/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 |
22 |
27 |
32 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/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/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/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 | QuickHybrid
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/quick/quickhybrid/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.quick.quickhybrid;
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 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.0'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/core/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/core/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 25
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 16
10 | targetSdkVersion 22
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 | }
26 |
27 | dependencies {
28 | compile fileTree(dir: 'libs', include: ['*.jar'])
29 |
30 | compile 'com.android.support:appcompat-v7:25.3.1'
31 | compile 'com.android.support:support-v4:25.3.1'
32 | compile 'com.android.support:design:25.3.1'
33 | compile 'com.android.support:recyclerview-v7:25.3.1'
34 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
35 | compile 'com.jakewharton:butterknife:8.6.0'
36 | compile 'com.google.code.gson:gson:2.8.0'
37 | compile 'com.journeyapps:zxing-android-embedded:3.5.0'
38 | compile 'com.liulishuo.filedownloader:library:1.5.5'
39 |
40 | compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
41 | compile 'me.iwf.photopicker:PhotoPicker:0.9.10@aar'
42 | compile 'com.github.bumptech.glide:glide:4.1.1'
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/core/libs/org.apache.http.legacy.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/libs/org.apache.http.legacy.jar
--------------------------------------------------------------------------------
/core/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 |
--------------------------------------------------------------------------------
/core/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
43 |
44 |
47 |
48 |
49 |
50 |
51 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/application/CrashHandler.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.application;
2 |
3 |
4 | /**
5 | * Created by dailichun on 2017/12/6.
6 | * 全局异常处理
7 | */
8 | public class CrashHandler implements Thread.UncaughtExceptionHandler {
9 |
10 | private static CrashHandler mCrashHandler;
11 |
12 | public static CrashHandler getInstance() {
13 | if (mCrashHandler == null) {
14 | synchronized (CrashHandler.class) {
15 | if (mCrashHandler == null) {
16 | mCrashHandler = new CrashHandler();
17 | }
18 | }
19 | }
20 | return mCrashHandler;
21 | }
22 |
23 | public void init() {
24 | Thread.setDefaultUncaughtExceptionHandler(this);
25 | }
26 |
27 | private void handlerException(final Throwable ex) {
28 | new Thread(new Runnable() {
29 |
30 | @Override
31 | public void run() {
32 | // TODO: 保存日志,这里预留
33 |
34 | // 退出程序
35 | android.os.Process.killProcess(android.os.Process.myPid());
36 | // 关闭虚拟机,彻底释放内存空间
37 | System.exit(0);
38 | }
39 |
40 | }).start();
41 | }
42 |
43 | @Override
44 | public void uncaughtException(Thread t, Throwable e) {
45 | e.printStackTrace();
46 | handlerException(e);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/baseapp/baseactivity/FrmBaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.baseapp.baseactivity;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.res.Configuration;
6 | import android.os.Bundle;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 |
10 | import com.quick.core.baseapp.baseactivity.control.PageControl;
11 | import com.quick.core.ui.app.INbControl;
12 | import com.quick.core.ui.app.IPageControl;
13 |
14 | /**
15 | * Created by dailichun on 2017/12/6.
16 | * 基础Activity 继承android.app.Activity
17 | */
18 |
19 | public class FrmBaseActivity extends Activity implements INbControl.INbOnClick {
20 |
21 | /**
22 | * 页面控制器
23 | */
24 | public IPageControl pageControl;
25 |
26 | @Override
27 | protected void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 |
30 | pageControl = new PageControl(this, this);
31 |
32 | pageControl.initBaseView(LayoutInflater.from(this), null);
33 | }
34 |
35 | public void setLayout(int layoutId) {
36 | pageControl.setLayout(layoutId);
37 | }
38 |
39 | public void setLayout(View view) {
40 | pageControl.setLayout(view);
41 | }
42 |
43 | public void setTitle(String title) {
44 | pageControl.setTitle(title);
45 | }
46 |
47 | public INbControl.ViewHolder getNbViewHolder() {
48 | return pageControl.getNbBar().getViewHolder();
49 | }
50 |
51 | public void showLoading() {
52 | pageControl.showLoading();
53 | }
54 |
55 | public void hideLoading() {
56 | pageControl.hideLoading();
57 | }
58 |
59 | public void toast(String msg) {
60 | pageControl.toast(msg);
61 | }
62 |
63 | public Context getContext() {
64 | return pageControl.getContext();
65 | }
66 |
67 | public Activity getActivity() {
68 | return this;
69 | }
70 |
71 | @Override
72 | public void onNbBack() {
73 | finish();
74 | }
75 |
76 | @Override
77 | public void onNbLeft(View view) {
78 |
79 | }
80 |
81 | @Override
82 | public void onNbRight(View view, int which) {
83 |
84 | }
85 |
86 | @Override
87 | public void onNbTitle(View view) {
88 |
89 | }
90 |
91 | @Override
92 | public void onNbSearch(String keyWord) {
93 | pageControl.getStatusPage().hideStatus();
94 | }
95 |
96 | @Override
97 | public void onNbSearchClear() {
98 |
99 | }
100 |
101 | @Override
102 | protected void onResume() {
103 | pageControl.onResume();
104 | super.onResume();
105 | }
106 |
107 | @Override
108 | protected void onDestroy() {
109 | pageControl.onDestroy();
110 | super.onDestroy();
111 | }
112 |
113 | @Override
114 | protected void onPause() {
115 | super.onPause();
116 | }
117 |
118 | @Override
119 | public void onBackPressed() {
120 | super.onBackPressed();
121 | }
122 |
123 | @Override
124 | public void onConfigurationChanged(Configuration newConfig) {
125 | super.onConfigurationChanged(newConfig);
126 | //切换横竖屏不重新加载界面
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/baseapp/baseactivity/FrmBaseCompatActivity.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.baseapp.baseactivity;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.res.Configuration;
6 | import android.os.Bundle;
7 | import android.support.v7.app.ActionBar;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 |
12 | import com.quick.core.baseapp.baseactivity.control.PageControl;
13 | import com.quick.core.ui.app.INbControl;
14 | import com.quick.core.ui.app.IPageControl;
15 |
16 |
17 | /**
18 | * Created by dailichun on 2017/12/8.
19 | * 基础Activity 继承android.support.v7.app.AppCompatActivity
20 | */
21 | public class FrmBaseCompatActivity extends AppCompatActivity implements INbControl.INbOnClick {
22 |
23 | /**
24 | * 页面控制器
25 | */
26 | public IPageControl pageControl;
27 |
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | //去掉自带的actionbar
32 | ActionBar actionBar = getSupportActionBar();
33 | if (actionBar != null) {
34 | actionBar.hide();
35 | }
36 |
37 | pageControl = new PageControl(this, this);
38 | pageControl.initBaseView(LayoutInflater.from(this), null);
39 | }
40 |
41 | public void setLayout(int layoutId) {
42 | pageControl.setLayout(layoutId);
43 | }
44 |
45 | public void setLayout(View view) {
46 | pageControl.setLayout(view);
47 | }
48 |
49 | public void setTitle(String title) {
50 | pageControl.setTitle(title);
51 | }
52 |
53 | public INbControl.ViewHolder getNbViewHolder() {
54 | return pageControl.getNbBar().getViewHolder();
55 | }
56 |
57 | public void showLoading() {
58 | pageControl.showLoading();
59 | }
60 |
61 | public void hideLoading() {
62 | pageControl.hideLoading();
63 | }
64 |
65 | public void toast(String msg) {
66 | pageControl.toast(msg);
67 | }
68 |
69 | public Context getContext() {
70 | return pageControl.getContext();
71 | }
72 |
73 | public Activity getActivity() {
74 | return this;
75 | }
76 |
77 | @Override
78 | public void onNbBack() {
79 | finish();
80 | }
81 |
82 | @Override
83 | public void onNbLeft(View view) {
84 |
85 | }
86 |
87 | @Override
88 | public void onNbRight(View view, int which) {
89 |
90 | }
91 |
92 | @Override
93 | public void onNbTitle(View view) {
94 |
95 | }
96 |
97 | @Override
98 | public void onNbSearch(String keyWord) {
99 |
100 | }
101 |
102 | @Override
103 | public void onNbSearchClear() {
104 |
105 | }
106 |
107 | @Override
108 | protected void onResume() {
109 | super.onResume();
110 | pageControl.onResume();
111 | }
112 |
113 | @Override
114 | protected void onDestroy() {
115 | super.onDestroy();
116 | pageControl.onDestroy();
117 | }
118 |
119 | @Override
120 | public void onBackPressed() {
121 | super.onBackPressed();
122 | }
123 |
124 | @Override
125 | public void onConfigurationChanged(Configuration newConfig) {
126 | super.onConfigurationChanged(newConfig);
127 | //切换横竖屏不重新加载界面
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/baseapp/baseactivity/FrmBaseFragment.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.baseapp.baseactivity;
2 |
3 | import android.app.Fragment;
4 | import android.os.Bundle;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.quick.core.baseapp.baseactivity.control.PageControl;
10 | import com.quick.core.ui.app.IErrorControl;
11 | import com.quick.core.ui.app.INbControl;
12 | import com.quick.core.ui.app.IPageControl;
13 |
14 |
15 | /**
16 | * Created by dailichun on 2017/12/8.
17 | * 基础Fragment 继承android.app.Fragment
18 | */
19 | public class FrmBaseFragment extends Fragment implements INbControl.INbOnClick {
20 |
21 | /**
22 | * 页面控制器
23 | */
24 | public IPageControl pageControl;
25 |
26 | @Override
27 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
28 |
29 | pageControl = new PageControl(this, this);
30 |
31 | return pageControl.initBaseView(inflater, container);
32 | }
33 |
34 | public void setLayout(int layoutId) {
35 | pageControl.setLayout(layoutId);
36 | }
37 |
38 | public void setLayout(View view) {
39 | pageControl.setLayout(view);
40 | }
41 |
42 | public void setTitle(String title){
43 | pageControl.setTitle(title);
44 | }
45 |
46 | public INbControl.ViewHolder getNbViewHolder(){
47 | return pageControl.getNbBar().getViewHolder();
48 | }
49 |
50 | public IErrorControl getStatusItem(){
51 | return pageControl.getStatusPage();
52 | }
53 |
54 | public void showLoading() {
55 | pageControl.showLoading();
56 | }
57 |
58 | public void hideLoading() {
59 | pageControl.hideLoading();
60 | }
61 |
62 | public void toast(String msg) {
63 | pageControl.toast(msg);
64 | }
65 |
66 | public View findViewById(int id) {
67 | return pageControl.findViewById(id);
68 | }
69 |
70 | @Override
71 | public void onResume() {
72 | super.onResume();
73 | pageControl.onResume();
74 | }
75 |
76 | @Override
77 | public void onDestroy() {
78 | super.onDestroy();
79 | pageControl.onDestroy();
80 | }
81 |
82 | @Override
83 | public void onDestroyView() {
84 | super.onDestroyView();
85 | pageControl.onDestroyFragmentView();
86 | }
87 |
88 | @Override
89 | public void onNbBack() {
90 | getActivity().finish();
91 | }
92 |
93 | @Override
94 | public void onNbLeft(View view) {
95 |
96 | }
97 |
98 | @Override
99 | public void onNbRight(View view, int which) {
100 |
101 | }
102 |
103 | @Override
104 | public void onNbTitle(View view) {
105 |
106 | }
107 |
108 | @Override
109 | public void onNbSearch(String keyWord) {
110 |
111 | }
112 |
113 | @Override
114 | public void onNbSearchClear() {
115 |
116 | }
117 |
118 | }
119 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/baseapp/baseactivity/FrmFragmentActivity.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.baseapp.baseactivity;
2 |
3 | import android.app.Fragment;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 | import android.text.TextUtils;
8 | import android.util.Log;
9 |
10 | import quick.com.core.R;
11 |
12 | /**
13 | * Created by dailichun on 2017/12/8.
14 | * Fragment的Activity容器
15 | */
16 | public class FrmFragmentActivity extends FrmBaseActivity {
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 |
22 | pageControl.getNbBar().hide();
23 |
24 | try {
25 | String fragmentName = getIntent().getStringExtra("fragment");
26 | Bundle bundle = getIntent().getBundleExtra("data");
27 | if (!TextUtils.isEmpty(fragmentName)) {
28 | Fragment fragment = (Fragment) Class.forName(fragmentName).newInstance();
29 | if (bundle!=null){
30 | fragment.setArguments(bundle);
31 | }
32 | getFragmentManager().beginTransaction().add(R.id.baseContent,fragment).commit();
33 | }else{
34 | Log.e("FrmFragmentActivity",fragmentName+"未找到");
35 | }
36 | } catch (InstantiationException e) {
37 | e.printStackTrace();
38 | } catch (IllegalAccessException e) {
39 | e.printStackTrace();
40 | } catch (ClassNotFoundException e) {
41 | e.printStackTrace();
42 | }
43 | }
44 |
45 | public static void go(Context context, Class fragmentClass){
46 | go(context,fragmentClass,null);
47 | }
48 |
49 | public static void go(Context context, Class fragmentClass, Bundle bundle){
50 | Intent intent = new Intent(context,FrmV4FragmentActivity.class);
51 | intent.putExtra("fragment",fragmentClass.getName());
52 | intent.putExtra("data",bundle);
53 | context.startActivity(intent);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/baseapp/baseactivity/FrmV4FragmentActivity.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.baseapp.baseactivity;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.text.TextUtils;
7 | import android.util.Log;
8 |
9 | import quick.com.core.R;
10 |
11 |
12 | /**
13 | * Created by dailichun on 2017/12/8.
14 | * V4Fragment的Activity容器
15 | */
16 | public class FrmV4FragmentActivity extends FrmBaseCompatActivity {
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 |
22 | pageControl.getNbBar().hide();
23 |
24 | try {
25 | String fragmentName = getIntent().getStringExtra("fragment");
26 | Bundle bundle = getIntent().getBundleExtra("data");
27 | if (!TextUtils.isEmpty(fragmentName)) {
28 | android.support.v4.app.Fragment fragment = (android.support.v4.app.Fragment) Class.forName(fragmentName).newInstance();
29 | if (bundle != null) {
30 | fragment.setArguments(bundle);
31 | }
32 | getSupportFragmentManager().beginTransaction().add(R.id.baseContent, fragment).commit();
33 | } else {
34 | Log.e("FrmV4FragmentActivity", fragmentName + "未找到");
35 | }
36 | } catch (InstantiationException e) {
37 | e.printStackTrace();
38 | } catch (IllegalAccessException e) {
39 | e.printStackTrace();
40 | } catch (ClassNotFoundException e) {
41 | e.printStackTrace();
42 | }
43 | }
44 |
45 | public static void go(Context context, Class fragmentClass) {
46 | go(context, fragmentClass, null);
47 | }
48 |
49 | public static void go(Context context, Class fragmentClass, Bundle bundle) {
50 | Intent intent = new Intent(context, FrmV4FragmentActivity.class);
51 | intent.putExtra("fragment",fragmentClass.getName());
52 | intent.putExtra("data", bundle);
53 | context.startActivity(intent);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/baseapp/component/scan/ScanCaptureActivity.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.baseapp.component.scan;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.view.View;
6 |
7 | import com.journeyapps.barcodescanner.CaptureActivity;
8 | import com.journeyapps.barcodescanner.DecoratedBarcodeView;
9 | import com.quick.core.util.device.DeviceUtil;
10 |
11 | import quick.com.core.R;
12 |
13 | /**
14 | * Created by dailichun on 2017/12/7.
15 | * 自定义二维码扫描界面
16 | */
17 | public class ScanCaptureActivity extends CaptureActivity {
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | DeviceUtil.setStatusBarColor(this,R.color.text_black);
23 | findViewById(R.id.iv_back).setOnClickListener(new View.OnClickListener() {
24 | @Override
25 | public void onClick(View v) {
26 | finish();
27 | }
28 | });
29 |
30 | }
31 |
32 | /**
33 | * Override to use a different layout.
34 | *
35 | * @return the DecoratedBarcodeView
36 | */
37 | protected DecoratedBarcodeView initializeContent() {
38 | setContentView(R.layout.frm_scan_activity);
39 | DecoratedBarcodeView barcodeScannerView = (DecoratedBarcodeView) findViewById(R.id.zxing_barcode_scanner);
40 | barcodeScannerView.setStatusText("");
41 | return barcodeScannerView;
42 | }
43 |
44 | @Override
45 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
46 | super.onActivityResult(requestCode, resultCode, data);
47 | if (requestCode==0 && resultCode==RESULT_OK){
48 | setResult(RESULT_OK,data);
49 | finish();
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/baseapp/theme/BaseThemeControl.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.baseapp.theme;
2 |
3 | import com.quick.core.ui.app.IThemeControl;
4 | import com.quick.core.ui.app.ThemeBean;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | import quick.com.core.R;
10 |
11 |
12 | /**
13 | * Created by dailichun on 2017/12/7.
14 | * 主题配置类
15 | */
16 | public class BaseThemeControl implements IThemeControl {
17 |
18 | private List themes;
19 |
20 | private static BaseThemeControl ourInstance;
21 |
22 | public static BaseThemeControl getInstance() {
23 | if (ourInstance == null) {
24 | ourInstance = new BaseThemeControl();
25 | }
26 | return ourInstance;
27 | }
28 |
29 | /**
30 | * 获取框架默认提供的主题,也可以根据需求自己定义
31 | *
32 | * @return
33 | */
34 | public static List getDefaultThemes() {
35 |
36 | List themes = new ArrayList<>();
37 |
38 | ThemeBean defaultItem = new ThemeBean();
39 | defaultItem.themeId = "theme_default_blue";
40 | defaultItem.topbarImage = R.color.white;
41 | defaultItem.topbarBackImage = R.mipmap.img_back_nav_btn;
42 | defaultItem.topbarFilterColor = R.color.nbbar_bg_blue;
43 | themes.add(defaultItem);
44 |
45 | return themes;
46 | }
47 |
48 | /**
49 | * 初始化设置指定主题
50 | *
51 | * @param themeList
52 | */
53 | @Override
54 | public void initTheme(List themeList) {
55 | if (themeList != null && themeList.size() > 0) {
56 | themes = themeList;
57 | setThemeId(themes.get(0).themeId);
58 | }
59 | }
60 |
61 | /**
62 | * 设置第一个主题为当前用户选择的主题
63 | */
64 | @Override
65 | public void setThemeId(String id) {
66 |
67 | // 可以保持数据库,默认不做
68 | }
69 |
70 | @Override
71 | public String getThemeId() {
72 |
73 | // 默认就是默认主题
74 | return "theme_default_blue";
75 | }
76 |
77 | /**
78 | * 获取设置的主题
79 | *
80 | * @return
81 | */
82 | @Override
83 | public List getTheme() {
84 | return themes;
85 | }
86 |
87 | /**
88 | * 获取本用户保存主题的key值
89 | *
90 | * @return
91 | */
92 | @Override
93 | public String getThemeKey() {
94 | return "theme_default_blue";
95 | }
96 |
97 | /**
98 | * 获取当前主题
99 | *
100 | * @return
101 | */
102 | @Override
103 | public ThemeBean getSelectedTheme() {
104 | if (themes == null) {
105 | initTheme(getDefaultThemes());
106 | }
107 | String themeId = "theme_default_blue";
108 | ThemeBean cuTheme = themes.get(0);
109 | for (ThemeBean theme : themes) {
110 | if (theme.themeId.equals(themeId)) {
111 | cuTheme = theme;
112 | }
113 | }
114 | return cuTheme;
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/ui/app/IErrorControl.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.ui.app;
2 |
3 | import android.view.View;
4 |
5 |
6 | /**
7 | * Created by dailichun on 2017/12/6.
8 | * 界面错误处理接口
9 | */
10 |
11 | public interface IErrorControl {
12 |
13 | /**
14 | * 获取根布局
15 | *
16 | * @return
17 | */
18 | View getRootView();
19 |
20 | /**
21 | * 按照错误类型显示错误页面
22 | *
23 | * @param type
24 | */
25 | void showStatus(int type);
26 |
27 | /**
28 | * 指定错误图片和文字
29 | *
30 | * @param resid
31 | * @param info
32 | */
33 | void showStatus(int resid, String info);
34 |
35 | /**
36 | * 设置错误描述
37 | *
38 | * @param description
39 | */
40 | void setErrorDescription(String description);
41 |
42 | /**
43 | * 隐藏错误页面,并且展示正文内容
44 | */
45 | void hideStatus();
46 |
47 | /**
48 | * 设置点击按钮
49 | *
50 | * @param text
51 | * @param clickListener
52 | */
53 | void setClickButton(String text, View.OnClickListener clickListener);
54 | }
55 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/ui/app/INbControl.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.ui.app;
2 |
3 | import android.view.View;
4 | import android.widget.FrameLayout;
5 | import android.widget.ImageView;
6 | import android.widget.LinearLayout;
7 | import android.widget.TextView;
8 |
9 | import com.quick.core.ui.widget.DrawableText;
10 | import com.quick.core.ui.widget.NbImageView;
11 | import com.quick.core.ui.widget.NbTextView;
12 |
13 | /**
14 | * Created by dailichun on 2017/12/6.
15 | * 导航栏操作接口。所有的导航栏控制器都必须实现该接口。
16 | */
17 | public interface INbControl {
18 |
19 | /**
20 | * 获取导航栏根布局
21 | *
22 | * @return
23 | */
24 | View getRootView();
25 |
26 | /**
27 | * 隐藏导航栏
28 | */
29 | void hide();
30 |
31 | /**
32 | * 显示导航栏
33 | */
34 | void show();
35 |
36 | /**
37 | * 隐藏边线
38 | */
39 | void hideLine();
40 |
41 | /**
42 | * 隐藏返回按钮
43 | */
44 | void hideNbBack();
45 |
46 | /**
47 | * 显示返回按钮
48 | */
49 | void showNbBack();
50 |
51 | /**
52 | * 设置最左侧按钮背景图片
53 | *
54 | * @param resid
55 | */
56 | void setNbBackImage(Object resid);
57 |
58 | /**
59 | * 设置导航栏背景图或者颜色
60 | *
61 | * @param bg
62 | */
63 | void setNbBackground(Object bg);
64 |
65 | /**
66 | * 设置导航栏过滤色,除了标题的图片和文字颜色都会被强制改为过滤色
67 | *
68 | * @param filterColor
69 | */
70 | void setColorFilter(Object filterColor);
71 |
72 | /**
73 | * 设置主题
74 | *
75 | * @param bean
76 | */
77 | void setTheme(ThemeBean bean);
78 |
79 | /**
80 | * 设置导航栏标题
81 | *
82 | * @param title 标题
83 | */
84 | void setNbTitle(String title);
85 |
86 | /**
87 | * 设置导航栏标题
88 | *
89 | * @param title 标题
90 | * @param title2 副标题
91 | */
92 | void setNbTitle(String title, String title2);
93 |
94 | /**
95 | * 设置导航栏自定义标题布局
96 | *
97 | * @param view
98 | */
99 | void addNbCustomTitleView(View view);
100 |
101 | /**
102 | * 设置标题是否可点击
103 | *
104 | * @param clickable 是否可点击
105 | * @param arrow 箭头图标
106 | */
107 | void setTitleClickable(boolean clickable, int arrow);
108 |
109 | /**
110 | * 获取控件对象集合
111 | *
112 | * @return
113 | */
114 | ViewHolder getViewHolder();
115 |
116 | /**
117 | * 获取搜索条件
118 | * @return
119 | */
120 | String getCondition();
121 |
122 | class ViewHolder {
123 |
124 | //最左侧图标按钮,一般是返回按钮
125 | public NbImageView nbBack;
126 |
127 | //最左侧图文按钮
128 | public DrawableText nbLeftTv1;
129 |
130 | //左侧图标按钮,在nbBack右侧
131 | public NbImageView nbLeftIv2;
132 |
133 | //左侧文字按钮,在nbBack右侧
134 | public NbTextView nbLeftTv2;
135 |
136 | //右侧图标按钮,框架默认4个
137 | public NbImageView[] nbRightIvs;
138 |
139 | //最右侧文字按钮,框架默认2个
140 | public NbTextView[] nbRightTvs;
141 |
142 | //标题父控件
143 | public View titleParent;
144 |
145 | //主标题
146 | public TextView nbTitle;
147 |
148 | //副标题
149 | public TextView nbTitle2;
150 |
151 | //标题箭头,可点击时展示
152 | public ImageView ivTitleArrow;
153 |
154 | //自定义标题父控件
155 | public FrameLayout nbCustomTitleLayout;
156 |
157 | //线
158 | public LinearLayout line;
159 |
160 | //导航栏根布局
161 | public View nbRoot;
162 |
163 | }
164 |
165 | interface INbOnClick {
166 |
167 | void onNbBack();
168 |
169 | void onNbLeft(View view);
170 |
171 | void onNbRight(View view, int which);
172 |
173 | void onNbTitle(View view);
174 |
175 | void onNbSearch(String keyWord);
176 |
177 | void onNbSearchClear();
178 | }
179 | }
180 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/ui/app/IPageControl.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.ui.app;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | /**
10 | * Created by dailichun on 2017/12/6.
11 | * 基础界面接口,定义了页面的基本操作,基础Activity或者Fragment必须实现该类
12 | */
13 |
14 | public interface IPageControl {
15 |
16 | /**
17 | * 设置横竖屏
18 | */
19 | void setOrientation();
20 |
21 | /**
22 | * 初始化根布局,包括导航栏,正文,状态栏等
23 | */
24 | View initBaseView(LayoutInflater inflater, ViewGroup container);
25 |
26 | /**
27 | * 显示页面加载进度条
28 | */
29 | void showLoading();
30 |
31 | /**
32 | * 显示页面加载进度条
33 | */
34 | void showLoading(String message);
35 |
36 | /**
37 | * 隐藏页面加载进度条
38 | */
39 | void hideLoading();
40 |
41 | /**
42 | * 显示提示文字
43 | */
44 | void toast(String msg);
45 |
46 |
47 | /**
48 | * 设置正文布局
49 | *
50 | * @param layoutId
51 | */
52 | void setLayout(int layoutId);
53 |
54 | /**
55 | * 设置正文布局
56 | *
57 | * @param view
58 | */
59 | void setLayout(View view);
60 |
61 | /**
62 | * 设置标题
63 | *
64 | * @param title
65 | */
66 | void setTitle(String title);
67 |
68 | /**
69 | * 设置标题
70 | *
71 | * @param title
72 | */
73 | void setTitle(String[] title);
74 |
75 | /**
76 | * 获取导航栏点击事件
77 | *
78 | * @return
79 | */
80 | INbControl.INbOnClick getNbOnClick();
81 |
82 | /**
83 | * 获取上下文
84 | *
85 | * @return
86 | */
87 | Context getContext();
88 |
89 | /**
90 | * 获取Activity对象
91 | *
92 | * @return
93 | */
94 | Activity getActivity();
95 |
96 | /**
97 | * 获取Fragment对象
98 | *
99 | * @return
100 | */
101 | Object getFragment();
102 |
103 |
104 | /**
105 | * 获取界面根布局
106 | *
107 | * @return
108 | */
109 | View getRootView();
110 |
111 | /**
112 | * 获取界面正文根布局
113 | *
114 | * @return
115 | */
116 | View getBaseContent();
117 |
118 | /**
119 | * 根据id查找根布局中的控件
120 | *
121 | * @param id
122 | * @return
123 | */
124 | View findViewById(int id);
125 |
126 | /**
127 | * 获取导航栏控制器
128 | *
129 | * @return
130 | */
131 | INbControl getNbBar();
132 |
133 | /**
134 | * 设置自定义导航栏
135 | *
136 | * @return
137 | */
138 | void setNbBar(INbControl nbBar);
139 |
140 | /**
141 | * 获取界面异常状态视图
142 | *
143 | * @return
144 | */
145 | IErrorControl getStatusPage();
146 |
147 | /**
148 | * 设置自定义界面异常状态视图,需要自己addview
149 | *
150 | * @return
151 | */
152 | void setStatusPage(IErrorControl statusControl);
153 |
154 | /**
155 | * Activity或者Fragment的onDestroy
156 | */
157 | void onDestroy();
158 |
159 | /**
160 | * Activity或者Fragment的onResume
161 | */
162 | void onResume();
163 |
164 | /**
165 | * Fragment的onDestroyView,相当于Activity的onStop
166 | */
167 | void onDestroyFragmentView();
168 |
169 | /**
170 | * 是否为Fragment界面
171 | *
172 | * @return
173 | */
174 | boolean isFragment();
175 | }
176 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/ui/app/IThemeControl.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.ui.app;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by dailichun on 2017/12/7.
7 | * 主题设置接口,只要对导航栏以及状态栏的全局控制
8 | */
9 | public interface IThemeControl {
10 |
11 | /**
12 | * 初始化可选主题
13 | *
14 | * @param themeList
15 | */
16 | void initTheme(List themeList);
17 |
18 | /**
19 | * 设置当前主题id
20 | *
21 | * @param id
22 | */
23 | void setThemeId(String id);
24 |
25 | /**
26 | * 获取当前主题id
27 | */
28 | String getThemeId();
29 |
30 | /**
31 | * 获取所有可选主题
32 | *
33 | * @return
34 | */
35 | List getTheme();
36 |
37 | /**
38 | * 获取当前主题
39 | *
40 | * @return
41 | */
42 | ThemeBean getSelectedTheme();
43 |
44 | /**
45 | * 获取当前用户保存主题的key值
46 | *
47 | * @return
48 | */
49 | String getThemeKey();
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/ui/app/ThemeBean.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.ui.app;
2 |
3 | /**
4 | * Created by dailichun on 2017/12/7.
5 | * 主题实体对象
6 | */
7 | public class ThemeBean {
8 |
9 | /**
10 | * 主题id
11 | */
12 | public String themeId;
13 |
14 | /**
15 | * 导航栏背景
16 | * 支持3种格式:
17 | * 1.String #RRGGBB或#AARRGGBB (Quick只能使用这种方式,且去掉#)
18 | * 2.int 纯数字 表示资源id,可以是Color.XX或者R.color.XX
19 | */
20 | public Object topbarImage;
21 |
22 | /*
23 | * 左侧返回按钮图片
24 | * 支持3种格式:
25 | * 1.int R.drawable.XX
26 | * 2.String 文件名 表示R.drawable.XX中的文件名
27 | * 3.网络图片 (Quick只能使用这种方式,如果加载失败则加载默认图片)
28 | */
29 | public Object topbarBackImage ;
30 |
31 | /**
32 | * 文字图片过滤色
33 | * 支持2种格式:
34 | * 1.#RRGGBB或#AARRGGBB (Quick只能使用这种方式,且去掉#)
35 | * 2.纯数字 表示资源id,可以是Color.XX或者R.color.XX
36 | */
37 | public Object topbarFilterColor;
38 |
39 | /*
40 | * 备用背景图片
41 | *
42 | */
43 | public Object otherImage;
44 |
45 | /*
46 | *备用背景图片
47 | */
48 | public Object otherImage2;
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/ui/widget/NbImageView.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.ui.widget;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.AppCompatImageView;
5 | import android.util.AttributeSet;
6 | import android.view.MotionEvent;
7 | import android.widget.ImageView;
8 |
9 | /**
10 | * Created by dailichun on 2017/12/6.
11 | * 自定义ImageView, 点击时半透明
12 | */
13 | public class NbImageView extends ImageView {
14 |
15 | public NbImageView(Context context, AttributeSet attrs) {
16 | super(context, attrs);
17 | }
18 |
19 | @Override
20 | public boolean onTouchEvent(MotionEvent event) {
21 | if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
22 | setAlpha(0.6f);
23 | } else {
24 | setAlpha(1.0f);
25 | }
26 | return super.onTouchEvent(event);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/ui/widget/NbTextView.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.ui.widget;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.AppCompatTextView;
5 | import android.util.AttributeSet;
6 | import android.view.MotionEvent;
7 | import android.widget.TextView;
8 |
9 | /**
10 | * Created by dailichun on 2017/12/6.
11 | * 自定义TextView, 点击时半透明
12 | */
13 | public class NbTextView extends TextView {
14 |
15 | public NbTextView(Context context, AttributeSet attrs) {
16 | super(context, attrs);
17 | }
18 |
19 | @Override
20 | public boolean onTouchEvent(MotionEvent event) {
21 | if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
22 | setAlpha(0.6f);
23 | } else {
24 | setAlpha(1.0f);
25 | }
26 | return super.onTouchEvent(event);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/ui/widget/SegActionCallBack.java:
--------------------------------------------------------------------------------
1 |
2 | package com.quick.core.ui.widget;
3 |
4 |
5 | /**
6 | * Created by dailichun on 2017/12/7.
7 | * ActionBarSeg点击回调接口
8 | */
9 | public interface SegActionCallBack {
10 |
11 | /**
12 | * 点击按钮执行事件
13 | *
14 | * @param i 点击按钮的索引
15 | */
16 | void segAction(int i);
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/ui/widget/ToastUtil.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.ui.widget;
2 |
3 | import android.content.Context;
4 | import android.text.TextUtils;
5 | import android.widget.Toast;
6 |
7 | /**
8 | * Created by dailichun on 2017/12/7.
9 | * 提示信息工具类
10 | */
11 | public class ToastUtil {
12 |
13 | public static void toastShort(Context context, String message) {
14 | if (TextUtils.isEmpty(message) || context==null) {
15 | return;
16 | }
17 | Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
18 | }
19 |
20 | public static void toastLong(Context context, String message) {
21 | if (TextUtils.isEmpty(message) || context==null) {
22 | return;
23 | }
24 | Toast.makeText(context, message, Toast.LENGTH_LONG).show();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/ui/widget/dialog/DialogSelectAdapter.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.ui.widget.dialog;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 |
12 | import java.util.HashMap;
13 | import java.util.List;
14 |
15 | import quick.com.core.R;
16 |
17 | /**
18 | * 列表选择对话框适配器
19 | */
20 | public class DialogSelectAdapter extends BaseAdapter {
21 |
22 | private List> meumList;
23 |
24 | private Context con;
25 |
26 | private LayoutInflater inflater;
27 |
28 | /**
29 | * 是否多选
30 | */
31 | private boolean isMulti;
32 |
33 | public DialogSelectAdapter(Context con, List> meumList) {
34 | this(con, meumList, false);
35 | }
36 |
37 | public DialogSelectAdapter(Context con, List> meumList, boolean isMulti) {
38 | this.meumList = meumList;
39 | this.con = con;
40 | this.isMulti = isMulti;
41 | this.inflater = LayoutInflater.from(con);
42 | }
43 |
44 | @Override
45 | public int getCount() {
46 | return meumList.size();
47 | }
48 |
49 | @Override
50 | public HashMap getItem(int position) {
51 | return meumList.get(position);
52 | }
53 |
54 | @Override
55 | public long getItemId(int position) {
56 | return position;
57 | }
58 |
59 | @Override
60 | public View getView(int position, View convertView, ViewGroup parent) {
61 | ViewHolder holder;
62 | if (convertView == null) {
63 | holder = new ViewHolder();
64 | convertView = inflater.inflate(R.layout.frm_select_adapter, null);
65 | holder.tv = (TextView) convertView.findViewById(R.id.tv);
66 | holder.iv = (ImageView) convertView.findViewById(R.id.iv);
67 | convertView.setTag(holder);
68 | } else {
69 | holder = (ViewHolder) convertView.getTag();
70 | }
71 | HashMap map = meumList.get(position);
72 | holder.tv.setText(map.get("text").toString());
73 | if (isMulti) {
74 | holder.iv.setVisibility(View.VISIBLE);
75 | setCheckBg(map, holder.iv, holder.tv);
76 | } else {
77 | holder.iv.setVisibility(View.GONE);
78 | }
79 | return convertView;
80 | }
81 |
82 | public void onItemClick(View view, int position) {
83 | ImageView iv = (ImageView) view.findViewById(R.id.iv);
84 | TextView tv = (TextView) view.findViewById(R.id.tv);
85 | setCheckBg(meumList.get(position), iv, tv);
86 | }
87 |
88 | private void setCheckBg(HashMap map, ImageView iv, TextView tv) {
89 | if ("1".equals(map.get("isChecked"))) {
90 | map.put("isChecked", "0");
91 | iv.setImageResource(R.mipmap.img_unchecked_btn);
92 | tv.setTextColor(con.getResources().getColor(R.color.text_black));
93 | } else {
94 | map.put("isChecked", "1");
95 | iv.setImageResource(R.mipmap.img_checked_btn);
96 | tv.setTextColor(con.getResources().getColor(R.color.text_blue));
97 | }
98 | }
99 |
100 | public class ViewHolder {
101 | public TextView tv;
102 | public ImageView iv;
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/ui/widget/popmenu/PopChangedListener.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.ui.widget.popmenu;
2 |
3 |
4 | /**
5 | * Created by dailichun on 2017/12/6.
6 | * 弹出窗口状态变化监听器
7 | */
8 | public interface PopChangedListener {
9 | void onShow(FrmPopMenu pop);
10 |
11 | void onHide(FrmPopMenu pop);
12 | }
13 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/ui/widget/popmenu/PopClickListener.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.ui.widget.popmenu;
2 |
3 |
4 | /**
5 | * Created by dailichun on 2017/12/6.
6 | * 弹出菜单点击接口
7 | */
8 | public interface PopClickListener {
9 | void onClick(int index);
10 | }
11 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/ui/widget/segbar/SegActionCallBack.java:
--------------------------------------------------------------------------------
1 | /*
2 | *Copyright (C) 2014 Jiangsu Guotai Epoint Software co., Ltd.
3 | */
4 | package com.quick.core.ui.widget.segbar;
5 |
6 |
7 | /**
8 | * Created by dailichun on 2017/12/6.
9 | * ActionBarSeg点击回调接口
10 | */
11 | public interface SegActionCallBack {
12 |
13 | /**
14 | * 点击按钮执行事件
15 | *
16 | * @param i 点击按钮的索引
17 | */
18 | void segAction(int i);
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/util/app/AppUtil.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.util.app;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | import com.nostra13.universalimageloader.core.DisplayImageOptions;
6 | import com.quick.core.application.FrmApplication;
7 |
8 |
9 | /**
10 | * Created by dailichun on 2017/12/6.
11 | * application工具类
12 | */
13 |
14 | public class AppUtil {
15 |
16 | public static FrmApplication getApplicationContext() {
17 | return FrmApplication.getInstance();
18 | }
19 |
20 |
21 | /**
22 | * ImageLoader组件加载图片默认配置
23 | * 显示大量的图片,当我们快速滑动GridView,ListView,希望能停止图片的加载时使用如下设置:
24 | * listView.setOnScrollListener(new PauseOnScrollListener(imageLoader, pauseOnScroll, pauseOnFling));
25 | * gridView.setOnScrollListener(new PauseOnScrollListener(imageLoader, pauseOnScroll, pauseOnFling));
26 | *
27 | * @param loadingId
28 | * @param failId
29 | * @param cacheOnMemory
30 | * @param cacheOnDinsk
31 | * @return
32 | */
33 | public static DisplayImageOptions getImageLoaderOptions(int loadingId, int failId, boolean cacheOnMemory, boolean cacheOnDinsk) {
34 | DisplayImageOptions options = new DisplayImageOptions.Builder()
35 | .showImageOnLoading(loadingId) //如果不需要设置则传0,设置该值刷新的时候会有闪烁现象
36 | .showImageForEmptyUri(failId) // 设置图片Uri为空或是错误的时候显示的图片
37 | .showImageOnFail(failId) // 设置图片加载或解码过程中发生错误显示的图片
38 | .cacheInMemory(cacheOnMemory) // default 设置下载的图片是否缓存在内存中
39 | .cacheOnDisk(cacheOnDinsk) // default 设置下载的图片是否缓存在SD卡中
40 | .bitmapConfig(Bitmap.Config.RGB_565) // default 设置图片的解码类型
41 | // .resetViewBeforeLoading(true) // default 设置图片在加载前是否重置、复位
42 | // .delayBeforeLoading(1000) // 下载前的延迟时间
43 | // .preProcessor(...)
44 | // .postProcessor(...)
45 | // .extraForDownloader(...)
46 | // .considerExifParams(false) // default
47 | // .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default 设置图片以如何的编码方式显示
48 | // .bitmapConfig(Bitmap.Config.RGB_565) // default 设置图片的解码类型
49 | // .decodingOptions(...) // 图片的解码设置
50 | // .displayer(new SimpleBitmapDisplayer()) // default 还可以设置圆角图片new RoundedBitmapDisplayer(20)
51 | // .handler(new Handler()) // default
52 | .build();
53 | return options;
54 | }
55 |
56 | /**
57 | * ImageLoader组件加载图片默认配置
58 | *
59 | * @param loadingId
60 | * @return
61 | */
62 | public static DisplayImageOptions getImageLoaderOptions(int loadingId) {
63 | return getImageLoaderOptions(loadingId, loadingId, true, true);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/util/common/QuickUtil.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.util.common;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.os.Build;
7 | import android.text.TextUtils;
8 | import android.webkit.CookieManager;
9 | import android.webkit.CookieSyncManager;
10 |
11 | import org.json.JSONArray;
12 | import org.json.JSONException;
13 | import org.json.JSONObject;
14 |
15 | import java.util.Iterator;
16 |
17 | /**
18 | * Created by dailichun on 2017/12/6.
19 | * quick工具类
20 | */
21 |
22 | public class QuickUtil {
23 |
24 | /**
25 | * 将jsnon数据传入Intent传递给本地页面
26 | *
27 | * @param jsonObject
28 | * @param intent
29 | * @return
30 | * @throws JSONException
31 | */
32 | public static Intent putIntentExtra(JSONObject jsonObject, Intent intent) throws JSONException {
33 | if (jsonObject == null || intent == null) {
34 | return null;
35 | }
36 | Iterator it = jsonObject.keys();
37 | while (it.hasNext()) {
38 | String key = it.next();
39 | Object valueObj = jsonObject.get(key);
40 | if (valueObj instanceof Boolean) {
41 | intent.putExtra(key, (boolean) valueObj);
42 | } else if (valueObj instanceof String) {
43 | intent.putExtra(key, valueObj.toString());
44 | } else if (valueObj instanceof Integer) {
45 | intent.putExtra(key, (int) valueObj);
46 | } else if (valueObj instanceof Double) {
47 | intent.putExtra(key, (Double) valueObj);
48 | } else if (valueObj instanceof Float) {
49 | intent.putExtra(key, (Float) valueObj);
50 | } else if (valueObj instanceof Byte) {
51 | intent.putExtra(key, (Byte) valueObj);
52 | } else if (valueObj instanceof Short) {
53 | intent.putExtra(key, (Short) valueObj);
54 | } else if (valueObj instanceof Long) {
55 | intent.putExtra(key, (Long) valueObj);
56 | } else {
57 | intent.putExtra(key, valueObj.toString());
58 | }
59 | }
60 | return intent;
61 | }
62 |
63 | /**
64 | * 将jsnon数据传入Intent传递给本地页面
65 | *
66 | * @param jsonArray
67 | * @param intent
68 | * @return
69 | * @throws JSONException
70 | */
71 | public static Intent putIntentExtra(JSONArray jsonArray, Intent intent) throws JSONException {
72 | if (jsonArray == null || intent == null) {
73 | return null;
74 | }
75 | for (int i = 0; i < jsonArray.length(); i++) {
76 | putIntentExtra((JSONObject) jsonArray.get(i), intent);
77 | }
78 | return intent;
79 | }
80 |
81 | /**
82 | * 本地页面回传数据给Quick页面
83 | *
84 | * @param activity
85 | * @param json
86 | */
87 | public static void quickResult(Activity activity, String json) {
88 | Intent intent = new Intent();
89 | intent.putExtra("resultData", json);
90 | activity.setResult(Activity.RESULT_OK, intent);
91 | }
92 |
93 | /**
94 | * 给webview设置cookie
95 | *
96 | * @param context
97 | * @param url
98 | */
99 | public static void setCookies(Context context, String url) {
100 | if (!TextUtils.isEmpty(url)) {
101 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP){
102 | CookieSyncManager.createInstance( context);
103 | }
104 | CookieManager cookieManager = CookieManager.getInstance();
105 | cookieManager.setAcceptCookie(true);
106 | cookieManager.removeSessionCookie();
107 | // 自动注入cookie,这个在使用cookie作为用户校验时有用
108 | cookieManager.setCookie(url, "JSESSIONID=" + QuickUtil.getToken());
109 | CookieSyncManager.getInstance().sync();
110 | }
111 | }
112 |
113 | public static String getToken() {
114 | // cookie注入的token可以通过对应的应用获取
115 | // 一般需要结合登陆,这里只预留一个接口,默认写死
116 | return "quickhybrid-test-cookie";
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/util/device/DensityUtil.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.util.device;
2 |
3 | import android.content.Context;
4 |
5 |
6 | /**
7 | * Created by dailichun on 2017/12/7.
8 | * 分辨率转化工具类
9 | */
10 | public class DensityUtil {
11 |
12 | /**
13 | * 根据手机的分辨率从 dp 的单位 转成为 px(像素)
14 | */
15 | public static int dip2px(Context con, float dpValue) {
16 | final float scale = con.getResources().getDisplayMetrics().density;
17 | return (int) (dpValue * scale + 0.5f);
18 | }
19 |
20 | /**
21 | * 根据手机的分辨率从 px(像素) 的单位 转成为 dp
22 | */
23 | public static int px2dip(Context con, float pxValue) {
24 | final float scale = con.getResources().getDisplayMetrics().density;
25 | return (int) (pxValue / scale + 0.5f);
26 | }
27 |
28 | /**
29 | * 将px值转换为sp值,保证文字大小不变
30 | * @param pxValue
31 | * @param pxValue
32 | * @return
33 | */
34 | public static int px2sp(Context con, float pxValue) {
35 | final float fontScale = con.getResources().getDisplayMetrics().scaledDensity;
36 | return (int) (pxValue / fontScale + 0.5f);
37 | }
38 |
39 | /**
40 | * 将px值转换为sp值,保证文字大小不变
41 | * @param spValue
42 | * @param spValue
43 | * @return
44 | */
45 | public static int sp2px(Context con, float spValue) {
46 | final float fontScale = con.getResources().getDisplayMetrics().scaledDensity;
47 | return (int) (spValue * fontScale + 0.5f);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/util/gis/MyLatLngPoint.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.util.gis;
2 |
3 | /**
4 | * Created by dailichun on 2017/12/7.
5 | * 坐标
6 | */
7 | public class MyLatLngPoint {
8 | private double lat, lng;
9 |
10 | public MyLatLngPoint(double lat, double lng) {
11 | this.lat = lat;
12 | this.lng = lng;
13 | }
14 |
15 | public double getLat() {
16 | return lat;
17 | }
18 |
19 | public double getLng() {
20 | return lng;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/util/io/FileSavePath.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.util.io;
2 |
3 | import android.os.Environment;
4 | import android.text.TextUtils;
5 |
6 | import com.quick.core.util.app.AppUtil;
7 | import com.quick.core.util.common.RuntimeUtil;
8 |
9 | /**
10 | * Created by dailichun on 2017/12/6.
11 | * 文件保存路径
12 | */
13 |
14 | public class FileSavePath {
15 | /**
16 | * 获取应用根文件夹
17 | *
18 | * @return
19 | */
20 | public static String getStoragePath() {
21 | return Environment.getExternalStorageDirectory().getPath() + "/" + RuntimeUtil.getPackageName(AppUtil.getApplicationContext()) + "/";
22 | }
23 |
24 | /**
25 | * 日志文件夹
26 | *
27 | * @return
28 | */
29 | public static String getLogFolder() {
30 | return getStoragePath() + "Log/";
31 | }
32 |
33 | /**
34 | * 获取用户的根文件夹
35 | *
36 | * @return
37 | */
38 | public static String getUserFolder() {
39 | String userRole = "";
40 |
41 | // TODO: 可以根据登陆用户获取不同路径,这里暂时预留
42 |
43 | if (TextUtils.isEmpty(userRole)) {
44 | userRole = "Vistor";
45 | }
46 | return getStoragePath() + userRole + "/";
47 | }
48 |
49 | /**
50 | * 下载中的临时文件存放文件夹
51 | *
52 | * @return
53 | */
54 | public static String getTempFolder() {
55 | return getUserFolder() + "Temp/";
56 | }
57 |
58 | /**
59 | * 附件下载的文件夹
60 | *
61 | * @param type 类型
62 | * @return
63 | */
64 | public static String getAttachFolder(String type) {
65 | return getUserFolder() + (TextUtils.isEmpty(type) ? "" : type + "/") + "Attach/";
66 | }
67 |
68 | /**
69 | * 附件下载的文件夹
70 | *
71 | * @return
72 | */
73 | public static String getAttachFolder() {
74 | return getAttachFolder("");
75 | }
76 |
77 | /**
78 | * 升级安装包下载的文件夹
79 | *
80 | * @return
81 | */
82 | public static String getUpgradeFolder() {
83 | return getUserFolder() + "Upgrade/";
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/util/io/IOUtil.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.util.io;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | import java.io.BufferedReader;
6 | import java.io.ByteArrayInputStream;
7 | import java.io.ByteArrayOutputStream;
8 | import java.io.IOException;
9 | import java.io.InputStream;
10 | import java.io.InputStreamReader;
11 | import java.io.ObjectInputStream;
12 | import java.io.ObjectOutputStream;
13 |
14 |
15 | /**
16 | * Created by dailichun on 2017/12/7.
17 | * 输入输出流工具类
18 | */
19 | public class IOUtil {
20 |
21 | public static InputStream bitmap2inputStream(Bitmap bm) {
22 | return bitmap2inputStream(bm, 100);
23 | }
24 |
25 | public static byte[] bitmap2Bytes(Bitmap bm) {
26 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
27 | bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
28 | return baos.toByteArray();
29 | }
30 |
31 | public static byte[] obj2bytes(Object obj) throws IOException {
32 | ByteArrayOutputStream fos = new ByteArrayOutputStream();
33 | ObjectOutputStream oos;
34 | oos = new ObjectOutputStream(fos);
35 | oos.writeObject(obj);
36 | return fos.toByteArray();
37 | }
38 |
39 | public static Object bytes2obj(byte[] b) throws ClassNotFoundException, IOException {
40 | ByteArrayInputStream bais = new ByteArrayInputStream(b);
41 | ObjectInputStream ois = new ObjectInputStream(bais);
42 | return ois.readObject();
43 | }
44 |
45 | public static String inputStream2String(InputStream is, String encode) {
46 | if (is != null) {
47 | try {
48 | BufferedReader reader = new BufferedReader(new InputStreamReader(is, encode));
49 | StringBuilder sb = new StringBuilder();
50 | String line = null;
51 | while ((line = reader.readLine()) != null) {
52 | sb.append(line).append("\n");
53 | }
54 | is.close();
55 | return sb.toString();
56 | } catch (IOException e) {
57 | e.printStackTrace();
58 | }
59 | }
60 | return "";
61 | }
62 |
63 | public static byte[] inputStream2Byte(InputStream is) {
64 | try {
65 | ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
66 | int ch;
67 | while ((ch = is.read()) != -1) {
68 | bytestream.write(ch);
69 | }
70 | byte imgdata[] = bytestream.toByteArray();
71 | bytestream.close();
72 | return imgdata;
73 | } catch (Exception e) {
74 | e.printStackTrace();
75 | return null;
76 | }
77 | }
78 |
79 | public static InputStream bitmap2inputStream(Bitmap bm, int quality) {
80 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
81 | bm.compress(Bitmap.CompressFormat.PNG, quality, baos);
82 | return new ByteArrayInputStream(baos.toByteArray());
83 | }
84 |
85 | public static byte[] object2Byte(Object obj) {
86 | byte[] bytes = null;
87 | ByteArrayOutputStream bos = new ByteArrayOutputStream();
88 | try {
89 | ObjectOutputStream oos = new ObjectOutputStream(bos);
90 | oos.writeObject(obj);
91 | oos.flush();
92 | bytes = bos.toByteArray();
93 | oos.close();
94 | bos.close();
95 | } catch (IOException ex) {
96 | ex.printStackTrace();
97 | }
98 | return bytes;
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/util/jsbridge/QuickModulesUtil.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.util.jsbridge;
2 |
3 | import android.content.Context;
4 |
5 | import java.io.InputStream;
6 | import java.util.Properties;
7 |
8 | /**
9 | * Created by dailichun on 2017/12/18.
10 | */
11 |
12 | public class QuickModulesUtil {
13 | // 存储属性
14 | static Properties props = null;
15 |
16 | public static String getProperties(Context c, String proName){
17 | if (props == null) {
18 | try{
19 | props = new Properties();
20 | // 方法一:通过activity中的context攻取setting.properties的FileInputStream
21 | InputStream in = c.getAssets().open("modules.properties");
22 | props.load(in);
23 | } catch (Exception e) {
24 | e.printStackTrace();
25 | }
26 | }
27 |
28 | String value = "";
29 |
30 | if (props != null) {
31 | value = props.getProperty(proName);
32 | }
33 |
34 | if (value != null) {
35 | return value;
36 | }
37 |
38 | return "";
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/util/reflect/ReflectUtil.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.util.reflect;
2 |
3 | import java.lang.reflect.Constructor;
4 | import java.lang.reflect.Field;
5 | import java.lang.reflect.Method;
6 |
7 | /**
8 | * Created by dailichun on 2017/12/7.
9 | * 反射机制调用工具类
10 | */
11 | public class ReflectUtil {
12 |
13 | /**
14 | * 更改class的变量值
15 | *
16 | * @param className 类名(包括包名)
17 | * @param fieldName 变量名,必须是public类型
18 | * @param value 赋值
19 | * @return boolean
20 | */
21 | public static boolean setField(String className, String fieldName, String value) {
22 | try {
23 | Class> myclass = Class.forName(className);
24 | Field field = myclass.getField(fieldName);// 获取class中的变量
25 | Class> typeClass = field.getType();
26 | Constructor> con = typeClass.getConstructor(typeClass);
27 | Object o = con.newInstance(value);// 要赋的值
28 | field.set(myclass, o);
29 | return true;
30 | } catch (Exception e) {
31 | e.printStackTrace();
32 | return false;
33 | }
34 | }
35 |
36 | /**
37 | * 获取class的变量值
38 | *
39 | * @param className 类名(包括包名)
40 | * @param fieldName 变量名,必须是public类型
41 | * @return Object
42 | */
43 | public static Object getField(String className, String fieldName) {
44 | try {
45 | Class> myclass = Class.forName(className);
46 | // 获取class中的变量
47 | Field field = myclass.getField(fieldName);
48 | return field.get(fieldName);
49 | } catch (Exception e) {
50 | e.printStackTrace();
51 | return null;
52 | }
53 | }
54 |
55 | /**
56 | * 反射机制调用无参静态方法
57 | *
58 | * @param className 类名(包括包名)
59 | * @param methodName 方法名
60 | * @return
61 | */
62 | public static Object invokeMethod(String className, String methodName) {
63 | return invokeMethod(className,methodName,null,null);
64 | }
65 |
66 | /**
67 | * 反射调用方法
68 | *
69 | * @param className 类名(包括包名)
70 | * @param methodName 方法名
71 | * @param argsClass 参数类型数组
72 | * @param args 参数数组
73 | * @return 返回值
74 | * @throws Exception
75 | */
76 | public static Object invokeMethod(String className, String methodName, Class[] argsClass, Object[] args) {
77 | try {
78 | Class c = Class.forName(className);
79 | if (c != null) {
80 | Method method;
81 | if (argsClass == null) {
82 | method = c.getMethod(methodName);
83 | } else {
84 | method = c.getMethod(methodName, argsClass);
85 | }
86 | if (method != null) {
87 | if (args == null) {
88 | return method.invoke(c);
89 | } else {
90 | return method.invoke(c, args);
91 | }
92 | }
93 | }
94 | } catch (Exception e) {
95 | e.printStackTrace();
96 | }
97 | return null;
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/util/reflect/ResManager.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.util.reflect;
2 |
3 |
4 | /**
5 | * Created by dailichun on 2017/12/7.
6 | * 资源文件反射方式获取工具类
7 | */
8 | public class ResManager {
9 |
10 | /**
11 | * basecore组件packagename
12 | */
13 | public static final String CORE_PACKAGENAME = "com.quick.core";
14 |
15 | /**
16 | * Quick组件packagename
17 | */
18 | public static final String QUICK_PACKAGENAME = "com.quick.jsbridge";
19 |
20 | /**
21 | * 项目packagename
22 | */
23 | public static final String APP_PACKAGENAME = "com.quick.quickhybrid";
24 |
25 | public static final String style = "style";
26 | public static final String string = "string";
27 | public static final String id = "id";
28 | public static final String layout = "layout";
29 | public static final String drawable = "drawable";
30 | public static final String mipmap = "mipmap";
31 | public static final String attr = "attr";
32 | public static final String anim = "anim";
33 | public static final String raw = "raw";
34 | public static final String color = "color";
35 | public static final String animator = "animator";
36 |
37 | /**
38 | * 通过反射获取资源id,优先从框架module中的寻找资源
39 | * 尽量避免大量使用该方法,对性能有影响
40 | *
41 | * @param className 资源类型
42 | * @param name 资源文件名字
43 | * @return
44 | */
45 | public static int getResourseIdByName(String className, String name) {
46 | int id = getResourseIdByName(CORE_PACKAGENAME, className, name);
47 | if (id == 0) {
48 | id = getResourseIdByName(QUICK_PACKAGENAME, className, name);
49 | }
50 | if (id == 0) {
51 | id = getResourseIdByName(APP_PACKAGENAME, className, name);
52 | }
53 | if (id == 0) {
54 | new NoSuchFieldException(name).printStackTrace();
55 | }
56 | return id;
57 | }
58 |
59 | /**
60 | * 通过反射获取资源id
61 | *
62 | * @param packageName manifest中的包名,每个module都有单独的包名,用于指定资源所属的module
63 | * @param className 资源类型
64 | * @param name 资源文件名字
65 | * @return
66 | */
67 | public static int getResourseIdByName(String packageName, String className, String name) {
68 | int id = 0;
69 | try {
70 | Class> cls = Class.forName(packageName + ".R$" + className);
71 | if (cls != null) {
72 | id = cls.getField(name).getInt(className);
73 | }
74 | } catch (Exception ignored) {
75 | }
76 |
77 | return id;
78 | }
79 |
80 | public static int getLayoutInt(String layoutname) {
81 | return getResourseIdByName(layout, layoutname);
82 | }
83 |
84 | public static int getStringInt(String stringname) {
85 | return getResourseIdByName(string, stringname);
86 | }
87 |
88 | public static int getIdInt(String idname) {
89 | return getResourseIdByName(id, idname);
90 | }
91 |
92 | public static int getDrawableInt(String drawablename) {
93 | return getResourseIdByName(drawable, drawablename);
94 | }
95 |
96 | public static int getMipmapInt(String mipmapname) {
97 | return getResourseIdByName(mipmap, mipmapname);
98 | }
99 |
100 | public static int getAttrInt(String attrname) {
101 | return getResourseIdByName(attr, attrname);
102 | }
103 |
104 | public static int getAnimInt(String animname) {
105 | return getResourseIdByName(anim, animname);
106 | }
107 |
108 | public static int getRawInt(String rawname) {
109 | return getResourseIdByName(raw, rawname);
110 | }
111 |
112 | public static int getColorInt(String colorname) {
113 | return getResourseIdByName(color, colorname);
114 | }
115 |
116 | public static int getStyleInt(String stylename) {
117 | return getResourseIdByName(style, stylename);
118 | }
119 |
120 | public static int getAnimatorInt(String animatorname) {
121 | return getResourseIdByName(animator, animatorname);
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/core/src/main/java/com/quick/core/util/security/MD5Util.java:
--------------------------------------------------------------------------------
1 | package com.quick.core.util.security;
2 |
3 | import java.security.MessageDigest;
4 | import java.security.NoSuchAlgorithmException;
5 |
6 | /**
7 | * Created by dailichun on 2017/12/6.
8 | * 比如明文是yanzi1225627,得到MD5散列后的字符串是:14F2AE15259E2C276A095E7394DA0CA9但不能由后面一大串倒推出yanzi1225627。
9 | * 可以用于下载文件校验文件是否中途被篡改。
10 | *
11 | * 注意:这不是一个加密算法,是散列
12 | */
13 |
14 | public class MD5Util {
15 | /**
16 | * SHA1加密,不可逆
17 | *
18 | * @param password
19 | * @return
20 | * @throws java.security.NoSuchAlgorithmException
21 | */
22 | public static String authPassword(String password) {
23 | try {
24 | MessageDigest md = MessageDigest.getInstance("SHA1");
25 | md.update(password.getBytes());
26 | return bytes2Hex(md.digest()).toUpperCase();
27 | } catch (NoSuchAlgorithmException e) {
28 | return "";
29 | }
30 | }
31 |
32 | /**
33 | * 转为16进制
34 | *
35 | * @param bts
36 | * @return
37 | */
38 | public static String bytes2Hex(byte[] bts) {
39 | String des = "";
40 | String tmp = null;
41 | for (byte bt : bts) {
42 | tmp = (Integer.toHexString(bt & 0xFF));
43 | if (tmp.length() == 1) {
44 | des += "0";
45 | }
46 | des += tmp;
47 | }
48 | return des;
49 | }
50 |
51 | /**
52 | * MD5加密
53 | *
54 | * @param byteStr 需要加密的内容
55 | * @return 返回 byteStr的md5值
56 | */
57 | public static String encryptionMD5(byte[] byteStr) {
58 | MessageDigest messageDigest;
59 | StringBuilder md5StrBuff = new StringBuilder();
60 | try {
61 | messageDigest = MessageDigest.getInstance("MD5");
62 | messageDigest.reset();
63 | messageDigest.update(byteStr);
64 | byte[] byteArray = messageDigest.digest();
65 | for (int i = 0; i < byteArray.length; i++) {
66 | if (Integer.toHexString(0xFF & byteArray[i]).length() == 1) {
67 | md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray[i]));
68 | } else {
69 | md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
70 | }
71 | }
72 | } catch (NoSuchAlgorithmException e) {
73 | e.printStackTrace();
74 | }
75 | return md5StrBuff.toString();
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/actionsheet_bottom_normal.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/drawable/actionsheet_bottom_normal.9.png
--------------------------------------------------------------------------------
/core/src/main/res/drawable/actionsheet_bottom_pressed.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/drawable/actionsheet_bottom_pressed.9.png
--------------------------------------------------------------------------------
/core/src/main/res/drawable/actionsheet_middle_normal.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/drawable/actionsheet_middle_normal.9.png
--------------------------------------------------------------------------------
/core/src/main/res/drawable/actionsheet_middle_pressed.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/drawable/actionsheet_middle_pressed.9.png
--------------------------------------------------------------------------------
/core/src/main/res/drawable/actionsheet_single_normal.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/drawable/actionsheet_single_normal.9.png
--------------------------------------------------------------------------------
/core/src/main/res/drawable/actionsheet_single_pressed.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/drawable/actionsheet_single_pressed.9.png
--------------------------------------------------------------------------------
/core/src/main/res/drawable/actionsheet_top_normal.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/drawable/actionsheet_top_normal.9.png
--------------------------------------------------------------------------------
/core/src/main/res/drawable/actionsheet_top_pressed.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/drawable/actionsheet_top_pressed.9.png
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_as_ios7_cancel_bt.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_as_ios7_other_bt_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_as_ios7_other_bt_middle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_as_ios7_other_bt_single.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_as_ios7_other_bt_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_blue_btn_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_click_dialog_left_btn_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_click_dialog_right_btn_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_click_dialog_single_btn_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_click_dialog_update_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_dialog_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_dialog_btn_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_dialog_btn_press_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_dialog_left_btn_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_dialog_left_btn_press_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_dialog_press_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_dialog_right_btn_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_dialog_right_btn_press_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_dialog_title_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_dialog_updatebtn_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_dialog_updatebtn_press_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_edittext_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_edittext_cursor_color.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_nav_tab_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/core/src/main/res/drawable/frm_nav_tab_btn_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/core/src/main/res/layout/frm_base.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/core/src/main/res/layout/frm_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
22 |
23 |
34 |
35 |
48 |
49 |
50 |
51 |
52 |
58 |
59 |
63 |
64 |
70 |
71 |
81 |
82 |
83 |
84 |
85 |
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/core/src/main/res/layout/frm_image_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
22 |
23 |
30 |
31 |
32 |
43 |
44 |
56 |
57 |
71 |
72 |
--------------------------------------------------------------------------------
/core/src/main/res/layout/frm_list_pop_adapter.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
18 |
19 |
32 |
33 |
42 |
43 |
--------------------------------------------------------------------------------
/core/src/main/res/layout/frm_localfilelist_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/core/src/main/res/layout/frm_localfilelist_adapter.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
20 |
21 |
22 |
28 |
29 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/core/src/main/res/layout/frm_prompt.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
24 |
--------------------------------------------------------------------------------
/core/src/main/res/layout/frm_scan_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
19 |
20 |
26 |
27 |
35 |
36 |
41 |
42 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/core/src/main/res/layout/frm_select_adapter.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
18 |
19 |
27 |
--------------------------------------------------------------------------------
/core/src/main/res/layout/frm_simple_adapter.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
--------------------------------------------------------------------------------
/core/src/main/res/layout/frm_status.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
19 |
20 |
25 |
26 |
27 |
33 |
34 |
38 |
39 |
44 |
45 |
46 |
50 |
51 |
60 |
61 |
75 |
76 |
77 |
78 |
79 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_arrow_black_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_arrow_black_down.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_arrow_black_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_arrow_black_up.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_arrow_blue_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_arrow_blue_down.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_arrow_blue_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_arrow_blue_up.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_arrows_btn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_arrows_btn.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_back_nav_btn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_back_nav_btn.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_back_nav_btn_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_back_nav_btn_white.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_checked_btn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_checked_btn.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_default.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_exit_btn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_exit_btn.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_exit_nav_btn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_exit_nav_btn.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_fc_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_fc_back.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_fc_dir.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_fc_dir.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_fc_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_fc_file.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_fc_sdcard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_fc_sdcard.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_fc_system.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_fc_system.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_file.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_net_none_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_net_none_bg.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_net_wrong_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_net_wrong_bg.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_server_wrong_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_server_wrong_bg.png
--------------------------------------------------------------------------------
/core/src/main/res/mipmap/img_unchecked_btn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/core/src/main/res/mipmap/img_unchecked_btn.png
--------------------------------------------------------------------------------
/core/src/main/res/values/frm_attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/core/src/main/res/values/frm_colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #4071dd
5 |
6 | #fcfcfc
7 |
8 | #f5f5f5
9 |
10 | #e4e4eb
11 | #ffffff
12 | #000000
13 | #00000000
14 | #7d000000
15 |
16 | #caa9ce
17 |
18 | #666666
19 | #333333
20 | #3c80e6
21 |
22 | #e0e0e0
23 |
24 | #eeeeee
25 |
26 | #999999
27 | #ff0000
28 | #99ff0000
29 | #F3323B
30 |
31 | #B2B2B2
32 | #78D2F6
33 | #01AAEE
34 | #00AAEE
35 | #f6f6f6
36 | #A5A5A5
37 | #DDE1E7
38 |
--------------------------------------------------------------------------------
/core/src/main/res/values/frm_dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 50dp
5 |
6 | 28dp
7 |
8 | 20sp
9 |
10 | 12sp
11 |
12 | 16sp
13 |
14 | 3dp
15 |
16 |
17 | 90px
18 | 28px
19 |
20 | 34dp
21 |
22 |
23 | 44dp
24 |
25 | 30dp
26 |
27 |
28 | 44dp
29 |
30 |
31 | 60dp
32 |
33 |
34 | 17sp
35 |
36 | 14sp
37 |
38 | 65dp
39 |
40 | 45dp
41 |
--------------------------------------------------------------------------------
/core/src/main/res/values/frm_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 05L3eucgqqN58GceZsQOKluUFO01M1fT
4 |
5 | 正在加载…
6 | 提示
7 | 确定
8 | 保存
9 | 提交
10 | 取消
11 | 清空
12 | 关闭
13 | 删除
14 | 完成
15 | 发送
16 | 复制
17 | 搜索
18 | 属性
19 | 相册
20 | 拍照
21 | 选择时间
22 | 选择日期
23 | yyyy年MM月dd日 HH:mm
24 |
25 |
26 | 保存成功
27 | 保存失败
28 | 操作失败
29 | 内存不足
30 | GPS未开启
31 | 获取位置失败
32 | 权限未开启
33 | 提交失败
34 | 数据解析失败
35 | 服务器响应数据格式错误
36 | 请输入正确的手机号码
37 | 请输入正确的邮箱地址
38 |
39 |
40 | 查看原因
41 | 隐藏原因
42 | 网络请求失败
43 | 网络请求超时
44 | 页面加载失败
45 | 返回参数不合法
46 | 服务器异常
47 | 数据异常
48 | 网络异常
49 | 请求参数错误
50 | 重新获取数据
51 | 点击重新加载
52 |
53 |
54 | 扫一扫
55 | 扫码历史
56 | 查看扫描历史
57 |
58 |
59 |
60 |
61 | 文件
62 | 文件未找到
63 | 没有适合的程序打开此文件
64 | 未知文件类型
65 | 文件不能打开
66 | 文件已存在
67 | 文件无法创建
68 | sd卡
69 | 请选择小于50M的文件
70 | 文件夹创建失败
71 | 本地文件
72 | sd卡路径获取失败
73 |
74 |
75 |
76 |
77 |
78 | 关于
79 |
80 | 官网
81 | 服务条款
82 | Copyright © 2017–2017 QuickHybrid.All Rights Reserved
83 |
84 |
--------------------------------------------------------------------------------
/core/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | core
3 |
4 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quickhybrid/quickhybrid-android/e45a018fe57d0c1e6b9eeaea6092793ba4268a27/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Dec 06 14:52:06 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/jsbridge/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/jsbridge/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 25
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 16
10 | targetSdkVersion 22
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 |
26 | }
27 |
28 | dependencies {
29 |
30 | implementation project(':core')
31 | implementation fileTree(dir: 'libs', include: ['*.jar'])
32 | }
33 |
--------------------------------------------------------------------------------
/jsbridge/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 |
--------------------------------------------------------------------------------
/jsbridge/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/jsbridge/src/main/java/com/quick/jsbridge/api/AuthApi.java:
--------------------------------------------------------------------------------
1 | package com.quick.jsbridge.api;
2 |
3 | import android.webkit.WebView;
4 |
5 |
6 | import com.quick.core.util.jsbridge.QuickModulesUtil;
7 | import com.quick.jsbridge.bridge.Callback;
8 | import com.quick.jsbridge.bridge.IBridgeImpl;
9 | import com.quick.jsbridge.bridge.JSBridge;
10 | import com.quick.jsbridge.view.IQuickFragment;
11 |
12 | import org.json.JSONArray;
13 | import org.json.JSONException;
14 | import org.json.JSONObject;
15 |
16 | import java.util.HashMap;
17 | import java.util.Iterator;
18 | import java.util.Map;
19 |
20 |
21 | /**
22 | * Created by dailichun on 2017/12/6.
23 | * auth相关API
24 | */
25 | public class AuthApi implements IBridgeImpl {
26 |
27 | /**
28 | * 注册API的别名
29 | */
30 | public static String RegisterName = "auth";
31 |
32 | /**
33 | * 获取token值
34 | *
35 | * 返回:
36 | * access_token
37 | */
38 | public static void getToken(IQuickFragment webLoader, WebView wv, JSONObject param, Callback callback) {
39 | Map map = new HashMap<>();
40 | map.put("access_token", "test-token-quickhybrid");
41 | callback.applySuccess(map);
42 | }
43 |
44 | /**
45 | * H5页面初始化配置
46 | * 先验证白名单,验证失败直接显示错误状态页面,验证通过后注册自定义API,注册成功进行成功回调,否则进行失败回调。
47 | *
48 | * 参数:
49 | * jsApiList:自定义API数组[{'ui':'com.quick.jsbridge.UiApi'},{'util':'com.quick.jsbridge.UtilApi'}]
50 | */
51 | public static void config(final IQuickFragment webLoader, final WebView wv, final JSONObject param, final Callback callback) {
52 | new Thread(new Runnable() {
53 | @Override
54 | public void run() {
55 | //白名单验证
56 | webLoader.getWebloaderControl().setHasConfig(true);
57 | //注册自定义API
58 | boolean falg = true;
59 | try {
60 | JSONArray apiJsonArray = param.optJSONArray("jsApiList");
61 | if (apiJsonArray != null) {
62 | for (int i = 0; i < apiJsonArray.length(); i++) {
63 | String apiName = apiJsonArray.optString(i);
64 | String apiPath = QuickModulesUtil.getProperties(wv.getContext(), apiName);
65 |
66 | if (apiPath != null && apiPath != "") {
67 | try {
68 | Class c = Class.forName(apiPath);
69 | JSBridge.register(apiName, c);
70 | } catch (ClassNotFoundException e) {
71 | e.printStackTrace();
72 | callback.applyFail(e.toString());
73 | falg = false;
74 | break;
75 | }
76 | }
77 |
78 | if (!falg) {
79 | break;
80 | }
81 | }
82 | }
83 | } catch (Exception e) {
84 | e.printStackTrace();
85 | falg = false;
86 | callback.applyFail(e.toString());
87 | }
88 | if (falg) {
89 | callback.applySuccess();
90 | }
91 | }
92 | }).start();
93 | }
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/jsbridge/src/main/java/com/quick/jsbridge/bean/QuickBean.java:
--------------------------------------------------------------------------------
1 | package com.quick.jsbridge.bean;
2 |
3 | import android.content.pm.ActivityInfo;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * Created by dailichun on 2017/12/6.
9 | */
10 |
11 | public class QuickBean implements Serializable {
12 | /**
13 | * H5页面url地址
14 | */
15 | public String pageUrl = "about:blank";
16 |
17 | /**
18 | * 页面类型
19 | * -1:不加载导航栏
20 | * 1:默认类型
21 | * 2:搜索导航栏
22 | */
23 | public int pageStyle = 1;
24 |
25 | /**
26 | * 横竖屏{@link android.content.pm.ActivityInfo}
27 | * 0:横屏
28 | * 1:竖屏(默认)
29 | * 2:跟随用户设置
30 | */
31 | public int orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
32 |
33 | public QuickBean() {
34 |
35 | }
36 |
37 | public QuickBean(String pageUrl) {
38 | this.pageUrl = pageUrl;
39 | }
40 |
41 | public QuickBean copy() {
42 | QuickBean model = new QuickBean();
43 |
44 | model.orientation = this.orientation;
45 | model.pageStyle = this.pageStyle;
46 | model.pageUrl = this.pageUrl;
47 |
48 | return model;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/jsbridge/src/main/java/com/quick/jsbridge/bridge/IBridgeImpl.java:
--------------------------------------------------------------------------------
1 | package com.quick.jsbridge.bridge;
2 |
3 | /**
4 | * Created by dailichun on 2017/12/6.
5 | * 约束JSBridge.register方法第二个参数必须是该接口的实现类.
6 | *
7 | * API的定义必须满足以下条件:
8 | * 1.实现IBridgeImpl
9 | * 2.方法必须是public static类型
10 | * 3.固定4个参数QuickFragment,WebView,JSONObject,Callback
11 | * 4.回调统一采用 callback.apply(),参数通过JSBridge.getResponse()获取
12 | * 注意:
13 | * 耗时操作在多线程中实现
14 | * UI操作在主线程实现
15 | * 所有API不管成功与否只进行一次回调
16 | * 长期以及延时回调事件只在触发事件时回调
17 | */
18 |
19 | public interface IBridgeImpl {
20 | }
21 |
--------------------------------------------------------------------------------
/jsbridge/src/main/java/com/quick/jsbridge/control/AutoCallbackDefined.java:
--------------------------------------------------------------------------------
1 | package com.quick.jsbridge.control;
2 |
3 | import java.util.Map;
4 |
5 | /**
6 | * Created by dailichun on 2017/12/6.
7 | * 按照注册回调事件方式可分为自动注册事件以及主动注册事件。
8 | * 自动注册事件在调用对应API开启事件时自动注册对应回调事件,并在响应事件时主动回调传值;
9 | * 主动注册事件需要调用{@link }进行事件注册,
10 | * 在响应事件时主动回调传值,如果需要取消注册可调用{@link };
11 | */
12 |
13 | public interface AutoCallbackDefined {
14 |
15 | //下拉刷新时主动回调
16 | String OnSwipeRefresh = "OnSwipeRefresh";
17 |
18 | void onSwipeRefresh();
19 |
20 | //获取上一个页面关闭后回传值时主动回调
21 | String OnPageResult = "OnPageResult";
22 |
23 | void onPageResult(Map object);
24 |
25 | //页面重新可见时主动回调
26 | String OnPageResume = "OnPageResume";
27 |
28 | void onPageResume();
29 |
30 | //页面不可见时主动回调
31 | String OnPagePause = "OnPagePause";
32 |
33 | void onPagePause();
34 |
35 | //导航栏返回按钮
36 | String OnClickNbBack = "OnClickNbBack";
37 |
38 | void onClickNbBack();
39 |
40 | //导航栏左侧按钮(非返回按钮)
41 | String OnClickNbLeft = "OnClickNbLeft";
42 |
43 | void onClickNbLeft();
44 |
45 | //导航栏标题按钮
46 | String OnClickNbTitle = "OnClickNbTitle";
47 |
48 | void onClickNbTitle(int which);
49 |
50 | //导航栏最右侧按钮
51 | String OnClickNbRight = "OnClickNbRight";
52 |
53 | void onClickNbRight(int which);
54 |
55 | //系统返回按钮(物理返回键)
56 | String OnClickBack = "OnClickBack";
57 |
58 | void onClickBack();
59 |
60 | //导航栏搜索
61 | String OnSearch = "OnSearch";
62 |
63 | void onSearch(Map object);
64 |
65 | //导航栏title切换
66 | String OnTitleChanged = "OnTitleChanged";
67 |
68 | void onTitleChanged(Map object);
69 |
70 | //扫描二维码
71 | String OnScanCode = "OnScanCode";
72 |
73 | void onScanCode(Map object);
74 |
75 | //选择或者预览图片,包括拍照、选择相册
76 | String OnChoosePic = "OnChoosePic";
77 |
78 | void onChoosePic(Map object);
79 |
80 | //选择文件
81 | String OnChooseFile = "OnChooseFile";
82 |
83 | void onChooseFile(Map object);
84 |
85 | //网络状态改变
86 | String OnNetChanged = "OnNetChanged";
87 |
88 | void onNetChanged(Map object);
89 |
90 | //选择通讯录回调
91 | String OnChooseContact= "OnChooseContact";
92 |
93 | void onChooseContact(Map object);
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/jsbridge/src/main/java/com/quick/jsbridge/control/AutoCallbackEvent.java:
--------------------------------------------------------------------------------
1 | package com.quick.jsbridge.control;
2 |
3 | import android.text.TextUtils;
4 |
5 | import com.quick.jsbridge.bridge.Callback;
6 | import com.quick.jsbridge.view.webview.QuickWebView;
7 | import java.util.HashMap;
8 | import java.util.Map;
9 |
10 |
11 | /**
12 | * Created by dailichun on 2017/12/7.
13 | * 主动回调事件
14 | */
15 | public class AutoCallbackEvent implements AutoCallbackDefined {
16 |
17 | private HashMap portMap;
18 |
19 | private QuickWebView wv;
20 |
21 | public AutoCallbackEvent(QuickWebView wv, HashMap portMap) {
22 | this.portMap = portMap;
23 | this.wv = wv;
24 | }
25 |
26 | @Override
27 | public void onSwipeRefresh() {
28 | callJS(OnSwipeRefresh, wv, null);
29 | }
30 |
31 | @Override
32 | public void onPageResult(Map object) {
33 | callJS(OnPageResult, wv, object);
34 | }
35 |
36 | @Override
37 | public void onPageResume() {
38 | callJS(OnPageResume, wv, null);
39 | }
40 |
41 | @Override
42 | public void onPagePause() {
43 | callJS(OnPagePause, wv, null);
44 | }
45 |
46 | @Override
47 | public void onClickNbBack() {
48 | callJS(OnClickNbBack, wv, null);
49 | }
50 |
51 | @Override
52 | public void onClickBack() {
53 | callJS(OnClickBack, wv, null);
54 | }
55 |
56 | @Override
57 | public void onClickNbLeft() {
58 | callJS(OnClickNbLeft, wv, null);
59 | }
60 |
61 | @Override
62 | public void onClickNbTitle(int which) {
63 | Map object = new HashMap<>();
64 | object.put("which",which);
65 | callJS(OnClickNbTitle, wv, object);
66 | }
67 |
68 | @Override
69 | public void onClickNbRight(int which) {
70 | Map object = new HashMap<>();
71 | object.put("which",which);
72 | callJS(OnClickNbRight+which, wv, object);
73 | }
74 |
75 | @Override
76 | public void onSearch(Map object) {
77 | callJS(OnSearch, wv, object);
78 | }
79 |
80 | @Override
81 | public void onTitleChanged(Map object) {
82 | callJS(OnTitleChanged, wv, object);
83 | }
84 |
85 | @Override
86 | public void onScanCode(Map object) {
87 | callJS(OnScanCode, wv, object);
88 | }
89 |
90 | @Override
91 | public void onChoosePic(Map object) {
92 | callJS(OnChoosePic, wv, object);
93 | }
94 |
95 | @Override
96 | public void onChooseFile(Map object) {
97 | callJS(OnChooseFile, wv, object);
98 | }
99 |
100 | @Override
101 | public void onNetChanged(Map object) {
102 | callJS(OnNetChanged,wv,object);
103 | }
104 |
105 | @Override
106 | public void onChooseContact(Map object) {
107 | callJS(OnChooseContact,wv,object);
108 | }
109 |
110 | private void callJS(String key, QuickWebView wv, Map object) {
111 | if (wv == null) {
112 | return;
113 | }
114 | String port = portMap.get(key);
115 | if (TextUtils.isEmpty(port)) {
116 | Callback callback = new Callback(Callback.ERROR_PORT, wv);
117 | callback.applyNativeError(wv.getUrl(), key + "未注册");
118 | } else {
119 | Callback callback = new Callback(port, wv);
120 | callback.applySuccess(object);
121 | }
122 | }
123 |
124 |
125 | /**
126 | * 判断事件是否注册
127 | *
128 | * @param eventName
129 | * @return
130 | */
131 | public boolean isRegist(String eventName) {
132 | return !TextUtils.isEmpty(portMap.get(eventName));
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/jsbridge/src/main/java/com/quick/jsbridge/view/IQuickFragment.java:
--------------------------------------------------------------------------------
1 | package com.quick.jsbridge.view;
2 |
3 | import android.widget.ProgressBar;
4 |
5 | import com.quick.core.ui.app.IPageControl;
6 | import com.quick.jsbridge.bean.QuickBean;
7 | import com.quick.jsbridge.control.WebloaderControl;
8 | import com.quick.jsbridge.view.webview.QuickWebView;
9 |
10 | /**
11 | * Created by dailichun on 2017/12/6.
12 | * quick的fragment容器,如果要加载H5页面请使用{@link }
13 | */
14 |
15 | public interface IQuickFragment {
16 | /**
17 | * 获取框架页面控制器
18 | *
19 | * @return
20 | */
21 | IPageControl getPageControl();
22 |
23 | /**
24 | * 获取Quick容器控制器
25 | *
26 | * @return
27 | */
28 | WebloaderControl getWebloaderControl();
29 | /**
30 | * 获取webview对象
31 | *
32 | * @return
33 | */
34 | QuickWebView getQuickWebView();
35 |
36 | /**
37 | * 获取页面参数
38 | *
39 | * @return
40 | */
41 | QuickBean getQuickBean();
42 |
43 | /**
44 | * 获取进度条
45 | *
46 | * @return
47 | */
48 | ProgressBar getProgressBar();
49 |
50 | /**
51 | * 设置页面参数
52 | *
53 | * @return
54 | */
55 | void setQuickBean(QuickBean bean);
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/jsbridge/src/main/java/com/quick/jsbridge/view/QuickWebLoader.java:
--------------------------------------------------------------------------------
1 | package com.quick.jsbridge.view;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 |
6 | import android.os.Bundle;
7 |
8 | import com.quick.core.baseapp.baseactivity.FrmBaseActivity;
9 | import com.quick.jsbridge.bean.QuickBean;
10 | import com.quick.jsbridge.control.AutoCallbackDefined;
11 | import com.quick.jsbridge.control.WebloaderControl;
12 |
13 |
14 | import quick.com.jsbridge.R;
15 |
16 |
17 | /**
18 | * Created by dailichun on 2017/12/7.
19 | * 如果需要自定义quick容器请继承QuickWebLoader,在布局文件中必须定义QuickFragment的容器FrameLayout控件
20 | */
21 | public class QuickWebLoader extends FrmBaseActivity {
22 |
23 | public QuickFragment fragment;
24 |
25 | public QuickBean bean;
26 |
27 |
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | //隐藏Activity的导航栏
32 | pageControl.getNbBar().hide();
33 |
34 | initQuickBean(savedInstanceState);
35 |
36 | setLayout(R.layout.quick_activity);
37 |
38 | addFragment(R.id.frgContent);
39 |
40 | }
41 |
42 | /**
43 | * 初始化页面参数
44 | *
45 | * @param savedInstanceState
46 | */
47 | public void initQuickBean(Bundle savedInstanceState) {
48 | if (null != savedInstanceState && savedInstanceState.containsKey("bean")) {
49 | bean = (QuickBean) savedInstanceState.getSerializable("bean");
50 | } else if (getIntent().hasExtra("bean")) {
51 | bean = (QuickBean) getIntent().getSerializableExtra("bean");
52 | }
53 |
54 | if (bean == null) {
55 | toast(getString(R.string.status_data_error));
56 | finish();
57 | return;
58 | }
59 | }
60 |
61 | /**
62 | * 添加QuickFragment容器
63 | *
64 | * @param containerViewId FrameLayout的视图id
65 | */
66 | public void addFragment(int containerViewId) {
67 | //初始化页面
68 | fragment = QuickFragment.newInstance(bean);
69 | getFragmentManager().beginTransaction().add(containerViewId, fragment).commit();
70 | }
71 |
72 |
73 | @Override
74 | protected void onDestroy() {
75 | super.onDestroy();
76 |
77 | }
78 |
79 | @Override
80 | protected void onSaveInstanceState(Bundle outState) {
81 | if (bean != null) {
82 | outState.putSerializable("bean", bean);
83 | }
84 | super.onSaveInstanceState(outState);
85 | }
86 |
87 | @Override
88 | protected void onRestoreInstanceState(Bundle savedInstanceState) {
89 | super.onRestoreInstanceState(savedInstanceState);
90 | if (savedInstanceState.containsKey("bean")) {
91 | bean = (QuickBean) savedInstanceState.getSerializable("bean");
92 | }
93 | }
94 |
95 | @Override
96 | public void onBackPressed() {
97 | WebloaderControl control = fragment.getWebloaderControl();
98 | if (control != null) {
99 | if (control.autoCallbackEvent.isRegist(AutoCallbackDefined.OnClickBack)) {
100 | control.autoCallbackEvent.onClickBack();
101 | } else {
102 | control.loadLastPage(false);
103 | }
104 | } else {
105 | super.onNbBack();
106 | }
107 | }
108 |
109 |
110 | public static void go(Context context, QuickBean bean) {
111 | Intent intent = new Intent(context, QuickWebLoader.class);
112 | intent.putExtra("bean", bean);
113 | context.startActivity(intent);
114 | }
115 |
116 | public static void go(Context context, String url) {
117 | go(context, new QuickBean(url));
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/jsbridge/src/main/java/com/quick/jsbridge/view/webview/IActivityResult.java:
--------------------------------------------------------------------------------
1 | package com.quick.jsbridge.view.webview;
2 |
3 | import android.content.Intent;
4 |
5 | /**
6 | * Created by dailichun on 2017/12/6.
7 | * quick容器onActivityResult回调接口
8 | */
9 | public interface IActivityResult {
10 |
11 | /**
12 | * 参数与onActivityResult一致
13 | * @param requestCode 请求code
14 | * @param resultCode 返回code
15 | * @param data 回传数据
16 | */
17 | void onResult(int requestCode, int resultCode, Intent data);
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/jsbridge/src/main/java/com/quick/jsbridge/view/webview/IFileChooser.java:
--------------------------------------------------------------------------------
1 | package com.quick.jsbridge.view.webview;
2 |
3 | import android.content.Intent;
4 | import android.net.Uri;
5 | import android.webkit.ValueCallback;
6 | import android.webkit.WebChromeClient;
7 | import android.webkit.WebView;
8 |
9 | /**
10 | * Created by dailichun on 2017/12/6.
11 | * h5中input=file控件选择文件接口
12 | */
13 | public interface IFileChooser {
14 |
15 | void showFileChooser(ValueCallback uploadMsg, String acceptType);
16 |
17 | void showFileChooser(ValueCallback uploadMsg, String acceptType, String capture);
18 |
19 | void showFileChooser(WebView webView, ValueCallback filePathCallback, WebChromeClient.FileChooserParams fileChooserParams);
20 |
21 | /**
22 | * 文件选择后的回调
23 | *
24 | * @param requestCode
25 | * @param resultCode
26 | * @param data
27 | */
28 | void onChooseFileResult(int requestCode, int resultCode, Intent data);
29 | }
30 |
--------------------------------------------------------------------------------
/jsbridge/src/main/java/com/quick/jsbridge/view/webview/ILoadPage.java:
--------------------------------------------------------------------------------
1 | package com.quick.jsbridge.view.webview;
2 |
3 | import android.graphics.Bitmap;
4 | import android.net.http.SslError;
5 | import android.webkit.SslErrorHandler;
6 | import android.webkit.WebResourceResponse;
7 | import android.webkit.WebView;
8 |
9 | import com.quick.jsbridge.view.IQuickFragment;
10 |
11 | import java.util.List;
12 |
13 |
14 | /**
15 | * Created by dailichun on 2017/12/6.
16 | * webview加载页面生命周期接口
17 | */
18 | public interface ILoadPage {
19 |
20 | /**
21 | * 获取fragment容器对象
22 | *
23 | * @return
24 | */
25 | IQuickFragment getFragment();
26 |
27 | /**
28 | * 获取选择文件的实现对象
29 | *
30 | * @return
31 | */
32 | IFileChooser getFileChooser();
33 |
34 | /**
35 | * 是否加载图片
36 | *
37 | * @param url
38 | * @return
39 | */
40 | boolean isLoadImage(String url);
41 |
42 | /**
43 | * 加载资源
44 | *
45 | * @param url
46 | * @return
47 | */
48 | WebResourceResponse shouldInterceptRequest(WebView view, String url);
49 |
50 | /**
51 | * 重定向或者跳转连接
52 | *
53 | * @param view
54 | * @param url
55 | * @return
56 | */
57 | void forwardUrl(WebView view, String url);
58 |
59 | /**
60 | * 页面加载完毕
61 | *
62 | * @param view
63 | * @param url
64 | */
65 | void onPageFinished(WebView view, String url);
66 |
67 | /**
68 | * 页面开始加载
69 | *
70 | * @param view
71 | * @param url
72 | * @param favicon
73 | */
74 | void onPageStarted(WebView view, String url, Bitmap favicon);
75 |
76 | /**
77 | * 获取标题
78 | *
79 | * @param url
80 | * @param title
81 | */
82 | void onReceivedTitle(String url, String title);
83 |
84 | /**
85 | * 加载进度
86 | *
87 | * @param view
88 | * @param newProgress
89 | */
90 | void onProgressChanged(WebView view, int newProgress);
91 |
92 | /**
93 | * 页面加载异常
94 | *
95 | * @param view
96 | * @param url
97 | * @param errorCode
98 | * @param errorDescription
99 | */
100 | void onReceivedError(WebView view, String url, int errorCode, String errorDescription);
101 |
102 | /**
103 | * 证书加载异常
104 | *
105 | * @param view
106 | * @param handler
107 | * @param error
108 | */
109 | void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error);
110 |
111 | /**
112 | * 获取历史记录
113 | *
114 | * @return
115 | */
116 | List getHistoryUrl();
117 |
118 | /**
119 | * 返回是否已初始化配置
120 | */
121 | boolean hasConfig();
122 |
123 | /**
124 | * 设置是否已初始化配置
125 | */
126 | void setHasConfig(boolean isConfig);
127 | }
128 |
--------------------------------------------------------------------------------
/jsbridge/src/main/java/com/quick/jsbridge/view/webview/IWebviewScrollChanged.java:
--------------------------------------------------------------------------------
1 | package com.quick.jsbridge.view.webview;
2 |
3 | /**
4 | * Created by dailichun on 2017/12/6.
5 | * webview滚动监听接口
6 | */
7 | public interface IWebviewScrollChanged {
8 |
9 | void onScroll(final int l, final int t, final int oldl,
10 | final int oldt);
11 | }
12 |
--------------------------------------------------------------------------------
/jsbridge/src/main/java/com/quick/jsbridge/view/webview/QuickWebChromeClient.java:
--------------------------------------------------------------------------------
1 | package com.quick.jsbridge.view.webview;
2 |
3 | import android.net.Uri;
4 | import android.os.Build;
5 | import android.support.annotation.RequiresApi;
6 | import android.webkit.GeolocationPermissions;
7 | import android.webkit.JsPromptResult;
8 | import android.webkit.ValueCallback;
9 | import android.webkit.WebChromeClient;
10 | import android.webkit.WebView;
11 |
12 | import com.quick.jsbridge.bridge.JSBridge;
13 |
14 | /**
15 | * Created by dailichun on 2017/12/6.
16 | * 自定义WebChromeClient, 处理H5的file控件以及接收QUICK协议等
17 | */
18 |
19 | public class QuickWebChromeClient extends WebChromeClient {
20 | private ILoadPage loadPage;
21 |
22 | public QuickWebChromeClient(ILoadPage loadPage) {
23 | this.loadPage = loadPage;
24 | }
25 |
26 | /**
27 | * Android 3.0+适用
28 | *
29 | * @param uploadMsg
30 | * @param acceptType
31 | */
32 | public void openFileChooser(ValueCallback uploadMsg, String acceptType) {
33 | loadPage.getFileChooser().showFileChooser(uploadMsg, acceptType);
34 | }
35 |
36 | /**
37 | * Android 4.1+适用
38 | *
39 | * @param uploadMsg
40 | * @param acceptType
41 | * @param capture
42 | */
43 | public void openFileChooser(ValueCallback uploadMsg, String acceptType, String capture) {
44 | loadPage.getFileChooser().showFileChooser(uploadMsg, acceptType, capture);
45 | }
46 |
47 | /**
48 | * Android 5.0+适用
49 | *
50 | * @param webView
51 | * @param filePathCallback
52 | * @param fileChooserParams
53 | * @return
54 | */
55 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
56 | @Override
57 | public boolean onShowFileChooser(WebView webView, ValueCallback filePathCallback, FileChooserParams fileChooserParams) {
58 | loadPage.getFileChooser().showFileChooser(webView, filePathCallback, fileChooserParams);
59 | return true;
60 | }
61 |
62 | /**
63 | * 监听页面加载进度条
64 | *
65 | * @param view
66 | * @param newProgress
67 | */
68 | @Override
69 | public void onProgressChanged(WebView view, int newProgress) {
70 | super.onProgressChanged(view, newProgress);
71 | loadPage.onProgressChanged(view, newProgress);
72 | }
73 |
74 | /**
75 | * 请求定位
76 | *
77 | * @param origin
78 | * @param callback
79 | */
80 | @Override
81 | public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
82 | callback.invoke(origin, true, false);
83 | super.onGeolocationPermissionsShowPrompt(origin, callback);
84 | }
85 |
86 | @Override
87 | public void onReceivedTitle(WebView view, String title) {
88 | super.onReceivedTitle(view, title);
89 | loadPage.onReceivedTitle(view.getUrl(),title);
90 | }
91 |
92 | /**
93 | * JSBridge协议入口
94 | *
95 | * @param view
96 | * @param url
97 | * @param message
98 | * @param defaultValue
99 | * @param result
100 | * @return
101 | */
102 | @Override
103 | public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
104 | result.confirm(JSBridge.callJava(loadPage.getFragment(), message,loadPage.hasConfig()));
105 | return true;
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/jsbridge/src/main/java/com/quick/jsbridge/view/webview/QuickWebView.java:
--------------------------------------------------------------------------------
1 | package com.quick.jsbridge.view.webview;
2 |
3 | import android.content.Context;
4 | import android.os.Build;
5 | import android.util.AttributeSet;
6 | import android.webkit.CookieManager;
7 | import android.webkit.WebSettings;
8 | import android.webkit.WebView;
9 | import android.widget.ProgressBar;
10 |
11 | import quick.com.jsbridge.BuildConfig;
12 |
13 | /**
14 | * Created by dailichun on 2017/12/6.
15 | * 自定义webview
16 | */
17 |
18 | public class QuickWebView extends WebView {
19 | public ProgressBar progressbar;
20 |
21 | private IWebviewScrollChanged mOnScrollChangedCallback;
22 |
23 | public QuickWebView(Context context) {
24 | super(context);
25 | settingWebView();
26 | }
27 |
28 | public QuickWebView(Context context, AttributeSet attrs) {
29 | super(context, attrs);
30 | settingWebView();
31 | }
32 |
33 | public QuickWebView(Context context, AttributeSet attrs, int defStyleAttr) {
34 | super(context, attrs, defStyleAttr);
35 | settingWebView();
36 | }
37 |
38 | /**
39 | * 是否存在滚动条
40 | *
41 | * @return
42 | */
43 | public boolean existVerticalScrollbar() {
44 | return computeVerticalScrollRange() > computeVerticalScrollExtent();
45 | }
46 |
47 | @Override
48 | protected void onScrollChanged(final int l, final int t, final int oldl,
49 | final int oldt) {
50 | super.onScrollChanged(l, t, oldl, oldt);
51 |
52 | if (mOnScrollChangedCallback != null) {
53 | mOnScrollChangedCallback.onScroll(l, t, oldl, oldt);
54 | }
55 | }
56 |
57 | /**
58 | * 获取滚动条监听事件
59 | *
60 | * @return
61 | */
62 | public IWebviewScrollChanged getOnScrollChangedCallback() {
63 | return mOnScrollChangedCallback;
64 | }
65 |
66 | /**
67 | * 设置滚动监听
68 | */
69 | public void setOnScrollChangedCallback(
70 | final IWebviewScrollChanged onScrollChangedCallback) {
71 | mOnScrollChangedCallback = onScrollChangedCallback;
72 | }
73 |
74 |
75 | /**
76 | * 初始化设置
77 | */
78 | public void settingWebView() {
79 | WebSettings settings = getSettings();
80 | String ua = settings.getUserAgentString();
81 | // 设置浏览器UA,JS端通过UA判断是否属于Quick环境
82 | settings.setUserAgentString(ua + " QuickHybridJs/" + BuildConfig.VERSION_NAME);
83 | // 设置支持JS
84 | settings.setJavaScriptEnabled(true);
85 | // 设置是否支持meta标签来控制缩放
86 | settings.setUseWideViewPort(true);
87 | // 缩放至屏幕的大小
88 | settings.setLoadWithOverviewMode(true);
89 | // 设置内置的缩放控件(若SupportZoom为false,该设置项无效)
90 | settings.setBuiltInZoomControls(true);
91 | // 设置缓存模式
92 | // LOAD_DEFAULT 根据HTTP协议header中设置的cache-control属性来执行加载策略
93 | // LOAD_CACHE_ELSE_NETWORK 只要本地有无论是否过期都从本地获取
94 | settings.setCacheMode(WebSettings.LOAD_DEFAULT);
95 | settings.setDomStorageEnabled(true);
96 | // 设置AppCache 需要H5页面配置manifest文件(官方已不推介使用)
97 | String appCachePath = getContext().getCacheDir().getAbsolutePath();
98 | settings.setAppCachePath(appCachePath);
99 | settings.setAppCacheEnabled(true);
100 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
101 | // 强制开启android webview debug模式使用Chrome inspect(https://developers.google.com/web/tools/chrome-devtools/remote-debugging/)
102 | WebView.setWebContentsDebuggingEnabled(true);
103 | }
104 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
105 | CookieManager.getInstance().setAcceptThirdPartyCookies(this, true);
106 | }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/jsbridge/src/main/res/drawable/quick_progress_bar_states.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
10 |
11 |
12 | -
13 |
14 |
15 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/jsbridge/src/main/res/layout/quick_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
--------------------------------------------------------------------------------
/jsbridge/src/main/res/layout/quick_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
12 |
16 |
17 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/jsbridge/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | jsbridge
3 |
4 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':jsbridge', ':core'
2 |
--------------------------------------------------------------------------------