Commit c6b9ffa4c871e08c0b8d153ceb5f04e01df47feb

Authored by YangShuai
1 parent 22a28a6e

创建项目

Showing 67 changed files with 257 additions and 4313 deletions

Too many changes to show.

To preserve performance only 67 of 329 files are displayed.

.idea/.name 0 → 100644
  1 +ModuleStrike
0 2 \ No newline at end of file
... ...
.idea/vcs.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="VcsDirectoryMappings">
  4 + <mapping directory="" vcs="Git" />
  5 + </component>
  6 +</project>
0 7 \ No newline at end of file
... ...
app/strike/build.gradle
1 1 apply plugin: 'com.android.application'
  2 +
  3 +static def stringValue(def value) {
  4 + return "\"${value}\""
  5 +}
  6 +
2 7 android {
3 8 compileSdkVersion 29
4 9 buildToolsVersion "29.0.2"
... ... @@ -13,31 +18,127 @@ android {
13 18  
14 19 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
15 20 consumerProguardFiles 'consumer-rules.pro'
16   - manifestPlaceholders = [
17   - APP_ID : "802_jhbqccxw08",
18   - APP_KEY : "9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f",
19   - APP_SECRET : "1e6380cb347255e777f72b5aa60f41daa68443a132aaea",
20   - H5_CNLIVE : "http://wjjh5test.cnlive.com/cnnews.html",
21   - H5_DP : "http://wjjh5test.cnlive.com/cndr.html",
22   - APP_START_HOST : "http://wjjh5test.cnlive.com",
23   - APP_WEB_START_HOST : "wjjh5test.cnlive.com",
24   - BAIDU_APP_KEY : "ibl8vbKkPVYBw5IOvR8tVGGo",
25   - BAIDU_APP_SECRET : "QEd6n1qruIGG8AYkyLyqepksO2uUe0GK",
26   - PAY_ACCOUNT : "wjj_app_test",
27   - WECHAT_APPID : "wx9b7f9443a8ccf15a",
28   - SHARE_ICON : "http://wjjh5test.cnlive.com/static/logo.png",
29   - SHARE_TITLE : "快来加入中国网家家,优享美好生活!",
30   - SHARE_DOWNLOAD : "https://fir.im/d35h",
31   - SHARE_APP_KEY : "@string/SHARE_APP_KEY_DEBUG",
32   - SHARE_APP_SCERET : "BNK5YVWfIBLir6WFaXTCNQLSFGTRs+Hnz5EkIfngJmOPLFBlUwmAbw==",
33   - SPECIAL_GROUP_MEMBER_LIMIT: 3
34   - ]
  21 + multiDexEnabled true
  22 + }
  23 + signingConfigs {
  24 + debugConfig {
  25 + storeFile file("www.cnlive.com.key")
  26 + storePassword "www.cnlive.comPassw0rd"
  27 + keyAlias "strike-debug"
  28 + keyPassword "www.cnlive.com"
  29 + }
  30 + releaseConfig {
  31 + storeFile file("www.cnlive.com.key")
  32 + storePassword "www.cnlive.comPassw0rd"
  33 + keyAlias "strike"
  34 + keyPassword "www.cnlive.com"
  35 + }
  36 + }
  37 + dexOptions {
  38 + javaMaxHeapSize '4g'
35 39 }
36   -
37 40 buildTypes {
  41 + debug {
  42 + signingConfig signingConfigs.debugConfig
  43 + zipAlignEnabled true
  44 + //测试版本1
  45 +// signingConfig signingConfigs.releaseConfig
  46 +// versionNameSuffix '-preview'
  47 +// resValue("string", "app_name", "网家家 内测")
  48 +// buildConfigField("boolean", "VERSION_AS_DEBUG", "true")
  49 + //测试版本2
  50 +// debuggable = false
  51 + applicationIdSuffix ".debug"
  52 + resValue("string", "app_name", "网家家 内测")
  53 + buildConfigField("boolean", "VERSION_AS_DEBUG", "true")
  54 + buildConfigField("String", "APP_ID", stringValue("802_jhbqccxw08"))
  55 + buildConfigField("String", "APP_KEY", stringValue("9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f"))
  56 + buildConfigField("String", "APP_SCERET", stringValue("1e6380cb347255e777f72b5aa60f41daa68443a132aaea"))
  57 + buildConfigField("String", "SHARE_APP_KEY", stringValue("26192e9007048"))
  58 + buildConfigField("String", "SHARE_APP_SCERET", stringValue("BNK5YVWfIBLir6WFaXTCNQLSFGTRs+Hnz5EkIfngJmOPLFBlUwmAbw=="))
  59 + buildConfigField("String", "PAY_ACCOUNT", stringValue("wjj_app_test"))
  60 + buildConfigField("String", "H5_CNLIVE", stringValue("http://wjjh5test.cnlive.com/cnnews.html"))
  61 + buildConfigField("String", "H5_DP", stringValue("http://wjjh5test.cnlive.com/cndr.html"))
  62 + buildConfigField("String", "APP_WEB_START_HOST", stringValue("wjjh5test.cnlive.com"))
  63 + buildConfigField("int", "SPECIAL_GROUP_MEMBER_LIMIT", "3")
  64 + buildConfigField("String", "TINGYUN_KEY", stringValue("631d38c6c09247debaab5389e5387b9a"))
  65 + buildConfigField("String", "BAIDU_APP_ID", stringValue("14380872"))
  66 + buildConfigField("String", "BAIDU_APP_KEY", stringValue("ibl8vbKkPVYBw5IOvR8tVGGo"))
  67 + buildConfigField("String", "BAIDU_APP_SECRET", stringValue("QEd6n1qruIGG8AYkyLyqepksO2uUe0GK"))
  68 + buildConfigField("String", "WECHAT_APPID", stringValue("wx9b7f9443a8ccf15a"))
  69 + buildConfigField("String", "SHARE_TITLE", stringValue("快来加入中国网家家,优享美好生活!"))
  70 + buildConfigField("String", "SHARE_SUBTITLE", stringValue("中国网家家 让生活更美好!"))
  71 + buildConfigField("String", "SHARE_DOWNLOAD", stringValue("https://fir.im/d35h"))
  72 + buildConfigField("String", "SHARE_ICON", stringValue("http://wjjh5test.cnlive.com/static/logo.png"))
  73 + buildConfigField("String", "HTML_SUBSCRIBE", stringValue(" http://wjjh5test.cnlive.com/cnSubscription.html"))
  74 + buildConfigField("String", "REPORT_URL", stringValue("http://wjjh5test.cnlive.com/cnReport.html?"))
  75 + buildConfigField("String", "BAIDU_MAP_APP_KEY", stringValue("2IIsTtvX2FA88yvDrPZedc2ZvMhxyDbN"))
  76 + buildConfigField("String", "SHOP_PATH", stringValue("wjjshop.cnlive.com"))
  77 + buildConfigField("String", "UMENG_APPKEY", stringValue("5d6482a30cafb21b6b000d14"))
  78 +
  79 + resValue("string", "outshare", "网家家好友Debug")
  80 + resValue("string", "outsharecircle", "网家家生活圈Debug")
  81 +
  82 + buildConfigField("String", "APP_SPLASH_VERSION", stringValue("5"))
  83 +
  84 + manifestPlaceholders = [
  85 + TINGYUN_SCHEME : "tingyun.33201",
  86 + APP_START_HOST : "wjjh5test.cnlive.com",
  87 + MAP_APPKEY : "2298a0e307e69fab64c02d7d0412fd73",
  88 + BAIDU_APP_ID : "14380872",
  89 + BAIDU_APP_KEY : "ibl8vbKkPVYBw5IOvR8tVGGo",
  90 + BAIDU_MAP_APP_KEY: "2IIsTtvX2FA88yvDrPZedc2ZvMhxyDbN",
  91 + BAIDU_APP_SECRET : "QEd6n1qruIGG8AYkyLyqepksO2uUe0GK",
  92 + UMENG_APPKEY : "5d6482a30cafb21b6b000d14",
  93 + OPENINSTALL_KEY : "gzqtwt"
  94 + ]
  95 + }
38 96 release {
39   - minifyEnabled false
40   - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  97 + signingConfig signingConfigs.releaseConfig
  98 + zipAlignEnabled true
  99 + resValue("string", "app_name", "网家家")
  100 + buildConfigField("boolean", "VERSION_AS_DEBUG", "false")
  101 + buildConfigField("String", "APP_ID", stringValue("769_jetj7bq525"))
  102 + buildConfigField("String", "APP_KEY", stringValue("0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d"))
  103 + buildConfigField("String", "APP_SCERET", stringValue("275e8dc29274a1186d82f65bc607c231d02bcb3bfd8976"))
  104 + buildConfigField("String", "SHARE_APP_KEY", stringValue("24e4abeaa92d8"))
  105 + buildConfigField("String", "SHARE_APP_SCERET", stringValue("FFtu2hsTjCHaZobVP4xNJNoQi1AqS9o8bdYYiv/3SXJTDva0l0arSw=="))
  106 + buildConfigField("String", "PAY_ACCOUNT", stringValue("wjj_app"))
  107 + buildConfigField("String", "H5_CNLIVE", stringValue("http://wjjh5.cnlive.com/index.html"))
  108 + buildConfigField("String", "H5_DP", stringValue("http://wjjh5.cnlive.com/number.html"))
  109 + buildConfigField("String", "APP_WEB_START_HOST", stringValue("wjjh5.cnlive.com"))
  110 + buildConfigField("int", "SPECIAL_GROUP_MEMBER_LIMIT", "10")
  111 + buildConfigField("String", "TINGYUN_KEY", stringValue("4069112acd1c429693e6f9bf70eba939"))
  112 + buildConfigField("String", "BAIDU_APP_ID", stringValue("14380860"))
  113 + buildConfigField("String", "BAIDU_APP_KEY", stringValue("4bX1eK7SiCL461QBnRKilowc"))
  114 + buildConfigField("String", "BAIDU_APP_SECRET", stringValue("BTzXLoPbUjlLeOM1nHnfOuTB9q18YZVq"))
  115 + buildConfigField("String", "WECHAT_APPID", stringValue("wxed528fc749b7ee88"))
  116 + buildConfigField("String", "SHARE_TITLE", stringValue("快来加入中国网家家,优享美好生活!"))
  117 + buildConfigField("String", "SHARE_SUBTITLE", stringValue("中国网家家 让生活更美好!"))
  118 + buildConfigField("String", "SHARE_DOWNLOAD", stringValue("http://apiwjj.cnlive.com/download/index.html"))
  119 + buildConfigField("String", "SHARE_ICON", stringValue("http://wjjh5.cnlive.com/static/logo.png"))
  120 + buildConfigField("String", "HTML_SUBSCRIBE", stringValue(" http://wjjh5.cnlive.com/cnSubscription.html"))
  121 + buildConfigField("String", "REPORT_URL", stringValue("http://wjjh5.cnlive.com/cnReport.html?"))
  122 + buildConfigField("String", "BAIDU_MAP_APP_KEY", stringValue("Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2"))
  123 + buildConfigField("String", "SHOP_PATH", stringValue("managemall.cnlive.com"))
  124 + buildConfigField("String", "UMENG_APPKEY", stringValue("5d647f890cafb21b6b000aee"))
  125 +
  126 + resValue("string", "outshare", "网家家好友")
  127 + resValue("string", "outsharecircle", "网家家生活圈")
  128 +
  129 + buildConfigField("String", "APP_SPLASH_VERSION", stringValue("5"))
  130 +
  131 + manifestPlaceholders = [
  132 + TINGYUN_SCHEME : "tingyun.33867",
  133 + APP_START_HOST : "wjjh5.cnlive.com",
  134 + MAP_APPKEY : "4b9aa4122d1d6f4d6beb6cb7701f2873",
  135 + BAIDU_APP_ID : "14380860",
  136 + BAIDU_APP_KEY : "4bX1eK7SiCL461QBnRKilowc",
  137 + BAIDU_MAP_APP_KEY: "Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2",
  138 + BAIDU_APP_SECRET : "BTzXLoPbUjlLeOM1nHnfOuTB9q18YZVq",
  139 + UMENG_APPKEY : "5d647f890cafb21b6b000aee",
  140 + OPENINSTALL_KEY : "vfkj9x"
  141 + ]
41 142 }
42 143 }
43 144  
... ... @@ -54,7 +155,9 @@ dependencies {
54 155  
55 156 // implementation project(path: ':core:database')
56 157 implementation project(path: ':core:network')
  158 + implementation project(path: ':core:base')
  159 +
57 160 // implementation project(path: ':core:util')
58 161 // implementation project(path: ':core:encipher')
59   - implementation project(path: ':cloud:user')
  162 +// implementation project(path: ':cloud:user')
60 163 }
... ...
app/strike/src/main/AndroidManifest.xml
... ... @@ -22,56 +22,30 @@
22 22 </activity>
23 23  
24 24 <meta-data
25   - android:name="com.cnlive.sdk.APP_ID"
26   - android:value="${APP_ID}" />
  25 + android:name="com.baidu.lbsapi.API_KEY"
  26 + android:value="${BAIDU_MAP_APP_KEY}" />
27 27 <meta-data
28   - android:name="com.cnlive.sdk.APP_KEY"
29   - android:value="${APP_KEY}" />
  28 + android:name="com.baidu.speech.APP_ID"
  29 + android:value="${BAIDU_APP_ID}" />
30 30 <meta-data
31   - android:name="com.cnlive.sdk.APP_SECRET"
32   - android:value="${APP_SECRET}" />
33   - <meta-data
34   - android:name="com.cnlive.app.H5_CNLIVE"
35   - android:value="${H5_CNLIVE}" />
36   - <meta-data
37   - android:name="com.cnlive.app.H5_DP"
38   - android:value="${H5_DP}" />
39   - <meta-data
40   - android:name="com.cnlive.app.APP_START_HOST"
41   - android:value="${APP_START_HOST}" />
42   - <meta-data
43   - android:name="com.cnlive.app.APP_WEB_START_HOST"
44   - android:value="${APP_WEB_START_HOST}" />
45   - <meta-data
46   - android:name="com.cnlive.app.BAIDU_APP_KEY"
  31 + android:name="com.baidu.speech.API_KEY"
47 32 android:value="${BAIDU_APP_KEY}" />
48 33 <meta-data
49   - android:name="com.cnlive.app.BAIDU_APP_SECRET"
  34 + android:name="com.baidu.speech.SECRET_KEY"
50 35 android:value="${BAIDU_APP_SECRET}" />
  36 +
  37 + <!--友盟&渠道配置-->
51 38 <meta-data
52   - android:name="com.cnlive.app.PAY_ACCOUNT"
53   - android:value="${PAY_ACCOUNT}" />
54   - <meta-data
55   - android:name="com.cnlive.app.WECHAT_APPID"
56   - android:value="${WECHAT_APPID}" />
57   - <meta-data
58   - android:name="com.cnlive.app.SHARE_ICON"
59   - android:value="${SHARE_ICON}" />
60   - <meta-data
61   - android:name="com.cnlive.app.SHARE_TITLE"
62   - android:value="${SHARE_TITLE}" />
63   - <meta-data
64   - android:name="com.cnlive.app.SHARE_DOWNLOAD"
65   - android:value="${SHARE_DOWNLOAD}" />
66   - <meta-data
67   - android:name="com.cnlive.app.SHARE_APP_KEY"
68   - android:value="${SHARE_APP_KEY}" />
  39 + android:name="UMENG_APPKEY"
  40 + android:value="${UMENG_APPKEY}" />
69 41 <meta-data
70   - android:name="com.cnlive.app.SHARE_APP_SCERET"
71   - android:value="${SHARE_APP_SCERET}" />
  42 + android:name="UMENG_CHANNEL"
  43 + android:value="debug" />
  44 +
  45 + <!-- OPEN-INSTALL-->
72 46 <meta-data
73   - android:name="com.cnlive.app.SPECIAL_GROUP_MEMBER_LIMIT"
74   - android:value="${SPECIAL_GROUP_MEMBER_LIMIT}" />
  47 + android:name="com.openinstall.APP_KEY"
  48 + android:value="${OPENINSTALL_KEY}" />
75 49 </application>
76 50  
77 51 </manifest>
78 52 \ No newline at end of file
... ...
app/strike/src/main/java/com/cnlive/strike/MainActivity.java
1 1 package com.cnlive.strike;
2 2  
3   -import androidx.appcompat.app.AppCompatActivity;
  3 +import com.cnlive.libs.base.mvp.BaseActivity;
4 4  
5   -import android.os.Bundle;
  5 +public class MainActivity extends BaseActivity {
6 6  
7   -public class MainActivity extends AppCompatActivity {
8 7  
9 8 @Override
10   - protected void onCreate(Bundle savedInstanceState) {
11   - super.onCreate(savedInstanceState);
12   - setContentView(R.layout.activity_main);
  9 + protected int initLayout() {
  10 + return R.layout.activity_main;
  11 + }
  12 +
  13 + @Override
  14 + protected void initView() {
  15 + getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,new MyFragment()).commitAllowingStateLoss();
  16 +
  17 + }
  18 +
  19 + @Override
  20 + protected void initData() {
  21 +
13 22 }
14 23 }
... ...
app/strike/src/main/java/com/cnlive/strike/MyFragment.java 0 → 100644
  1 +package com.cnlive.strike;
  2 +
  3 +import android.util.Log;
  4 +
  5 +import com.cnlive.libs.base.mvp.BaseFragment;
  6 +
  7 +public class MyFragment extends BaseFragment<MyFragmentView,MyPresenter> {
  8 +
  9 + @Override
  10 + protected int initLayout() {
  11 + return R.layout.activity_main1;
  12 + }
  13 +
  14 + @Override
  15 + protected void init() {
  16 + Log.e(TAG, "init: "+TAG );
  17 + }
  18 +}
... ...
app/strike/src/main/java/com/cnlive/strike/MyFragmentView.java 0 → 100644
  1 +package com.cnlive.strike;
  2 +
  3 +import com.cnlive.libs.base.mvp.BaseFragment;
  4 +import com.cnlive.libs.base.mvp.BaseView;
  5 +
  6 +public class MyFragmentView extends BaseView {
  7 +
  8 +
  9 + public MyFragmentView(BaseFragment fragment) {
  10 + super(fragment);
  11 + }
  12 +
  13 + @Override
  14 + protected void initView() {
  15 + }
  16 +
  17 + @Override
  18 + protected void initData() {
  19 +
  20 + }
  21 +
  22 + public void test() {
  23 + }
  24 +}
... ...
app/strike/src/main/java/com/cnlive/strike/MyPresenter.java 0 → 100644
  1 +package com.cnlive.strike;
  2 +
  3 +import com.cnlive.libs.base.mvp.BasePresenter;
  4 +
  5 +public class MyPresenter extends BasePresenter<MyFragmentView> {
  6 +
  7 + public void test() {
  8 + getView().test();
  9 + }
  10 +}
... ...
app/strike/src/main/res/layout/activity_main.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2   -<androidx.constraintlayout.widget.ConstraintLayout 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">
  2 +<layout>
  3 + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4 + xmlns:app="http://schemas.android.com/apk/res-auto"
  5 + xmlns:tools="http://schemas.android.com/tools"
  6 + android:layout_width="match_parent"
  7 + android:layout_height="match_parent"
  8 + android:orientation="vertical"
  9 + tools:context=".ui.activity.AllDeviceActivity">
8 10  
9   -</androidx.constraintlayout.widget.ConstraintLayout>
10 11 \ No newline at end of file
  12 + <RelativeLayout
  13 + android:id="@+id/fragment_container"
  14 + android:layout_width="match_parent"
  15 + android:layout_height="match_parent"></RelativeLayout>
  16 +
  17 + </RelativeLayout>
  18 +</layout>
11 19 \ No newline at end of file
... ...
app/strike/src/main/res/layout/activity_main1.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout>
  3 +
  4 + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  5 + xmlns:app="http://schemas.android.com/apk/res-auto"
  6 + xmlns:tools="http://schemas.android.com/tools"
  7 + android:layout_width="match_parent"
  8 + android:layout_height="match_parent"
  9 + android:orientation="vertical"
  10 + tools:context=".ui.activity.AllDeviceActivity">
  11 +
  12 + <TextView
  13 + android:id="@+id/tv1"
  14 + android:layout_width="wrap_content"
  15 + android:layout_height="wrap_content"
  16 + android:text="fragment" />
  17 +
  18 + </RelativeLayout>
  19 +</layout>
0 20 \ No newline at end of file
... ...
app/strike/src/main/res/layout/activity_test.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:orientation="vertical" android:layout_width="match_parent"
  4 + android:layout_height="match_parent">
  5 +
  6 +</LinearLayout>
0 7 \ No newline at end of file
... ...
app/strike/src/main/res/values/strings.xml
1 1 <resources>
2   - <string name="app_name">strike</string>
  2 +<!-- <string name="app_name">strike</string>-->
3 3 </resources>
... ...
build.gradle
... ... @@ -74,7 +74,6 @@ allprojects {
74 74 dexOptions {
75 75 javaMaxHeapSize '4g'
76 76 }
77   -
78 77 signingConfigs {
79 78 debugConfig {
80 79 storeFile file("www.cnlive.com.key")
... ...
cloud/user/.gitignore deleted 100644 → 0
1   -/build
cloud/user/build.gradle deleted 100644 → 0
1   -apply plugin: 'com.android.library'
2   -
3   -static def stringValue(def value) {
4   - return "\"${value}\""
5   -}
6   -
7   -
8   -android {
9   -
10   - defaultConfig {
11   - }
12   -
13   - buildTypes {
14   - debug {
15   - resValue("string", "ACCOUNT_LABEL", "网家家 内测")
16   - resValue("string", "ACCOUNT_TYPE", "com.c nlive.strike.debug.AccountType")
17   - resValue("string", "ACCOUNT_PROVIDE", "com.cnlive.strike.debug.AccountProvide")
18   - zipAlignEnabled true
19   - }
20   - release {
21   - resValue("string", "ACCOUNT_LABEL", "网家家")
22   - resValue("string", "ACCOUNT_TYPE", "com.cnlive.strike.AccountType")
23   - resValue("string", "ACCOUNT_PROVIDE", "com.cnlive.strike.AccountProvide")
24   - minifyEnabled false
25   - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
26   - zipAlignEnabled true
27   - }
28   - }
29   - dataBinding {
30   - enabled true
31   - }
32   -
33   -}
34   -
35   -dependencies {
36   - implementation fileTree(dir: 'libs', include: ['*.jar'])
37   - implementation project(path: ':core:network')
38   -}
cloud/user/consumer-rules.pro deleted 100644 → 0
cloud/user/proguard-rules.pro deleted 100644 → 0
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
cloud/user/src/androidTest/java/com/cnlive/core/user/ExampleInstrumentedTest.java deleted 100644 → 0
1   -package com.cnlive.core.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.user.test", appContext.getPackageName());
26   - }
27   -}
cloud/user/src/debug/res/mipmap-hdpi/icon_account.png deleted 100644 → 0

4.41 KB

cloud/user/src/debug/res/mipmap-ldpi/icon_account.png deleted 100644 → 0

2.17 KB

cloud/user/src/debug/res/mipmap-xhdpi/icon_account.png deleted 100644 → 0

5.93 KB

cloud/user/src/debug/res/mipmap-xxhdpi/icon_account.png deleted 100644 → 0

9.25 KB

cloud/user/src/debug/res/mipmap-xxxhdpi/icon_account.png deleted 100644 → 0

13.2 KB

cloud/user/src/main/AndroidManifest.xml deleted 100644 → 0
1   -<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2   - xmlns:tools="http://schemas.android.com/tools"
3   - package="com.cnlive.core.user">
4   - <uses-permission android:name="android.permission.INTERNET" />
5   -
6   - <!-- for mta statistics, not necessary-->
7   - <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
8   - <uses-permission android:name="android.permission.READ_PHONE_STATE" />
9   - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
10   - <uses-permission
11   - android:name="android.permission.AUTHENTICATE_ACCOUNTS"
12   - android:maxSdkVersion="22" />
13   - <uses-permission
14   - android:name="android.permission.GET_ACCOUNTS"
15   - android:maxSdkVersion="22" />
16   - <uses-permission
17   - android:name="android.permission.MANAGE_ACCOUNTS"
18   - android:maxSdkVersion="22" />
19   - <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" /> <!-- 账户自动更新 App保活相关 -->
20   - <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
21   - <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
22   - <uses-permission android:name="android.permission.ACTION_LIGHT_DEVICE_IDLE_MODE_CHANGED" />
23   - <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 账户权限相关 -->
24   - <uses-permission
25   - android:name="android.permission.INTERACT_ACROSS_USERS_FULL"
26   - tools:ignore="ProtectedPermissions" />
27   - <uses-permission
28   - android:name="android.permission.ACCOUNT_MANAGER"
29   - tools:ignore="ProtectedPermissions" />
30   - <uses-permission android:name="android.permission.INTERNET" />
31   -
32   - <application android:largeHeap="true">
33   -
34   - <activity android:name="com.cnlive.strike.moudle.user.ui.activity.MainTestActivity" />
35   - <activity
36   - android:name="com.cnlive.strike.moudle.user.ui.activity.LoginActivity"
37   - android:configChanges="keyboardHidden|screenSize|orientation|smallestScreenSize|screenLayout"
38   - android:launchMode="singleTop"
39   - android:screenOrientation="portrait"
40   - android:windowSoftInputMode="stateHidden|adjustPan">
41   - <intent-filter>
42   - <action android:name="android.accounts.AccountAuthenticator" />
43   - </intent-filter>
44   - </activity>
45   -
46   - <activity
47   - android:name="com.cnlive.strike.moudle.user.ui.activity.BindPhoneNumberActivity"
48   - android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
49   - android:launchMode="singleTop"
50   - android:screenOrientation="portrait" />
51   - <activity
52   - android:name="com.cnlive.strike.moudle.user.ui.activity.FirstLoginActivity"
53   - android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
54   - android:launchMode="singleTop"
55   - android:screenOrientation="portrait" />
56   - <activity
57   - android:name="com.cnlive.strike.moudle.user.ui.activity.SelectCountryActivity"
58   - android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
59   - android:launchMode="singleTask"
60   - android:screenOrientation="portrait"
61   - android:windowSoftInputMode="adjustResize" />
62   - <!-- 个人资料页-->
63   - <activity
64   - android:name="com.cnlive.strike.moudle.user.ui.activity.PersonalDataActivity"
65   - android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
66   - android:launchMode="singleTop"
67   - android:screenOrientation="portrait" />
68   - <!--预览头像-->
69   - <activity
70   - android:name="com.cnlive.strike.moudle.user.ui.activity.PersonalImageActivity"
71   - android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
72   - android:launchMode="singleTop"
73   - android:screenOrientation="portrait" />
74   - <!-- 个人资料姓名-->
75   - <activity
76   - android:name="com.cnlive.strike.moudle.user.ui.activity.UpdateContentActivity"
77   - android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
78   - android:launchMode="singleTop"
79   - android:screenOrientation="portrait"
80   - android:windowSoftInputMode="stateVisible|adjustPan" />
81   - <!-- 个人签名-->
82   - <activity
83   - android:name="com.cnlive.strike.moudle.user.ui.activity.SignatureActivity"
84   - android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
85   - android:launchMode="singleTop"
86   - android:screenOrientation="portrait"
87   - android:windowSoftInputMode="stateVisible|adjustPan" />
88   - </application>
89   -</manifest>
cloud/user/src/main/java/com/cnlive/strike/data/network/api/ApiBaseRequest.java deleted 100644 → 0
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.data.network.ApiBuild;
7   -import com.cnlive.libs.data.network.Subscriber;
8   -import com.cnlive.libs.data.network.interceptor.DESEncryptInterceptor;
9   -import com.cnlive.libs.data.network.interceptor.DefaultEncryptInterceptor;
10   -import com.cnlive.libs.data.network.interceptor.NetPPEncryptInterceptor;
11   -import com.cnlive.libs.data.network.interceptor.NetPPPayEncryptInterceptor;
12   -import com.cnlive.libs.data.network.interceptor.SignEncrypt2Interceptor;
13   -import com.cnlive.libs.data.network.interceptor.SignEncryptInterceptor;
14   -import com.cnlive.strike.data.network.model.BaseInfo;
15   -import com.cnlive.libs.base.application.AppConfig;
16   -import com.cnlive.libs.base.logic.callback.DataCallback;
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   -}
cloud/user/src/main/java/com/cnlive/strike/data/network/api/ApiBaseServiceOpen.java deleted 100644 → 0
1   -package com.cnlive.strike.data.network.api;
2   -
3   -
4   -import com.cnlive.strike.data.network.model.BaseInfo;
5   -import com.cnlive.strike.data.network.model.FaceData;
6   -import com.cnlive.strike.data.network.model.TokenData;
7   -import com.cnlive.strike.data.network.model.UserData;
8   -
9   -import java.util.List;
10   -import java.util.Map;
11   -
12   -import io.reactivex.Observable;
13   -import okhttp3.MultipartBody;
14   -import okhttp3.RequestBody;
15   -import retrofit2.adapter.rxjava2.Result;
16   -import retrofit2.http.Multipart;
17   -import retrofit2.http.POST;
18   -import retrofit2.http.Part;
19   -import retrofit2.http.PartMap;
20   -import retrofit2.http.QueryMap;
21   -
22   -/**
23   - * Created by xiansong on 2018/3/22.
24   - */
25   -
26   -public interface ApiBaseServiceOpen {
27   -
28   -
29   - /**
30   - * 顶踩一条节目 0:踩 1:顶
31   - *
32   - * @param map
33   - * @return
34   - */
35   - @POST("open/api2/ctServices/supportForHd/support")
36   - Observable<Result<BaseInfo>> support(@QueryMap Map<String, String> map);
37   -
38   -
39   - /**
40   - * 快捷登录前发送验证码
41   - *
42   - * @param map
43   - * @return
44   - */
45   - @POST("open/api2/user/sendVerifyCode")
46   - Observable<Result<BaseInfo>> sendVerifyCodeBefQuickLogin(@QueryMap Map<String, String> map);
47   -
48   - /**
49   - * 快捷登录
50   - *
51   - * @param map
52   - * @return
53   - */
54   - @POST("open/api2/user/loginInQuickly")
55   - Observable<Result<BaseInfo<UserData>>> quickLogin(@QueryMap Map<String, String> map);
56   -
57   - /**
58   - * 登录
59   - *
60   - * @param map
61   - * @return
62   - */
63   - @POST("open/api2/user/loginIn")
64   - Observable<Result<BaseInfo<UserData>>> login(@QueryMap Map<String, String> map);
65   -
66   - /**
67   - * 查询用户信息
68   - *
69   - * @param map
70   - * @return
71   - */
72   - @POST("open/api2/user/readUserById")
73   - Observable<Result<BaseInfo<UserData>>> queryUserInfo(@QueryMap Map<String, String> map);
74   -
75   - /**
76   - * 更新用户附加信息
77   - *
78   - * @param map
79   - * @return
80   - */
81   - @POST("open/api2/user/updateUserExtInfo")
82   - Observable<Result<BaseInfo>> updateUserExtInfo(@QueryMap Map<String, String> map);
83   -
84   - /**
85   - * 修改用户单项信息
86   - *
87   - * @param map
88   - * @return
89   - */
90   - @POST("open/api2/user/updateUserById")
91   - Observable<Result<BaseInfo>> modifyUserInfo(@QueryMap Map<String, String> map);
92   -
93   -
94   - /**
95   - * 注册或修改手机号前发手机验证码
96   - *
97   - * @param map
98   - * @return
99   - */
100   - @POST("open/api2/user/sendVerifyCodeForUnRegistered")
101   - Observable<Result<BaseInfo>> sendVerifyCodeForUnRegistered(@QueryMap Map<String, String> map);
102   -
103   - /**
104   - * 更新手机号
105   - *
106   - * @param map
107   - * @return
108   - */
109   - @POST("open/api2/user/updateMobileById")
110   - Observable<Result<BaseInfo>> updateMobile(@QueryMap Map<String, String> map);
111   -
112   - /**
113   - * 注册
114   - *
115   - * @param map
116   - * @return
117   - */
118   - @POST("open/api2/user/register")
119   - Observable<Result<BaseInfo<UserData>>> register(@QueryMap Map<String, String> map);
120   -
121   -
122   - /**
123   - * 获取access_token
124   - *
125   - * @param map
126   - * @return
127   - */
128   - @POST("open/api2/token")
129   - Observable<Result<BaseInfo<TokenData>>> accessToken(@QueryMap Map<String, String> map);
130   -
131   - /**
132   - * 上传头像
133   - *
134   - * @param map
135   - * @param params
136   - * @return
137   - */
138   - @Multipart
139   - @POST("open/api2/user/updateUserFaceById")
140   - Observable<Result<BaseInfo<FaceData>>> updateUserFace(@PartMap Map<String, RequestBody> map,
141   - @Part List<MultipartBody.Part> params);
142   -
143   -
144   -
145   - /**
146   - * 音频播放鉴权接口
147   - * @param map
148   - * @return
149   - */
150   - @POST("open/api2/user/loginIn3rdForWJJ")
151   - Observable<Result<BaseInfo<UserData>>> loginIn3rdForWJJ(@QueryMap Map<String, String> map);
152   - /**
153   - * 登陆
154   - * @param map
155   - * @return
156   - */
157   - @POST("open/api2/user/loginIn3rdAndMobileForWJJ")
158   - Observable<Result<BaseInfo<UserData>>> loginIn3rdAndMobileForWJJ(@QueryMap Map<String, String> map);
159   -
160   -}
cloud/user/src/main/java/com/cnlive/strike/data/network/api/ApiBaseSubscriber.java deleted 100644 → 0
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   -}
cloud/user/src/main/java/com/cnlive/strike/data/network/api/Test.java deleted 100644 → 0
1   -package com.cnlive.strike.data.network.api;
2   -
3   -import android.content.Context;
4   -
5   -import com.cnlive.libs.data.network.ApiBuild;
6   -import com.cnlive.libs.data.network.Subscriber;
7   -import com.cnlive.strike.data.network.model.BaseInfo;
8   -import com.cnlive.libs.base.logic.callback.DataCallback;
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   -}
cloud/user/src/main/java/com/cnlive/strike/data/network/model/BaseInfo.java deleted 100644 → 0
1   -package com.cnlive.strike.data.network.model;
2   -
3   -import com.cnlive.libs.base.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   -}
cloud/user/src/main/java/com/cnlive/strike/data/network/model/FaceData.java deleted 100644 → 0
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   -}
cloud/user/src/main/java/com/cnlive/strike/data/network/model/StorageInfoData.java deleted 100644 → 0
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   -}
cloud/user/src/main/java/com/cnlive/strike/data/network/model/TimeStampInfo.java deleted 100644 → 0
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   -}
cloud/user/src/main/java/com/cnlive/strike/data/network/model/TokenData.java deleted 100644 → 0
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   -}
cloud/user/src/main/java/com/cnlive/strike/data/network/model/UserData.java deleted 100644 → 0
1   -package com.cnlive.strike.data.network.model;
2   -
3   -/**
4   - * Created by Lynn on 2018/10/15.
5   - */
6   -
7   -public class UserData {
8   - private String uid;
9   - private String nickName;
10   - private String gender;
11   - private String location;
12   - private String faceUrl;
13   - private String mobile;
14   - private String email;
15   - private String extInfo;
16   - private String qqUid;
17   - private String wxUid;
18   - private String sinaUid;
19   - private String renrenUid;
20   - private String hUid;
21   - private String platformId;
22   - private String token;
23   - private String callbackAcitvityStatushttpPostUrl;
24   - private boolean isNewUser;
25   - private String bigFaceUrl;
26   - private String countryCode = "86";//手机号国家码
27   -
28   - public String getUid() {
29   - return uid;
30   - }
31   -
32   - public void setUid(String uid) {
33   - this.uid = uid;
34   - }
35   -
36   - public String getNickName() {
37   - return nickName;
38   - }
39   -
40   - public void setNickName(String nickName) {
41   - this.nickName = nickName;
42   - }
43   -
44   - public String getLocation() {
45   - return location;
46   - }
47   -
48   - public void setLocation(String location) {
49   - this.location = location;
50   - }
51   -
52   - public String getGender() {
53   - return gender;
54   - }
55   -
56   - public void setGender(String gender) {
57   - this.gender = gender;
58   - }
59   -
60   - public String getFaceUrl() {
61   - return faceUrl;
62   - }
63   -
64   - public void setFaceUrl(String faceUrl) {
65   - this.faceUrl = faceUrl;
66   - }
67   -
68   - public String getToken() {
69   - return token;
70   - }
71   -
72   - public void setToken(String token) {
73   - this.token = token;
74   - }
75   -
76   - public String getExtInfo() {
77   - return extInfo;
78   - }
79   -
80   - public void setExtInfo(String extInfo) {
81   - this.extInfo = extInfo;
82   - }
83   -
84   - public String getMobile() {
85   - return mobile;
86   - }
87   -
88   - public void setMobile(String mobile) {
89   - this.mobile = mobile;
90   - }
91   -
92   - public String getEmail() {
93   - return email;
94   - }
95   -
96   - public void setEmail(String email) {
97   - this.email = email;
98   - }
99   -
100   - public String getQqUid() {
101   - return qqUid;
102   - }
103   -
104   - public void setQqUid(String qqUid) {
105   - this.qqUid = qqUid;
106   - }
107   -
108   - public String getWxUid() {
109   - return wxUid;
110   - }
111   -
112   - public void setWxUid(String wxUid) {
113   - this.wxUid = wxUid;
114   - }
115   -
116   - public String getSinaUid() {
117   - return sinaUid;
118   - }
119   -
120   - public void setSinaUid(String sinaUid) {
121   - this.sinaUid = sinaUid;
122   - }
123   -
124   - public String getRenrenUid() {
125   - return renrenUid;
126   - }
127   -
128   - public void setRenrenUid(String renrenUid) {
129   - this.renrenUid = renrenUid;
130   - }
131   -
132   - public String gethUid() {
133   - return hUid;
134   - }
135   -
136   - public void sethUid(String hUid) {
137   - this.hUid = hUid;
138   - }
139   -
140   - public String getPlatformId() {
141   - return platformId;
142   - }
143   -
144   - public void setPlatformId(String platformId) {
145   - this.platformId = platformId;
146   - }
147   -
148   - public boolean isNewUser() {
149   - return isNewUser;
150   - }
151   -
152   - public void setNewUser(boolean newUser) {
153   - isNewUser = newUser;
154   - }
155   -
156   - public String getBigFaceUrl() {
157   - return bigFaceUrl;
158   - }
159   -
160   - public void setBigFaceUrl(String bigFaceUrl) {
161   - this.bigFaceUrl = bigFaceUrl;
162   - }
163   -
164   - public String getCountryCode() {
165   - return countryCode;
166   - }
167   -
168   - public void setCountryCode(String countryCode) {
169   - this.countryCode = countryCode;
170   - }
171   -
172   - public String getCallbackAcitvityStatushttpPostUrl() {
173   - return callbackAcitvityStatushttpPostUrl;
174   - }
175   -
176   - public void setCallbackAcitvityStatushttpPostUrl(String callbackAcitvityStatushttpPostUrl) {
177   - this.callbackAcitvityStatushttpPostUrl = callbackAcitvityStatushttpPostUrl;
178   - }
179   -
180   - @Override
181   - public String toString() {
182   - return "UserData{" +
183   - "uid='" + uid + '\'' +
184   - ", nickName='" + nickName + '\'' +
185   - ", gender='" + gender + '\'' +
186   - ", location='" + location + '\'' +
187   - ", faceUrl='" + faceUrl + '\'' +
188   - ", mobile='" + mobile + '\'' +
189   - ", email='" + email + '\'' +
190   - ", extInfo='" + extInfo + '\'' +
191   - ", qqUid='" + qqUid + '\'' +
192   - ", wxUid='" + wxUid + '\'' +
193   - ", sinaUid='" + sinaUid + '\'' +
194   - ", renrenUid='" + renrenUid + '\'' +
195   - ", hUid='" + hUid + '\'' +
196   - ", platformId='" + platformId + '\'' +
197   - ", token='" + token + '\'' +
198   - ", callbackAcitvityStatushttpPostUrl='" + callbackAcitvityStatushttpPostUrl + '\'' +
199   - ", isNewUser=" + isNewUser +
200   - ", bigFaceUrl='" + bigFaceUrl + '\'' +
201   - ", countryCode='" + countryCode + '\'' +
202   - '}';
203   - }
204   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/base/BaseBackActivity.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.base;
2   -
3   -import android.content.Context;
4   -import android.os.Bundle;
5   -import androidx.core.app.Fragment;
6   -import android.support.v7.app.AppCompatActivity;
7   -import android.text.TextUtils;
8   -import android.view.Gravity;
9   -import android.view.LayoutInflater;
10   -import android.view.View;
11   -import android.widget.ImageView;
12   -import android.widget.RelativeLayout;
13   -import android.widget.TextView;
14   -
15   -import com.cnlive.core.user.R;
16   -import com.cnlive.libs.base.util.StatusBarUtil;
17   -import com.cnlive.libs.base.util.StatusBarUtil2;
18   -import com.cnlive.strike.moudle.conversation.util.QMUIUtil;
19   -import com.qmuiteam.qmui.widget.QMUITopBar;
20   -
21   -/**
22   - * Created by gujun on 2017/9/7.
23   - */
24   -
25   -public abstract class BaseBackActivity extends AppCompatActivity {
26   - protected QMUITopBar toolbar;
27   - protected Fragment mFragment;
28   -
29   - protected void setupToolBar(String title) {
30   - StatusBarUtil.setStatusBarWrite(this);
31   - StatusBarUtil2.setColor(this, getResources().getColor(R.color.color_fff), 0);
32   - toolbar = findViewById(R.id.includeToolbar);
33   - toolbar.setTitle(title);
34   - toolbar.setVisibility(View.VISIBLE);
35   - toolbar.addLeftImageButton(R.drawable.drd_fanhui, R.id.qmui_topbar_item_left_back).setOnClickListener(v -> onBackPressed());
36   -
37   - QMUIUtil.setTopBar(toolbar, TextUtils.TruncateAt.MARQUEE);
38   - }
39   -
40   - public TextView addRightTextButtonWrapContent(int bgId) {
41   - int dp_10 = DensityUtils.dp2px(this, 10);
42   - TextView textView = new TextView(this);
43   - textView.setBackgroundResource(bgId > 0 ? bgId : android.R.color.transparent);
44   - textView.setGravity(Gravity.CENTER);
45   - textView.setTextSize(15f);
46   - textView.setPadding(dp_10, 0, dp_10, 0);
47   - RelativeLayout.LayoutParams rl = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
48   - rl.addRule(RelativeLayout.CENTER_IN_PARENT);
49   - toolbar.addRightView(textView, R.id.rightBtn, rl);
50   - return textView;
51   - }
52   -
53   - public void setToolBarTitle(String title) {
54   - if (toolbar == null) return;
55   - toolbar.setTitle(title);
56   - }
57   -
58   - public View addRightView(int imageResId, int viewId) {
59   - if (toolbar == null) return null;
60   - View view = LayoutInflater.from(this).inflate(R.layout.layout_toolbar_menu, null);
61   - ImageView btn = view.findViewById(R.id.image);
62   - btn.setImageResource(imageResId);
63   - RelativeLayout.LayoutParams rl = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
64   - rl.addRule(RelativeLayout.CENTER_IN_PARENT);
65   - toolbar.addRightView(view, viewId, rl);
66   - return view;
67   - }
68   -
69   - public View addRightView(int imageResId, int viewId, int paddingLeft, int paddingRight) {
70   - if (toolbar == null) return null;
71   - View view = LayoutInflater.from(this).inflate(R.layout.layout_toolbar_menu, null);
72   - view.setPadding(paddingLeft, 0, paddingRight, 0);
73   - ImageView btn = view.findViewById(R.id.image);
74   - btn.setImageResource(imageResId);
75   - RelativeLayout.LayoutParams rl = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
76   - rl.addRule(RelativeLayout.CENTER_IN_PARENT);
77   - toolbar.addRightView(view, viewId, rl);
78   - return view;
79   - }
80   -
81   - public static View addRightView(Context context, QMUITopBar toolbar, int layoutId, int imageResId, int viewId) {
82   - if (toolbar == null) return null;
83   - View view = LayoutInflater.from(context).inflate(layoutId, null);
84   - ImageView btn = view.findViewById(R.id.image);
85   - btn.setImageResource(imageResId);
86   - RelativeLayout.LayoutParams rl = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
87   - rl.addRule(RelativeLayout.CENTER_IN_PARENT);
88   - rl.setMargins(DensityUtil.dp2px(5), 0, DensityUtil.dp2px(15), 0);
89   - toolbar.addRightView(view, viewId, rl);
90   - return view;
91   - }
92   -
93   - public static View addRightView(Context context, QMUITopBar toolbar, int imageResId, int viewId) {
94   - if (toolbar == null) return null;
95   - View view = LayoutInflater.from(context).inflate(R.layout.layout_toolbar_menu, null);
96   - ImageView btn = view.findViewById(R.id.image);
97   - btn.setImageResource(imageResId);
98   - RelativeLayout.LayoutParams rl = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
99   - rl.addRule(RelativeLayout.CENTER_IN_PARENT);
100   - toolbar.addRightView(view, viewId, rl);
101   - return view;
102   - }
103   -
104   - @Override
105   - protected void onSaveInstanceState(Bundle outState) {
106   - super.onSaveInstanceState(outState);
107   - if (mFragment != null) {
108   - getSupportFragmentManager().putFragment(outState, "fragment", mFragment);
109   - }
110   - }
111   -
112   - protected Fragment getSaveFragment(Bundle savedInstanceState) {
113   - if (savedInstanceState == null) return null;
114   - return getSupportFragmentManager().getFragment(savedInstanceState, "fragment");
115   - }
116   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/base/adapter/DataBindingAdapter.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.base.adapter;
2   -
3   -import android.content.Context;
4   -import android.support.v7.widget.RecyclerView;
5   -import android.view.LayoutInflater;
6   -import android.view.View;
7   -import android.view.ViewGroup;
8   -
9   -import androidx.databinding.DataBindingUtil;
10   -import androidx.databinding.ViewDataBinding;
11   -
12   -import com.cnlive.libs.base.ui.adapter.BaseRecyclerAdapter;
13   -import com.cnlive.libs.base.ui.adapter.holder.DataBindingViewHolder;
14   -import com.cnlive.core.user.BR;
15   -
16   -/**
17   - * Created by gujun on 2017/5/23.
18   - */
19   -
20   -public class DataBindingAdapter<T> extends BaseRecyclerAdapter<T> {
21   - private int layoutId;
22   - protected int itemBRId;
23   -
24   - protected OnAdapterViewClickListener<T> l;
25   - protected OnAdapterViewLoadMoreListener loadMoreListener;
26   -
27   - public DataBindingAdapter(Context context) {
28   - super(context);
29   - }
30   -
31   - public DataBindingAdapter(Context context, int layoutId, int itemBRId) {
32   - super(context);
33   - this.layoutId = layoutId;
34   - this.itemBRId = itemBRId;
35   - }
36   -
37   - public void setOnViewClickListener(OnAdapterViewClickListener listener) {
38   - l = listener;
39   - }
40   -
41   - public void setOnLoadMoreListener(OnAdapterViewLoadMoreListener listener) {
42   - loadMoreListener = listener;
43   - }
44   -
45   - @Override
46   - public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
47   - ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), layoutId, parent, false);
48   - DataBindingViewHolder viewHolder = new DataBindingViewHolder(binding.getRoot());
49   - viewHolder.setBinding(binding);
50   - return viewHolder;
51   - }
52   -
53   - @Override
54   - public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
55   - DataBindingViewHolder videoListViewHolder = (DataBindingViewHolder) holder;
56   - videoListViewHolder.getBinding().setVariable(itemBRId, getItem(position));
57   - if (l != null)
58   - videoListViewHolder.getBinding().setVariable(BR.clickListener, l);
59   - videoListViewHolder.getBinding().executePendingBindings();
60   - if (loadMoreListener != null && position == getList().size() - 1) {
61   - loadMoreListener.onLoadMore();
62   - }
63   - }
64   -
65   - public interface OnAdapterViewClickListener<T> {
66   - void onViewClick(View v, T program);
67   - }
68   -
69   - public interface OnAdapterViewLoadMoreListener {
70   - void onLoadMore();
71   - }
72   -
73   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/baseim/routers/UserRouter.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.baseim.routers;
2   -
3   -import android.content.Context;
4   -
5   -import com.alibaba.android.arouter.launcher.ARouter;
6   -
7   -public class UserRouter {
8   -
9   - public static void startRestartActivity(Context context) {
10   - ARouter.getInstance().build("/cnuser/RestartActivity").navigation(context);
11   - }
12   -
13   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/baseim/util/PinyinUtil.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.baseim.util;
2   -
3   -
4   -import net.sourceforge.pinyin4j.PinyinHelper;
5   -import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
6   -import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
7   -import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
8   -
9   -/**
10   - * 拼音工具类
11   - *
12   - * @author Liu Wenzhu
13   - */
14   -public class PinyinUtil {
15   - private static HanyuPinyinOutputFormat outputFormat;
16   -
17   - static {
18   - outputFormat = new HanyuPinyinOutputFormat(); // 设置格式
19   - outputFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE); // 没有音标
20   - outputFormat.setCaseType(HanyuPinyinCaseType.UPPERCASE); // 输出拼音为大写字母
21   - }
22   -
23   - private PinyinUtil() {
24   - }
25   -
26   - /**
27   - * 将字符串的第一个汉字转化为拼音 <br>
28   - * 若该字符串的第一个字为英文字母,则原样返回
29   - *
30   - * @param str 欲要将首字转换为拼音的字符串
31   - * @return String 拼音/英文
32   - */
33   - public static String getPinyin(String str) {
34   - // 去除中英文标点及空格
35   - str = str.trim().replaceAll("\\p{P}", "").trim();
36   - String[] strs = null;
37   - try {
38   - strs = PinyinHelper.toHanyuPinyinStringArray(str.charAt(0), outputFormat);
39   - } catch (Exception e) {
40   - }
41   - if (strs != null) {
42   - str = strs[0];
43   - }
44   - return str;
45   - }
46   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/baseim/util/im/IMReconnect.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.baseim.util.im;
2   -
3   -public enum IMReconnect {
4   - CONNECTED, DISCONNECT
5   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/baseim/util/im/IMReconnectObservable.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.baseim.util.im;
2   -
3   -
4   -import java.util.Observable;
5   -
6   -public class IMReconnectObservable extends Observable {
7   -
8   - private static IMReconnectObservable instance = new IMReconnectObservable();
9   -
10   - public static IMReconnectObservable getInstance() {
11   - return instance;
12   - }
13   -
14   - public void updateState(IMReconnect info) {
15   - setChanged();
16   - notifyObservers(info);
17   - }
18   -
19   -}
20 0 \ No newline at end of file
cloud/user/src/main/java/com/cnlive/strike/moudle/baseim/util/search/CharacterParser.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.baseim.util.search;
2   -
3   -public class CharacterParser {
4   - private static int[] pyvalue = new int[]{-20319, -20317, -20304, -20295,
5   - -20292, -20283, -20265, -20257, -20242, -20230, -20051, -20036,
6   - -20032, -20026, -20002, -19990, -19986, -19982, -19976, -19805,
7   - -19784, -19775, -19774, -19763, -19756, -19751, -19746, -19741,
8   - -19739, -19728, -19725, -19715, -19540, -19531, -19525, -19515,
9   - -19500, -19484, -19479, -19467, -19289, -19288, -19281, -19275,
10   - -19270, -19263, -19261, -19249, -19243, -19242, -19238, -19235,
11   - -19227, -19224, -19218, -19212, -19038, -19023, -19018, -19006,
12   - -19003, -18996, -18977, -18961, -18952, -18783, -18774, -18773,
13   - -18763, -18756, -18741, -18735, -18731, -18722, -18710, -18697,
14   - -18696, -18526, -18518, -18501, -18490, -18478, -18463, -18448,
15   - -18447, -18446, -18239, -18237, -18231, -18220, -18211, -18201,
16   - -18184, -18183, -18181, -18012, -17997, -17988, -17970, -17964,
17   - -17961, -17950, -17947, -17931, -17928, -17922, -17759, -17752,
18   - -17733, -17730, -17721, -17703, -17701, -17697, -17692, -17683,
19   - -17676, -17496, -17487, -17482, -17468, -17454, -17433, -17427,
20   - -17417, -17202, -17185, -16983, -16970, -16942, -16915, -16733,
21   - -16708, -16706, -16689, -16664, -16657, -16647, -16474, -16470,
22   - -16465, -16459, -16452, -16448, -16433, -16429, -16427, -16423,
23   - -16419, -16412, -16407, -16403, -16401, -16393, -16220, -16216,
24   - -16212, -16205, -16202, -16187, -16180, -16171, -16169, -16158,
25   - -16155, -15959, -15958, -15944, -15933, -15920, -15915, -15903,
26   - -15889, -15878, -15707, -15701, -15681, -15667, -15661, -15659,
27   - -15652, -15640, -15631, -15625, -15454, -15448, -15436, -15435,
28   - -15419, -15416, -15408, -15394, -15385, -15377, -15375, -15369,
29   - -15363, -15362, -15183, -15180, -15165, -15158, -15153, -15150,
30   - -15149, -15144, -15143, -15141, -15140, -15139, -15128, -15121,
31   - -15119, -15117, -15110, -15109, -14941, -14937, -14933, -14930,
32   - -14929, -14928, -14926, -14922, -14921, -14914, -14908, -14902,
33   - -14894, -14889, -14882, -14873, -14871, -14857, -14678, -14674,
34   - -14670, -14668, -14663, -14654, -14645, -14630, -14594, -14429,
35   - -14407, -14399, -14384, -14379, -14368, -14355, -14353, -14345,
36   - -14170, -14159, -14151, -14149, -14145, -14140, -14137, -14135,
37   - -14125, -14123, -14122, -14112, -14109, -14099, -14097, -14094,
38   - -14092, -14090, -14087, -14083, -13917, -13914, -13910, -13907,
39   - -13906, -13905, -13896, -13894, -13878, -13870, -13859, -13847,
40   - -13831, -13658, -13611, -13601, -13406, -13404, -13400, -13398,
41   - -13395, -13391, -13387, -13383, -13367, -13359, -13356, -13343,
42   - -13340, -13329, -13326, -13318, -13147, -13138, -13120, -13107,
43   - -13096, -13095, -13091, -13076, -13068, -13063, -13060, -12888,
44   - -12875, -12871, -12860, -12858, -12852, -12849, -12838, -12831,
45   - -12829, -12812, -12802, -12607, -12597, -12594, -12585, -12556,
46   - -12359, -12346, -12320, -12300, -12120, -12099, -12089, -12074,
47   - -12067, -12058, -12039, -11867, -11861, -11847, -11831, -11798,
48   - -11781, -11604, -11589, -11536, -11358, -11340, -11339, -11324,
49   - -11303, -11097, -11077, -11067, -11055, -11052, -11045, -11041,
50   - -11038, -11024, -11020, -11019, -11018, -11014, -10838, -10832,
51   - -10815, -10800, -10790, -10780, -10764, -10587, -10544, -10533,
52   - -10519, -10331, -10329, -10328, -10322, -10315, -10309, -10307,
53   - -10296, -10281, -10274, -10270, -10262, -10260, -10256, -10254};
54   - public static String[] pystr = new String[]{"a", "ai", "an", "ang", "ao",
55   - "ba", "bai", "ban", "bang", "bao", "bei", "ben", "beng", "bi",
56   - "bian", "biao", "bie", "bin", "bing", "bo", "bu", "ca", "cai",
57   - "can", "cang", "cao", "ce", "ceng", "cha", "chai", "chan", "chang",
58   - "chao", "che", "chen", "cheng", "chi", "chong", "chou", "chu",
59   - "chuai", "chuan", "chuang", "chui", "chun", "chuo", "ci", "cong",
60   - "cou", "cu", "cuan", "cui", "cun", "cuo", "da", "dai", "dan",
61   - "dang", "dao", "de", "deng", "di", "dian", "diao", "die", "ding",
62   - "diu", "dong", "dou", "du", "duan", "dui", "dun", "duo", "e", "en",
63   - "er", "fa", "fan", "fang", "fei", "fen", "feng", "fo", "fou", "fu",
64   - "ga", "gai", "gan", "gang", "gao", "ge", "gei", "gen", "geng",
65   - "gong", "gou", "gu", "gua", "guai", "guan", "guang", "gui", "gun",
66   - "guo", "ha", "hai", "han", "hang", "hao", "he", "hei", "hen",
67   - "heng", "hong", "hou", "hu", "hua", "huai", "huan", "huang", "hui",
68   - "hun", "huo", "ji", "jia", "jian", "jiang", "jiao", "jie", "jin",
69   - "jing", "jiong", "jiu", "ju", "juan", "jue", "jun", "ka", "kai",
70   - "kan", "kang", "kao", "ke", "ken", "keng", "kong", "kou", "ku",
71   - "kua", "kuai", "kuan", "kuang", "kui", "kun", "kuo", "la", "lai",
72   - "lan", "lang", "lao", "le", "lei", "leng", "li", "lia", "lian",
73   - "liang", "liao", "lie", "lin", "ling", "liu", "long", "lou", "lu",
74   - "lv", "luan", "lue", "lun", "luo", "ma", "mai", "man", "mang",
75   - "mao", "me", "mei", "men", "meng", "mi", "mian", "miao", "mie",
76   - "min", "ming", "miu", "mo", "mou", "mu", "na", "nai", "nan",
77   - "nang", "nao", "ne", "nei", "nen", "neng", "ni", "nian", "niang",
78   - "niao", "nie", "nin", "ning", "niu", "nong", "nu", "nv", "nuan",
79   - "nue", "nuo", "o", "ou", "pa", "pai", "pan", "pang", "pao", "pei",
80   - "pen", "peng", "pi", "pian", "piao", "pie", "pin", "ping", "po",
81   - "pu", "qi", "qia", "qian", "qiang", "qiao", "qie", "qin", "qing",
82   - "qiong", "qiu", "qu", "quan", "que", "qun", "ran", "rang", "rao",
83   - "re", "ren", "reng", "ri", "rong", "rou", "ru", "ruan", "rui",
84   - "run", "ruo", "sa", "sai", "san", "sang", "sao", "se", "sen",
85   - "seng", "sha", "shai", "shan", "shang", "shao", "she", "shen",
86   - "sheng", "shi", "shou", "shu", "shua", "shuai", "shuan", "shuang",
87   - "shui", "shun", "shuo", "si", "song", "sou", "su", "suan", "sui",
88   - "sun", "suo", "ta", "tai", "tan", "tang", "tao", "te", "teng",
89   - "ti", "tian", "tiao", "tie", "ting", "tong", "tou", "tu", "tuan",
90   - "tui", "tun", "tuo", "wa", "wai", "wan", "wang", "wei", "wen",
91   - "weng", "wo", "wu", "xi", "xia", "xian", "xiang", "xiao", "xie",
92   - "xin", "xing", "xiong", "xiu", "xu", "xuan", "xue", "xun", "ya",
93   - "yan", "yang", "yao", "ye", "yi", "yin", "ying", "yo", "yong",
94   - "you", "yu", "yuan", "yue", "yun", "za", "zai", "zan", "zang",
95   - "zao", "ze", "zei", "zen", "zeng", "zha", "zhai", "zhan", "zhang",
96   - "zhao", "zhe", "zhen", "zheng", "zhi", "zhong", "zhou", "zhu",
97   - "zhua", "zhuai", "zhuan", "zhuang", "zhui", "zhun", "zhuo", "zi",
98   - "zong", "zou", "zu", "zuan", "zui", "zun", "zuo"};
99   - private StringBuilder buffer;
100   - private String resource;
101   - private static CharacterParser characterParser = new CharacterParser();
102   -
103   - public static CharacterParser getInstance() {
104   - return characterParser;
105   - }
106   -
107   - public String getResource() {
108   - return resource;
109   - }
110   -
111   - public void setResource(String resource) {
112   - this.resource = resource;
113   - }
114   -
115   - /**
116   - * 汉字转成ASCII码
117   - *
118   - * @param chs
119   - * @return
120   - */
121   - private int getChsAscii(String chs) {
122   - int asc = 0;
123   - try {
124   - byte[] bytes = chs.getBytes("gb2312");
125   - if (bytes == null || bytes.length > 2 || bytes.length <= 0) {
126   - throw new RuntimeException("illegal resource string");
127   - }
128   - if (bytes.length == 1) {
129   - asc = bytes[0];
130   - }
131   - if (bytes.length == 2) {
132   - int hightByte = 256 + bytes[0];
133   - int lowByte = 256 + bytes[1];
134   - asc = (256 * hightByte + lowByte) - 256 * 256;
135   - }
136   - } catch (Exception e) {
137   - System.out
138   - .println("ERROR:ChineseSpelling.class-getChsAscii(String chs)"
139   - + e);
140   - }
141   - return asc;
142   - }
143   -
144   - /**
145   - * 单字解析
146   - **/
147   - public String convert(String str) {
148   - String result = null;
149   - int ascii = getChsAscii(str);
150   - if (ascii > 0 && ascii < 160) {
151   - result = String.valueOf((char) ascii);
152   - } else {
153   - for (int i = (pyvalue.length - 1); i >= 0; i--) {
154   - if (pyvalue[i] <= ascii) {
155   - result = pystr[i];
156   - break;
157   - }
158   - }
159   - }
160   - return result;
161   - }
162   -
163   - /**
164   - * 词组解析
165   - *
166   - * @param chs
167   - * @return
168   - */
169   - public String getSelling(String chs) {
170   - String key, value;
171   - buffer = new StringBuilder();
172   - for (int i = 0; i < chs.length(); i++) {
173   - key = chs.substring(i, i + 1);
174   - if (key.getBytes().length >= 2) {
175   - value = (String) convert(key);
176   - if (value == null) {
177   - value = "unknown";
178   - }
179   - } else {
180   - value = key;
181   - }
182   - buffer.append(value);
183   - }
184   - return buffer.toString();
185   - }
186   -
187   - public String getSpelling() {
188   - return this.getSelling(this.getResource());
189   - }
190   -
191   -}
192 0 \ No newline at end of file
cloud/user/src/main/java/com/cnlive/strike/moudle/baseim/util/search/FirstLetterUtil.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.baseim.util.search;
2   -
3   -public class FirstLetterUtil {
4   - private static int BEGIN = 45217;
5   - private static int END = 63486;
6   - // 按照声母表示,这个表是在GB2312中的出现的第一个汉字,也就是说“啊”是代表首字母a的第一个汉字。
7   - // i, u, v都不做声母, 自定规则跟随前面的字母
8   - private static char[] chartable = {'啊', '芭', '擦', '搭', '蛾', '发', '噶', '哈',
9   - '哈', '击', '喀', '垃', '妈', '拿', '哦', '啪', '期', '然', '撒', '塌', '塌',
10   - '塌', '挖', '昔', '压', '匝',};
11   - // 二十六个字母区间对应二十七个端点
12   - // GB2312码汉字区间十进制表示
13   - private static int[] table = new int[27];
14   - // 对应首字母区间表
15   - private static char[] initialtable = {'a', 'b', 'c', 'd', 'e', 'f', 'g',
16   - 'h', 'h', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
17   - 't', 't', 'w', 'x', 'y', 'z',};
18   -
19   - // 初始化
20   - static {
21   - for (int i = 0; i < 26; i++) {
22   - table[i] = gbValue(chartable[i]);// 得到GB2312码的首字母区间端点表,十进制。
23   - }
24   - table[26] = END;// 区间表结尾
25   - }
26   -
27   - /**
28   - * 根据一个包含汉字的字符串返回一个汉字拼音首字母的字符串 最重要的一个方法,思路如下:一个个字符读入、判断、输出
29   - */
30   - public static String getFirstLetter(String sourceStr) {
31   - String result = "";
32   - String str = sourceStr.toLowerCase();
33   - int StrLength = str.length();
34   - int i;
35   - try {
36   - for (i = 0; i < StrLength; i++) {
37   - result += Char2Initial(str.charAt(i));
38   - }
39   - } catch (Exception e) {
40   - result = "";
41   - }
42   - return result;
43   - }
44   -
45   - /**
46   - * 输入字符,得到他的声母,英文字母返回对应的大写字母,其他非简体汉字返回 '0'
47   - */
48   - private static char Char2Initial(char ch) {
49   - // 对英文字母的处理:小写字母转换为大写,大写的直接返回
50   - if (ch >= 'a' && ch <= 'z') {
51   - return ch;
52   - }
53   - if (ch >= 'A' && ch <= 'Z') {
54   -
55   - return ch;
56   - }
57   - // 对非英文字母的处理:转化为首字母,然后判断是否在码表范围内,
58   - // 若不是,则直接返回。
59   - // 若是,则在码表内的进行判断。
60   - int gb = gbValue(ch);// 汉字转换首字母
61   -
62   - if ((gb < BEGIN) || (gb > END))// 在码表区间之前,直接返回
63   - {
64   - return ch;
65   - }
66   -
67   - int i;
68   - for (i = 0; i < 26; i++) {// 判断匹配码表区间,匹配到就break,判断区间形如“[,)”
69   - if ((gb >= table[i]) && (gb < table[i + 1])) {
70   - break;
71   - }
72   - }
73   -
74   - if (gb == END) {// 补上GB2312区间最右端
75   - i = 25;
76   - }
77   - return initialtable[i]; // 在码表区间中,返回首字母
78   - }
79   -
80   - /**
81   - * 取出汉字的编码 cn 汉字
82   - */
83   - private static int gbValue(char ch) {// 将一个汉字(GB2312)转换为十进制表示。
84   - String str = new String();
85   - str += ch;
86   - try {
87   - byte[] bytes = str.getBytes("GB2312");
88   - if (bytes.length < 2) {
89   - return 0;
90   - }
91   - return (bytes[0] << 8 & 0xff00) + (bytes[1] & 0xff);
92   - } catch (Exception e) {
93   - return 0;
94   - }
95   - }
96   -
97   -
98   -}
99 0 \ No newline at end of file
cloud/user/src/main/java/com/cnlive/strike/moudle/baseim/util/search/SearchData.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.baseim.util.search;
2   -
3   -import java.io.Serializable;
4   -
5   -/**
6   - * author gujun
7   - * date: 2019/4/2
8   - * desc:
9   - */
10   -public class SearchData implements Serializable {
11   -
12   - private String searchContent;
13   - private int spannableNickStartIndex;
14   - private int spannableNickEndIndex;
15   -
16   - public String getSearchContent() {
17   - return searchContent;
18   - }
19   -
20   - public void setSearchContent(String searchContent) {
21   - this.searchContent = searchContent;
22   - }
23   -
24   - public int getSpannableNickStartIndex() {
25   - return spannableNickStartIndex;
26   - }
27   -
28   - public void setSpannableNickStartIndex(int spannableNickStartIndex) {
29   - this.spannableNickStartIndex = spannableNickStartIndex;
30   - }
31   -
32   - public int getSpannableNickEndIndex() {
33   - return spannableNickEndIndex;
34   - }
35   -
36   - public void setSpannableNickEndIndex(int spannableNickEndIndex) {
37   - this.spannableNickEndIndex = spannableNickEndIndex;
38   - }
39   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/baseim/util/search/SearchUtil.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.baseim.util.search;
2   -
3   -import android.text.TextUtils;
4   -
5   -import java.util.ArrayList;
6   -import java.util.List;
7   -import java.util.regex.Matcher;
8   -import java.util.regex.Pattern;
9   -
10   -/**
11   - * Created by gujun on 2018/1/9.
12   - */
13   -
14   -public class SearchUtil {
15   -
16   - /**
17   - * 获取联系人模糊查询列表
18   - *
19   - * @param filter 过滤条件
20   - * @param list 原始列表
21   - * @return
22   - */
23   - public static <T extends SearchData> List<T> getFilterContactList(CharSequence filter, List<T> list) {
24   - if (list == null || list.size() <= 0) return null;
25   - List<T> filterList = new ArrayList<>();
26   -
27   - for (T contactInfo : list) {
28   - if (!TextUtils.isEmpty(filter)) {
29   - if (contains(contactInfo, filter.toString())) {
30   - filterList.add(contactInfo);
31   - }
32   - } else {
33   - contactInfo.setSpannableNickEndIndex(0);
34   - contactInfo.setSpannableNickStartIndex(0);
35   - filterList.add(contactInfo);
36   - }
37   - }
38   - return filterList;
39   - }
40   -
41   - /**
42   - * 判断某个联系人昵称是否包含查询字段
43   - *
44   - * @param searchData
45   - * @param filter
46   - * @return
47   - */
48   - private static boolean contains(SearchData searchData, String filter) {
49   - String name = searchData.getSearchContent();
50   - if (TextUtils.isEmpty(name)
51   - && TextUtils.isEmpty(name)) {
52   - return false;
53   - }
54   -
55   - int startIndex = 0;
56   - int endIndex = 0;
57   - boolean flag = false;
58   -
59   - if (!isAllEnglish(filter)) {
60   - // 只要不全是英文就字符串对比
61   - if (name.contains(filter)) {
62   - flag = true;
63   - startIndex = name.indexOf(filter);
64   - endIndex = startIndex + filter.length();
65   - }
66   - } else {
67   - String key = "";
68   - String searchPinYin = "";
69   - if (!flag) {
70   - CharacterParser finder = CharacterParser.getInstance();
71   - // 先将输入的字符串转换为拼音
72   - finder.setResource(filter);
73   - searchPinYin = finder.getSpelling();
74   - //处理通配符
75   - key = processingWildcards(searchPinYin);
76   -
77   - // 简拼匹配,如果输入在字符串长度大于6就不按首字母匹配了
78   - if (key.length() < 6) {
79   - String firstLetters = FirstLetterUtil
80   - .getFirstLetter(name);
81   - // 不区分大小写
82   - Pattern firstLetterPattern = Pattern.compile(key,
83   - Pattern.CASE_INSENSITIVE);
84   - Matcher firstLetterMatcher = firstLetterPattern.matcher(firstLetters);
85   - flag = firstLetterMatcher.find();
86   - if (flag) {
87   - startIndex = firstLetterMatcher.start();
88   - endIndex = firstLetterMatcher.end();
89   - }
90   - }
91   - }
92   -
93   - if (!flag && key.length() > 1) {
94   - //key.length() > 1代表:仅有一个字母时必须匹配首字母,不能使用全拼
95   - // 全拼匹配
96   - CharacterParser finder = CharacterParser.getInstance();
97   - finder.setResource(name);
98   - // 不区分大小写
99   - Pattern pattern = Pattern
100   - .compile(key, Pattern.CASE_INSENSITIVE);
101   - Matcher matcher = pattern.matcher(finder.getSpelling());
102   - flag = matcher.find();
103   - if (flag) {
104   - int matcherStart = matcher.start();
105   - int matcherEnd = matcher.end();
106   - if (matcherStart < matcherEnd) {
107   - int scanPinYinCount = 0;
108   - char nickNameChar[] = name.toCharArray();
109   - for (int i = 0; i < nickNameChar.length; i++) {
110   - CharacterParser finderNick = CharacterParser.getInstance();
111   - finderNick.setResource(String.valueOf(nickNameChar[i]));
112   - String nickNamePinYin = finderNick.getSpelling();
113   - if (matcherStart >= scanPinYinCount && matcherStart < scanPinYinCount + nickNamePinYin.length()) {
114   - startIndex = i;
115   - }
116   - if (matcherEnd > scanPinYinCount && matcherEnd <= scanPinYinCount + nickNamePinYin.length()) {
117   - endIndex = i + 1;
118   - }
119   - scanPinYinCount += nickNamePinYin.length();
120   - }
121   - }
122   - }
123   - }
124   - }
125   -
126   - if (flag) {
127   - searchData.setSpannableNickStartIndex(startIndex);
128   - searchData.setSpannableNickEndIndex(endIndex);
129   - }
130   -
131   - return flag;
132   - }
133   -
134   - /**
135   - * 处理转义字符包括 * . ? + $ ^ [ ] ( ) { } | \
136   - *
137   - * @param searchPinYin
138   - * @return
139   - */
140   - private static String processingWildcards(String searchPinYin) {
141   - String key = "";
142   - // 处理通配符问题
143   - if (searchPinYin.contains("*") ||
144   - searchPinYin.contains(".") ||
145   - searchPinYin.contains("?") ||
146   - searchPinYin.contains("+") ||
147   - searchPinYin.contains("$") ||
148   - searchPinYin.contains("^") ||
149   - searchPinYin.contains("[") ||
150   - searchPinYin.contains("]") ||
151   - searchPinYin.contains("(") ||
152   - searchPinYin.contains(")") ||
153   - searchPinYin.contains("{") ||
154   - searchPinYin.contains("}") ||
155   - searchPinYin.contains("|") ||
156   - searchPinYin.contains("\\")) {
157   - char[] chars = searchPinYin.toCharArray();
158   - for (int k = 0; k < chars.length; k++) {
159   - if (chars[k] == '*') {
160   - key = key + "\\*";
161   - } else if (chars[k] == '(') {
162   - key = key + "\\(";
163   - } else if (chars[k] == ')') {
164   - key = key + "\\)";
165   - } else if (chars[k] == '?') {
166   - key = key + "\\?";
167   - } else if (chars[k] == '.') {
168   - key = key + "\\.";
169   - } else if (chars[k] == '+') {
170   - key = key + "\\+";
171   - } else if (chars[k] == '$') {
172   - key = key + "\\$";
173   - } else if (chars[k] == '^') {
174   - key = key + "\\^";
175   - } else if (chars[k] == '[') {
176   - key = key + "\\[";
177   - } else if (chars[k] == ']') {
178   - key = key + "\\]";
179   - } else if (chars[k] == '{') {
180   - key = key + "\\{";
181   - } else if (chars[k] == '}') {
182   - key = key + "\\}";
183   - } else if (chars[k] == '|') {
184   - key = key + "\\|";
185   - } else if (chars[k] == '\\') {
186   - key = key + "\\\\";
187   - } else {
188   - key = key + String.valueOf(chars[k]);
189   - }
190   - }
191   - } else {
192   - key = searchPinYin;
193   - }
194   - return key;
195   - }
196   -
197   - /**
198   - * 是否全是英文
199   - *
200   - * @param str
201   - * @return
202   - */
203   - public static boolean isAllEnglish(String str) {
204   - Pattern p = Pattern.compile("[a-zA-Z]");
205   - Matcher m = p.matcher(str);
206   - if (m.find()) {
207   - return true;
208   - }
209   - return false;
210   - }
211   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/conversation/util/QMUIUtil.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.conversation.util;
2   -
3   -import android.content.Context;
4   -import android.text.TextUtils;
5   -import android.view.Gravity;
6   -import android.view.View;
7   -import android.widget.LinearLayout;
8   -import android.widget.TextView;
9   -
10   -import com.qmuiteam.qmui.widget.QMUITopBar;
11   -
12   -import java.lang.reflect.Field;
13   -
14   -public class QMUIUtil {
15   - /**
16   - * 文本自动滚动功能回填视图(需要一直获取选中状态)
17   - */
18   - public static class MarqueeTextView extends android.support.v7.widget.AppCompatTextView {
19   - public MarqueeTextView(Context context) {
20   - super(context);
21   - }
22   -
23   - @Override
24   - public boolean isSelected() {
25   - return true;
26   - }
27   - }
28   -
29   - /**
30   - * 设置QMUI头部视图方法,内部可以随意定制功能
31   - */
32   - public static void setTopBar(QMUITopBar toolbar, TextUtils.TruncateAt ta) {
33   - if (toolbar == null || ta == null) return;
34   - for (int i = 0; i < toolbar.getChildCount(); i++) {
35   - View view = toolbar.getChildAt(i);
36   - if (view.getId() != -1) continue;
37   - if (!(view instanceof LinearLayout)) continue;
38   - for (int j = 0; j < ((LinearLayout) view).getChildCount(); j++) {
39   - View child = ((LinearLayout) view).getChildAt(j);
40   - if (child.getId() != -1) continue;
41   - if (!(child instanceof TextView)) continue;
42   - if (((TextView) child).getEllipsize() != TextUtils.TruncateAt.MIDDLE) continue;
43   -
44   - //将原有视图配置信息取出
45   - LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) child.getLayoutParams();
46   - float textSize = px2sp(toolbar.getContext(), ((TextView) child).getTextSize());
47   - String textValue = ((TextView) child).getText().toString();
48   - //移除原有视图
49   - ((LinearLayout) view).removeView(child);
50   - //创建新的视图
51   - MarqueeTextView newView = new MarqueeTextView(toolbar.getContext());
52   - newView.setGravity(Gravity.CENTER_VERTICAL);
53   - newView.setHorizontallyScrolling(true);
54   - newView.setMarqueeRepeatLimit(-1);
55   - newView.setFocusable(true);
56   - newView.setFocusableInTouchMode(true);
57   - newView.setEllipsize(ta);
58   - newView.setSingleLine();
59   - newView.invalidate();
60   - newView.setTextSize(textSize);
61   - newView.setText(textValue);
62   - //填充新视图
63   - if (layoutParams != null) ((LinearLayout) view).addView(newView, layoutParams);
64   - else ((LinearLayout) view).addView(newView);
65   - //原视图缓存对象替换
66   - try {
67   - Field darkFlag = QMUITopBar.class.getDeclaredField("mTitleView");
68   - darkFlag.setAccessible(true);
69   - darkFlag.set(toolbar, newView);
70   - } catch (Exception ignored) {
71   - }
72   - }
73   - }
74   - }
75   -
76   - public static int px2sp(Context context, float pxValue) {
77   - final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
78   - return (int) (pxValue / fontScale + 0.5f);
79   - }
80   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/launch/frame/presenter/BindPhoneNumberPresenter.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.launch.frame.presenter;
2   -
3   -import android.content.Context;
4   -import android.text.TextUtils;
5   -
6   -import com.cnlive.strike.data.network.model.BaseInfo;
7   -import com.cnlive.libs.base.application.AppConfig;
8   -import com.cnlive.libs.base.logic.Event;
9   -import com.cnlive.libs.base.logic.Logic;
10   -import com.cnlive.libs.base.util.TimerUtil;
11   -import com.cnlive.strike.moudle.qr.uitl.RegexUtils;
12   -import com.cnlive.strike.moudle.user.frame.data.OtherUserInfo;
13   -import com.cnlive.strike.moudle.user.frame.view.BindPhoneNumberView;
14   -import com.cnlive.strike.moudle.user.ui.activity.BindPhoneNumberActivity;
15   -import com.cnlive.strike.moudle_user.R;
16   -import com.cnlive.strike.router.user.UserAction;
17   -import com.cnlive.strike.user.UserUtilAction;
18   -import com.cnlive.strike.user.auth.UserService;
19   -import com.cnlive.strike.user.model.CNLiveUserInfo;
20   -import com.cnlive.strike.util.TimeEvent;
21   -import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
22   -
23   -import java.util.HashMap;
24   -
25   -
26   -/**
27   - * 作者: 吴奎庆
28   - * <p>
29   - * 时间: 2019/9/9
30   - * <p>
31   - * 简介:
32   - */
33   -public class BindPhoneNumberPresenter extends MvpBasePresenter<BindPhoneNumberView> {
34   -
35   - private Event sendMsgBefQuickLogin;
36   - private TimerUtil timerUtil;
37   - private long currentTime = 0;
38   -
39   - private void startTimer() {
40   - if (timerUtil != null) timerUtil.cancel();
41   -
42   - timerUtil = new TimerUtil();
43   - timerUtil.setTotalTime(60_000);//设置毫秒数
44   - timerUtil.setIntervalTime(500);//设置间隔数
45   - timerUtil.start();
46   - timerUtil.setTimerLiener(new TimerUtil.TimeListener() {
47   - @Override
48   - public void onFinish() {
49   - currentTime = 0;
50   - if (getView() != null) getView().onTimerFinish();
51   - }
52   -
53   - @Override
54   - public void onInterval(long remainTime) {
55   - currentTime = remainTime;
56   - if (getView() != null) getView().onTimerInterval(remainTime / 1000);
57   - }
58   - });
59   - }
60   -
61   - public void sendCode(Context context, String phone, String countryCode) {
62   - if (getView() == null) return;
63   - if (TimeEvent.debounce(2_000)) return;
64   - if (TextUtils.isEmpty(phone)) {
65   - getView().showMessage(context.getString(R.string.user_toast_quick_login_empty_phone));
66   - return;
67   - }
68   - if ("86".equals(countryCode) && !RegexUtils.isMobileSimple(phone)) {
69   - getView().showMessage(context.getString(R.string.user_toast_quick_login_error_phone));
70   - return;
71   - }
72   - if (currentTime!=0){
73   - getView().showMessage("处理中请稍后...");
74   - return;
75   - }
76   - if (sendMsgBefQuickLogin != null && sendMsgBefQuickLogin.active) {
77   - getView().showMessage("处理中请稍后...");
78   - } else {
79   - sendMsgBefQuickLogin = Logic.create()
80   - .action(UserUtilAction.sendMsgBefQuickLoginAction(context, phone, countryCode))
81   - .<BaseInfo>event()
82   - .setFailureCallback((state, message) -> {
83   - if (getView() != null) getView().showMessage(message);
84   - })
85   - .setSuccessCallback(data -> {
86   - startTimer();
87   - if (getView() != null) getView().showMessage("验证码已发送");
88   - }).start();
89   - }
90   - }
91   -
92   - public void cancle() {
93   - if (timerUtil != null) {
94   - timerUtil.cancel();
95   - }
96   - if (sendMsgBefQuickLogin != null) sendMsgBefQuickLogin.cencel();
97   - }
98   -
99   - public void bindOther(BindPhoneNumberActivity activity, OtherUserInfo otherUserInfo, String phone, String ems) {
100   - HashMap<String, String> requestMap = new HashMap<>();
101   - requestMap.put("appId", AppConfig.getAppId());
102   - requestMap.put("mobile", phone);
103   - requestMap.put("countryCode", activity.countryCode);
104   - requestMap.put("frmId", AppConfig.getAppChannel());
105   - requestMap.put("verificationCode", ems);
106   -
107   - requestMap.put("thirdPartyPlat", otherUserInfo.getLoginType());
108   - requestMap.put("thirdPartyId", otherUserInfo.getThirdPartyId());
109   - requestMap.put("uuid", AppConfig.getAppUUID());
110   - requestMap.put("clientPlat", "a");
111   - requestMap.put("nickName", otherUserInfo.getNickName());
112   - requestMap.put("gender", otherUserInfo.getGender());
113   - requestMap.put("location", otherUserInfo.getLocation());
114   - requestMap.put("faceUrl", otherUserInfo.getFaceUrl());
115   -
116   - UserAction.otherLoginBindMobile(activity, phone, activity.countryCode, ems,
117   - otherUserInfo.getLoginType(), otherUserInfo.getThirdPartyId(),
118   - otherUserInfo.getNickName(), otherUserInfo.getGender(), otherUserInfo.getLocation(),
119   - otherUserInfo.getFaceUrl(), initLoginEvent(activity, false, otherUserInfo)
120   - );
121   -
122   - }
123   -
124   - public Event<CNLiveUserInfo> initLoginEvent(BindPhoneNumberActivity context, Boolean retry, OtherUserInfo otherUserInfo) {
125   - return new Event<CNLiveUserInfo>()
126   - .setFailureCallback((state, message) -> {
127   - if (context == null) return;
128   - if (getView() == null) return;
129   - switch (state) {
130   - case 41010: //手机号无效
131   - getView().showMessage(message);
132   - break;
133   - case 41002: //验证码为6位数字
134   - getView().showMessage(message);
135   - break;
136   - case 41009: //验证码错误
137   - getView().showMessage(message);
138   - break;
139   - case 41006: //手机号已存在
140   - getView().showMessage(message);
141   - break;
142   - case 6208: //当前用户在其他地点登陆
143   - if (retry) {
144   - UserAction.otherLoginBindMobile(context, context.phoneNum, context.countryCode, context.phoneEms,
145   - otherUserInfo.getLoginType(), otherUserInfo.getThirdPartyId(),
146   - otherUserInfo.getNickName(), otherUserInfo.getGender(), otherUserInfo.getLocation(),
147   - otherUserInfo.getFaceUrl(), initLoginEvent(context, false, otherUserInfo)
148   - );
149   - return;
150   - } else getView().showMessage("用户登录失败,再试一次吧.");
151   - break;
152   - default: //其他错误
153   - getView().showMessage(message);
154   - break;
155   - }
156   - }).setSuccessCallback((info) -> {
157   - if (context == null) return;
158   - if (getView() == null) return;
159   - CNLiveUserInfo user = UserService.getInstance(context).getAppAccount();
160   - if (user == null || (user != null && TextUtils.isEmpty(user.getToken()))) {
161   - getView().showMessage("用户登陆失败,再试一次吧.");
162   - } else if (user.isNewUser()) {
163   - //TODO 必须设置用户头像
164   - //OpenInstall用户注册统计
165   -// OpenInstall.reportRegister();
166   - //友盟账号登录统计,暂时只有平台登录,后续对接三方登录
167   -// MobclickAgent.onProfileSignIn("CNLive", user.getUid());
168   - if (otherUserInfo != null) {
169   - getView().showMainView();
170   - } else {
171   - getView().showEditView();
172   - }
173   - } else {
174   - //友盟账号登录统计,暂时只有平台登录,后续对接三方登录
175   -// MobclickAgent.onProfileSignIn("CNLive", user.getUid());
176   - getView().showMainView();
177   - }
178   - AppConfig.setCountryCode("");
179   - AppConfig.setVerificationCode("");
180   - AppConfig.setUserPhone("");
181   - });
182   - }
183   -
184   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/launch/model/LaunchPage.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.launch.model;
2   -
3   -import androidx.databinding.BaseObservable;
4   -import androidx.databinding.Bindable;
5   -import android.view.View;
6   -
7   -import com.cnlive.strike.moudle_user.BR;
8   -
9   -
10   -public class LaunchPage extends BaseObservable {
11   -
12   - private int loading = View.GONE;
13   -
14   - @Bindable
15   - public int getLoading() {
16   - return loading;
17   - }
18   -
19   - public void setLoading(int loading) {
20   - this.loading = loading;
21   - notifyPropertyChanged(com.cnlive.strike.moudle_user.BR.loading);
22   - }
23   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/mian/ui/widget/TokenErrorDialog.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.mian.ui.widget;
2   -
3   -import android.app.Dialog;
4   -import android.content.Context;
5   -
6   -import com.cnlive.media.picker.utils.AlertDialogUtils;
7   -import com.cnlive.strike.moudle.user.ui.activity.LoginActivity;
8   -import com.cnlive.strike.moudle_user.R;
9   -
10   -/**
11   - * Created by Lynn on 2019/1/19.
12   - */
13   -
14   -public class TokenErrorDialog {
15   - public static Dialog showTokenErrorDialog(Context context) {
16   - return AlertDialogUtils.showTwoButtonDialog(context,
17   - "取消",
18   - "重新登录",
19   - "修改个人信息",
20   - R.color.color_dialog_btn,
21   - R.color.color_ffa300,
22   - new AlertDialogUtils.DialogTwoListener() {
23   - @Override
24   - public void onClickLeft(Dialog dialog) {
25   - dialog.dismiss();
26   - }
27   -
28   - @Override
29   - public void onClickRight(Dialog dialog) {
30   - dialog.dismiss();
31   - LoginActivity.start(context, true);
32   - }
33   - }
34   - );
35   - }
36   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/preview/ui/widget/DownLoadImageService.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.preview.ui.widget;
2   -
3   -import android.content.Context;
4   -import android.content.Intent;
5   -import android.net.Uri;
6   -import android.os.Environment;
7   -import android.text.TextUtils;
8   -import android.util.Log;
9   -
10   -import com.bumptech.glide.Glide;
11   -import com.bumptech.glide.request.target.Target;
12   -import com.cnlive.media.picker.utils.FileTypeUtil;
13   -import com.cnlive.libs.base.util.MD5Util;
14   -
15   -import java.io.File;
16   -import java.io.FileInputStream;
17   -import java.io.FileOutputStream;
18   -import java.io.InputStream;
19   -
20   -/**
21   - * 创建:wukuiqing
22   - * <p>
23   - * 时间:2018/3/17
24   - * <p>
25   - * 描述:图片下载的工具类
26   - */
27   -
28   -public class DownLoadImageService implements Runnable {
29   - private String url;
30   - private Context context;
31   - private ImageDownLoadCallBack callBack;
32   - private File file;
33   -
34   - public DownLoadImageService(Context context, String url, ImageDownLoadCallBack callBack) {
35   - this.url = url;
36   - this.callBack = callBack;
37   - this.context = context;
38   - }
39   -
40   - @Override
41   - public void run() {
42   - try {
43   - if (!TextUtils.isEmpty(url)) file = Glide.with(context).asFile()
44   - .load(url)
45   - .into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
46   - .get();
47   - if (file != null) saveImageToGallery(context, file);
48   - } catch (Exception e) {
49   - Log.e("DownLoadFile", "", e);
50   - } finally {
51   - if (file != null && file.exists()) callBack.onDownLoadSuccess(file.getAbsolutePath());
52   - else callBack.onDownLoadFailed();
53   - }
54   - }
55   -
56   - public void saveImageToGallery(Context context, File file) {
57   - try {
58   - String md5 = MD5Util.getMD5(file);
59   - InputStream inStream = new FileInputStream(file); //读入原文件
60   - File appDir = new File(Environment.getExternalStorageDirectory(), "strike");
61   - if (!appDir.exists()) appDir.mkdir();
62   -
63   - String type = FileTypeUtil.getFileType(file.getAbsolutePath());
64   - String extension;//初始文件扩展名
65   - if (TextUtils.isEmpty(type)) {
66   - extension = ".jpg";
67   - } else {
68   - extension = "." + type;
69   - }
70   -
71   - File newFile = new File(appDir, md5 + extension);
72   - FileOutputStream outputStream = new FileOutputStream(newFile);
73   -
74   - int byteread = 0;
75   - byte[] buffer2 = new byte[1444];
76   - while ((byteread = inStream.read(buffer2)) != -1)
77   - outputStream.write(buffer2, 0, byteread);
78   - inStream.close();
79   - outputStream.close();
80   -
81   - context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + newFile.getAbsolutePath())));
82   - //TODO 文件缓存已经完成 待优化~!!
83   - } catch (Exception e) {
84   - Log.e("ImageDownloadService", "Exception ", e);
85   - }
86   - }
87   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/preview/ui/widget/ImageDownLoadCallBack.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.preview.ui.widget;
2   -
3   -import java.io.File;
4   -import java.io.IOException;
5   -
6   -/**
7   - * 创建:wukuiqing
8   - * <p>
9   - * 时间:2018/3/17
10   - * <p>
11   - * 描述:
12   - */
13   -
14   -public interface ImageDownLoadCallBack {
15   -
16   - void onDownLoadSuccess(File file) throws IOException;
17   - void onDownLoadSuccess(String path);
18   -
19   - void onDownLoadFailed();
20   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/qr/uitl/RegexConstants.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.qr.uitl;
2   -
3   -public final class RegexConstants {
4   -
5   - /**
6   - * 正则:手机号(简单)
7   - */
8   - public static final String REGEX_MOBILE_SIMPLE = "^[1]\\d{10}$";
9   - /**
10   - * 正则:手机号(精确)
11   - * <p>移动:134(0-8)、135、136、137、138、139、147、150、151、152、157、158、159、178、182、183、184、187、188</p>
12   - * <p>联通:130、131、132、145、155、156、171、175、176、185、186</p>
13   - * <p>电信:133、153、173、177、180、181、189</p>
14   - * <p>全球星:1349</p>
15   - * <p>虚拟运营商:170</p>
16   - */
17   - public static final String REGEX_MOBILE_EXACT = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(16[6,9])|(17[0,1,3,5-8])|(18[0-9])|(147))\\d{8}$";
18   - /**
19   - * 正则:电话号码
20   - */
21   - public static final String REGEX_TEL = "^0\\d{2,3}[- ]?\\d{7,8}";
22   - /**
23   - * 正则:身份证号码15位
24   - */
25   - public static final String REGEX_ID_CARD15 = "^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$";
26   - /**
27   - * 正则:身份证号码18位
28   - */
29   - public static final String REGEX_ID_CARD18 = "^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9Xx])$";
30   - /**
31   - * 正则:邮箱
32   - */
33   - public static final String REGEX_EMAIL = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
34   - /**
35   - * 正则:URL
36   - */
37   - public static final String REGEX_URL = "[a-zA-z]+://[^\\s]*";
38   - /**
39   - * 正则:汉字
40   - */
41   - public static final String REGEX_ZH = "^[\\u4e00-\\u9fa5]+$";
42   - /**
43   - * 正则:用户名,取值范围为a-z,A-Z,0-9,"_",汉字,不能以"_"结尾,用户名必须是6-20位
44   - */
45   - public static final String REGEX_USERNAME = "^[\\w\\u4e00-\\u9fa5]{6,20}(?<!_)$";
46   - /**
47   - * 正则:yyyy-MM-dd格式的日期校验,已考虑平闰年
48   - */
49   - public static final String REGEX_DATE = "^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$";
50   - /**
51   - * 正则:IP地址
52   - */
53   - public static final String REGEX_IP = "((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)";
54   -
55   - ///////////////////////////////////////////////////////////////////////////
56   - // 以下摘自http://tool.oschina.net/regex
57   - ///////////////////////////////////////////////////////////////////////////
58   -
59   - /**
60   - * 正则:双字节字符(包括汉字在内)
61   - */
62   - public static final String REGEX_DOUBLE_BYTE_CHAR = "[^\\x00-\\xff]";
63   - /**
64   - * 正则:空白行
65   - */
66   - public static final String REGEX_BLANK_LINE = "\\n\\s*\\r";
67   - /**
68   - * 正则:QQ号
69   - */
70   - public static final String REGEX_TENCENT_NUM = "[1-9][0-9]{4,}";
71   - /**
72   - * 正则:中国邮政编码
73   - */
74   - public static final String REGEX_ZIP_CODE = "[1-9]\\d{5}(?!\\d)";
75   - /**
76   - * 正则:正整数
77   - */
78   - public static final String REGEX_POSITIVE_INTEGER = "^[1-9]\\d*$";
79   - /**
80   - * 正则:负整数
81   - */
82   - public static final String REGEX_NEGATIVE_INTEGER = "^-[1-9]\\d*$";
83   - /**
84   - * 正则:整数
85   - */
86   - public static final String REGEX_INTEGER = "^-?[1-9]\\d*$";
87   - /**
88   - * 正则:非负整数(正整数 + 0)
89   - */
90   - public static final String REGEX_NOT_NEGATIVE_INTEGER = "^[1-9]\\d*|0$";
91   - /**
92   - * 正则:非正整数(负整数 + 0)
93   - */
94   - public static final String REGEX_NOT_POSITIVE_INTEGER = "^-[1-9]\\d*|0$";
95   - /**
96   - * 正则:正浮点数
97   - */
98   - public static final String REGEX_POSITIVE_FLOAT = "^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$";
99   - /**
100   - * 正则:负浮点数
101   - */
102   - public static final String REGEX_NEGATIVE_FLOAT = "^-[1-9]\\d*\\.\\d*|-0\\.\\d*[1-9]\\d*$";
103   -
104   - ///////////////////////////////////////////////////////////////////////////
105   - // If u want more please visit http://toutiao.com/i6231678548520731137
106   - ///////////////////////////////////////////////////////////////////////////
107   -}
108 0 \ No newline at end of file
cloud/user/src/main/java/com/cnlive/strike/moudle/qr/uitl/RegexUtils.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.qr.uitl;
2   -
3   -import java.util.ArrayList;
4   -import java.util.List;
5   -import java.util.regex.Matcher;
6   -import java.util.regex.Pattern;
7   -
8   -public final class RegexUtils {
9   -
10   - private RegexUtils() {
11   - throw new UnsupportedOperationException("u can't instantiate me...");
12   - }
13   -
14   - ///////////////////////////////////////////////////////////////////////////
15   - // If u want more please visit http://toutiao.com/i6231678548520731137
16   - ///////////////////////////////////////////////////////////////////////////
17   -
18   - /**
19   - * 验证手机号(简单)
20   - *
21   - * @param input 待验证文本
22   - * @return {@code true}: 匹配<br>{@code false}: 不匹配
23   - */
24   - public static boolean isMobileSimple(final CharSequence input) {
25   - return isMatch(RegexConstants.REGEX_MOBILE_SIMPLE, input);
26   - }
27   -
28   - /**
29   - * 验证手机号(精确)
30   - *
31   - * @param input 待验证文本
32   - * @return {@code true}: 匹配<br>{@code false}: 不匹配
33   - */
34   - public static boolean isMobileExact(final CharSequence input) {
35   - return isMatch(RegexConstants.REGEX_MOBILE_EXACT, input);
36   - }
37   -
38   - /**
39   - * 验证电话号码
40   - *
41   - * @param input 待验证文本
42   - * @return {@code true}: 匹配<br>{@code false}: 不匹配
43   - */
44   - public static boolean isTel(final CharSequence input) {
45   - return isMatch(RegexConstants.REGEX_TEL, input);
46   - }
47   -
48   - /**
49   - * 验证身份证号码15位
50   - *
51   - * @param input 待验证文本
52   - * @return {@code true}: 匹配<br>{@code false}: 不匹配
53   - */
54   - public static boolean isIDCard15(final CharSequence input) {
55   - return isMatch(RegexConstants.REGEX_ID_CARD15, input);
56   - }
57   -
58   - /**
59   - * 验证身份证号码18位
60   - *
61   - * @param input 待验证文本
62   - * @return {@code true}: 匹配<br>{@code false}: 不匹配
63   - */
64   - public static boolean isIDCard18(final CharSequence input) {
65   - return isMatch(RegexConstants.REGEX_ID_CARD18, input);
66   - }
67   -
68   - /**
69   - * 验证邮箱
70   - *
71   - * @param input 待验证文本
72   - * @return {@code true}: 匹配<br>{@code false}: 不匹配
73   - */
74   - public static boolean isEmail(final CharSequence input) {
75   - return isMatch(RegexConstants.REGEX_EMAIL, input);
76   - }
77   -
78   - /**
79   - * 验证URL
80   - *
81   - * @param input 待验证文本
82   - * @return {@code true}: 匹配<br>{@code false}: 不匹配
83   - */
84   - public static boolean isURL(final CharSequence input) {
85   - return isMatch(RegexConstants.REGEX_URL, input);
86   - }
87   -
88   - /**
89   - * 验证汉字
90   - *
91   - * @param input 待验证文本
92   - * @return {@code true}: 匹配<br>{@code false}: 不匹配
93   - */
94   - public static boolean isZh(final CharSequence input) {
95   - return isMatch(RegexConstants.REGEX_ZH, input);
96   - }
97   -
98   - /**
99   - * 验证用户名
100   - * <p>取值范围为a-z,A-Z,0-9,"_",汉字,不能以"_"结尾,用户名必须是6-20位</p>
101   - *
102   - * @param input 待验证文本
103   - * @return {@code true}: 匹配<br>{@code false}: 不匹配
104   - */
105   - public static boolean isUsername(final CharSequence input) {
106   - return isMatch(RegexConstants.REGEX_USERNAME, input);
107   - }
108   -
109   - /**
110   - * 验证yyyy-MM-dd格式的日期校验,已考虑平闰年
111   - *
112   - * @param input 待验证文本
113   - * @return {@code true}: 匹配<br>{@code false}: 不匹配
114   - */
115   - public static boolean isDate(final CharSequence input) {
116   - return isMatch(RegexConstants.REGEX_DATE, input);
117   - }
118   -
119   - /**
120   - * 验证IP地址
121   - *
122   - * @param input 待验证文本
123   - * @return {@code true}: 匹配<br>{@code false}: 不匹配
124   - */
125   - public static boolean isIP(final CharSequence input) {
126   - return isMatch(RegexConstants.REGEX_IP, input);
127   - }
128   - /**
129   - * 验证数字
130   - *
131   - * @param input 待验证文本
132   - * @return {@code true}: 匹配<br>{@code false}: 不匹配
133   - */
134   - public static boolean isIntNym(final CharSequence input) {
135   - return isMatch(RegexConstants.REGEX_INTEGER, input);
136   - }
137   -
138   - /**
139   - * 判断是否匹配正则
140   - *
141   - * @param regex 正则表达式
142   - * @param input 要匹配的字符串
143   - * @return {@code true}: 匹配<br>{@code false}: 不匹配
144   - */
145   - public static boolean isMatch(final String regex, final CharSequence input) {
146   - return input != null && input.length() > 0 && Pattern.matches(regex, input);
147   - }
148   -
149   - /**
150   - * 获取正则匹配的部分
151   - *
152   - * @param regex 正则表达式
153   - * @param input 要匹配的字符串
154   - * @return 正则匹配的部分
155   - */
156   - public static List<String> getMatches(final String regex, final CharSequence input) {
157   - if (input == null) return null;
158   - List<String> matches = new ArrayList<>();
159   - Pattern pattern = Pattern.compile(regex);
160   - Matcher matcher = pattern.matcher(input);
161   - while (matcher.find()) {
162   - matches.add(matcher.group());
163   - }
164   - return matches;
165   - }
166   -
167   - /**
168   - * 获取正则匹配分组
169   - *
170   - * @param input 要分组的字符串
171   - * @param regex 正则表达式
172   - * @return 正则匹配分组
173   - */
174   - public static String[] getSplits(final String input, final String regex) {
175   - if (input == null) return null;
176   - return input.split(regex);
177   - }
178   -
179   - /**
180   - * 替换正则匹配的第一部分
181   - *
182   - * @param input 要替换的字符串
183   - * @param regex 正则表达式
184   - * @param replacement 代替者
185   - * @return 替换正则匹配的第一部分
186   - */
187   - public static String getReplaceFirst(final String input, final String regex, final String replacement) {
188   - if (input == null) return null;
189   - return Pattern.compile(regex).matcher(input).replaceFirst(replacement);
190   - }
191   -
192   - /**
193   - * 替换所有正则匹配的部分
194   - *
195   - * @param input 要替换的字符串
196   - * @param regex 正则表达式
197   - * @param replacement 代替者
198   - * @return 替换所有正则匹配的部分
199   - */
200   - public static String getReplaceAll(final String input, final String regex, final String replacement) {
201   - if (input == null) return null;
202   - return Pattern.compile(regex).matcher(input).replaceAll(replacement);
203   - }
204   -}
205 0 \ No newline at end of file
cloud/user/src/main/java/com/cnlive/strike/moudle/user/arouters/UserRouters.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.arouters;
2   -
3   -import android.content.Context;
4   -import android.content.Intent;
5   -
6   -import com.alibaba.android.arouter.launcher.ARouter;
7   -
8   -public class UserRouters {
9   -
10   - public static void startVodPlayer(Context context,
11   - String contentId,
12   - String videoId,
13   - String videoTitle,
14   - String shareSubTitle,
15   - String shareImg,
16   - String shareUrl,
17   - String channelName) {
18   - ARouter.getInstance().build("/cnvideo/PlayerVodActivity")
19   - .withString("contentId", contentId)
20   - .withString("videoId", videoId)
21   - .withString("videoTitle", videoTitle)
22   - .withString("shareSubTitle", shareSubTitle)
23   - .withString("shareImg", shareImg)
24   - .withString("shareUrl", shareUrl)
25   - .withString("channelName", channelName)
26   - .withFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
27   - .navigation(context);
28   - }
29   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/IFirstLoginView.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame;
2   -
3   -import com.hannesdorfmann.mosby3.mvp.MvpView;
4   -
5   -/**
6   - * Created by xiansong on 2018/1/19.
7   - */
8   -
9   -public interface IFirstLoginView extends MvpView {
10   - String TAG = "IFirstLoginView";
11   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/IQuickLoginView.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame;
2   -
3   -import com.hannesdorfmann.mosby3.mvp.MvpView;
4   -
5   -/**
6   - * @author Lynn
7   - * @date 2017/12/22
8   - */
9   -
10   -public interface IQuickLoginView extends MvpView {
11   - String TAG = "IQuickLoginView";
12   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/data/FirstLoginData.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame.data;
2   -
3   -import androidx.databinding.BaseObservable;
4   -import androidx.databinding.Bindable;
5   -
6   -import com.cnlive.strike.moudle_user.BR;
7   -
8   -
9   -/**
10   - * Created by xiansong on 2018/1/19.
11   - */
12   -
13   -public class FirstLoginData extends BaseObservable {
14   -
15   - private String name;
16   - private String image;
17   -
18   - @Bindable
19   - public String getImage() {
20   - return image;
21   - }
22   -
23   - public void setImage(String image) {
24   - this.image = image;
25   - super.notifyPropertyChanged(BR.image);
26   - }
27   -
28   - @Bindable
29   - public String getName() {
30   - return name;
31   - }
32   -
33   - public void setName(String name) {
34   - this.name = name;
35   - super.notifyPropertyChanged(BR.name);
36   - }
37   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/data/LoginData.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame.data;
2   -
3   -
4   -import androidx.databinding.BaseObservable;
5   -import androidx.databinding.Bindable;
6   -
7   -import com.cnlive.libs.base.logic.Config;
8   -import com.cnlive.libs.base.logic.callback.StateCallback;
9   -
10   -import static android.view.View.GONE;
11   -import static android.view.View.VISIBLE;
12   -import com.cnlive.core.user.BR;
13   -/**
14   - * Created by xiansong on 2018/1/2.
15   - */
16   -@Deprecated
17   -public class LoginData extends BaseObservable implements StateCallback {
18   - private String name = "";
19   - private String password = "";
20   - private int loadVisibility = GONE;
21   -
22   - @Bindable
23   - public String getName() {
24   - return name;
25   - }
26   -
27   - public void setName(String name) {
28   - this.name = name;
29   - notifyPropertyChanged(BR.name);
30   - }
31   -
32   - @Bindable
33   - public String getPassword() {
34   - return password;
35   - }
36   -
37   - public void setPassword(String password) {
38   - this.password = password;
39   - notifyPropertyChanged(BR.password);
40   - }
41   -
42   - @Bindable
43   - public int getLoadVisibility() {
44   - return loadVisibility;
45   - }
46   -
47   - public void setLoadVisibility(int loadVisibility) {
48   - this.loadVisibility = loadVisibility;
49   - notifyPropertyChanged(BR.loadVisibility);
50   - }
51   -
52   - @Override
53   - public void onState(int state) {
54   - loadVisibility = state == Config.STATE_LOAD ? VISIBLE : GONE;
55   - }
56   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/data/OtherUserInfo.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame.data;
2   -
3   -import java.io.Serializable;
4   -
5   -/**
6   - * 作者: 吴奎庆
7   - * <p>
8   - * 时间: 2019/9/10
9   - * <p>
10   - * 简介: 三方登陆的用户信息
11   - */
12   -public class OtherUserInfo implements Serializable {
13   - // 用户昵称
14   - String nickName;
15   - //性别,m:男、f:女、n:未知
16   - String gender;
17   - //用户所在地
18   - String location;
19   - //头像,约100*100
20   - String faceUrl;
21   -
22   - //第三方用户ID
23   - //[qq: 建议使用openid, wx: 建议使用unionid, sina: 建议使用idstr];
24   - //注意:同一用户在登录Sp下不同app时,thirdPartyId必须相同
25   - String thirdPartyId;
26   - //三方登陆的类型 微信: weixin 微博 :sina qq :qq
27   - String loginType;
28   -
29   - public String getLoginType() {
30   - return loginType;
31   - }
32   -
33   - public void setLoginType(String loginType) {
34   - this.loginType = loginType;
35   - }
36   -
37   - public String getNickName() {
38   - return nickName;
39   - }
40   -
41   - public void setNickName(String nickName) {
42   - this.nickName = nickName;
43   - }
44   -
45   - public String getGender() {
46   - return gender;
47   - }
48   -
49   - public void setGender(String gender) {
50   - this.gender = gender;
51   - }
52   -
53   - public String getLocation() {
54   - return location;
55   - }
56   -
57   - public void setLocation(String location) {
58   - this.location = location;
59   - }
60   -
61   - public String getFaceUrl() {
62   - return faceUrl;
63   - }
64   -
65   - public void setFaceUrl(String faceUrl) {
66   - this.faceUrl = faceUrl;
67   - }
68   -
69   - public String getThirdPartyId() {
70   - return thirdPartyId;
71   - }
72   -
73   - public void setThirdPartyId(String thirdPartyId) {
74   - this.thirdPartyId = thirdPartyId;
75   - }
76   -
77   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/data/QuickLoginData.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame.data;
2   -
3   -
4   -import androidx.databinding.BaseObservable;
5   -import androidx.databinding.Bindable;
6   -
7   -import com.cnlive.libs.base.logic.Config;
8   -import com.cnlive.libs.base.logic.callback.StateCallback;
9   -import com.cnlive.core.user.BR;
10   -
11   -import static android.view.View.GONE;
12   -import static android.view.View.VISIBLE;
13   -import com.cnlive.core.user.BR;
14   -/**
15   - * Created by xiansong on 2018/1/11.
16   - */
17   -
18   -public class QuickLoginData extends BaseObservable implements StateCallback {
19   - private static final String send = "获取验证码";
20   - private static final String time_format = "%s秒后重发";
21   -
22   - private String phone = "";
23   - private String code = "";
24   - private String sendBtnText = send;
25   - private int time;
26   - private boolean sendEnabled = true;
27   - private int loadVisibility = GONE;
28   -
29   - @Bindable
30   - public String getPhone() {
31   - return phone;
32   - }
33   -
34   - public void setPhone(String phone) {
35   - this.phone = phone;
36   - notifyPropertyChanged(BR.phone);
37   - }
38   -
39   - @Bindable
40   - public String getCode() {
41   - return code;
42   - }
43   -
44   - public void setCode(String code) {
45   - this.code = code;
46   - notifyPropertyChanged(BR.code);
47   - }
48   -
49   - @Bindable
50   - public int getTime() {
51   - return time;
52   - }
53   -
54   - public void setTime(int time) {
55   - this.time = time;
56   - setSendBtnText(time <= 0 ? send : String.format(time_format, time));
57   - setSendEnabled(time <= 0);
58   - notifyPropertyChanged(BR.time);
59   - }
60   -
61   - @Bindable
62   - public String getSendBtnText() {
63   - return sendBtnText;
64   - }
65   -
66   - public void setSendBtnText(String sendBtnText) {
67   - this.sendBtnText = sendBtnText;
68   - notifyPropertyChanged(BR.sendBtnText);
69   - }
70   -
71   - @Bindable
72   - public boolean getSendEnabled() {
73   - return sendEnabled;
74   - }
75   -
76   - public void setSendEnabled(boolean sendEnabled) {
77   - this.sendEnabled = sendEnabled;
78   - notifyPropertyChanged(BR.sendEnabled);
79   - }
80   -
81   - @Bindable
82   - public int getLoadVisibility() {
83   - return loadVisibility;
84   - }
85   -
86   - public void setLoadVisibility(int loadVisibility) {
87   - this.loadVisibility = loadVisibility;
88   - notifyPropertyChanged(BR.loadVisibility);
89   - }
90   -
91   - @Override
92   - public void onState(int state) {
93   - loadVisibility = state == Config.STATE_LOAD ? VISIBLE : GONE;
94   - }
95   -}
96 0 \ No newline at end of file
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/presenter/FirstLoginPresenter.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame.presenter;
2   -
3   -import android.content.Context;
4   -import android.text.TextUtils;
5   -
6   -import com.cnlive.strike.data.network.model.BaseInfo;
7   -import com.cnlive.strike.data.network.model.FaceData;
8   -import com.cnlive.strike.data.network.model.TokenData;
9   -import com.cnlive.strike.data.network.model.UserData;
10   -import com.cnlive.libs.base.logic.Event;
11   -import com.cnlive.libs.base.logic.Logic;
12   -import com.cnlive.libs.base.logic.callback.DataCallback;
13   -import com.cnlive.strike.moudle.user.frame.view.FirstLoginView;
14   -import com.cnlive.strike.moudle_user.R;
15   -import com.cnlive.strike.user.UserUtilAction;
16   -import com.cnlive.strike.user.auth.UserService;
17   -import com.cnlive.strike.util.HelperUtil;
18   -import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
19   -
20   -import java.io.File;
21   -
22   -import static com.cnlive.libs.base.logic.Config.STATE_IDLE;
23   -import static com.cnlive.libs.base.logic.Config.STATE_LOAD;
24   -
25   -
26   -/**
27   - * Created by xiansong on 2018/1/19.
28   - */
29   -
30   -public class FirstLoginPresenter extends MvpBasePresenter<FirstLoginView> {
31   -
32   - private static final String TAG = "FirstLoginPresenter";
33   -
34   - private Event<BaseInfo<FaceData>> updateFaceEvent;
35   - private Event updateNameEvent;
36   -
37   - public void loadUserInfo(Context context) {
38   - UserService userService = UserService.getInstance(context);
39   - if (userService != null && userService.getAppAccount() != null) {
40   - String sid = UserService.getUid(context);
41   - String token = userService.getAppAccount().getToken();
42   - Logic.create()
43   - .action(UserUtilAction.queryUserInfo(context, sid, sid, token))
44   - .action((BaseInfo<UserData> data, DataCallback<UserData> callback) -> Logic.process(() -> {
45   - userService.setUserInfo(data.getData());
46   - return data.getData() == null ? null : data.getData();
47   - }, callback))
48   - .event()
49   - .setSuccessCallback(data -> {
50   - })
51   - .start();
52   - }
53   - }
54   -
55   - public void uploadName(Context context, String nickName) {
56   - if (updateNameEvent != null) updateNameEvent.cencel();
57   - if (getView() == null) return;
58   - if (TextUtils.isEmpty(nickName)) {
59   - if (getView() != null)
60   - getView().showToast(context.getString(R.string.user_toast_edit_nickname_empty));
61   - return;
62   - }
63   - if (nickName.trim().length() == 0) {
64   - if (getView() != null)
65   - getView().showToast(context.getString(R.string.user_toast_edit_nickname_only_space));
66   - return;
67   - }
68   -// 请输入昵称(不支持表情符号)
69   - UserService userService = UserService.getInstance(context);
70   - String sid = UserService.getUid(context);
71   - String token = userService.getAppAccount().getToken();
72   - updateNameEvent = Logic.create()
73   - .action(UserUtilAction.modifyUserInfo(context, sid, "nickName", nickName.trim().replaceAll("[\r\n]", ""), token))
74   - .action(UserUtilAction.queryUserInfo(context, sid, sid, token))
75   - .action((BaseInfo<UserData> data, DataCallback<UserData> callback) -> Logic.process(() -> {
76   - userService.setUserInfo(data.getData());
77   - return data == null ? null : data.getData();
78   - }, callback))
79   - .event()
80   - .setStateCallback(state -> {
81   - if (getView() == null) return;
82   - if (state == STATE_LOAD) {
83   - getView().showProgress(R.string.upload_nickname_dialog);
84   - } else if (state == STATE_IDLE) {
85   - getView().hideProgress();
86   - }
87   - })
88   - .setFailureCallback((state, message) -> {
89   - if (getView() == null) return;
90   - if (state == 8 || state == 9) {
91   -// UserOfflineUtil.userInvalid(context);
92   - HelperUtil.userInvalid(context);
93   - } else if (state == UserUtilAction.TOKEN_ERROR_CODE) {
94   - getView().showTokenErrorDialog();
95   - } else {
96   - getView().showToast(message);
97   - }
98   - })
99   - .setSuccessCallback(data -> {
100   -// LoginManager.modifyUserName( UserService.getUid(context), nickName);
101   - HelperUtil.modifyUserName(context, nickName);
102   - userService.setUserNickName(nickName);
103   - if (getView() == null) return;
104   - getView().showMainPage();
105   - })
106   - .start();
107   -
108   - }
109   -
110   - public void uploadFile(Context context, String filePath) {
111   - if (updateFaceEvent != null) updateFaceEvent.cencel();
112   - if (getView() == null) return;
113   - getView().showProgress(R.string.upload_image_dialog);
114   - File file = new File(filePath);
115   - UserService userService = UserService.getInstance(context);
116   - if (file.exists()) {
117   -
118   - updateFaceEvent = Logic.create()
119   - .action(UserUtilAction.accessToken(context))
120   - .action((BaseInfo<TokenData> data, DataCallback<BaseInfo<FaceData>> callback) -> {
121   - UserUtilAction.updateUserFace(context, UserService.getUid(context), file, userService.getAppAccount().getToken(), data.getData().getAccess_token(), callback);
122   - return null;
123   - })
124   - .<BaseInfo<FaceData>>event()
125   - .setStateCallback(state -> {
126   - if (getView() == null) return;
127   - if (state == STATE_LOAD) {
128   -
129   - } else if (state == STATE_IDLE) {
130   - getView().hideProgress();
131   - }
132   - })
133   - .setFailureCallback((state, message) -> {
134   - if (getView() == null) return;
135   - if (state == 8 || state == 9) {
136   -// UserOfflineUtil.userInvalid(context);
137   - HelperUtil.userInvalid(context);
138   - } else if (state == UserUtilAction.TOKEN_ERROR_CODE) {
139   - getView().showTokenErrorDialog();
140   - } else {
141   - getView().showToast(message);
142   - }
143   - })
144   - .setSuccessCallback(data -> {
145   - HelperUtil.modifyUserImage(context,data.getData().getFaceUrl());
146   -// LoginManager.modifyUserImage( UserService.getUid(context), data.getData().getFaceUrl());
147   - userService.setUserFaceUrl(data.getData().getFaceUrl(), data.getData().getBigFaceUrl());
148   - if (getView() == null) return;
149   - getView().photoChange(data.getData().getFaceUrl());
150   - })
151   - .start();
152   - } else {
153   - if (getView() != null) getView().showToast("文件不存在");
154   - }
155   - }
156   -
157   -}
158   -
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/presenter/PersonalDataPresenter.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame.presenter;
2   -
3   -import android.content.Context;
4   -import android.text.InputFilter;
5   -import android.text.InputType;
6   -import android.text.TextUtils;
7   -import android.widget.EditText;
8   -import android.widget.Toast;
9   -
10   -import com.cnlive.strike.data.network.model.BaseInfo;
11   -import com.cnlive.libs.base.logic.Event;
12   -import com.cnlive.libs.base.logic.Logic;
13   -import com.cnlive.libs.base.logic.callback.FailureCallback;
14   -import com.cnlive.libs.base.logic.callback.SuccessCallback;
15   -import com.cnlive.libs.base.util.AlertUtil;
16   -import com.cnlive.strike.moudle.user.frame.view.PersonalDataView;
17   -import com.cnlive.strike.moudle.user.model.msg.UserEventMsg;
18   -import com.cnlive.strike.moudle.user.ui.activity.PersonalDataActivity;
19   -import com.cnlive.strike.user.UserUtilAction;
20   -import com.cnlive.strike.user.auth.UserService;
21   -import com.cnlive.strike.user.model.CNLiveUserInfoExt;
22   -//import com.cnlive.tcsdk.LoginManager;
23   -import com.google.gson.Gson;
24   -import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
25   -import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
26   -import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
27   -
28   -import org.greenrobot.eventbus.EventBus;
29   -
30   -/**
31   - * 创建:wukuiqing
32   - * <p>
33   - * 时间:2018/3/22
34   - * <p>
35   - * 描述:
36   - */
37   -
38   -public class PersonalDataPresenter extends MvpBasePresenter<PersonalDataView> {
39   -
40   - private Event updateUserExtInfoEvent;
41   - private Event modifyUserInfoEvent;
42   -
43   - public void setData(UserService userService) {
44   - if (getView() == null) return;
45   - getView().setView(userService);
46   - }
47   -
48   - public void upLoadNickName(PersonalDataActivity personalDataActivity, UserService userService) {
49   - QMUIDialog.EditTextDialogBuilder builderNickName = new QMUIDialog.EditTextDialogBuilder(personalDataActivity);
50   - EditText name = builderNickName.getEditText();
51   - name.setFilters(new InputFilter[]{new InputFilter.LengthFilter(15)});
52   - name.setLines(1);
53   - builderNickName.setTitle("修改昵称")
54   - .setPlaceholder("昵称最多15个字")
55   - .setInputType(InputType.TYPE_CLASS_TEXT)
56   - .addAction("取消", new QMUIDialogAction.ActionListener() {
57   - @Override
58   - public void onClick(QMUIDialog dialog, int index) {
59   - dialog.cancel();
60   - }
61   - })
62   - .addAction("确定", new QMUIDialogAction.ActionListener() {
63   - @Override
64   - public void onClick(QMUIDialog dialog, int index) {
65   - String name = builderNickName.getEditText().getText().toString();
66   -
67   - if (name != null && name.trim().length() > 0) {
68   - if (name.length() > 15) {
69   - AlertUtil.showDeftToast(personalDataActivity, "昵称最多十五个字");
70   - } else {
71   - dialog.dismiss();
72   -
73   - upLoadUserInfo(personalDataActivity, userService, "nickName", name);
74   - }
75   -
76   -
77   - } else {
78   - AlertUtil.showDeftToast(personalDataActivity, "昵称不能为空");
79   - }
80   - }
81   - }).show();
82   - }
83   -
84   - public void upLoadUserInfo(Context context, UserService userService, String type, String value) {
85   -
86   -
87   - /**
88   - * @param uid 用户ID
89   - * @param type nickName-昵称,gender-性别,email-邮箱, location-联系方式
90   - * @param value 对应的信息,性别,m:男、f:女、n:未知
91   - * @param callback 回调
92   - *
93   - *
94   - */
95   - if (modifyUserInfoEvent != null) modifyUserInfoEvent.cencel();
96   - String uid = UserService.getUid(context);
97   - String token = userService.getAppAccount().getToken();
98   -
99   - modifyUserInfoEvent = Logic.create()
100   - .action(UserUtilAction.modifyUserInfo(context, uid, type, value, token))
101   - .<BaseInfo>event()
102   - .setFailureCallback(new FailureCallback() {
103   - @Override
104   - public void onFailure(int state, String message) {
105   - if (getView() == null) return;
106   - if (state == UserUtilAction.TOKEN_ERROR_CODE) {
107   - getView().showTokenErrorDialog();
108   - } else {
109   - getView().showMessage(message);
110   - }
111   - }
112   - })
113   - .setSuccessCallback(new SuccessCallback<BaseInfo>() {
114   - @Override
115   - public void onSuccess(BaseInfo data) {
116   - if (type.equals("nickName")) {
117   - userService.setUserNickName(value);
118   - if (getView() != null) {
119   - getView().upDataNickName(value);
120   - }
121   - EventBus.getDefault().post(new UserEventMsg(UserEventMsg.MODIFY_USER_IMAGE, value));
122   -
123   -// LoginManager.modifyUserName( UserService.getUid(context), value);
124   - } else if (type.equals("gender")) {
125   - userService.setUserSex(value);
126   - if (getView() != null) {
127   -
128   - getView().upDataSex(value);
129   - }
130   -
131   - } else if (type.equals("location")) {
132   - userService.setUserLocation(value);
133   - if (getView() != null) {
134   - getView().upDataLocation(value);
135   - }
136   - }
137   - }
138   - }).start();
139   -
140   - }
141   -
142   -
143   - public void upDataLocation(PersonalDataActivity personalDataActivity, UserService userService) {
144   -
145   - QMUIDialog.EditTextDialogBuilder builderNickName = new QMUIDialog.EditTextDialogBuilder(personalDataActivity);
146   - EditText where = builderNickName.getEditText();
147   - where.setFilters(new InputFilter[]{new InputFilter.LengthFilter(12)});
148   - where.setLines(1);
149   - builderNickName.setTitle("修改位置")
150   - .setPlaceholder("在此输入您的位置")
151   - .setInputType(InputType.TYPE_CLASS_TEXT)
152   - .addAction("取消", new QMUIDialogAction.ActionListener() {
153   - @Override
154   - public void onClick(QMUIDialog dialog, int index) {
155   - dialog.cancel();
156   - }
157   - })
158   - .addAction("确定", new QMUIDialogAction.ActionListener() {
159   - @Override
160   - public void onClick(QMUIDialog dialog, int index) {
161   - String location = builderNickName.getEditText().getText().toString();
162   - if (location != null && location.length() > 0) {
163   - dialog.dismiss();
164   -
165   - upLoadUserInfo(personalDataActivity, userService, "location", location);
166   - } else {
167   -
168   - AlertUtil.showDeftToast(personalDataActivity, "请填入您的位置");
169   - }
170   - }
171   - }).show();
172   - }
173   -
174   - /**
175   - * 修改个人信息 名字 性别 地址
176   - *
177   - * @param personalDataActivity
178   - * @param userService
179   - */
180   - public void upDataSignature(PersonalDataActivity personalDataActivity, UserService userService) {
181   - QMUIDialog.EditTextDialogBuilder builderNickName = new QMUIDialog.EditTextDialogBuilder(personalDataActivity);
182   - builderNickName.setTitle("修改个性签名")
183   - .setPlaceholder("请输入您的个性签名")
184   - .setInputType(InputType.TYPE_CLASS_TEXT)
185   - .addAction("取消", new QMUIDialogAction.ActionListener() {
186   - @Override
187   - public void onClick(QMUIDialog dialog, int index) {
188   - dialog.cancel();
189   - }
190   - })
191   - .addAction("确定", new QMUIDialogAction.ActionListener() {
192   - @Override
193   - public void onClick(QMUIDialog dialog, int index) {
194   - String location = builderNickName.getEditText().getText().toString();
195   - if (!TextUtils.isEmpty(location)) {
196   - if (location.length() > 15) {
197   - AlertUtil.showDeftToast(personalDataActivity, "个性签名最多十五个字");
198   - } else {
199   - dialog.dismiss();
200   - upLoadSignature(personalDataActivity, userService, location);
201   - }
202   -
203   -
204   - } else {
205   -
206   - AlertUtil.showDeftToast(personalDataActivity, "请输入您的个性签名");
207   - }
208   - }
209   - }).show();
210   -
211   - }
212   -
213   - /**
214   - * 修改个人签名
215   - *
216   - * @param personalDataActivity
217   - * @param userService
218   - * @param value
219   - */
220   - public void upLoadSignature(PersonalDataActivity personalDataActivity, UserService userService, String value) {
221   - if (updateUserExtInfoEvent != null) updateUserExtInfoEvent.cencel();
222   - String uid = UserService.getUid(personalDataActivity);
223   - String token = userService.getAppAccount().getToken();
224   -
225   - CNLiveUserInfoExt info = new CNLiveUserInfoExt();
226   - info.setUserSign(value);
227   -
228   - String signature = new Gson().toJson(info);
229   - updateUserExtInfoEvent = Logic.create()
230   - .action(UserUtilAction.updateUserExtInfo(personalDataActivity, uid, signature, token))
231   - .<BaseInfo>event()
232   - .setFailureCallback((state, message) -> {
233   - if (state == UserUtilAction.TOKEN_ERROR_CODE) {
234   - if (getView() != null) getView().showTokenErrorDialog();
235   - } else {
236   - Toast.makeText(personalDataActivity, message, Toast.LENGTH_SHORT).show();
237   - }
238   - })
239   - .setSuccessCallback(data -> {
240   - userService.setUserSign(value);
241   - if (getView() != null) getView().upSignature(value);
242   - }).start();
243   - }
244   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/presenter/PersonalImagePresenter.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame.presenter;
2   -
3   -import android.content.SharedPreferences;
4   -
5   -import com.cnlive.libs.base.logic.Event;
6   -import com.cnlive.libs.base.logic.Logic;
7   -import com.cnlive.libs.base.logic.callback.DataCallback;
8   -import com.cnlive.libs.base.util.AlertUtil;
9   -import com.cnlive.libs.base.util.SharedPreferencesHelper;
10   -import com.cnlive.strike.data.network.model.BaseInfo;
11   -import com.cnlive.strike.data.network.model.FaceData;
12   -import com.cnlive.strike.data.network.model.TokenData;
13   -import com.cnlive.strike.moudle.user.frame.view.PersonalImageView;
14   -import com.cnlive.strike.moudle.user.model.msg.UserEventMsg;
15   -import com.cnlive.strike.moudle.user.ui.activity.PersonalImageActivity;
16   -import com.cnlive.strike.user.UserUtilAction;
17   -import com.cnlive.strike.user.auth.UserService;
18   -import com.cnlive.strike.util.HelperUtil;
19   -import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
20   -
21   -import org.greenrobot.eventbus.EventBus;
22   -
23   -import java.io.File;
24   -
25   -import static android.content.Context.MODE_PRIVATE;
26   -
27   -/**
28   - * 创建:wukuiqing
29   - * <p>
30   - * 时间:2018/3/22
31   - * <p>
32   - * 描述:
33   - */
34   -
35   -
36   -public class PersonalImagePresenter extends MvpBasePresenter<PersonalImageView> {
37   -
38   - private Event<BaseInfo<FaceData>> updateFaceEvent;
39   - private UserService userService;
40   -
41   - public void showBottomSheet() {
42   - if (getView() != null) {
43   - getView().showBottomSheet();
44   - }
45   -
46   - }
47   -
48   - public void uploadUserIcon(PersonalImageActivity activity, String path) {
49   -
50   - if (updateFaceEvent != null) updateFaceEvent.cencel();
51   - userService = UserService.getInstance(activity);
52   - String uid = UserService.getUid(activity);
53   - String token = userService.getAppAccount().getToken();
54   - /**
55   - * @param uid 用户ID
56   - * @param secret 获取access_token 凭证
57   - * @param file 头像文件
58   - * @param callback 回调
59   - */
60   - File file = new File(path);
61   - updateFaceEvent = Logic.create()
62   - .action(UserUtilAction.accessToken(activity))
63   - .action((BaseInfo<TokenData> data, DataCallback<BaseInfo<FaceData>> callback) -> {
64   - UserUtilAction.updateUserFace(activity, uid, file, token, data.getData().getAccess_token(), callback);
65   - return null;
66   - })
67   - .<BaseInfo<FaceData>>event()
68   - .setFailureCallback((state, message) -> {
69   - if (getView() == null) return;
70   - getView().hideLoading();
71   - if (state == UserUtilAction.TOKEN_ERROR_CODE) {
72   - getView().showTokenErrorDialog();
73   - } else {
74   - AlertUtil.showDeftToast(activity, message);
75   - }
76   - })
77   - .setSuccessCallback(data -> {
78   - userService.setUserFaceUrl(data.getData().getFaceUrl(), data.getData().getBigFaceUrl());
79   - if (getView() != null) {
80   - SharedPreferences preferences = activity.getSharedPreferences("updateface", MODE_PRIVATE);
81   - boolean status = preferences.getBoolean(UserService.getUid(activity), false);
82   - Boolean app_is_show_integral = SharedPreferencesHelper.getInstance(activity).getBoolValue("APP_IS_SHOW_INTEGRAL");
83   - if (!status && app_is_show_integral) {
84   - //todo
85   - HelperUtil.goToCoinRainAction(activity,"update_face", "", "updateface",false);
86   -
87   -// CoinRainAction.code(activity, UserService.getUid(activity), "update_face", "", "updateface",false);
88   - }
89   - getView().upDataUserIcon(data.getData().getBigFaceUrl());
90   - }
91   - })
92   - .start();
93   -
94   - }
95   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/presenter/QuickLoginPresenter.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame.presenter;
2   -
3   -import android.accounts.Account;
4   -import android.content.Context;
5   -import android.text.TextUtils;
6   -
7   -import com.cnlive.strike.data.network.model.BaseInfo;
8   -import com.cnlive.libs.base.application.AppConfig;
9   -import com.cnlive.libs.base.logic.Config;
10   -import com.cnlive.libs.base.logic.Event;
11   -import com.cnlive.libs.base.logic.Logic;
12   -import com.cnlive.libs.base.util.TimerUtil;
13   -import com.cnlive.strike.moudle.qr.uitl.RegexUtils;
14   -import com.cnlive.strike.moudle.user.frame.data.OtherUserInfo;
15   -import com.cnlive.strike.moudle.user.frame.data.QuickLoginData;
16   -import com.cnlive.strike.moudle.user.frame.view.QuickLoginView;
17   -import com.cnlive.strike.moudle.user.model.msg.UserEventMsg;
18   -import com.cnlive.strike.moudle.user.ui.fragment.QuickLoginFragment;
19   -import com.cnlive.strike.moudle_user.R;
20   -import com.cnlive.strike.router.user.UserAction;
21   -import com.cnlive.strike.user.UserUtilAction;
22   -import com.cnlive.strike.user.auth.UserService;
23   -import com.cnlive.strike.user.model.CNLiveUserInfo;
24   -import com.cnlive.strike.util.TimeEvent;
25   -import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
26   -
27   -import org.greenrobot.eventbus.EventBus;
28   -
29   -import java.util.Arrays;
30   -import java.util.Collections;
31   -
32   -
33   -/**
34   - * @author Lynn
35   - * @date 2017/12/22
36   - */
37   -
38   -public class QuickLoginPresenter extends MvpBasePresenter<QuickLoginView> {
39   -
40   -
41   - private static final String TAG = "QuickLoginPresenter";
42   -
43   - private Event<CNLiveUserInfo> event;
44   - private Event sendMsgBefQuickLogin;
45   - private TimerUtil timerUtil; //计时工具类
46   - private Event otherEvent;
47   -
48   - public void deleteUserInfo(Context context, String userName) {
49   - UserService.getInstance(context).removeUser(userName, future -> {
50   - if (getView() == null) return;
51   - //获取已登录用户列表
52   - Account[] accounts = UserService.getInstance(context).getUserList();
53   - //倒序输出最近登录用户
54   -
55   - Collections.reverse(Arrays.asList(accounts));
56   - getView().uploadListData(accounts);
57   - });
58   - }
59   -
60   - public void init(Context context) {
61   - if (getView() == null) return;
62   - UserService us = UserService.getInstance(context);
63   - //获取已登录用户列表
64   - Account[] accounts = us.getUserList();
65   - //倒序输出最近登录用户
66   - Collections.reverse(Arrays.asList(accounts));
67   - //获取最近登录用户数据
68   - Account account = accounts.length > 0 ? accounts[0] : null;
69   - String name = account == null ? "" : account.name;
70   - //页面填充数据
71   - getView().uploadInputData(name);
72   - getView().uploadListData(accounts);
73   - }
74   -
75   - private void startTimer() {
76   - if (timerUtil != null) timerUtil.cancel();
77   -
78   - timerUtil = new TimerUtil();
79   - timerUtil.setTotalTime(60_000);//设置毫秒数
80   - timerUtil.setIntervalTime(500);//设置间隔数
81   - timerUtil.start();
82   - timerUtil.setTimerLiener(new TimerUtil.TimeListener() {
83   - @Override
84   - public void onFinish() {
85   - if (getView() != null) getView().onTimerFinish();
86   - }
87   -
88   - @Override
89   - public void onInterval(long remainTime) {
90   - if (getView() != null) getView().onTimerInterval(remainTime / 1000);
91   - }
92   - });
93   - }
94   -
95   - public void sendCode(Context context, String phone, String countryCode) {
96   - if (getView() == null) return;
97   - if (TimeEvent.debounce(2_000)) return;
98   - if (TextUtils.isEmpty(phone)) {
99   - getView().showToast(context.getString(R.string.user_toast_quick_login_empty_phone));
100   - return;
101   - }
102   - if ("86".equals(countryCode) && !RegexUtils.isMobileSimple(phone)) {
103   - getView().showToast(context.getString(R.string.user_toast_quick_login_error_phone));
104   - return;
105   - }
106   - if (sendMsgBefQuickLogin != null && sendMsgBefQuickLogin.active) {
107   - getView().showToast("处理中请稍后...");
108   - } else {
109   - sendMsgBefQuickLogin = Logic.create()
110   - .action(UserUtilAction.sendMsgBefQuickLoginAction(context, phone, countryCode))
111   - .<BaseInfo>event()
112   - .setFailureCallback((state, message) -> {
113   - if (getView() != null) getView().showToast(message);
114   - })
115   - .setSuccessCallback(data -> {
116   - startTimer();
117   - if (getView() != null) getView().showToast("验证码已发送");
118   - }).start();
119   - }
120   - }
121   -
122   - public void login(QuickLoginFragment context, QuickLoginData data, String countryCode) {
123   - if (getView() == null) return;
124   -
125   - if (TextUtils.isEmpty(data.getPhone())) {
126   - getView().showToast(context.getString(R.string.user_toast_quick_login_empty_phone));
127   - } else if (TextUtils.isEmpty(data.getCode())) {
128   - getView().showToast(context.getString(R.string.user_toast_quick_login_empty_code));
129   - } else {
130   - cancelLoad();
131   - context.isLogin = true;
132   - UserAction.mobileLogin(context.getActivity(), data.getPhone(), data.getCode(), countryCode, initLoginEvent(context, true));
133   - }
134   - }
135   -
136   - private Event<CNLiveUserInfo> initLoginEvent(QuickLoginFragment context, Boolean retry) {
137   - return initLoginEvent(context, retry, null);
138   - }
139   -
140   - private Event<CNLiveUserInfo> initLoginEvent(QuickLoginFragment context, Boolean retry, OtherUserInfo otherUserInfo) {
141   - return event = new Event<CNLiveUserInfo>()
142   - .setStateCallback(state -> {
143   - if (state == Config.STATE_LOAD) getView().showProgress();
144   - else getView().hideProgress();
145   - }).setFailureCallback((state, message) -> {
146   - if (context == null) return;
147   - if (getView() == null) return;
148   - switch (state) {
149   - case 41010: //手机号无效
150   - getView().showToast(message);
151   - break;
152   - case 41002: //验证码为6位数字
153   - getView().showToast(message);
154   - break;
155   - case 41009: //验证码错误
156   - getView().showToast(message);
157   - break;
158   - case 41006: //手机号已存在
159   - getView().showToast(message);
160   - break;
161   - case 42013: //此帐号未注册,请先注册
162   - getView().bindPhone(otherUserInfo);
163   - break;
164   - case 6208: //当前用户在其他地点登陆
165   - if (retry) {
166   - if (otherUserInfo == null) {
167   - UserAction.mobileLogin(context.getActivity(), context.data.getPhone(), context.data.getCode(), "", initLoginEvent(context, false));
168   - }
169   - return;
170   - } else getView().showToast("用户登录失败,再试一次吧.");
171   - break;
172   - default: //其他错误
173   - getView().showToast(message);
174   - break;
175   - }
176   - context.hasLogin = false;
177   - if (context != null) context.isLogin = false;
178   - }).setSuccessCallback((info) -> {
179   - if (context == null) return;
180   - if (getView() == null) return;
181   - CNLiveUserInfo user = UserService.getInstance(context.getActivity()).getAppAccount();
182   - if (user == null || (user != null && TextUtils.isEmpty(user.getToken()))) {
183   - getView().showToast("用户登陆失败,再试一次吧.");
184   - } else if (user.isNewUser()) {
185   - //是新用户
186   - EventBus.getDefault().post(new UserEventMsg(UserEventMsg.IS_NEW_USER, null));
187   - //TODO 必须设置用户头像
188   - //OpenInstall用户注册统计
189   -// OpenInstall.reportRegister();
190   - //友盟账号登录统计,暂时只有平台登录,后续对接三方登录
191   -// MobclickAgent.onProfileSignIn("CNLive", user.getUid());
192   - //三方登陆不需要重新设置头像 otherUserInfo不为空表示三方登陆
193   - if (otherUserInfo != null) {
194   - getView().showMainView(true, true);
195   - } else {
196   - getView().showEditView(false);
197   - }
198   -
199   - } else {
200   - //友盟账号登录统计,暂时只有平台登录,后续对接三方登录
201   -// MobclickAgent.onProfileSignIn("CNLive", user.getUid());
202   - getView().showMainView(false, false);
203   - }
204   - AppConfig.setCountryCode("");
205   - AppConfig.setVerificationCode("");
206   - AppConfig.setUserPhone("");
207   - context.hasLogin = true;
208   - if (context != null) context.isLogin = false;
209   - }).setCancelCallback(() -> {
210   - //取消操作可能被触发多次 ,根据页面逻辑选择使用
211   - context.hasLogin = false;
212   - if (context != null) context.isLogin = false;
213   - });
214   - }
215   -
216   - public void cancelLoad() {
217   - if (event != null) {
218   - event.cencel();
219   - event = null;
220   - }
221   - }
222   -
223   - /**
224   - * 销毁
225   - */
226   - public void destroy() {
227   - if (timerUtil != null) {
228   - timerUtil.cancel();
229   - }
230   - if (event != null) {
231   - event.cencel();
232   - event = null;
233   - }
234   - if (otherEvent != null) otherEvent.cencel();
235   - }
236   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/presenter/SelectCountryPresenter.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame.presenter;
2   -
3   -import com.cnlive.strike.moudle.user.frame.view.SelectCountryView;
4   -import com.cnlive.strike.moudle.user.model.CountryData;
5   -import com.cnlive.strike.moudle.user.ui.activity.SelectCountryActivity;
6   -import com.google.gson.Gson;
7   -import com.google.gson.reflect.TypeToken;
8   -import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
9   -
10   -import java.lang.reflect.Type;
11   -import java.util.ArrayList;
12   -import java.util.List;
13   -
14   -import io.reactivex.Observable;
15   -import io.reactivex.ObservableEmitter;
16   -import io.reactivex.ObservableOnSubscribe;
17   -import io.reactivex.Observer;
18   -import io.reactivex.android.schedulers.AndroidSchedulers;
19   -import io.reactivex.disposables.Disposable;
20   -import io.reactivex.schedulers.Schedulers;
21   -
22   -/**
23   - * 作者: 吴奎庆
24   - * <p>
25   - * 时间: 2018/11/17
26   - * <p>
27   - * 简介:
28   - */
29   -public class SelectCountryPresenter extends MvpBasePresenter<SelectCountryView> {
30   - public void processData(SelectCountryActivity countryActivity, String countryCode) {
31   -
32   -
33   - Observable.create(new ObservableOnSubscribe<List<CountryData>>() {
34   - @Override
35   - public void subscribe(ObservableEmitter<List<CountryData>> emitter) throws Exception {
36   - String country = "[{\"contryName\":\"阿尔巴尼亚\",\"contryCode\":\"355\"},{\"contryName\":\"阿尔及利亚\",\"contryCode\":\"213\"},{\"contryName\":\"阿富汗\",\"contryCode\":\"93\"},{\"contryName\":\"阿根廷\",\"contryCode\":\"54\"},{\"contryName\":\"阿拉伯联合酋长国\",\"contryCode\":\"971\"},{\"contryName\":\"阿鲁巴\",\"contryCode\":\"297\"},{\"contryName\":\"阿曼\",\"contryCode\":\"968\"},{\"contryName\":\"阿塞拜疆\",\"contryCode\":\"994\"},{\"contryName\":\"埃及\",\"contryCode\":\"20\"},{\"contryName\":\"埃塞俄比亚\",\"contryCode\":\"251\"},{\"contryName\":\"爱尔兰\",\"contryCode\":\"353\"},{\"contryName\":\"爱沙尼亚\",\"contryCode\":\"372\"},{\"contryName\":\"安道尔\",\"contryCode\":\"376\"},{\"contryName\":\"安哥拉\",\"contryCode\":\"244\"},{\"contryName\":\"安圭拉\",\"contryCode\":\"1264\"},{\"contryName\":\"安提瓜和巴布达\",\"contryCode\":\"1268\"},{\"contryName\":\"奥地利\",\"contryCode\":\"43\"},{\"contryName\":\"澳大利亚\",\"contryCode\":\"61\"},{\"contryName\":\"巴巴多斯\",\"contryCode\":\"1246\"},{\"contryName\":\"巴布亚新几内亚\",\"contryCode\":\"675\"},{\"contryName\":\"巴哈马\",\"contryCode\":\"1242\"},{\"contryName\":\"巴基斯坦\",\"contryCode\":\"92\"},{\"contryName\":\"巴拉圭\",\"contryCode\":\"595\"},{\"contryName\":\"巴林\",\"contryCode\":\"973\"},{\"contryName\":\"巴拿马\",\"contryCode\":\"507\"},{\"contryName\":\"巴西\",\"contryCode\":\"55\"},{\"contryName\":\"白俄罗斯\",\"contryCode\":\"375\"},{\"contryName\":\"百慕大群岛\",\"contryCode\":\"1441\"},{\"contryName\":\"保加利亚\",\"contryCode\":\"359\"},{\"contryName\":\"贝宁\",\"contryCode\":\"229\"},{\"contryName\":\"比利时\",\"contryCode\":\"32\"},{\"contryName\":\"冰岛\",\"contryCode\":\"354\"},{\"contryName\":\"波多黎各\",\"contryCode\":\"1787\"},{\"contryName\":\"波兰\",\"contryCode\":\"48\"},{\"contryName\":\"波斯尼亚和黑塞哥维那\",\"contryCode\":\"387\"},{\"contryName\":\"玻利维亚\",\"contryCode\":\"591\"},{\"contryName\":\"伯利兹\",\"contryCode\":\"501\"},{\"contryName\":\"博茨瓦纳\",\"contryCode\":\"267\"},{\"contryName\":\"不丹\",\"contryCode\":\"975\"},{\"contryName\":\"布基纳法索\",\"contryCode\":\"226\"},{\"contryName\":\"布隆迪\",\"contryCode\":\"257\"},{\"contryName\":\"朝鲜\",\"contryCode\":\"850\"},{\"contryName\":\"赤道几内亚\",\"contryCode\":\"240\"},{\"contryName\":\"丹麦\",\"contryCode\":\"45\"},{\"contryName\":\"德国\",\"contryCode\":\"49\"},{\"contryName\":\"东帝汶\",\"contryCode\":\"670\"},{\"contryName\":\"多哥\",\"contryCode\":\"228\"},{\"contryName\":\"多米尼加\",\"contryCode\":\"1767\"},{\"contryName\":\"多米尼加共和国\",\"contryCode\":\"1809\"},{\"contryName\":\"俄罗斯\",\"contryCode\":\"7\"},{\"contryName\":\"厄瓜多尔\",\"contryCode\":\"593\"},{\"contryName\":\"厄立特里亚\",\"contryCode\":\"291\"},{\"contryName\":\"法国\",\"contryCode\":\"33\"},{\"contryName\":\"法罗群岛\",\"contryCode\":\"298\"},{\"contryName\":\"法属波利尼西亚\",\"contryCode\":\"689\"},{\"contryName\":\"法属圭亚那\",\"contryCode\":\"594\"},{\"contryName\":\"菲律宾\",\"contryCode\":\"63\"},{\"contryName\":\"斐济\",\"contryCode\":\"679\"},{\"contryName\":\"芬兰\",\"contryCode\":\"358\"},{\"contryName\":\"冈比亚\",\"contryCode\":\"220\"},{\"contryName\":\"刚果共和国\",\"contryCode\":\"242\"},{\"contryName\":\"刚果民主共和国\",\"contryCode\":\"243\"},{\"contryName\":\"哥伦比亚\",\"contryCode\":\"57\"},{\"contryName\":\"哥斯达黎加\",\"contryCode\":\"506\"},{\"contryName\":\"格林纳达\",\"contryCode\":\"1473\"},{\"contryName\":\"格陵兰岛\",\"contryCode\":\"299\"},{\"contryName\":\"格鲁吉亚\",\"contryCode\":\"995\"},{\"contryName\":\"古巴\",\"contryCode\":\"53\"},{\"contryName\":\"瓜德罗普岛\",\"contryCode\":\"590\"},{\"contryName\":\"瓜地马拉\",\"contryCode\":\"502\"},{\"contryName\":\"关岛\",\"contryCode\":\"1671\"},{\"contryName\":\"圭亚那\",\"contryCode\":\"592\"},{\"contryName\":\"哈萨克斯坦\",\"contryCode\":\"7\"},{\"contryName\":\"海地\",\"contryCode\":\"509\"},{\"contryName\":\"韩国\",\"contryCode\":\"82\"},{\"contryName\":\"荷兰\",\"contryCode\":\"31\"},{\"contryName\":\"荷兰加勒比\",\"contryCode\":\"599\"},{\"contryName\":\"黑山\",\"contryCode\":\"382\"},{\"contryName\":\"洪都拉斯\",\"contryCode\":\"504\"},{\"contryName\":\"基里巴斯\",\"contryCode\":\"686\"},{\"contryName\":\"吉布提\",\"contryCode\":\"253\"},{\"contryName\":\"吉尔吉斯斯坦\",\"contryCode\":\"996\"},{\"contryName\":\"几内亚\",\"contryCode\":\"224\"},{\"contryName\":\"几内亚比绍共和国\",\"contryCode\":\"245\"},{\"contryName\":\"加拿大\",\"contryCode\":\"1\"},{\"contryName\":\"加纳\",\"contryCode\":\"233\"},{\"contryName\":\"加蓬\",\"contryCode\":\"241\"},{\"contryName\":\"柬埔寨\",\"contryCode\":\"855\"},{\"contryName\":\"捷克\",\"contryCode\":\"420\"},{\"contryName\":\"津巴布韦\",\"contryCode\":\"263\"},{\"contryName\":\"喀麦隆\",\"contryCode\":\"237\"},{\"contryName\":\"卡塔尔\",\"contryCode\":\"974\"},{\"contryName\":\"开曼群岛\",\"contryCode\":\"1345\"},{\"contryName\":\"开普\",\"contryCode\":\"238\"},{\"contryName\":\"科摩罗\",\"contryCode\":\"269\"},{\"contryName\":\"科威特\",\"contryCode\":\"965\"},{\"contryName\":\"克罗地亚\",\"contryCode\":\"385\"},{\"contryName\":\"肯尼亚\",\"contryCode\":\"254\"},{\"contryName\":\"库克群岛\",\"contryCode\":\"682\"},{\"contryName\":\"库拉索\",\"contryCode\":\"599\"},{\"contryName\":\"拉脱维亚\",\"contryCode\":\"371\"},{\"contryName\":\"莱索托\",\"contryCode\":\"266\"},{\"contryName\":\"老挝\",\"contryCode\":\"856\"},{\"contryName\":\"黎巴嫩\",\"contryCode\":\"961\"},{\"contryName\":\"立陶宛\",\"contryCode\":\"370\"},{\"contryName\":\"利比里亚\",\"contryCode\":\"231\"},{\"contryName\":\"利比亚\",\"contryCode\":\"218\"},{\"contryName\":\"列支敦士登\",\"contryCode\":\"423\"},{\"contryName\":\"留尼汪\",\"contryCode\":\"262\"},{\"contryName\":\"卢森堡\",\"contryCode\":\"352\"},{\"contryName\":\"卢旺达\",\"contryCode\":\"250\"},{\"contryName\":\"罗马尼亚\",\"contryCode\":\"40\"},{\"contryName\":\"马达加斯加\",\"contryCode\":\"261\"},{\"contryName\":\"马尔代夫\",\"contryCode\":\"960\"},{\"contryName\":\"马耳他\",\"contryCode\":\"356\"},{\"contryName\":\"马拉维\",\"contryCode\":\"265\"},{\"contryName\":\"马来西亚\",\"contryCode\":\"60\"},{\"contryName\":\"马里\",\"contryCode\":\"223\"},{\"contryName\":\"马其顿\",\"contryCode\":\"389\"},{\"contryName\":\"马绍尔群岛\",\"contryCode\":\"692\"},{\"contryName\":\"马约特\",\"contryCode\":\"269\"},{\"contryName\":\"毛里求斯\",\"contryCode\":\"230\"},{\"contryName\":\"毛里塔尼亚\",\"contryCode\":\"222\"},{\"contryName\":\"美国\",\"contryCode\":\"1\"},{\"contryName\":\"美属萨摩亚\",\"contryCode\":\"1684\"},{\"contryName\":\"蒙古\",\"contryCode\":\"976\"},{\"contryName\":\"蒙特塞拉特岛\",\"contryCode\":\"1664\"},{\"contryName\":\"孟加拉国\",\"contryCode\":\"880\"},{\"contryName\":\"秘鲁\",\"contryCode\":\"51\"},{\"contryName\":\"密克罗尼西亚\",\"contryCode\":\"691\"},{\"contryName\":\"缅甸\",\"contryCode\":\"95\"},{\"contryName\":\"摩尔多瓦\",\"contryCode\":\"373\"},{\"contryName\":\"摩洛哥\",\"contryCode\":\"212\"},{\"contryName\":\"摩纳哥\",\"contryCode\":\"377\"},{\"contryName\":\"莫桑比克\",\"contryCode\":\"258\"},{\"contryName\":\"墨西哥\",\"contryCode\":\"52\"},{\"contryName\":\"拿鲁岛\",\"contryCode\":\"674\"},{\"contryName\":\"纳米比亚\",\"contryCode\":\"264\"},{\"contryName\":\"南非\",\"contryCode\":\"27\"},{\"contryName\":\"尼泊尔\",\"contryCode\":\"977\"},{\"contryName\":\"尼加拉瓜\",\"contryCode\":\"505\"},{\"contryName\":\"尼日尔\",\"contryCode\":\"227\"},{\"contryName\":\"尼日利亚\",\"contryCode\":\"234\"},{\"contryName\":\"挪威\",\"contryCode\":\"47\"},{\"contryName\":\"帕劳\",\"contryCode\":\"680\"},{\"contryName\":\"葡萄牙\",\"contryCode\":\"351\"},{\"contryName\":\"日本\",\"contryCode\":\"81\"},{\"contryName\":\"瑞典\",\"contryCode\":\"46\"},{\"contryName\":\"瑞士\",\"contryCode\":\"41\"},{\"contryName\":\"萨尔瓦多\",\"contryCode\":\"503\"},{\"contryName\":\"萨摩亚\",\"contryCode\":\"685\"},{\"contryName\":\"塞尔维亚\",\"contryCode\":\"381\"},{\"contryName\":\"塞拉利昂\",\"contryCode\":\"232\"},{\"contryName\":\"塞内加尔\",\"contryCode\":\"221\"},{\"contryName\":\"塞浦路斯\",\"contryCode\":\"357\"},{\"contryName\":\"塞舌尔\",\"contryCode\":\"248\"},{\"contryName\":\"沙特阿拉伯\",\"contryCode\":\"966\"},{\"contryName\":\"圣彼埃尔和密克隆岛\",\"contryCode\":\"508\"},{\"contryName\":\"圣多美和普林西比\",\"contryCode\":\"239\"},{\"contryName\":\"圣基茨和尼维斯\",\"contryCode\":\"1869\"},{\"contryName\":\"圣露西亚\",\"contryCode\":\"1758\"},{\"contryName\":\"圣马力诺\",\"contryCode\":\"378\"},{\"contryName\":\"圣文森特和格林纳丁斯\",\"contryCode\":\"1784\"},{\"contryName\":\"斯里兰卡\",\"contryCode\":\"94\"},{\"contryName\":\"斯洛伐克\",\"contryCode\":\"421\"},{\"contryName\":\"斯洛文尼亚\",\"contryCode\":\"386\"},{\"contryName\":\"斯威士兰\",\"contryCode\":\"268\"},{\"contryName\":\"苏丹\",\"contryCode\":\"249\"},{\"contryName\":\"苏里南\",\"contryCode\":\"597\"},{\"contryName\":\"所罗门群岛\",\"contryCode\":\"677\"},{\"contryName\":\"索马里\",\"contryCode\":\"252\"},{\"contryName\":\"塔吉克斯坦\",\"contryCode\":\"992\"},{\"contryName\":\"泰国\",\"contryCode\":\"66\"},{\"contryName\":\"坦桑尼亚\",\"contryCode\":\"255\"},{\"contryName\":\"汤加\",\"contryCode\":\"676\"},{\"contryName\":\"特克斯和凯科斯群岛\",\"contryCode\":\"1649\"},{\"contryName\":\"特立尼达和多巴哥\",\"contryCode\":\"1868\"},{\"contryName\":\"突尼斯\",\"contryCode\":\"216\"},{\"contryName\":\"土耳其\",\"contryCode\":\"90\"},{\"contryName\":\"土库曼斯坦\",\"contryCode\":\"993\"},{\"contryName\":\"瓦努阿图\",\"contryCode\":\"678\"},{\"contryName\":\"委内瑞拉\",\"contryCode\":\"58\"},{\"contryName\":\"文莱\",\"contryCode\":\"673\"},{\"contryName\":\"乌干达\",\"contryCode\":\"256\"},{\"contryName\":\"乌克兰\",\"contryCode\":\"380\"},{\"contryName\":\"乌拉圭\",\"contryCode\":\"598\"},{\"contryName\":\"乌兹别克斯坦\",\"contryCode\":\"998\"},{\"contryName\":\"西班牙\",\"contryCode\":\"34\"},{\"contryName\":\"希腊\",\"contryCode\":\"30\"},{\"contryName\":\"象牙海岸\",\"contryCode\":\"225\"},{\"contryName\":\"新加坡\",\"contryCode\":\"65\"},{\"contryName\":\"新喀里多尼亚\",\"contryCode\":\"687\"},{\"contryName\":\"新西兰\",\"contryCode\":\"64\"},{\"contryName\":\"匈牙利\",\"contryCode\":\"36\"},{\"contryName\":\"叙利亚\",\"contryCode\":\"963\"},{\"contryName\":\"牙买加\",\"contryCode\":\"1876\"},{\"contryName\":\"亚美尼亚\",\"contryCode\":\"374\"},{\"contryName\":\"也门\",\"contryCode\":\"967\"},{\"contryName\":\"伊拉克\",\"contryCode\":\"964\"},{\"contryName\":\"伊朗\",\"contryCode\":\"98\"},{\"contryName\":\"以色列\",\"contryCode\":\"972\"},{\"contryName\":\"意大利\",\"contryCode\":\"39\"},{\"contryName\":\"印度\",\"contryCode\":\"91\"},{\"contryName\":\"印度尼西亚\",\"contryCode\":\"62\"},{\"contryName\":\"英国\",\"contryCode\":\"44\"},{\"contryName\":\"英属处女群岛\",\"contryCode\":\"1284\"},{\"contryName\":\"约旦\",\"contryCode\":\"962\"},{\"contryName\":\"越南\",\"contryCode\":\"84\"},{\"contryName\":\"赞比亚\",\"contryCode\":\"260\"},{\"contryName\":\"乍得\",\"contryCode\":\"235\"},{\"contryName\":\"直布罗陀\",\"contryCode\":\"350\"},{\"contryName\":\"智利\",\"contryCode\":\"56\"},{\"contryName\":\"中非共和国\",\"contryCode\":\"236\"},{\"contryName\":\"中国(澳门)\",\"contryCode\":\"853\"},{\"contryName\":\"中国(台湾)\",\"contryCode\":\"886\"},{\"contryName\":\"中国(香港)\",\"contryCode\":\"852\"},{\"contryName\":\"中国\",\"contryCode\":\"86\"}]";
37   -
38   - Gson gson = new Gson();
39   - Type type = new TypeToken<List<CountryData>>() {
40   - }.getType();
41   - List<CountryData> countryDataList = gson.fromJson(country, type);
42   - countryDataList.size();
43   - //处理数据 设置Letter
44   - for (CountryData countryData : countryDataList) {
45   - countryData.setLetterContent(countryData.getContryName());
46   - }
47   - //处理数据
48   - String letter = "";
49   - List<CountryData> newList = new ArrayList<>();
50   - for (CountryData data : countryDataList) {
51   - if (!letter.equals(data.getLetter().substring(0, 1))) {
52   - letter = data.getLetter().substring(0, 1);
53   - CountryData newBean = new CountryData();
54   - newBean.setLetter(letter);
55   - newBean.setType(CountryData.TYPE_CATGORY);
56   - newList.add(newBean);
57   - countryActivity.contactLetterGuideMap.put(letter, newList.size());
58   - }
59   -
60   - data.setType(CountryData.TYPE_COUNTRY);
61   - newList.add(data);
62   - if (countryCode.equals(data.getContryCode())){
63   - data.setSelect(true);
64   - countryActivity.fistPosition=newList.indexOf(data);
65   - }else {
66   - data.setSelect(false);
67   - }
68   - }
69   - if (emitter != null && newList != null) {
70   - emitter.onNext(newList);
71   - }
72   - }
73   - }).subscribeOn(Schedulers.io())
74   - .observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<List<CountryData>>() {
75   - @Override
76   - public void onSubscribe(Disposable d) {
77   -
78   - }
79   -
80   - @Override
81   - public void onNext(List<CountryData> countryData) {
82   - if (getView()!=null)getView().showView(countryData);
83   - }
84   -
85   - @Override
86   - public void onError(Throwable e) {
87   -
88   - }
89   -
90   - @Override
91   - public void onComplete() {
92   -
93   - }
94   - });
95   - }
96   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/view/BindPhoneNumberView.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame.view;
2   -
3   -import android.content.Intent;
4   -import android.net.Uri;
5   -import android.text.Spannable;
6   -import android.text.SpannableStringBuilder;
7   -import android.text.TextPaint;
8   -import android.text.TextUtils;
9   -import android.text.method.LinkMovementMethod;
10   -import android.text.style.ClickableSpan;
11   -import android.text.style.ForegroundColorSpan;
12   -import android.util.Log;
13   -import android.view.View;
14   -
15   -import com.alibaba.android.arouter.launcher.ARouter;
16   -import com.cnlive.libs.base.util.AlertUtil;
17   -import com.cnlive.libs.base.util.DoublePressed;
18   -import com.cnlive.libs.base.util.StatusBarUtil;
19   -import com.cnlive.libs.base.util.StatusBarUtil2;
20   -import com.cnlive.strike.moudle.user.model.LoginSuccessInfo;
21   -import com.cnlive.strike.moudle.user.model.msg.UserEventMsg;
22   -import com.cnlive.strike.moudle.user.ui.activity.BindPhoneNumberActivity;
23   -import com.cnlive.strike.moudle.user.ui.activity.FirstLoginActivity;
24   -import com.cnlive.strike.moudle.user.ui.activity.LoginActivity;
25   -import com.cnlive.strike.moudle.user.ui.activity.MainTestActivity;
26   -import com.cnlive.strike.moudle_user.R;
27   -import com.cnlive.strike.myinterfacce.IUSERAPI;
28   -import com.cnlive.strike.myinterfacce.IUserLoginFactory;
29   -import com.cnlive.strike.router.user.UserAction;
30   -import com.hannesdorfmann.mosby3.mvp.MvpView;
31   -import com.qmuiteam.qmui.widget.QMUITopBar;
32   -
33   -import org.greenrobot.eventbus.EventBus;
34   -
35   -/**
36   - * 作者: 吴奎庆
37   - * <p>
38   - * 时间: 2019/9/9
39   - * <p>
40   - * 简介:
41   - */
42   -public class BindPhoneNumberView implements MvpView {
43   - BindPhoneNumberActivity mActivity;
44   - private IUSERAPI userApi;
45   -
46   - public BindPhoneNumberView(BindPhoneNumberActivity activity) {
47   - mActivity = activity;
48   - userApi = IUserLoginFactory.createWXAPI(activity);
49   - }
50   -
51   - String al = "确定后,此%s将与网家家账号绑定";
52   -
53   - public void initView() {
54   - StatusBarUtil.setStatusBarWrite(mActivity);
55   - StatusBarUtil2.setColor(mActivity, mActivity.getResources().getColor(R.color.color_fff), 0);
56   - QMUITopBar toolbar = (QMUITopBar) mActivity.binding.includeToolbar;
57   - toolbar.setTitle("绑定手机号");
58   - toolbar.setBackgroundColor(mActivity.getResources().getColor(R.color.white));
59   - toolbar.addLeftImageButton(R.drawable.back_black, R.id.qmui_topbar_item_left_back).setOnClickListener(new View.OnClickListener() {
60   - @Override
61   - public void onClick(View v) {
62   - mActivity.finish();
63   - }
64   - });
65   - switch (mActivity.otherUserInfo.getLoginType()) {
66   -
67   - case "1":
68   - //sina
69   - mActivity.binding.ivThree.setBackgroundResource(R.drawable.iv_bind_wb);
70   - mActivity.binding.tvThree.setText("微博");
71   -
72   - String weibos = String.format(al, "微博账号");
73   - mActivity.binding.tvBind.setText(weibos);
74   -
75   -// 微博账号
76   - break;
77   - case "2":
78   - //qq
79   - mActivity.binding.ivThree.setBackgroundResource(R.drawable.iv_bind_qq);
80   - mActivity.binding.tvThree.setText("QQ");
81   - String qqs = String.format(al, "QQ账号");
82   - mActivity.binding.tvBind.setText(qqs);
83   - break;
84   - case "3":
85   - //wechat
86   - mActivity.binding.ivThree.setBackgroundResource(R.drawable.iv_bind_wechat);
87   - mActivity.binding.tvThree.setText("微信");
88   -
89   - String wechats = String.format(al, "微信账号");
90   - mActivity.binding.tvBind.setText(wechats);
91   - break;
92   -
93   - }
94   - String textContent = "已阅读并同意《账户绑定确认书(网家家)》";
95   - SpannableStringBuilder ssb = new SpannableStringBuilder(textContent);
96   - ssb.setSpan(new ClickableSpan() {
97   - @Override
98   - public void onClick(View widget) {
99   - if (mActivity != null && DoublePressed.onDoublePressed()) {
100   - startWebView("sfdlxy");
101   - }
102   - }
103   -
104   - @Override
105   - public void updateDrawState(TextPaint ds) {
106   - ds.setUnderlineText(false);
107   - }
108   - }, 7, 19, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
109   -
110   - ssb.setSpan(new ForegroundColorSpan(mActivity.getResources().getColor(R.color.color_23d41e)), 7, 19, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
111   - mActivity.binding.tvAgreement.setMovementMethod(LinkMovementMethod.getInstance());
112   - mActivity.binding.tvAgreement.setText(ssb);
113   - mActivity.binding.tvVc.setOnClickListener(mActivity);
114   - mActivity.binding.llCountry.setOnClickListener(mActivity);
115   - mActivity.binding.login.setOnClickListener(mActivity);
116   - mActivity.binding.tvCountry.setText("+ " + mActivity.countryCode);
117   - mActivity.binding.tvCountryName.setText(mActivity.countryName);
118   - }
119   -
120   - private void startWebView(String type) {
121   - Log.e("csc", "startWebView: ");
122   -// WWebView wWebView = new WWebView.Builder()
123   -// .urlType(type)
124   -// .isOther(true)
125   -// .enableTitle(false)
126   -// .enableJump(true)
127   -// .enableRefresh(false)
128   -// .enableImageLongClick(false)
129   -// .builder();
130   -// wWebView.startWebViewActivity(mActivity);
131   -
132   - ARouter.getInstance().build("/web/WebViewActivity")
133   - .withString("rUrlType", type)
134   - .withBoolean("rIsOther", true)
135   - .withBoolean("rEnableTitle", false)
136   - .withBoolean("rEnableJump", true)
137   - .withBoolean("rEnableRefresh", false)
138   - .withBoolean("rEnableImageLongClick", false)
139   - .navigation(mActivity);
140   - }
141   -
142   -
143   - public void showMessage(String message) {
144   - if (mActivity == null || TextUtils.isEmpty(message)) return;
145   - AlertUtil.showDeftToast(mActivity, message);
146   - }
147   -
148   - public void onTimerFinish() {
149   - mActivity.binding.tvVc.setText("获取验证码");
150   - mActivity.binding.tvVc.setTextColor(mActivity.getResources().getColor(R.color.color_23d41e));
151   - }
152   -
153   - private static final String time_format = "已发送 | %ss";
154   -
155   - public void onTimerInterval(long l) {
156   - String text = String.format(time_format, (int) l);
157   - mActivity.binding.tvVc.setText(text);
158   - mActivity.binding.tvVc.setTextColor(mActivity.getResources().getColor(R.color.color_999));
159   - }
160   -
161   - public void showEditView() {
162   - if (mActivity == null) return;
163   - Intent intent = new Intent(mActivity, FirstLoginActivity.class);
164   - intent.putExtra(mActivity.TAG_CLICK_AD, mActivity.clickAd);
165   - intent.putExtra(LoginActivity.TAG_MSG, TextUtils.isEmpty(mActivity.tagMsg) ? "" : mActivity.tagMsg);
166   - mActivity.startActivity(intent);
167   - mActivity.finish();
168   - }
169   -
170   - public void showMainView() {
171   - if (mActivity == null) return;
172   - //判断如果是因为token为空跳转到的登录页面则不需要跳转到MainActivity,直接关闭登录页面即可
173   - if (mActivity.fromTokenError) {
174   - mActivity.finish();
175   - return;
176   - }
177   - Uri uri = UserAction.getUri(mActivity);
178   -
179   - //设置跳转信息
180   - LoginSuccessInfo successInfo = new LoginSuccessInfo();
181   - successInfo.setType("login");
182   - successInfo.setUri(uri);
183   - successInfo.setClickAd(mActivity.clickAd);
184   - successInfo.setTagShare(mActivity.tagShare);
185   - successInfo.setTagMsg(mActivity.tagMsg);
186   - EventBus.getDefault().post(new UserEventMsg(UserEventMsg.LOGIN_SUCCESS, successInfo));
187   -
188   - if (null != userApi) {
189   - userApi.showMainView(successInfo);
190   - }
191   - Intent intent = new Intent(mActivity, MainTestActivity.class);
192   - intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
193   - intent.putExtra("type", "login");
194   - intent.putExtra("uri", uri);
195   - intent.putExtra("sharetype", mActivity.tagShare);
196   - intent.putExtra(mActivity.TAG_CLICK_AD, mActivity.clickAd);
197   - if (!TextUtils.isEmpty(mActivity.tagMsg))
198   - intent.putExtra("classifyTagMsg", mActivity.tagMsg);
199   - mActivity.startActivity(intent);
200   - }
201   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/view/FirstLoginView.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame.view;
2   -
3   -import android.app.Activity;
4   -import android.content.Context;
5   -import android.content.Intent;
6   -import android.text.TextUtils;
7   -
8   -import com.cnlive.core.user.R;
9   -import com.cnlive.libs.base.util.AlertUtil;
10   -import com.cnlive.libs.base.util.GlideUtil;
11   -import com.cnlive.strike.moudle.mian.ui.widget.TokenErrorDialog;
12   -import com.cnlive.strike.moudle.user.frame.IFirstLoginView;
13   -import com.cnlive.strike.moudle.user.model.LoginSuccessInfo;
14   -import com.cnlive.strike.moudle.user.model.msg.UserEventMsg;
15   -import com.cnlive.strike.moudle.user.ui.activity.FirstLoginActivity;
16   -import com.cnlive.strike.moudle.user.ui.activity.MainTestActivity;
17   -import com.cnlive.strike.moudle.user.ui.fragment.FirstLoginFragment;
18   -
19   -import org.greenrobot.eventbus.EventBus;
20   -
21   -/**
22   - * Created by xiansong on 2018/1/19.
23   - */
24   -
25   -public class FirstLoginView implements IFirstLoginView {
26   - private FirstLoginFragment fragment;
27   -
28   - public FirstLoginView(FirstLoginFragment fragment) {
29   - this.fragment = fragment;
30   - }
31   -
32   - private Activity getContext() {
33   - return fragment.getActivity();
34   - }
35   -
36   - public void showToast(String msg) {
37   - if (getContext() == null) return;
38   - Context context = getContext();
39   - AlertUtil.showDeftToast(context, msg);
40   - }
41   -
42   - public void showProgress(int stringId) {
43   - if (!fragment.mProgressDialog.isShowing()) {
44   - String tag = getContext().getString(stringId);
45   - fragment.mProgressDialog.setMessage(tag);
46   - fragment.mProgressDialog.show();
47   - }
48   - }
49   -
50   - public void hideProgress() {
51   - if (fragment.mProgressDialog.isShowing()) fragment.mProgressDialog.dismiss();
52   - }
53   -
54   - public void photoChange(String faceUrl) {
55   - if (getContext() == null) return;
56   - GlideUtil.init(fragment, faceUrl).error(R.drawable.touxiang_circle).circleCrop().into(fragment.binding.ivUserIcon);
57   - }
58   -
59   - public void showMainPage() {
60   - if (getContext() == null) return;
61   - //设置跳转信息
62   - LoginSuccessInfo successInfo = new LoginSuccessInfo();
63   - successInfo.setClickAd(fragment.clickAd);
64   - successInfo.setTagMsg(fragment.tagMsg);
65   - EventBus.getDefault().post(new UserEventMsg(UserEventMsg.LOGIN_SUCCESS, successInfo));
66   -
67   -
68   -
69   - Intent intent = new Intent(getContext(), MainTestActivity.class);
70   - if (!TextUtils.isEmpty(fragment.tagMsg))
71   - intent.putExtra("classifyTagMsg", fragment.tagMsg);
72   -
73   - intent.putExtra(FirstLoginActivity.TAG_CLICK_AD, fragment.clickAd);
74   - getContext().startActivity(intent);
75   - getContext().finish();
76   - }
77   -
78   - public void showTokenErrorDialog() {
79   - if (fragment.tokenErrorDialog != null)
80   - fragment.tokenErrorDialog.dismiss();
81   - fragment.tokenErrorDialog = TokenErrorDialog.showTokenErrorDialog(fragment.getActivity());
82   - }
83   -
84   -
85   -}
cloud/user/src/main/java/com/cnlive/strike/moudle/user/frame/view/PersonalDataView.java deleted 100644 → 0
1   -package com.cnlive.strike.moudle.user.frame.view;
2   -
3   -import android.text.TextUtils;
4   -
5   -import com.bumptech.glide.Priority;
6   -import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
7   -import com.bumptech.glide.request.RequestOptions;
8   -import com.cnlive.core.user.R;
9   -import com.cnlive.libs.base.util.AlertUtil;
10   -import com.cnlive.libs.base.util.GlideUtil;
11   -import com.cnlive.strike.moudle.mian.ui.widget.TokenErrorDialog;
12   -import com.cnlive.strike.moudle.user.ui.activity.PersonalDataActivity;
13   -import com.cnlive.strike.user.auth.UserService;
14   -import com.cnlive.strike.user.model.CNLiveUserInfo;
15   -import com.hannesdorfmann.mosby3.mvp.MvpView;
16   -
17   -import static com.bumptech.glide.request.RequestOptions.bitmapTransform;
18   -
19   -/**
20   - * 创建:wukuiqing
21   - * <p>
22   - * 时间:2018/3/22
23   - * <p>
24   - * 描述:
25   - */
26   -public class PersonalDataView implements MvpView {
27   - PersonalDataActivity activity;
28   -
29   - public PersonalDataView(PersonalDataActivity activity) {
30   - this.activity = activity;
31   - }
32   -
33   - public void setView(UserService userService) {
34   - CNLiveUserInfo info = userService == null ? null : userService.getAppAccount();
35   - if (info == null) return;
36   - activity.binding.tvName.setText(info.getNickName());
37   - if ("m".equals(info.getGender())) {
38   - activity.binding.tvSex.setText("男");
39   - } else if ("f".equals(info.getGender())) {
40   - activity.binding.tvSex.setText("女");
41   - } else {
42   - activity.binding.tvSex.setText("男");
43   - }
44   -
45   - String location = info.getLocation();
46   - activity.binding.tvWhere.setText(TextUtils.isEmpty(location) ? "中国" : location);
47   -
48   - RequestOptions options = bitmapTransform(new RoundedCorners(10))
49   - .placeholder(R.drawable.touxiang_round)
50   - .error(R.drawable.touxiang_round)
51   - .priority(Priority.HIGH);
52   - if (TextUtils.isEmpty(info.getFaceUrl())) {
53   - GlideUtil.into(activity.binding.ivIcon, "http://wjj.ys1.cnliveimg.com/admin/test/head.png", options);
54   - } else {
55   - GlideUtil.into(activity.binding.ivIcon, info.getFaceUrl(), options);
56   - }
57   -
58   - if (!TextUtils.isEmpty(info.getUserSign())) {
59   - activity.binding.tvAutograph.setText(info.getUserSign());
60   - }
61   - }
62   -
63   - public void upDataSex(String value) {
64   - if ("m".equals(value)) {
65   - activity.binding.tvSex.setText("男");
66   - } else if ("f".equals(value)) {
67   - activity.binding.tvSex.setText("女");
68   - } else {
69   - activity.binding.tvSex.setText("其他");
70   - }
71   - }
72   -
73   - public void upDataNickName(String value) {
74   - activity.binding.tvName.setText(value);
75   - }
76   -
77   - public void upDataLocation(String value) {
78   - activity.binding.tvWhere.setText(value);
79   - }
80   -
81   - public void upSignature(String value) {
82   - activity.binding.tvAutograph.setText(value);
83   - }
84   -
85   - public void showMessage(String s) {
86   - if (activity == null) return;
87   -
88   - AlertUtil.showDeftToast(activity, s);
89   - }
90   -
91   - public void showTokenErrorDialog() {
92   - if (activity.tokenErrorDialog != null)
93   - activity.tokenErrorDialog.dismiss();
94   - activity.tokenErrorDialog = TokenErrorDialog.showTokenErrorDialog(activity);
95   - }
96   -
97   -
98   -}