Commit 969a9636d69862541cf345ee95fda9d16bcb6252
0 parents
提出用户模块
Showing
76 changed files
with
4652 additions
and
0 deletions
Too many changes to show.
To preserve performance only 76 of 308 files are displayed.
.gitignore
0 → 100644
.idea/codeStyles/Project.xml
0 → 100644
| 1 | +++ a/.idea/codeStyles/Project.xml | |
| 1 | +<component name="ProjectCodeStyleConfiguration"> | |
| 2 | + <code_scheme name="Project" version="173"> | |
| 3 | + <codeStyleSettings language="XML"> | |
| 4 | + <indentOptions> | |
| 5 | + <option name="CONTINUATION_INDENT_SIZE" value="4" /> | |
| 6 | + </indentOptions> | |
| 7 | + <arrangement> | |
| 8 | + <rules> | |
| 9 | + <section> | |
| 10 | + <rule> | |
| 11 | + <match> | |
| 12 | + <AND> | |
| 13 | + <NAME>xmlns:android</NAME> | |
| 14 | + <XML_ATTRIBUTE /> | |
| 15 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | |
| 16 | + </AND> | |
| 17 | + </match> | |
| 18 | + </rule> | |
| 19 | + </section> | |
| 20 | + <section> | |
| 21 | + <rule> | |
| 22 | + <match> | |
| 23 | + <AND> | |
| 24 | + <NAME>xmlns:.*</NAME> | |
| 25 | + <XML_ATTRIBUTE /> | |
| 26 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | |
| 27 | + </AND> | |
| 28 | + </match> | |
| 29 | + <order>BY_NAME</order> | |
| 30 | + </rule> | |
| 31 | + </section> | |
| 32 | + <section> | |
| 33 | + <rule> | |
| 34 | + <match> | |
| 35 | + <AND> | |
| 36 | + <NAME>.*:id</NAME> | |
| 37 | + <XML_ATTRIBUTE /> | |
| 38 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | |
| 39 | + </AND> | |
| 40 | + </match> | |
| 41 | + </rule> | |
| 42 | + </section> | |
| 43 | + <section> | |
| 44 | + <rule> | |
| 45 | + <match> | |
| 46 | + <AND> | |
| 47 | + <NAME>.*:name</NAME> | |
| 48 | + <XML_ATTRIBUTE /> | |
| 49 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | |
| 50 | + </AND> | |
| 51 | + </match> | |
| 52 | + </rule> | |
| 53 | + </section> | |
| 54 | + <section> | |
| 55 | + <rule> | |
| 56 | + <match> | |
| 57 | + <AND> | |
| 58 | + <NAME>name</NAME> | |
| 59 | + <XML_ATTRIBUTE /> | |
| 60 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | |
| 61 | + </AND> | |
| 62 | + </match> | |
| 63 | + </rule> | |
| 64 | + </section> | |
| 65 | + <section> | |
| 66 | + <rule> | |
| 67 | + <match> | |
| 68 | + <AND> | |
| 69 | + <NAME>style</NAME> | |
| 70 | + <XML_ATTRIBUTE /> | |
| 71 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | |
| 72 | + </AND> | |
| 73 | + </match> | |
| 74 | + </rule> | |
| 75 | + </section> | |
| 76 | + <section> | |
| 77 | + <rule> | |
| 78 | + <match> | |
| 79 | + <AND> | |
| 80 | + <NAME>.*</NAME> | |
| 81 | + <XML_ATTRIBUTE /> | |
| 82 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | |
| 83 | + </AND> | |
| 84 | + </match> | |
| 85 | + <order>BY_NAME</order> | |
| 86 | + </rule> | |
| 87 | + </section> | |
| 88 | + <section> | |
| 89 | + <rule> | |
| 90 | + <match> | |
| 91 | + <AND> | |
| 92 | + <NAME>.*</NAME> | |
| 93 | + <XML_ATTRIBUTE /> | |
| 94 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | |
| 95 | + </AND> | |
| 96 | + </match> | |
| 97 | + <order>ANDROID_ATTRIBUTE_ORDER</order> | |
| 98 | + </rule> | |
| 99 | + </section> | |
| 100 | + <section> | |
| 101 | + <rule> | |
| 102 | + <match> | |
| 103 | + <AND> | |
| 104 | + <NAME>.*</NAME> | |
| 105 | + <XML_ATTRIBUTE /> | |
| 106 | + <XML_NAMESPACE>.*</XML_NAMESPACE> | |
| 107 | + </AND> | |
| 108 | + </match> | |
| 109 | + <order>BY_NAME</order> | |
| 110 | + </rule> | |
| 111 | + </section> | |
| 112 | + </rules> | |
| 113 | + </arrangement> | |
| 114 | + </codeStyleSettings> | |
| 115 | + </code_scheme> | |
| 116 | +</component> | |
| 0 | 117 | \ No newline at end of file | ... | ... |
.idea/gradle.xml
0 → 100644
| 1 | +++ a/.idea/gradle.xml | |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project version="4"> | |
| 3 | + <component name="GradleSettings"> | |
| 4 | + <option name="linkedExternalProjectsSettings"> | |
| 5 | + <GradleProjectSettings> | |
| 6 | + <compositeConfiguration> | |
| 7 | + <compositeBuild compositeDefinitionSource="SCRIPT" /> | |
| 8 | + </compositeConfiguration> | |
| 9 | + <option name="distributionType" value="DEFAULT_WRAPPED" /> | |
| 10 | + <option name="externalProjectPath" value="$PROJECT_DIR$" /> | |
| 11 | + <option name="resolveModulePerSourceSet" value="false" /> | |
| 12 | + <option name="testRunner" value="PLATFORM" /> | |
| 13 | + </GradleProjectSettings> | |
| 14 | + </option> | |
| 15 | + </component> | |
| 16 | +</project> | |
| 0 | 17 | \ No newline at end of file | ... | ... |
.idea/misc.xml
0 → 100644
| 1 | +++ a/.idea/misc.xml | |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project version="4"> | |
| 3 | + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
| 4 | + <output url="file://$PROJECT_DIR$/build/classes" /> | |
| 5 | + </component> | |
| 6 | + <component name="ProjectType"> | |
| 7 | + <option name="id" value="Android" /> | |
| 8 | + </component> | |
| 9 | +</project> | |
| 0 | 10 | \ No newline at end of file | ... | ... |
.idea/runConfigurations.xml
0 → 100644
| 1 | +++ a/.idea/runConfigurations.xml | |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project version="4"> | |
| 3 | + <component name="RunConfigurationProducerService"> | |
| 4 | + <option name="ignoredProducers"> | |
| 5 | + <set> | |
| 6 | + <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" /> | |
| 7 | + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" /> | |
| 8 | + <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" /> | |
| 9 | + </set> | |
| 10 | + </option> | |
| 11 | + </component> | |
| 12 | +</project> | |
| 0 | 13 | \ No newline at end of file | ... | ... |
app/.gitignore
0 → 100644
app/build.gradle
0 → 100644
| 1 | +++ a/app/build.gradle | |
| 1 | +apply plugin: 'com.android.application' | |
| 2 | +apply plugin: 'com.alibaba.arouter' | |
| 3 | + | |
| 4 | +static def stringValue(def value) { | |
| 5 | + return "\"${value}\"" | |
| 6 | +} | |
| 7 | +//自定义资源 resValue("bool", "debug", "true") | |
| 8 | +//自定义BuildConfig buildConfigField("String", "BASE_URL", stringValue("http://120.92.201.43:8090/")) | |
| 9 | +//自定义Manifest manifestPlaceholders = [BaiduMobAd_CHANNEL: "meizu", xxx: "xx"] | |
| 10 | + | |
| 11 | +def ACTION_SHARE_SEND = "netpp.intent.action.SHARE_SEND" | |
| 12 | +def ACTION_SHARE_RELEASE = "netpp.intent.action.SHARE_RELEASE" | |
| 13 | +def ACTION_EYEWITNESS_ACTIVITY = "cnlive.intent.action.eyewitness.activity" | |
| 14 | +def ACTION_HTML_IMG_PREVIEW = "com.cnlive.strike.moudle.preview.ui.DataProcessingActivity" | |
| 15 | +def ACTION_HTML_PAY_ICE = "com.cnlive.strike.moudle.user.ui.activity.PayActivity" | |
| 16 | +android { | |
| 17 | + compileSdkVersion rootProject.ext.compileSdkVersion | |
| 18 | + buildToolsVersion rootProject.ext.buildToolsVersion | |
| 19 | + defaultConfig { | |
| 20 | + applicationId "com.cnlive.strike" | |
| 21 | + minSdkVersion 19 | |
| 22 | + targetSdkVersion 27 | |
| 23 | + versionCode 1 | |
| 24 | + versionName "1.0" | |
| 25 | + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |
| 26 | + multiDexEnabled true | |
| 27 | + | |
| 28 | + javaCompileOptions { | |
| 29 | + annotationProcessorOptions { | |
| 30 | + arguments = [AROUTER_MODULE_NAME: project.getName(), AROUTER_GENERATE_DOC: "enable"] | |
| 31 | + } | |
| 32 | + } | |
| 33 | + } | |
| 34 | + | |
| 35 | + signingConfigs { | |
| 36 | + debugConfig { | |
| 37 | + storeFile file("www.cnlive.com.key") | |
| 38 | + storePassword "www.cnlive.comPassw0rd" | |
| 39 | + keyAlias "strike-debug" | |
| 40 | + keyPassword "www.cnlive.com" | |
| 41 | + } | |
| 42 | + releaseConfig { | |
| 43 | + storeFile file("www.cnlive.com.key") | |
| 44 | + storePassword "www.cnlive.comPassw0rd" | |
| 45 | + keyAlias "strike" | |
| 46 | + keyPassword "www.cnlive.com" | |
| 47 | + } | |
| 48 | + } | |
| 49 | + | |
| 50 | + buildTypes { | |
| 51 | + debug { | |
| 52 | + signingConfig signingConfigs.debugConfig | |
| 53 | + resValue("string", "app_name", "网++ 内测") | |
| 54 | + resValue("string", "ACCOUNT_LABEL", "网家家 内测") | |
| 55 | + resValue("string", "ACCOUNT_TYPE", "com.cnlive.strike.debug.AccountType") | |
| 56 | + resValue("string", "ACCOUNT_PROVIDE", "com.cnlive.strike.debug.AccountProvide") | |
| 57 | + | |
| 58 | + buildConfigField("String", "QQ_SHARE", stringValue("1106866745")) | |
| 59 | + buildConfigField("String", "WECHAT_SHARE", stringValue("wx9b7f9443a8ccf15a")) | |
| 60 | + buildConfigField("String", "WECHAT_KEY", stringValue("8d9970bf2901411d8dd2bffb344f147e")) | |
| 61 | + buildConfigField("String", "SEND_AUTH_REQ_STATE", stringValue("com_cnlive_strike_debug")) | |
| 62 | + | |
| 63 | + zipAlignEnabled true | |
| 64 | + applicationIdSuffix ".debug" | |
| 65 | + resValue("string", "app_name", "网家家 内测") | |
| 66 | + buildConfigField("boolean", "VERSION_AS_DEBUG", "true") | |
| 67 | + buildConfigField("String", "APP_ID", stringValue("802_jhbqccxw08")) | |
| 68 | + buildConfigField("String", "APP_KEY", stringValue("9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f")) | |
| 69 | + buildConfigField("String", "APP_SCERET", stringValue("1e6380cb347255e777f72b5aa60f41daa68443a132aaea")) | |
| 70 | + buildConfigField("String", "SHARE_APP_KEY", stringValue("26192e9007048")) | |
| 71 | + buildConfigField("String", "SHARE_APP_SCERET", stringValue("BNK5YVWfIBLir6WFaXTCNQLSFGTRs+Hnz5EkIfngJmOPLFBlUwmAbw==")) | |
| 72 | + buildConfigField("String", "PAY_ACCOUNT", stringValue("wjj_app_test")) | |
| 73 | + buildConfigField("String", "H5_CNLIVE", stringValue("http://wjjh5test.cnlive.com/cnnews.html")) | |
| 74 | + buildConfigField("String", "H5_DP", stringValue("http://wjjh5test.cnlive.com/cndr.html")) | |
| 75 | + buildConfigField("String", "APP_WEB_START_HOST", stringValue("wjjh5test.cnlive.com")) | |
| 76 | + buildConfigField("int", "SPECIAL_GROUP_MEMBER_LIMIT", "3") | |
| 77 | + buildConfigField("String", "TINGYUN_KEY", stringValue("631d38c6c09247debaab5389e5387b9a")) | |
| 78 | + buildConfigField("String", "BAIDU_APP_ID", stringValue("14380872")) | |
| 79 | + buildConfigField("String", "BAIDU_APP_KEY", stringValue("ibl8vbKkPVYBw5IOvR8tVGGo")) | |
| 80 | + buildConfigField("String", "BAIDU_APP_SECRET", stringValue("QEd6n1qruIGG8AYkyLyqepksO2uUe0GK")) | |
| 81 | + buildConfigField("String", "WECHAT_APPID", stringValue("wx9b7f9443a8ccf15a")) | |
| 82 | + buildConfigField("String", "SHARE_TITLE", stringValue("快来加入中国网家家,优享美好生活!")) | |
| 83 | + buildConfigField("String", "SHARE_SUBTITLE", stringValue("中国网家家 让生活更美好!")) | |
| 84 | + buildConfigField("String", "SHARE_DOWNLOAD", stringValue("https://fir.im/d35h")) | |
| 85 | + buildConfigField("String", "SHARE_ICON", stringValue("http://wjjh5test.cnlive.com/static/logo.png")) | |
| 86 | + buildConfigField("String", "HTML_SUBSCRIBE", stringValue(" http://wjjh5test.cnlive.com/cnSubscription.html")) | |
| 87 | + buildConfigField("String", "REPORT_URL", stringValue("http://wjjh5test.cnlive.com/cnReport.html?")) | |
| 88 | + buildConfigField("String", "BAIDU_MAP_APP_KEY", stringValue("2IIsTtvX2FA88yvDrPZedc2ZvMhxyDbN")) | |
| 89 | + buildConfigField("String", "SHOP_PATH", stringValue("wjjshop.cnlive.com")) | |
| 90 | + buildConfigField("String", "UMENG_APPKEY", stringValue("5d6482a30cafb21b6b000d14")) | |
| 91 | + | |
| 92 | + resValue("string", "outshare", "网家家好友Debug") | |
| 93 | + resValue("string", "outsharecircle", "网家家生活圈Debug") | |
| 94 | + | |
| 95 | + buildConfigField("String", "APP_SPLASH_VERSION", stringValue("5")) | |
| 96 | + | |
| 97 | + manifestPlaceholders = [ | |
| 98 | + QQ_APPKEY : "tencent1106866745", | |
| 99 | + TINGYUN_SCHEME : "tingyun.33201", | |
| 100 | + APP_START_HOST : "wjjh5test.cnlive.com", | |
| 101 | + MAP_APPKEY : "2298a0e307e69fab64c02d7d0412fd73", | |
| 102 | + BAIDU_APP_ID : "14380872", | |
| 103 | + BAIDU_APP_KEY : "ibl8vbKkPVYBw5IOvR8tVGGo", | |
| 104 | + BAIDU_MAP_APP_KEY: "2IIsTtvX2FA88yvDrPZedc2ZvMhxyDbN", | |
| 105 | + BAIDU_APP_SECRET : "QEd6n1qruIGG8AYkyLyqepksO2uUe0GK", | |
| 106 | + UMENG_APPKEY : "5d6482a30cafb21b6b000d14", | |
| 107 | + OPENINSTALL_KEY : "gzqtwt" | |
| 108 | + ] | |
| 109 | + } | |
| 110 | + release { | |
| 111 | + signingConfig signingConfigs.releaseConfig | |
| 112 | + | |
| 113 | + minifyEnabled false | |
| 114 | + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |
| 115 | + | |
| 116 | + resValue("string", "ACCOUNT_LABEL", "网家家") | |
| 117 | + resValue("string", "ACCOUNT_TYPE", "com.cnlive.strike.AccountType") | |
| 118 | + resValue("string", "ACCOUNT_PROVIDE", "com.cnlive.strike.AccountProvide") | |
| 119 | + | |
| 120 | + buildConfigField("String", "QQ_SHARE", stringValue("1106691520")) | |
| 121 | + buildConfigField("String", "WECHAT_SHARE", stringValue("wxed528fc749b7ee88")) | |
| 122 | + buildConfigField("String", "WECHAT_KEY", stringValue("729c3d3055fe336bcdef7020c2548e89")) | |
| 123 | + buildConfigField("String", "SEND_AUTH_REQ_STATE", stringValue("com_cnlive_strike")) | |
| 124 | + | |
| 125 | + zipAlignEnabled true | |
| 126 | + resValue("string", "app_name", "网家家") | |
| 127 | + buildConfigField("boolean", "VERSION_AS_DEBUG", "false") | |
| 128 | + buildConfigField("String", "APP_ID", stringValue("769_jetj7bq525")) | |
| 129 | + buildConfigField("String", "APP_KEY", stringValue("0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d")) | |
| 130 | + buildConfigField("String", "APP_SCERET", stringValue("275e8dc29274a1186d82f65bc607c231d02bcb3bfd8976")) | |
| 131 | + buildConfigField("String", "SHARE_APP_KEY", stringValue("24e4abeaa92d8")) | |
| 132 | + buildConfigField("String", "SHARE_APP_SCERET", stringValue("FFtu2hsTjCHaZobVP4xNJNoQi1AqS9o8bdYYiv/3SXJTDva0l0arSw==")) | |
| 133 | + buildConfigField("String", "PAY_ACCOUNT", stringValue("wjj_app")) | |
| 134 | + buildConfigField("String", "H5_CNLIVE", stringValue("http://wjjh5.cnlive.com/index.html")) | |
| 135 | + buildConfigField("String", "H5_DP", stringValue("http://wjjh5.cnlive.com/number.html")) | |
| 136 | + buildConfigField("String", "APP_WEB_START_HOST", stringValue("wjjh5.cnlive.com")) | |
| 137 | + buildConfigField("int", "SPECIAL_GROUP_MEMBER_LIMIT", "10") | |
| 138 | + buildConfigField("String", "TINGYUN_KEY", stringValue("4069112acd1c429693e6f9bf70eba939")) | |
| 139 | + buildConfigField("String", "BAIDU_APP_ID", stringValue("14380860")) | |
| 140 | + buildConfigField("String", "BAIDU_APP_KEY", stringValue("4bX1eK7SiCL461QBnRKilowc")) | |
| 141 | + buildConfigField("String", "BAIDU_APP_SECRET", stringValue("BTzXLoPbUjlLeOM1nHnfOuTB9q18YZVq")) | |
| 142 | + buildConfigField("String", "WECHAT_APPID", stringValue("wxed528fc749b7ee88")) | |
| 143 | + buildConfigField("String", "SHARE_TITLE", stringValue("快来加入中国网家家,优享美好生活!")) | |
| 144 | + buildConfigField("String", "SHARE_SUBTITLE", stringValue("中国网家家 让生活更美好!")) | |
| 145 | + buildConfigField("String", "SHARE_DOWNLOAD", stringValue("http://apiwjj.cnlive.com/download/index.html")) | |
| 146 | + buildConfigField("String", "SHARE_ICON", stringValue("http://wjjh5.cnlive.com/static/logo.png")) | |
| 147 | + buildConfigField("String", "HTML_SUBSCRIBE", stringValue(" http://wjjh5.cnlive.com/cnSubscription.html")) | |
| 148 | + buildConfigField("String", "REPORT_URL", stringValue("http://wjjh5.cnlive.com/cnReport.html?")) | |
| 149 | + buildConfigField("String", "BAIDU_MAP_APP_KEY", stringValue("Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2")) | |
| 150 | + buildConfigField("String", "SHOP_PATH", stringValue("managemall.cnlive.com")) | |
| 151 | + buildConfigField("String", "UMENG_APPKEY", stringValue("5d647f890cafb21b6b000aee")) | |
| 152 | + | |
| 153 | + resValue("string", "outshare", "网家家好友") | |
| 154 | + resValue("string", "outsharecircle", "网家家生活圈") | |
| 155 | + | |
| 156 | + buildConfigField("String", "APP_SPLASH_VERSION", stringValue("5")) | |
| 157 | + | |
| 158 | + manifestPlaceholders = [ | |
| 159 | + QQ_APPKEY : "tencent1106691520", | |
| 160 | + TINGYUN_SCHEME : "tingyun.33867", | |
| 161 | + APP_START_HOST : "wjjh5.cnlive.com", | |
| 162 | + MAP_APPKEY : "4b9aa4122d1d6f4d6beb6cb7701f2873", | |
| 163 | + BAIDU_APP_ID : "14380860", | |
| 164 | + BAIDU_APP_KEY : "4bX1eK7SiCL461QBnRKilowc", | |
| 165 | + BAIDU_MAP_APP_KEY: "Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2", | |
| 166 | + BAIDU_APP_SECRET : "BTzXLoPbUjlLeOM1nHnfOuTB9q18YZVq", | |
| 167 | + UMENG_APPKEY : "5d647f890cafb21b6b000aee", | |
| 168 | + OPENINSTALL_KEY : "vfkj9x" | |
| 169 | + ] | |
| 170 | + } | |
| 171 | + | |
| 172 | + | |
| 173 | + } | |
| 174 | + | |
| 175 | + compileOptions { | |
| 176 | + sourceCompatibility JavaVersion.VERSION_1_8 | |
| 177 | + targetCompatibility JavaVersion.VERSION_1_8 | |
| 178 | + } | |
| 179 | + dataBinding { | |
| 180 | + enabled true | |
| 181 | + } | |
| 182 | + dexOptions { | |
| 183 | + javaMaxHeapSize '4g' | |
| 184 | + } | |
| 185 | + compileOptions { | |
| 186 | + sourceCompatibility 1.8 | |
| 187 | + targetCompatibility 1.8 | |
| 188 | + } | |
| 189 | +} | |
| 190 | + | |
| 191 | +dependencies { | |
| 192 | + implementation fileTree(dir: 'libs', include: ['*.jar']) | |
| 193 | + implementation "com.android.support:support-v4:$rootProject.supportV4" | |
| 194 | + implementation "com.android.support:appcompat-v7:$rootProject.appcompatV7" | |
| 195 | + implementation "com.android.support:design:$rootProject.design" | |
| 196 | + implementation "com.android.support:support-v13:$rootProject.supportV13" | |
| 197 | + implementation "com.android.support:recyclerview-v7:$rootProject.recyclerviewV7" | |
| 198 | + testImplementation 'junit:junit:4.12' | |
| 199 | + //ARouter | |
| 200 | + implementation "com.alibaba:arouter-api:$rootProject.arouterApiVersion" | |
| 201 | + annotationProcessor "com.alibaba:arouter-compiler:$rootProject.arouterCompilerVersion" | |
| 202 | + | |
| 203 | + api "com.cnlive.libs:network:$rootProject.libNetwork" | |
| 204 | + //CNLive Encipher | |
| 205 | + implementation "com.cnlive:lib-cnencipher:$rootProject.libCnencipher" | |
| 206 | + implementation "com.cnlive:lib_cnutil:$rootProject.libCnUtil" | |
| 207 | + | |
| 208 | + //base | |
| 209 | + implementation "com.cnlive.libs:base:$rootProject.libBase" | |
| 210 | + implementation project(path: ':moudle_user') | |
| 211 | + | |
| 212 | + //UI框架库 (http://qmuiteam.com/android/page/document.html) | |
| 213 | + implementation "com.qmuiteam:qmui:$rootProject.qmui" | |
| 214 | + implementation "com.cnlive.libs:arch:$rootProject.appArch" | |
| 215 | + | |
| 216 | + // eventbus | |
| 217 | + implementation "org.greenrobot:eventbus:$rootProject.eventBus" | |
| 218 | + | |
| 219 | +} | ... | ... |
app/proguard-rules.pro
0 → 100644
| 1 | +++ a/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 | ... | ... |
app/src/androidTest/java/com/cnlive/strike/moduleuser/ExampleInstrumentedTest.java
0 → 100644
| 1 | +++ a/app/src/androidTest/java/com/cnlive/strike/moduleuser/ExampleInstrumentedTest.java | |
| 1 | +package com.cnlive.strike.moduleuser; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | + | |
| 5 | +import androidx.test.platform.app.InstrumentationRegistry; | |
| 6 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
| 7 | + | |
| 8 | +import org.junit.Test; | |
| 9 | +import org.junit.runner.RunWith; | |
| 10 | + | |
| 11 | +import static org.junit.Assert.*; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Instrumented test, which will execute on an Android device. | |
| 15 | + * | |
| 16 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | |
| 17 | + */ | |
| 18 | +@RunWith(AndroidJUnit4.class) | |
| 19 | +public class ExampleInstrumentedTest { | |
| 20 | + @Test | |
| 21 | + public void useAppContext() { | |
| 22 | + // Context of the app under test. | |
| 23 | + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | |
| 24 | + | |
| 25 | + assertEquals("com.cnlive.strike.moduleuser", appContext.getPackageName()); | |
| 26 | + } | |
| 27 | +} | ... | ... |
app/src/main/AndroidManifest.xml
0 → 100644
| 1 | +++ a/app/src/main/AndroidManifest.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + xmlns:tools="http://schemas.android.com/tools" | |
| 4 | + package="com.cnlive.strike"> | |
| 5 | + | |
| 6 | + <uses-permission | |
| 7 | + android:name="android.permission.AUTHENTICATE_ACCOUNTS" | |
| 8 | + android:maxSdkVersion="22" /> | |
| 9 | + <uses-permission | |
| 10 | + android:name="android.permission.GET_ACCOUNTS" | |
| 11 | + android:maxSdkVersion="22" /> | |
| 12 | + <uses-permission | |
| 13 | + android:name="android.permission.MANAGE_ACCOUNTS" | |
| 14 | + android:maxSdkVersion="22" /> | |
| 15 | + <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /> <!-- 账户自动更新 App保活相关 --> | |
| 16 | + <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /> | |
| 17 | + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | |
| 18 | + <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> | |
| 19 | + <uses-permission android:name="android.permission.ACTION_LIGHT_DEVICE_IDLE_MODE_CHANGED" /> | |
| 20 | + <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 账户权限相关 --> | |
| 21 | + <uses-permission | |
| 22 | + android:name="android.permission.INTERACT_ACROSS_USERS_FULL" | |
| 23 | + tools:ignore="ProtectedPermissions" /> | |
| 24 | + <uses-permission | |
| 25 | + android:name="android.permission.ACCOUNT_MANAGER" | |
| 26 | + tools:ignore="ProtectedPermissions" /> | |
| 27 | + <uses-permission android:name="android.permission.INTERNET" /> | |
| 28 | + | |
| 29 | + <application | |
| 30 | + android:name=".moduleuser.MyApp" | |
| 31 | + android:allowBackup="true" | |
| 32 | + android:icon="@mipmap/ic_launcher" | |
| 33 | + android:label="@string/app_name" | |
| 34 | + android:roundIcon="@mipmap/ic_launcher_round" | |
| 35 | + android:supportsRtl="true" | |
| 36 | + android:theme="@style/AppTheme"> | |
| 37 | + <service | |
| 38 | + android:name="com.cnlive.strike.user.auth.UserAccountService" | |
| 39 | + tools:ignore="ExportedService"> | |
| 40 | + <intent-filter> | |
| 41 | + <action android:name="android.accounts.AccountAuthenticator" /> | |
| 42 | + </intent-filter> | |
| 43 | + | |
| 44 | + <meta-data | |
| 45 | + android:name="android.accounts.AccountAuthenticator" | |
| 46 | + android:resource="@xml/authenticator" /> | |
| 47 | + </service> | |
| 48 | + | |
| 49 | + <service | |
| 50 | + android:name="com.cnlive.strike.user.auth.UserSyncService" | |
| 51 | + android:exported="true"> | |
| 52 | + <intent-filter> | |
| 53 | + <action android:name="android.content.SyncAdapter" /> | |
| 54 | + </intent-filter> | |
| 55 | + | |
| 56 | + <meta-data | |
| 57 | + android:name="android.content.SyncAdapter" | |
| 58 | + android:resource="@xml/account_sync_adapter" /> | |
| 59 | + </service> | |
| 60 | + | |
| 61 | + <provider | |
| 62 | + android:name="com.cnlive.strike.user.auth.UserAccountProvider" | |
| 63 | + android:authorities="@string/ACCOUNT_PROVIDE" | |
| 64 | + android:exported="false" | |
| 65 | + android:syncable="true" /> | |
| 66 | + <activity android:name=".moduleuser.MainActivity"> | |
| 67 | + <intent-filter> | |
| 68 | + <action android:name="android.intent.action.MAIN" /> | |
| 69 | + | |
| 70 | + <category android:name="android.intent.category.LAUNCHER" /> | |
| 71 | + </intent-filter> | |
| 72 | + </activity> | |
| 73 | + <activity | |
| 74 | + android:name=".moduleuser.TestActivity" | |
| 75 | + android:label="UserAPI" | |
| 76 | + android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" /> | |
| 77 | + </application> | |
| 78 | + | |
| 79 | +</manifest> | |
| 0 | 80 | \ No newline at end of file | ... | ... |
app/src/main/java/com/cnlive/strike/moduleuser/MainActivity.java
0 → 100644
| 1 | +++ a/app/src/main/java/com/cnlive/strike/moduleuser/MainActivity.java | |
| 1 | +package com.cnlive.strike.moduleuser; | |
| 2 | + | |
| 3 | + | |
| 4 | +import android.content.Intent; | |
| 5 | +import android.os.Bundle; | |
| 6 | +import android.support.v7.app.AppCompatActivity; | |
| 7 | + | |
| 8 | +import com.cnlive.strike.R; | |
| 9 | +import com.cnlive.strike.moudle.user.ui.activity.LoginActivity; | |
| 10 | +import com.cnlive.strike.user.auth.UserService; | |
| 11 | +import com.cnlive.strike.util.SharedPreferencesUtils; | |
| 12 | + | |
| 13 | + | |
| 14 | +public class MainActivity extends AppCompatActivity { | |
| 15 | + @Override | |
| 16 | + protected void onCreate(Bundle savedInstanceState) { | |
| 17 | + super.onCreate(savedInstanceState); | |
| 18 | + setContentView(R.layout.activity_main); | |
| 19 | + startLoginPage(); | |
| 20 | + } | |
| 21 | + | |
| 22 | + public void startLoginPage() { | |
| 23 | +// int version = Integer.parseInt(BuildConfig.APP_SPLASH_VERSION); | |
| 24 | +// SharedPreferencesUtils.put(this, "APP_SPLASH_VERSION", version); | |
| 25 | + SharedPreferencesUtils.put(this, "isFirstLogin", false); | |
| 26 | + Intent intent = new Intent(this, LoginActivity.class); | |
| 27 | + startActivity(intent); | |
| 28 | + overridePendingTransition(R.anim.in_from_left, R.anim.out_to_right); | |
| 29 | + finish(); | |
| 30 | + } | |
| 31 | +} | ... | ... |
app/src/main/java/com/cnlive/strike/moduleuser/MyApp.java
0 → 100644
| 1 | +++ a/app/src/main/java/com/cnlive/strike/moduleuser/MyApp.java | |
| 1 | +package com.cnlive.strike.moduleuser; | |
| 2 | + | |
| 3 | +import android.app.Application; | |
| 4 | + | |
| 5 | +import com.alibaba.android.arouter.launcher.ARouter; | |
| 6 | +import com.cnlive.libs.base.application.AppConfig; | |
| 7 | +import com.cnlive.strike.BuildConfig; | |
| 8 | +import com.cnlive.strike.user.auth.UserService; | |
| 9 | + | |
| 10 | +public class MyApp extends Application { | |
| 11 | + @Override | |
| 12 | + public void onCreate() { | |
| 13 | + super.onCreate(); | |
| 14 | + //App默认配置单 | |
| 15 | + AppConfig.init(this, BuildConfig.APP_ID, BuildConfig.APP_KEY, | |
| 16 | + BuildConfig.APP_SCERET, BuildConfig.SPECIAL_GROUP_MEMBER_LIMIT, | |
| 17 | + BuildConfig.VERSION_AS_DEBUG, BuildConfig.BAIDU_APP_KEY, BuildConfig.BAIDU_APP_SECRET, | |
| 18 | + UserService.getUid(getApplicationContext()), BuildConfig.WECHAT_APPID, | |
| 19 | + BuildConfig.SHARE_DOWNLOAD, BuildConfig.SHARE_ICON, BuildConfig.PAY_ACCOUNT, | |
| 20 | + BuildConfig.SHARE_TITLE, BuildConfig.SHARE_SUBTITLE, BuildConfig.REPORT_URL, | |
| 21 | + BuildConfig.BAIDU_MAP_APP_KEY, BuildConfig.SHOP_PATH); | |
| 22 | + initARouter(); | |
| 23 | + } | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 初始化阿里的路由 | |
| 27 | + */ | |
| 28 | + private void initARouter() { | |
| 29 | + if (BuildConfig.DEBUG) { // 这两行必须写在init之前,否则这些配置在init过程中将无效 | |
| 30 | + ARouter.openLog(); // 打印日志 | |
| 31 | + ARouter.openDebug(); // 开启调试模式(如果在InstantRun模式下运行,必须开启调试模式!线上版本需要关闭,否则有安全风险) | |
| 32 | + ARouter.printStackTrace(); // 打印日志的时候打印线程堆栈 | |
| 33 | + } | |
| 34 | + ARouter.init(this); // 尽可能早,推荐在Application中初始化 | |
| 35 | + } | |
| 36 | +} | ... | ... |
app/src/main/java/com/cnlive/strike/moduleuser/TestActivity.java
0 → 100644
| 1 | +++ a/app/src/main/java/com/cnlive/strike/moduleuser/TestActivity.java | |
| 1 | +package com.cnlive.strike.moduleuser; | |
| 2 | + | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.content.Intent; | |
| 5 | +import android.net.Uri; | |
| 6 | +import android.os.Bundle; | |
| 7 | +import android.text.TextUtils; | |
| 8 | +import android.util.Log; | |
| 9 | + | |
| 10 | +import androidx.annotation.Nullable; | |
| 11 | + | |
| 12 | +import com.cnlive.strike.moudle.user.model.UserConst; | |
| 13 | +import com.cnlive.strike.moudle.user.ui.activity.FirstLoginActivity; | |
| 14 | +import com.cnlive.strike.moudle.user.ui.activity.LoginActivity; | |
| 15 | +import com.cnlive.strike.moudle.user.ui.activity.MainTestActivity; | |
| 16 | +import com.cnlive.strike.moudle.user.ui.activity.PersonalDataActivity; | |
| 17 | +import com.cnlive.strike.user.auth.UserService; | |
| 18 | + | |
| 19 | +public class TestActivity extends Activity { | |
| 20 | + private int eventType; | |
| 21 | + private boolean isHasOtherUserInfo = false; | |
| 22 | + private String TAG = "TestActivity"; | |
| 23 | + | |
| 24 | + /************MainActivity 所需要的数据***********/ | |
| 25 | + private String type; | |
| 26 | + private Uri uri; | |
| 27 | + private boolean clickAd; | |
| 28 | + private String sharetype; | |
| 29 | + private String classifyTagMsg; | |
| 30 | + /************LoginActivity 所需要的数据***********/ | |
| 31 | + private String tagMsg; | |
| 32 | + /************修改用户头像 所需要的数据***********/ | |
| 33 | + private String faceUrl; | |
| 34 | + /************修改用户昵称 所需要的数据***********/ | |
| 35 | + private String nickName; | |
| 36 | + /************CoinRainAction 所需要的数据***********/ | |
| 37 | + private String taskId; | |
| 38 | + private String contentId; | |
| 39 | + private String addtype; | |
| 40 | + private Boolean isDouyin; | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + protected void onCreate(@Nullable @android.support.annotation.Nullable Bundle savedInstanceState) { | |
| 44 | + super.onCreate(savedInstanceState); | |
| 45 | + if (null != getIntent().getExtras()) { | |
| 46 | + eventType = getIntent().getExtras().getInt("eventType"); | |
| 47 | + initAction(eventType); | |
| 48 | + } | |
| 49 | + } | |
| 50 | + | |
| 51 | + private void initAction(int eventType) { | |
| 52 | + switch (eventType) { | |
| 53 | + //是新用户 | |
| 54 | + case UserConst.IS_NEW_USER://是新用户 | |
| 55 | + Log.e(TAG, "是新用户"); | |
| 56 | + | |
| 57 | + //TODO 必须设置用户头像 | |
| 58 | + //OpenInstall用户注册统计 | |
| 59 | +// OpenInstall.reportRegister(); | |
| 60 | + //友盟账号登录统计,暂时只有平台登录,后续对接三方登录 | |
| 61 | +// MobclickAgent.onProfileSignIn("CNLive", user.getUid()); | |
| 62 | + isHasOtherUserInfo = getIntent().getExtras().getBoolean("isHasOtherUserInfo"); | |
| 63 | + | |
| 64 | + //判断是否有其他平台数据 | |
| 65 | + if (isHasOtherUserInfo) { | |
| 66 | + type = getIntent().getExtras().getString("type"); | |
| 67 | + uri = (Uri) getIntent().getExtras().get("uri"); | |
| 68 | + clickAd = getIntent().getExtras().getBoolean(LoginActivity.TAG_CLICK_AD); | |
| 69 | + sharetype = getIntent().getExtras().getString("sharetype"); | |
| 70 | + classifyTagMsg = getIntent().getExtras().getString("classifyTagMsg"); | |
| 71 | + | |
| 72 | + | |
| 73 | + //直接显示主视图 | |
| 74 | + Intent intent = new Intent(this, MainTestActivity.class); | |
| 75 | + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); | |
| 76 | + intent.putExtra("type", type); | |
| 77 | + intent.putExtra("uri", uri); | |
| 78 | + intent.putExtra(LoginActivity.TAG_CLICK_AD, clickAd); | |
| 79 | + intent.putExtra("sharetype", sharetype); | |
| 80 | + if (!TextUtils.isEmpty(classifyTagMsg)) { | |
| 81 | + intent.putExtra("classifyTagMsg", classifyTagMsg); | |
| 82 | + } | |
| 83 | + startActivity(intent); | |
| 84 | + } else { | |
| 85 | + tagMsg = getIntent().getExtras().getString("tagMsg"); | |
| 86 | + clickAd = getIntent().getExtras().getBoolean(LoginActivity.TAG_CLICK_AD); | |
| 87 | + //没有第三方数据,跳转到设置用户信息的界面 | |
| 88 | + Intent intent = new Intent(this, FirstLoginActivity.class); | |
| 89 | + intent.putExtra(LoginActivity.TAG_MSG, TextUtils.isEmpty(tagMsg) ? "" : tagMsg); | |
| 90 | + intent.putExtra(LoginActivity.TAG_CLICK_AD, clickAd); | |
| 91 | + startActivity(intent); | |
| 92 | + | |
| 93 | + } | |
| 94 | + Log.e(TAG, "initAction: "); | |
| 95 | + finish(); | |
| 96 | + break; | |
| 97 | + case UserConst.IS_NOT_NEW_USER://不是新用户 | |
| 98 | + //todo | |
| 99 | + //友盟账号登录统计,暂时只有平台登录,后续对接三方登录 | |
| 100 | +// MobclickAgent.onProfileSignIn("CNLive", user.getUid()); | |
| 101 | + type = getIntent().getExtras().getString("type"); | |
| 102 | + uri = (Uri) getIntent().getExtras().get("uri"); | |
| 103 | + clickAd = getIntent().getExtras().getBoolean(LoginActivity.TAG_CLICK_AD); | |
| 104 | + sharetype = getIntent().getExtras().getString("sharetype"); | |
| 105 | + classifyTagMsg = getIntent().getExtras().getString("classifyTagMsg"); | |
| 106 | + //直接显示主视图 | |
| 107 | +// Intent intent = new Intent(this, MainTestActivity.class); | |
| 108 | +// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); | |
| 109 | +// intent.putExtra("type", type); | |
| 110 | +// intent.putExtra("uri", uri); | |
| 111 | +// intent.putExtra(LoginActivity.TAG_CLICK_AD, clickAd); | |
| 112 | +// intent.putExtra("sharetype", sharetype); | |
| 113 | +// if (!TextUtils.isEmpty(classifyTagMsg)) { | |
| 114 | +// intent.putExtra("classifyTagMsg", classifyTagMsg); | |
| 115 | +// } | |
| 116 | +// startActivity(intent); | |
| 117 | + PersonalDataActivity.startActivity(this); | |
| 118 | + Log.e(TAG, "不是新用户"); | |
| 119 | + finish(); | |
| 120 | + break; | |
| 121 | + | |
| 122 | + case UserConst.MODIFY_USER_IMAGE://修改用户头像 | |
| 123 | + Log.e(TAG, "修改用户头像"); | |
| 124 | + | |
| 125 | + faceUrl = getIntent().getExtras().getString("faceUrl"); | |
| 126 | + //todo | |
| 127 | +// LoginManager.modifyUserImage(UserService.getUid(this), faceUrl); | |
| 128 | + finish(); | |
| 129 | + break; | |
| 130 | + | |
| 131 | + case UserConst.USER_INVALID://用户失效 | |
| 132 | + Log.e(TAG, "用户失效"); | |
| 133 | + | |
| 134 | + //todo | |
| 135 | + // UserOfflineUtil.userInvalid(context); | |
| 136 | + finish(); | |
| 137 | + case UserConst.MODIFY_USER_NAME://修改用户名称 | |
| 138 | + //todo | |
| 139 | + Log.e(TAG, "修改用户名称"); | |
| 140 | + nickName = getIntent().getExtras().getString("nickName"); | |
| 141 | + // LoginManager.modifyUserName( UserService.getUid(context), nickName); | |
| 142 | + | |
| 143 | + finish(); | |
| 144 | + break; | |
| 145 | + case UserConst.COIN_RAIN_ACTION://下金币 | |
| 146 | + Log.e(TAG, "下金币"); | |
| 147 | + //todo | |
| 148 | + taskId = getIntent().getExtras().getString("taskId"); | |
| 149 | + contentId = getIntent().getExtras().getString("contentId"); | |
| 150 | + addtype = getIntent().getExtras().getString("addtype"); | |
| 151 | + isDouyin = getIntent().getExtras().getBoolean("isDouyin"); | |
| 152 | + if (TextUtils.isEmpty(taskId)) { | |
| 153 | + taskId = ""; | |
| 154 | + } | |
| 155 | + if (TextUtils.isEmpty(contentId)) { | |
| 156 | + contentId = ""; | |
| 157 | + } | |
| 158 | + if (TextUtils.isEmpty(addtype)) { | |
| 159 | + addtype = ""; | |
| 160 | + } | |
| 161 | + //CoinRainAction.code(activity, UserService.getUid(activity), taskId,contentId, addtype,isDouyin); | |
| 162 | + | |
| 163 | + break; | |
| 164 | + } | |
| 165 | + } | |
| 166 | + | |
| 167 | +} | ... | ... |
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
0 → 100644
| 1 | +++ a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml | |
| 1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | + xmlns:aapt="http://schemas.android.com/aapt" | |
| 3 | + android:width="108dp" | |
| 4 | + android:height="108dp" | |
| 5 | + android:viewportWidth="108" | |
| 6 | + android:viewportHeight="108"> | |
| 7 | + <path | |
| 8 | + android:fillType="evenOdd" | |
| 9 | + android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z" | |
| 10 | + android:strokeWidth="1" | |
| 11 | + android:strokeColor="#00000000"> | |
| 12 | + <aapt:attr name="android:fillColor"> | |
| 13 | + <gradient | |
| 14 | + android:endX="78.5885" | |
| 15 | + android:endY="90.9159" | |
| 16 | + android:startX="48.7653" | |
| 17 | + android:startY="61.0927" | |
| 18 | + android:type="linear"> | |
| 19 | + <item | |
| 20 | + android:color="#44000000" | |
| 21 | + android:offset="0.0" /> | |
| 22 | + <item | |
| 23 | + android:color="#00000000" | |
| 24 | + android:offset="1.0" /> | |
| 25 | + </gradient> | |
| 26 | + </aapt:attr> | |
| 27 | + </path> | |
| 28 | + <path | |
| 29 | + android:fillColor="#FFFFFF" | |
| 30 | + android:fillType="nonZero" | |
| 31 | + android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z" | |
| 32 | + android:strokeWidth="1" | |
| 33 | + android:strokeColor="#00000000" /> | |
| 34 | +</vector> | ... | ... |
app/src/main/res/drawable/ic_launcher_background.xml
0 → 100644
| 1 | +++ a/app/src/main/res/drawable/ic_launcher_background.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:width="108dp" | |
| 4 | + android:height="108dp" | |
| 5 | + android:viewportWidth="108" | |
| 6 | + android:viewportHeight="108"> | |
| 7 | + <path | |
| 8 | + android:fillColor="#008577" | |
| 9 | + android:pathData="M0,0h108v108h-108z" /> | |
| 10 | + <path | |
| 11 | + android:fillColor="#00000000" | |
| 12 | + android:pathData="M9,0L9,108" | |
| 13 | + android:strokeWidth="0.8" | |
| 14 | + android:strokeColor="#33FFFFFF" /> | |
| 15 | + <path | |
| 16 | + android:fillColor="#00000000" | |
| 17 | + android:pathData="M19,0L19,108" | |
| 18 | + android:strokeWidth="0.8" | |
| 19 | + android:strokeColor="#33FFFFFF" /> | |
| 20 | + <path | |
| 21 | + android:fillColor="#00000000" | |
| 22 | + android:pathData="M29,0L29,108" | |
| 23 | + android:strokeWidth="0.8" | |
| 24 | + android:strokeColor="#33FFFFFF" /> | |
| 25 | + <path | |
| 26 | + android:fillColor="#00000000" | |
| 27 | + android:pathData="M39,0L39,108" | |
| 28 | + android:strokeWidth="0.8" | |
| 29 | + android:strokeColor="#33FFFFFF" /> | |
| 30 | + <path | |
| 31 | + android:fillColor="#00000000" | |
| 32 | + android:pathData="M49,0L49,108" | |
| 33 | + android:strokeWidth="0.8" | |
| 34 | + android:strokeColor="#33FFFFFF" /> | |
| 35 | + <path | |
| 36 | + android:fillColor="#00000000" | |
| 37 | + android:pathData="M59,0L59,108" | |
| 38 | + android:strokeWidth="0.8" | |
| 39 | + android:strokeColor="#33FFFFFF" /> | |
| 40 | + <path | |
| 41 | + android:fillColor="#00000000" | |
| 42 | + android:pathData="M69,0L69,108" | |
| 43 | + android:strokeWidth="0.8" | |
| 44 | + android:strokeColor="#33FFFFFF" /> | |
| 45 | + <path | |
| 46 | + android:fillColor="#00000000" | |
| 47 | + android:pathData="M79,0L79,108" | |
| 48 | + android:strokeWidth="0.8" | |
| 49 | + android:strokeColor="#33FFFFFF" /> | |
| 50 | + <path | |
| 51 | + android:fillColor="#00000000" | |
| 52 | + android:pathData="M89,0L89,108" | |
| 53 | + android:strokeWidth="0.8" | |
| 54 | + android:strokeColor="#33FFFFFF" /> | |
| 55 | + <path | |
| 56 | + android:fillColor="#00000000" | |
| 57 | + android:pathData="M99,0L99,108" | |
| 58 | + android:strokeWidth="0.8" | |
| 59 | + android:strokeColor="#33FFFFFF" /> | |
| 60 | + <path | |
| 61 | + android:fillColor="#00000000" | |
| 62 | + android:pathData="M0,9L108,9" | |
| 63 | + android:strokeWidth="0.8" | |
| 64 | + android:strokeColor="#33FFFFFF" /> | |
| 65 | + <path | |
| 66 | + android:fillColor="#00000000" | |
| 67 | + android:pathData="M0,19L108,19" | |
| 68 | + android:strokeWidth="0.8" | |
| 69 | + android:strokeColor="#33FFFFFF" /> | |
| 70 | + <path | |
| 71 | + android:fillColor="#00000000" | |
| 72 | + android:pathData="M0,29L108,29" | |
| 73 | + android:strokeWidth="0.8" | |
| 74 | + android:strokeColor="#33FFFFFF" /> | |
| 75 | + <path | |
| 76 | + android:fillColor="#00000000" | |
| 77 | + android:pathData="M0,39L108,39" | |
| 78 | + android:strokeWidth="0.8" | |
| 79 | + android:strokeColor="#33FFFFFF" /> | |
| 80 | + <path | |
| 81 | + android:fillColor="#00000000" | |
| 82 | + android:pathData="M0,49L108,49" | |
| 83 | + android:strokeWidth="0.8" | |
| 84 | + android:strokeColor="#33FFFFFF" /> | |
| 85 | + <path | |
| 86 | + android:fillColor="#00000000" | |
| 87 | + android:pathData="M0,59L108,59" | |
| 88 | + android:strokeWidth="0.8" | |
| 89 | + android:strokeColor="#33FFFFFF" /> | |
| 90 | + <path | |
| 91 | + android:fillColor="#00000000" | |
| 92 | + android:pathData="M0,69L108,69" | |
| 93 | + android:strokeWidth="0.8" | |
| 94 | + android:strokeColor="#33FFFFFF" /> | |
| 95 | + <path | |
| 96 | + android:fillColor="#00000000" | |
| 97 | + android:pathData="M0,79L108,79" | |
| 98 | + android:strokeWidth="0.8" | |
| 99 | + android:strokeColor="#33FFFFFF" /> | |
| 100 | + <path | |
| 101 | + android:fillColor="#00000000" | |
| 102 | + android:pathData="M0,89L108,89" | |
| 103 | + android:strokeWidth="0.8" | |
| 104 | + android:strokeColor="#33FFFFFF" /> | |
| 105 | + <path | |
| 106 | + android:fillColor="#00000000" | |
| 107 | + android:pathData="M0,99L108,99" | |
| 108 | + android:strokeWidth="0.8" | |
| 109 | + android:strokeColor="#33FFFFFF" /> | |
| 110 | + <path | |
| 111 | + android:fillColor="#00000000" | |
| 112 | + android:pathData="M19,29L89,29" | |
| 113 | + android:strokeWidth="0.8" | |
| 114 | + android:strokeColor="#33FFFFFF" /> | |
| 115 | + <path | |
| 116 | + android:fillColor="#00000000" | |
| 117 | + android:pathData="M19,39L89,39" | |
| 118 | + android:strokeWidth="0.8" | |
| 119 | + android:strokeColor="#33FFFFFF" /> | |
| 120 | + <path | |
| 121 | + android:fillColor="#00000000" | |
| 122 | + android:pathData="M19,49L89,49" | |
| 123 | + android:strokeWidth="0.8" | |
| 124 | + android:strokeColor="#33FFFFFF" /> | |
| 125 | + <path | |
| 126 | + android:fillColor="#00000000" | |
| 127 | + android:pathData="M19,59L89,59" | |
| 128 | + android:strokeWidth="0.8" | |
| 129 | + android:strokeColor="#33FFFFFF" /> | |
| 130 | + <path | |
| 131 | + android:fillColor="#00000000" | |
| 132 | + android:pathData="M19,69L89,69" | |
| 133 | + android:strokeWidth="0.8" | |
| 134 | + android:strokeColor="#33FFFFFF" /> | |
| 135 | + <path | |
| 136 | + android:fillColor="#00000000" | |
| 137 | + android:pathData="M19,79L89,79" | |
| 138 | + android:strokeWidth="0.8" | |
| 139 | + android:strokeColor="#33FFFFFF" /> | |
| 140 | + <path | |
| 141 | + android:fillColor="#00000000" | |
| 142 | + android:pathData="M29,19L29,89" | |
| 143 | + android:strokeWidth="0.8" | |
| 144 | + android:strokeColor="#33FFFFFF" /> | |
| 145 | + <path | |
| 146 | + android:fillColor="#00000000" | |
| 147 | + android:pathData="M39,19L39,89" | |
| 148 | + android:strokeWidth="0.8" | |
| 149 | + android:strokeColor="#33FFFFFF" /> | |
| 150 | + <path | |
| 151 | + android:fillColor="#00000000" | |
| 152 | + android:pathData="M49,19L49,89" | |
| 153 | + android:strokeWidth="0.8" | |
| 154 | + android:strokeColor="#33FFFFFF" /> | |
| 155 | + <path | |
| 156 | + android:fillColor="#00000000" | |
| 157 | + android:pathData="M59,19L59,89" | |
| 158 | + android:strokeWidth="0.8" | |
| 159 | + android:strokeColor="#33FFFFFF" /> | |
| 160 | + <path | |
| 161 | + android:fillColor="#00000000" | |
| 162 | + android:pathData="M69,19L69,89" | |
| 163 | + android:strokeWidth="0.8" | |
| 164 | + android:strokeColor="#33FFFFFF" /> | |
| 165 | + <path | |
| 166 | + android:fillColor="#00000000" | |
| 167 | + android:pathData="M79,19L79,89" | |
| 168 | + android:strokeWidth="0.8" | |
| 169 | + android:strokeColor="#33FFFFFF" /> | |
| 170 | +</vector> | ... | ... |
app/src/main/res/layout/activity_main.xml
0 → 100644
| 1 | +++ a/app/src/main/res/layout/activity_main.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
| 4 | + xmlns:tools="http://schemas.android.com/tools" | |
| 5 | + android:layout_width="match_parent" | |
| 6 | + android:layout_height="match_parent" | |
| 7 | + tools:context=".MainActivity"> | |
| 8 | + | |
| 9 | + | |
| 10 | +</LinearLayout> | |
| 0 | 11 | \ No newline at end of file | ... | ... |
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
0 → 100644
| 1 | +++ a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + <background android:drawable="@drawable/ic_launcher_background" /> | |
| 4 | + <foreground android:drawable="@drawable/ic_launcher_foreground" /> | |
| 5 | +</adaptive-icon> | |
| 0 | 6 | \ No newline at end of file | ... | ... |
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
0 → 100644
| 1 | +++ a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + <background android:drawable="@drawable/ic_launcher_background" /> | |
| 4 | + <foreground android:drawable="@drawable/ic_launcher_foreground" /> | |
| 5 | +</adaptive-icon> | |
| 0 | 6 | \ No newline at end of file | ... | ... |
app/src/main/res/mipmap-hdpi/ic_launcher.png
0 → 100644
2.89 KB
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
0 → 100644
4.79 KB
app/src/main/res/mipmap-mdpi/ic_launcher.png
0 → 100644
2.01 KB
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
0 → 100644
2.72 KB
app/src/main/res/mipmap-xhdpi/ic_launcher.png
0 → 100644
4.38 KB
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
0 → 100644
6.73 KB
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
0 → 100644
6.24 KB
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
0 → 100644
10.2 KB
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
0 → 100644
8.91 KB
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
0 → 100644
14.8 KB
app/src/main/res/values/colors.xml
0 → 100644
app/src/main/res/values/strings.xml
0 → 100644
app/src/main/res/values/styles.xml
0 → 100644
| 1 | +++ a/app/src/main/res/values/styles.xml | |
| 1 | +<resources> | |
| 2 | + | |
| 3 | + <!-- Base application theme. --> | |
| 4 | + <style name="AppTheme" parent="QMUI.Compat.NoActionBar"> | |
| 5 | + <!-- Customize your theme here. --> | |
| 6 | + <item name="colorPrimary">@color/colorPrimary</item> | |
| 7 | + <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
| 8 | + <item name="colorAccent">@color/colorAccent</item> | |
| 9 | + </style> | |
| 10 | + | |
| 11 | +</resources> | ... | ... |
app/src/test/java/com/cnlive/strike/moduleuser/ExampleUnitTest.java
0 → 100644
| 1 | +++ a/app/src/test/java/com/cnlive/strike/moduleuser/ExampleUnitTest.java | |
| 1 | +package com.cnlive.strike.moduleuser; | |
| 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 <a href="http://d.android.com/tools/testing">Testing documentation</a> | |
| 11 | + */ | |
| 12 | +public class ExampleUnitTest { | |
| 13 | + @Test | |
| 14 | + public void addition_isCorrect() { | |
| 15 | + assertEquals(4, 2 + 2); | |
| 16 | + } | |
| 17 | +} | |
| 0 | 18 | \ No newline at end of file | ... | ... |
app/www.cnlive.com.key
0 → 100644
No preview for this file type
build.gradle
0 → 100644
| 1 | +++ a/build.gradle | |
| 1 | +// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
| 2 | +apply from: "config.gradle" | |
| 3 | +buildscript { | |
| 4 | + repositories { | |
| 5 | + //关联微博 | |
| 6 | + maven { url "https://dl.bintray.com/thelasterstar/maven/" } | |
| 7 | + google() | |
| 8 | + jcenter() | |
| 9 | + mavenCentral() | |
| 10 | + maven { | |
| 11 | + url 'http://nexus2.tingyun.com/nexus/content/repositories/snapshots/' | |
| 12 | + } | |
| 13 | + maven { | |
| 14 | + url 'https://dl.bintray.com/granzon/cnlive' | |
| 15 | + } | |
| 16 | + | |
| 17 | + maven { url 'https://dl.bintray.com/umsdk/release' } | |
| 18 | + } | |
| 19 | + dependencies { | |
| 20 | + classpath 'com.android.tools.build:gradle:3.5.1' | |
| 21 | + classpath "com.alibaba:arouter-register:1.0.2" | |
| 22 | + // NOTE: Do not place your application dependencies here; they belong | |
| 23 | + // in the individual module build.gradle files | |
| 24 | + } | |
| 25 | +} | |
| 26 | + | |
| 27 | +allprojects { | |
| 28 | + repositories { | |
| 29 | + maven { url "https://dl.bintray.com/thelasterstar/maven/" } | |
| 30 | + google() | |
| 31 | + jcenter() | |
| 32 | + //------------------ 资源库配置 ------------------ | |
| 33 | + maven { | |
| 34 | + url "http://android.nexus.cnlive.com/repository/cnlive-mixed/" | |
| 35 | + credentials { username = nexusId; password = nexusPw } | |
| 36 | + } | |
| 37 | + //------------------ 资源库配置 END------------------ | |
| 38 | + maven { | |
| 39 | + url 'https://dl.bintray.com/granzon/cnlive' | |
| 40 | + } | |
| 41 | + maven { | |
| 42 | + url 'https://dl.bintray.com/granzon/cnliveLibs' | |
| 43 | + } | |
| 44 | + maven { | |
| 45 | + url "https://jitpack.io" | |
| 46 | + } | |
| 47 | + | |
| 48 | + } | |
| 49 | +} | |
| 50 | + | |
| 51 | +task clean(type: Delete) { | |
| 52 | + delete rootProject.buildDir | |
| 53 | +} | |
| 54 | + | |
| 55 | +//配置全局变量 | |
| 56 | +ext { | |
| 57 | + def versionMajor = 1 | |
| 58 | + def versionMinor = 5 | |
| 59 | + def versionPatch = 5 | |
| 60 | + def versionBuild = 5 | |
| 61 | + // module依赖库公共版本号 | |
| 62 | + versionCode = versionMajor * 1000 + versionMinor * 100 + versionPatch * 10 + versionBuild | |
| 63 | + versionName = "${versionMajor}.${versionMinor}.${versionPatch}.${versionBuild}" | |
| 64 | + | |
| 65 | + compileSdkVersion = 29 | |
| 66 | + buildToolsVersion = "29.0.2" | |
| 67 | + minSdkVersion = 19 | |
| 68 | + targetSdkVersion = 29 | |
| 69 | + //基础库 | |
| 70 | + libBase = '1.6.2' | |
| 71 | + libNetwork = '1.1.5' | |
| 72 | + libEmoj = '2.0.9' | |
| 73 | + libMenu = '1.0.6' | |
| 74 | + libAnalytics = '1.1.0' | |
| 75 | + libLargeImage = '1.0.1' | |
| 76 | + libMediaPicker = '1.5.8' | |
| 77 | + libWjjPay = "1.0.5" | |
| 78 | + appAgriculture = "1.1.9" | |
| 79 | + appArch = '1.1.1' | |
| 80 | + | |
| 81 | + //视频库 | |
| 82 | + libVideoQiniu = '1.0.6' | |
| 83 | + | |
| 84 | + //幸福中国 | |
| 85 | + moduleHappyChina = '0.0.12' | |
| 86 | + | |
| 87 | + //support 相关 | |
| 88 | + supportV4 = '28.0.0' | |
| 89 | + appcompatV7 = '28.0.0' | |
| 90 | + design = '28.0.0' | |
| 91 | + supportV13 = '28.0.0' | |
| 92 | + recyclerviewV7 = '28.0.0' | |
| 93 | + cardviewV7 = '28.0.0' | |
| 94 | + multidex = '1.0.3' | |
| 95 | + constraintLayout = '1.1.3' | |
| 96 | + | |
| 97 | + //阿里路由框架 | |
| 98 | + arouterApiVersion = '1.4.0' | |
| 99 | + arouterCompilerVersion = '1.2.1' | |
| 100 | + | |
| 101 | + //视讯云相关 | |
| 102 | + libCnUtil = '3.1.5' | |
| 103 | + libCnVideo = '3.3.11' | |
| 104 | + libUpload = '2.0.6' | |
| 105 | + libCnencipher = '1.1.1' | |
| 106 | + | |
| 107 | + //glide | |
| 108 | + glide = '4.5.0' | |
| 109 | + glideTransformations = '3.0.1' | |
| 110 | + compiler = '4.5.0' | |
| 111 | + | |
| 112 | + //数据库加密 | |
| 113 | + androidDatabaseSqlcipher = '3.5.6' | |
| 114 | + | |
| 115 | + //qmui | |
| 116 | + qmui = '1.4.0' | |
| 117 | + | |
| 118 | + //高德地图 | |
| 119 | + location = 'latest.integration' | |
| 120 | + | |
| 121 | + //SmartRefresh | |
| 122 | + SmartRefreshLayout = '1.1.0-alpha-6' | |
| 123 | + SmartRefreshHeader = '1.1.0-alpha-6' | |
| 124 | + | |
| 125 | + //二维码相关 | |
| 126 | + bgaQrcodeZxing = '1.3.6' | |
| 127 | + bgaQrcodeZbar = '1.3.6' | |
| 128 | + | |
| 129 | + //七牛 | |
| 130 | + qiniuAndroidSdk = '7.3.11' | |
| 131 | + | |
| 132 | + //听云 | |
| 133 | + nbsNewlensAgent = '2.14.1' | |
| 134 | + | |
| 135 | + //eventbus | |
| 136 | + eventbus = '3.1.1' | |
| 137 | + | |
| 138 | + //华为推送 | |
| 139 | + push = '2.6.0.301' | |
| 140 | + | |
| 141 | + //mvp 框架 | |
| 142 | + mvp = '3.0.4' | |
| 143 | + viewstate = '3.0.4' | |
| 144 | + mvpLce = '3.0.4' | |
| 145 | + mvpNullobjectPresenter = '3.0.4' | |
| 146 | + | |
| 147 | + //GSON | |
| 148 | + gson = '2.8.2' | |
| 149 | + | |
| 150 | + //greendao | |
| 151 | + greendao = '3.2.2' | |
| 152 | + | |
| 153 | + //retrofit2 | |
| 154 | + retrofit = '2.3.0' | |
| 155 | + converterGson = '2.3.0' | |
| 156 | + adapterRxjava2 = '2.3.0' | |
| 157 | + | |
| 158 | + //okhttp3 | |
| 159 | + okhttp = '3.9.0' | |
| 160 | + loggingInterceptor = '3.9.0' | |
| 161 | + | |
| 162 | + //rxJava | |
| 163 | + rxJava = "2.1.8" | |
| 164 | + rxAndroid = "2.0.1" | |
| 165 | + | |
| 166 | + //IM | |
| 167 | + imsdk = '3.3.2.14394.14395' | |
| 168 | + callsdk = '1.0.9' | |
| 169 | + //魅族推送 | |
| 170 | + pushInternal = '3.6.+@aar' | |
| 171 | + | |
| 172 | + //其他 | |
| 173 | + circleimageview = '2.1.0' | |
| 174 | + recyclerviewAnimators = '2.2.6' | |
| 175 | + TimePickerDialog = '1.0.1' | |
| 176 | + loadingviewlib = '1.0' | |
| 177 | + lottie = '2.7.0' | |
| 178 | + easypermissions = '1.0.0' | |
| 179 | + rotatephotoview = '1.0.5' | |
| 180 | + LargeImageView = '1.1.0' | |
| 181 | + magicindicator = '1.6.0' | |
| 182 | + libAudio = '1.0.1' | |
| 183 | + | |
| 184 | + appSubscription = "2.0.5" | |
| 185 | + eventBus = "3.1.1" | |
| 186 | + agentweb = '4.0.3-beta' | |
| 187 | + filechooser = '4.0.3-beta' | |
| 188 | + download = '4.0.3-beta' | |
| 189 | + | |
| 190 | + pedometer = "0.9.8" | |
| 191 | + avi = "2.1.3" | |
| 192 | + classification = "0.5.7" | |
| 193 | + | |
| 194 | + //友盟 | |
| 195 | + umsdk_analytics = "8.0.0" | |
| 196 | + umsdk_common = "2.0.0" | |
| 197 | + //小家音箱 | |
| 198 | + xiaojiaSoundBox="0.3.17" | |
| 199 | + //动画大全 | |
| 200 | + viewAnimationsEasing='2.0@aar' | |
| 201 | + viewAnimationsAndroid='2.3@aar' | |
| 202 | + //蓝牙 | |
| 203 | + BleLib="2.3.4" | |
| 204 | +} | ... | ... |
config.gradle
0 → 100644
| 1 | +++ a/config.gradle | |
| 1 | +ext { | |
| 2 | + //Nexus 访问账号 | |
| 3 | + nexusId = "developer" | |
| 4 | + nexusPw = "android_2019" | |
| 5 | + | |
| 6 | + //Nexus 发布配置 | |
| 7 | + maven = [ | |
| 8 | + //发布版地址(暂未使用) | |
| 9 | + mavenUrl : "http://android.nexus.cnlive.com/repository/cnlive/", | |
| 10 | + //快照版地址(暂未使用) | |
| 11 | + mavenDevUrl : "http://android.nexus.cnlive.com/repository/cnlive-snapshot/", | |
| 12 | + //混合版地址 | |
| 13 | + mavenMixedUrl : "http://android.nexus.cnlive.com/repository/cnlive-mixed/", | |
| 14 | + //发布账号(单独分配) | |
| 15 | + mavenUserName: "developer", | |
| 16 | + mavenPwd : "android_2019" | |
| 17 | + ] | |
| 18 | + | |
| 19 | + //Maven Base库配置 | |
| 20 | + moudle_user = [ | |
| 21 | + //编译方式 | |
| 22 | + debug : false, | |
| 23 | + //版本号 | |
| 24 | + version: "0.0.1", | |
| 25 | + //Lib库前缀 | |
| 26 | + packeg : "com.cnlive.module", | |
| 27 | + //Lib库名称 | |
| 28 | + name : "user" | |
| 29 | + ] | |
| 30 | +} | |
| 0 | 31 | \ No newline at end of file | ... | ... |
gradle.properties
0 → 100644
| 1 | +++ a/gradle.properties | |
| 1 | +# Project-wide Gradle settings. | |
| 2 | +# IDE (e.g. Android Studio) users: | |
| 3 | +# Gradle settings configured through the IDE *will override* | |
| 4 | +# any settings specified in this file. | |
| 5 | +# For more details on how to configure your build environment visit | |
| 6 | +# http://www.gradle.org/docs/current/userguide/build_environment.html | |
| 7 | +# Specifies the JVM arguments used for the daemon process. | |
| 8 | +# The setting is particularly useful for tweaking memory settings. | |
| 9 | +org.gradle.jvmargs=-Xmx1536m | |
| 10 | +# When configured, Gradle will run in incubating parallel mode. | |
| 11 | +# This option should only be used with decoupled projects. More details, visit | |
| 12 | +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | |
| 13 | +# org.gradle.parallel=true | |
| 14 | +# AndroidX package structure to make it clearer which packages are bundled with the | |
| 15 | +# Android operating system, and which are packaged with your app's APK | |
| 16 | +# https://developer.android.com/topic/libraries/support-library/androidx-rn | |
| 17 | +android.useAndroidX=false | |
| 18 | +# Automatically convert third-party libraries to use AndroidX | |
| 19 | +android.enableJetifier=false | |
| 20 | + | ... | ... |
gradle/wrapper/gradle-wrapper.jar
0 → 100644
No preview for this file type
gradle/wrapper/gradle-wrapper.properties
0 → 100644
| 1 | +++ a/gradle/wrapper/gradle-wrapper.properties | |
| 1 | +#Wed Oct 30 10:59:02 CST 2019 | |
| 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-5.4.1-all.zip | ... | ... |
gradlew
0 → 100644
| 1 | +++ a/gradlew | |
| 1 | +#!/usr/bin/env sh | |
| 2 | + | |
| 3 | +############################################################################## | |
| 4 | +## | |
| 5 | +## Gradle start up script for UN*X | |
| 6 | +## | |
| 7 | +############################################################################## | |
| 8 | + | |
| 9 | +# Attempt to set APP_HOME | |
| 10 | +# Resolve links: $0 may be a link | |
| 11 | +PRG="$0" | |
| 12 | +# Need this for relative symlinks. | |
| 13 | +while [ -h "$PRG" ] ; do | |
| 14 | + ls=`ls -ld "$PRG"` | |
| 15 | + link=`expr "$ls" : '.*-> \(.*\)$'` | |
| 16 | + if expr "$link" : '/.*' > /dev/null; then | |
| 17 | + PRG="$link" | |
| 18 | + else | |
| 19 | + PRG=`dirname "$PRG"`"/$link" | |
| 20 | + fi | |
| 21 | +done | |
| 22 | +SAVED="`pwd`" | |
| 23 | +cd "`dirname \"$PRG\"`/" >/dev/null | |
| 24 | +APP_HOME="`pwd -P`" | |
| 25 | +cd "$SAVED" >/dev/null | |
| 26 | + | |
| 27 | +APP_NAME="Gradle" | |
| 28 | +APP_BASE_NAME=`basename "$0"` | |
| 29 | + | |
| 30 | +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | |
| 31 | +DEFAULT_JVM_OPTS="" | |
| 32 | + | |
| 33 | +# Use the maximum available, or set MAX_FD != -1 to use that value. | |
| 34 | +MAX_FD="maximum" | |
| 35 | + | |
| 36 | +warn () { | |
| 37 | + echo "$*" | |
| 38 | +} | |
| 39 | + | |
| 40 | +die () { | |
| 41 | + echo | |
| 42 | + echo "$*" | |
| 43 | + echo | |
| 44 | + exit 1 | |
| 45 | +} | |
| 46 | + | |
| 47 | +# OS specific support (must be 'true' or 'false'). | |
| 48 | +cygwin=false | |
| 49 | +msys=false | |
| 50 | +darwin=false | |
| 51 | +nonstop=false | |
| 52 | +case "`uname`" in | |
| 53 | + CYGWIN* ) | |
| 54 | + cygwin=true | |
| 55 | + ;; | |
| 56 | + Darwin* ) | |
| 57 | + darwin=true | |
| 58 | + ;; | |
| 59 | + MINGW* ) | |
| 60 | + msys=true | |
| 61 | + ;; | |
| 62 | + NONSTOP* ) | |
| 63 | + nonstop=true | |
| 64 | + ;; | |
| 65 | +esac | |
| 66 | + | |
| 67 | +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar | |
| 68 | + | |
| 69 | +# Determine the Java command to use to start the JVM. | |
| 70 | +if [ -n "$JAVA_HOME" ] ; then | |
| 71 | + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | |
| 72 | + # IBM's JDK on AIX uses strange locations for the executables | |
| 73 | + JAVACMD="$JAVA_HOME/jre/sh/java" | |
| 74 | + else | |
| 75 | + JAVACMD="$JAVA_HOME/bin/java" | |
| 76 | + fi | |
| 77 | + if [ ! -x "$JAVACMD" ] ; then | |
| 78 | + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME | |
| 79 | + | |
| 80 | +Please set the JAVA_HOME variable in your environment to match the | |
| 81 | +location of your Java installation." | |
| 82 | + fi | |
| 83 | +else | |
| 84 | + JAVACMD="java" | |
| 85 | + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | |
| 86 | + | |
| 87 | +Please set the JAVA_HOME variable in your environment to match the | |
| 88 | +location of your Java installation." | |
| 89 | +fi | |
| 90 | + | |
| 91 | +# Increase the maximum file descriptors if we can. | |
| 92 | +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then | |
| 93 | + MAX_FD_LIMIT=`ulimit -H -n` | |
| 94 | + if [ $? -eq 0 ] ; then | |
| 95 | + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then | |
| 96 | + MAX_FD="$MAX_FD_LIMIT" | |
| 97 | + fi | |
| 98 | + ulimit -n $MAX_FD | |
| 99 | + if [ $? -ne 0 ] ; then | |
| 100 | + warn "Could not set maximum file descriptor limit: $MAX_FD" | |
| 101 | + fi | |
| 102 | + else | |
| 103 | + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" | |
| 104 | + fi | |
| 105 | +fi | |
| 106 | + | |
| 107 | +# For Darwin, add options to specify how the application appears in the dock | |
| 108 | +if $darwin; then | |
| 109 | + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" | |
| 110 | +fi | |
| 111 | + | |
| 112 | +# For Cygwin, switch paths to Windows format before running java | |
| 113 | +if $cygwin ; then | |
| 114 | + APP_HOME=`cygpath --path --mixed "$APP_HOME"` | |
| 115 | + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` | |
| 116 | + JAVACMD=`cygpath --unix "$JAVACMD"` | |
| 117 | + | |
| 118 | + # We build the pattern for arguments to be converted via cygpath | |
| 119 | + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` | |
| 120 | + SEP="" | |
| 121 | + for dir in $ROOTDIRSRAW ; do | |
| 122 | + ROOTDIRS="$ROOTDIRS$SEP$dir" | |
| 123 | + SEP="|" | |
| 124 | + done | |
| 125 | + OURCYGPATTERN="(^($ROOTDIRS))" | |
| 126 | + # Add a user-defined pattern to the cygpath arguments | |
| 127 | + if [ "$GRADLE_CYGPATTERN" != "" ] ; then | |
| 128 | + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" | |
| 129 | + fi | |
| 130 | + # Now convert the arguments - kludge to limit ourselves to /bin/sh | |
| 131 | + i=0 | |
| 132 | + for arg in "$@" ; do | |
| 133 | + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` | |
| 134 | + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option | |
| 135 | + | |
| 136 | + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition | |
| 137 | + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` | |
| 138 | + else | |
| 139 | + eval `echo args$i`="\"$arg\"" | |
| 140 | + fi | |
| 141 | + i=$((i+1)) | |
| 142 | + done | |
| 143 | + case $i in | |
| 144 | + (0) set -- ;; | |
| 145 | + (1) set -- "$args0" ;; | |
| 146 | + (2) set -- "$args0" "$args1" ;; | |
| 147 | + (3) set -- "$args0" "$args1" "$args2" ;; | |
| 148 | + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; | |
| 149 | + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; | |
| 150 | + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; | |
| 151 | + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; | |
| 152 | + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; | |
| 153 | + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; | |
| 154 | + esac | |
| 155 | +fi | |
| 156 | + | |
| 157 | +# Escape application args | |
| 158 | +save () { | |
| 159 | + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done | |
| 160 | + echo " " | |
| 161 | +} | |
| 162 | +APP_ARGS=$(save "$@") | |
| 163 | + | |
| 164 | +# Collect all arguments for the java command, following the shell quoting and substitution rules | |
| 165 | +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" | |
| 166 | + | |
| 167 | +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong | |
| 168 | +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then | |
| 169 | + cd "$(dirname "$0")" | |
| 170 | +fi | |
| 171 | + | |
| 172 | +exec "$JAVACMD" "$@" | ... | ... |
gradlew.bat
0 → 100644
| 1 | +++ a/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 | +set DIRNAME=%~dp0 | |
| 12 | +if "%DIRNAME%" == "" set DIRNAME=. | |
| 13 | +set APP_BASE_NAME=%~n0 | |
| 14 | +set APP_HOME=%DIRNAME% | |
| 15 | + | |
| 16 | +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | |
| 17 | +set DEFAULT_JVM_OPTS= | |
| 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 Windows variants | |
| 50 | + | |
| 51 | +if not "%OS%" == "Windows_NT" goto win9xME_args | |
| 52 | + | |
| 53 | +:win9xME_args | |
| 54 | +@rem Slurp the command line arguments. | |
| 55 | +set CMD_LINE_ARGS= | |
| 56 | +set _SKIP=2 | |
| 57 | + | |
| 58 | +:win9xME_args_slurp | |
| 59 | +if "x%~1" == "x" goto execute | |
| 60 | + | |
| 61 | +set CMD_LINE_ARGS=%* | |
| 62 | + | |
| 63 | +:execute | |
| 64 | +@rem Setup the command line | |
| 65 | + | |
| 66 | +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | |
| 67 | + | |
| 68 | +@rem Execute Gradle | |
| 69 | +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% | |
| 70 | + | |
| 71 | +:end | |
| 72 | +@rem End local scope for the variables with windows NT shell | |
| 73 | +if "%ERRORLEVEL%"=="0" goto mainEnd | |
| 74 | + | |
| 75 | +:fail | |
| 76 | +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | |
| 77 | +rem the _cmd.exe /c_ return code! | |
| 78 | +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 | |
| 79 | +exit /b 1 | |
| 80 | + | |
| 81 | +:mainEnd | |
| 82 | +if "%OS%"=="Windows_NT" endlocal | |
| 83 | + | |
| 84 | +:omega | ... | ... |
moudle_user/.gitignore
0 → 100644
moudle_user/build.gradle
0 → 100644
| 1 | +++ a/moudle_user/build.gradle | |
| 1 | +apply plugin: 'com.android.library' | |
| 2 | +apply from: './maven_push.gradle' | |
| 3 | +android { | |
| 4 | + compileSdkVersion rootProject.ext.compileSdkVersion | |
| 5 | + buildToolsVersion rootProject.ext.buildToolsVersion | |
| 6 | + | |
| 7 | + | |
| 8 | + defaultConfig { | |
| 9 | + minSdkVersion rootProject.ext.minSdkVersion | |
| 10 | + targetSdkVersion rootProject.ext.targetSdkVersion | |
| 11 | + versionCode rootProject.ext.versionCode | |
| 12 | + versionName rootProject.ext.versionName | |
| 13 | + javaCompileOptions { | |
| 14 | + annotationProcessorOptions { | |
| 15 | + arguments = [AROUTER_MODULE_NAME: project.getName(), AROUTER_GENERATE_DOC: "enable"] | |
| 16 | + } | |
| 17 | + } | |
| 18 | + } | |
| 19 | + compileOptions { | |
| 20 | + sourceCompatibility JavaVersion.VERSION_1_8 | |
| 21 | + targetCompatibility JavaVersion.VERSION_1_8 | |
| 22 | + } | |
| 23 | + | |
| 24 | + buildTypes { | |
| 25 | + debug { | |
| 26 | + resValue("string", "ACCOUNT_LABEL", "网家家 内测") | |
| 27 | + resValue("string", "ACCOUNT_TYPE", "com.c nlive.strike.debug.AccountType") | |
| 28 | + resValue("string", "ACCOUNT_PROVIDE", "com.cnlive.strike.debug.AccountProvide") | |
| 29 | + | |
| 30 | + zipAlignEnabled true | |
| 31 | + buildConfigField("String", "QQ_SHARE", stringValue("1106866745")) | |
| 32 | + buildConfigField("String", "WECHAT_SHARE", stringValue("wx9b7f9443a8ccf15a")) | |
| 33 | + buildConfigField("String", "WECHAT_KEY", stringValue("8d9970bf2901411d8dd2bffb344f147e")) | |
| 34 | + buildConfigField("String", "SEND_AUTH_REQ_STATE", stringValue("com_cnlive_strike_debug")) | |
| 35 | + manifestPlaceholders = [ | |
| 36 | + QQ_APPKEY: "tencent1106866745" | |
| 37 | + ] | |
| 38 | + } | |
| 39 | + release { | |
| 40 | + resValue("string", "ACCOUNT_LABEL", "网家家") | |
| 41 | + resValue("string", "ACCOUNT_TYPE", "com.cnlive.strike.AccountType") | |
| 42 | + resValue("string", "ACCOUNT_PROVIDE", "com.cnlive.strike.AccountProvide") | |
| 43 | + minifyEnabled false | |
| 44 | + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |
| 45 | + | |
| 46 | + zipAlignEnabled true | |
| 47 | + buildConfigField("String", "QQ_SHARE", stringValue("1106691520")) | |
| 48 | + buildConfigField("String", "WECHAT_SHARE", stringValue("wxed528fc749b7ee88")) | |
| 49 | + buildConfigField("String", "WECHAT_KEY", stringValue("729c3d3055fe336bcdef7020c2548e89")) | |
| 50 | + buildConfigField("String", "SEND_AUTH_REQ_STATE", stringValue("com_cnlive_strike")) | |
| 51 | + manifestPlaceholders = [ | |
| 52 | + QQ_APPKEY: "tencent1106691520" | |
| 53 | + ] | |
| 54 | + } | |
| 55 | + } | |
| 56 | + dataBinding { | |
| 57 | + enabled true | |
| 58 | + } | |
| 59 | +} | |
| 60 | + | |
| 61 | +static def stringValue(def value) { | |
| 62 | + return "\"${value}\"" | |
| 63 | +} | |
| 64 | + | |
| 65 | +dependencies { | |
| 66 | + implementation fileTree(include: ['*.jar'], dir: 'libs') | |
| 67 | +// implementation "com.android.support:support-v4:$rootProject.supportV4" | |
| 68 | + implementation "com.android.support:appcompat-v7:$rootProject.appcompatV7" | |
| 69 | + implementation "com.android.support:design:$rootProject.design" | |
| 70 | + implementation "com.android.support:support-v13:$rootProject.supportV13" | |
| 71 | + implementation "com.android.support:recyclerview-v7:$rootProject.recyclerviewV7" | |
| 72 | + | |
| 73 | + //ARouter | |
| 74 | + implementation "com.alibaba:arouter-api:$rootProject.arouterApiVersion" | |
| 75 | + implementation 'com.android.support.constraint:constraint-layout:1.1.3' | |
| 76 | + annotationProcessor "com.alibaba:arouter-compiler:$rootProject.arouterCompilerVersion" | |
| 77 | + | |
| 78 | + //base | |
| 79 | + implementation "com.cnlive.libs:base:$rootProject.libBase" | |
| 80 | + api "com.cnlive.libs:network:$rootProject.libNetwork" | |
| 81 | + | |
| 82 | + //CNLive Encipher | |
| 83 | + implementation "com.cnlive:lib-cnencipher:$rootProject.libCnencipher" | |
| 84 | + implementation "com.cnlive:lib_cnutil:$rootProject.libCnUtil" | |
| 85 | + | |
| 86 | + //UI框架库 (http://qmuiteam.com/android/page/document.html) | |
| 87 | + implementation "com.qmuiteam:qmui:$rootProject.qmui" | |
| 88 | + implementation "com.cnlive.libs:arch:$rootProject.appArch" | |
| 89 | + | |
| 90 | + //腾讯 | |
| 91 | + api files('libs/open_sdk_r6008_lite.jar') | |
| 92 | + | |
| 93 | + //微博 | |
| 94 | + implementation 'com.sina.weibo.sdk:core:4.4.1:openDefaultRelease@aar' | |
| 95 | + | |
| 96 | + //微信 | |
| 97 | + implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:5.3.1' | |
| 98 | + | |
| 99 | + //IM | |
| 100 | + api "com.tencent.imsdk:imsdk:$rootProject.imsdk" | |
| 101 | + | |
| 102 | + //图片选择器 | |
| 103 | + implementation "com.cnlive.libs:mediapicker:$rootProject.libMediaPicker" | |
| 104 | + | |
| 105 | + implementation "com.cnlive.libs:emoj:$rootProject.libEmoj" | |
| 106 | + | |
| 107 | + implementation files('libs/pinyin4j-2.5.0.jar') | |
| 108 | + | |
| 109 | + //glide | |
| 110 | + implementation "com.github.bumptech.glide:glide:$rootProject.glide" | |
| 111 | + implementation "jp.wasabeef:glide-transformations:$rootProject.glideTransformations" | |
| 112 | + implementation "com.android.support.constraint:constraint-layout:$rootProject.constraintLayout" | |
| 113 | + annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.compiler" | |
| 114 | + | |
| 115 | + // eventbus | |
| 116 | + implementation "org.greenrobot:eventbus:$rootProject.eventBus" | |
| 117 | +} | ... | ... |
moudle_user/consumer-rules.pro
0 → 100644
| 1 | +++ a/moudle_user/consumer-rules.pro | ... | ... |
moudle_user/libs/open_sdk_r6008_lite.jar
0 → 100644
No preview for this file type
moudle_user/libs/pinyin4j-2.5.0.jar
0 → 100644
No preview for this file type
moudle_user/maven_push.gradle
0 → 100644
| 1 | +++ a/moudle_user/maven_push.gradle | |
| 1 | +apply plugin: 'maven' | |
| 2 | + | |
| 3 | +uploadArchives() { | |
| 4 | + repositories { | |
| 5 | + mavenDeployer { | |
| 6 | + def lib = moudle_user | |
| 7 | + //发布环境(正式/测试) | |
| 8 | + android.defaultPublishConfig lib.debug ? "debug" : "release" | |
| 9 | + //发布渠道(地址/账号) | |
| 10 | + repository(url: maven.mavenMixedUrl) { | |
| 11 | + authentication(userName: maven.mavenUserName, password: maven.mavenPwd) | |
| 12 | + } | |
| 13 | + //发布信息(包名/别名/版本) | |
| 14 | + pom.project { | |
| 15 | + groupId lib.packeg | |
| 16 | + artifactId lib.name | |
| 17 | + version = lib.debug ? lib.version.concat("-SNAPSHOT") : lib.version | |
| 18 | + } | |
| 19 | + pom.whenConfigured { pom -> | |
| 20 | + pom.dependencies.clear() | |
| 21 | + } | |
| 22 | + | |
| 23 | + } | |
| 24 | + } | |
| 25 | +} | |
| 0 | 26 | \ No newline at end of file | ... | ... |
moudle_user/proguard-rules.pro
0 → 100644
| 1 | +++ a/moudle_user/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 | ... | ... |
moudle_user/src/androidTest/java/com/cnlive/strike/moudle_user/ExampleInstrumentedTest.java
0 → 100644
| 1 | +++ a/moudle_user/src/androidTest/java/com/cnlive/strike/moudle_user/ExampleInstrumentedTest.java | |
| 1 | +package com.cnlive.strike.moudle_user; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | + | |
| 5 | +import androidx.test.platform.app.InstrumentationRegistry; | |
| 6 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | |
| 7 | + | |
| 8 | +import org.junit.Test; | |
| 9 | +import org.junit.runner.RunWith; | |
| 10 | + | |
| 11 | +import static org.junit.Assert.*; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Instrumented test, which will execute on an Android device. | |
| 15 | + * | |
| 16 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | |
| 17 | + */ | |
| 18 | +@RunWith(AndroidJUnit4.class) | |
| 19 | +public class ExampleInstrumentedTest { | |
| 20 | + @Test | |
| 21 | + public void useAppContext() { | |
| 22 | + // Context of the app under test. | |
| 23 | + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | |
| 24 | + | |
| 25 | + assertEquals("com.cnlive.strike.moudle_user.test", appContext.getPackageName()); | |
| 26 | + } | |
| 27 | +} | ... | ... |
moudle_user/src/debug/res/mipmap-hdpi/icon_account.png
0 → 100644
4.41 KB
moudle_user/src/debug/res/mipmap-ldpi/icon_account.png
0 → 100644
2.17 KB
moudle_user/src/debug/res/mipmap-xhdpi/icon_account.png
0 → 100644
5.93 KB
moudle_user/src/debug/res/mipmap-xxhdpi/icon_account.png
0 → 100644
9.25 KB
moudle_user/src/debug/res/mipmap-xxxhdpi/icon_account.png
0 → 100644
13.2 KB
moudle_user/src/main/AndroidManifest.xml
0 → 100644
| 1 | +++ a/moudle_user/src/main/AndroidManifest.xml | |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + xmlns:tools="http://schemas.android.com/tools" | |
| 4 | + package="com.cnlive.strike.moudle_user"> | |
| 5 | + | |
| 6 | + <uses-permission android:name="android.permission.INTERNET" /> | |
| 7 | + | |
| 8 | + <!-- for mta statistics, not necessary--> | |
| 9 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | |
| 10 | + <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | |
| 11 | + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | |
| 12 | + <uses-permission | |
| 13 | + android:name="android.permission.AUTHENTICATE_ACCOUNTS" | |
| 14 | + android:maxSdkVersion="22" /> | |
| 15 | + <uses-permission | |
| 16 | + android:name="android.permission.GET_ACCOUNTS" | |
| 17 | + android:maxSdkVersion="22" /> | |
| 18 | + <uses-permission | |
| 19 | + android:name="android.permission.MANAGE_ACCOUNTS" | |
| 20 | + android:maxSdkVersion="22" /> | |
| 21 | + <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /> <!-- 账户自动更新 App保活相关 --> | |
| 22 | + <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /> | |
| 23 | + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | |
| 24 | + <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> | |
| 25 | + <uses-permission android:name="android.permission.ACTION_LIGHT_DEVICE_IDLE_MODE_CHANGED" /> | |
| 26 | + <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 账户权限相关 --> | |
| 27 | + <uses-permission | |
| 28 | + android:name="android.permission.INTERACT_ACROSS_USERS_FULL" | |
| 29 | + tools:ignore="ProtectedPermissions" /> | |
| 30 | + <uses-permission | |
| 31 | + android:name="android.permission.ACCOUNT_MANAGER" | |
| 32 | + tools:ignore="ProtectedPermissions" /> | |
| 33 | + <uses-permission android:name="android.permission.INTERNET" /> | |
| 34 | + | |
| 35 | + <application android:largeHeap="true"> | |
| 36 | + <meta-data | |
| 37 | + android:name="WEIBO_APPKEY" | |
| 38 | + android:value="3884700821" /> | |
| 39 | + <meta-data | |
| 40 | + android:name="WEIBO_CHANNEL" | |
| 41 | + android:value="weibo" /> | |
| 42 | + | |
| 43 | + <activity android:name="com.cnlive.strike.moudle.user.ui.activity.MainTestActivity" /> | |
| 44 | + <activity | |
| 45 | + android:name="com.cnlive.strike.moudle.user.ui.activity.LoginActivity" | |
| 46 | + android:configChanges="keyboardHidden|screenSize|orientation|smallestScreenSize|screenLayout" | |
| 47 | + android:launchMode="singleTop" | |
| 48 | + android:screenOrientation="portrait" | |
| 49 | + android:windowSoftInputMode="stateHidden|adjustPan"> | |
| 50 | + <intent-filter> | |
| 51 | + <action android:name="android.accounts.AccountAuthenticator" /> | |
| 52 | + </intent-filter> | |
| 53 | + </activity> | |
| 54 | + <activity | |
| 55 | + android:name="com.tencent.connect.common.AssistActivity" | |
| 56 | + android:configChanges="orientation|keyboardHidden|screenSize" | |
| 57 | + android:theme="@android:style/Theme.Translucent.NoTitleBar" /> | |
| 58 | + <activity | |
| 59 | + android:name="com.tencent.tauth.AuthActivity" | |
| 60 | + android:launchMode="singleTop" | |
| 61 | + android:noHistory="true"> | |
| 62 | + <intent-filter> | |
| 63 | + <action android:name="android.intent.action.VIEW" /> | |
| 64 | + | |
| 65 | + <category android:name="android.intent.category.DEFAULT" /> | |
| 66 | + <category android:name="android.intent.category.BROWSABLE" /> | |
| 67 | + | |
| 68 | + <data android:scheme="${QQ_APPKEY}" /> | |
| 69 | + </intent-filter> | |
| 70 | + </activity> | |
| 71 | + | |
| 72 | + <activity | |
| 73 | + android:name="com.cnlive.strike.moudle.user.ui.activity.BindPhoneNumberActivity" | |
| 74 | + android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" | |
| 75 | + android:launchMode="singleTop" | |
| 76 | + android:screenOrientation="portrait" /> | |
| 77 | + <activity | |
| 78 | + android:name="com.cnlive.strike.moudle.user.ui.activity.FirstLoginActivity" | |
| 79 | + android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" | |
| 80 | + android:launchMode="singleTop" | |
| 81 | + android:screenOrientation="portrait" /> | |
| 82 | + <activity | |
| 83 | + android:name="com.cnlive.strike.moudle.user.ui.activity.SelectCountryActivity" | |
| 84 | + android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" | |
| 85 | + android:launchMode="singleTask" | |
| 86 | + android:screenOrientation="portrait" | |
| 87 | + android:windowSoftInputMode="adjustResize" /> | |
| 88 | + <activity | |
| 89 | + android:name="com.cnlive.strike.debug.wxapi.WXEntryActivity" | |
| 90 | + android:exported="true" | |
| 91 | + android:label="@string/app_name" | |
| 92 | + android:launchMode="singleTop" | |
| 93 | + android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" /> | |
| 94 | + <!-- 个人资料页--> | |
| 95 | + <activity | |
| 96 | + android:name="com.cnlive.strike.moudle.user.ui.activity.PersonalDataActivity" | |
| 97 | + android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" | |
| 98 | + android:launchMode="singleTop" | |
| 99 | + android:screenOrientation="portrait" /> | |
| 100 | + <!--预览头像--> | |
| 101 | + <activity | |
| 102 | + android:name="com.cnlive.strike.moudle.user.ui.activity.PersonalImageActivity" | |
| 103 | + android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | |
| 104 | + android:launchMode="singleTop" | |
| 105 | + android:screenOrientation="portrait" /> | |
| 106 | + <!-- 个人资料姓名--> | |
| 107 | + <activity | |
| 108 | + android:name="com.cnlive.strike.moudle.user.ui.activity.UpdateContentActivity" | |
| 109 | + android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" | |
| 110 | + android:launchMode="singleTop" | |
| 111 | + android:screenOrientation="portrait" | |
| 112 | + android:windowSoftInputMode="stateVisible|adjustPan" /> | |
| 113 | +<!-- 个人签名--> | |
| 114 | + <activity | |
| 115 | + android:name="com.cnlive.strike.moudle.user.ui.activity.SignatureActivity" | |
| 116 | + android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" | |
| 117 | + android:launchMode="singleTop" | |
| 118 | + android:screenOrientation="portrait" | |
| 119 | + android:windowSoftInputMode="stateVisible|adjustPan" /> | |
| 120 | + </application> | |
| 121 | + | |
| 122 | +</manifest> | |
| 0 | 123 | \ No newline at end of file | ... | ... |
moudle_user/src/main/java/com/cnlive/share/arouter/ARouterUtil.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/share/arouter/ARouterUtil.java | |
| 1 | +package com.cnlive.share.arouter; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | + | |
| 5 | +import com.alibaba.android.arouter.launcher.ARouter; | |
| 6 | +import com.cnlive.libs.base.util.SharedPreferencesHelper; | |
| 7 | +import com.cnlive.strike.user.auth.UserService; | |
| 8 | +import com.cnlive.strike.util.HelperUtil; | |
| 9 | + | |
| 10 | +public class ARouterUtil { | |
| 11 | + /** | |
| 12 | + * 分享完成 增加积分 | |
| 13 | + */ | |
| 14 | + public static void addIntegrationPic(Context context, String taskId, String contentId, String addtype) { | |
| 15 | + Boolean app_is_show_integral = SharedPreferencesHelper.getInstance(context).getBoolValue("APP_IS_SHOW_INTEGRAL"); | |
| 16 | + if (app_is_show_integral) { | |
| 17 | + HelperUtil.goToCoinRainAction(context, taskId, contentId, addtype,false); | |
| 18 | +// CoinRainAction.code(context, UserService.getUid(context), taskId, contentId, addtype,false); | |
| 19 | + } | |
| 20 | + } | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 打开举报的h5页面 | |
| 24 | + * | |
| 25 | + * @param context | |
| 26 | + * @param url | |
| 27 | + */ | |
| 28 | + public static void startReportActivity(Context context, String url) { | |
| 29 | + ARouter.getInstance().build("/web/WebViewActivity") | |
| 30 | + .withString("rUrl", url) | |
| 31 | + .navigation(context); | |
| 32 | + } | |
| 33 | + | |
| 34 | + | |
| 35 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/share/data/FullVideoShareItemData.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/share/data/FullVideoShareItemData.java | |
| 1 | +package com.cnlive.share.data; | |
| 2 | + | |
| 3 | +public class FullVideoShareItemData { | |
| 4 | + | |
| 5 | + public static final int TYPE_WEIXIN = 0X1001; | |
| 6 | + public static final int TYPE_PENG_YOU_QUAN = 0X1002; | |
| 7 | + public static final int TYPE_WJJ = 0X1003; | |
| 8 | + public static final int TYPE_WJJ_QUAN = 0X1004; | |
| 9 | + public static final int TYPE_QQ = 0X1005; | |
| 10 | + public static final int TYPE_BROWSER = 0X1006; | |
| 11 | + public static final int TYPE_WEIBO = 0X1007; | |
| 12 | + | |
| 13 | + private int iconId; | |
| 14 | + private String title; | |
| 15 | + private int type; | |
| 16 | + | |
| 17 | + public FullVideoShareItemData(int iconId, String title, int type) { | |
| 18 | + this.iconId = iconId; | |
| 19 | + this.title = title; | |
| 20 | + this.type = type; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public int getIconId() { | |
| 24 | + return iconId; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public void setIconId(int iconId) { | |
| 28 | + this.iconId = iconId; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public String getTitle() { | |
| 32 | + return title; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setTitle(String title) { | |
| 36 | + this.title = title; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public int getType() { | |
| 40 | + return type; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setType(int type) { | |
| 44 | + this.type = type; | |
| 45 | + } | |
| 46 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/share/data/IconInfo.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/share/data/IconInfo.java | |
| 1 | +package com.cnlive.share.data; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by Lynn on 2018/8/23. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +public class IconInfo { | |
| 8 | + public static final String WJJ_FRIEND = "wjj_friend";//网家家好友 | |
| 9 | + public static final String WJJ_CIRCLE = "wjj_circle";//网家家生活圈 | |
| 10 | + public static final String WECHAT_FRIEND = "weChat_friend";//微信好友 | |
| 11 | + public static final String WECHAT_CIRCLE = "weChat_circle";//微信朋友圈 | |
| 12 | + public static final String QQ = "qq";//qq | |
| 13 | + public static final String WEBO = "webo";//微博 | |
| 14 | + public static final String BROWSER = "browser";//浏览器打开 | |
| 15 | + public static final String REPORT = "report"; //举报 | |
| 16 | + public static final String DOWNLOAD_ALBUM_IMG = "down_album_img"; | |
| 17 | + private String id; | |
| 18 | + private String title; | |
| 19 | + private int icon; | |
| 20 | + | |
| 21 | + public IconInfo(String id, String title, int icon) { | |
| 22 | + this.id = id; | |
| 23 | + this.title = title; | |
| 24 | + this.icon = icon; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public String getId() { | |
| 28 | + return id; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setId(String id) { | |
| 32 | + this.id = id; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public String getTitle() { | |
| 36 | + return title; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public void setTitle(String title) { | |
| 40 | + this.title = title; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public int getIcon() { | |
| 44 | + return icon; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public void setIcon(int icon) { | |
| 48 | + this.icon = icon; | |
| 49 | + } | |
| 50 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/share/data/ShareInfo.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/share/data/ShareInfo.java | |
| 1 | +package com.cnlive.share.data; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 创建:wukuiqing | |
| 5 | + * <p> | |
| 6 | + * 时间:2017/11/13 | |
| 7 | + * <p> | |
| 8 | + * 描述:分享的 数据类型 | |
| 9 | + */ | |
| 10 | + | |
| 11 | +public class ShareInfo { | |
| 12 | + //分享的标题 | |
| 13 | + private String title; | |
| 14 | + //分享的简介 | |
| 15 | + private String content; | |
| 16 | + //分享的图片 | |
| 17 | + private String imgurl; | |
| 18 | + private String siteUrl; | |
| 19 | + //分享的Url | |
| 20 | + private String url; | |
| 21 | + //分享的类型 (默认: share_article 积分用) | |
| 22 | + private String shareType; | |
| 23 | + //分享的内容id | |
| 24 | + private String contentId; | |
| 25 | + //兼容低版本的网页链接 | |
| 26 | + private String webpageUrl; | |
| 27 | + //小程序原始id 示例(gh_d43f693ca31f); | |
| 28 | + private String userName; | |
| 29 | + //小程序页面路径 示例 ("/pages/media") | |
| 30 | + private String path; | |
| 31 | + //(int类型) 正式版:0,测试版:1,体验版:2 | |
| 32 | + private int miniprogramType; | |
| 33 | + // 1:目击者 2:生活圈 3:H5 4:点播 5:直播 | |
| 34 | + | |
| 35 | + //举报类型 | |
| 36 | + private String reportType; | |
| 37 | + //是否展示投诉的页面 | |
| 38 | + public boolean isReport; | |
| 39 | + | |
| 40 | + //是否是网家家生活圈内容的分享 | |
| 41 | + private boolean isProcessWjjShare; | |
| 42 | + | |
| 43 | + //网家家分享区分外部内部时 内部用的url | |
| 44 | + private String wjjShareUrl; | |
| 45 | + | |
| 46 | + | |
| 47 | + public boolean isProcessWjjShare() { | |
| 48 | + return isProcessWjjShare; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setProcessWjjShare(boolean processWjjShare) { | |
| 52 | + isProcessWjjShare = processWjjShare; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public String getWjjShareUrl() { | |
| 56 | + return wjjShareUrl; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public void setWjjShareUrl(String wjjShareUrl) { | |
| 60 | + this.wjjShareUrl = wjjShareUrl; | |
| 61 | + } | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + public String getReportType() { | |
| 66 | + return reportType; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setReportType(String reportType) { | |
| 70 | + this.reportType = reportType; | |
| 71 | + } | |
| 72 | + | |
| 73 | + | |
| 74 | + public String getWebpageUrl() { | |
| 75 | + return webpageUrl; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public void setWebpageUrl(String webpageUrl) { | |
| 79 | + this.webpageUrl = webpageUrl; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public String getUserName() { | |
| 83 | + return userName; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public void setUserName(String userName) { | |
| 87 | + this.userName = userName; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public String getPath() { | |
| 91 | + return path; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public void setPath(String path) { | |
| 95 | + this.path = path; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public int getMiniprogramType() { | |
| 99 | + return miniprogramType; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public void setMiniprogramType(int miniprogramType) { | |
| 103 | + this.miniprogramType = miniprogramType; | |
| 104 | + } | |
| 105 | + | |
| 106 | + | |
| 107 | + public String getShareType() { | |
| 108 | + return shareType; | |
| 109 | + } | |
| 110 | + | |
| 111 | + public void setShareType(String shareType) { | |
| 112 | + if (shareType == null) { | |
| 113 | + shareType = "share_article"; | |
| 114 | + } | |
| 115 | + this.shareType = shareType; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public String getContentId() { | |
| 119 | + return contentId; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public void setContentId(String contentId) { | |
| 123 | + if (contentId == null) { | |
| 124 | + contentId = ""; | |
| 125 | + } | |
| 126 | + this.contentId = contentId; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public String getTitle() { | |
| 130 | + return title; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public void setTitle(String title) { | |
| 134 | + if (title != null && title.length() >= 200) | |
| 135 | + title = title.substring(0, 200); | |
| 136 | + | |
| 137 | + this.title = title; | |
| 138 | + } | |
| 139 | + | |
| 140 | + public String getContent() { | |
| 141 | + return content; | |
| 142 | + } | |
| 143 | + | |
| 144 | + public void setContent(String content) { | |
| 145 | + if (content != null && content.length() >= 200) | |
| 146 | + content = content.substring(0, 200); | |
| 147 | + | |
| 148 | + this.content = content; | |
| 149 | + } | |
| 150 | + | |
| 151 | + public String getImgurl() { | |
| 152 | + return imgurl; | |
| 153 | + } | |
| 154 | + | |
| 155 | + public void setImgurl(String imgurl) { | |
| 156 | + this.imgurl = imgurl; | |
| 157 | + } | |
| 158 | + | |
| 159 | + public String getSiteUrl() { | |
| 160 | + return siteUrl; | |
| 161 | + } | |
| 162 | + | |
| 163 | + public void setSiteUrl(String siteUrl) { | |
| 164 | + this.siteUrl = siteUrl; | |
| 165 | + } | |
| 166 | + | |
| 167 | + public String getUrl() { | |
| 168 | + return url; | |
| 169 | + } | |
| 170 | + | |
| 171 | + public void setUrl(String url) { | |
| 172 | + this.url = url; | |
| 173 | + } | |
| 174 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/share/data/ShareIntegralTypeInfo.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/share/data/ShareIntegralTypeInfo.java | |
| 1 | +package com.cnlive.share.data; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 作者: 吴奎庆 | |
| 5 | + * <p> | |
| 6 | + * 时间: 2019/3/9 | |
| 7 | + * <p> | |
| 8 | + * 简介: 分享 | |
| 9 | + */ | |
| 10 | +public class ShareIntegralTypeInfo { | |
| 11 | + public String getShareType() { | |
| 12 | + return shareType; | |
| 13 | + } | |
| 14 | + | |
| 15 | + public void setShareType(String shareType) { | |
| 16 | + this.shareType = shareType; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public String getContentId() { | |
| 20 | + return contentId; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setContentId(String contentId) { | |
| 24 | + this.contentId = contentId; | |
| 25 | + } | |
| 26 | + | |
| 27 | + private String shareType; | |
| 28 | + private String contentId; | |
| 29 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/share/data/WeChatInfo.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/share/data/WeChatInfo.java | |
| 1 | +package com.cnlive.share.data; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 作者: 吴奎庆 | |
| 5 | + * <p> | |
| 6 | + * 时间: 2019/8/30 | |
| 7 | + * <p> | |
| 8 | + * 简介: | |
| 9 | + */ | |
| 10 | + | |
| 11 | +public class WeChatInfo { | |
| 12 | + private int errCode; | |
| 13 | + | |
| 14 | + private String openid; | |
| 15 | + | |
| 16 | + //普通用户性别,1为男性,2为女性 | |
| 17 | + private int sex; | |
| 18 | + | |
| 19 | + private String nickname; | |
| 20 | + | |
| 21 | + private String headimgurl; | |
| 22 | + | |
| 23 | + private String province; | |
| 24 | + | |
| 25 | + private String language; | |
| 26 | + | |
| 27 | + private String country; | |
| 28 | + | |
| 29 | + private String unionid; | |
| 30 | + | |
| 31 | + public String getOpenid() { | |
| 32 | + return openid; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setOpenid(String openid) { | |
| 36 | + this.openid = openid; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public String getNickname() { | |
| 40 | + return nickname; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setNickname(String nickname) { | |
| 44 | + this.nickname = nickname; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public String getHeadimgurl() { | |
| 48 | + return headimgurl; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setHeadimgurl(String headimgurl) { | |
| 52 | + this.headimgurl = headimgurl; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public String getSex() { | |
| 56 | + return "" + sex; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public String getProvince() { | |
| 60 | + return province; | |
| 61 | + } | |
| 62 | + | |
| 63 | + public void setProvince(String province) { | |
| 64 | + this.province = province; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public String getLanguage() { | |
| 68 | + return language; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public void setLanguage(String language) { | |
| 72 | + this.language = language; | |
| 73 | + } | |
| 74 | + | |
| 75 | + public String getCountry() { | |
| 76 | + return country; | |
| 77 | + } | |
| 78 | + | |
| 79 | + public void setCountry(String country) { | |
| 80 | + this.country = country; | |
| 81 | + } | |
| 82 | + | |
| 83 | + public String getUnionid() { | |
| 84 | + return unionid; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public void setUnionid(String unionid) { | |
| 88 | + this.unionid = unionid; | |
| 89 | + } | |
| 90 | + | |
| 91 | + public void setSex(int sex) { | |
| 92 | + this.sex = sex; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public int getErrCode() { | |
| 96 | + return errCode; | |
| 97 | + } | |
| 98 | + | |
| 99 | + public void setErrCode(int errCode) { | |
| 100 | + this.errCode = errCode; | |
| 101 | + } | |
| 102 | + | |
| 103 | + @Override | |
| 104 | + public String toString() { | |
| 105 | + return "WeChatInfo{" + | |
| 106 | + "errCode='" + errCode + '\'' + | |
| 107 | + ", openid='" + openid + '\'' + | |
| 108 | + ", sex=" + sex + | |
| 109 | + ", nickname='" + nickname + '\'' + | |
| 110 | + ", headimgurl='" + headimgurl + '\'' + | |
| 111 | + ", province='" + province + '\'' + | |
| 112 | + ", language='" + language + '\'' + | |
| 113 | + ", country='" + country + '\'' + | |
| 114 | + ", unionid='" + unionid + '\'' + | |
| 115 | + '}'; | |
| 116 | + } | |
| 117 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/share/observable/ShareClickObservable.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/share/observable/ShareClickObservable.java | |
| 1 | +package com.cnlive.share.observable; | |
| 2 | + | |
| 3 | +import java.util.Observable; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 作者: 吴奎庆 | |
| 7 | + * <p> | |
| 8 | + * 时间: 2019/9/25 | |
| 9 | + * <p> | |
| 10 | + * 简介: 分享点击的观察者 | |
| 11 | + */ | |
| 12 | +public class ShareClickObservable extends Observable { | |
| 13 | + | |
| 14 | + private static ShareClickObservable instance; | |
| 15 | + | |
| 16 | + public static ShareClickObservable getInstance() { | |
| 17 | + | |
| 18 | + synchronized (ShareClickObservable.class) { | |
| 19 | + if (instance == null) { | |
| 20 | + instance = new ShareClickObservable(); | |
| 21 | + } | |
| 22 | + } | |
| 23 | + return instance; | |
| 24 | + } | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * @param type 1 网家家好友 2 网家家生活圈 3 微信好友 4 微信朋友圈 5 qq 6 微博 7 外部 8 举报 | |
| 28 | + */ | |
| 29 | + public void update(int type) { | |
| 30 | + setChanged(); | |
| 31 | + notifyObservers(type); | |
| 32 | + } | |
| 33 | + | |
| 34 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/share/observable/WechatLoginObservable.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/share/observable/WechatLoginObservable.java | |
| 1 | +package com.cnlive.share.observable; | |
| 2 | + | |
| 3 | +import com.cnlive.share.data.WeChatInfo; | |
| 4 | + | |
| 5 | +import java.util.Observable; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 作者: 吴奎庆 | |
| 9 | + * <p> | |
| 10 | + * 时间: 2019/9/10 | |
| 11 | + * <p> | |
| 12 | + * 简介: 微信三方登陆的观察者 | |
| 13 | + * | |
| 14 | + */ | |
| 15 | +public class WechatLoginObservable extends Observable { | |
| 16 | + static WechatLoginObservable wechatLoginObservable; | |
| 17 | + | |
| 18 | + public static WechatLoginObservable getInstance() { | |
| 19 | + if (wechatLoginObservable == null) | |
| 20 | + synchronized (WechatLoginObservable.class) { | |
| 21 | + if (wechatLoginObservable == null) | |
| 22 | + wechatLoginObservable = new WechatLoginObservable(); | |
| 23 | + } | |
| 24 | + return wechatLoginObservable; | |
| 25 | + } | |
| 26 | + | |
| 27 | + | |
| 28 | + public void update(WeChatInfo wechatInfo) { | |
| 29 | + setChanged(); | |
| 30 | + notifyObservers(wechatInfo); | |
| 31 | + } | |
| 32 | + | |
| 33 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/share/observable/WechatShareObservable.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/share/observable/WechatShareObservable.java | |
| 1 | +package com.cnlive.share.observable; | |
| 2 | + | |
| 3 | +import java.util.Observable; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 作者: 吴奎庆 | |
| 7 | + * <p> | |
| 8 | + * 时间: 2019/9/18 | |
| 9 | + * <p> | |
| 10 | + * 简介: 微信分享完成 | |
| 11 | + */ | |
| 12 | +public class WechatShareObservable extends Observable { | |
| 13 | + | |
| 14 | + static WechatShareObservable wechatLoginObservable; | |
| 15 | + | |
| 16 | + public static WechatShareObservable getInstance() { | |
| 17 | + if (wechatLoginObservable == null) | |
| 18 | + synchronized (WechatLoginObservable.class) { | |
| 19 | + if (wechatLoginObservable == null) | |
| 20 | + wechatLoginObservable = new WechatShareObservable(); | |
| 21 | + } | |
| 22 | + return wechatLoginObservable; | |
| 23 | + } | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 1 分享完成 2 取消 3 失败 | |
| 27 | + * @param state | |
| 28 | + */ | |
| 29 | + public void update(int state) { | |
| 30 | + setChanged(); | |
| 31 | + notifyObservers(state); | |
| 32 | + } | |
| 33 | + | |
| 34 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/share/util/DateTimeUtil.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/share/util/DateTimeUtil.java | |
| 1 | +package com.cnlive.share.util; | |
| 2 | + | |
| 3 | +import android.annotation.SuppressLint; | |
| 4 | +import android.util.Log; | |
| 5 | + | |
| 6 | +import java.text.DateFormat; | |
| 7 | +import java.text.ParseException; | |
| 8 | +import java.text.ParsePosition; | |
| 9 | +import java.text.SimpleDateFormat; | |
| 10 | +import java.util.Calendar; | |
| 11 | +import java.util.Date; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 时间、日期工具类 | |
| 15 | + * Created by fanji on 2017/7/19. | |
| 16 | + */ | |
| 17 | + | |
| 18 | +public class DateTimeUtil { | |
| 19 | + | |
| 20 | + static SimpleDateFormat format; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 日期格式:yyyy-MM-dd HH:mm:ss | |
| 24 | + **/ | |
| 25 | + public static final String DF_YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 日期格式:yyyy-MM-dd HH:mm | |
| 29 | + **/ | |
| 30 | + public static final String DF_YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm"; | |
| 31 | + // yyyy-MM-dd-HH-mm | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 日期格式:yyyy-MM-dd | |
| 35 | + **/ | |
| 36 | + public static final String DF_YYYY_MM_DD = "yyyy-MM-dd"; | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 日期格式:HH:mm:ss | |
| 40 | + **/ | |
| 41 | + public static final String DF_HH_MM_SS = "HH:mm:ss"; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 日期格式:HH:mm | |
| 45 | + **/ | |
| 46 | + public static final String DF_HH_MM = "HH:mm"; | |
| 47 | + | |
| 48 | + private final static long minute = 60 * 1000;// 1分钟 | |
| 49 | + private final static long hour = 60 * minute;// 1小时 | |
| 50 | + private final static long day = 24 * hour;// 1天 | |
| 51 | + private final static long month = 31 * day;// 月 | |
| 52 | + private final static long year = 12 * month;// 年 | |
| 53 | + | |
| 54 | + | |
| 55 | + public DateTimeUtil() { | |
| 56 | + | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 将日期格式化成友好的字符串:几分钟前、几小时前、几天前、几月前、几年前、刚刚 | |
| 61 | + * | |
| 62 | + * @param date | |
| 63 | + * @return | |
| 64 | + */ | |
| 65 | + public static String formatFriendly(Date date) { | |
| 66 | + if (date == null) { | |
| 67 | + return null; | |
| 68 | + } | |
| 69 | + long diff = new Date().getTime() - date.getTime(); | |
| 70 | + long r = 0; | |
| 71 | + if (diff > year) { | |
| 72 | + r = (diff / year); | |
| 73 | + return r + "年前"; | |
| 74 | + } | |
| 75 | + if (diff > month) { | |
| 76 | + r = (diff / month); | |
| 77 | + return r + "个月前"; | |
| 78 | + } | |
| 79 | + if (diff > day) { | |
| 80 | + r = (diff / day); | |
| 81 | + return r + "天前"; | |
| 82 | + } | |
| 83 | + if (diff > hour) { | |
| 84 | + r = (diff / hour); | |
| 85 | + return r + "个小时前"; | |
| 86 | + } | |
| 87 | + if (diff > minute) { | |
| 88 | + r = (diff / minute); | |
| 89 | + return r + "分钟前"; | |
| 90 | + } | |
| 91 | + return "刚刚"; | |
| 92 | + } | |
| 93 | + | |
| 94 | + /** | |
| 95 | + * 生活圈模仿微信时间展示样式 | |
| 96 | + * | |
| 97 | + * @param date | |
| 98 | + * @return | |
| 99 | + */ | |
| 100 | + public static String formatNewFriendly(Date date) { | |
| 101 | + if (date == null) { | |
| 102 | + return null; | |
| 103 | + } | |
| 104 | + long diff = new Date().getTime() - date.getTime(); | |
| 105 | + long r = 0; | |
| 106 | + if (diff > day) { | |
| 107 | + r = (diff / day); | |
| 108 | + if (r==1){ | |
| 109 | + return"昨天"; | |
| 110 | + }else { | |
| 111 | + return r + "天前"; | |
| 112 | + } | |
| 113 | + } | |
| 114 | + if (diff > hour) { | |
| 115 | + r = (diff / hour); | |
| 116 | + return r + "小时前"; | |
| 117 | + } | |
| 118 | + if (diff > minute) { | |
| 119 | + r = (diff / minute); | |
| 120 | + return r + "分钟前"; | |
| 121 | + } | |
| 122 | + return "1分钟前"; | |
| 123 | + } | |
| 124 | + | |
| 125 | + /** | |
| 126 | + * 将日期以yyyy-MM-dd HH:mm:ss格式化 | |
| 127 | + * | |
| 128 | + * @param dateL 日期 | |
| 129 | + * @return | |
| 130 | + */ | |
| 131 | + @SuppressLint("SimpleDateFormat") | |
| 132 | + public static String formatDateTime(long dateL) { | |
| 133 | + SimpleDateFormat sdf = new SimpleDateFormat(DF_YYYY_MM_DD_HH_MM_SS); | |
| 134 | + Date date = new Date(dateL); | |
| 135 | + return sdf.format(date); | |
| 136 | + } | |
| 137 | + | |
| 138 | + /** | |
| 139 | + * 将日期以yyyy-MM-dd HH:mm:ss格式化 | |
| 140 | + * | |
| 141 | + * @param dateL 日期 | |
| 142 | + * @return | |
| 143 | + */ | |
| 144 | + @SuppressLint("SimpleDateFormat") | |
| 145 | + public static String formatDateTime(long dateL, String pattern) { | |
| 146 | + SimpleDateFormat sdf = new SimpleDateFormat(pattern); | |
| 147 | + Date date = new Date(dateL); | |
| 148 | + return sdf.format(date); | |
| 149 | + } | |
| 150 | + | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * 将日期以yyyy-MM-dd HH:mm:ss格式化 | |
| 154 | + * | |
| 155 | + * @param date 日期 | |
| 156 | + * @param formater | |
| 157 | + * @return | |
| 158 | + */ | |
| 159 | + @SuppressLint("SimpleDateFormat") | |
| 160 | + public static String formatDateTime(Date date, String formater) { | |
| 161 | + SimpleDateFormat sdf = new SimpleDateFormat(formater); | |
| 162 | + return sdf.format(date); | |
| 163 | + } | |
| 164 | + | |
| 165 | + /** | |
| 166 | + * 将日期字符串转成日期 | |
| 167 | + * | |
| 168 | + * @param strDate 字符串日期 | |
| 169 | + * @return java.util.date日期类型 | |
| 170 | + */ | |
| 171 | + @SuppressLint("SimpleDateFormat") | |
| 172 | + public static Date parseDate(String strDate) { | |
| 173 | + DateFormat dateFormat = new SimpleDateFormat(DF_YYYY_MM_DD_HH_MM_SS); | |
| 174 | + Date returnDate = null; | |
| 175 | + try { | |
| 176 | + returnDate = dateFormat.parse(strDate); | |
| 177 | + } catch (ParseException e) { | |
| 178 | + | |
| 179 | + } | |
| 180 | + return returnDate; | |
| 181 | + | |
| 182 | + } | |
| 183 | + | |
| 184 | + /** | |
| 185 | + * 获取系统当前日期 | |
| 186 | + * | |
| 187 | + * @return | |
| 188 | + */ | |
| 189 | + public static Date gainCurrentDate() { | |
| 190 | + return new Date(); | |
| 191 | + } | |
| 192 | + | |
| 193 | + /** | |
| 194 | + * 验证日期是否比当前日期早 | |
| 195 | + * | |
| 196 | + * @param target1 比较时间1 | |
| 197 | + * @param target2 比较时间2 | |
| 198 | + * @return true 则代表target1比target2晚或等于target2,否则比target2早 | |
| 199 | + */ | |
| 200 | + public static boolean compareDate(Date target1, Date target2) { | |
| 201 | + boolean flag = false; | |
| 202 | + try { | |
| 203 | + String target1DateTime = formatDateTime(target1, DF_YYYY_MM_DD_HH_MM_SS); | |
| 204 | + String target2DateTime = formatDateTime(target2, DF_YYYY_MM_DD_HH_MM_SS); | |
| 205 | + if (target1DateTime.compareTo(target2DateTime) <= 0) { | |
| 206 | + flag = true; | |
| 207 | + } | |
| 208 | + } catch (Exception e) { | |
| 209 | + System.out.println("比较失败,原因:" + e.getMessage()); | |
| 210 | + } | |
| 211 | + return flag; | |
| 212 | + } | |
| 213 | + | |
| 214 | + /** | |
| 215 | + * 对日期进行增加操作 | |
| 216 | + * | |
| 217 | + * @param target 需要进行运算的日期 | |
| 218 | + * @param hour 小时 | |
| 219 | + * @return | |
| 220 | + */ | |
| 221 | + public static Date addDateTime(Date target, double hour) { | |
| 222 | + if (null == target || hour < 0) { | |
| 223 | + return target; | |
| 224 | + } | |
| 225 | + | |
| 226 | + return new Date(target.getTime() + (long) (hour * 60 * 60 * 1000)); | |
| 227 | + } | |
| 228 | + | |
| 229 | + /** | |
| 230 | + * 对日期进行相减操作 | |
| 231 | + * | |
| 232 | + * @param target 需要进行运算的日期 | |
| 233 | + * @param hour 小时 | |
| 234 | + * @return | |
| 235 | + */ | |
| 236 | + public static Date subDateTime(Date target, double hour) { | |
| 237 | + if (null == target || hour < 0) { | |
| 238 | + return target; | |
| 239 | + } | |
| 240 | + | |
| 241 | + return new Date(target.getTime() - (long) (hour * 60 * 60 * 1000)); | |
| 242 | + } | |
| 243 | + | |
| 244 | + /** | |
| 245 | + * 获取系统时间的方法:月/日 时:分:秒 | |
| 246 | + */ | |
| 247 | + public static String getFormateDate() { | |
| 248 | + Calendar calendar = Calendar.getInstance(); | |
| 249 | + int month = (calendar.get(Calendar.MONTH) + 1); | |
| 250 | + int day = calendar.get(Calendar.DAY_OF_MONTH); | |
| 251 | + int hour = calendar.get(Calendar.HOUR_OF_DAY); | |
| 252 | + int minute = calendar.get(Calendar.MINUTE); | |
| 253 | + int second = calendar.get(Calendar.SECOND); | |
| 254 | + | |
| 255 | + String systemTime = (month < 10 ? "0" + month : month) + "/" + (day < 10 ? "0" + day : day) + " " + (hour < 10 ? "0" + hour : hour) + ":" + (minute < 10 ? "0" + minute : minute) + ":" + (second < 10 ? "0" + second : second); | |
| 256 | + return systemTime; | |
| 257 | + } | |
| 258 | + | |
| 259 | + /** | |
| 260 | + * 获取系统时间的方法:时:分:秒 | |
| 261 | + */ | |
| 262 | + public static String getHourAndMinute() { | |
| 263 | + Calendar calendar = Calendar.getInstance(); | |
| 264 | + int hour = calendar.get(Calendar.HOUR_OF_DAY); | |
| 265 | + int minute = calendar.get(Calendar.MINUTE); | |
| 266 | + return (hour < 10 ? "0" + hour : hour) + ":" + (minute < 10 ? "0" + minute : minute); | |
| 267 | + } | |
| 268 | + | |
| 269 | + /** | |
| 270 | + * 获取分钟 | |
| 271 | + */ | |
| 272 | + public static int getMinute() { | |
| 273 | + Calendar calendar = Calendar.getInstance(); | |
| 274 | + int hour = calendar.get(Calendar.HOUR_OF_DAY); | |
| 275 | + int minute = calendar.get(Calendar.MINUTE); | |
| 276 | + return minute; | |
| 277 | + } | |
| 278 | + | |
| 279 | + /** | |
| 280 | + * 获取系统时间的方法:时 | |
| 281 | + */ | |
| 282 | + public static String getHour() { | |
| 283 | + Calendar calendar = Calendar.getInstance(); | |
| 284 | + int hour = calendar.get(Calendar.HOUR_OF_DAY); | |
| 285 | + return ((hour < 10 ? "0" + hour : hour) + ""); | |
| 286 | + } | |
| 287 | + | |
| 288 | + /** | |
| 289 | + * 将2017-07-10 00:00:00 换2017-07-10 | |
| 290 | + * | |
| 291 | + * @param strDate | |
| 292 | + * @return | |
| 293 | + */ | |
| 294 | + public static String strFormatStr(String strDate) { | |
| 295 | + if (strDate.equals("")) { | |
| 296 | + return ""; | |
| 297 | + } | |
| 298 | + return dateToStr(strToDate(strDate)); | |
| 299 | + } | |
| 300 | + | |
| 301 | + /** | |
| 302 | + * 2015-01-07 15:05:34 | |
| 303 | + * | |
| 304 | + * @param strDate | |
| 305 | + * @return | |
| 306 | + */ | |
| 307 | + @SuppressLint("SimpleDateFormat") | |
| 308 | + public static Date strToDateHHMMSS(String strDate) { | |
| 309 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 310 | + ParsePosition pos = new ParsePosition(0); | |
| 311 | + Date strtodate = formatter.parse(strDate, pos); | |
| 312 | + return strtodate; | |
| 313 | + } | |
| 314 | + | |
| 315 | + /** | |
| 316 | + * 2015-01-07 15:05 | |
| 317 | + * | |
| 318 | + * @param strDate | |
| 319 | + * @return | |
| 320 | + */ | |
| 321 | + @SuppressLint("SimpleDateFormat") | |
| 322 | + public static Date strToDateHHMM(String strDate) { | |
| 323 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 324 | + ParsePosition pos = new ParsePosition(0); | |
| 325 | + Date strtodate = formatter.parse(strDate, pos); | |
| 326 | + return strtodate; | |
| 327 | + } | |
| 328 | + | |
| 329 | + /** | |
| 330 | + * 2015-01-07 | |
| 331 | + * | |
| 332 | + * @param strDate | |
| 333 | + * @return | |
| 334 | + */ | |
| 335 | + @SuppressLint("SimpleDateFormat") | |
| 336 | + public static Date strToDate(String strDate) { | |
| 337 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); | |
| 338 | + ParsePosition pos = new ParsePosition(0); | |
| 339 | + Date strtodate = formatter.parse(strDate, pos); | |
| 340 | + return strtodate; | |
| 341 | + } | |
| 342 | + | |
| 343 | + /** | |
| 344 | + * 2015.01.07 | |
| 345 | + * | |
| 346 | + * @param strDate | |
| 347 | + * @return | |
| 348 | + */ | |
| 349 | + @SuppressLint("SimpleDateFormat") | |
| 350 | + public static Date strToDateDorp(String strDate) { | |
| 351 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd"); | |
| 352 | + ParsePosition pos = new ParsePosition(0); | |
| 353 | + Date strtodate = formatter.parse(strDate, pos); | |
| 354 | + return strtodate; | |
| 355 | + } | |
| 356 | + | |
| 357 | + @SuppressLint("SimpleDateFormat") | |
| 358 | + public static String dateToStr(Date dateDate) { | |
| 359 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); | |
| 360 | + String dateString = formatter.format(dateDate); | |
| 361 | + return dateString; | |
| 362 | + } | |
| 363 | + | |
| 364 | + /** | |
| 365 | + * 传入一个String转化为long | |
| 366 | + */ | |
| 367 | + @SuppressLint("SimpleDateFormat") | |
| 368 | + public static Long stringParserLong(String param) throws ParseException { | |
| 369 | + format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 370 | + return format.parse(param).getTime(); | |
| 371 | + } | |
| 372 | + | |
| 373 | + /** | |
| 374 | + * 传入一个String转化为long | |
| 375 | + */ | |
| 376 | + @SuppressLint("SimpleDateFormat") | |
| 377 | + public static Long stringParserLong1(String param) throws ParseException { | |
| 378 | + format = new SimpleDateFormat("yyyyMMddHHmmss"); | |
| 379 | + return format.parse(param).getTime(); | |
| 380 | + } | |
| 381 | + | |
| 382 | + /** | |
| 383 | + * 当前时间转换为long | |
| 384 | + */ | |
| 385 | + @SuppressLint("SimpleDateFormat") | |
| 386 | + public static Long currentDateParserLong() throws ParseException { | |
| 387 | + format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 388 | + return format.parse(format.format(Calendar.getInstance().getTime())).getTime(); | |
| 389 | + } | |
| 390 | + | |
| 391 | + /** | |
| 392 | + * 当前时间 如: 2013-04-22 10:37:00 | |
| 393 | + */ | |
| 394 | + @SuppressLint("SimpleDateFormat") | |
| 395 | + public static String getCurrentDate() { | |
| 396 | + format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 397 | + return format.format(Calendar.getInstance().getTime()); | |
| 398 | + } | |
| 399 | + | |
| 400 | + /** | |
| 401 | + * 当前时间 如: 10:37 | |
| 402 | + */ | |
| 403 | + @SuppressLint("SimpleDateFormat") | |
| 404 | + public static String getCurrentDateHHMM() { | |
| 405 | + format = new SimpleDateFormat("HH:mm"); | |
| 406 | + return format.format(Calendar.getInstance().getTime()); | |
| 407 | + } | |
| 408 | + | |
| 409 | + /** | |
| 410 | + * 当前时间 如: 10:37 | |
| 411 | + * | |
| 412 | + * @throws ParseException | |
| 413 | + */ | |
| 414 | + @SuppressLint("SimpleDateFormat") | |
| 415 | + public static String getCurrentDateHHMMSS() { | |
| 416 | + format = new SimpleDateFormat("HH:mm:ss"); | |
| 417 | + return format.format(Calendar.getInstance().getTime()); | |
| 418 | + } | |
| 419 | + | |
| 420 | + /** | |
| 421 | + * 当前时间 如: 20130422 | |
| 422 | + */ | |
| 423 | + @SuppressLint("SimpleDateFormat") | |
| 424 | + public static String getCurrentDateString() { | |
| 425 | + format = new SimpleDateFormat("yyyyMMddHHmm"); | |
| 426 | + return format.format(Calendar.getInstance().getTime()); | |
| 427 | + } | |
| 428 | + | |
| 429 | + /** | |
| 430 | + * 当前时间 如: 2013-04-22 | |
| 431 | + */ | |
| 432 | + @SuppressLint("SimpleDateFormat") | |
| 433 | + public static String getCurrentTime() { | |
| 434 | + format = new SimpleDateFormat("yyyy-MM-dd"); | |
| 435 | + return format.format(Calendar.getInstance().getTime()); | |
| 436 | + } | |
| 437 | + | |
| 438 | + @SuppressLint("SimpleDateFormat") | |
| 439 | + public static String getSWAHDate() { | |
| 440 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 441 | + return format.format(Calendar.getInstance().getTime()); | |
| 442 | + } | |
| 443 | + | |
| 444 | + @SuppressLint("SimpleDateFormat") | |
| 445 | + public static Long stringToLongD(String param) throws ParseException { | |
| 446 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | |
| 447 | + return format.parse(param.substring(0, param.length() - 4)).getTime(); | |
| 448 | + } | |
| 449 | + | |
| 450 | + @SuppressLint("SimpleDateFormat") | |
| 451 | + public static Long stringToLong(String param) throws ParseException { | |
| 452 | + SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmm"); | |
| 453 | + return format.parse(param).getTime(); | |
| 454 | + } | |
| 455 | + | |
| 456 | + /** | |
| 457 | + * 获取两个日期之间的间隔天数 | |
| 458 | + * | |
| 459 | + * @return | |
| 460 | + */ | |
| 461 | + @SuppressLint("SimpleDateFormat") | |
| 462 | + public static int getGapCount(Date startDate, Date endDate) { | |
| 463 | + Calendar fromCalendar = Calendar.getInstance(); | |
| 464 | + fromCalendar.setTime(startDate); | |
| 465 | + fromCalendar.set(Calendar.HOUR_OF_DAY, 0); | |
| 466 | + fromCalendar.set(Calendar.MINUTE, 0); | |
| 467 | + fromCalendar.set(Calendar.SECOND, 0); | |
| 468 | + fromCalendar.set(Calendar.MILLISECOND, 0); | |
| 469 | + | |
| 470 | + Calendar toCalendar = Calendar.getInstance(); | |
| 471 | + toCalendar.setTime(endDate); | |
| 472 | + toCalendar.set(Calendar.HOUR_OF_DAY, 0); | |
| 473 | + toCalendar.set(Calendar.MINUTE, 0); | |
| 474 | + toCalendar.set(Calendar.SECOND, 0); | |
| 475 | + toCalendar.set(Calendar.MILLISECOND, 0); | |
| 476 | + | |
| 477 | + return (int) ((toCalendar.getTime().getTime() - fromCalendar.getTime().getTime()) / (1000 * 60 * 60 * 24)); | |
| 478 | + } | |
| 479 | + | |
| 480 | + /** | |
| 481 | + * 日期转换成Java字符串 | |
| 482 | + * | |
| 483 | + * @param date | |
| 484 | + * @return str | |
| 485 | + */ | |
| 486 | + @SuppressLint("SimpleDateFormat") | |
| 487 | + public static String DateToStr(Date date) { | |
| 488 | + | |
| 489 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 490 | + String str = format.format(date); | |
| 491 | + return str; | |
| 492 | + } | |
| 493 | + | |
| 494 | + /** | |
| 495 | + * 字符串转换成日期 | |
| 496 | + * | |
| 497 | + * @param str | |
| 498 | + * @return date | |
| 499 | + */ | |
| 500 | + @SuppressLint("SimpleDateFormat") | |
| 501 | + public static Date StrToDate(String str) { | |
| 502 | + | |
| 503 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | |
| 504 | + Date date = null; | |
| 505 | + try { | |
| 506 | + date = format.parse(str); | |
| 507 | + } catch (ParseException e) { | |
| 508 | + e.printStackTrace(); | |
| 509 | + } | |
| 510 | + return date; | |
| 511 | + } | |
| 512 | + | |
| 513 | + /** | |
| 514 | + * 字符串转换成日期 | |
| 515 | + * | |
| 516 | + * @param str | |
| 517 | + * @return date | |
| 518 | + */ | |
| 519 | + @SuppressLint("SimpleDateFormat") | |
| 520 | + public static Date StrToDateDrop(String str) { | |
| 521 | + | |
| 522 | + SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd"); | |
| 523 | + Date date = null; | |
| 524 | + try { | |
| 525 | + date = format.parse(str); | |
| 526 | + } catch (ParseException e) { | |
| 527 | + e.printStackTrace(); | |
| 528 | + } | |
| 529 | + return date; | |
| 530 | + } | |
| 531 | + | |
| 532 | + /** | |
| 533 | + * @param time | |
| 534 | + * @return | |
| 535 | + */ | |
| 536 | + @SuppressLint("SimpleDateFormat") | |
| 537 | + public static long getLongTime(String time) { | |
| 538 | + long ct = 0; | |
| 539 | + try { | |
| 540 | + format = new SimpleDateFormat("HH:mm:ss"); | |
| 541 | + ct = format.parse(time).getTime(); | |
| 542 | + } catch (Exception e) { | |
| 543 | + e.printStackTrace(); | |
| 544 | + } | |
| 545 | + return ct; | |
| 546 | + } | |
| 547 | + | |
| 548 | + /** | |
| 549 | + * 判断两日期是否同一天 | |
| 550 | + * | |
| 551 | + * @param str1 | |
| 552 | + * @param str2 | |
| 553 | + * @return | |
| 554 | + */ | |
| 555 | + @SuppressLint("SimpleDateFormat") | |
| 556 | + public static boolean isSameDay(String str1, String str2) { | |
| 557 | + | |
| 558 | + Date day1 = null, day2 = null; | |
| 559 | + day1 = DateTimeUtil.strToDate(str1); | |
| 560 | + day2 = DateTimeUtil.strToDate(str2); | |
| 561 | + | |
| 562 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 563 | + | |
| 564 | + String ds1 = sdf.format(day1); | |
| 565 | + | |
| 566 | + String ds2 = sdf.format(day2); | |
| 567 | + | |
| 568 | + if (ds1.equals(ds2)) { | |
| 569 | + return true; | |
| 570 | + } else { | |
| 571 | + return false; | |
| 572 | + } | |
| 573 | + | |
| 574 | + } | |
| 575 | + | |
| 576 | + /** | |
| 577 | + * 获取两个日期的时间差 | |
| 578 | + */ | |
| 579 | + @SuppressLint("SimpleDateFormat") | |
| 580 | + public static int getTimeInterval(String date) { | |
| 581 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 582 | + int interval = 0; | |
| 583 | + try { | |
| 584 | + Date currentTime = new Date();// 获取现在的时间 | |
| 585 | + Date beginTime = dateFormat.parse(date); | |
| 586 | + interval = (int) ((beginTime.getTime() - currentTime.getTime()) / (1000));// 时间差 | |
| 587 | + // 单位秒 | |
| 588 | + } catch (ParseException e) { | |
| 589 | + e.printStackTrace(); | |
| 590 | + } | |
| 591 | + return interval; | |
| 592 | + } | |
| 593 | + | |
| 594 | + /** | |
| 595 | + * 获取两个日期的时间差 yyyy.MM.dd HH.mm.ss | |
| 596 | + */ | |
| 597 | + @SuppressLint("SimpleDateFormat") | |
| 598 | + public static int getInterval(String bDate, String eDate) { | |
| 599 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); | |
| 600 | + int interval = 0; | |
| 601 | + try { | |
| 602 | + Date currentTime = dateFormat.parse(eDate);// 获取现在的时间 | |
| 603 | + Date beginTime = dateFormat.parse(bDate); | |
| 604 | + interval = (int) ((beginTime.getTime() - currentTime.getTime()));// 时间差 | |
| 605 | + // 单位秒 | |
| 606 | + } catch (ParseException e) { | |
| 607 | + e.printStackTrace(); | |
| 608 | + } | |
| 609 | + return interval; | |
| 610 | + } | |
| 611 | + | |
| 612 | + /** | |
| 613 | + * 两个时间之差 求出一个long Time | |
| 614 | + * | |
| 615 | + * @param date | |
| 616 | + * @return | |
| 617 | + */ | |
| 618 | + @SuppressLint("SimpleDateFormat") | |
| 619 | + public static long getTime(String date) { | |
| 620 | + | |
| 621 | + DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 622 | + long diff = 0; | |
| 623 | + try { | |
| 624 | + Date currentTime = new Date();// 获取现在的时间 | |
| 625 | + Date getdate = df.parse(date); | |
| 626 | + diff = getdate.getTime() - currentTime.getTime(); | |
| 627 | + | |
| 628 | + } catch (Exception e) { | |
| 629 | + } | |
| 630 | + return diff; | |
| 631 | + } | |
| 632 | + | |
| 633 | + | |
| 634 | + /** | |
| 635 | + * 日期转换成Java字符串 | |
| 636 | + * | |
| 637 | + * @param DATE1 | |
| 638 | + * @param DATE2 | |
| 639 | + * @return | |
| 640 | + */ | |
| 641 | + @SuppressLint("SimpleDateFormat") | |
| 642 | + public static int compare_date(String DATE1, String DATE2) { | |
| 643 | + DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); | |
| 644 | + try { | |
| 645 | + Date dt1 = df.parse(DATE1); | |
| 646 | + Date dt2 = df.parse(DATE2); | |
| 647 | + if (dt1.getTime() >= dt2.getTime()) { | |
| 648 | + return 1; | |
| 649 | + } else if (dt1.getTime() < dt2.getTime()) { | |
| 650 | + return -1; | |
| 651 | + } else { | |
| 652 | + return 0; | |
| 653 | + } | |
| 654 | + } catch (Exception exception) { | |
| 655 | + exception.printStackTrace(); | |
| 656 | + } | |
| 657 | + return 0; | |
| 658 | + } | |
| 659 | + | |
| 660 | + /** | |
| 661 | + * 传入时间 算出星期几 | |
| 662 | + * | |
| 663 | + * @param str 2014年1月3日 | |
| 664 | + * @param days 1:2014年1月4日 类推 | |
| 665 | + * @return | |
| 666 | + */ | |
| 667 | + @SuppressLint("SimpleDateFormat") | |
| 668 | + public static String formatDate(String str, int days) { | |
| 669 | + | |
| 670 | + String dateStr = ""; | |
| 671 | + try { | |
| 672 | + DateFormat df = DateFormat.getDateInstance(DateFormat.LONG); | |
| 673 | + Date date = df.parse(str); | |
| 674 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | |
| 675 | + Calendar c = Calendar.getInstance(); | |
| 676 | + Date d = dateFormat.parse(dateFormat.format(date)); | |
| 677 | + c.setTime(d); | |
| 678 | + c.add(Calendar.DAY_OF_MONTH, days); | |
| 679 | + switch (c.get(Calendar.DAY_OF_WEEK) - 1) { | |
| 680 | + case 0: | |
| 681 | + dateStr = "周日"; | |
| 682 | + break; | |
| 683 | + case 1: | |
| 684 | + dateStr = "周一"; | |
| 685 | + break; | |
| 686 | + case 2: | |
| 687 | + dateStr = "周二"; | |
| 688 | + break; | |
| 689 | + case 3: | |
| 690 | + dateStr = "周三"; | |
| 691 | + break; | |
| 692 | + case 4: | |
| 693 | + dateStr = "周四"; | |
| 694 | + break; | |
| 695 | + case 5: | |
| 696 | + dateStr = "周五"; | |
| 697 | + break; | |
| 698 | + case 6: | |
| 699 | + dateStr = "周六"; | |
| 700 | + break; | |
| 701 | + default: | |
| 702 | + break; | |
| 703 | + } | |
| 704 | + } catch (Exception e) { | |
| 705 | + e.printStackTrace(); | |
| 706 | + } | |
| 707 | + | |
| 708 | + return dateStr; | |
| 709 | + } | |
| 710 | + | |
| 711 | + /** | |
| 712 | + * 根据提供的年月日获取该月份的第一天 | |
| 713 | + */ | |
| 714 | + public static String getSupportBeginDayofMonth(int year, int monthOfYear) { | |
| 715 | + Calendar cal = Calendar.getInstance(); | |
| 716 | + cal.set(Calendar.YEAR, year); | |
| 717 | + cal.set(Calendar.MONTH, monthOfYear - 1); | |
| 718 | + cal.set(Calendar.DAY_OF_MONTH, 1); | |
| 719 | + cal.set(Calendar.HOUR_OF_DAY, 0); | |
| 720 | + cal.set(Calendar.MINUTE, 0); | |
| 721 | + cal.set(Calendar.SECOND, 0); | |
| 722 | + | |
| 723 | + cal.set(Calendar.DAY_OF_MONTH, 1); | |
| 724 | + return cal.getTimeInMillis() + ""; | |
| 725 | + } | |
| 726 | + | |
| 727 | + /** | |
| 728 | + * 根据提供的年月获取该月份的最后一天 | |
| 729 | + * | |
| 730 | + * @return | |
| 731 | + */ | |
| 732 | + public static String getSupportEndDayofMonth(int year, int monthOfYear) { | |
| 733 | + Calendar cal = Calendar.getInstance(); | |
| 734 | + cal.set(Calendar.YEAR, year); | |
| 735 | + cal.set(Calendar.MONTH, monthOfYear); | |
| 736 | + cal.set(Calendar.DAY_OF_MONTH, 1); | |
| 737 | + cal.set(Calendar.HOUR_OF_DAY, 23); | |
| 738 | + cal.set(Calendar.MINUTE, 59); | |
| 739 | + cal.set(Calendar.SECOND, 59); | |
| 740 | + | |
| 741 | + cal.add(Calendar.DAY_OF_MONTH, -1); | |
| 742 | + return cal.getTimeInMillis() + ""; | |
| 743 | + } | |
| 744 | + | |
| 745 | + public static String getYear(long millseconds) { | |
| 746 | + | |
| 747 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); | |
| 748 | + Date date = new Date(millseconds); | |
| 749 | + return sdf.format(date).substring(0, 4); | |
| 750 | + } | |
| 751 | + | |
| 752 | + public static String getMonth(long millseconds) { | |
| 753 | + | |
| 754 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); | |
| 755 | + Date date = new Date(millseconds); | |
| 756 | + return sdf.format(date).substring(4, 6); | |
| 757 | + } | |
| 758 | + | |
| 759 | + public static String formatFriendly(String timeStr) { | |
| 760 | + String time = ""; | |
| 761 | + try { | |
| 762 | + time = DateTimeUtil.formatFriendly(new Date(Long.valueOf(timeStr) * 1000L)); | |
| 763 | + } catch (Exception e) { | |
| 764 | + Log.e("FriendCircleMessage", "Time format exception.", e); | |
| 765 | + } | |
| 766 | + return time; | |
| 767 | + } | |
| 768 | + | |
| 769 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/share/util/OkHttpUtils.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/share/util/OkHttpUtils.java | |
| 1 | +package com.cnlive.share.util; | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | +import android.os.Handler; | |
| 6 | +import android.os.Looper; | |
| 7 | + | |
| 8 | +import com.google.gson.Gson; | |
| 9 | +import com.google.gson.internal.$Gson$Types; | |
| 10 | + | |
| 11 | +import java.io.IOException; | |
| 12 | +import java.lang.reflect.ParameterizedType; | |
| 13 | +import java.lang.reflect.Type; | |
| 14 | +import java.util.List; | |
| 15 | +import java.util.concurrent.TimeUnit; | |
| 16 | + | |
| 17 | +import okhttp3.Call; | |
| 18 | +import okhttp3.Callback; | |
| 19 | +import okhttp3.FormBody; | |
| 20 | +import okhttp3.OkHttpClient; | |
| 21 | +import okhttp3.Request; | |
| 22 | +import okhttp3.RequestBody; | |
| 23 | +import okhttp3.Response; | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * | |
| 27 | + */ | |
| 28 | +public class OkHttpUtils { | |
| 29 | + | |
| 30 | + private static final String TAG = "OkHttpUtils"; | |
| 31 | + | |
| 32 | + private static OkHttpUtils mInstance; | |
| 33 | + private OkHttpClient mOkHttpClient; | |
| 34 | + private Handler mDelivery; | |
| 35 | + private Gson mGson; | |
| 36 | + | |
| 37 | + private OkHttpUtils() { | |
| 38 | + mOkHttpClient = new OkHttpClient.Builder() | |
| 39 | + .connectTimeout(10, TimeUnit.SECONDS) | |
| 40 | + .writeTimeout(10, TimeUnit.SECONDS) | |
| 41 | + .readTimeout(30, TimeUnit.SECONDS) | |
| 42 | + .build(); | |
| 43 | + mGson = new Gson(); | |
| 44 | + mDelivery = new Handler(Looper.getMainLooper()); | |
| 45 | + } | |
| 46 | + | |
| 47 | + private synchronized static OkHttpUtils getmInstance() { | |
| 48 | + if (mInstance == null) { | |
| 49 | + mInstance = new OkHttpUtils(); | |
| 50 | + } | |
| 51 | + return mInstance; | |
| 52 | + } | |
| 53 | + | |
| 54 | + private void getRequest(String url, final ResultCallback callback) { | |
| 55 | + final Request request = new Request.Builder().url(url).build(); | |
| 56 | + deliveryResult(callback, request); | |
| 57 | + } | |
| 58 | + | |
| 59 | + private void postRequest(String url, final ResultCallback callback, List<Param> params) { | |
| 60 | + Request request = buildPostRequest(url, params); | |
| 61 | + deliveryResult(callback, request); | |
| 62 | + } | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 处理结果 | |
| 66 | + * @param callback | |
| 67 | + * @param request | |
| 68 | + */ | |
| 69 | + private void deliveryResult(final ResultCallback callback, Request request) { | |
| 70 | + | |
| 71 | + mOkHttpClient.newCall(request).enqueue(new Callback() { | |
| 72 | + @Override | |
| 73 | + public void onFailure(Call call, IOException e) { | |
| 74 | + sendFailCallback(callback, e); | |
| 75 | + } | |
| 76 | + | |
| 77 | + @Override | |
| 78 | + public void onResponse(Call call, Response response) throws IOException { | |
| 79 | + try { | |
| 80 | + String str = response.body().string(); | |
| 81 | + if (callback.mType == String.class) { | |
| 82 | + /** | |
| 83 | + * 返回字符串 | |
| 84 | + */ | |
| 85 | + sendSuccessCallBack(callback, str); | |
| 86 | + } else { | |
| 87 | + /** | |
| 88 | + * 这里处理解析返回对象 | |
| 89 | + */ | |
| 90 | + Object object = mGson.fromJson(str, callback.mType); | |
| 91 | + sendSuccessCallBack(callback, object); | |
| 92 | + | |
| 93 | + } | |
| 94 | + } catch (final Exception e) { | |
| 95 | +// LogUtils.e(TAG, "convert json failure", e); | |
| 96 | + sendFailCallback(callback, e); | |
| 97 | + } | |
| 98 | + } | |
| 99 | + }); | |
| 100 | + } | |
| 101 | + | |
| 102 | + private void sendFailCallback(final ResultCallback callback, final Exception e) { | |
| 103 | + mDelivery.post(new Runnable() { | |
| 104 | + @Override | |
| 105 | + public void run() { | |
| 106 | + if (callback != null) { | |
| 107 | + callback.onFailure(e); | |
| 108 | + } | |
| 109 | + } | |
| 110 | + }); | |
| 111 | + } | |
| 112 | + | |
| 113 | + private void sendSuccessCallBack(final ResultCallback callback, final Object obj) { | |
| 114 | + mDelivery.post(new Runnable() { | |
| 115 | + @Override | |
| 116 | + public void run() { | |
| 117 | + if (callback != null) { | |
| 118 | + callback.onSuccess(obj); | |
| 119 | + } | |
| 120 | + } | |
| 121 | + }); | |
| 122 | + } | |
| 123 | + | |
| 124 | + private Request buildPostRequest(String url, List<Param> params) { | |
| 125 | + FormBody.Builder builder= new FormBody.Builder(); | |
| 126 | + for (Param param : params) { | |
| 127 | + builder.add(param.key, param.value); | |
| 128 | + } | |
| 129 | + RequestBody requestBody = builder.build(); | |
| 130 | + return new Request.Builder().url(url).post(requestBody).build(); | |
| 131 | + } | |
| 132 | + | |
| 133 | + | |
| 134 | + /**********************对外接口************************/ | |
| 135 | + | |
| 136 | + /** | |
| 137 | + * get请求 | |
| 138 | + * @param url 请求url | |
| 139 | + * @param callback 请求回调 | |
| 140 | + */ | |
| 141 | + public static void get(String url, ResultCallback callback) { | |
| 142 | + getmInstance().getRequest(url, callback); | |
| 143 | + } | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * post请求 | |
| 147 | + * @param url 请求url | |
| 148 | + * @param callback 请求回调 | |
| 149 | + * @param params 请求参数 | |
| 150 | + */ | |
| 151 | + public static void post(String url, final ResultCallback callback, List<Param> params) { | |
| 152 | + getmInstance().postRequest(url, callback, params); | |
| 153 | + } | |
| 154 | + | |
| 155 | + /** | |
| 156 | + * http请求回调类,回调方法在UI线程中执行 | |
| 157 | + * @param <T> | |
| 158 | + */ | |
| 159 | + public static abstract class ResultCallback<T> { | |
| 160 | + | |
| 161 | + Type mType; | |
| 162 | + | |
| 163 | + public ResultCallback(){ | |
| 164 | + mType = getSuperclassTypeParameter(getClass()); | |
| 165 | + } | |
| 166 | + | |
| 167 | + static Type getSuperclassTypeParameter(Class<?> subclass) { | |
| 168 | + Type superclass = subclass.getGenericSuperclass(); | |
| 169 | + if (superclass instanceof Class) { | |
| 170 | + throw new RuntimeException("Missing type parameter."); | |
| 171 | + } | |
| 172 | + ParameterizedType parameterized = (ParameterizedType) superclass; | |
| 173 | + return $Gson$Types.canonicalize(parameterized.getActualTypeArguments()[0]); | |
| 174 | + } | |
| 175 | + | |
| 176 | + /** | |
| 177 | + * 请求成功回调 | |
| 178 | + * @param response | |
| 179 | + */ | |
| 180 | + public abstract void onSuccess(T response); | |
| 181 | + | |
| 182 | + /** | |
| 183 | + * 请求失败回调 | |
| 184 | + * @param e | |
| 185 | + */ | |
| 186 | + public abstract void onFailure(Exception e); | |
| 187 | + } | |
| 188 | + | |
| 189 | + /** | |
| 190 | + * post请求参数类 这里可以根据项目抽取成泛型 | |
| 191 | + */ | |
| 192 | + public static class Param { | |
| 193 | + | |
| 194 | + String key; | |
| 195 | + String value; | |
| 196 | + | |
| 197 | + public Param() { | |
| 198 | + } | |
| 199 | + | |
| 200 | + public Param(String key, String value) { | |
| 201 | + this.key = key; | |
| 202 | + this.value = value; | |
| 203 | + } | |
| 204 | + | |
| 205 | + } | |
| 206 | + | |
| 207 | + | |
| 208 | +} | |
| 0 | 209 | \ No newline at end of file | ... | ... |
moudle_user/src/main/java/com/cnlive/share/util/Util.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/share/util/Util.java | |
| 1 | +package com.cnlive.share.util; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 作者: 吴奎庆 | |
| 5 | + * <p> | |
| 6 | + * 时间: 2018/8/22 | |
| 7 | + * <p> | |
| 8 | + * 简介: | |
| 9 | + */ | |
| 10 | + | |
| 11 | + | |
| 12 | +import android.content.Context; | |
| 13 | +import android.content.Intent; | |
| 14 | +import android.content.pm.PackageInfo; | |
| 15 | +import android.content.pm.PackageManager; | |
| 16 | +import android.graphics.Bitmap; | |
| 17 | +import android.graphics.Bitmap.CompressFormat; | |
| 18 | +import android.graphics.Canvas; | |
| 19 | +import android.graphics.Rect; | |
| 20 | +import android.net.Uri; | |
| 21 | +import android.text.TextUtils; | |
| 22 | + | |
| 23 | +import com.cnlive.libs.base.application.AppConfig; | |
| 24 | +import com.cnlive.libs.data.network.util.UriUtil; | |
| 25 | +import com.cnlive.strike.moudle_user.BuildConfig; | |
| 26 | +import com.cnlive.strike.user.auth.UserService; | |
| 27 | +import com.sina.weibo.sdk.WbSdk; | |
| 28 | +import com.sina.weibo.sdk.auth.AuthInfo; | |
| 29 | +import com.tencent.mm.opensdk.openapi.IWXAPI; | |
| 30 | +import com.tencent.mm.opensdk.openapi.WXAPIFactory; | |
| 31 | + | |
| 32 | +import java.io.ByteArrayOutputStream; | |
| 33 | +import java.io.InputStream; | |
| 34 | +import java.util.List; | |
| 35 | + | |
| 36 | + | |
| 37 | +public class Util { | |
| 38 | + | |
| 39 | + public static byte[] bmpToByteArray(final Bitmap bmp, final boolean needRecycle) { | |
| 40 | + | |
| 41 | + if (bmp == null) return null; | |
| 42 | + int i; | |
| 43 | + int j; | |
| 44 | + if (bmp.getHeight() > bmp.getWidth()) { | |
| 45 | + i = bmp.getWidth(); | |
| 46 | + j = bmp.getWidth(); | |
| 47 | + } else { | |
| 48 | + i = bmp.getHeight(); | |
| 49 | + j = bmp.getHeight(); | |
| 50 | + } | |
| 51 | + | |
| 52 | + Bitmap localBitmap = Bitmap.createBitmap(i, j, Bitmap.Config.RGB_565); | |
| 53 | + Canvas localCanvas = new Canvas(localBitmap); | |
| 54 | + | |
| 55 | + while (true) { | |
| 56 | + localCanvas.drawBitmap(bmp, new Rect(0, 0, i, j), new Rect(0, 0, i, j), null); | |
| 57 | + if (needRecycle) | |
| 58 | + bmp.recycle(); | |
| 59 | + ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream(); | |
| 60 | + localBitmap.compress(CompressFormat.JPEG, 100, | |
| 61 | + localByteArrayOutputStream); | |
| 62 | + localBitmap.recycle(); | |
| 63 | + byte[] arrayOfByte = localByteArrayOutputStream.toByteArray(); | |
| 64 | + try { | |
| 65 | + localByteArrayOutputStream.close(); | |
| 66 | + return arrayOfByte; | |
| 67 | + } catch (Exception e) { | |
| 68 | + // F.out(e); | |
| 69 | + } | |
| 70 | + i = bmp.getHeight(); | |
| 71 | + j = bmp.getHeight(); | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | + public static byte[] inputStreamToByte(InputStream is) { | |
| 76 | + try { | |
| 77 | + ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); | |
| 78 | + int ch; | |
| 79 | + while ((ch = is.read()) != -1) { | |
| 80 | + bytestream.write(ch); | |
| 81 | + } | |
| 82 | + byte imgdata[] = bytestream.toByteArray(); | |
| 83 | + bytestream.close(); | |
| 84 | + return imgdata; | |
| 85 | + } catch (Exception e) { | |
| 86 | + e.printStackTrace(); | |
| 87 | + } | |
| 88 | + | |
| 89 | + return null; | |
| 90 | + } | |
| 91 | + | |
| 92 | + /** | |
| 93 | + * 判断是否安装了微信客户端 | |
| 94 | + */ | |
| 95 | + public static boolean isWXAppInstalledAndSupported(Context context) { | |
| 96 | + IWXAPI api = WXAPIFactory.createWXAPI(context, BuildConfig.WECHAT_SHARE); | |
| 97 | + return api.isWXAppInstalled(); | |
| 98 | + } | |
| 99 | + | |
| 100 | + | |
| 101 | + public static boolean isWeixinAvilible(Context context) { | |
| 102 | + PackageManager packageManager = context.getPackageManager();// 获取packagemanager | |
| 103 | + List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);// 获取所有已安装程序的包信息 | |
| 104 | + if (pinfo != null) { | |
| 105 | + for (int i = 0; i < pinfo.size(); i++) { | |
| 106 | + String pn = pinfo.get(i).packageName; | |
| 107 | + if (pn.equals("com.tencent.mm")) { | |
| 108 | + return true; | |
| 109 | + } | |
| 110 | + } | |
| 111 | + } | |
| 112 | + return false; | |
| 113 | + } | |
| 114 | + | |
| 115 | + /** | |
| 116 | + * 判断qq是否可用 | |
| 117 | + * | |
| 118 | + * @param context | |
| 119 | + * @return | |
| 120 | + */ | |
| 121 | + public static boolean isQQClientAvailable(Context context) { | |
| 122 | + final PackageManager packageManager = context.getPackageManager(); | |
| 123 | + List<PackageInfo> pinfo = packageManager.getInstalledPackages(0); | |
| 124 | + if (pinfo != null) { | |
| 125 | + for (int i = 0; i < pinfo.size(); i++) { | |
| 126 | + String pn = pinfo.get(i).packageName; | |
| 127 | + if (pn.equals("com.tencent.mobileqq")) { | |
| 128 | + return true; | |
| 129 | + } | |
| 130 | + } | |
| 131 | + } | |
| 132 | + return false; | |
| 133 | + } | |
| 134 | + | |
| 135 | + | |
| 136 | + //Scheme 检测QQ分享 | |
| 137 | + public static boolean checkQQ(Context context) { | |
| 138 | + if (context == null || context.getPackageManager() == null) return false; | |
| 139 | + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mqqapi://share")); | |
| 140 | + return !context.getPackageManager().queryIntentActivities(intent, 0).isEmpty(); | |
| 141 | + } | |
| 142 | + | |
| 143 | + public static boolean checkWechat(Context context) { | |
| 144 | + if (context == null || context.getPackageManager() == null) return false; | |
| 145 | + if (Util.isWXAppInstalledAndSupported(context)) return true; | |
| 146 | + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("weixin://")); | |
| 147 | + return !context.getPackageManager().queryIntentActivities(intent, 0).isEmpty(); | |
| 148 | + } | |
| 149 | + | |
| 150 | + | |
| 151 | + /** | |
| 152 | + * 处理分享地址 | |
| 153 | + * | |
| 154 | + * @param shareInfoUrl | |
| 155 | + * @param mContext | |
| 156 | + */ | |
| 157 | + public static String processUrlData(String shareInfoUrl, Context mContext, boolean isToWjj) { | |
| 158 | + if (shareInfoUrl.contains("http://wjjh5.cnlive.com") || shareInfoUrl.contains("http://wjjh5test.cnlive.com")) { | |
| 159 | + Uri oldUri = Uri.parse(shareInfoUrl); | |
| 160 | + //判断分享地址中是否有参数,如果没有则先拼接问号 | |
| 161 | + if (oldUri.getQueryParameterNames().size() <= 0) { | |
| 162 | + if (!shareInfoUrl.contains("?")) | |
| 163 | + shareInfoUrl = shareInfoUrl.concat("?"); | |
| 164 | + } | |
| 165 | + if (!shareInfoUrl.contains("?sid=") && !shareInfoUrl.contains("&sid=")) { | |
| 166 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 167 | + pageUrl.append(oldUri.getQueryParameterNames().size() <= 0 ? "sid=" : "&sid=").append(UserService.getUid(mContext)); | |
| 168 | + shareInfoUrl = pageUrl.toString(); | |
| 169 | + } | |
| 170 | + | |
| 171 | + if (!shareInfoUrl.contains("?shareSid=") && !shareInfoUrl.contains("&shareSid=")) { | |
| 172 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 173 | + pageUrl.append("&shareSid=").append(UserService.getUid(mContext)); | |
| 174 | + shareInfoUrl = pageUrl.toString(); | |
| 175 | + } | |
| 176 | + if (!shareInfoUrl.contains("?isApp=") && !shareInfoUrl.contains("&isApp=")) { | |
| 177 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 178 | + pageUrl.append("&isApp=").append(isToWjj); | |
| 179 | + shareInfoUrl = pageUrl.toString(); | |
| 180 | + } | |
| 181 | + | |
| 182 | + | |
| 183 | + if (!shareInfoUrl.contains("?ver=") && !shareInfoUrl.contains("&ver=")) { | |
| 184 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 185 | + pageUrl.append("&ver=").append(AppConfig.getAppVersion()); | |
| 186 | + shareInfoUrl = pageUrl.toString(); | |
| 187 | + } | |
| 188 | + | |
| 189 | + if (!shareInfoUrl.contains("?plat=") && !shareInfoUrl.contains("&plat=")) { | |
| 190 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 191 | + pageUrl.append("&plat=").append("a"); | |
| 192 | + shareInfoUrl = pageUrl.toString(); | |
| 193 | + } | |
| 194 | + | |
| 195 | + if (!shareInfoUrl.contains("?wjjFrom=") && !shareInfoUrl.contains("&wjjFrom=")) { | |
| 196 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 197 | + pageUrl.append("&wjjFrom=").append(AppConfig.getAppChannel()); | |
| 198 | + shareInfoUrl = pageUrl.toString(); | |
| 199 | + } | |
| 200 | + if (!shareInfoUrl.contains("?appId=") && !shareInfoUrl.contains("&appId=")) { | |
| 201 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 202 | + pageUrl.append("&appId=").append(AppConfig.getAppId()); | |
| 203 | + shareInfoUrl = pageUrl.toString(); | |
| 204 | + } | |
| 205 | + Uri uri = Uri.parse(shareInfoUrl); | |
| 206 | + | |
| 207 | + String[] urls = shareInfoUrl.split("\\?"); | |
| 208 | + String url = urls[0]; | |
| 209 | + StringBuilder pageUrl = new StringBuilder(url); | |
| 210 | + pageUrl.append("?"); | |
| 211 | + for (String key : uri.getQueryParameterNames()) { | |
| 212 | + if ("sid".equals(key)) { | |
| 213 | + pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(UserService.getUid(mContext)) ? "" : UserService.getUid(mContext))).append("&"); | |
| 214 | + } else if ("ver".equals(key)) { | |
| 215 | + pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(AppConfig.getAppVersion()) ? "" : AppConfig.getAppVersion())).append("&"); | |
| 216 | + } else if ("plat".equals(key)) { | |
| 217 | + pageUrl.append(key).append("=").append(Uri.encode("a")).append("&"); | |
| 218 | + } else if ("shareSid".equals(key)) { | |
| 219 | + pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(UserService.getUid(mContext)) ? "" : UserService.getUid(mContext))).append("&"); | |
| 220 | + } else if ("isApp".equals(key)) { | |
| 221 | + pageUrl.append(key).append("=").append(isToWjj).append("&"); | |
| 222 | + } else if ("wjjFrom".equals(key)) { | |
| 223 | + pageUrl.append(key).append("=").append(Uri.encode(AppConfig.getAppChannel())).append("&"); | |
| 224 | + } else if ("appId".equals(key)) { | |
| 225 | + pageUrl.append(key).append("=").append(Uri.encode(AppConfig.getAppId())).append("&"); | |
| 226 | + } else { | |
| 227 | + String value = UriUtil.getQueryParameterWithDecode(uri.getEncodedQuery(), key); | |
| 228 | + pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(value) ? "" : value)).append("&"); | |
| 229 | + } | |
| 230 | + } | |
| 231 | + pageUrl = deleteCharOfEnd(pageUrl, "&", true); | |
| 232 | + shareInfoUrl = pageUrl.toString(); | |
| 233 | + | |
| 234 | + | |
| 235 | + } | |
| 236 | + return shareInfoUrl; | |
| 237 | + } | |
| 238 | + | |
| 239 | + public static StringBuilder deleteCharOfEnd(StringBuilder strBud, String item, boolean asLast) { | |
| 240 | + if (strBud == null) return null; | |
| 241 | + int index = asLast ? strBud.lastIndexOf(item) : strBud.indexOf(item); | |
| 242 | + if (index == strBud.length() - 1) strBud.deleteCharAt(index); | |
| 243 | + return strBud; | |
| 244 | + } | |
| 245 | + | |
| 246 | + public static String buildTransaction(final String type) { | |
| 247 | + return (type == null) ? String.valueOf(System.currentTimeMillis()) : type + System.currentTimeMillis(); | |
| 248 | + } | |
| 249 | + | |
| 250 | + public static boolean isNetUrl(String url) { | |
| 251 | + | |
| 252 | + if (TextUtils.isEmpty(url)) return false; | |
| 253 | + | |
| 254 | + if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("rtsp:") || url.startsWith("ftp:")) { | |
| 255 | + return true; | |
| 256 | + } else { | |
| 257 | + return false; | |
| 258 | + } | |
| 259 | +// String UrlEndAppendNextChars = "(http[s]{0,1}|ftp)://[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,4})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:;_/=<>]*)?"; | |
| 260 | +// | |
| 261 | +// // 邮箱验证规则 | |
| 262 | +// // 编译正则表达式 | |
| 263 | +// | |
| 264 | +// Pattern pattern = Pattern.compile(UrlEndAppendNextChars); | |
| 265 | +// // 忽略大小写的写法 | |
| 266 | +// // Pattern pat = Pattern.compile(regEx, Pattern.CASE_INSENSITIVE); | |
| 267 | +// Matcher matcher = pattern.matcher(url); | |
| 268 | +// // 字符串是否与正则表达式相匹配 | |
| 269 | +// boolean rs = matcher.matches(); | |
| 270 | +// return Patterns.WEB_URL.matcher(url).matches(); | |
| 271 | + } | |
| 272 | + | |
| 273 | + public static boolean isWeiboInstallAndInit(Context context) { | |
| 274 | + if (context == null || context.getPackageManager() == null) return false; | |
| 275 | + if (!WbSdk.isWbInstall(context)) return false; | |
| 276 | + if (!Util.initWeibo(context)) return false; | |
| 277 | + return true; | |
| 278 | + } | |
| 279 | + | |
| 280 | + public static boolean initWeibo(Context context) { | |
| 281 | + try { | |
| 282 | + AuthInfo info = new AuthInfo(context, "3884700821", | |
| 283 | + "http://wjjh5.cnlive.com/apkdownload.php", | |
| 284 | + "email,direct_messages_read,direct_messages_write," | |
| 285 | + + "friendships_groups_read,friendships_groups_write,statuses_to_me_read," | |
| 286 | + + "follow_app_official_microblog," + "invitation_write"); | |
| 287 | + WbSdk.install(context, info); | |
| 288 | + WbSdk.checkInit(); | |
| 289 | + return true; | |
| 290 | + } catch (Exception ignored) { | |
| 291 | + } | |
| 292 | + return false; | |
| 293 | + } | |
| 294 | + | |
| 295 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/strike/data/network/api/ApiBaseRequest.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/strike/data/network/api/ApiBaseRequest.java | |
| 1 | +package com.cnlive.strike.data.network.api; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.util.Log; | |
| 5 | + | |
| 6 | +import com.cnlive.libs.base.application.AppConfig; | |
| 7 | +import com.cnlive.libs.base.logic.callback.DataCallback; | |
| 8 | +import com.cnlive.strike.data.network.model.BaseInfo; | |
| 9 | +import com.cnlive.libs.data.network.ApiBuild; | |
| 10 | +import com.cnlive.libs.data.network.Subscriber; | |
| 11 | +import com.cnlive.libs.data.network.interceptor.DESEncryptInterceptor; | |
| 12 | +import com.cnlive.libs.data.network.interceptor.DefaultEncryptInterceptor; | |
| 13 | +import com.cnlive.libs.data.network.interceptor.NetPPEncryptInterceptor; | |
| 14 | +import com.cnlive.libs.data.network.interceptor.NetPPPayEncryptInterceptor; | |
| 15 | +import com.cnlive.libs.data.network.interceptor.SignEncrypt2Interceptor; | |
| 16 | +import com.cnlive.libs.data.network.interceptor.SignEncryptInterceptor; | |
| 17 | + | |
| 18 | +import io.reactivex.android.schedulers.AndroidSchedulers; | |
| 19 | +import io.reactivex.disposables.Disposable; | |
| 20 | +import io.reactivex.schedulers.Schedulers; | |
| 21 | +import okhttp3.Interceptor; | |
| 22 | +import okhttp3.OkHttpClient; | |
| 23 | +import okhttp3.Request; | |
| 24 | +import okhttp3.Response; | |
| 25 | +import retrofit2.adapter.rxjava2.Result; | |
| 26 | + | |
| 27 | +import static com.cnlive.libs.base.logic.Config.SUCCESS; | |
| 28 | + | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * Created by xiansong on 2017/9/8. | |
| 32 | + */ | |
| 33 | + | |
| 34 | +public class ApiBaseRequest<Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> { | |
| 35 | + | |
| 36 | + private static final int OKHTTP_KEEP_ALIVE_DURATION_SECONDS = 10; | |
| 37 | + | |
| 38 | + //网家家 接口域名 | |
| 39 | + public static final String BASE_URL = "https://apiwjj.cnlive.com/"; | |
| 40 | + //网家家 测试环境 接口域名 | |
| 41 | + public static final String DEBUG_URL = "http://apiwjjtest.cnlive.com/"; | |
| 42 | + //IM 接口域名 | |
| 43 | + private static final String IM_URL = "https://wjjim.cnlive.com/"; | |
| 44 | + //IM 测试环境 接口域名 | |
| 45 | + public static final String IM_DEBUG_URL = "http://imtest.cnlive.com/"; | |
| 46 | + //OPEN API 接口域名 | |
| 47 | + public static final String OPEN_URL = "https://api.cnlive.com/"; | |
| 48 | + //WJJ JSON | |
| 49 | + private static final String JSON_URL = "https://wjj.ys1.cnliveimg.com/"; | |
| 50 | + | |
| 51 | + private static final String DEBUG_CMS_URL = "http://cmstest.cnlive.com:8768/"; | |
| 52 | + // TODO: 2018/11/27 cms正式地址 | |
| 53 | + private static final String CMS_URL = "http://cms.cnlive.com:8768/"; | |
| 54 | + | |
| 55 | + public static <T> String baseEndpoint() { | |
| 56 | + return AppConfig.isDebug() ? DEBUG_URL : BASE_URL; | |
| 57 | + } | |
| 58 | + | |
| 59 | + | |
| 60 | + public static <T> String baseIMEndpoint() { | |
| 61 | + return AppConfig.isDebug() ? IM_DEBUG_URL : IM_URL; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public static <T> String baseCMSEndpoint() { | |
| 65 | + return AppConfig.isDebug() ? DEBUG_CMS_URL : CMS_URL; | |
| 66 | + } | |
| 67 | + | |
| 68 | + private static <T> String serviceEndpoint(Class<T> clazz) { | |
| 69 | + if (clazz == ApiBaseServiceOpen.class) { | |
| 70 | + return OPEN_URL; | |
| 71 | + } else | |
| 72 | + return baseEndpoint(); | |
| 73 | + } | |
| 74 | + | |
| 75 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 76 | + ApiBaseRequest<Observable, BaseData> observable(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 77 | + return observable(clazz, false, api, null); | |
| 78 | + } | |
| 79 | + | |
| 80 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 81 | + ApiBaseRequest<Observable, BaseData> observable(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api, Interceptor interceptor) { | |
| 82 | + return observable(clazz, false, api, interceptor); | |
| 83 | + } | |
| 84 | + | |
| 85 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 86 | + ApiBaseRequest<Observable, BaseData> observable(Class<Service> clazz, boolean decode, ApiBuild.Api<Service, Observable, BaseData> api, Interceptor interceptor) { | |
| 87 | + ApiBaseRequest<Observable, BaseData> request = new ApiBaseRequest<>(); | |
| 88 | + ApiBuild<Service, Observable, BaseData> build = ApiBuild.service(clazz, api); | |
| 89 | + build.setEndpoint(serviceEndpoint(clazz)); | |
| 90 | + if (interceptor != null) build.addInterceptor(interceptor); | |
| 91 | + request.observable = build.build(decode, OKHTTP_KEEP_ALIVE_DURATION_SECONDS); | |
| 92 | + return request; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public static <Service> Service serviceNoSign(Class<Service> clazz) { | |
| 96 | + return service(clazz, (Interceptor) new DefaultEncryptInterceptor()); | |
| 97 | + } | |
| 98 | + | |
| 99 | + public static <Service> Service service(Class<Service> clazz) { | |
| 100 | + return service(clazz, new SignEncryptInterceptor()); | |
| 101 | + } | |
| 102 | + | |
| 103 | + public static <Service> Service service(Class<Service> clazz, boolean valueUrlencode, boolean responseUrldecode) { | |
| 104 | + return service(clazz, responseUrldecode, new SignEncryptInterceptor(valueUrlencode)); | |
| 105 | + } | |
| 106 | + | |
| 107 | + public static <Service> Service serviceDES(Class<Service> clazz) { | |
| 108 | + return service(clazz, new DESEncryptInterceptor()); | |
| 109 | + } | |
| 110 | + | |
| 111 | + public static <Service> Service serviceNetPP(Class<Service> clazz) { | |
| 112 | + return service(clazz, new NetPPEncryptInterceptor()); | |
| 113 | + } | |
| 114 | + | |
| 115 | + public static <Service> Service serviceNetPPPay(Class<Service> clazz) { | |
| 116 | + return service(clazz, new NetPPPayEncryptInterceptor()); | |
| 117 | + } | |
| 118 | + | |
| 119 | + | |
| 120 | + private static <Service> Service service(Class<Service> clazz, Interceptor... interceptor) { | |
| 121 | + return service(clazz, false, interceptor); | |
| 122 | + } | |
| 123 | + | |
| 124 | + private static <Service> Service service(Class<Service> clazz, boolean decode, Interceptor... interceptor) { | |
| 125 | + return ApiBuild.service(clazz, null) | |
| 126 | + .setEndpoint(serviceEndpoint(clazz)) | |
| 127 | + .addInterceptor(interceptor) | |
| 128 | + .service(decode, OKHTTP_KEEP_ALIVE_DURATION_SECONDS); | |
| 129 | + } | |
| 130 | + | |
| 131 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 132 | + ApiBaseRequest<Observable, BaseData> serviceNoSign(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 133 | + return service(clazz, api, new DefaultEncryptInterceptor()); | |
| 134 | + } | |
| 135 | + | |
| 136 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 137 | + ApiBaseRequest<Observable, BaseData> service(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 138 | + return service(clazz, api, new SignEncryptInterceptor()); | |
| 139 | + } | |
| 140 | + | |
| 141 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 142 | + ApiBaseRequest<Observable, BaseData> serviceNewVersion(Class<Service> clazz, long connectTimeout, long readTimeout, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 143 | + return serviceNewVersion(clazz, false, api, connectTimeout, readTimeout, new SignEncryptInterceptor()); | |
| 144 | + } | |
| 145 | + | |
| 146 | + | |
| 147 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 148 | + ApiBaseRequest<Observable, BaseData> service(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api, boolean valueUrlencode, boolean responseUrldecode) { | |
| 149 | + return service(clazz, responseUrldecode, api, new SignEncryptInterceptor(valueUrlencode)); | |
| 150 | + } | |
| 151 | + | |
| 152 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 153 | + ApiBaseRequest<Observable, BaseData> serviceDES(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 154 | + return service(clazz, api, new DESEncryptInterceptor()); | |
| 155 | + } | |
| 156 | + | |
| 157 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 158 | + ApiBaseRequest<Observable, BaseData> service2encode(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 159 | + return service(clazz, api, new SignEncrypt2Interceptor()); | |
| 160 | + } | |
| 161 | + | |
| 162 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 163 | + ApiBaseRequest<Observable, BaseData> serviceNetPP(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 164 | + return service(clazz, api, new NetPPEncryptInterceptor()); | |
| 165 | + } | |
| 166 | + | |
| 167 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 168 | + ApiBaseRequest<Observable, BaseData> serviceNetPPPay(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 169 | + return service(clazz, api, new NetPPPayEncryptInterceptor()); | |
| 170 | + } | |
| 171 | + | |
| 172 | + private static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 173 | + ApiBaseRequest<Observable, BaseData> service(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api, Interceptor... interceptor) { | |
| 174 | + return service(clazz, false, api, interceptor); | |
| 175 | + } | |
| 176 | + | |
| 177 | + private static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 178 | + ApiBaseRequest<Observable, BaseData> service(Class<Service> clazz, boolean decode, ApiBuild.Api<Service, Observable, BaseData> api, Interceptor... interceptor) { | |
| 179 | + | |
| 180 | + ApiBaseRequest<Observable, BaseData> request = new ApiBaseRequest<>(); | |
| 181 | + | |
| 182 | + request.observable = ApiBuild.service(clazz, api) | |
| 183 | + .setEndpoint(serviceEndpoint(clazz)) | |
| 184 | + .addInterceptor(interceptor) | |
| 185 | + .build(decode, OKHTTP_KEEP_ALIVE_DURATION_SECONDS); | |
| 186 | + | |
| 187 | + return request; | |
| 188 | + } | |
| 189 | + | |
| 190 | + | |
| 191 | + private static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 192 | + ApiBaseRequest<Observable, BaseData> serviceNewVersion(Class<Service> clazz, boolean decode, ApiBuild.Api<Service, Observable, BaseData> api, long connectTimeout, long readTimeout, Interceptor... interceptor) { | |
| 193 | + | |
| 194 | + ApiBaseRequest<Observable, BaseData> request = new ApiBaseRequest<>(); | |
| 195 | + | |
| 196 | + request.observable = ApiBuild.service(clazz, api) | |
| 197 | + .setEndpoint(serviceEndpoint(clazz)) | |
| 198 | + .setConnectTimeout(connectTimeout) | |
| 199 | + .setReadTimeout(readTimeout) | |
| 200 | + .addInterceptor(interceptor) | |
| 201 | + .build(decode); | |
| 202 | + | |
| 203 | + return request; | |
| 204 | + } | |
| 205 | + | |
| 206 | + private Observable observable; | |
| 207 | + | |
| 208 | + private ApiBaseRequest() { | |
| 209 | + } | |
| 210 | + | |
| 211 | + public static <Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 212 | + Disposable subscribe(Observable observable, Subscriber<BaseData> subscriber) { | |
| 213 | + return observable.take(1) | |
| 214 | + .subscribeOn(Schedulers.io()) | |
| 215 | + .observeOn(AndroidSchedulers.mainThread()) | |
| 216 | + .subscribe(subscriber.next, subscriber.error, subscriber.complete, subscriber.subscribe); | |
| 217 | + } | |
| 218 | + | |
| 219 | + public Disposable subscribe(Subscriber<BaseData> subscriber) { | |
| 220 | + return observable.take(1) | |
| 221 | + .subscribeOn(Schedulers.io()) | |
| 222 | + .observeOn(AndroidSchedulers.mainThread()) | |
| 223 | + .subscribe(subscriber.next, subscriber.error, subscriber.complete, subscriber.subscribe); | |
| 224 | + } | |
| 225 | + | |
| 226 | + public Disposable subscribe(Context context, DataCallback<BaseData> callback) { | |
| 227 | + Subscriber<BaseData> subscriber = new Subscriber<BaseData>(context) { | |
| 228 | + @Override | |
| 229 | + public void onCompleted(String s, String s1, BaseData data) { | |
| 230 | + if (callback == null) return; | |
| 231 | + callback.callback(SUCCESS, "", data); | |
| 232 | + } | |
| 233 | + | |
| 234 | + @Override | |
| 235 | + public void onError(String code, String message) { | |
| 236 | + if (callback == null) return; | |
| 237 | + int errorCode = -1; | |
| 238 | + try { | |
| 239 | + errorCode = Integer.valueOf(code); | |
| 240 | + } catch (Exception ignored) { | |
| 241 | + } | |
| 242 | + | |
| 243 | + Log.e("LynnTest read", code + " \n " + message); | |
| 244 | + callback.callback(errorCode, message, null); | |
| 245 | + } | |
| 246 | + }; | |
| 247 | + | |
| 248 | + return observable.take(1) | |
| 249 | + .subscribeOn(Schedulers.io()) | |
| 250 | + .observeOn(AndroidSchedulers.mainThread()) | |
| 251 | + .subscribe(subscriber.next, subscriber.error, subscriber.complete, subscriber.subscribe); | |
| 252 | + } | |
| 253 | + | |
| 254 | + public static Disposable loadData(String url, DataCallback<String> callback) { | |
| 255 | + return io.reactivex.Observable | |
| 256 | + .just(url) | |
| 257 | + .map(s -> { | |
| 258 | + Response response = null; | |
| 259 | + String data = null; | |
| 260 | + try { | |
| 261 | + OkHttpClient client = new OkHttpClient();//创建OkHttpClient对象 | |
| 262 | + Request request = new Request.Builder().url(url).build(); | |
| 263 | + response = client.newCall(request).execute();//得到Response 对 | |
| 264 | + if (response.isSuccessful()) data = response.body().string(); | |
| 265 | + } catch (Exception e) { | |
| 266 | + Log.e("Api", "", e); | |
| 267 | + } | |
| 268 | + | |
| 269 | + if (data != null) { | |
| 270 | +// Log.e("DemoView", "response.code()==" + response.code()); | |
| 271 | +// Log.e("DemoView", "response.message()==" + response.message()); | |
| 272 | +// Log.e("DemoView", "res==" + data); | |
| 273 | + //此时的代码执行在子线程,修改UI的操作请使用handler跳转到UI线程。 | |
| 274 | + } | |
| 275 | + return data; | |
| 276 | + }) | |
| 277 | + .subscribeOn(Schedulers.io()) | |
| 278 | + .observeOn(AndroidSchedulers.mainThread()) | |
| 279 | + .subscribe(s -> callback.callback(0, "", s)); | |
| 280 | + } | |
| 281 | + | |
| 282 | + public interface SetUrl { | |
| 283 | + <T> BaseRequest getUrl(Class<T> clazz); | |
| 284 | + | |
| 285 | + class BaseRequest { | |
| 286 | + Class clazz; | |
| 287 | + | |
| 288 | + } | |
| 289 | + } | |
| 290 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/strike/data/network/api/ApiBaseServiceOpen.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/strike/data/network/api/ApiBaseServiceOpen.java | |
| 1 | +package com.cnlive.strike.data.network.api; | |
| 2 | + | |
| 3 | +import com.cnlive.strike.data.network.model.BaseInfo; | |
| 4 | +import com.cnlive.strike.data.network.model.FaceData; | |
| 5 | +import com.cnlive.strike.data.network.model.TokenData; | |
| 6 | +import com.cnlive.strike.data.network.model.UserData; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | +import io.reactivex.Observable; | |
| 12 | +import okhttp3.MultipartBody; | |
| 13 | +import okhttp3.RequestBody; | |
| 14 | +import retrofit2.adapter.rxjava2.Result; | |
| 15 | +import retrofit2.http.Multipart; | |
| 16 | +import retrofit2.http.POST; | |
| 17 | +import retrofit2.http.Part; | |
| 18 | +import retrofit2.http.PartMap; | |
| 19 | +import retrofit2.http.QueryMap; | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Created by xiansong on 2018/3/22. | |
| 23 | + */ | |
| 24 | + | |
| 25 | +public interface ApiBaseServiceOpen { | |
| 26 | + | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 顶踩一条节目 0:踩 1:顶 | |
| 30 | + * | |
| 31 | + * @param map | |
| 32 | + * @return | |
| 33 | + */ | |
| 34 | + @POST("open/api2/ctServices/supportForHd/support") | |
| 35 | + Observable<Result<BaseInfo>> support(@QueryMap Map<String, String> map); | |
| 36 | + | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 快捷登录前发送验证码 | |
| 40 | + * | |
| 41 | + * @param map | |
| 42 | + * @return | |
| 43 | + */ | |
| 44 | + @POST("open/api2/user/sendVerifyCode") | |
| 45 | + Observable<Result<BaseInfo>> sendVerifyCodeBefQuickLogin(@QueryMap Map<String, String> map); | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 快捷登录 | |
| 49 | + * | |
| 50 | + * @param map | |
| 51 | + * @return | |
| 52 | + */ | |
| 53 | + @POST("open/api2/user/loginInQuickly") | |
| 54 | + Observable<Result<BaseInfo<UserData>>> quickLogin(@QueryMap Map<String, String> map); | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 登录 | |
| 58 | + * | |
| 59 | + * @param map | |
| 60 | + * @return | |
| 61 | + */ | |
| 62 | + @POST("open/api2/user/loginIn") | |
| 63 | + Observable<Result<BaseInfo<UserData>>> login(@QueryMap Map<String, String> map); | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * 查询用户信息 | |
| 67 | + * | |
| 68 | + * @param map | |
| 69 | + * @return | |
| 70 | + */ | |
| 71 | + @POST("open/api2/user/readUserById") | |
| 72 | + Observable<Result<BaseInfo<UserData>>> queryUserInfo(@QueryMap Map<String, String> map); | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 更新用户附加信息 | |
| 76 | + * | |
| 77 | + * @param map | |
| 78 | + * @return | |
| 79 | + */ | |
| 80 | + @POST("open/api2/user/updateUserExtInfo") | |
| 81 | + Observable<Result<BaseInfo>> updateUserExtInfo(@QueryMap Map<String, String> map); | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * 修改用户单项信息 | |
| 85 | + * | |
| 86 | + * @param map | |
| 87 | + * @return | |
| 88 | + */ | |
| 89 | + @POST("open/api2/user/updateUserById") | |
| 90 | + Observable<Result<BaseInfo>> modifyUserInfo(@QueryMap Map<String, String> map); | |
| 91 | + | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * 注册或修改手机号前发手机验证码 | |
| 95 | + * | |
| 96 | + * @param map | |
| 97 | + * @return | |
| 98 | + */ | |
| 99 | + @POST("open/api2/user/sendVerifyCodeForUnRegistered") | |
| 100 | + Observable<Result<BaseInfo>> sendVerifyCodeForUnRegistered(@QueryMap Map<String, String> map); | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * 更新手机号 | |
| 104 | + * | |
| 105 | + * @param map | |
| 106 | + * @return | |
| 107 | + */ | |
| 108 | + @POST("open/api2/user/updateMobileById") | |
| 109 | + Observable<Result<BaseInfo>> updateMobile(@QueryMap Map<String, String> map); | |
| 110 | + | |
| 111 | + /** | |
| 112 | + * 注册 | |
| 113 | + * | |
| 114 | + * @param map | |
| 115 | + * @return | |
| 116 | + */ | |
| 117 | + @POST("open/api2/user/register") | |
| 118 | + Observable<Result<BaseInfo<UserData>>> register(@QueryMap Map<String, String> map); | |
| 119 | + | |
| 120 | + | |
| 121 | + /** | |
| 122 | + * 获取access_token | |
| 123 | + * | |
| 124 | + * @param map | |
| 125 | + * @return | |
| 126 | + */ | |
| 127 | + @POST("open/api2/token") | |
| 128 | + Observable<Result<BaseInfo<TokenData>>> accessToken(@QueryMap Map<String, String> map); | |
| 129 | + | |
| 130 | + /** | |
| 131 | + * 上传头像 | |
| 132 | + * | |
| 133 | + * @param map | |
| 134 | + * @param params | |
| 135 | + * @return | |
| 136 | + */ | |
| 137 | + @Multipart | |
| 138 | + @POST("open/api2/user/updateUserFaceById") | |
| 139 | + Observable<Result<BaseInfo<FaceData>>> updateUserFace(@PartMap Map<String, RequestBody> map, | |
| 140 | + @Part List<MultipartBody.Part> params); | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + /** | |
| 145 | + * 音频播放鉴权接口 | |
| 146 | + * @param map | |
| 147 | + * @return | |
| 148 | + */ | |
| 149 | + @POST("open/api2/user/loginIn3rdForWJJ") | |
| 150 | + Observable<Result<BaseInfo<UserData>>> loginIn3rdForWJJ(@QueryMap Map<String, String> map); | |
| 151 | + /** | |
| 152 | + * 登陆 | |
| 153 | + * @param map | |
| 154 | + * @return | |
| 155 | + */ | |
| 156 | + @POST("open/api2/user/loginIn3rdAndMobileForWJJ") | |
| 157 | + Observable<Result<BaseInfo<UserData>>> loginIn3rdAndMobileForWJJ(@QueryMap Map<String, String> map); | |
| 158 | + | |
| 159 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/strike/data/network/api/ApiBaseSubscriber.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/strike/data/network/api/ApiBaseSubscriber.java | |
| 1 | +package com.cnlive.strike.data.network.api; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.cnlive.libs.data.network.Subscriber; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * Created by xiansong on 2017/9/8. | |
| 8 | + */ | |
| 9 | + | |
| 10 | +public class ApiBaseSubscriber { | |
| 11 | + | |
| 12 | + private static final String success_code = "0"; | |
| 13 | + private static final String success_message = "数据加载成功"; | |
| 14 | + | |
| 15 | + public static final Subscriber.Config subscriberBuild = Subscriber.newConfig() | |
| 16 | + .putInfo(Subscriber.Config.response_success, success_code, success_message) ; | |
| 17 | + | |
| 18 | + public static String getSuccessCode(){ | |
| 19 | + return success_code; | |
| 20 | + } | |
| 21 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/strike/data/network/api/ApiTest.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/strike/data/network/api/ApiTest.java | |
| 1 | +package com.cnlive.strike.data.network.api; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | + | |
| 5 | +import com.cnlive.libs.base.logic.callback.DataCallback; | |
| 6 | +import com.cnlive.libs.data.network.ApiBuild; | |
| 7 | +import com.cnlive.libs.data.network.Subscriber; | |
| 8 | + | |
| 9 | +import io.reactivex.Observable; | |
| 10 | +import io.reactivex.disposables.Disposable; | |
| 11 | +import okhttp3.Interceptor; | |
| 12 | + | |
| 13 | +public class ApiTest implements Test { | |
| 14 | + @Override | |
| 15 | + public String baseEndpoint() { | |
| 16 | + return null; | |
| 17 | + } | |
| 18 | + | |
| 19 | + @Override | |
| 20 | + public String baseIMEndpoint() { | |
| 21 | + return null; | |
| 22 | + } | |
| 23 | + | |
| 24 | + @Override | |
| 25 | + public String baseCMSEndpoint() { | |
| 26 | + return null; | |
| 27 | + } | |
| 28 | + | |
| 29 | + @Override | |
| 30 | + public String serviceEndpoint(Class clazz) { | |
| 31 | + return null; | |
| 32 | + } | |
| 33 | + | |
| 34 | + @Override | |
| 35 | + public ApiBaseRequest observable(Class clazz, ApiBuild.Api api) { | |
| 36 | + return null; | |
| 37 | + } | |
| 38 | + | |
| 39 | + @Override | |
| 40 | + public ApiBaseRequest observable(Class clazz, ApiBuild.Api api, Interceptor interceptor) { | |
| 41 | + return null; | |
| 42 | + } | |
| 43 | + | |
| 44 | + @Override | |
| 45 | + public ApiBaseRequest observable(Class clazz, boolean decode, ApiBuild.Api api, Interceptor interceptor) { | |
| 46 | + return null; | |
| 47 | + } | |
| 48 | + | |
| 49 | + @Override | |
| 50 | + public Object serviceNoSign(Class clazz) { | |
| 51 | + return null; | |
| 52 | + } | |
| 53 | + | |
| 54 | + @Override | |
| 55 | + public Object service(Class clazz) { | |
| 56 | + return null; | |
| 57 | + } | |
| 58 | + | |
| 59 | + @Override | |
| 60 | + public Object service(Class clazz, boolean valueUrlencode, boolean responseUrldecode) { | |
| 61 | + return null; | |
| 62 | + } | |
| 63 | + | |
| 64 | + @Override | |
| 65 | + public Object serviceDES(Class clazz) { | |
| 66 | + return null; | |
| 67 | + } | |
| 68 | + | |
| 69 | + @Override | |
| 70 | + public Object serviceNetPP(Class clazz) { | |
| 71 | + return null; | |
| 72 | + } | |
| 73 | + | |
| 74 | + @Override | |
| 75 | + public Object serviceNetPPPay(Class clazz) { | |
| 76 | + return null; | |
| 77 | + } | |
| 78 | + | |
| 79 | + @Override | |
| 80 | + public Object service(Class clazz, Interceptor... interceptor) { | |
| 81 | + return null; | |
| 82 | + } | |
| 83 | + | |
| 84 | + @Override | |
| 85 | + public Object service(Class clazz, boolean decode, Interceptor... interceptor) { | |
| 86 | + return null; | |
| 87 | + } | |
| 88 | + | |
| 89 | + @Override | |
| 90 | + public ApiBaseRequest serviceNoSign(Class clazz, ApiBuild.Api api) { | |
| 91 | + return null; | |
| 92 | + } | |
| 93 | + | |
| 94 | + @Override | |
| 95 | + public ApiBaseRequest service(Class clazz, ApiBuild.Api api) { | |
| 96 | + return null; | |
| 97 | + } | |
| 98 | + | |
| 99 | + @Override | |
| 100 | + public ApiBaseRequest serviceNewVersion(Class clazz, long connectTimeout, long readTimeout, ApiBuild.Api api) { | |
| 101 | + return null; | |
| 102 | + } | |
| 103 | + | |
| 104 | + @Override | |
| 105 | + public ApiBaseRequest service(Class clazz, ApiBuild.Api api, boolean valueUrlencode, boolean responseUrldecode) { | |
| 106 | + return null; | |
| 107 | + } | |
| 108 | + | |
| 109 | + @Override | |
| 110 | + public ApiBaseRequest serviceDES(Class clazz, ApiBuild.Api api) { | |
| 111 | + return null; | |
| 112 | + } | |
| 113 | + | |
| 114 | + @Override | |
| 115 | + public ApiBaseRequest service2encode(Class clazz, ApiBuild.Api api) { | |
| 116 | + return null; | |
| 117 | + } | |
| 118 | + | |
| 119 | + @Override | |
| 120 | + public ApiBaseRequest serviceNetPP(Class clazz, ApiBuild.Api api) { | |
| 121 | + return null; | |
| 122 | + } | |
| 123 | + | |
| 124 | + @Override | |
| 125 | + public ApiBaseRequest serviceNetPPPay(Class clazz, ApiBuild.Api api) { | |
| 126 | + return null; | |
| 127 | + } | |
| 128 | + | |
| 129 | + @Override | |
| 130 | + public ApiBaseRequest service(Class clazz, ApiBuild.Api api, Interceptor... interceptor) { | |
| 131 | + return null; | |
| 132 | + } | |
| 133 | + | |
| 134 | + @Override | |
| 135 | + public ApiBaseRequest service(Class clazz, boolean decode, ApiBuild.Api api, Interceptor... interceptor) { | |
| 136 | + return null; | |
| 137 | + } | |
| 138 | + | |
| 139 | + @Override | |
| 140 | + public ApiBaseRequest serviceNewVersion(Class clazz, boolean decode, ApiBuild.Api api, long connectTimeout, long readTimeout, Interceptor... interceptor) { | |
| 141 | + return null; | |
| 142 | + } | |
| 143 | + | |
| 144 | + @Override | |
| 145 | + public Disposable subscribe(Observable observable, Subscriber subscriber) { | |
| 146 | + return null; | |
| 147 | + } | |
| 148 | + | |
| 149 | + @Override | |
| 150 | + public Disposable subscribe(Subscriber subscriber) { | |
| 151 | + return null; | |
| 152 | + } | |
| 153 | + | |
| 154 | + @Override | |
| 155 | + public Disposable subscribe(Context context, DataCallback callback) { | |
| 156 | + return null; | |
| 157 | + } | |
| 158 | + | |
| 159 | + @Override | |
| 160 | + public Disposable loadData(String url, DataCallback callback) { | |
| 161 | + return null; | |
| 162 | + } | |
| 163 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/strike/data/network/api/Test.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/strike/data/network/api/Test.java | |
| 1 | +package com.cnlive.strike.data.network.api; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | + | |
| 5 | +import com.cnlive.libs.base.logic.callback.DataCallback; | |
| 6 | +import com.cnlive.libs.data.network.ApiBuild; | |
| 7 | +import com.cnlive.libs.data.network.Subscriber; | |
| 8 | +import com.cnlive.strike.data.network.model.BaseInfo; | |
| 9 | + | |
| 10 | +import io.reactivex.disposables.Disposable; | |
| 11 | +import okhttp3.Interceptor; | |
| 12 | +import retrofit2.adapter.rxjava2.Result; | |
| 13 | + | |
| 14 | +public interface Test<Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> { | |
| 15 | + public static final int OKHTTP_KEEP_ALIVE_DURATION_SECONDS = 10; | |
| 16 | + | |
| 17 | + //网家家 接口域名 | |
| 18 | + public static final String BASE_URL = "https://apiwjj.cnlive.com/"; | |
| 19 | + //网家家 测试环境 接口域名 | |
| 20 | + public static final String DEBUG_URL = "http://apiwjjtest.cnlive.com/"; | |
| 21 | + //IM 接口域名 | |
| 22 | + public static final String IM_URL = "https://wjjim.cnlive.com/"; | |
| 23 | + //IM 测试环境 接口域名 | |
| 24 | + public static final String IM_DEBUG_URL = "http://imtest.cnlive.com/"; | |
| 25 | + //OPEN API 接口域名 | |
| 26 | + public static final String OPEN_URL = "https://api.cnlive.com/"; | |
| 27 | + //WJJ JSON | |
| 28 | + public static final String JSON_URL = "https://wjj.ys1.cnliveimg.com/"; | |
| 29 | + | |
| 30 | + public static final String DEBUG_CMS_URL = "http://cmstest.cnlive.com:8768/"; | |
| 31 | + // TODO: 2018/11/27 cms正式地址 | |
| 32 | + public static final String CMS_URL = "http://cms.cnlive.com:8768/"; | |
| 33 | + | |
| 34 | + public <T> String baseEndpoint(); | |
| 35 | + | |
| 36 | + | |
| 37 | + public <T> String baseIMEndpoint(); | |
| 38 | + | |
| 39 | + public <T> String baseCMSEndpoint(); | |
| 40 | + | |
| 41 | + public <T> String serviceEndpoint(Class<T> clazz); | |
| 42 | + | |
| 43 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 44 | + ApiBaseRequest<Observable, BaseData> observable(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api); | |
| 45 | + | |
| 46 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 47 | + ApiBaseRequest<Observable, BaseData> observable(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api, Interceptor interceptor); | |
| 48 | + | |
| 49 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 50 | + ApiBaseRequest<Observable, BaseData> observable(Class<Service> clazz, boolean decode, ApiBuild.Api<Service, Observable, BaseData> api, Interceptor interceptor); | |
| 51 | + | |
| 52 | + public <Service> Service serviceNoSign(Class<Service> clazz); | |
| 53 | + | |
| 54 | + public <Service> Service service(Class<Service> clazz); | |
| 55 | + | |
| 56 | + public <Service> Service service(Class<Service> clazz, boolean valueUrlencode, boolean responseUrldecode); | |
| 57 | + | |
| 58 | + public <Service> Service serviceDES(Class<Service> clazz); | |
| 59 | + | |
| 60 | + public <Service> Service serviceNetPP(Class<Service> clazz); | |
| 61 | + | |
| 62 | + public <Service> Service serviceNetPPPay(Class<Service> clazz); | |
| 63 | + | |
| 64 | + | |
| 65 | + public <Service> Service service(Class<Service> clazz, Interceptor... interceptor); | |
| 66 | + | |
| 67 | + public <Service> Service service(Class<Service> clazz, boolean decode, Interceptor... interceptor); | |
| 68 | + | |
| 69 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 70 | + ApiBaseRequest<Observable, BaseData> serviceNoSign(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api); | |
| 71 | + | |
| 72 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 73 | + ApiBaseRequest<Observable, BaseData> service(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api); | |
| 74 | + | |
| 75 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 76 | + ApiBaseRequest<Observable, BaseData> serviceNewVersion(Class<Service> clazz, long connectTimeout, long readTimeout, ApiBuild.Api<Service, Observable, BaseData> api); | |
| 77 | + | |
| 78 | + | |
| 79 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 80 | + ApiBaseRequest<Observable, BaseData> service(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api, boolean valueUrlencode, boolean responseUrldecode); | |
| 81 | + | |
| 82 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 83 | + ApiBaseRequest<Observable, BaseData> serviceDES(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api); | |
| 84 | + | |
| 85 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 86 | + ApiBaseRequest<Observable, BaseData> service2encode(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api); | |
| 87 | + | |
| 88 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 89 | + ApiBaseRequest<Observable, BaseData> serviceNetPP(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api); | |
| 90 | + | |
| 91 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 92 | + ApiBaseRequest<Observable, BaseData> serviceNetPPPay(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api); | |
| 93 | + | |
| 94 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 95 | + ApiBaseRequest<Observable, BaseData> service(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api, Interceptor... interceptor); | |
| 96 | + | |
| 97 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 98 | + ApiBaseRequest<Observable, BaseData> service(Class<Service> clazz, boolean decode, ApiBuild.Api<Service, Observable, BaseData> api, Interceptor... interceptor); | |
| 99 | + | |
| 100 | + | |
| 101 | + public <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 102 | + ApiBaseRequest<Observable, BaseData> serviceNewVersion(Class<Service> clazz, boolean decode, ApiBuild.Api<Service, Observable, BaseData> api, long connectTimeout, long readTimeout, Interceptor... interceptor); | |
| 103 | + | |
| 104 | + | |
| 105 | + public <Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 106 | + Disposable subscribe(Observable observable, Subscriber<BaseData> subscriber); | |
| 107 | + | |
| 108 | + public Disposable subscribe(Subscriber<BaseData> subscriber); | |
| 109 | + | |
| 110 | + public Disposable subscribe(Context context, DataCallback<BaseData> callback); | |
| 111 | + | |
| 112 | + | |
| 113 | + public Disposable loadData(String url, DataCallback<String> callback); | |
| 114 | + | |
| 115 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/strike/data/network/model/BaseInfo.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/strike/data/network/model/BaseInfo.java | |
| 1 | +package com.cnlive.strike.data.network.model; | |
| 2 | + | |
| 3 | +import com.cnlive.libs.data.network.model.IBaseInfo; | |
| 4 | +import com.cnlive.strike.data.network.api.ApiBaseSubscriber; | |
| 5 | + | |
| 6 | + | |
| 7 | +public class BaseInfo<T> implements IBaseInfo { | |
| 8 | + //TODO 接口错误信息 需要自定义 | |
| 9 | + private String errorCode = ApiBaseSubscriber.getSuccessCode(); | |
| 10 | + private String errorMessage = ""; | |
| 11 | + | |
| 12 | + //TODO 接口内容数据 需要自定义 | |
| 13 | + private T data; | |
| 14 | + | |
| 15 | + public void setCode(String status_code) { | |
| 16 | + this.errorCode = status_code; | |
| 17 | + } | |
| 18 | + | |
| 19 | + @Override | |
| 20 | + public String getCode() { | |
| 21 | + return errorCode; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setMessage(String errorMessage) { | |
| 25 | + this.errorMessage = errorMessage; | |
| 26 | + } | |
| 27 | + | |
| 28 | + @Override | |
| 29 | + public String getMessage() { | |
| 30 | + return errorMessage; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setData(T data) { | |
| 34 | + this.data = data; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public T getData() { | |
| 38 | + return data; | |
| 39 | + } | |
| 40 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/strike/data/network/model/FaceData.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/strike/data/network/model/FaceData.java | |
| 1 | +package com.cnlive.strike.data.network.model; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by Lynn on 2018/10/15. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +public class FaceData { | |
| 8 | + private String faceUrl; | |
| 9 | + private String bigFaceUrl; | |
| 10 | + | |
| 11 | + public String getFaceUrl() { | |
| 12 | + return faceUrl; | |
| 13 | + } | |
| 14 | + | |
| 15 | + public void setFaceUrl(String faceUrl) { | |
| 16 | + this.faceUrl = faceUrl; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public String getBigFaceUrl() { | |
| 20 | + return bigFaceUrl; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setBigFaceUrl(String bigFaceUrl) { | |
| 24 | + this.bigFaceUrl = bigFaceUrl; | |
| 25 | + } | |
| 26 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/strike/data/network/model/StorageInfoData.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/strike/data/network/model/StorageInfoData.java | |
| 1 | +package com.cnlive.strike.data.network.model; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by cnlive201803 on 2018/5/31. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +public class StorageInfoData { | |
| 8 | + private int storageId; | |
| 9 | + private String storageName; | |
| 10 | + private int storageType; | |
| 11 | + private int state; | |
| 12 | + private int contentType; | |
| 13 | + private int profile; | |
| 14 | + private String domain; | |
| 15 | + | |
| 16 | + | |
| 17 | + public int getStorageId() { | |
| 18 | + return storageId; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public void setStorageId(int storageId) { | |
| 22 | + this.storageId = storageId; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public String getStorageName() { | |
| 26 | + return storageName; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public void setStorageName(String storageName) { | |
| 30 | + this.storageName = storageName; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public int getStorageType() { | |
| 34 | + return storageType; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setStorageType(int storageType) { | |
| 38 | + this.storageType = storageType; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public int getState() { | |
| 42 | + return state; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setState(int state) { | |
| 46 | + this.state = state; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public int getContentType() { | |
| 50 | + return contentType; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setContentType(int contentType) { | |
| 54 | + this.contentType = contentType; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public int getProfile() { | |
| 58 | + return profile; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setProfile(int profile) { | |
| 62 | + this.profile = profile; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public String getDomain() { | |
| 66 | + return domain; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setDomain(String domain) { | |
| 70 | + this.domain = domain; | |
| 71 | + } | |
| 72 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/strike/data/network/model/TimeStampInfo.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/strike/data/network/model/TimeStampInfo.java | |
| 1 | +package com.cnlive.strike.data.network.model; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 作者: 吴奎庆 | |
| 5 | + * <p> | |
| 6 | + * 时间: 2019/8/27 | |
| 7 | + * <p> | |
| 8 | + * 简介: | |
| 9 | + */ | |
| 10 | +public class TimeStampInfo { | |
| 11 | + long timestamp; | |
| 12 | + | |
| 13 | + public long getTimestamp() { | |
| 14 | + return timestamp; | |
| 15 | + } | |
| 16 | + | |
| 17 | + public void setTimestamp(long timestamp) { | |
| 18 | + this.timestamp = timestamp; | |
| 19 | + } | |
| 20 | +} | ... | ... |
moudle_user/src/main/java/com/cnlive/strike/data/network/model/TokenData.java
0 → 100644
| 1 | +++ a/moudle_user/src/main/java/com/cnlive/strike/data/network/model/TokenData.java | |
| 1 | +package com.cnlive.strike.data.network.model; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by Lynn on 2018/10/15. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +public class TokenData { | |
| 8 | + | |
| 9 | + private String access_token; | |
| 10 | + private int expires_in; | |
| 11 | + | |
| 12 | + public String getAccess_token() { | |
| 13 | + return access_token; | |
| 14 | + } | |
| 15 | + | |
| 16 | + public void setAccess_token(String access_token) { | |
| 17 | + this.access_token = access_token; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public int getExpires_in() { | |
| 21 | + return expires_in; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setExpires_in(int expires_in) { | |
| 25 | + this.expires_in = expires_in; | |
| 26 | + } | |
| 27 | +} | ... | ... |