Compare commits
345 Commits
6.4.4
...
DRPK_6.4.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
503fb0d7f1 | ||
|
|
6b0500b5ff | ||
| ae8c6cc23d | |||
| ad028c69d0 | |||
| 03b3398bce | |||
| 4a84283000 | |||
| c49c560e8d | |||
| 8d3ac7761f | |||
| a1d9b1f75b | |||
|
|
afed0c8833 | ||
| 415ed2fc9b | |||
| 8e45e17768 | |||
|
|
576a30d1be | ||
|
|
e380c8dcbc | ||
| 5e9f23286e | |||
| 1bbc78fb32 | |||
| b56368412c | |||
| 4ad75a11a8 | |||
| 3fa259c5b9 | |||
|
|
4cd4939c58 | ||
| 9eff246f06 | |||
| 285a33ff9a | |||
|
|
7ebd935eba | ||
| f62a093092 | |||
| 28b4a36800 | |||
| ec59fce097 | |||
| e134ef8d54 | |||
| 29ddc68870 | |||
| 9ead9a6fb8 | |||
| 2a2672587c | |||
| 98122c25d8 | |||
| 84c89d7530 | |||
| 4268816539 | |||
| 721172d48a | |||
| 3e7942dbd4 | |||
| 17d18eff98 | |||
| 0d422177ac | |||
| 6336eab32a | |||
| f91a3f3fc1 | |||
| a489a6d00d | |||
| 8d8cff8d1b | |||
|
|
5f487f74bd | ||
| 857206e3da | |||
|
|
4ebe56913a | ||
|
|
efcc2591c2 | ||
|
|
455b330b7d | ||
|
|
ed2879e263 | ||
| 3b1c5ac1ec | |||
|
|
d243ffb380 | ||
| 6bdd81038b | |||
| 1eff58aca1 | |||
|
|
fa6eda5936 | ||
|
|
72f7e00dd5 | ||
| 707e083684 | |||
| 8b4f88c766 | |||
|
|
ae3ac93248 | ||
|
|
f43ccea32a | ||
|
|
73684b9962 | ||
|
|
80a1508dfc | ||
| 0b1393615c | |||
|
|
4481b102ef | ||
| cab59a5f4a | |||
| 9f6cd3fd6f | |||
|
|
4c5730d3bf | ||
|
|
1222aa9819 | ||
|
|
e58915edb6 | ||
|
|
4d4c251ebd | ||
|
|
6a416aaba1 | ||
| bbb25cde50 | |||
| 210749ebd3 | |||
| 637fedcbe6 | |||
|
|
70b05b85d7 | ||
| 9a1cefdb70 | |||
| 6ca8fb0c29 | |||
|
|
8e7de87c6b | ||
| cb55c09624 | |||
|
|
a41a58dc26 | ||
| f257c2b5a9 | |||
|
|
f5bd17f832 | ||
| 1b7296c13b | |||
| a965a83653 | |||
|
|
5cc521d93c | ||
| 6f2a893a4e | |||
| 1548b6f252 | |||
|
|
0c6b62ed1a | ||
|
|
1fcb3d312c | ||
| 35b24c261e | |||
| e5c5a2e5f5 | |||
| 9934d53390 | |||
| 030fdb6ad0 | |||
|
|
cf4948a3e2 | ||
| afd4cb6e41 | |||
| 596c9f9962 | |||
| 020bbf322d | |||
| 05b1a9bc74 | |||
| 7f001ba887 | |||
|
|
744de267dd | ||
|
|
af26dc24c7 | ||
|
|
e9fa533e5a | ||
| 3bd4301cda | |||
| 23be58c4e8 | |||
| 718d4a5d2f | |||
| 733678532a | |||
| 6fb29bbf60 | |||
| ecbfa57276 | |||
| fc59a6f182 | |||
| 83039d7b29 | |||
|
|
e405965298 | ||
|
|
e6766dc5eb | ||
| fe027e53db | |||
|
|
546d9b5728 | ||
| 7008ccc505 | |||
| 1fc8977f99 | |||
| 4acba02c6a | |||
|
|
491427feba | ||
|
|
249d251708 | ||
|
|
96eee88c82 | ||
|
|
7005895d90 | ||
|
|
3bdee09402 | ||
| 2843131151 | |||
| a8d4d64174 | |||
| 1853acd5eb | |||
|
|
03a4054ee5 | ||
| fe66792935 | |||
|
|
082c9d7d12 | ||
| e35eb5ac7f | |||
|
|
5e631652a9 | ||
| 4eb9adad78 | |||
| 4a9a8c3ec3 | |||
|
|
450047aae2 | ||
| eb65c0e101 | |||
| 6bd29ec63e | |||
| f0231be306 | |||
| b12547cd88 | |||
| ed6b531b8d | |||
| 47b9487e13 | |||
| ec40f8fa0d | |||
| 86a0a19fec | |||
| e0b69be2d4 | |||
| a2ad006a7e | |||
| 9b17c1225a | |||
|
|
32881d3f35 | ||
| e8367b8f1a | |||
| fc1bada607 | |||
| 1eca5b0309 | |||
| 08906e028a | |||
|
|
6e36e15ef3 | ||
| d71fe7d92e | |||
| 72ca2b7b04 | |||
| 5768ff5518 | |||
| 8a03b194b2 | |||
| 0d18a135ec | |||
| 91fdef55c7 | |||
|
|
4d437be248 | ||
| d42835231e | |||
| 3d117dbcb4 | |||
| 202aedbcf3 | |||
|
|
14a4bc4343 | ||
|
|
011322dd8e | ||
|
|
0d219e4b6d | ||
|
|
1972144384 | ||
|
|
08e7e6b461 | ||
| dbba33f085 | |||
| 4a637d0a69 | |||
|
|
a9d323354b | ||
|
|
4cd1c22d01 | ||
|
|
55ff7a1649 | ||
|
|
3deb3693b3 | ||
| 009efc2c86 | |||
| 40b37b49f9 | |||
| a3ad9a17c7 | |||
|
|
2c13c3dce1 | ||
|
|
859d884941 | ||
| 4a28abf5b7 | |||
| 527bb0f1d9 | |||
| 0429e7ca36 | |||
|
|
e8f13d7590 | ||
| 7eb3e567f6 | |||
| 17ec4753b6 | |||
| 2371ef1dee | |||
| c99d139940 | |||
| e0a2f7c798 | |||
| a12524dc9c | |||
|
|
c08cf6ea57 | ||
| 20746185e0 | |||
| 54cf0e213f | |||
|
|
6654fe0434 | ||
| 324917672c | |||
| d0a373123a | |||
| 86b7ad6d92 | |||
| c949667b94 | |||
| a61a41a068 | |||
| 06d241c66c | |||
| 62ed0ae78e | |||
| 1ee335abf2 | |||
|
|
05ee59618b | ||
|
|
fffa7cdabd | ||
| b8ec25c94e | |||
| 38029f7268 | |||
| d2fdccadf2 | |||
|
|
b1d06a4f1a | ||
|
|
ecf3a94b64 | ||
|
|
99b9af2980 | ||
|
|
267d07f3a5 | ||
| 977bfa910c | |||
| fe3c9c1563 | |||
|
|
8c11818b49 | ||
| ee0d8dd1a0 | |||
|
|
1d50f8e4f5 | ||
| e8f9884365 | |||
| 38f6f2f451 | |||
| a664ff7464 | |||
| a4ab6df974 | |||
| dc8f32062c | |||
| 0a090301df | |||
| d53d250e6f | |||
|
|
897a47bee7 | ||
| 0f457efce6 | |||
| 7842c1b838 | |||
| 02a5ceaacc | |||
| 6b1c223acd | |||
|
|
09a9e023d3 | ||
| 9b37374066 | |||
| 45257e8fe1 | |||
|
|
85971339d4 | ||
|
|
383e8c0859 | ||
| 749ac197de | |||
| d20210f291 | |||
|
|
da3398f1f9 | ||
| 81763110d7 | |||
| 6ac610e1aa | |||
|
|
362cc3814e | ||
| 37dfa05a25 | |||
|
|
2df205218c | ||
|
|
cceb697739 | ||
| 7d63869d44 | |||
| 3b1cecf8a3 | |||
| e52ec4a2b8 | |||
|
|
ed300eec30 | ||
| 8455c360fc | |||
| 059bfaf1d9 | |||
|
|
9f0b6897f1 | ||
| 2119d75e5b | |||
| af39c4bac0 | |||
| 93ac837148 | |||
| c4f3d10419 | |||
| 3f9cf21b8f | |||
| e9a8a4dc02 | |||
|
|
84f352a7fb | ||
| 834170e272 | |||
| 042f53e134 | |||
| 0b041bad7b | |||
| fe124dad0c | |||
|
|
7fe7178b27 | ||
|
|
9dcc23960e | ||
|
|
140e5740e6 | ||
|
|
752fae680c | ||
| e2f8e52583 | |||
| 4d573767f7 | |||
| 56475e729c | |||
| 8f0a1a09a6 | |||
|
|
c6b8b61b1e | ||
| 862295ff03 | |||
|
|
d13e42e33d | ||
| 134cdf2e2a | |||
| 44a05ea0d5 | |||
| 7f34c50b71 | |||
|
|
77682d310a | ||
| 2b0846f939 | |||
|
|
0b6c188e0a | ||
| f51f440b43 | |||
|
|
f74a01efc0 | ||
| 6dafa64e0b | |||
|
|
60453c756c | ||
|
|
350f17915a | ||
| ffcb847b02 | |||
| 8eae2c29ae | |||
|
|
5e55a5b94c | ||
| 1eee54fef1 | |||
| 24f691d4b8 | |||
| 1fc417ec25 | |||
| 71713e5b37 | |||
|
|
ef4c377990 | ||
| 88e27df986 | |||
| 628d9c7a1b | |||
|
|
7836c57479 | ||
|
|
939675fe58 | ||
| 5ed5b15737 | |||
| 783685942c | |||
| 30c09b0e26 | |||
| 96f21643b4 | |||
| 977067eda5 | |||
| 3e7279b4de | |||
| 34dd3ca883 | |||
|
|
d0d36ef207 | ||
| a66a32038c | |||
| 80d5bf3007 | |||
| cb39253785 | |||
| 3ec3350c97 | |||
| 7a01f62490 | |||
| 4a6bb9fd56 | |||
| 40532a0972 | |||
|
|
e059d9bbb2 | ||
| ab953b4785 | |||
|
|
6e38ef2962 | ||
|
|
6656aebff9 | ||
| 50b598d8a1 | |||
| cf08f8197b | |||
| 62f1912a7a | |||
| eae7f3d1a0 | |||
| b3e9836d7c | |||
| c3c91ba9a2 | |||
|
|
1075f7252a | ||
| 302435c068 | |||
| 41fb743bda | |||
|
|
823075c0ad | ||
|
|
c57486b69c | ||
| 8b3b0ce2ea | |||
| e3f9f21287 | |||
| b10d9ada46 | |||
| b48ceea571 | |||
|
|
0f2fbeb114 | ||
| 1623743b26 | |||
| 703f542abf | |||
| a2de293e10 | |||
|
|
a50abb5b2c | ||
|
|
2102acd9e5 | ||
|
|
b8ee197e52 | ||
|
|
ba81a46e2f | ||
|
|
6841f47ac3 | ||
| a2fef0990a | |||
| 9e411ecd71 | |||
| 8d14c06284 | |||
| 8b3f8d783e | |||
| b5ebc085b4 | |||
| 7e169e882d | |||
| 50f83939cc | |||
| f856188a68 | |||
| 7e9b794c7f | |||
|
|
e70a5e09f6 | ||
| 3e8db9ec7e | |||
| 34f70bb4cd | |||
|
|
12f78dc3b8 | ||
| 89a54276b3 | |||
| 73fb523ddc |
@@ -71,7 +71,7 @@ public class FaceManager implements SensorEventListener {
|
||||
* 配置美颜SDK
|
||||
*/
|
||||
public void initFURender(Context context) {
|
||||
|
||||
initFaceUnity(context);
|
||||
mFURenderer = FURenderer.getInstance();
|
||||
mFURenderer.setInputTextureType(FUInputTextureEnum.FU_ADM_FLAG_COMMON_TEXTURE);
|
||||
mFURenderer.setCameraFacing(CameraFacingEnum.CAMERA_FRONT);
|
||||
@@ -105,9 +105,11 @@ public class FaceManager implements SensorEventListener {
|
||||
}
|
||||
});
|
||||
}
|
||||
public void loadConfig(){
|
||||
|
||||
public void loadConfig() {
|
||||
initFaceBeauty();
|
||||
}
|
||||
|
||||
public void initFaceBeauty() {
|
||||
FaceBeautyDataFactory faceBeautyDataFactory;
|
||||
faceBeautyDataFactory = new FaceBeautyDataFactory();
|
||||
@@ -115,9 +117,13 @@ public class FaceManager implements SensorEventListener {
|
||||
for (String key : configMap.keySet()) {
|
||||
if ("FilterViewHolder_".equals(key)) {
|
||||
for (FaceBeautyFilterBean filter : faceBeautyDataFactory.getBeautyFilters()) {
|
||||
if (filter.getKey().equals(configMap.get(key))&&!"origin".equals(configMap.get(key))) {
|
||||
faceBeautyDataFactory.onFilterSelected(filter.getKey(), Double.parseDouble((String) Objects.requireNonNull(configMap.get("FilterViewHolder_" + configMap.get(key) + "_val")))/100, filter.getDesRes());
|
||||
Log.i(TAG, "test: 设置滤镜 ="+filter.getKey()+" val = "+configMap.get("FilterViewHolder_" + configMap.get(key) + "_val"));
|
||||
if (filter.getKey().equals(configMap.get(key)) && !"origin".equals(configMap.get(key))) {
|
||||
try {
|
||||
faceBeautyDataFactory.onFilterSelected(filter.getKey(), Double.parseDouble((String) Objects.requireNonNull(configMap.get("FilterViewHolder_" + configMap.get(key) + "_val"))) / 100, filter.getDesRes());
|
||||
Log.i(TAG, "test: 设置滤镜 =" + filter.getKey() + " val = " + configMap.get("FilterViewHolder_" + configMap.get(key) + "_val"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -125,17 +131,25 @@ public class FaceManager implements SensorEventListener {
|
||||
String name = key.replace("BeautySkinViewHolder_", "");
|
||||
for (FaceBeautyBean bean : faceBeautyDataFactory.getShapeBeauty()) {
|
||||
if (bean.getKey().equals(name)) {
|
||||
faceBeautyDataFactory.updateParamIntensity(bean.getKey(),Double.parseDouble((String) Objects.requireNonNull(configMap.get(key))));
|
||||
Log.i(TAG, "test: 设置美颜 = "+bean.getKey()+" val = "+configMap.get(key));
|
||||
try {
|
||||
faceBeautyDataFactory.updateParamIntensity(bean.getKey(), Double.parseDouble((String) Objects.requireNonNull(configMap.get(key))));
|
||||
Log.i(TAG, "test: 设置美颜 = " + bean.getKey() + " val = " + configMap.get(key));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else if(key.startsWith("BeautyShapeViewHolder")){
|
||||
} else if (key.startsWith("BeautyShapeViewHolder")) {
|
||||
String name = key.replace("BeautyShapeViewHolder_", "");
|
||||
for (FaceBeautyBean bean : faceBeautyDataFactory.getShapeBeauty()) {
|
||||
if (bean.getKey().equals(name)) {
|
||||
faceBeautyDataFactory.updateParamIntensity(bean.getKey(),Double.parseDouble((String) Objects.requireNonNull(configMap.get(key))));
|
||||
Log.i(TAG, "test: 设置美肤 = "+bean.getKey()+" val = "+configMap.get(key));
|
||||
try {
|
||||
faceBeautyDataFactory.updateParamIntensity(bean.getKey(), Double.parseDouble((String) Objects.requireNonNull(configMap.get(key))));
|
||||
Log.i(TAG, "test: 设置美肤 = " + bean.getKey() + " val = " + configMap.get(key));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -277,6 +291,7 @@ public class FaceManager implements SensorEventListener {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
isInit = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -80,11 +80,11 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter<BaseViewHolde
|
||||
}
|
||||
|
||||
public void hideSeekBar() {
|
||||
if (seekBar.getVisibility() == View.GONE) {
|
||||
if (seekBar.getVisibility() == View.INVISIBLE) {
|
||||
return;
|
||||
}
|
||||
seekBar.setOnProgressChangeListener(null);
|
||||
seekBar.setVisibility(View.GONE);
|
||||
seekBar.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="colorPrimary">#FF8D41</color>
|
||||
<color name="colorPrimaryDark">#FF8D41</color>
|
||||
<color name="colorAccent">#FF8D41</color>
|
||||
|
||||
<!--fulive demo 主配色-->
|
||||
<color name="primary_background">#050F14</color>
|
||||
|
||||
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
|
||||
apply plugin: 'img-optimizer'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
android {
|
||||
dexOptions {
|
||||
jumboMode = true
|
||||
@@ -230,6 +230,7 @@ dependencies {
|
||||
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
|
||||
|
||||
// implementation rootProject.ext.dependencies["leakcanary"]
|
||||
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -78,10 +78,10 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
<uses-permission android:name="com.android.vending.BILLING" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
|
||||
<!-- Android11新增 -->
|
||||
<!-- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />-->
|
||||
|
||||
<!-- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />-->
|
||||
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
|
||||
<application
|
||||
android:name="com.shayu.phonelive.AppContext"
|
||||
android:allowBackup="true"
|
||||
|
||||
@@ -17,10 +17,6 @@ import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.adjust.sdk.AdjustConfig;
|
||||
import com.adjust.sdk.AdjustEvent;
|
||||
import com.adjust.sdk.LogLevel;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.Utils;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
@@ -28,6 +24,7 @@ import com.fm.openinstall.OpenInstall;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.shayu.phonelive.utils.LogUtils;
|
||||
import com.tencent.imsdk.v2.V2TIMGroupMemberInfo;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMSimpleMsgListener;
|
||||
@@ -37,8 +34,6 @@ import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.CrashSaveBean;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.manager.imrongcloud.InstructorSendReward;
|
||||
import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider;
|
||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||
@@ -46,7 +41,6 @@ import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.faceunity.FaceManager;
|
||||
import com.yunbao.live.socket.SocketRyClient;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
import com.yunbao.live.views.PortraitLiveManager;
|
||||
@@ -86,12 +80,10 @@ public class AppContext extends CommonAppContext {
|
||||
private static final class AdjustLifecycleCallbacks implements ActivityLifecycleCallbacks {
|
||||
@Override
|
||||
public void onActivityResumed(Activity activity) {
|
||||
Adjust.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPaused(Activity activity) {
|
||||
Adjust.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,6 +129,7 @@ public class AppContext extends CommonAppContext {
|
||||
CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis());
|
||||
registerError();
|
||||
registerFirebaseCrash();
|
||||
LogUtils.start(this);
|
||||
sInstance = this;
|
||||
L.setDeBug(BuildConfig.DEBUG);
|
||||
AppEventsLogger.activateApp(this);
|
||||
@@ -161,38 +154,8 @@ public class AppContext extends CommonAppContext {
|
||||
OpenInstall.init(this);
|
||||
}
|
||||
|
||||
String environment = AdjustConfig.ENVIRONMENT_PRODUCTION;
|
||||
AdjustConfig config = new AdjustConfig(this, "3om5fbglyqdc", environment);
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
||||
config.setDefaultTracker("xa7k5ut");
|
||||
}
|
||||
Adjust.onCreate(config);
|
||||
|
||||
registerActivityLifecycleCallbacks(new AdjustLifecycleCallbacks());
|
||||
config.setLogLevel(LogLevel.WARN);
|
||||
//激活操作记录
|
||||
AdjustEvent adjustEvent = new AdjustEvent("m7wk0c");
|
||||
Adjust.trackEvent(adjustEvent);
|
||||
|
||||
//谷歌激活
|
||||
mFirebaseAnalytics.logEvent("FS_activation", null);
|
||||
|
||||
//FB激活
|
||||
logger.logEvent("FB_activation");
|
||||
|
||||
AdjustEvent adjustEvent2 = new AdjustEvent("p7igfz");
|
||||
Adjust.trackEvent(adjustEvent2);
|
||||
CommonHttpUtil.setAdvertisingChannels("p7igfz", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
//谷歌激活
|
||||
mFirebaseAnalytics.logEvent("FS_complete_1st_loading", null);
|
||||
//FB激活
|
||||
logger.logEvent("FB_complete_1st_loading");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//初始化 AndroidUtilCode
|
||||
Utils.init(this);
|
||||
liveImDeletUtil = new LiveImDeletUtil();
|
||||
@@ -268,10 +231,11 @@ public class AppContext extends CommonAppContext {
|
||||
mSocketHandler.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
configSPApp();
|
||||
//初始化美颜SDK
|
||||
FaceManager.initFaceUnity(this);
|
||||
// FaceManager.initFaceUnity(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.shayu.phonelive.activity;
|
||||
|
||||
import static com.yunbao.common.CommonAppContext.logger;
|
||||
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -21,9 +19,8 @@ import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.adjust.sdk.AdjustEvent;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -107,14 +104,6 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
EventBus.getDefault().register(this);
|
||||
setStatusBar();
|
||||
setContentView(R.layout.activity_launcher);
|
||||
//开屏
|
||||
AdjustEvent adjustEvent = new AdjustEvent("vjqk8g");
|
||||
Adjust.trackEvent(adjustEvent);
|
||||
|
||||
//谷歌激活
|
||||
mFirebaseAnalytics.logEvent("FS_screen", null);
|
||||
//FB激活
|
||||
logger.logEvent("FB_screen");
|
||||
mContext = this;
|
||||
mRoot = findViewById(R.id.root);
|
||||
mCover = findViewById(R.id.cover);
|
||||
@@ -140,6 +129,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
};
|
||||
mHandler.sendEmptyMessageDelayed(WHAT_GET_CONFIG, 1000);
|
||||
LogUtil.uploadErrorLog(AppContext.sInstance);
|
||||
SpUtil.getInstance().setBooleanValue("NOTIFICATION", NotificationManagerCompat.from(this).areNotificationsEnabled());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@ package com.shayu.phonelive.utils;
|
||||
|
||||
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
@@ -17,6 +20,7 @@ import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
@@ -31,9 +35,12 @@ import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.shayu.phonelive.AppContext;
|
||||
import com.shayu.phonelive.activity.LauncherActivity;
|
||||
import com.yunbao.common.bean.NotificationMsgBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.main.activity.MainActivity;
|
||||
|
||||
import org.json.JSONException;
|
||||
@@ -52,7 +59,7 @@ public class CustomMessageReceiver extends PushMessageReceiver {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||
NotificationManager manager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
|
||||
NotificationChannel channel = new NotificationChannel(channelID, channelNAME, level);
|
||||
channel.setSound(Uri.parse("android.resource://" + context.getPackageName() + "/raw/pdlive_sound"),null);
|
||||
channel.setSound(Uri.parse("android.resource://" + context.getPackageName() + "/raw/pdlive_sound"), null);
|
||||
manager.createNotificationChannel(channel);
|
||||
return channelID;
|
||||
} else {
|
||||
@@ -81,6 +88,23 @@ public class CustomMessageReceiver extends PushMessageReceiver {
|
||||
@Override
|
||||
public boolean onNotificationMessageArrived(Context context, PushType pushType, PushNotificationMessage notificationMessage) {
|
||||
Log.i("gmc", notificationMessage.getPushContent() + "VVV" + notificationMessage.getPushTitle() + "gmc11112222" + notificationMessage.getExtra());
|
||||
if (!SpUtil.getInstance().getBooleanValue("NOTIFICATION")) {
|
||||
Activity activity = AppContext.activityWeakReference.get();
|
||||
if (activity != null) {
|
||||
DialogUitl.showSimpleDialog(activity, "应用需要通知权限", new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
|
||||
intent.putExtra("app_package", context.getPackageName());
|
||||
intent.putExtra("app_uid", context.getApplicationInfo().uid);
|
||||
// for Android 8 and above
|
||||
intent.putExtra("android.provider.extra.APP_PACKAGE", context.getPackageName());
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (notificationMessage.getExtra() == null) {
|
||||
msg.setImg("" + notificationMessage.getSenderPortrait());
|
||||
msg.setTitle(notificationMessage.getPushTitle());
|
||||
@@ -199,7 +223,7 @@ public class CustomMessageReceiver extends PushMessageReceiver {
|
||||
PendingIntent pendingIntent;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
|
||||
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
|
||||
}else {
|
||||
} else {
|
||||
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
String channelId = createNotificationChannel(context, "my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
|
||||
@@ -233,7 +257,7 @@ public class CustomMessageReceiver extends PushMessageReceiver {
|
||||
PendingIntent pendingIntent;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
|
||||
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
|
||||
}else {
|
||||
} else {
|
||||
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
String channelId = createNotificationChannel(context, "my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
|
||||
@@ -276,7 +300,7 @@ public class CustomMessageReceiver extends PushMessageReceiver {
|
||||
PendingIntent pendingIntent;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
|
||||
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
|
||||
}else {
|
||||
} else {
|
||||
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
String channelId = createNotificationChannel(context, "my_channel_ID", "my_channel_NAME", NotificationManager.IMPORTANCE_HIGH);
|
||||
|
||||
89
app/src/main/java/com/shayu/phonelive/utils/LogUtils.java
Normal file
89
app/src/main/java/com/shayu/phonelive/utils/LogUtils.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package com.shayu.phonelive.utils;
|
||||
|
||||
import static java.text.DateFormat.DEFAULT;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
public class LogUtils {
|
||||
/**
|
||||
* 采集所有日志
|
||||
*/
|
||||
public static void start(Context context) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
String[] exec = new String[]{"logcat", "-c"};
|
||||
Runtime.getRuntime().exec(exec).waitFor();
|
||||
|
||||
exec = new String[]{"logcat", "-v", "UTC", "-D"};
|
||||
|
||||
Process process = Runtime.getRuntime().exec(exec);
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
String line;
|
||||
PrintWriter writer = null;
|
||||
String title = "[PDLIVE]" + CommonAppConfig.getInstance().getUid() + "_";
|
||||
String today = title + SimpleDateFormat.getDateInstance(DEFAULT, Locale.CHINA).format(new Date());
|
||||
File dir = new File(context.getDir("files", Context.MODE_PRIVATE).getAbsolutePath() + File.separator);
|
||||
if (dir.listFiles() != null) {
|
||||
for (File file : dir.listFiles()) {
|
||||
if (file.getName().endsWith(".log") && !"error.log".equals(file.getName())) {
|
||||
String fileName = file.getName().replace(".log", "").split("_")[1];
|
||||
if (isDelLog(fileName)) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File saveFile = new File(context.getDir("files", Context.MODE_PRIVATE).getAbsolutePath() + File.separator + today + ".log");
|
||||
FileOutputStream os = new FileOutputStream(saveFile, true);
|
||||
writer = new PrintWriter(os);
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
writer.append(line).write("\n");
|
||||
}
|
||||
writer.flush();
|
||||
writer.close();
|
||||
exec = new String[]{"logcat", "-c"};
|
||||
Runtime.getRuntime().exec(exec).waitFor();
|
||||
bufferedReader.close();
|
||||
start(context);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是要删除的日志
|
||||
**/
|
||||
private static boolean isDelLog(String time) {
|
||||
try {
|
||||
Calendar timeCal = Calendar.getInstance(Locale.CHINA);
|
||||
timeCal.setTime(Objects.requireNonNull(SimpleDateFormat.getDateInstance(DEFAULT, Locale.CHINA).parse(time)));
|
||||
Calendar calendar = Calendar.getInstance(Locale.CHINA);
|
||||
calendar.setTime(new Date());
|
||||
calendar.add(Calendar.DATE, -3);
|
||||
return calendar.after(timeCal);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">PDLIVE</string>
|
||||
<string name="leak_canary_test_class_name">assertk.Assert</string>
|
||||
</resources>
|
||||
@@ -22,6 +22,7 @@ buildscript {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20"
|
||||
classpath 'com.google.gms:google-services:4.3.3'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
|
||||
classpath "com.alibaba:arouter-register:1.0.2"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -147,7 +147,6 @@ dependencies {
|
||||
//谷歌支付
|
||||
//谷歌内购
|
||||
api 'com.android.billingclient:billing:5.0.0'
|
||||
implementation 'com.teprinciple:updateapputils:2.3.0'
|
||||
api 'com.squareup.picasso:picasso:2.5.2'
|
||||
api "com.immomo.cosmos.mediax:beautyutils:2.2.1_01071700"
|
||||
api files('libs/liteavsdk.jar')
|
||||
@@ -155,9 +154,11 @@ dependencies {
|
||||
//腾讯im
|
||||
api 'com.tencent.imsdk:imsdk-plus:5.4.666'
|
||||
api 'com.google.code.gson:gson:2.8.8'
|
||||
api 'cn.rongcloud.sdk:rtc_lib:5.2.5.8' // 音视频通话基础能力库
|
||||
api 'cn.rongcloud.sdk:rtc_lib:5.2.0' // 音视频通话基础能力库
|
||||
//此处以集成 5.1.2 版本为例
|
||||
api 'cn.rongcloud.sdk:im_lib:5.2.0.2'
|
||||
|
||||
//此处以集成 5.1.2 版本为例
|
||||
api 'cn.rongcloud.sdk:im_lib:5.2.5.4' // 即时通讯基础能力库
|
||||
api 'cn.rongcloud.sdk:im_kit:5.2.5.4' // 即时通讯 UI 基础组件
|
||||
//融云小视频模块
|
||||
api 'cn.rongcloud.sdk:sight:5.2.5.4'
|
||||
@@ -168,7 +169,6 @@ dependencies {
|
||||
transitive = true
|
||||
}
|
||||
api 'com.linecorp:linesdk:5.0.1'
|
||||
api 'com.adjust.sdk:adjust-android:4.30.1'
|
||||
api 'com.android.installreferrer:installreferrer:2.2'
|
||||
//Retrofit2库
|
||||
api 'com.squareup.retrofit2:retrofit:2.3.0'
|
||||
@@ -188,4 +188,9 @@ dependencies {
|
||||
api 'com.github.princekin-f:EasyFloat:2.0.4'
|
||||
api files('libs/Msc.jar')
|
||||
|
||||
api 'com.github.li-xiaojun:XPopup:2.9.1'
|
||||
//app-updater
|
||||
api 'com.github.jenly1314.AppUpdater:app-updater:1.1.3'
|
||||
//app-dialog
|
||||
api 'com.github.jenly1314.AppUpdater:app-dialog:1.1.3'
|
||||
}
|
||||
|
||||
@@ -32,8 +32,9 @@
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
|
||||
<!--
|
||||
|
||||
<!--支付宝-->
|
||||
支付宝
|
||||
<activity
|
||||
android:name="com.alipay.sdk.app.H5PayActivity"
|
||||
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
|
||||
@@ -46,7 +47,8 @@
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden"></activity>
|
||||
<!--支付宝 end-->
|
||||
支付宝 end
|
||||
-->
|
||||
|
||||
<activity
|
||||
android:name="com.yunbao.common.activity.ErrorActivity"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,22 +1,22 @@
|
||||
package com.yunbao.common;
|
||||
|
||||
import static com.facebook.FacebookSdk.setAdvertiserIDCollectionEnabled;
|
||||
import static com.facebook.FacebookSdk.setAutoLogAppEventsEnabled;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.multidex.MultiDex;
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.facebook.FacebookSdk;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.google.android.gms.common.api.ApiException;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Locale;
|
||||
|
||||
import io.rong.imlib.RongIMClient;
|
||||
@@ -24,9 +24,6 @@ import io.rong.push.RongPushClient;
|
||||
import io.rong.push.pushconfig.PushConfig;
|
||||
import me.leolin.shortcutbadger.ShortcutBadger;
|
||||
|
||||
import static com.facebook.FacebookSdk.setAdvertiserIDCollectionEnabled;
|
||||
import static com.facebook.FacebookSdk.setAutoLogAppEventsEnabled;
|
||||
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/8/3.
|
||||
@@ -35,13 +32,12 @@ import static com.facebook.FacebookSdk.setAutoLogAppEventsEnabled;
|
||||
public class CommonAppContext extends MultiDexApplication {
|
||||
|
||||
public static CommonAppContext sInstance;
|
||||
public static WeakReference<Activity> activityWeakReference;
|
||||
private int mCount;
|
||||
private boolean mFront;//是否前台
|
||||
public static int jpushMsgNum;
|
||||
public static int Ingroup = 0;
|
||||
public static String lang = "chinese";
|
||||
public static FirebaseAnalytics mFirebaseAnalytics;
|
||||
public static AppEventsLogger logger;
|
||||
public static boolean isReady = false;
|
||||
public static String home_zdy_img_us = "";
|
||||
public static String home_zdy_img_cn = "";
|
||||
@@ -67,33 +63,29 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
//初始化友盟统计
|
||||
// UMConfigure.init(this, UMConfigure.DEVICE_TYPE_PHONE, null);
|
||||
FacebookSdk.sdkInitialize(getApplicationContext());
|
||||
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
||||
mFirebaseAnalytics.setAnalyticsCollectionEnabled(true);
|
||||
mFirebaseAnalytics.setUserProperty("ALLOW_AD_PERSONALIZATION_SIGNALS", "true" );
|
||||
|
||||
|
||||
|
||||
logger = AppEventsLogger.newLogger(this);
|
||||
setAutoLogAppEventsEnabled(true);
|
||||
FacebookSdk.fullyInitialize();
|
||||
setAdvertiserIDCollectionEnabled(true);
|
||||
registerActivityLifecycleCallbacks();
|
||||
|
||||
Locale locale;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
locale = getResources().getConfiguration().getLocales().get(0);
|
||||
} else {
|
||||
locale = getResources().getConfiguration().locale;
|
||||
}
|
||||
if(locale.getLanguage().equals("en")){
|
||||
lang = "english";
|
||||
}else{
|
||||
lang = "chinese";
|
||||
}
|
||||
Log.i("lang",lang);
|
||||
Locale locale;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
locale = getResources().getConfiguration().getLocales().get(0);
|
||||
} else {
|
||||
locale = getResources().getConfiguration().locale;
|
||||
}
|
||||
if (locale.getLanguage().equals("en")) {
|
||||
lang = "english";
|
||||
} else {
|
||||
lang = "chinese";
|
||||
}
|
||||
Log.i("lang", lang);
|
||||
|
||||
}
|
||||
|
||||
public static Activity getTopActivity() {
|
||||
return activityWeakReference.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
@@ -111,11 +103,12 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
@Override
|
||||
public void onActivityStarted(Activity activity) {
|
||||
mCount++;
|
||||
activityWeakReference = new WeakReference<>(activity);
|
||||
if (!mFront) {
|
||||
mFront = true;
|
||||
L.e("AppContext------->处于前台");
|
||||
ShortcutBadger.applyCount(activity,0);
|
||||
jpushMsgNum=0;
|
||||
ShortcutBadger.applyCount(activity, 0);
|
||||
jpushMsgNum = 0;
|
||||
CommonAppConfig.getInstance().setFrontGround(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import java.util.List;
|
||||
*/
|
||||
|
||||
public class Constants {
|
||||
public static final String NEW_ENTER_ROOM = "enterRoom";
|
||||
|
||||
public static final String URL = "url";
|
||||
public static final String PAYLOAD = "payload";
|
||||
public static final String SEX = "sex";
|
||||
@@ -74,7 +76,7 @@ public class Constants {
|
||||
public static final String PAY_BUY_COIN_ALI = "Charge.getAliOrder";
|
||||
public static final String PAY_BUY_COIN_WX = "Charge.getWxOrder";
|
||||
|
||||
public static final String PACKAGE_NAME_ALI = "com.eg.android.AlipayGphone";//支付宝的包名
|
||||
// public static final String PACKAGE_NAME_ALI = "com.eg.android.AlipayGphone";//支付宝的包名
|
||||
public static final String PACKAGE_NAME_WX = "com.tencent.mm";//微信的包名
|
||||
public static final String PACKAGE_NAME_QQ = "com.tencent.mobileqq";//QQ的包名
|
||||
public static final String LAT = "lat";
|
||||
@@ -130,6 +132,7 @@ public class Constants {
|
||||
public static final int LIVE_FUNC_MIC = 2013;//語音
|
||||
public static final int LIVE_FUNC_WKS = 2014;//語音
|
||||
public static final int LIVE_FUNC_ZSLK = 2015;//語音
|
||||
public static final int LIVE_FUNC_RANDOM_PK = 2016;//随机PK
|
||||
|
||||
//socket
|
||||
public static final String SOCKET_CONN = "conn";
|
||||
@@ -143,6 +146,7 @@ public class Constants {
|
||||
public static final String SOCKET_ALL_SERVER_NOTIFY = "AllServerNotify";//全服通知
|
||||
public static final String SOCKET_SEND_BARRAGE = "SendBarrage";//发弹幕
|
||||
public static final String SOCKET_LIVE_DRPK = "LiveDRPK";//多人PK
|
||||
public static final String SOCKET_LIVE_DRPK_RANDOM = "LiveRandomPK";//多人PK
|
||||
public static final String SOCKET_LEAVE_ROOM = "disconnect";//用户离开房间
|
||||
public static final String SOCKET_LIVE_END = "StartEndLive";//主播关闭直播
|
||||
public static final String SOCKET_SYSTEM = "SystemNot";//系统消息
|
||||
@@ -168,6 +172,8 @@ public class Constants {
|
||||
public static final String STAR_CHALLENGE_UPDATE = "starChallengeUpdate";//星级助力
|
||||
public static final String AI_AUTOMATIC_SPEECH = "aiAutomaticSpeech";//机器人助手
|
||||
public static final String STAR_CHALLENGE_UPGRADE_NOTIFY = "starChallengeUpgradeNotify";//星级挑战成功
|
||||
public static final String SUPER_VISION = "supervision";//超级发言警告
|
||||
public static final String PK_RANK_UPDATE = "RankingRankUpdate";//PK排位赛更新数据
|
||||
|
||||
//游戏socket
|
||||
public static final String SOCKET_GAME_ZJH = "startGame";//炸金花
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyCharacterMap;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
@@ -54,8 +55,8 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
Intent intent=getIntent();
|
||||
if(intent!=null) {
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
isFullWindow = getIntent().getBooleanExtra("isFull", false);
|
||||
if (isFullWindow) {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
@@ -358,4 +359,15 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(int level) {
|
||||
super.onTrimMemory(level);
|
||||
Log.i("memory", "onTrimMemory: " + level);
|
||||
switch (level) {
|
||||
case TRIM_MEMORY_RUNNING_CRITICAL://内存低值危险值
|
||||
break;
|
||||
case TRIM_MEMORY_RUNNING_LOW://内存过低
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,9 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.MediaStore;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
@@ -23,16 +20,23 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
import com.yunbao.common.utils.AndroidBug5497Workaround;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/25.
|
||||
*/
|
||||
@@ -64,14 +68,13 @@ public class WebViewActivity extends AbsActivity {
|
||||
btnEdit = (ImageView) findViewById(R.id.btn_edit);
|
||||
ft_title = (FrameLayout) findViewById(R.id.ft_title);
|
||||
v_spacing = (View) findViewById(R.id.v_spacing);
|
||||
mWebView = findViewById(R.id.webView);
|
||||
AndroidBug5497Workaround.assistActivity(this);
|
||||
|
||||
mWebView = new WebView(mContext);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
params.topMargin = DpUtil.dp2px(1);
|
||||
mWebView.setLayoutParams(params);
|
||||
mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
rootView.addView(mWebView);
|
||||
// mWebView.setLayoutParams(params);
|
||||
//mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
mWebView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
@@ -93,6 +96,11 @@ public class WebViewActivity extends AbsActivity {
|
||||
if (url.contains("for")) {
|
||||
mWebView.loadUrl("javascript:goAnchorTab()");
|
||||
}
|
||||
//真实屏幕高度-(ft_title的高度+导航栏高度)
|
||||
int height = DeviceUtils.getScreenRealHeight(mContext) - DpUtil.dp2px(72) - getCurrentNavigationBarHeight(mContext);
|
||||
if (!navigationGestureEnabled(mContext)) {
|
||||
view.loadUrl("javascript:window.androidObject.setHeight(" + height + ",0,false)");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
@@ -136,7 +144,7 @@ public class WebViewActivity extends AbsActivity {
|
||||
}
|
||||
|
||||
});
|
||||
mWebView.addJavascriptInterface(new JsInteration(), "androidObject");
|
||||
mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView).setPageClose(true).setLiveZhuangBana(false), "androidObject");
|
||||
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
|
||||
mWebView.getSettings().setJavaScriptEnabled(true);
|
||||
mWebView.getSettings().setDomStorageEnabled(true);
|
||||
@@ -165,58 +173,6 @@ public class WebViewActivity extends AbsActivity {
|
||||
}
|
||||
}
|
||||
|
||||
//js调用原生
|
||||
public class JsInteration {
|
||||
@JavascriptInterface
|
||||
public void onBack() {
|
||||
finish();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void modifyMydata() {
|
||||
indexInto = 1;
|
||||
RouteUtil.forwardEditProfileActivity();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void reportUser(String touid) {
|
||||
RouteUtil.forwardLiveReportActivity(touid);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void gotoHomePage(String indexStr) {
|
||||
Log.e("tgasss","indexStr4"+indexStr);
|
||||
|
||||
if (!"".equals(indexStr) && indexStr != null) {
|
||||
int index = -1;
|
||||
if ("0".equals(indexStr)) {
|
||||
index = 0;
|
||||
} else if ("1".equals(indexStr)) {
|
||||
index = 1;
|
||||
} else if ("2".equals(indexStr)) {
|
||||
index = 2;
|
||||
} else if ("3".equals(indexStr)) {
|
||||
index = 3;
|
||||
}
|
||||
if (index != -1) {
|
||||
finish();
|
||||
Constants.isShowPage = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void openWebView(String url) {
|
||||
Constants.isTitle = false;
|
||||
RouteUtil.forwardZhuangBanActivity(url);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void openWebViewTitle(String url) {
|
||||
Constants.isTitle = true;
|
||||
RouteUtil.forwardZhuangBanActivity(url);
|
||||
}
|
||||
}
|
||||
|
||||
private void openImageChooserActivity(ValueCallback<Uri> valueCallback) {
|
||||
mValueCallback = valueCallback;
|
||||
@@ -348,11 +304,10 @@ public class WebViewActivity extends AbsActivity {
|
||||
if (Constants.isShowPage != -1) {
|
||||
finish();
|
||||
}
|
||||
// new Handler().postDelayed(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// mWebView.reload();
|
||||
// }
|
||||
// }, 100);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onJavascriptInterfaceEvent(JavascriptInterfaceEvent event) {
|
||||
indexInto = event.getIndexInto();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.http.main.MainNetManager;
|
||||
import com.yunbao.common.views.DrawerRecommendViewHolder;
|
||||
import com.yunbao.common.views.DrawerTaskViewHolder;
|
||||
import com.yunbao.common.views.FunGamesViewHolder;
|
||||
import com.yunbao.common.views.RecommendViewHolder;
|
||||
import com.yunbao.common.views.RigtsInterestsViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新侧边栏适配器
|
||||
*/
|
||||
public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
||||
private Context mContext;
|
||||
// "type": 1,//模块类型 1 充值送好礼类型2 任务中心类型 3趣味游戏类4 权益 ,5为你推荐
|
||||
private final int GOOD_GIFTS = 1;
|
||||
private final int TASK_CENTER = 2;
|
||||
private final int FUN_GAMES = 3;
|
||||
private final int RIGHTS_INTERESTS = 4;
|
||||
private final int RECOMMEND = 5;
|
||||
private String liveId;
|
||||
private List<AnchorRecommendItemModel> list = new ArrayList<>();
|
||||
|
||||
private List<CustomSidebarInfoModel> infoModels = new ArrayList<>();
|
||||
|
||||
public CustomDrawerPopupAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
|
||||
public CustomDrawerPopupAdapter setLiveId(String liveId) {
|
||||
this.liveId = liveId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupAdapter setList(List<AnchorRecommendItemModel> list) {
|
||||
this.list = list;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
switch (viewType) {
|
||||
case GOOD_GIFTS:
|
||||
View goodGiftsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_good_gifts, parent, false);
|
||||
return new DrawerRecommendViewHolder(goodGiftsView);
|
||||
case TASK_CENTER:
|
||||
View taskCenterView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_tsak_center, parent, false);
|
||||
return new DrawerTaskViewHolder(taskCenterView);
|
||||
case FUN_GAMES:
|
||||
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_fun_games_view, parent, false);
|
||||
return new FunGamesViewHolder(runGamesView);
|
||||
case RIGHTS_INTERESTS:
|
||||
View rightsInterestsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_rights_interests, parent, false);
|
||||
return new RigtsInterestsViewHolder(rightsInterestsView);
|
||||
default:
|
||||
View recommendView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_recommend, parent, false);
|
||||
return new RecommendViewHolder(recommendView);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder instanceof DrawerRecommendViewHolder) {
|
||||
DrawerRecommendViewHolder recommendViewHolder = (DrawerRecommendViewHolder) holder;
|
||||
recommendViewHolder.setData(infoModels.get(position));
|
||||
} else if (holder instanceof DrawerTaskViewHolder) {
|
||||
DrawerTaskViewHolder taskViewHolder = (DrawerTaskViewHolder) holder;
|
||||
taskViewHolder.setData(infoModels.get(position));
|
||||
} else if (holder instanceof FunGamesViewHolder) {
|
||||
FunGamesViewHolder funGamesViewHolder = (FunGamesViewHolder) holder;
|
||||
funGamesViewHolder.setData(infoModels.get(position));
|
||||
} else if (holder instanceof RigtsInterestsViewHolder) {
|
||||
RigtsInterestsViewHolder rigtsInterestsViewHolder = (RigtsInterestsViewHolder) holder;
|
||||
rigtsInterestsViewHolder.setData(infoModels.get(position));
|
||||
} else if (holder instanceof RecommendViewHolder) {
|
||||
|
||||
RecommendViewHolder recommendViewHolder = (RecommendViewHolder) holder;
|
||||
recommendViewHolder.setData(infoModels.get(position));
|
||||
recommendViewHolder.updateData(list);
|
||||
|
||||
recommendViewHolder.setListener(new RecommendViewHolder.RecommendViewListener() {
|
||||
@Override
|
||||
public void changeOneBatch() {
|
||||
//推荐位
|
||||
MainNetManager.get((Activity) mContext)
|
||||
.anchorRecommend("9", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
|
||||
|
||||
List<AnchorRecommendItemModel> models = anchorRecommendModel.getList();
|
||||
int userIndex = -1;
|
||||
for (int i = 0; i < models.size(); i++) {
|
||||
if (TextUtils.equals(models.get(i).getUid(), liveId)) {
|
||||
userIndex = i;
|
||||
}
|
||||
}
|
||||
if (userIndex != -1) {
|
||||
models.remove(userIndex);
|
||||
}
|
||||
recommendViewHolder.updateData(models);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToLive(AnchorRecommendItemModel model) {
|
||||
if (listener != null) {
|
||||
listener.goToLive(model);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return infoModels.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
CustomSidebarInfoModel model = infoModels.get(position);
|
||||
switch (model.getType()) {
|
||||
case "1":
|
||||
return GOOD_GIFTS;
|
||||
case "2":
|
||||
return TASK_CENTER;
|
||||
case "3":
|
||||
return FUN_GAMES;
|
||||
case "4":
|
||||
return RIGHTS_INTERESTS;
|
||||
case "5":
|
||||
return RECOMMEND;
|
||||
}
|
||||
return super.getItemViewType(position);
|
||||
|
||||
}
|
||||
|
||||
public void updateData(List<CustomSidebarInfoModel> mInfoModels) {
|
||||
infoModels.clear();
|
||||
infoModels.addAll(mInfoModels);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private CustomDrawerListener listener;
|
||||
|
||||
public CustomDrawerPopupAdapter setListener(CustomDrawerListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface CustomDrawerListener {
|
||||
void goToLive(AnchorRecommendItemModel model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.views.DrawerRecommendChildViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DrawerRecommendAdapter extends RecyclerView.Adapter {
|
||||
private Context mContext;
|
||||
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
||||
|
||||
public DrawerRecommendAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View goodGiftsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_drawer_recommend_child, parent, false);
|
||||
return new DrawerRecommendChildViewHolder(goodGiftsView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
DrawerRecommendChildViewHolder childViewHolder = (DrawerRecommendChildViewHolder) holder;
|
||||
childViewHolder.setData(child.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return child.size();
|
||||
}
|
||||
|
||||
public void updateData(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
child.addAll(mChild);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.event.CustomDrawerPopupEvent;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.views.DrawerTaskChildViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DrawerTaskAdapter extends RecyclerView.Adapter {
|
||||
private Context mContext;
|
||||
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
||||
|
||||
public DrawerTaskAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View taskCenterView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_tsak_center_child, parent, false);
|
||||
return new DrawerTaskChildViewHolder(taskCenterView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
DrawerTaskChildViewHolder taskChildViewHolder = (DrawerTaskChildViewHolder) holder;
|
||||
taskChildViewHolder.setData(child.get(position), position);
|
||||
taskChildViewHolder.setListener(new DrawerTaskChildViewHolder.DrawerTaskChildListener() {
|
||||
@Override
|
||||
public void giftSuccess(CustomSidebarChildModel model, int index) {
|
||||
//将领取的任务移动至任务列表尾部
|
||||
Bus.get().post(new CustomDrawerPopupEvent()
|
||||
.setDisMiss(false).setRefresh(true));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public void updateData(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
child.addAll(mChild);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.views.FunGamesChildViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FunGamesAdapter extends RecyclerView.Adapter {
|
||||
private Context mContext;
|
||||
private boolean rigts;
|
||||
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
||||
|
||||
public FunGamesAdapter(Context mContext, boolean rigts) {
|
||||
this.mContext = mContext;
|
||||
this.rigts = rigts;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_fun_games_child_view, parent, false);
|
||||
return new FunGamesChildViewHolder(runGamesView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
FunGamesChildViewHolder childViewHolder = (FunGamesChildViewHolder) holder;
|
||||
childViewHolder.setData(child.get(position), rigts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return child.size();
|
||||
}
|
||||
|
||||
public void updateData(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
if (mChild.size() > 8) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
child.add(mChild.get(i));
|
||||
}
|
||||
} else {
|
||||
child.addAll(mChild);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void selectAll(List<CustomSidebarChildModel> mChild){
|
||||
child.clear();
|
||||
child.addAll(mChild);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.views.RecommendChildViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RecommendAdapter extends RecyclerView.Adapter {
|
||||
private List<AnchorRecommendItemModel> list = new ArrayList<>();
|
||||
private Context mContext;
|
||||
|
||||
public RecommendAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new RecommendChildViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_sidebar_lives_new, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
|
||||
RecommendChildViewHolder itemViewHolder = (RecommendChildViewHolder) holder;
|
||||
itemViewHolder.setData(list.get(position));
|
||||
itemViewHolder.setListener(new RecommendChildViewHolder.RecommendChildListener() {
|
||||
@Override
|
||||
public void goToLive(AnchorRecommendItemModel model) {
|
||||
if (callback != null) {
|
||||
callback.goToLive(model);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public void updateData(List<AnchorRecommendItemModel> mList) {
|
||||
list.clear();
|
||||
list.addAll(mList);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private RecommendCallback callback;
|
||||
|
||||
public RecommendAdapter setCallback(RecommendCallback callback) {
|
||||
this.callback = callback;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface RecommendCallback {
|
||||
void goToLive(AnchorRecommendItemModel model);
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public abstract class RefreshAdapter<T> extends RecyclerView.Adapter {
|
||||
return position;
|
||||
}
|
||||
|
||||
protected boolean canClick() {
|
||||
protected static boolean canClick() {
|
||||
return ClickUtil.canClick();
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public class AnchorRecommendItemModel extends BaseModel {
|
||||
private String avatarThumb = "";
|
||||
@SerializedName("avatar2")
|
||||
private String avatar2 = "";
|
||||
@SerializedName("user_nicename")
|
||||
@SerializedName(value = "user_nicename", alternate = "userNiceName")
|
||||
private String userNicename = "";
|
||||
@SerializedName("level")
|
||||
private String level = "";
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class CheckLiveModel extends BaseModel {
|
||||
|
||||
@SerializedName("type")
|
||||
private int type;
|
||||
@SerializedName("type_val")
|
||||
private String typeVal;
|
||||
@SerializedName("type_msg")
|
||||
private String typeMsg;
|
||||
@SerializedName("live_sdk")
|
||||
private String liveSdk;
|
||||
|
||||
public static CheckLiveModel objectFromData(String str) {
|
||||
|
||||
return new Gson().fromJson(str, CheckLiveModel.class);
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTypeVal() {
|
||||
return typeVal;
|
||||
}
|
||||
|
||||
public void setTypeVal(String typeVal) {
|
||||
this.typeVal = typeVal;
|
||||
}
|
||||
|
||||
public String getTypeMsg() {
|
||||
return typeMsg;
|
||||
}
|
||||
|
||||
public void setTypeMsg(String typeMsg) {
|
||||
this.typeMsg = typeMsg;
|
||||
}
|
||||
|
||||
public String getLiveSdk() {
|
||||
return liveSdk;
|
||||
}
|
||||
|
||||
public void setLiveSdk(String liveSdk) {
|
||||
this.liveSdk = liveSdk;
|
||||
}
|
||||
}
|
||||
@@ -60,10 +60,14 @@ public class CrashSaveBean {
|
||||
}
|
||||
|
||||
public String getActivitySize() {
|
||||
StringBuilder builder=new StringBuilder();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (WeakReference<Activity> activity : activities) {
|
||||
if(activity.get()!=null){
|
||||
builder.append(activity.get()).append(",");
|
||||
try {
|
||||
if (activity.get() != null) {
|
||||
builder.append(activity.get().getClass().getSimpleName()).append(",");
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
return builder.toString();
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class CustomSidebarChildModel extends BaseModel {
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("parent_id")
|
||||
private String parentId;
|
||||
@SerializedName("title")
|
||||
private String title;
|
||||
@SerializedName("subtitle")
|
||||
private String subtitle;
|
||||
@SerializedName("icon")
|
||||
private String icon;
|
||||
@SerializedName("src")
|
||||
private String src;
|
||||
@SerializedName("show_type")
|
||||
private String showType;
|
||||
@SerializedName("sort")
|
||||
private String sort;
|
||||
@SerializedName("english")
|
||||
private String english;
|
||||
//奖励领取状态 0未达到领取要求 1已领取 2未领取
|
||||
@SerializedName("status")
|
||||
private String status;
|
||||
@SerializedName("need_num")
|
||||
private String needNum;
|
||||
@SerializedName("now_num")
|
||||
private String nowNum;
|
||||
@SerializedName("activity_id")
|
||||
private String activityId;
|
||||
@SerializedName("flag")
|
||||
private String flag;
|
||||
|
||||
public String getFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setFlag(String flag) {
|
||||
this.flag = flag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setActivityId(String activityId) {
|
||||
this.activityId = activityId;
|
||||
return this;
|
||||
}
|
||||
|
||||
private int resIcon;
|
||||
|
||||
public int getResIcon() {
|
||||
return resIcon;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setResIcon(int resIcon) {
|
||||
this.resIcon = resIcon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSubtitle() {
|
||||
return subtitle;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setSubtitle(String subtitle) {
|
||||
this.subtitle = subtitle;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSrc() {
|
||||
return src;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setSrc(String src) {
|
||||
this.src = src;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getShowType() {
|
||||
return showType;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setShowType(String showType) {
|
||||
this.showType = showType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setSort(String sort) {
|
||||
this.sort = sort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getEnglish() {
|
||||
return english;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setEnglish(String english) {
|
||||
this.english = english;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setStatus(String status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNeedNum() {
|
||||
return needNum;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setNeedNum(String needNum) {
|
||||
this.needNum = needNum;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNowNum() {
|
||||
return nowNum;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setNowNum(String nowNum) {
|
||||
this.nowNum = nowNum;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新版自定义侧边栏
|
||||
*/
|
||||
public class CustomSidebarInfoModel extends BaseModel {
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
//一级标题
|
||||
@SerializedName("title")
|
||||
private String title;
|
||||
//二级标题
|
||||
@SerializedName("subtitle")
|
||||
private String subtitle;
|
||||
@SerializedName("sort")
|
||||
private String sort;
|
||||
//1全屏 2半屏
|
||||
@SerializedName("show_type")
|
||||
private String showType;
|
||||
//跳转链接
|
||||
@SerializedName("src")
|
||||
private String src;
|
||||
@SerializedName("type")
|
||||
private String type;
|
||||
@SerializedName("child")
|
||||
private List<CustomSidebarChildModel> child;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public CustomSidebarInfoModel setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public CustomSidebarInfoModel setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSubtitle() {
|
||||
return subtitle;
|
||||
}
|
||||
|
||||
public CustomSidebarInfoModel setSubtitle(String subtitle) {
|
||||
this.subtitle = subtitle;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public CustomSidebarInfoModel setSort(String sort) {
|
||||
this.sort = sort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getShowType() {
|
||||
return showType;
|
||||
}
|
||||
|
||||
public CustomSidebarInfoModel setShowType(String showType) {
|
||||
this.showType = showType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSrc() {
|
||||
return src;
|
||||
}
|
||||
|
||||
public CustomSidebarInfoModel setSrc(String src) {
|
||||
this.src = src;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public CustomSidebarInfoModel setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<CustomSidebarChildModel> getChild() {
|
||||
return child;
|
||||
}
|
||||
|
||||
public CustomSidebarInfoModel setChild(List<CustomSidebarChildModel> child) {
|
||||
this.child = child;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,550 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EnterRoomInfoModel extends BaseModel {
|
||||
@SerializedName("votestotal")
|
||||
private String votestotal;
|
||||
@SerializedName("medalRankNum")
|
||||
private String medalRankNum;
|
||||
@SerializedName("barrage_fee")
|
||||
private String barrageFee;
|
||||
@SerializedName("userlist_time")
|
||||
private String userlistTime;
|
||||
@SerializedName("chatserver")
|
||||
private String chatserver;
|
||||
@SerializedName("linkmic_uid")
|
||||
private String linkmicUid;
|
||||
@SerializedName("linkmic_pull")
|
||||
private String linkmicPull;
|
||||
@SerializedName("nums")
|
||||
private String nums;
|
||||
@SerializedName("game")
|
||||
private List<?> game;
|
||||
@SerializedName("gamebet")
|
||||
private List<String> gamebet;
|
||||
@SerializedName("gametime")
|
||||
private String gametime;
|
||||
@SerializedName("gameid")
|
||||
private String gameid;
|
||||
@SerializedName("gameaction")
|
||||
private String gameaction;
|
||||
@SerializedName("game_bankerid")
|
||||
private String gameBankerid;
|
||||
@SerializedName("game_banker_name")
|
||||
private String gameBankerName;
|
||||
@SerializedName("game_banker_avatar")
|
||||
private String gameBankerAvatar;
|
||||
@SerializedName("game_banker_coin")
|
||||
private String gameBankerCoin;
|
||||
@SerializedName("game_banker_limit")
|
||||
private String gameBankerLimit;
|
||||
@SerializedName("shut_time")
|
||||
private String shutTime;
|
||||
@SerializedName("kick_time")
|
||||
private String kickTime;
|
||||
@SerializedName("speak_limit")
|
||||
private String speakLimit;
|
||||
@SerializedName("barrage_limit")
|
||||
private String barrageLimit;
|
||||
@SerializedName("coin")
|
||||
private String coin;
|
||||
@SerializedName("vip")
|
||||
private VipModel vip;
|
||||
@SerializedName("liang")
|
||||
private LiangModel liang;
|
||||
@SerializedName("medal_level")
|
||||
private String medalLevel;
|
||||
@SerializedName("medal_name")
|
||||
private String medalName;
|
||||
@SerializedName("issuper")
|
||||
private String issuper;
|
||||
@SerializedName("usertype")
|
||||
private String usertype;
|
||||
@SerializedName("front_task")
|
||||
private String frontTask;
|
||||
@SerializedName("ismic")
|
||||
private String ismic;
|
||||
@SerializedName("isattention")
|
||||
private String isattention;
|
||||
@SerializedName("userlists")
|
||||
private List<LiveUserGiftBean> userlists;
|
||||
@SerializedName("guard")
|
||||
private GuardModel guard;
|
||||
@SerializedName("guard_nums")
|
||||
private String guardNums;
|
||||
@SerializedName("pkinfo")
|
||||
private PkinfoModel pkinfo;
|
||||
@SerializedName("lminfo")
|
||||
private LminfoModel lminfo;
|
||||
@SerializedName("isred")
|
||||
private String isred;
|
||||
@SerializedName("is_fans")
|
||||
private String isFans;
|
||||
@SerializedName("count_fans")
|
||||
private String countFans;
|
||||
@SerializedName("isconnection")
|
||||
private String isconnection;
|
||||
@SerializedName("isleave")
|
||||
private String isleave;
|
||||
@SerializedName("landscape")
|
||||
private String landscape;
|
||||
@SerializedName("un_charge")
|
||||
private String unCharge;
|
||||
@SerializedName("see_time")
|
||||
private String seeTime;
|
||||
@SerializedName("greetings")
|
||||
private List<String> greetings;
|
||||
@SerializedName("live_bg")
|
||||
private String liveBg;
|
||||
@SerializedName("anchor_goodnum")
|
||||
private String anchorGoodnum;
|
||||
@SerializedName("jackpot_level")
|
||||
private String jackpotLevel="-1";
|
||||
|
||||
public String getJackpotLevel() {
|
||||
|
||||
return jackpotLevel;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setJackpotLevel(String jackpotLevel) {
|
||||
this.jackpotLevel = jackpotLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getVotestotal() {
|
||||
return votestotal;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setVotestotal(String votestotal) {
|
||||
this.votestotal = votestotal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMedalRankNum() {
|
||||
return medalRankNum;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setMedalRankNum(String medalRankNum) {
|
||||
this.medalRankNum = medalRankNum;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBarrageFee() {
|
||||
return barrageFee;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setBarrageFee(String barrageFee) {
|
||||
this.barrageFee = barrageFee;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserlistTime() {
|
||||
return userlistTime;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setUserlistTime(String userlistTime) {
|
||||
this.userlistTime = userlistTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getChatserver() {
|
||||
return chatserver;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setChatserver(String chatserver) {
|
||||
this.chatserver = chatserver;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLinkmicUid() {
|
||||
return linkmicUid;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setLinkmicUid(String linkmicUid) {
|
||||
this.linkmicUid = linkmicUid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLinkmicPull() {
|
||||
return linkmicPull;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setLinkmicPull(String linkmicPull) {
|
||||
this.linkmicPull = linkmicPull;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNums() {
|
||||
return nums;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setNums(String nums) {
|
||||
this.nums = nums;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<?> getGame() {
|
||||
return game;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setGame(List<?> game) {
|
||||
this.game = game;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getGamebet() {
|
||||
return gamebet;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setGamebet(List<String> gamebet) {
|
||||
this.gamebet = gamebet;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGametime() {
|
||||
return gametime;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setGametime(String gametime) {
|
||||
this.gametime = gametime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGameid() {
|
||||
return gameid;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setGameid(String gameid) {
|
||||
this.gameid = gameid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGameaction() {
|
||||
return gameaction;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setGameaction(String gameaction) {
|
||||
this.gameaction = gameaction;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGameBankerid() {
|
||||
return gameBankerid;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setGameBankerid(String gameBankerid) {
|
||||
this.gameBankerid = gameBankerid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGameBankerName() {
|
||||
return gameBankerName;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setGameBankerName(String gameBankerName) {
|
||||
this.gameBankerName = gameBankerName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGameBankerAvatar() {
|
||||
return gameBankerAvatar;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setGameBankerAvatar(String gameBankerAvatar) {
|
||||
this.gameBankerAvatar = gameBankerAvatar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGameBankerCoin() {
|
||||
return gameBankerCoin;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setGameBankerCoin(String gameBankerCoin) {
|
||||
this.gameBankerCoin = gameBankerCoin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGameBankerLimit() {
|
||||
return gameBankerLimit;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setGameBankerLimit(String gameBankerLimit) {
|
||||
this.gameBankerLimit = gameBankerLimit;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getShutTime() {
|
||||
return shutTime;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setShutTime(String shutTime) {
|
||||
this.shutTime = shutTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getKickTime() {
|
||||
return kickTime;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setKickTime(String kickTime) {
|
||||
this.kickTime = kickTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSpeakLimit() {
|
||||
return speakLimit;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setSpeakLimit(String speakLimit) {
|
||||
this.speakLimit = speakLimit;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBarrageLimit() {
|
||||
return barrageLimit;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setBarrageLimit(String barrageLimit) {
|
||||
this.barrageLimit = barrageLimit;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCoin() {
|
||||
return coin;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setCoin(String coin) {
|
||||
this.coin = coin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VipModel getVip() {
|
||||
return vip;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setVip(VipModel vip) {
|
||||
this.vip = vip;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LiangModel getLiang() {
|
||||
return liang;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setLiang(LiangModel liang) {
|
||||
this.liang = liang;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMedalLevel() {
|
||||
return medalLevel;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setMedalLevel(String medalLevel) {
|
||||
this.medalLevel = medalLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMedalName() {
|
||||
return medalName;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setMedalName(String medalName) {
|
||||
this.medalName = medalName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIssuper() {
|
||||
return issuper;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setIssuper(String issuper) {
|
||||
this.issuper = issuper;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUsertype() {
|
||||
return usertype;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setUsertype(String usertype) {
|
||||
this.usertype = usertype;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFrontTask() {
|
||||
return frontTask;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setFrontTask(String frontTask) {
|
||||
this.frontTask = frontTask;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsmic() {
|
||||
return ismic;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setIsmic(String ismic) {
|
||||
this.ismic = ismic;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsattention() {
|
||||
return isattention;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setIsattention(String isattention) {
|
||||
this.isattention = isattention;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<LiveUserGiftBean> getUserlists() {
|
||||
return userlists;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setUserlists(List<LiveUserGiftBean> userlists) {
|
||||
this.userlists = userlists;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GuardModel getGuard() {
|
||||
return guard;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setGuard(GuardModel guard) {
|
||||
this.guard = guard;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGuardNums() {
|
||||
return guardNums;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setGuardNums(String guardNums) {
|
||||
this.guardNums = guardNums;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PkinfoModel getPkinfo() {
|
||||
return pkinfo;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setPkinfo(PkinfoModel pkinfo) {
|
||||
this.pkinfo = pkinfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LminfoModel getLminfo() {
|
||||
return lminfo;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setLminfo(LminfoModel lminfo) {
|
||||
this.lminfo = lminfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsred() {
|
||||
return isred;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setIsred(String isred) {
|
||||
this.isred = isred;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsFans() {
|
||||
return isFans;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setIsFans(String isFans) {
|
||||
this.isFans = isFans;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCountFans() {
|
||||
return countFans;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setCountFans(String countFans) {
|
||||
this.countFans = countFans;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsconnection() {
|
||||
return isconnection;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setIsconnection(String isconnection) {
|
||||
this.isconnection = isconnection;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsleave() {
|
||||
return isleave;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setIsleave(String isleave) {
|
||||
this.isleave = isleave;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLandscape() {
|
||||
return landscape;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setLandscape(String landscape) {
|
||||
this.landscape = landscape;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUnCharge() {
|
||||
return unCharge;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setUnCharge(String unCharge) {
|
||||
this.unCharge = unCharge;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSeeTime() {
|
||||
return seeTime;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setSeeTime(String seeTime) {
|
||||
this.seeTime = seeTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getGreetings() {
|
||||
return greetings;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setGreetings(List<String> greetings) {
|
||||
this.greetings = greetings;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLiveBg() {
|
||||
return liveBg;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setLiveBg(String liveBg) {
|
||||
this.liveBg = liveBg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAnchorGoodnum() {
|
||||
return anchorGoodnum;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setAnchorGoodnum(String anchorGoodnum) {
|
||||
this.anchorGoodnum = anchorGoodnum;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 整合进入直播间接口
|
||||
*/
|
||||
public class EnterRoomNewModel extends BaseModel {
|
||||
|
||||
@SerializedName("liveInfo")
|
||||
private LiveInfoModel liveInfo = new LiveInfoModel();//直播间信息
|
||||
@SerializedName("enterRoomInfo")
|
||||
private EnterRoomInfoModel enterRoomInfo = new EnterRoomInfoModel();//原接口进入直播间数据返回
|
||||
@SerializedName("rankHour")
|
||||
private RankHourModel rankHour = new RankHourModel();//.热度卡
|
||||
@SerializedName("newPeopleTask")
|
||||
private NewPeopleTaskModel newPeopleTask = new NewPeopleTaskModel();//新人任务
|
||||
@SerializedName("wishList")
|
||||
private WishListModel wishList = new WishListModel();//心愿单
|
||||
@SerializedName("guardUser")
|
||||
private GuardUserModel guardUserAvatar = new GuardUserModel();//守护
|
||||
@SerializedName("activeList")
|
||||
private List<ActiveModel> activeList = new ArrayList<>();//活动列表
|
||||
@SerializedName("isUseHotCard")
|
||||
private String isUseHotCard = "";//是否使用热度卡
|
||||
@SerializedName("liveRoomActivity")
|
||||
private List<LiveRoomActivityModel> liveRoomActivityModels = new ArrayList<>();//活动列表
|
||||
|
||||
public List<LiveRoomActivityModel> getLiveRoomActivityModels() {
|
||||
return liveRoomActivityModels;
|
||||
}
|
||||
|
||||
public EnterRoomNewModel setLiveRoomActivityModels(List<LiveRoomActivityModel> liveRoomActivityModels) {
|
||||
this.liveRoomActivityModels = liveRoomActivityModels;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LiveInfoModel getLiveInfo() {
|
||||
return liveInfo;
|
||||
}
|
||||
|
||||
public EnterRoomNewModel setLiveInfo(LiveInfoModel liveInfo) {
|
||||
this.liveInfo = liveInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel getEnterRoomInfo() {
|
||||
return enterRoomInfo;
|
||||
}
|
||||
|
||||
public EnterRoomNewModel setEnterRoomInfo(EnterRoomInfoModel enterRoomInfo) {
|
||||
this.enterRoomInfo = enterRoomInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RankHourModel getRankHour() {
|
||||
return rankHour;
|
||||
}
|
||||
|
||||
public EnterRoomNewModel setRankHour(RankHourModel rankHour) {
|
||||
this.rankHour = rankHour;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NewPeopleTaskModel getNewPeopleTask() {
|
||||
return newPeopleTask;
|
||||
}
|
||||
|
||||
public EnterRoomNewModel setNewPeopleTask(NewPeopleTaskModel newPeopleTask) {
|
||||
this.newPeopleTask = newPeopleTask;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WishListModel getWishList() {
|
||||
return wishList;
|
||||
}
|
||||
|
||||
public EnterRoomNewModel setWishList(WishListModel wishList) {
|
||||
this.wishList = wishList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GuardUserModel getGuardUserAvatar() {
|
||||
return guardUserAvatar;
|
||||
}
|
||||
|
||||
public EnterRoomNewModel setGuardUserAvatar(GuardUserModel guardUserAvatar) {
|
||||
this.guardUserAvatar = guardUserAvatar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<ActiveModel> getActiveList() {
|
||||
return activeList;
|
||||
}
|
||||
|
||||
public EnterRoomNewModel setActiveList(List<ActiveModel> activeList) {
|
||||
this.activeList = activeList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsUseHotCard() {
|
||||
return isUseHotCard;
|
||||
}
|
||||
|
||||
public EnterRoomNewModel setIsUseHotCard(String isUseHotCard) {
|
||||
this.isUseHotCard = isUseHotCard;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
105
common/src/main/java/com/yunbao/common/bean/GiftModel.java
Normal file
105
common/src/main/java/com/yunbao/common/bean/GiftModel.java
Normal file
@@ -0,0 +1,105 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class GiftModel extends BaseModel{
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("sendtype")
|
||||
private String sendtype;
|
||||
@SerializedName("type")
|
||||
private String type;
|
||||
@SerializedName("mark")
|
||||
private String mark;
|
||||
@SerializedName("giftname")
|
||||
private String giftname;
|
||||
@SerializedName("needcoin")
|
||||
private String needcoin;
|
||||
@SerializedName("gifticon")
|
||||
private String gifticon;
|
||||
@SerializedName("swf")
|
||||
private String swf;
|
||||
@SerializedName("gift_uid")
|
||||
private String giftUid;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public GiftModel setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSendtype() {
|
||||
return sendtype;
|
||||
}
|
||||
|
||||
public GiftModel setSendtype(String sendtype) {
|
||||
this.sendtype = sendtype;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public GiftModel setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMark() {
|
||||
return mark;
|
||||
}
|
||||
|
||||
public GiftModel setMark(String mark) {
|
||||
this.mark = mark;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGiftname() {
|
||||
return giftname;
|
||||
}
|
||||
|
||||
public GiftModel setGiftname(String giftname) {
|
||||
this.giftname = giftname;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNeedcoin() {
|
||||
return needcoin;
|
||||
}
|
||||
|
||||
public GiftModel setNeedcoin(String needcoin) {
|
||||
this.needcoin = needcoin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGifticon() {
|
||||
return gifticon;
|
||||
}
|
||||
|
||||
public GiftModel setGifticon(String gifticon) {
|
||||
this.gifticon = gifticon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSwf() {
|
||||
return swf;
|
||||
}
|
||||
|
||||
public GiftModel setSwf(String swf) {
|
||||
this.swf = swf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGiftUid() {
|
||||
return giftUid;
|
||||
}
|
||||
|
||||
public GiftModel setGiftUid(String giftUid) {
|
||||
this.giftUid = giftUid;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
29
common/src/main/java/com/yunbao/common/bean/GuardModel.java
Normal file
29
common/src/main/java/com/yunbao/common/bean/GuardModel.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class GuardModel extends BaseModel {
|
||||
|
||||
@SerializedName("type")
|
||||
private String type;
|
||||
@SerializedName("endtime")
|
||||
private String endtime;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public GuardModel setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getEndtime() {
|
||||
return endtime;
|
||||
}
|
||||
|
||||
public GuardModel setEndtime(String endtime) {
|
||||
this.endtime = endtime;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class GuardUserModel extends BaseModel{
|
||||
|
||||
@SerializedName("guardUserAvatar")
|
||||
private String guardUserAvatar;
|
||||
@SerializedName("guardType")
|
||||
private String guardType;
|
||||
|
||||
public static GuardUserModel objectFromData(String str) {
|
||||
|
||||
return new Gson().fromJson(str, GuardUserModel.class);
|
||||
}
|
||||
|
||||
public String getGuardUserAvatar() {
|
||||
return guardUserAvatar;
|
||||
}
|
||||
|
||||
public void setGuardUserAvatar(String guardUserAvatar) {
|
||||
this.guardUserAvatar = guardUserAvatar;
|
||||
}
|
||||
|
||||
public String getGuardType() {
|
||||
return guardType;
|
||||
}
|
||||
|
||||
public void setGuardType(String guardType) {
|
||||
this.guardType = guardType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
|
||||
public class HttpCallbackModel extends BaseModel{
|
||||
private int code;
|
||||
private String msg;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
@@ -64,6 +66,7 @@ public class IMLoginModel extends BaseModel {
|
||||
* noble_name : 贵族
|
||||
* sex : 1
|
||||
* slide : [{"listorder":0,"slide_cid":4,"slide_content":"","slide_des":"首充特惠大禮包","slide_id":91,"slide_name":"首充特惠大禮包","slide_pic":"https://qny.shayucm.com/20220531/90f6942fb928c3034baeb380b9c4003d.gif","slide_status":1,"slide_url":"https://ceshi.yaoulive.com/h5/activity/firstTopUp/newUp.html"},{"listorder":0,"slide_cid":4,"slide_content":"","slide_des":"充值反饋活動","slide_id":88,"slide_name":"充值反饋活動","slide_pic":"https://qny.shayucm.com/20220511/faacb51d5a45f7ff24a6f0314df133fb.gif","slide_status":1,"slide_url":"https://ceshi.yaoulive.com/h5/GuildTournament/202204/Tournament.html"}]
|
||||
* slide : [{"listorder":0,"slide_cid":4,"slide_content":"","slide_des":"首充特惠大禮包","slide_id":91,"slide_name":"首充特惠大禮包","slide_pic":"https://qny.shayucm.com/20220531/90f6942fb928c3034baeb380b9c4003d.gif","slide_status":1,"slide_url":"https://ceshi.yaoulive.com/h5/activity/firstTopUp/newUp.html"},{"listorder":0,"slide_cid":4,"slide_content":"","slide_des":"充值反饋活動","slide_id":88,"slide_name":"充值反饋活動","slide_pic":"https://qny.shayucm.com/20220511/faacb51d5a45f7ff24a6f0314df133fb.gif","slide_status":1,"slide_url":"https://ceshi.yaoulive.com/h5/GuildTournament/202204/Tournament.html"}]
|
||||
* users_type : A
|
||||
* votes : 0.00
|
||||
* votestotal : 0
|
||||
@@ -222,6 +225,126 @@ public class IMLoginModel extends BaseModel {
|
||||
//超皇字体颜色
|
||||
@SerializedName("contentColor")
|
||||
private String contentColor = "";
|
||||
//创建时间
|
||||
@SerializedName("create_time")
|
||||
private String createTime = "";
|
||||
|
||||
@SerializedName("is_guess")
|
||||
private String isGuess = "";
|
||||
|
||||
@SerializedName("goodnum_expire_time")
|
||||
private String goodnumExpireTime = "";
|
||||
|
||||
@SerializedName("version")
|
||||
private String version = "";
|
||||
|
||||
@SerializedName("max_noble_end_time")
|
||||
private String maxNobleEndTime = "";
|
||||
|
||||
@SerializedName("custom_color_id")
|
||||
private String customColorId = "";
|
||||
|
||||
@SerializedName("is_chat")
|
||||
private String isChat = "";
|
||||
|
||||
@SerializedName("is_rong")
|
||||
private String isRong = "";
|
||||
|
||||
@SerializedName("contribution")
|
||||
private String contribution = "";
|
||||
|
||||
@SerializedName("guard_type")
|
||||
private String guardType = "";
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public IMLoginModel setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsGuess() {
|
||||
return isGuess;
|
||||
}
|
||||
|
||||
public IMLoginModel setIsGuess(String isGuess) {
|
||||
this.isGuess = isGuess;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGoodnumExpireTime() {
|
||||
return goodnumExpireTime;
|
||||
}
|
||||
|
||||
public IMLoginModel setGoodnumExpireTime(String goodnumExpireTime) {
|
||||
this.goodnumExpireTime = goodnumExpireTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public IMLoginModel setVersion(String version) {
|
||||
this.version = version;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMaxNobleEndTime() {
|
||||
return maxNobleEndTime;
|
||||
}
|
||||
|
||||
public IMLoginModel setMaxNobleEndTime(String maxNobleEndTime) {
|
||||
this.maxNobleEndTime = maxNobleEndTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCustomColorId() {
|
||||
return customColorId;
|
||||
}
|
||||
|
||||
public IMLoginModel setCustomColorId(String customColorId) {
|
||||
this.customColorId = customColorId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsChat() {
|
||||
return isChat;
|
||||
}
|
||||
|
||||
public IMLoginModel setIsChat(String isChat) {
|
||||
this.isChat = isChat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsRong() {
|
||||
return isRong;
|
||||
}
|
||||
|
||||
public IMLoginModel setIsRong(String isRong) {
|
||||
this.isRong = isRong;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getContribution() {
|
||||
return contribution;
|
||||
}
|
||||
|
||||
public IMLoginModel setContribution(String contribution) {
|
||||
this.contribution = contribution;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGuardType() {
|
||||
return guardType;
|
||||
}
|
||||
|
||||
public IMLoginModel setGuardType(String guardType) {
|
||||
this.guardType = guardType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNobleEndTime() {
|
||||
return nobleEndTime;
|
||||
@@ -679,6 +802,15 @@ public class IMLoginModel extends BaseModel {
|
||||
return usersType;
|
||||
}
|
||||
|
||||
/**
|
||||
* usersType ==C 是主播身份
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean anchorUserType() {
|
||||
return TextUtils.equals("C", usersType);
|
||||
}
|
||||
|
||||
public IMLoginModel setUsersType(String usersType) {
|
||||
this.usersType = usersType;
|
||||
return this;
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class LinkMicUserBean extends BaseModel {
|
||||
@SerializedName("user_nicename")
|
||||
private String uname;
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
@SerializedName("dress_avatar")
|
||||
private String dress_avatar;
|
||||
private String uid = "";
|
||||
private String action;
|
||||
@SerializedName("id")
|
||||
private String id;//连麦显示右侧头像时要用
|
||||
@SerializedName("level")
|
||||
private int level;
|
||||
@SerializedName("sex")
|
||||
private int sex;
|
||||
|
||||
public String getUname() {
|
||||
return uname;
|
||||
}
|
||||
|
||||
public void setUname(String uname) {
|
||||
this.uname = uname;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getDress_avatar() {
|
||||
return dress_avatar;
|
||||
}
|
||||
|
||||
public void setDress_avatar(String dress_avatar) {
|
||||
this.dress_avatar = dress_avatar;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public int getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(int sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LinkMicUserBean{" +
|
||||
"uname='" + uname + '\'' +
|
||||
", avatar='" + avatar + '\'' +
|
||||
", dress_avatar='" + dress_avatar + '\'' +
|
||||
", uid='" + uid + '\'' +
|
||||
", action='" + action + '\'' +
|
||||
", id='" + id + '\'' +
|
||||
", level=" + level +
|
||||
", sex=" + sex +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LinkMicUserBeanV2 extends BaseModel {
|
||||
private String roomuserid;
|
||||
private int status;
|
||||
private List<LinkMicUserBean> userlist;
|
||||
|
||||
public String getRoomuserid() {
|
||||
return roomuserid;
|
||||
}
|
||||
|
||||
public void setRoomuserid(String roomuserid) {
|
||||
this.roomuserid = roomuserid;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public List<LinkMicUserBean> getUserlist() {
|
||||
return userlist;
|
||||
}
|
||||
|
||||
public void setUserlist(List<LinkMicUserBean> userlist) {
|
||||
this.userlist = userlist;
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,10 @@ import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/8/9.
|
||||
@@ -53,6 +52,8 @@ public class LiveBean implements Parcelable {
|
||||
private String recommendCardIconSizeTwo = "";
|
||||
private String recommendCardIconSizeThree = "";
|
||||
|
||||
private Map<String,String> params;//用于跳转Activity时扩展参数,例:从首页Banner跳转到直播间时需要根据携带参数判断是否弹出新人特惠对话框
|
||||
|
||||
public String getRecommendCardIconSizeTwo() {
|
||||
return recommendCardIconSizeTwo;
|
||||
}
|
||||
@@ -83,6 +84,14 @@ public class LiveBean implements Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Map<String, String> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Map<String, String> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public String getRecommendcardtype() {
|
||||
return recommendCardtype;
|
||||
}
|
||||
@@ -378,27 +387,28 @@ public class LiveBean implements Parcelable {
|
||||
*/
|
||||
public String getLiangNameTip() {
|
||||
if (!TextUtils.isEmpty(this.goodNum) && !"0".equals(this.goodNum)) {
|
||||
return WordUtil.getString(R.string.live_liang) + ":" + this.goodNum;
|
||||
return this.goodNum;
|
||||
}
|
||||
return "ID:" + this.uid;
|
||||
return this.uid;
|
||||
}
|
||||
|
||||
public LiveBean() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private LiveBean(Parcel in) {
|
||||
this.uid = in.readString();
|
||||
this.avatar = in.readString();
|
||||
this.avatarThumb = in.readString();
|
||||
this.userNiceName = in.readString();
|
||||
this.sex = in.readInt();
|
||||
this.title = in.readString();
|
||||
this.city = in.readString();
|
||||
this.stream = in.readString();
|
||||
this.pull = in.readString();
|
||||
this.thumb = in.readString();
|
||||
this.nums = in.readString();
|
||||
this.sex = in.readInt();
|
||||
this.distance = in.readString();
|
||||
this.levelAnchor = in.readInt();
|
||||
this.type = in.readInt();
|
||||
@@ -406,6 +416,23 @@ public class LiveBean implements Parcelable {
|
||||
this.goodNum = in.readString();
|
||||
this.gameAction = in.readInt();
|
||||
this.game = in.readString();
|
||||
this.islive = in.readString();
|
||||
this.isTop = in.readString();
|
||||
this.pk_avatar_thumb = in.readString();
|
||||
this.landscape = in.readInt();
|
||||
this.hot_num = in.readString();
|
||||
this.content_pic_size_one = in.readString();
|
||||
this.content_pic_size_two = in.readString();
|
||||
this.content_pic_size_three = in.readString();
|
||||
this.is_week = in.readString();
|
||||
this.img = in.readString();
|
||||
this.url = in.readString();
|
||||
this.drpk_status = in.readString();
|
||||
this.is_rong = in.readInt();
|
||||
this.isattention = in.readString();
|
||||
this.recommendCardtype = in.readString();
|
||||
this.recommendCardIconSizeTwo = in.readString();
|
||||
this.recommendCardIconSizeThree = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -419,13 +446,13 @@ public class LiveBean implements Parcelable {
|
||||
dest.writeString(this.avatar);
|
||||
dest.writeString(this.avatarThumb);
|
||||
dest.writeString(this.userNiceName);
|
||||
dest.writeInt(this.sex);
|
||||
dest.writeString(this.title);
|
||||
dest.writeString(this.city);
|
||||
dest.writeString(this.stream);
|
||||
dest.writeString(this.pull);
|
||||
dest.writeString(this.thumb);
|
||||
dest.writeString(this.nums);
|
||||
dest.writeInt(this.sex);
|
||||
dest.writeString(this.distance);
|
||||
dest.writeInt(this.levelAnchor);
|
||||
dest.writeInt(this.type);
|
||||
@@ -433,6 +460,23 @@ public class LiveBean implements Parcelable {
|
||||
dest.writeString(this.goodNum);
|
||||
dest.writeInt(this.gameAction);
|
||||
dest.writeString(this.game);
|
||||
dest.writeString(this.islive);
|
||||
dest.writeString(this.isTop);
|
||||
dest.writeString(this.pk_avatar_thumb);
|
||||
dest.writeInt(this.landscape);
|
||||
dest.writeString(this.hot_num);
|
||||
dest.writeString(this.content_pic_size_one);
|
||||
dest.writeString(this.content_pic_size_two);
|
||||
dest.writeString(this.content_pic_size_three);
|
||||
dest.writeString(this.is_week);
|
||||
dest.writeString(this.img);
|
||||
dest.writeString(this.url);
|
||||
dest.writeString(this.drpk_status);
|
||||
dest.writeInt(this.is_rong);
|
||||
dest.writeString(this.isattention);
|
||||
dest.writeString(this.recommendCardtype);
|
||||
dest.writeString(this.recommendCardIconSizeTwo);
|
||||
dest.writeString(this.recommendCardIconSizeThree);
|
||||
}
|
||||
|
||||
public static final Creator<LiveBean> CREATOR = new Creator<LiveBean>() {
|
||||
|
||||
@@ -62,7 +62,7 @@ public class LiveInfoModel extends BaseModel {
|
||||
@SerializedName("islive")
|
||||
private long islive;
|
||||
@SerializedName("landscape")
|
||||
private long landscape = 0;
|
||||
private int landscape = 0;
|
||||
@SerializedName("is_rong")
|
||||
private long isRong = 0;
|
||||
@SerializedName("nums")
|
||||
@@ -208,11 +208,11 @@ public class LiveInfoModel extends BaseModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getLandscape() {
|
||||
public int getLandscape() {
|
||||
return landscape;
|
||||
}
|
||||
|
||||
public LiveInfoModel setLandscape(long landscape) {
|
||||
public LiveInfoModel setLandscape(int landscape) {
|
||||
this.landscape = landscape;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 活动列表
|
||||
*/
|
||||
public class LiveRoomActivityModel extends BaseModel {
|
||||
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("img")
|
||||
private String img;
|
||||
@SerializedName("link")
|
||||
private String link;
|
||||
@SerializedName("is_hidden")
|
||||
private String isHidden;
|
||||
@SerializedName("show_type")
|
||||
private String showType;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public LiveRoomActivityModel setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public LiveRoomActivityModel setImg(String img) {
|
||||
this.img = img;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
public LiveRoomActivityModel setLink(String link) {
|
||||
this.link = link;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsHidden() {
|
||||
return isHidden;
|
||||
}
|
||||
|
||||
public LiveRoomActivityModel setIsHidden(String isHidden) {
|
||||
this.isHidden = isHidden;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getShowType() {
|
||||
return showType;
|
||||
}
|
||||
|
||||
public LiveRoomActivityModel setShowType(String showType) {
|
||||
this.showType = showType;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/27.
|
||||
* 直播间用户列表实体类
|
||||
*/
|
||||
|
||||
public class LiveUserGiftBean extends UserBean {
|
||||
|
||||
private String contribution;
|
||||
private int guardType;
|
||||
private int nub;
|
||||
|
||||
public LiveUserGiftBean() {
|
||||
}
|
||||
|
||||
public int getNub() {
|
||||
return nub;
|
||||
}
|
||||
|
||||
public void setNub(int nub) {
|
||||
this.nub = nub;
|
||||
}
|
||||
|
||||
public String getContribution() {
|
||||
return contribution;
|
||||
}
|
||||
|
||||
public void setContribution(String contribution) {
|
||||
this.contribution = contribution;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否送过礼物
|
||||
*/
|
||||
public boolean hasContribution() {
|
||||
return !TextUtils.isEmpty(this.contribution) && !"0".equals(this.contribution);
|
||||
}
|
||||
|
||||
@JSONField(name = "guard_type")
|
||||
public int getGuardType() {
|
||||
return guardType;
|
||||
}
|
||||
|
||||
@JSONField(name = "guard_type")
|
||||
public void setGuardType(int guardType) {
|
||||
this.guardType = guardType;
|
||||
}
|
||||
|
||||
public LiveUserGiftBean(Parcel in) {
|
||||
super(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LiveUserGiftBean{" +
|
||||
"contribution='" + contribution + '\'' +
|
||||
", guardType=" + guardType +
|
||||
", nub=" + nub +
|
||||
", id='" + id + '\'' +
|
||||
", userNiceName='" + userNiceName + '\'' +
|
||||
", avatar='" + avatar + '\'' +
|
||||
", avatarThumb='" + avatarThumb + '\'' +
|
||||
", sex=" + sex +
|
||||
", signature='" + signature + '\'' +
|
||||
", coin='" + coin + '\'' +
|
||||
", gold='" + gold + '\'' +
|
||||
", votes='" + votes + '\'' +
|
||||
", consumption='" + consumption + '\'' +
|
||||
", votestotal='" + votestotal + '\'' +
|
||||
", province='" + province + '\'' +
|
||||
", city='" + city + '\'' +
|
||||
", location='" + location + '\'' +
|
||||
", birthday='" + birthday + '\'' +
|
||||
", level=" + level +
|
||||
", levelAnchor=" + levelAnchor +
|
||||
", lives=" + lives +
|
||||
", follows=" + follows +
|
||||
", fans=" + fans +
|
||||
", vip=" + vip +
|
||||
", liang=" + liang +
|
||||
", car=" + car +
|
||||
", medal_level=" + medal_level +
|
||||
", medal_name='" + medal_name + '\'' +
|
||||
", Dress=" + Dress +
|
||||
", noble_id='" + noble_id + '\'' +
|
||||
", yuanbao='" + yuanbao + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
23
common/src/main/java/com/yunbao/common/bean/LminfoModel.java
Normal file
23
common/src/main/java/com/yunbao/common/bean/LminfoModel.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class LminfoModel extends BaseModel{
|
||||
|
||||
@SerializedName("status")
|
||||
private int status;
|
||||
|
||||
public static LminfoModel objectFromData(String str) {
|
||||
|
||||
return new Gson().fromJson(str, LminfoModel.class);
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
package com.yunbao.live.bean;
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
public class MicUserBean {
|
||||
public class MicUserBean extends BaseModel{
|
||||
protected String id;
|
||||
protected String userNiceName;
|
||||
protected String avatar;
|
||||
protected int level;
|
||||
protected int sex;
|
||||
protected String dress_avatar;
|
||||
protected int type;
|
||||
|
||||
@JSONField(name = "dress_avatar")
|
||||
public String getDress_avatar() {
|
||||
@@ -65,4 +66,12 @@ public class MicUserBean {
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,17 @@ public class MsgModel extends BaseModel {
|
||||
private String taskName1;
|
||||
@SerializedName("taskName2")
|
||||
private String taskName2;
|
||||
@SerializedName("activityUrl")
|
||||
private String activityUrl;
|
||||
|
||||
public String getActivityUrl() {
|
||||
return activityUrl;
|
||||
}
|
||||
|
||||
public MsgModel setActivityUrl(String activityUrl) {
|
||||
this.activityUrl = activityUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 星级挑战成功IM消息
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yunbao.video.bean;
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 新用户等级牌
|
||||
*/
|
||||
public class NewLevelModel extends BaseModel {
|
||||
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("levelmin")
|
||||
private String levemin;
|
||||
@SerializedName("levelmax")
|
||||
private String levemax;
|
||||
@SerializedName("thumb")
|
||||
private String thumb;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public NewLevelModel setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLevemin() {
|
||||
return levemin;
|
||||
}
|
||||
|
||||
public int getLeveMin() {
|
||||
if (TextUtils.isEmpty(levemin)) {
|
||||
levemin = "0";
|
||||
}
|
||||
return Integer.parseInt(levemin);
|
||||
}
|
||||
|
||||
public int getLeveMax() {
|
||||
if (TextUtils.isEmpty(levemax)) {
|
||||
levemax = "0";
|
||||
}
|
||||
return Integer.parseInt(levemax);
|
||||
}
|
||||
|
||||
public NewLevelModel setLevemin(String levemin) {
|
||||
this.levemin = levemin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLevemax() {
|
||||
return levemax;
|
||||
}
|
||||
|
||||
public NewLevelModel setLevemax(String levemax) {
|
||||
this.levemax = levemax;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getThumb() {
|
||||
return thumb;
|
||||
}
|
||||
|
||||
public NewLevelModel setThumb(String thumb) {
|
||||
this.thumb = thumb;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class NewPeopleTaskModel extends BaseModel {
|
||||
|
||||
@SerializedName("task")
|
||||
private TaskModel task = new TaskModel();
|
||||
@SerializedName("gift")
|
||||
private GiftModel gift = new GiftModel();
|
||||
@SerializedName("reward_all")
|
||||
private RewardAllModel rewardAll = new RewardAllModel();
|
||||
@SerializedName("reward_one")
|
||||
private RewardAllModel rewardOne = new RewardAllModel();
|
||||
|
||||
public TaskModel getTask() {
|
||||
return task;
|
||||
}
|
||||
|
||||
public NewPeopleTaskModel setTask(TaskModel task) {
|
||||
this.task = task;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GiftModel getGift() {
|
||||
return gift;
|
||||
}
|
||||
|
||||
public NewPeopleTaskModel setGift(GiftModel gift) {
|
||||
this.gift = gift;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RewardAllModel getRewardAll() {
|
||||
return rewardAll;
|
||||
}
|
||||
|
||||
public NewPeopleTaskModel setRewardAll(RewardAllModel rewardAll) {
|
||||
this.rewardAll = rewardAll;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RewardAllModel getRewardOne() {
|
||||
return rewardOne;
|
||||
}
|
||||
|
||||
public NewPeopleTaskModel setRewardOne(RewardAllModel rewardOne) {
|
||||
this.rewardOne = rewardOne;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class PKTopThreeModel extends BaseModel {
|
||||
@SerializedName("uid")
|
||||
private String uid;
|
||||
@SerializedName("img")
|
||||
private String img;
|
||||
@SerializedName("liveuid")
|
||||
private String liveuid;
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public PKTopThreeModel setUid(String uid) {
|
||||
this.uid = uid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public PKTopThreeModel setImg(String img) {
|
||||
this.img = img;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLiveuid() {
|
||||
return liveuid;
|
||||
}
|
||||
|
||||
public PKTopThreeModel setLiveuid(String liveuid) {
|
||||
this.liveuid = liveuid;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
110
common/src/main/java/com/yunbao/common/bean/PkRankBean.java
Normal file
110
common/src/main/java/com/yunbao/common/bean/PkRankBean.java
Normal file
@@ -0,0 +1,110 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
/**
|
||||
* 直播间PK排位赛
|
||||
*/
|
||||
public class PkRankBean extends BaseModel {
|
||||
@SerializedName("anchor_id")
|
||||
public int id;
|
||||
@SerializedName("rank_name")
|
||||
public String name;
|
||||
@SerializedName("rank_img")
|
||||
public String img;
|
||||
@SerializedName("win_continuity1")
|
||||
public String redVal;
|
||||
@SerializedName("win_continuity2")
|
||||
public String blueVal;
|
||||
@SerializedName("pktt_img")
|
||||
public String pkTopImgUrl;
|
||||
@SerializedName("link")
|
||||
public String clickUrl;
|
||||
@SerializedName("vs_img")
|
||||
public String vsImgUrl;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public String getRedVal() {
|
||||
if (StringUtil.isEmpty(redVal)) {
|
||||
redVal = "0";
|
||||
}
|
||||
return redVal;
|
||||
}
|
||||
|
||||
public void setRedVal(String redVal) {
|
||||
this.redVal = redVal;
|
||||
}
|
||||
|
||||
public String getBlueVal() {
|
||||
if (StringUtil.isEmpty(blueVal)) {
|
||||
blueVal = "0";
|
||||
}
|
||||
return blueVal;
|
||||
}
|
||||
|
||||
public void setBlueVal(String blueVal) {
|
||||
this.blueVal = blueVal;
|
||||
}
|
||||
|
||||
public String getPkTopImgUrl() {
|
||||
return pkTopImgUrl;
|
||||
}
|
||||
|
||||
public void setPkTopImgUrl(String pkTopImgUrl) {
|
||||
this.pkTopImgUrl = pkTopImgUrl;
|
||||
}
|
||||
|
||||
public String getClickUrl() {
|
||||
return clickUrl;
|
||||
}
|
||||
|
||||
public void setClickUrl(String clickUrl) {
|
||||
this.clickUrl = clickUrl;
|
||||
}
|
||||
|
||||
public String getVsImgUrl() {
|
||||
return vsImgUrl;
|
||||
}
|
||||
|
||||
public void setVsImgUrl(String vsImgUrl) {
|
||||
this.vsImgUrl = vsImgUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PkRankBean{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", img='" + img + '\'' +
|
||||
", redVal='" + redVal + '\'' +
|
||||
", blueVal='" + blueVal + '\'' +
|
||||
", pkTopImgUrl='" + pkTopImgUrl + '\'' +
|
||||
", clickUrl='" + clickUrl + '\'' +
|
||||
", vsImgUrl='" + vsImgUrl + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class PkTopUsersModel extends BaseModel {
|
||||
@SerializedName("red_one")
|
||||
private PKTopThreeModel redOne;
|
||||
@SerializedName("red_two")
|
||||
private PKTopThreeModel redTwo;
|
||||
@SerializedName("red_three")
|
||||
private PKTopThreeModel redThree;
|
||||
@SerializedName("blue_one")
|
||||
private PKTopThreeModel blueOne;
|
||||
@SerializedName("blue_two")
|
||||
private PKTopThreeModel blueTwo;
|
||||
@SerializedName("blue_three")
|
||||
private PKTopThreeModel blueThree;
|
||||
}
|
||||
172
common/src/main/java/com/yunbao/common/bean/PkinfoModel.java
Normal file
172
common/src/main/java/com/yunbao/common/bean/PkinfoModel.java
Normal file
@@ -0,0 +1,172 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class PkinfoModel extends BaseModel {
|
||||
|
||||
@SerializedName("pkuid")
|
||||
private String pkuid;
|
||||
@SerializedName("pkuname")
|
||||
private String pkuname;
|
||||
@SerializedName("pkuimg")
|
||||
private String pkuimg;
|
||||
@SerializedName("pkpull")
|
||||
private String pkpull;
|
||||
@SerializedName("ifpk")
|
||||
private String ifpk;
|
||||
@SerializedName("pk_time")
|
||||
private String pkTime;
|
||||
@SerializedName("end_pk_time")
|
||||
private String endPkTime;
|
||||
@SerializedName("pk_gift_liveuid")
|
||||
private String pkGiftLiveuid;
|
||||
@SerializedName("pk_gift_pkuid")
|
||||
private String pkGiftPkuid;
|
||||
@SerializedName("anyway")
|
||||
private String anyway;
|
||||
@SerializedName("drpk_status")
|
||||
private String drpkStatus;
|
||||
@SerializedName("drpk_roomid")
|
||||
private String drpkRoomid;
|
||||
@SerializedName("drpk_time")
|
||||
private String drpkTime;
|
||||
@SerializedName("pk_top_users")
|
||||
private PkTopUsersModel pkTopUsers;
|
||||
@SerializedName("userlist")
|
||||
private JsonArray userlist;
|
||||
|
||||
public JsonArray getUserlist() {
|
||||
return userlist;
|
||||
}
|
||||
|
||||
public void setUserlist(JsonArray userlist) {
|
||||
this.userlist = userlist;
|
||||
}
|
||||
|
||||
public String getPkuid() {
|
||||
return pkuid;
|
||||
}
|
||||
|
||||
public PkinfoModel setPkuid(String pkuid) {
|
||||
this.pkuid = pkuid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPkuname() {
|
||||
return pkuname;
|
||||
}
|
||||
|
||||
public PkinfoModel setPkuname(String pkuname) {
|
||||
this.pkuname = pkuname;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPkuimg() {
|
||||
return pkuimg;
|
||||
}
|
||||
|
||||
public PkinfoModel setPkuimg(String pkuimg) {
|
||||
this.pkuimg = pkuimg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPkpull() {
|
||||
return pkpull;
|
||||
}
|
||||
|
||||
public PkinfoModel setPkpull(String pkpull) {
|
||||
this.pkpull = pkpull;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIfpk() {
|
||||
return ifpk;
|
||||
}
|
||||
|
||||
public PkinfoModel setIfpk(String ifpk) {
|
||||
this.ifpk = ifpk;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPkTime() {
|
||||
return pkTime;
|
||||
}
|
||||
|
||||
public PkinfoModel setPkTime(String pkTime) {
|
||||
this.pkTime = pkTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getEndPkTime() {
|
||||
return endPkTime;
|
||||
}
|
||||
|
||||
public PkinfoModel setEndPkTime(String endPkTime) {
|
||||
this.endPkTime = endPkTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPkGiftLiveuid() {
|
||||
return pkGiftLiveuid;
|
||||
}
|
||||
|
||||
public PkinfoModel setPkGiftLiveuid(String pkGiftLiveuid) {
|
||||
this.pkGiftLiveuid = pkGiftLiveuid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPkGiftPkuid() {
|
||||
return pkGiftPkuid;
|
||||
}
|
||||
|
||||
public PkinfoModel setPkGiftPkuid(String pkGiftPkuid) {
|
||||
this.pkGiftPkuid = pkGiftPkuid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAnyway() {
|
||||
return anyway;
|
||||
}
|
||||
|
||||
public PkinfoModel setAnyway(String anyway) {
|
||||
this.anyway = anyway;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDrpkStatus() {
|
||||
return drpkStatus;
|
||||
}
|
||||
|
||||
public PkinfoModel setDrpkStatus(String drpkStatus) {
|
||||
this.drpkStatus = drpkStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDrpkRoomid() {
|
||||
return drpkRoomid;
|
||||
}
|
||||
|
||||
public PkinfoModel setDrpkRoomid(String drpkRoomid) {
|
||||
this.drpkRoomid = drpkRoomid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDrpkTime() {
|
||||
return drpkTime;
|
||||
}
|
||||
|
||||
public PkinfoModel setDrpkTime(String drpkTime) {
|
||||
this.drpkTime = drpkTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PkTopUsersModel getPkTopUsers() {
|
||||
return pkTopUsers;
|
||||
}
|
||||
|
||||
public PkinfoModel setPkTopUsers(PkTopUsersModel pkTopUsers) {
|
||||
this.pkTopUsers = pkTopUsers;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 随机PK UserBean
|
||||
*/
|
||||
public class RandomPkUserBean extends UserBean {
|
||||
@SerializedName("is_pk")
|
||||
private int pk;
|
||||
@SerializedName("isattention")
|
||||
private String attention;
|
||||
@SerializedName("user_nicename")
|
||||
private String userNiceName;
|
||||
|
||||
public RandomPkUserBean() {
|
||||
}
|
||||
|
||||
public boolean isPk() {
|
||||
return pk==1;
|
||||
}
|
||||
|
||||
public boolean isAttention() {
|
||||
return attention.equals("1");
|
||||
}
|
||||
|
||||
public String getAttention() {
|
||||
return attention;
|
||||
}
|
||||
|
||||
public void setAttention(String attention) {
|
||||
this.attention = attention;
|
||||
}
|
||||
|
||||
public int getPk() {
|
||||
return pk;
|
||||
}
|
||||
|
||||
public void setPk(int pk) {
|
||||
this.pk = pk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserNiceName() {
|
||||
return userNiceName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserNiceName(String userNiceName) {
|
||||
this.userNiceName = userNiceName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RandomPkUserBean{" +
|
||||
"pk=" + pk +
|
||||
", attention='" + attention + '\'' +
|
||||
", userNiceName='" + userNiceName + '\'' +
|
||||
", id='" + id + '\'' +
|
||||
", userNiceName='" + userNiceName + '\'' +
|
||||
", avatar='" + avatar + '\'' +
|
||||
", avatarThumb='" + avatarThumb + '\'' +
|
||||
", sex=" + sex +
|
||||
", signature='" + signature + '\'' +
|
||||
", coin='" + coin + '\'' +
|
||||
", gold='" + gold + '\'' +
|
||||
", votes='" + votes + '\'' +
|
||||
", consumption='" + consumption + '\'' +
|
||||
", votestotal='" + votestotal + '\'' +
|
||||
", province='" + province + '\'' +
|
||||
", city='" + city + '\'' +
|
||||
", location='" + location + '\'' +
|
||||
", birthday='" + birthday + '\'' +
|
||||
", level=" + level +
|
||||
", levelAnchor=" + levelAnchor +
|
||||
", lives=" + lives +
|
||||
", follows=" + follows +
|
||||
", fans=" + fans +
|
||||
", vip=" + vip +
|
||||
", liang=" + liang +
|
||||
", car=" + car +
|
||||
", medal_level=" + medal_level +
|
||||
", medal_name='" + medal_name + '\'' +
|
||||
", Dress=" + Dress +
|
||||
", noble_id='" + noble_id + '\'' +
|
||||
", yuanbao='" + yuanbao + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class RankHourModel extends BaseModel {
|
||||
@SerializedName("liveuid")
|
||||
private String liveuid;
|
||||
@SerializedName("hourchart_h5_url")
|
||||
private String hourchartH5Url;
|
||||
@SerializedName("rank")
|
||||
private String rank;
|
||||
@SerializedName("starlightVal")
|
||||
private String starlightVal;
|
||||
@SerializedName("isshow")
|
||||
private String isshow;
|
||||
|
||||
public String getLiveuid() {
|
||||
return liveuid;
|
||||
}
|
||||
|
||||
public RankHourModel setLiveuid(String liveuid) {
|
||||
this.liveuid = liveuid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getHourchartH5Url() {
|
||||
return hourchartH5Url;
|
||||
}
|
||||
|
||||
public RankHourModel setHourchartH5Url(String hourchartH5Url) {
|
||||
this.hourchartH5Url = hourchartH5Url;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRank() {
|
||||
return rank;
|
||||
}
|
||||
|
||||
public RankHourModel setRank(String rank) {
|
||||
this.rank = rank;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getStarlightVal() {
|
||||
return starlightVal;
|
||||
}
|
||||
|
||||
public RankHourModel setStarlightVal(String starlightVal) {
|
||||
this.starlightVal = starlightVal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsshow() {
|
||||
return isshow;
|
||||
}
|
||||
|
||||
public RankHourModel setIsshow(String isshow) {
|
||||
this.isshow = isshow;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
128
common/src/main/java/com/yunbao/common/bean/RankPkInfoBean.java
Normal file
128
common/src/main/java/com/yunbao/common/bean/RankPkInfoBean.java
Normal file
@@ -0,0 +1,128 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
public class RankPkInfoBean extends BaseModel {
|
||||
private int id;
|
||||
@SerializedName("start_time")
|
||||
private String startTime;
|
||||
@SerializedName("end_time")
|
||||
private String endTime;
|
||||
@SerializedName("pk_start_hour1")
|
||||
private String pkStartHour1;
|
||||
@SerializedName("pk_end_hour1")
|
||||
private String pkEndHour1;
|
||||
@SerializedName("pk_start_hour2")
|
||||
private String pkStartHour2;
|
||||
@SerializedName("pk_end_hour2")
|
||||
private String pkEndHour2;
|
||||
|
||||
public RankPkInfoBean() {
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getPkStartHour1() {
|
||||
return pkStartHour1;
|
||||
}
|
||||
|
||||
public void setPkStartHour1(String pkStartHour1) {
|
||||
this.pkStartHour1 = pkStartHour1;
|
||||
}
|
||||
|
||||
public String getPkEndHour1() {
|
||||
return pkEndHour1;
|
||||
}
|
||||
|
||||
public void setPkEndHour1(String pkEndHour1) {
|
||||
this.pkEndHour1 = pkEndHour1;
|
||||
}
|
||||
|
||||
public String getPkStartHour2() {
|
||||
return pkStartHour2;
|
||||
}
|
||||
|
||||
public void setPkStartHour2(String pkStartHour2) {
|
||||
this.pkStartHour2 = pkStartHour2;
|
||||
}
|
||||
|
||||
public String getPkEndHour2() {
|
||||
return pkEndHour2;
|
||||
}
|
||||
|
||||
public void setPkEndHour2(String pkEndHour2) {
|
||||
this.pkEndHour2 = pkEndHour2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否在排位赛时间范围内
|
||||
*/
|
||||
public boolean isRankPKTime() {
|
||||
try {
|
||||
Date now =new Date();
|
||||
Date startDate = simpleDateToDate(startTime, "yyyy-MM-dd HH:mm:ss");
|
||||
Date endDate = simpleDateToDate(endTime, "yyyy-MM-dd HH:mm:ss");
|
||||
if (startDate == null || endDate == null) {
|
||||
return false;
|
||||
}
|
||||
Calendar calendarStart = Calendar.getInstance(Locale.CHINA);
|
||||
Calendar calendarEnd = Calendar.getInstance(Locale.CHINA);
|
||||
Calendar calendarNow = Calendar.getInstance(Locale.CHINA);
|
||||
calendarNow.setTime(now);
|
||||
calendarStart.setTime(startDate);
|
||||
calendarEnd.setTime(endDate);
|
||||
if (calendarStart.before(calendarNow) && calendarEnd.after(calendarNow)) {
|
||||
calendarNow.setTime(simpleDateToDate(dateToSimpleDate(now,"HH:mm:ss"),"HH:mm:ss"));
|
||||
calendarStart.setTime(simpleDateToDate(pkStartHour1, "HH:mm:ss"));
|
||||
calendarEnd.setTime(simpleDateToDate(pkEndHour1, "HH:mm:ss"));
|
||||
if (calendarStart.before(calendarNow) && calendarEnd.after(calendarNow)) {
|
||||
return true;
|
||||
} else {
|
||||
calendarNow.setTime(simpleDateToDate(dateToSimpleDate(now,"HH:mm:ss"),"HH:mm:ss"));
|
||||
calendarStart.setTime(simpleDateToDate(pkStartHour2, "HH:mm:ss"));
|
||||
calendarEnd.setTime(simpleDateToDate(pkEndHour2, "HH:mm:ss"));
|
||||
return calendarStart.before(calendarNow) && calendarEnd.after(calendarNow);
|
||||
}
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private Date simpleDateToDate(String time, String pattern) throws ParseException {
|
||||
return new SimpleDateFormat(pattern, Locale.CHINA).parse(time);
|
||||
}
|
||||
private String dateToSimpleDate(Date date,String pattern){
|
||||
return new SimpleDateFormat(pattern,Locale.CHINA).format(date);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yunbao.live.bean;
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
public class ReportCommunityBean {
|
||||
String dynamic_id;
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class RewardAllModel extends BaseModel{
|
||||
@SerializedName("gold")
|
||||
private String gold;
|
||||
@SerializedName("experience")
|
||||
private String experience;
|
||||
|
||||
public String getGold() {
|
||||
return gold;
|
||||
}
|
||||
|
||||
public RewardAllModel setGold(String gold) {
|
||||
this.gold = gold;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getExperience() {
|
||||
return experience;
|
||||
}
|
||||
|
||||
public RewardAllModel setExperience(String experience) {
|
||||
this.experience = experience;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
50
common/src/main/java/com/yunbao/common/bean/TaskModel.java
Normal file
50
common/src/main/java/com/yunbao/common/bean/TaskModel.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class TaskModel extends BaseModel{
|
||||
@SerializedName("uid")
|
||||
private String uid;
|
||||
@SerializedName("attent")
|
||||
private String attent;
|
||||
@SerializedName("illumine")
|
||||
private String illumine;
|
||||
@SerializedName("sendgift")
|
||||
private String sendgift;
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public TaskModel setUid(String uid) {
|
||||
this.uid = uid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAttent() {
|
||||
return attent;
|
||||
}
|
||||
|
||||
public TaskModel setAttent(String attent) {
|
||||
this.attent = attent;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIllumine() {
|
||||
return illumine;
|
||||
}
|
||||
|
||||
public TaskModel setIllumine(String illumine) {
|
||||
this.illumine = illumine;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSendgift() {
|
||||
return sendgift;
|
||||
}
|
||||
|
||||
public TaskModel setSendgift(String sendgift) {
|
||||
this.sendgift = sendgift;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/8/14.
|
||||
@@ -56,8 +57,30 @@ public class UserBean implements Parcelable {
|
||||
private String mobile;
|
||||
private String front_task;
|
||||
private String is_admin;
|
||||
@SerializedName("user_love_num")
|
||||
private int praise;
|
||||
//是否隐藏
|
||||
private boolean isHide = false;
|
||||
//是否为随机PK,仅在主播PK时使用
|
||||
private boolean randomPk;
|
||||
//随机天梯排位赛PK img,仅在主播PK时使用
|
||||
private String mRankPkImgUrl;
|
||||
|
||||
public boolean isRandomPk() {
|
||||
return randomPk;
|
||||
}
|
||||
|
||||
public void setRandomPk(boolean randomPk) {
|
||||
this.randomPk = randomPk;
|
||||
}
|
||||
|
||||
public String getRankPkImgUrl() {
|
||||
return mRankPkImgUrl;
|
||||
}
|
||||
|
||||
public void setRankPkImgUrl(String mRankPkImgUrl) {
|
||||
this.mRankPkImgUrl = mRankPkImgUrl;
|
||||
}
|
||||
|
||||
public boolean isHide() {
|
||||
return isHide;
|
||||
@@ -363,6 +386,14 @@ public class UserBean implements Parcelable {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int getPraise() {
|
||||
return praise;
|
||||
}
|
||||
|
||||
public void setPraise(int praise) {
|
||||
this.praise = praise;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.yunbao.video.bean;
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/10/25.
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WishListModel extends BaseModel {
|
||||
@SerializedName("wishList")
|
||||
private List<WishModel> wishList;
|
||||
@SerializedName("img")
|
||||
private String img;
|
||||
|
||||
public List<WishModel> getWishList() {
|
||||
return wishList;
|
||||
}
|
||||
|
||||
public WishListModel setWishList(List<WishModel> wishList) {
|
||||
this.wishList = wishList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public WishListModel setImg(String img) {
|
||||
this.img = img;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
106
common/src/main/java/com/yunbao/common/bean/WishModel.java
Normal file
106
common/src/main/java/com/yunbao/common/bean/WishModel.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class WishModel extends BaseModel {
|
||||
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("dtime")
|
||||
private String dtime;
|
||||
@SerializedName("luid")
|
||||
private String luid;
|
||||
@SerializedName("lid")
|
||||
private String lid;
|
||||
@SerializedName("wishlist_icon")
|
||||
private String wishlistIcon;
|
||||
@SerializedName("wishlist_num")
|
||||
private String wishlistNum;
|
||||
@SerializedName("wishlist_progress")
|
||||
private String wishlistProgress;
|
||||
@SerializedName("wishlist_name")
|
||||
private String wishlistName;
|
||||
@SerializedName("create_time")
|
||||
private String createTime;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public WishModel setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDtime() {
|
||||
return dtime;
|
||||
}
|
||||
|
||||
public WishModel setDtime(String dtime) {
|
||||
this.dtime = dtime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLuid() {
|
||||
return luid;
|
||||
}
|
||||
|
||||
public WishModel setLuid(String luid) {
|
||||
this.luid = luid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLid() {
|
||||
return lid;
|
||||
}
|
||||
|
||||
public WishModel setLid(String lid) {
|
||||
this.lid = lid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getWishlistIcon() {
|
||||
return wishlistIcon;
|
||||
}
|
||||
|
||||
public WishModel setWishlistIcon(String wishlistIcon) {
|
||||
this.wishlistIcon = wishlistIcon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getWishlistNum() {
|
||||
return wishlistNum;
|
||||
}
|
||||
|
||||
public WishModel setWishlistNum(String wishlistNum) {
|
||||
this.wishlistNum = wishlistNum;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getWishlistProgress() {
|
||||
return wishlistProgress;
|
||||
}
|
||||
|
||||
public WishModel setWishlistProgress(String wishlistProgress) {
|
||||
this.wishlistProgress = wishlistProgress;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getWishlistName() {
|
||||
return wishlistName;
|
||||
}
|
||||
|
||||
public WishModel setWishlistName(String wishlistName) {
|
||||
this.wishlistName = wishlistName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public WishModel setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,16 @@ import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.yunbao.common.utils.ClickUtil;
|
||||
|
||||
@@ -34,7 +37,7 @@ public abstract class AbsDialogFragment extends DialogFragment {
|
||||
} else {
|
||||
mRootView = LayoutInflater.from(mContext).inflate(getLayoutId(), null);
|
||||
}
|
||||
final Dialog dialog = new Dialog(mContext, getDialogStyle());
|
||||
Dialog dialog = new Dialog(mContext, getDialogStyle());
|
||||
dialog.setContentView(mRootView);
|
||||
dialog.setCancelable(canCancel());
|
||||
dialog.setCanceledOnTouchOutside(canCancel());
|
||||
@@ -74,4 +77,12 @@ public abstract class AbsDialogFragment extends DialogFragment {
|
||||
return ClickUtil.canClick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(@NonNull FragmentManager manager, @Nullable String tag) {
|
||||
try {
|
||||
super.show(manager, tag);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,11 @@ import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
@@ -77,6 +82,15 @@ public class HintDialog extends AbsDialogFragment {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(@NonNull FragmentManager manager, @Nullable String tag) {
|
||||
try {
|
||||
super.show(manager, tag);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private HintListener listener;
|
||||
|
||||
public HintDialog setListener(HintListener listener) {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_cn;
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_us;
|
||||
import static com.yunbao.common.CommonAppContext.lang;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
@@ -12,30 +16,14 @@ import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.adjust.sdk.AdjustEvent;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.event.InstructorOperationEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_cn;
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_us;
|
||||
import static com.yunbao.common.CommonAppContext.lang;
|
||||
|
||||
public class InstructorOperationDialog extends AbsDialogFragment {
|
||||
|
||||
@Override
|
||||
@@ -96,40 +84,16 @@ public class InstructorOperationDialog extends AbsDialogFragment {
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
ImageView to_msg = mRootView.findViewById(R.id.to_msg);
|
||||
if(lang.equals("english")){
|
||||
ImgLoader.display(mContext,home_zdy_img_us, to_msg);
|
||||
}else{
|
||||
ImgLoader.display(mContext,home_zdy_img_cn, to_msg);
|
||||
if (lang.equals("english")) {
|
||||
ImgLoader.display(mContext, home_zdy_img_us, to_msg);
|
||||
} else {
|
||||
ImgLoader.display(mContext, home_zdy_img_cn, to_msg);
|
||||
}
|
||||
|
||||
|
||||
mRootView.findViewById(R.id.to_msg).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("82nzkz");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
CommonHttpUtil.setAdvertisingChannels("82nzkz", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
FirebaseAnalytics.getInstance(mContext).logEvent("FS_director_enter", null);
|
||||
AppEventsLogger.newLogger(mContext).logEvent("FB_director_enter");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AdjustEvent adjustEvent2 = new AdjustEvent("ykpmj8");
|
||||
Adjust.trackEvent(adjustEvent2);
|
||||
CommonHttpUtil.setAdvertisingChannels("ykpmj8", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
FirebaseAnalytics.getInstance(mContext).logEvent("FS_director_message_box", null);
|
||||
AppEventsLogger.newLogger(mContext).logEvent("FB_director_message_box");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
EventBus.getDefault().post(new InstructorOperationEvent());
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class CustomDrawerPopupEvent extends BaseModel {
|
||||
//是否关闭弹窗
|
||||
private boolean isDisMiss = false;
|
||||
//权益的名字
|
||||
private String rightsInterests = "";
|
||||
//活动的id
|
||||
private int activityId = 0;
|
||||
//跳转网页地址
|
||||
private String htmlUrl;
|
||||
//是否半屏展示
|
||||
private boolean screen = false;
|
||||
//系统消息
|
||||
private boolean systemNotice = false;
|
||||
//在线客服
|
||||
private boolean online = false;
|
||||
//举报
|
||||
private boolean reportLayout = false;
|
||||
//刷新
|
||||
private boolean refresh = false;
|
||||
|
||||
public boolean isRefresh() {
|
||||
return refresh;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupEvent setRefresh(boolean refresh) {
|
||||
this.refresh = refresh;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSystemNotice() {
|
||||
return systemNotice;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupEvent setSystemNotice(boolean systemNotice) {
|
||||
this.systemNotice = systemNotice;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isOnline() {
|
||||
return online;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupEvent setOnline(boolean online) {
|
||||
this.online = online;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isReportLayout() {
|
||||
return reportLayout;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupEvent setReportLayout(boolean reportLayout) {
|
||||
this.reportLayout = reportLayout;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getHtmlUrl() {
|
||||
return htmlUrl;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupEvent setHtmlUrl(String htmlUrl) {
|
||||
this.htmlUrl = htmlUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isScreen() {
|
||||
return screen;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupEvent setScreen(boolean screen) {
|
||||
this.screen = screen;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupEvent setActivityId(int activityId) {
|
||||
this.activityId = activityId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRightsInterests() {
|
||||
return rightsInterests;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupEvent setRightsInterests(String rightsInterests) {
|
||||
this.rightsInterests = rightsInterests;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isDisMiss() {
|
||||
return isDisMiss;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupEvent setDisMiss(boolean disMiss) {
|
||||
isDisMiss = disMiss;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.VideoBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class JavascriptInterfaceEvent extends BaseModel {
|
||||
private String method = "";
|
||||
private String svg = "";
|
||||
private String postsId = "";
|
||||
private String isClose;
|
||||
private List<VideoBean> videoBeanList = new ArrayList<>();
|
||||
private int position;
|
||||
private String liveId;
|
||||
private String userId;
|
||||
private int indexInto;
|
||||
private String productId;
|
||||
private String orderNumber;
|
||||
private String moneyUsd;
|
||||
private boolean isUpdataUser;
|
||||
private String data;
|
||||
private String name;
|
||||
private String image;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setImage(String image) {
|
||||
this.image = image;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setData(String data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isUpdataUser() {
|
||||
return isUpdataUser;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setUpdataUser(boolean updataUser) {
|
||||
isUpdataUser = updataUser;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setProductId(String productId) {
|
||||
this.productId = productId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getOrderNumber() {
|
||||
return orderNumber;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setOrderNumber(String orderNumber) {
|
||||
this.orderNumber = orderNumber;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMoneyUsd() {
|
||||
return moneyUsd;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setMoneyUsd(String moneyUsd) {
|
||||
this.moneyUsd = moneyUsd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getIndexInto() {
|
||||
return indexInto;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setIndexInto(int indexInto) {
|
||||
this.indexInto = indexInto;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLiveId() {
|
||||
return liveId;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setLiveId(String liveId) {
|
||||
this.liveId = liveId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<VideoBean> getVideoBeanList() {
|
||||
return videoBeanList;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setVideoBeanList(List<VideoBean> videoBeanList) {
|
||||
this.videoBeanList = videoBeanList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setPosition(int position) {
|
||||
this.position = position;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsClose() {
|
||||
return isClose;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setIsClose(String isClose) {
|
||||
this.isClose = isClose;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPostsId() {
|
||||
return postsId;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setPostsId(String postsId) {
|
||||
this.postsId = postsId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSvg() {
|
||||
return svg;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setSvg(String svg) {
|
||||
this.svg = svg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceEvent setMethod(String method) {
|
||||
this.method = method;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yunbao.main.event;
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ImgLoader {
|
||||
private static final boolean SKIP_MEMORY_CACHE = true;
|
||||
|
||||
private static BlurTransformation sBlurTransformation;
|
||||
private final static float thumbnail = 0.1f;
|
||||
private final static float thumbnail = 1.0f;
|
||||
|
||||
static {
|
||||
sBlurTransformation = new BlurTransformation(25);
|
||||
@@ -70,9 +70,8 @@ public class ImgLoader {
|
||||
}
|
||||
RequestBuilder<Drawable> builder = Glide.with(context)
|
||||
.load(url)
|
||||
|
||||
|
||||
.thumbnail(thumbnail)
|
||||
.dontAnimate()
|
||||
.placeholder(imageView.getDrawable());
|
||||
if (width != -1 && height != -1) {
|
||||
builder = builder.override(width, height);
|
||||
@@ -87,7 +86,21 @@ public class ImgLoader {
|
||||
Glide.with(context)
|
||||
.asDrawable()
|
||||
.load(url)
|
||||
|
||||
|
||||
.thumbnail(thumbnail)
|
||||
.placeholder(imageView.getDrawable())
|
||||
.dontAnimate()
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
public static void display2(Context context, Drawable drawable, ImageView imageView) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context)
|
||||
.asDrawable()
|
||||
.load(drawable)
|
||||
.thumbnail(thumbnail)
|
||||
.placeholder(imageView.getDrawable())
|
||||
.dontAnimate()
|
||||
@@ -142,7 +155,7 @@ public class ImgLoader {
|
||||
RequestBuilder<Drawable> builder = Glide.with(context)
|
||||
.load(url)
|
||||
.thumbnail(thumbnail)
|
||||
|
||||
|
||||
.error(R.mipmap.icon_avatar_placeholder);
|
||||
if (width != -1 && height != -1) {
|
||||
builder = builder.override(width, height);
|
||||
@@ -165,7 +178,7 @@ public class ImgLoader {
|
||||
Glide.with(context)
|
||||
.asDrawable()
|
||||
.load(file)
|
||||
|
||||
|
||||
.thumbnail(thumbnail)
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(imageView);
|
||||
@@ -178,7 +191,7 @@ public class ImgLoader {
|
||||
Glide.with(context)
|
||||
.asDrawable()
|
||||
.load(res)
|
||||
|
||||
|
||||
.thumbnail(thumbnail)
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(imageView);
|
||||
|
||||
@@ -63,9 +63,9 @@ public class API extends BaseApi {
|
||||
loggingInterceptor.setPrintLevel(HttpLoggingInterceptor.Level.BODY);
|
||||
OkHttpClient.Builder builder = new OkHttpClient()
|
||||
.newBuilder()
|
||||
|
||||
.addInterceptor(initQuery(isNeedUid,CommonAppContext.sInstance.getApplicationContext()))
|
||||
.addInterceptor(loggingInterceptor);
|
||||
|
||||
return create(builder.build(),
|
||||
GsonConverterFactory.create(gson), RxJava2CallAdapterFactory.create(), CommonAppConfig.HOST, PDLiveApi.class);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.callback.StringCallback;
|
||||
@@ -18,6 +18,7 @@ import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.event.FollowEvent;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.NewLevelManager;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.MD5Util;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
@@ -190,6 +191,14 @@ public class CommonHttpUtil {
|
||||
if (obj.containsKey("is_chat")) {
|
||||
IMLoginManager.get(context).initChat(String.valueOf(obj.getInteger("is_chat")));
|
||||
}
|
||||
if (obj.containsKey("level_new")) {//缓存等级数据
|
||||
JSONArray levelArray = obj.getJSONArray("level_new");
|
||||
new NewLevelManager(context).UpDataLevel(levelArray.toJSONString());
|
||||
}
|
||||
if (obj.containsKey("levelanchor_new")) {//缓存等级数据
|
||||
JSONArray levelArray = obj.getJSONArray("levelanchor_new");
|
||||
new NewLevelManager(context).UpAnchorDataLevel(levelArray.toJSONString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage();
|
||||
ErrorActivity.forward("GetConfig接口返回数据异常", error);
|
||||
@@ -411,14 +420,14 @@ public class CommonHttpUtil {
|
||||
.params("touid", touid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
//埋点唯一性
|
||||
public static void setAdvertisingChannels(String operation, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Tx.setAdvertisingChannels", CommonHttpConsts.GET_USER_BASEINFO)
|
||||
.params("operation", operation)
|
||||
.params("marking", Adjust.getAdid())
|
||||
.execute(callback);
|
||||
}
|
||||
//
|
||||
// //埋点唯一性
|
||||
// public static void setAdvertisingChannels(String operation, HttpCallback callback) {
|
||||
// HttpClient.getInstance().get("Tx.setAdvertisingChannels", CommonHttpConsts.GET_USER_BASEINFO)
|
||||
// .params("operation", operation)
|
||||
// .params("marking", Adjust.getAdid())
|
||||
// .execute(callback);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,16 +3,23 @@ package com.yunbao.common.http;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
import com.yunbao.common.bean.ContributeModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
import com.yunbao.common.bean.FaceBookUpModel;
|
||||
import com.yunbao.common.bean.HourRank;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LinkMicUserBeanV2;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.MsgSwitchDetailModel;
|
||||
import com.yunbao.common.bean.NewPeopleInfo;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.bean.SearchModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
@@ -169,10 +176,10 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<List<ActiveModel>>> getActiveList();
|
||||
|
||||
/**
|
||||
* 获取活动
|
||||
* 获取多人连麦列表
|
||||
*/
|
||||
@GET("/api/public/?service=live.getDrLm")
|
||||
Observable<ResponseModel<List<ActiveModel>>> getDrLm();
|
||||
Observable<ResponseModel<List<LinkMicUserBeanV2>>> getDrLm(@Query("uid") String uid);
|
||||
|
||||
/**
|
||||
* 获取日榜、周榜数据
|
||||
@@ -236,7 +243,8 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<NobleRankHideUserListModel>> getNobleRankHideUserList();
|
||||
|
||||
/**
|
||||
*获取当前星级
|
||||
* 获取当前星级
|
||||
*
|
||||
* @param liveUid
|
||||
* @return
|
||||
*/
|
||||
@@ -248,4 +256,141 @@ public interface PDLiveApi {
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getLiveRoomActivtyBanner")
|
||||
Observable<ResponseModel<List<LiveRoomActivityBanner>>> getLiveRoomActivityBanner();
|
||||
|
||||
/**
|
||||
* 新侧边栏请求
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getCustomSidebarInfo")
|
||||
Observable<ResponseModel<List<CustomSidebarInfoModel>>> getCustomSidebarInfo();
|
||||
|
||||
/**
|
||||
* 任务领取接口
|
||||
*/
|
||||
@GET("/api/public/?service=Task.sendTaskGift")
|
||||
Observable<ResponseModel<List<Observable>>> sendTaskGift(@Query("flag") String flag, @Query("type") String type);
|
||||
|
||||
/**
|
||||
* PK排位赛接口
|
||||
*/
|
||||
@GET("/api/public/?service=Ranking.getAnchorRankData")
|
||||
Observable<ResponseModel<PkRankBean>> getPkRanksList(@Query("anchor_id") String anchorId, @Query("anchor_id2") String pkUid);
|
||||
|
||||
/**
|
||||
* 多人连麦-创建房间
|
||||
*/
|
||||
@GET("/api/public/?service=Live.createDrLm")
|
||||
Observable<ResponseModel<BaseModel>> createDrLm();
|
||||
|
||||
/**
|
||||
* 多人连麦-关闭房间
|
||||
*/
|
||||
@GET("/api/public/?service=Live.delDrLm")
|
||||
Observable<ResponseModel<BaseModel>> delDrLm();
|
||||
|
||||
/**
|
||||
* 多人连麦-踢出用户
|
||||
*
|
||||
* @param uid 对方uid
|
||||
* @param roomId 当前房间号
|
||||
*/
|
||||
@GET("/api/public/?service=Live.killDrLm")
|
||||
Observable<ResponseModel<BaseModel>> killDrLm(@Query("uid") String uid, @Query("roomid") String roomId);
|
||||
|
||||
/**
|
||||
* 新进入房间接口
|
||||
*
|
||||
* @param groupId 房间名 g+liveUid
|
||||
* @param stream
|
||||
* @param liveUid
|
||||
* @param city
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Live.enterRoomNew")
|
||||
Observable<ResponseModel<EnterRoomNewModel>> enterRoomNew(
|
||||
@Query("GroupId") String groupId,
|
||||
@Query("stream") String stream,
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("city") String city
|
||||
);
|
||||
|
||||
/**
|
||||
* 检查直播间状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Live.checkLive")
|
||||
Observable<ResponseModel<List<CheckLiveModel>>> checkLive(
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("stream") String stream
|
||||
);
|
||||
|
||||
/**
|
||||
* 加入房间推送Im欢迎语
|
||||
*/
|
||||
@GET("/api/public/?service=Tx.userJoinRoomNew")
|
||||
Observable<ResponseModel<String>> userJoinRoomNew(
|
||||
@Query("GroupId") String GroupId,
|
||||
@Query("stream") String stream
|
||||
);
|
||||
|
||||
/**
|
||||
* 加入房间推送Im欢迎语
|
||||
*/
|
||||
@GET("/api/public/?service=Tx.leaveRoomNew")
|
||||
Observable<ResponseModel<List<Object>>> leaveRoomNew(
|
||||
@Query("GroupId") String GroupId,
|
||||
@Query("stream") String stream
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取随机PK开关
|
||||
*
|
||||
* @return 1=开,0=关
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.getRandomPKType")
|
||||
Observable<ResponseModel<List<Integer>>> getRandomPkSwitch();
|
||||
|
||||
/**
|
||||
* 设置随机PK开关
|
||||
* @param pk 1=开,0=关
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.setRandomPKType")
|
||||
Observable<ResponseModel<List<BaseModel>>> changeRandomPkSwitch(@Query("random_pk") int pk);
|
||||
/**
|
||||
* 获取自由PK次数
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.getActivePkNum")
|
||||
Observable<ResponseModel<Integer>> getFreePkNumber();
|
||||
/**
|
||||
* 发起随机PK
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.setRandomPK")
|
||||
Observable<ResponseModel<String>> randomPK();
|
||||
/**
|
||||
* 随机PK后调用接口给后台记录
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.startRandomPK")
|
||||
Observable<ResponseModel<BaseModel>> startRandomPK(@Query("pkuid")String pkuid);
|
||||
/**
|
||||
* 自由PK开始后调用接口扣掉次数
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.setActivePkNum")
|
||||
Observable<ResponseModel<BaseModel>> setFreePkNum();
|
||||
/**
|
||||
* 随机PK搜索用户
|
||||
* @param cs 简体关键字/uid
|
||||
* @param ct 繁体关键字/uid
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.searchUser")
|
||||
Observable<ResponseModel<List<RandomPkUserBean>>> randomPkSearchUser(@Query("jian_key")String cs,@Query("fan_key")String ct);
|
||||
/**
|
||||
* 拒绝随机PK
|
||||
*/
|
||||
@GET("/api/public/?service=Livepk.setBanRandomPK")
|
||||
Observable<ResponseModel<BaseModel>> setBanRandomPK();
|
||||
/**
|
||||
* 拒绝随机PK
|
||||
*/
|
||||
@GET("/api/public/?service=Ranking.getRankingInfo")
|
||||
Observable<ResponseModel<RankPkInfoBean>> getRankingInfo();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.yunbao.common.http.base;
|
||||
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
|
||||
/**
|
||||
* 直播间类型返回
|
||||
*/
|
||||
public interface CheckLiveCallBack {
|
||||
/**
|
||||
* ;普通房
|
||||
*/
|
||||
void forwardNormalRoom(CheckLiveModel model);
|
||||
|
||||
/**
|
||||
* 密码房
|
||||
*/
|
||||
void forwardPwdRoom(CheckLiveModel model);
|
||||
|
||||
/**
|
||||
* 收费房
|
||||
*/
|
||||
void forwardPayRoom(CheckLiveModel model);
|
||||
|
||||
/**
|
||||
* 请求失败
|
||||
*
|
||||
* @param error
|
||||
*/
|
||||
void onError(String error);
|
||||
}
|
||||
@@ -2,24 +2,38 @@ package com.yunbao.common.http.live;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
import com.yunbao.common.bean.LinkMicUserBeanV2;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.VipModel;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.http.base.CheckLiveCallBack;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
@@ -63,6 +77,7 @@ public class LiveNetManager {
|
||||
if (callback != null)
|
||||
callback.onError(throwable.getMessage());
|
||||
}).isDisposed();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,7 +252,6 @@ public class LiveNetManager {
|
||||
|
||||
/**
|
||||
* 获取 【新人特惠】【趣味游戏】【幸运天使】
|
||||
*
|
||||
*/
|
||||
public void getLiveRoomActivityBanner(HttpCallback<List<LiveRoomActivityBanner>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
@@ -253,4 +267,493 @@ public class LiveNetManager {
|
||||
throwable.printStackTrace();
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取新侧边数据
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
public void getCustomSidebarInfo(HttpCallback<List<CustomSidebarInfoModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getCustomSidebarInfo()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(listResponseModel -> callback.onSuccess(listResponseModel.getData().getInfo()), throwable -> {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
throwable.printStackTrace();
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务领取接口
|
||||
*/
|
||||
public void sendTaskGift(String flag, HttpCallback<String> callback) {
|
||||
|
||||
API.get().pdLiveApi(mContext)
|
||||
.sendTaskGift(flag, "2")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(observableResponseModel -> {
|
||||
if (observableResponseModel.getData().getCode() == 0) {
|
||||
callback.onSuccess("");
|
||||
} else {
|
||||
callback.onError(observableResponseModel.getData().getMsg());
|
||||
}
|
||||
}, throwable -> callback.onError(throwable.getMessage())).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查直播间状态
|
||||
*
|
||||
* @param liveUid
|
||||
* @param stream
|
||||
* @param callBack
|
||||
*/
|
||||
public void checkLive(String liveUid, String stream, CheckLiveCallBack callBack) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.checkLive(liveUid, stream)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<CheckLiveModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<CheckLiveModel>> listResponseModel) throws Exception {
|
||||
if (listResponseModel.getData().getCode() == 0) {
|
||||
List<CheckLiveModel> checkLiveModels = listResponseModel.getData().getInfo();
|
||||
if (checkLiveModels.size() > 0) {
|
||||
CheckLiveModel liveModel = checkLiveModels.get(0);
|
||||
switch (liveModel.getType()) {
|
||||
case Constants.LIVE_TYPE_NORMAL:
|
||||
if (callBack != null) {
|
||||
callBack.forwardNormalRoom(liveModel);
|
||||
}
|
||||
break;
|
||||
case Constants.LIVE_TYPE_PWD:
|
||||
if (callBack != null) {
|
||||
callBack.forwardPwdRoom(liveModel);
|
||||
}
|
||||
break;
|
||||
case Constants.LIVE_TYPE_PAY:
|
||||
case Constants.LIVE_TYPE_TIME:
|
||||
if (callBack != null) {
|
||||
callBack.forwardPayRoom(liveModel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (callBack != null) {
|
||||
callBack.onError(listResponseModel.getData().getMsg());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (callBack != null) {
|
||||
callBack.onError(listResponseModel.getData().getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callBack != null) {
|
||||
callBack.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新进入直播间接口
|
||||
*
|
||||
* @param stream
|
||||
* @param liveUid
|
||||
* @param city
|
||||
* @param callback
|
||||
*/
|
||||
private Disposable enterRoomDisposable = null;
|
||||
|
||||
public void enterRoomNew(String stream, String liveUid, String city, HttpCallback<EnterRoomNewModel> callback) {
|
||||
enterRoomDisposable = API.get().pdLiveApi(mContext)
|
||||
.enterRoomNew("g" + liveUid, stream, liveUid, city)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<EnterRoomNewModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<EnterRoomNewModel> enterRoomNewModelResponseModel) throws Exception {
|
||||
Log.e("进入房间", "enterRoomNew--------------------------------------------");
|
||||
enterRoomDisposable = null;
|
||||
if (callback != null) {
|
||||
callback.onSuccess(enterRoomNewModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
enterRoomDisposable = null;
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 加入房间推送IM消息
|
||||
*
|
||||
* @param stream
|
||||
* @param liveUid
|
||||
*/
|
||||
private Disposable userJoinDisposable = null;
|
||||
|
||||
public void userJoinRoomNew(String stream, String liveUid) {
|
||||
userJoinDisposable = API.get().pdLiveApi(mContext)
|
||||
.userJoinRoomNew("g" + liveUid, stream)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<String>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<String> stringResponseModel) throws Exception {
|
||||
Log.e("进入房间", "userJoinRoomNew--------------------------------------------");
|
||||
userJoinDisposable = null;
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
userJoinDisposable = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 离开直播间
|
||||
*
|
||||
* @param stream
|
||||
* @param liveUid
|
||||
*/
|
||||
public void leaveRoomNew(String stream, String liveUid, HttpCallback<String> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.leaveRoomNew("g" + liveUid, stream)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<Object>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<Object>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(null);
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取多人连麦用户列表
|
||||
*/
|
||||
public void getDRMicUserList(String uid, HttpCallback<List<LinkMicUserBean>> callback) {
|
||||
API.get().createPDLiveApi(false)
|
||||
.getDrLm(uid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<LinkMicUserBeanV2>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<LinkMicUserBeanV2>> listResponseModel) throws Exception {
|
||||
List<LinkMicUserBean> list = new ArrayList<>();
|
||||
for (LinkMicUserBeanV2 bean : listResponseModel.getData().getInfo()) {
|
||||
list.addAll(bean.getUserlist());
|
||||
for (LinkMicUserBean userBean : bean.getUserlist()) {
|
||||
Log.i("多人连麦", "list: " + userBean.toString());
|
||||
}
|
||||
}
|
||||
Log.i("多人连麦", "accept: " + list.size());
|
||||
if (callback != null) {
|
||||
callback.onSuccess(list);
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
private Disposable randomPkApi;
|
||||
|
||||
/**
|
||||
* PK排位赛接口
|
||||
*/
|
||||
public void getRandomPk(String mLiveUid, String pkUid, HttpCallback<PkRankBean> callback) {
|
||||
randomPkApi = API.get().pdLiveApi(mContext)
|
||||
.getPkRanksList(mLiveUid, pkUid)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(listResponseModel -> {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取随机PK开关
|
||||
* 1=开,0=关
|
||||
*/
|
||||
public void getRandomPkSwitch(HttpCallback<Integer> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getRandomPkSwitch()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(listResponseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo().get(0));
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置随机PK开关
|
||||
*
|
||||
* @param pk 1=开,0=关
|
||||
* @param callback @{@link HttpCallbackModel#getCode()} 0=成功
|
||||
*/
|
||||
public void changeRandomPkSwitch(int pk, HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.changeRandomPkSwitch(pk)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<BaseModel>> responseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
HttpCallbackModel model = new HttpCallbackModel();
|
||||
model.setCode(responseModel.getData().getCode());
|
||||
model.setMsg(responseModel.getData().getMsg());
|
||||
callback.onSuccess(model);
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自由PK次数
|
||||
*/
|
||||
public void getFreePkNumber(HttpCallback<Integer> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getFreePkNumber()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<Integer>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<Integer> responseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(responseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起随机PK
|
||||
*/
|
||||
public void randomPK(HttpCallback<String> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.randomPK()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<String>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<String> responseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(responseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 自由PK开始后调用接口扣掉次数
|
||||
*/
|
||||
public void setFreePkNum(HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.setFreePkNum()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<BaseModel> responseModel) throws Exception {
|
||||
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机PK后调用接口给后台记录
|
||||
*/
|
||||
public void startRandomPK(String pkuid, HttpCallback<Boolean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.startRandomPK(pkuid)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<BaseModel> responseModel) throws Exception {
|
||||
if (responseModel.getData().getCode() == 0) {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(true);
|
||||
}
|
||||
} else {
|
||||
callback.onSuccess(false);
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机PK后调用接口给后台记录
|
||||
*
|
||||
* @param cs 简体关键字/uid
|
||||
* @param ct 繁体关键字/uid
|
||||
*/
|
||||
public void randomPkSearchUser(String cs, String ct, HttpCallback<List<RandomPkUserBean>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.randomPkSearchUser(cs, ct)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<List<RandomPkUserBean>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<RandomPkUserBean>> responseModel) throws Exception {
|
||||
if (responseModel.getData().getCode() == 0) {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(responseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒绝随机PK
|
||||
*/
|
||||
public void setBanRandomPK(HttpCallback<HttpCallbackModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.setBanRandomPK()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<BaseModel> responseModel) throws Exception {
|
||||
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取随机排位赛信息
|
||||
*/
|
||||
public void getRankPkInfoBean(HttpCallback<RankPkInfoBean> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getRankingInfo()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseModel<RankPkInfoBean>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<RankPkInfoBean> rankPkInfoBeanResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(rankPkInfoBeanResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
public void cancelLive() {
|
||||
if (userJoinDisposable != null) {
|
||||
userJoinDisposable.dispose();
|
||||
}
|
||||
if (enterRoomDisposable != null) {
|
||||
enterRoomDisposable.dispose();
|
||||
}
|
||||
if (randomPkApi != null) {
|
||||
randomPkApi.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.cosmos.baseutil.app.AppContext;
|
||||
import com.google.gson.Gson;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.event.DataUserInfoEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
@@ -25,18 +27,18 @@ import org.greenrobot.eventbus.EventBus;
|
||||
* 登录者信息管理
|
||||
*/
|
||||
public class IMLoginManager extends BaseCacheManager {
|
||||
private final static String KEY_USER_INFO = "keyUserInfo";
|
||||
private final String KEY_USER_INFO = "keyUserInfo";
|
||||
private static IMLoginManager manager;
|
||||
private IMLoginModel userInfo;
|
||||
private final static String isNewUserGif = "isNewUserGif";
|
||||
private final static String isNewUserOne = "isNewUserOne";
|
||||
private final static String GiftEffect = "giftEffect";
|
||||
private final static String MountEffect = "mountEffect";
|
||||
private final static String IS_CHAT = "isChat";
|
||||
private final static String IS_SLIDE = "isSlide";
|
||||
private final static String IS_FLOAT = "is_float";
|
||||
private final static String IS_HINT = "is_hint";
|
||||
private final static String IS_HINT2 = "is_hint2";
|
||||
private final String isNewUserGif = "isNewUserGif";
|
||||
private final String isNewUserOne = "isNewUserOne";
|
||||
private final String GiftEffect = "giftEffect";
|
||||
private final String MountEffect = "mountEffect";
|
||||
private final String IS_CHAT = "isChat";
|
||||
private final String IS_SLIDE = "isSlide";
|
||||
private final String IS_FLOAT = "is_float";
|
||||
private final String IS_HINT = "is_hint";
|
||||
private final String IS_HINT2 = "is_hint2";
|
||||
|
||||
|
||||
public boolean isHint() {
|
||||
@@ -151,7 +153,7 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
*/
|
||||
public static IMLoginManager get(Context context) {
|
||||
if (null == manager) {
|
||||
manager = new IMLoginManager(context);
|
||||
manager = new IMLoginManager(CommonAppContext.sInstance.getBaseContext());
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.yunbao.common.manager;
|
||||
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCRoom;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
|
||||
/**
|
||||
* RTC管理类,负责管理申请、同意、拒绝PK
|
||||
*/
|
||||
public class IMRTCManager {
|
||||
private static IMRTCManager manager;
|
||||
private RCRTCRoom rtcRoom;
|
||||
|
||||
private IMRTCManager() {
|
||||
|
||||
}
|
||||
|
||||
public static IMRTCManager getInstance() {
|
||||
if (manager == null) {
|
||||
manager = new IMRTCManager();
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
public void setRtcRoom(RCRTCRoom rtcRoom) {
|
||||
this.rtcRoom = rtcRoom;
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应PK请求
|
||||
* @param liveUid 对方房间号
|
||||
* @param agree 是否同意
|
||||
* @param extra 扩展参数
|
||||
* @param callback 回调
|
||||
*/
|
||||
public void responseJoinOtherRoom(String liveUid, boolean agree, String extra, IRCRTCResultCallback callback) {
|
||||
if (rtcRoom != null) {
|
||||
/*
|
||||
inviterRoomId - 邀请者所在房间 id,
|
||||
inviterUserId - 邀请者用户 id
|
||||
agree - 被邀请者是否同意连麦邀请
|
||||
inviteeAutoMix - 是否将被邀请者音视频资源发送到邀请人房间中合流
|
||||
1:inviteeAutoMix 为true时:
|
||||
1.1:如果邀请方在发送连麦请求之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把邀请方流资源合并到被邀请方视图(默认仅悬浮布局合流)上。
|
||||
1.2:如果邀请方在发送连麦请求之前没有发布资源,将会在邀请方发布资源成功后,服务器才会把邀请方的资源合并到被邀请方视图(默认仅悬浮布局合流)上。
|
||||
2: 无论为true或false,双方都可以使用RCRTCLiveInfo.setMixConfig(RCRTCMixConfig, IRCRTCResultCallback) 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。
|
||||
extra - 扩展字段,默认为空
|
||||
*/
|
||||
rtcRoom.getLocalUser().responseJoinOtherRoom(liveUid, liveUid, agree, agree, extra, callback);
|
||||
} else {
|
||||
callback.onFailed(RTCErrorCode.RongRTCCodeIMError);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请PK
|
||||
* @param liveUid 对方房间号
|
||||
* @param inviterAutoMix 是否将邀请者音视频资源发送到被邀请人房间中合流
|
||||
* @param extra 扩展参数
|
||||
* @param callback 回调
|
||||
*/
|
||||
public void requestJoinOtherRoom(String liveUid,boolean inviterAutoMix,String extra,IRCRTCResultCallback callback){
|
||||
if(rtcRoom!=null){
|
||||
/*
|
||||
inviteeRoomId - 被邀请者所在房间 id
|
||||
inviteeUserId - 被邀请用户 id
|
||||
inviterAutoMix - 是否将邀请者音视频资源发送到被邀请人房间中合流
|
||||
1: inviterAutoMix为true时:
|
||||
1.1:如果被邀请方在加入邀请方房间之前发布了资源,当被邀请方加入邀请者房间成功后,服务器会把被邀请方流资源合并到邀请方视图 ·(默认仅悬浮布局合流)上。
|
||||
1.2:如果被邀请方在加入邀请方房间之前没有发布过资源,将会在被邀请方发布资源成功后,服务器会把被邀请方流资源合并到邀请方视图(默认仅悬浮布局合流)上。
|
||||
2:无论为true或false,双方都可以使用RCRTCLiveInfo.setMixConfig(RCRTCMixConfig, IRCRTCResultCallback) 方法主动设置合流布局。一旦主动设置过合流布局,后续音视频直播过程中设置的自动合流参数将失效。
|
||||
extra - 扩展字段,默认为空
|
||||
*/
|
||||
rtcRoom.getLocalUser().requestJoinOtherRoom(liveUid, liveUid, inviterAutoMix, extra, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
callback.onSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
callback.onFailed(errorCode);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
callback.onFailed(RTCErrorCode.RongRTCCodeIMError);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.yunbao.common.manager;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.yunbao.common.bean.NewLevelModel;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新粉丝牌管理
|
||||
*/
|
||||
public class NewLevelManager extends BaseCacheManager {
|
||||
private final String KEY_USER_LEVEL = "keyUserLevel";
|
||||
private final String KEY_ANCHOR_LEVEL = "keyAnchorLevel";
|
||||
private List<NewLevelModel> newLevelModels = new ArrayList<>();
|
||||
private List<NewLevelModel> keyAnchorLevel = new ArrayList<>();
|
||||
|
||||
public NewLevelManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存等级图标
|
||||
*
|
||||
* @param json
|
||||
*/
|
||||
public void UpDataLevel(String json) {
|
||||
newLevelModels = new Gson().fromJson(json, new TypeToken<List<NewLevelModel>>() {
|
||||
}.getType());
|
||||
put(KEY_USER_LEVEL, newLevelModels);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取等级数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<NewLevelModel> getNewLevelModels() {
|
||||
return getList(KEY_USER_LEVEL, new TypeToken<List<NewLevelModel>>() {
|
||||
}.getType());
|
||||
}
|
||||
/**
|
||||
* 缓存等级图标
|
||||
*
|
||||
* @param json
|
||||
*/
|
||||
public void UpAnchorDataLevel(String json) {
|
||||
newLevelModels = new Gson().fromJson(json, new TypeToken<List<NewLevelModel>>() {
|
||||
}.getType());
|
||||
put(KEY_ANCHOR_LEVEL, newLevelModels);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取等级数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<NewLevelModel> getNewAnchorLevelModels() {
|
||||
return getList(KEY_ANCHOR_LEVEL, new TypeToken<List<NewLevelModel>>() {
|
||||
}.getType());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,407 @@
|
||||
package com.yunbao.common.manager;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* 随机PK管理类
|
||||
*/
|
||||
public class RandomPkManager {
|
||||
public final static int PK_STATUS_DEFAULT = -1;//默认状态,一般为为开始匹配
|
||||
public final static int PK_STATUS_REQUEST = 0;//已发出匹配请求
|
||||
public final static int PK_STATUS_START = 1;//匹配到用户
|
||||
public final static int PK_STATUS_CLOSE = 2;//PK结束
|
||||
public final static int PK_STATUS_REFUSE = 3;//对方拒绝
|
||||
public final static int PK_STATUS_EXIT_ING = 4;//退出匹配中
|
||||
|
||||
private static RandomPkManager manager;
|
||||
private int min = -1;//匹配计时器 分钟
|
||||
private int sec = -1;//匹配计时器 秒钟
|
||||
private int status = PK_STATUS_DEFAULT;
|
||||
private Timer timer;
|
||||
private TimerTask task;
|
||||
private final List<OnRandomPkTimer> randomPkTimer = new ArrayList<>();//监听器集合
|
||||
private String pkUid;//对方房间ID
|
||||
public static String debugUid;
|
||||
private RankPkInfoBean rankPkInfoBean;//排位赛信息
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
private RandomPkManager() {
|
||||
getRankInfo();
|
||||
initTask();
|
||||
}
|
||||
|
||||
public static RandomPkManager getInstance() {
|
||||
if (manager == null) {
|
||||
manager = new RandomPkManager();
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加监听器
|
||||
*/
|
||||
public void addOnRandomPkTimer(OnRandomPkTimer randomPkTimer) {
|
||||
if (randomPkTimer != null) {
|
||||
this.randomPkTimer.add(randomPkTimer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除监听器
|
||||
*/
|
||||
public void unregisterOnRandomPkTimer(OnRandomPkTimer randomPkTimer) {
|
||||
if (randomPkTimer != null) {
|
||||
this.randomPkTimer.remove(randomPkTimer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化参数
|
||||
*/
|
||||
private void initVal() {
|
||||
min = -1;
|
||||
sec = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化任务
|
||||
*/
|
||||
private void initTask() {
|
||||
if (task != null) {
|
||||
return;
|
||||
}
|
||||
task = new TimerTask() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
sec++;
|
||||
if (sec % 60 == 0) {
|
||||
min++;
|
||||
sec = 0;
|
||||
}
|
||||
handler.post(() -> {
|
||||
for (OnRandomPkTimer onRandomPkTimer : randomPkTimer) {
|
||||
onRandomPkTimer.onTimer(String.format(Locale.CHINA, "%02d:%02d", min, sec));
|
||||
}
|
||||
nextPk();
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化匹配时间
|
||||
*/
|
||||
public String getTimer() {
|
||||
return String.format(Locale.CHINA, "%02d:%02d", min, sec);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对方拒绝,开始下一轮匹配
|
||||
*/
|
||||
private void nextPk() {
|
||||
if (status != PK_STATUS_DEFAULT && status != PK_STATUS_REFUSE) {
|
||||
return;
|
||||
}
|
||||
status = PK_STATUS_REQUEST;
|
||||
LiveNetManager.get(CommonAppContext.getTopActivity())
|
||||
.randomPK(new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
pkUid = data;
|
||||
if (debugUid != null) {
|
||||
pkUid = data = debugUid;
|
||||
}
|
||||
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||
pkTimer.onStartPK(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为排位赛模式
|
||||
*/
|
||||
public boolean isRankModel() {
|
||||
return rankPkInfoBean != null && rankPkInfoBean.isRankPKTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始匹配
|
||||
*/
|
||||
public boolean start() {
|
||||
if (status == PK_STATUS_START) {
|
||||
ToastUtil.show("PK中");
|
||||
return false;
|
||||
}
|
||||
if (status == PK_STATUS_EXIT_ING) {
|
||||
return false;
|
||||
}
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
}
|
||||
task = null;
|
||||
initTask();
|
||||
initVal();
|
||||
timer = new Timer();
|
||||
timer.schedule(task, 0, 1000);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void getRankInfo() {
|
||||
LiveNetManager.get(CommonAppContext.getTopActivity())
|
||||
.getRankPkInfoBean(new HttpCallback<RankPkInfoBean>() {
|
||||
@Override
|
||||
public void onSuccess(RankPkInfoBean data) {
|
||||
rankPkInfoBean = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知所有监听者,开始退出匹配
|
||||
*/
|
||||
private void callEndPkStart() {
|
||||
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||
pkTimer.onPkEndStart();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知所有监听者,退出匹配倒计时
|
||||
*/
|
||||
private void callEndPkTimer(String time) {
|
||||
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||
pkTimer.onPkEndTimer(time);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知所有监听者,退出匹配成功
|
||||
*/
|
||||
private void callEndPkSuccess() {
|
||||
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||
pkTimer.onPkEndSuccess();
|
||||
}
|
||||
status = PK_STATUS_DEFAULT;
|
||||
rankPkInfoBean = null;
|
||||
}
|
||||
|
||||
private int exitTimer;
|
||||
|
||||
/**
|
||||
* 退出匹配
|
||||
*/
|
||||
public void exitPk() {
|
||||
if (status == PK_STATUS_EXIT_ING) {
|
||||
return;
|
||||
}
|
||||
callEndPkStart();
|
||||
status = PK_STATUS_EXIT_ING;
|
||||
exitTimer = 11;
|
||||
new Timer().schedule(new TimerTask() {
|
||||
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
handler.post(() -> {
|
||||
exitTimer--;
|
||||
callEndPkTimer(exitTimer + "");
|
||||
if (exitTimer == 0) {
|
||||
end();
|
||||
callEndPkSuccess();
|
||||
cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 0, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出连麦
|
||||
*/
|
||||
public void end() {
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
}
|
||||
task = null;
|
||||
status = PK_STATUS_DEFAULT;
|
||||
pkUid = null;
|
||||
callEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否正在匹配中
|
||||
*/
|
||||
public boolean isRequestPk() {
|
||||
return status == PK_STATUS_REQUEST;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知所有监听者,结束匹配
|
||||
*/
|
||||
private void callEnd() {
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
}
|
||||
handler.post(() -> {
|
||||
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||
pkTimer.onPkEnd();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知所有监听者,开始匹配
|
||||
*/
|
||||
private void callStart() {
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
}
|
||||
handler.post(() -> {
|
||||
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||
pkTimer.onPking();
|
||||
}
|
||||
});
|
||||
LiveNetManager.get(CommonAppContext.getTopActivity())
|
||||
.startRandomPK(pkUid, new HttpCallback<Boolean>() {
|
||||
@Override
|
||||
public void onSuccess(Boolean data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知所有监听者,对方拒绝PK
|
||||
*/
|
||||
private void callRefuse() {
|
||||
handler.post(() -> {
|
||||
for (OnRandomPkTimer pkTimer : randomPkTimer) {
|
||||
pkTimer.onRefuse();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置PK状态
|
||||
*/
|
||||
public void setPkStatus(int status) {
|
||||
if (this.status == PK_STATUS_DEFAULT || this.status == PK_STATUS_EXIT_ING) {//默认状态下不响应随机PK接口
|
||||
return;
|
||||
}
|
||||
this.status = status;
|
||||
switch (status) {
|
||||
case PK_STATUS_START:
|
||||
callStart();
|
||||
break;
|
||||
case PK_STATUS_CLOSE:
|
||||
callEnd();
|
||||
break;
|
||||
case PK_STATUS_REFUSE:
|
||||
//callRefuse();
|
||||
nextPk();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否正在退出匹配中
|
||||
*/
|
||||
public boolean isExiting() {
|
||||
return status == PK_STATUS_EXIT_ING;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取退出匹配倒计时
|
||||
*/
|
||||
public String getExitTimer() {
|
||||
return exitTimer + "";
|
||||
}
|
||||
|
||||
|
||||
public static abstract class OnRandomPkTimer {
|
||||
/**
|
||||
* 匹配倒计时
|
||||
*/
|
||||
public void onTimer(String time) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配到对方
|
||||
*
|
||||
* @param pkUid 对方uid
|
||||
*/
|
||||
public void onStartPK(String pkUid) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配中
|
||||
*/
|
||||
public void onPking() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 连麦结束
|
||||
*/
|
||||
public void onPkEnd() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 对方拒绝PK
|
||||
*/
|
||||
public void onRefuse() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出匹配倒计时
|
||||
*/
|
||||
public void onPkEndTimer(String time) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始退出匹配
|
||||
*/
|
||||
public void onPkEndStart() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出匹配成功
|
||||
*/
|
||||
public void onPkEndSuccess() {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -271,7 +271,6 @@ public class ACache {
|
||||
JSONArray obj = new JSONArray(JSONString);
|
||||
return obj;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,16 +3,8 @@ package com.yunbao.common.manager.imrongcloud;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.adjust.sdk.AdjustEvent;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.google.gson.Gson;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -41,7 +33,7 @@ public class PDMessageInterceptor implements MessageInterceptor {
|
||||
Log.e("PDMessageInterceptor", textMessage.getContent());
|
||||
//删除消息
|
||||
IMCenter.getInstance().deleteRemoteMessages(Conversation.ConversationType.PRIVATE, message.getTargetId(), messages, null);
|
||||
IMCenter.getInstance().clearMessagesUnreadStatus(Conversation.ConversationType.PRIVATE, message.getTargetId(), null);
|
||||
IMCenter.getInstance().clearMessagesUnreadStatus(Conversation.ConversationType.PRIVATE, message.getTargetId(), null);
|
||||
|
||||
// return true;
|
||||
}
|
||||
@@ -53,7 +45,7 @@ public class PDMessageInterceptor implements MessageInterceptor {
|
||||
IMLoginModel userBean = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
|
||||
//新手指导员
|
||||
if (!TextUtils.isEmpty(userBean.getIsAdmin()) && TextUtils.equals(userBean.getIsAdmin(), "1")) {
|
||||
//wow
|
||||
//wow
|
||||
|
||||
} else {//非指导员
|
||||
|
||||
@@ -71,7 +63,7 @@ public class PDMessageInterceptor implements MessageInterceptor {
|
||||
*/
|
||||
@Override
|
||||
public void onSuccess(List<Message> messages) {
|
||||
if (messages.size() == 0||(messages.size()==1&&((TextMessage) messages.get(0).getContent()).getContent().contains("LivePK"))) {
|
||||
if (messages.size() == 0 || (messages.size() == 1 && ((TextMessage) messages.get(0).getContent()).getContent().contains("LivePK"))) {
|
||||
IMCenter.getInstance().removeConversation(Conversation.ConversationType.PRIVATE, message.getTargetId(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,21 +295,21 @@ public class PayPresenter {
|
||||
if (mActivity == null || TextUtils.isEmpty(mServiceNameAli)|| TextUtils.isEmpty(mAliCallbackUrl)) {
|
||||
return;
|
||||
}
|
||||
if (!CommonAppConfig.isAppExist(Constants.PACKAGE_NAME_ALI)) {
|
||||
ToastUtil.show(R.string.coin_ali_not_install);
|
||||
return;
|
||||
}
|
||||
// if (!CommonAppConfig.isAppExist(Constants.PACKAGE_NAME_ALI)) {
|
||||
// ToastUtil.show(R.string.coin_ali_not_install);
|
||||
// return;
|
||||
// }
|
||||
if (TextUtils.isEmpty(mAliPartner) || TextUtils.isEmpty(mAliSellerId) || TextUtils.isEmpty(mAliPrivateKey)) {
|
||||
ToastUtil.show(Constants.PAY_ALI_NOT_ENABLE);
|
||||
return;
|
||||
}
|
||||
AliPayBuilder builder = new AliPayBuilder(mActivity, mAliPartner, mAliSellerId, mAliPrivateKey);
|
||||
builder.setMoney(money);
|
||||
builder.setGoodsName(goodsName);
|
||||
builder.setCallbackUrl(mAliCallbackUrl);
|
||||
builder.setOrderParams(StringUtil.contact(mServiceNameAli, orderParams));
|
||||
builder.setPayCallback(mPayCallback);
|
||||
builder.pay();
|
||||
// AliPayBuilder builder = new AliPayBuilder(mActivity, mAliPartner, mAliSellerId, mAliPrivateKey);
|
||||
// builder.setMoney(money);
|
||||
// builder.setGoodsName(goodsName);
|
||||
// builder.setCallbackUrl(mAliCallbackUrl);
|
||||
// builder.setOrderParams(StringUtil.contact(mServiceNameAli, orderParams));
|
||||
// builder.setPayCallback(mPayCallback);
|
||||
// builder.pay();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,213 +22,214 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/9/21.
|
||||
* 禁用支付宝
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
public class AliPayBuilder {
|
||||
|
||||
private Activity mActivity;
|
||||
private String mPartner;// 商户ID
|
||||
private String mSellerId; // 商户收款账号
|
||||
private String mPrivateKey; // 商户私钥,pkcs8格式
|
||||
private String mPayInfo;//支付宝订单信息 包括 商品信息,订单签名,签名类型
|
||||
private String mGoodsName;//商品名称
|
||||
private String mMoney;//要支付的金额
|
||||
private String mOrderParams;//订单获取订单需要的参数
|
||||
private String mCallbackUrl;//支付宝充值回调地址
|
||||
private PayHandler mPayHandler;
|
||||
|
||||
public AliPayBuilder(Activity activity, String partner, String sellerId, String privateKey) {
|
||||
mActivity = new WeakReference<>(activity).get();
|
||||
mPartner = partner;
|
||||
mSellerId = sellerId;
|
||||
mPrivateKey = privateKey;
|
||||
}
|
||||
|
||||
public AliPayBuilder setMoney(String money) {
|
||||
mMoney = money;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AliPayBuilder setGoodsName(String goodsName) {
|
||||
mGoodsName = goodsName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AliPayBuilder setOrderParams(String orderParams) {
|
||||
mOrderParams = orderParams;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public AliPayBuilder setPayCallback(PayCallback callback) {
|
||||
mPayHandler = new PayHandler(callback);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setCallbackUrl(String callbackUrl) {
|
||||
mCallbackUrl = callbackUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从服务器端获取订单号,即下单
|
||||
*/
|
||||
public void pay() {
|
||||
if (TextUtils.isEmpty(mOrderParams) || TextUtils.isEmpty(mMoney) || TextUtils.isEmpty(mGoodsName)|| TextUtils.isEmpty(mCallbackUrl)) {
|
||||
return;
|
||||
}
|
||||
CommonHttpUtil.getAliOrder(mOrderParams, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
String orderInfo = createAliOrder(obj.getString("orderid"));//商品信息
|
||||
String sign = getOrderSign(orderInfo);//订单签名
|
||||
if (TextUtils.isEmpty(sign)) {
|
||||
ToastUtil.show("商户私钥错误,订单签名失败");
|
||||
return;
|
||||
}
|
||||
sign = urlEncode(sign);
|
||||
String signType = "sign_type=\"RSA\"";//签名类型
|
||||
mPayInfo = orderInfo + "&sign=\"" + sign + "\"&" + signType;
|
||||
L.e("支付宝订单信息----->" + mPayInfo);
|
||||
invokeAliPay();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showLoadingDialog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog createLoadingDialog() {
|
||||
return DialogUitl.loadingDialog(mActivity);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单号和商品信息生成支付宝格式的订单信息
|
||||
*
|
||||
* @param orderId 服务器返回的订单号
|
||||
* @return
|
||||
*/
|
||||
private String createAliOrder(String orderId) {
|
||||
// 合作者身份ID
|
||||
String orderInfo = "partner=" + "\"" + mPartner + "\"";
|
||||
|
||||
// 卖家支付宝账号
|
||||
orderInfo += "&seller_id=" + "\"" + mSellerId + "\"";
|
||||
|
||||
// 商户网站唯一订单号
|
||||
orderInfo += "&out_trade_no=" + "\"" + orderId + "\"";
|
||||
|
||||
// 商品名称
|
||||
orderInfo += "&subject=" + "\"" + mGoodsName + "\"";
|
||||
|
||||
// 商品详情
|
||||
orderInfo += "&body=" + "\"" + mGoodsName + "\"";
|
||||
|
||||
// 商品金额
|
||||
orderInfo += "&total_fee=" + "\"" + mMoney + "\"";
|
||||
|
||||
// 服务器异步通知页面路径 //服务器异步通知页面路径 参数 notify_url,如果商户没设定,则不会进行该操作
|
||||
orderInfo += "¬ify_url=" + "\"" + mCallbackUrl + "\"";
|
||||
|
||||
// 接口名称, 固定值
|
||||
orderInfo += "&service=\"mobile.securitypay.pay\"";
|
||||
|
||||
// 支付类型, 固定值
|
||||
orderInfo += "&payment_type=\"1\"";
|
||||
|
||||
// 参数编码, 固定值
|
||||
orderInfo += "&_input_charset=\"utf-8\"";
|
||||
|
||||
// 设置未付款交易的超时时间
|
||||
// 默认30分钟,一旦超时,该笔交易就会自动被关闭。
|
||||
// 取值范围:1m〜15d。
|
||||
// m-分钟,h-小时,d-天,1c-当天(无论交易何时创建,都在0点关闭)。
|
||||
// 该参数数值不接受小数点,如1.5h,可转换为90m。
|
||||
orderInfo += "&it_b_pay=\"30m\"";
|
||||
|
||||
// 支付宝处理完请求后,当前页面跳转到商户指定页面的路径,可空
|
||||
orderInfo += "&return_url=\"m.alipay.com\"";
|
||||
|
||||
// 调用银行卡支付,需配置此参数,参与签名, 固定值
|
||||
// orderInfo += "&paymethod=\"expressGateway\"";
|
||||
|
||||
return orderInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单信息生成订单的签名
|
||||
*
|
||||
* @param orderInfo 订单信息
|
||||
* @return
|
||||
*/
|
||||
private String getOrderSign(String orderInfo) {
|
||||
return SignUtils.sign(orderInfo, mPrivateKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对订单签名进行urlencode转码
|
||||
*
|
||||
* @param sign 签名
|
||||
* @return
|
||||
*/
|
||||
private String urlEncode(String sign) {
|
||||
try {
|
||||
sign = URLEncoder.encode(sign, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return sign;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用支付宝sdk
|
||||
*/
|
||||
private void invokeAliPay() {
|
||||
// new Thread(new Runnable() {
|
||||
//
|
||||
// private Activity mActivity;
|
||||
// private String mPartner;// 商户ID
|
||||
// private String mSellerId; // 商户收款账号
|
||||
// private String mPrivateKey; // 商户私钥,pkcs8格式
|
||||
// private String mPayInfo;//支付宝订单信息 包括 商品信息,订单签名,签名类型
|
||||
// private String mGoodsName;//商品名称
|
||||
// private String mMoney;//要支付的金额
|
||||
// private String mOrderParams;//订单获取订单需要的参数
|
||||
// private String mCallbackUrl;//支付宝充值回调地址
|
||||
// private PayHandler mPayHandler;
|
||||
//
|
||||
// public AliPayBuilder(Activity activity, String partner, String sellerId, String privateKey) {
|
||||
// mActivity = new WeakReference<>(activity).get();
|
||||
// mPartner = partner;
|
||||
// mSellerId = sellerId;
|
||||
// mPrivateKey = privateKey;
|
||||
// }
|
||||
//
|
||||
// public AliPayBuilder setMoney(String money) {
|
||||
// mMoney = money;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public AliPayBuilder setGoodsName(String goodsName) {
|
||||
// mGoodsName = goodsName;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public AliPayBuilder setOrderParams(String orderParams) {
|
||||
// mOrderParams = orderParams;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public AliPayBuilder setPayCallback(PayCallback callback) {
|
||||
// mPayHandler = new PayHandler(callback);
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public void setCallbackUrl(String callbackUrl) {
|
||||
// mCallbackUrl = callbackUrl;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 从服务器端获取订单号,即下单
|
||||
// */
|
||||
// public void pay() {
|
||||
// if (TextUtils.isEmpty(mOrderParams) || TextUtils.isEmpty(mMoney) || TextUtils.isEmpty(mGoodsName)|| TextUtils.isEmpty(mCallbackUrl)) {
|
||||
// return;
|
||||
// }
|
||||
// CommonHttpUtil.getAliOrder(mOrderParams, new HttpCallback() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
//// PayTask alipay = new PayTask(mActivity);
|
||||
// //执行支付,这是一个耗时操作,最后返回支付的结果,用handler发送到主线程
|
||||
//// Map<String, String> result = alipay.payV2(mPayInfo, true);
|
||||
//// L.e("支付宝返回结果----->" + result);
|
||||
//// if (mPayHandler != null) {
|
||||
//// Message msg = Message.obtain();
|
||||
//// msg.obj = result;
|
||||
//// mPayHandler.sendMessage(msg);
|
||||
//// }
|
||||
//// }
|
||||
// }).start();
|
||||
}
|
||||
|
||||
|
||||
private static class PayHandler extends Handler {
|
||||
|
||||
private PayCallback mPayCallback;
|
||||
|
||||
public PayHandler(PayCallback payCallback) {
|
||||
mPayCallback = new WeakReference<>(payCallback).get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
if (mPayCallback != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> result = (Map<String, String>) msg.obj;
|
||||
if ("9000".equals(result.get("resultStatus"))) {
|
||||
mPayCallback.onSuccess();
|
||||
} else {
|
||||
mPayCallback.onFailed();
|
||||
}
|
||||
}
|
||||
mPayCallback = null;
|
||||
}
|
||||
}
|
||||
// public void onSuccess(int code, String msg, String[] info) {
|
||||
// if (code == 0 && info.length > 0) {
|
||||
// JSONObject obj = JSON.parseObject(info[0]);
|
||||
// String orderInfo = createAliOrder(obj.getString("orderid"));//商品信息
|
||||
// String sign = getOrderSign(orderInfo);//订单签名
|
||||
// if (TextUtils.isEmpty(sign)) {
|
||||
// ToastUtil.show("商户私钥错误,订单签名失败");
|
||||
// return;
|
||||
// }
|
||||
// sign = urlEncode(sign);
|
||||
// String signType = "sign_type=\"RSA\"";//签名类型
|
||||
// mPayInfo = orderInfo + "&sign=\"" + sign + "\"&" + signType;
|
||||
// L.e("支付宝订单信息----->" + mPayInfo);
|
||||
// invokeAliPay();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean showLoadingDialog() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Dialog createLoadingDialog() {
|
||||
// return DialogUitl.loadingDialog(mActivity);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 根据订单号和商品信息生成支付宝格式的订单信息
|
||||
// *
|
||||
// * @param orderId 服务器返回的订单号
|
||||
// * @return
|
||||
// */
|
||||
// private String createAliOrder(String orderId) {
|
||||
// // 合作者身份ID
|
||||
// String orderInfo = "partner=" + "\"" + mPartner + "\"";
|
||||
//
|
||||
// // 卖家支付宝账号
|
||||
// orderInfo += "&seller_id=" + "\"" + mSellerId + "\"";
|
||||
//
|
||||
// // 商户网站唯一订单号
|
||||
// orderInfo += "&out_trade_no=" + "\"" + orderId + "\"";
|
||||
//
|
||||
// // 商品名称
|
||||
// orderInfo += "&subject=" + "\"" + mGoodsName + "\"";
|
||||
//
|
||||
// // 商品详情
|
||||
// orderInfo += "&body=" + "\"" + mGoodsName + "\"";
|
||||
//
|
||||
// // 商品金额
|
||||
// orderInfo += "&total_fee=" + "\"" + mMoney + "\"";
|
||||
//
|
||||
// // 服务器异步通知页面路径 //服务器异步通知页面路径 参数 notify_url,如果商户没设定,则不会进行该操作
|
||||
// orderInfo += "¬ify_url=" + "\"" + mCallbackUrl + "\"";
|
||||
//
|
||||
// // 接口名称, 固定值
|
||||
// orderInfo += "&service=\"mobile.securitypay.pay\"";
|
||||
//
|
||||
// // 支付类型, 固定值
|
||||
// orderInfo += "&payment_type=\"1\"";
|
||||
//
|
||||
// // 参数编码, 固定值
|
||||
// orderInfo += "&_input_charset=\"utf-8\"";
|
||||
//
|
||||
// // 设置未付款交易的超时时间
|
||||
// // 默认30分钟,一旦超时,该笔交易就会自动被关闭。
|
||||
// // 取值范围:1m〜15d。
|
||||
// // m-分钟,h-小时,d-天,1c-当天(无论交易何时创建,都在0点关闭)。
|
||||
// // 该参数数值不接受小数点,如1.5h,可转换为90m。
|
||||
// orderInfo += "&it_b_pay=\"30m\"";
|
||||
//
|
||||
// // 支付宝处理完请求后,当前页面跳转到商户指定页面的路径,可空
|
||||
// orderInfo += "&return_url=\"m.alipay.com\"";
|
||||
//
|
||||
// // 调用银行卡支付,需配置此参数,参与签名, 固定值
|
||||
// // orderInfo += "&paymethod=\"expressGateway\"";
|
||||
//
|
||||
// return orderInfo;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 根据订单信息生成订单的签名
|
||||
// *
|
||||
// * @param orderInfo 订单信息
|
||||
// * @return
|
||||
// */
|
||||
// private String getOrderSign(String orderInfo) {
|
||||
// return SignUtils.sign(orderInfo, mPrivateKey);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 对订单签名进行urlencode转码
|
||||
// *
|
||||
// * @param sign 签名
|
||||
// * @return
|
||||
// */
|
||||
// private String urlEncode(String sign) {
|
||||
// try {
|
||||
// sign = URLEncoder.encode(sign, "UTF-8");
|
||||
// } catch (UnsupportedEncodingException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return sign;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 调用支付宝sdk
|
||||
// */
|
||||
// private void invokeAliPay() {
|
||||
//// new Thread(new Runnable() {
|
||||
//// @Override
|
||||
//// public void run() {
|
||||
////// PayTask alipay = new PayTask(mActivity);
|
||||
//// //执行支付,这是一个耗时操作,最后返回支付的结果,用handler发送到主线程
|
||||
////// Map<String, String> result = alipay.payV2(mPayInfo, true);
|
||||
////// L.e("支付宝返回结果----->" + result);
|
||||
////// if (mPayHandler != null) {
|
||||
////// Message msg = Message.obtain();
|
||||
////// msg.obj = result;
|
||||
////// mPayHandler.sendMessage(msg);
|
||||
////// }
|
||||
////// }
|
||||
//// }).start();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private static class PayHandler extends Handler {
|
||||
//
|
||||
// private PayCallback mPayCallback;
|
||||
//
|
||||
// public PayHandler(PayCallback payCallback) {
|
||||
// mPayCallback = new WeakReference<>(payCallback).get();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void handleMessage(Message msg) {
|
||||
// if (mPayCallback != null) {
|
||||
// @SuppressWarnings("unchecked")
|
||||
// Map<String, String> result = (Map<String, String>) msg.obj;
|
||||
// if ("9000".equals(result.get("resultStatus"))) {
|
||||
// mPayCallback.onSuccess();
|
||||
// } else {
|
||||
// mPayCallback.onFailed();
|
||||
// }
|
||||
// }
|
||||
// mPayCallback = null;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@ import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.Rect;
|
||||
import android.provider.MediaStore;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
@@ -195,4 +197,24 @@ public class BitmapUtil {
|
||||
canvas.drawBitmap(bitmap, 0, 0, paint);
|
||||
return bm;
|
||||
}
|
||||
|
||||
/**
|
||||
* 镜像Bitmap
|
||||
*
|
||||
* @param bitmap
|
||||
* @return
|
||||
*/
|
||||
public Bitmap convertMirror(Bitmap bitmap) {
|
||||
int w = bitmap.getWidth();
|
||||
int h = bitmap.getHeight();
|
||||
Bitmap newb = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);// 创建一个新的和SRC长度宽度一样的位图
|
||||
Canvas cv = new Canvas(newb);
|
||||
Matrix m = new Matrix();
|
||||
//m.postScale(1, -1); //镜像垂直翻转
|
||||
m.postScale(-1, 1); //镜像水平翻转
|
||||
//m.postRotate(-90); //旋转-90度
|
||||
Bitmap new2 = Bitmap.createBitmap(bitmap, 0, 0, w, h, m, true);
|
||||
cv.drawBitmap(new2, new Rect(0, 0, new2.getWidth(), new2.getHeight()), new Rect(0, 0, w, h), null);
|
||||
return newb;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,5 +11,8 @@ public class CommonIconUtil {
|
||||
public static int getSexIcon(int key) {
|
||||
return key == 1 ? R.mipmap.icon_sex_male_1 : R.mipmap.icon_sex_female_1;
|
||||
}
|
||||
public static int getSexIconForUserCard(int key) {
|
||||
return key == 1 ? R.mipmap.user_card_man : R.mipmap.user_card_woman;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Point;
|
||||
import android.text.format.Formatter;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.WindowManager;
|
||||
|
||||
/**
|
||||
* 设备通用类
|
||||
@@ -34,6 +38,19 @@ public class DeviceUtils {
|
||||
return displayMetrics.heightPixels;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取屏幕真实高度
|
||||
*
|
||||
* @param activity activity
|
||||
* @return 屏幕高度
|
||||
*/
|
||||
public static int getScreenRealHeight(Activity activity) {
|
||||
WindowManager service = (WindowManager) activity.getSystemService(Context.WINDOW_SERVICE);
|
||||
Point point = new Point();
|
||||
service.getDefaultDisplay().getRealSize(point);
|
||||
return point.y;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
|
||||
*
|
||||
@@ -61,7 +78,7 @@ public class DeviceUtils {
|
||||
public static String getVersionName(Context context) {
|
||||
try {
|
||||
PackageManager manager = context.getPackageManager();
|
||||
PackageInfo info = manager.getPackageInfo(context.getPackageName(),0);
|
||||
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
|
||||
return info.versionName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -69,4 +86,21 @@ public class DeviceUtils {
|
||||
return "0";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前是否处于低内存状态
|
||||
*/
|
||||
public static boolean isLowMemory(Context context) {
|
||||
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
|
||||
am.getMemoryInfo(mi);
|
||||
return mi.lowMemory;
|
||||
}
|
||||
|
||||
public static String getMemory(Context context) {
|
||||
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
|
||||
am.getMemoryInfo(mi);
|
||||
return Formatter.formatFileSize(context, mi.availMem);// 将获取的内存大小规格化
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,10 @@ package com.yunbao.common.utils;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.text.InputFilter;
|
||||
import android.text.InputType;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.SparseArray;
|
||||
@@ -19,6 +21,8 @@ import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.LayoutRes;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -320,6 +324,9 @@ public class DialogUitl {
|
||||
private int mLength;
|
||||
private SimpleCallback mClickCallback;
|
||||
private SimpleCallback3 mClickCallback3;
|
||||
private SimpleCallbackView mSimpleCallbackView;
|
||||
private int mView = 0;
|
||||
private CharSequence mSpanned;
|
||||
|
||||
public Builder(Context context) {
|
||||
mContext = context;
|
||||
@@ -332,6 +339,18 @@ public class DialogUitl {
|
||||
|
||||
public Builder setContent(String content) {
|
||||
mContent = content;
|
||||
this.mSpanned = null;//设置文本则不是使用HTML代码
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setHtmlCode(CharSequence mSpanned) {
|
||||
this.mSpanned = mSpanned;
|
||||
this.mContent = null;//设置HTML代码则不使用文本
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setSimpleCallbackView(SimpleCallbackView mSimpleCallbackView) {
|
||||
this.mSimpleCallbackView = mSimpleCallbackView;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -385,9 +404,18 @@ public class DialogUitl {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setView(@LayoutRes int layoutRes) {
|
||||
mView = layoutRes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Dialog build() {
|
||||
final Dialog dialog = new Dialog(mContext, mBackgroundDimEnabled ? R.style.dialog : R.style.dialog2);
|
||||
dialog.setContentView(mInput ? R.layout.dialog_input : R.layout.dialog_simple);
|
||||
if (mView != 0) {
|
||||
dialog.setContentView(mView);
|
||||
} else {
|
||||
dialog.setContentView(mInput ? R.layout.dialog_input : R.layout.dialog_simple);
|
||||
}
|
||||
dialog.setCancelable(mCancelable);
|
||||
dialog.setCanceledOnTouchOutside(mCancelable);
|
||||
TextView titleView = (TextView) dialog.findViewById(R.id.title);
|
||||
@@ -401,6 +429,9 @@ public class DialogUitl {
|
||||
if (!TextUtils.isEmpty(mContent)) {
|
||||
content.setText(mContent);
|
||||
}
|
||||
if (mSpanned != null) {
|
||||
content.setText(mSpanned);
|
||||
}
|
||||
if (mInputType == INPUT_TYPE_NUMBER) {
|
||||
content.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
} else if (mInputType == INPUT_TYPE_NUMBER_PASSWORD) {
|
||||
@@ -431,23 +462,33 @@ public class DialogUitl {
|
||||
mClickCallback.onConfirmClick(dialog, "");
|
||||
}
|
||||
} else {
|
||||
dialog.dismiss();
|
||||
|
||||
if (mClickCallback3 != null) {
|
||||
mClickCallback3.onConfirmClick(dialog);
|
||||
}
|
||||
if (mSimpleCallbackView != null) {
|
||||
mSimpleCallbackView.onConfirmClick(dialog,titleView, content, btnConfirm, btnCancel);
|
||||
}else{
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
dialog.dismiss();
|
||||
|
||||
if (mClickCallback3 != null) {
|
||||
mClickCallback3.onCancel();
|
||||
|
||||
dialog.dismiss();
|
||||
} else {
|
||||
|
||||
if (mClickCallback instanceof SimpleCallback2) {
|
||||
((SimpleCallback2) mClickCallback).onCancelClick();
|
||||
}
|
||||
if (mSimpleCallbackView != null) {
|
||||
mSimpleCallbackView.onCancel(dialog,titleView, content, btnConfirm, btnCancel);
|
||||
}else{
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -455,6 +496,14 @@ public class DialogUitl {
|
||||
};
|
||||
btnConfirm.setOnClickListener(listener);
|
||||
btnCancel.setOnClickListener(listener);
|
||||
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
if (mSimpleCallbackView != null) {
|
||||
mSimpleCallbackView.onShow(dialog,titleView, content, btnConfirm, btnCancel);
|
||||
}
|
||||
}
|
||||
});
|
||||
return dialog;
|
||||
}
|
||||
|
||||
@@ -482,6 +531,14 @@ public class DialogUitl {
|
||||
void onCancel();
|
||||
}
|
||||
|
||||
public interface SimpleCallbackView {
|
||||
void onShow(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn);
|
||||
|
||||
void onConfirmClick(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn);
|
||||
|
||||
void onCancel(Dialog dialog, View title, View context, View confirmBtn, View cancelBtn);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 城市选择
|
||||
|
||||
@@ -33,6 +33,24 @@ public class FileUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 把字符串追加保存成文件
|
||||
*/
|
||||
public static void saveAddStringToFile(File dir, String content, String fileName) {
|
||||
PrintWriter writer = null;
|
||||
try {
|
||||
FileOutputStream os = new FileOutputStream(new File(dir, fileName));
|
||||
writer = new PrintWriter(os);
|
||||
writer.append(content);
|
||||
writer.flush();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从文件读取字符串
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.util.Log;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
@@ -59,7 +60,7 @@ public class GiftCacheUtil {
|
||||
} else {
|
||||
DownloadUtil downloadUtil = new DownloadUtil();
|
||||
if (forwhat.equals("1")) {
|
||||
ToastUtil.show("礼物正在获取中...");
|
||||
ToastUtil.show(R.string.gift_way);
|
||||
}
|
||||
downloadUtil.download(CommonHttpConsts.DOWNLOAD_GIF, dir, fileName, url, new DownloadUtil.Callback() {
|
||||
String TAG="下载";
|
||||
|
||||
@@ -0,0 +1,500 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import static com.yunbao.common.CommonAppConfig.isGetNewWrap;
|
||||
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.ReportCommunityBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.bean.VideoBean;
|
||||
import com.yunbao.common.bean.VideoListBean;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
//网页调用Android工具类
|
||||
public class JavascriptInterfaceUtils {
|
||||
private Activity mContext;
|
||||
private WebView mWebView;
|
||||
//判断是页面关闭还是网页回退
|
||||
private boolean pageClose = false;
|
||||
private boolean dialogClose = false;
|
||||
//同名activity跳转问题
|
||||
private boolean LiveZhuangBana = true;
|
||||
private static JavascriptInterfaceUtils sInstance;
|
||||
|
||||
public JavascriptInterfaceUtils setPageClose(boolean pageClose) {
|
||||
this.pageClose = pageClose;
|
||||
return this;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceUtils setDialogClose(boolean dialogClose) {
|
||||
this.dialogClose = dialogClose;
|
||||
return this;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceUtils setLiveZhuangBana(boolean liveZhuangBana) {
|
||||
LiveZhuangBana = liveZhuangBana;
|
||||
return this;
|
||||
}
|
||||
|
||||
public JavascriptInterfaceUtils setmContext(Activity mContext, WebView mWebView) {
|
||||
this.mContext = mContext;
|
||||
this.mWebView = mWebView;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static JavascriptInterfaceUtils getInstance() {
|
||||
|
||||
synchronized (JavascriptInterfaceUtils.class) {
|
||||
|
||||
sInstance = new JavascriptInterfaceUtils();
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidOpeningNoble(String svg) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidOpeningNoble")
|
||||
.setSvg(svg));
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidGoBack() {
|
||||
if (pageClose) {
|
||||
mContext.finish();
|
||||
} else {
|
||||
if (dialogClose) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidGoBack"));
|
||||
} else {
|
||||
mContext.runOnUiThread(() -> mWebView.goBack());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void AndroidAdjustConsume() {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("AndroidAdjustConsume"));
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidGoToRe() {
|
||||
ARouter.getInstance().build(PATH_COIN).withInt("p", 1).navigation();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void onBack() {
|
||||
mContext.finish();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidClickToNewH5PageView(String url) {
|
||||
url = CommonAppConfig.HOST + url;
|
||||
if (url.contains("?")) {
|
||||
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||
+ CommonAppConfig.getInstance().getToken();
|
||||
} else {
|
||||
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||
+ CommonAppConfig.getInstance().getToken();
|
||||
}
|
||||
if (LiveZhuangBana) {
|
||||
RouteUtil.forwardLiveZhuangBanActivity(url, false);
|
||||
} else {
|
||||
RouteUtil.forwardZhuangBanActivity(url, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新跳转
|
||||
*
|
||||
* @param url 跳转的url
|
||||
* @param title 有标题的展示标题
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public void androidClickToNewH5PageView(String url, String title) {
|
||||
url = CommonAppConfig.HOST + url;
|
||||
if (url.contains("?")) {
|
||||
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||
+ CommonAppConfig.getInstance().getToken();
|
||||
} else {
|
||||
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||
+ CommonAppConfig.getInstance().getToken();
|
||||
}
|
||||
if (LiveZhuangBana) {
|
||||
RouteUtil.forwardLiveZhuangBanActivity(url, title);
|
||||
} else {
|
||||
RouteUtil.forwardZhuangBanActivity(url, title);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置超皇字体颜色
|
||||
*
|
||||
* @param startColor 渐变色
|
||||
* @param endColor 渐变色
|
||||
* @param contentColor 内容颜色
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public void androidSetColor(String startColor, String endColor, String contentColor) {
|
||||
IMLoginModel model = IMLoginManager.get(mContext).getUserInfo();
|
||||
model.setStartColor("#" + startColor)
|
||||
.setEndColor("#" + endColor)
|
||||
.setContentColor("#" + contentColor);
|
||||
IMLoginManager.get(mContext).upDataUserInfo(model);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidCommunityGift(String postsId) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidCommunityGift")
|
||||
.setPostsId(postsId));
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void reportCommunity(String info) {
|
||||
ReportCommunityBean reportCommunityBean = JSON.parseObject(info, ReportCommunityBean.class);
|
||||
RouteUtil.forwardLiveReportActivity(reportCommunityBean.getDynamic_id(), 1, reportCommunityBean.getCommunity_type(), reportCommunityBean.getComment_id());
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void reportUser(String touid) {
|
||||
RouteUtil.forwardLiveReportActivity(touid);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void isCloseNavigation(String isClose) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("isCloseNavigation")
|
||||
.setIsClose(isClose));
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidPlayVideo(String list) {
|
||||
list.toString();
|
||||
if (!"undefined".equals(list)) {
|
||||
JSONObject obj = JSON.parseObject(list);
|
||||
int position = obj.getIntValue("video_index");
|
||||
String videoListString = obj.getString("video_list");
|
||||
List<VideoListBean> videoList = JSON.parseArray(videoListString, VideoListBean.class);
|
||||
List<VideoBean> videoBeanList = new ArrayList<>();
|
||||
for (VideoListBean videoListBean : videoList) {
|
||||
JSONObject obj2 = JSON.parseObject(videoListBean.getContent());
|
||||
String msg = obj2.getString("msg");
|
||||
VideoBean videoBean = new VideoBean();
|
||||
videoBean.setHref(videoListBean.getVideo());
|
||||
videoBean.setCity("");
|
||||
videoBean.setCommentNum(videoListBean.getComment_num());
|
||||
videoBean.setAddtime(videoListBean.getCreate_time());
|
||||
videoBean.setDatetime("");
|
||||
videoBean.setDistance("");
|
||||
videoBean.setId(videoListBean.getId());
|
||||
videoBean.setLat("");
|
||||
videoBean.setLike(0);
|
||||
videoBean.setTitle(msg);
|
||||
if ("2".endsWith(videoListBean.getIs_attention()) || "0".endsWith(videoListBean.getIs_attention())) {
|
||||
videoBean.setAttent(2);
|
||||
} else if ("1".endsWith(videoListBean.getIs_attention())) {
|
||||
videoBean.setAttent(1);
|
||||
} else {
|
||||
videoBean.setAttent(-1);
|
||||
}
|
||||
UserBean userBean = new UserBean();
|
||||
userBean.setAvatar(videoListBean.getUser_avatar());
|
||||
userBean.setUserNiceName(videoListBean.getUser_name());
|
||||
userBean.setId(videoListBean.getUser_id());
|
||||
videoBean.setUserBean(userBean);
|
||||
|
||||
videoBean.setUid(videoListBean.getUser_id());
|
||||
videoBeanList.add(videoBean);
|
||||
}
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidPlayVideo")
|
||||
.setVideoBeanList(videoBeanList)
|
||||
.setPosition(position));
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidClickSayHiBack(String uid, String name, String img) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidClickSayHiBack")
|
||||
.setUserId(uid)
|
||||
.setUserId(uid)
|
||||
.setImage(img)
|
||||
.setName(name));
|
||||
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidMethodLookToLive(String liveId) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidMethodLookToLive")
|
||||
.setLiveId(liveId));
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidClickFansList(String uid) {
|
||||
RouteUtil.forwardFansActivity(uid);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public String androidMethod(String data) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent().setMethod("androidMethod").setData(data));
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public String androidGetNewWrap(String data) {
|
||||
if (data != null && !data.isEmpty()) {
|
||||
isGetNewWrap = true;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidMethodBack() {
|
||||
mContext.finish();
|
||||
}
|
||||
|
||||
|
||||
@JavascriptInterface
|
||||
public void modifyMydata() {
|
||||
Bus.get().post(new JavascriptInterfaceEvent().setMethod("modifyMydata").setIndexInto(1));
|
||||
RouteUtil.forwardEditProfileActivity();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void gotoHomePage(String indexStr) {
|
||||
if (!"".equals(indexStr) && indexStr != null) {
|
||||
int index = -1;
|
||||
if ("0".equals(indexStr)) {
|
||||
index = 0;
|
||||
} else if ("1".equals(indexStr)) {
|
||||
index = 1;
|
||||
} else if ("2".equals(indexStr)) {
|
||||
index = 2;
|
||||
} else if ("3".equals(indexStr)) {
|
||||
index = 3;
|
||||
}
|
||||
if (index != -1) {
|
||||
mContext.finish();
|
||||
Constants.isShowPage = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void openWebView(String url) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent().setMethod("openWebView").setData(url));
|
||||
Constants.isTitle = false;
|
||||
RouteUtil.forwardZhuangBanActivity(url);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void openWebViewTitle(String url) {
|
||||
Constants.isTitle = true;
|
||||
RouteUtil.forwardZhuangBanActivity(url);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidNewGoToGooglePay(String ProductId, String OrderNumber, String MoneyUsd) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidNewGoToGooglePay")
|
||||
.setProductId(ProductId)
|
||||
.setMoneyUsd(MoneyUsd)
|
||||
.setOrderNumber(OrderNumber));
|
||||
}
|
||||
|
||||
//拉黑不感兴趣
|
||||
@JavascriptInterface
|
||||
public void androidLoseInterest() {
|
||||
EventBus.getDefault().post("blacklist");
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void AndroidFellow() {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("AndroidFellow"));
|
||||
}
|
||||
|
||||
//跳转修改昵称
|
||||
@JavascriptInterface
|
||||
public void openUpdataName() {
|
||||
Constants.myIntoIndex = 2;
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("openUpdataName")
|
||||
.setUpdataUser(true));
|
||||
RouteUtil.forwardMyWebViewActivity2(CommonAppConfig.HOST + "/h5/table/Modify-information.html" + "?token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid());
|
||||
}
|
||||
|
||||
//跳转修改头像
|
||||
@JavascriptInterface
|
||||
public void openUpdataAvater() {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("openUpdataAvater"));
|
||||
|
||||
}
|
||||
|
||||
//跳转修改头像
|
||||
@JavascriptInterface
|
||||
public void openUpdataAvater(String s) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("openUpdataAvater"));
|
||||
|
||||
}
|
||||
|
||||
//跳转修改签名
|
||||
@JavascriptInterface
|
||||
public void openUpdataAutograph() {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("openUpdataAutograph"));
|
||||
|
||||
}
|
||||
|
||||
//跳转修改签名
|
||||
@JavascriptInterface
|
||||
public void openUpdataAutograph(String s) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("openUpdataAutograph"));
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidGoTopUp() {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidGoTopUp"));
|
||||
//我们的
|
||||
ARouter.getInstance().build(PATH_COIN).withInt("p", 0).withString("tag", "&first_page=1").navigation();
|
||||
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public String androidMethodLookLive(String uId, String liveId, String isLiving) {
|
||||
//跳转个人主页
|
||||
RouteUtil.forwardUserHome(mContext, liveId, 0);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void AndroidClose() {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("AndroidClose"));
|
||||
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void sendFansCard(String id) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("sendFansCard")
|
||||
.setLiveId(id));
|
||||
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public String androidMethodClickUser(String userId, String liveId) {
|
||||
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidMethodClickUser")
|
||||
.setLiveId(liveId)
|
||||
.setUserId(userId));
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void onTrickerySendGift(String id) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("onTrickerySendGift")
|
||||
.setUserId(id));
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidZBan(String svg) {
|
||||
String[] arr = svg.split("/");
|
||||
String id = arr[arr.length - 1];
|
||||
String url1;
|
||||
if (!svg.contains("http")) {
|
||||
url1 = CommonAppConfig.HOST + svg;
|
||||
} else {
|
||||
url1 = svg;
|
||||
}
|
||||
GiftCacheUtil.getFile(Constants.GIF_CAR_PREFIX + id, url1, "0", new CommonCallback<File>() {
|
||||
@Override
|
||||
public void callback(File bean) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void AndroidAdjustPrank() {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("AndroidAdjustPrank"));
|
||||
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void openWrap() {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("openWrap"));
|
||||
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidSignGift(String json) {
|
||||
Bus.get().post(new JavascriptInterfaceEvent()
|
||||
.setMethod("androidSignGift")
|
||||
.setData(json));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置webView高度
|
||||
* @param useDp 是否用dp换算
|
||||
*/
|
||||
@JavascriptInterface
|
||||
public void setHeight(String height, String width,boolean useDp) {
|
||||
if ("0".equals(height)) {
|
||||
return;
|
||||
}
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
handler.post(() -> {
|
||||
ViewGroup.LayoutParams params = mWebView.getLayoutParams();
|
||||
if("-1".equals(height)){
|
||||
params.height=ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
}else {
|
||||
params.height = useDp?DpUtil.dp2px(Integer.parseInt(height)):Integer.parseInt(height);
|
||||
}
|
||||
mWebView.setLayoutParams(params);
|
||||
mWebView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,23 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import static android.provider.Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION;
|
||||
import static androidx.core.content.PermissionChecker.PERMISSION_GRANTED;
|
||||
import static java.text.DateFormat.DEFAULT;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.core.content.PermissionChecker;
|
||||
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.callback.StringCallback;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
@@ -14,10 +28,24 @@ import com.lzy.okserver.upload.UploadListener;
|
||||
import com.lzy.okserver.upload.UploadTask;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.WritableByteChannel;
|
||||
import java.nio.file.Files;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/6/20.
|
||||
@@ -58,15 +86,15 @@ public class LogUtil {
|
||||
Log.i("异常上传", "pushError: 准备上传文件");
|
||||
String err = FileUtil.loadStringToFile(file);
|
||||
String time = matcher(".(?<=time\\=).*(?=\\AndroidVersion\\=)", err);
|
||||
if(time!=null){
|
||||
time=time.replace("=","");
|
||||
}else{
|
||||
time=System.currentTimeMillis()+"";
|
||||
if (time != null) {
|
||||
time = time.replace("=", "");
|
||||
} else {
|
||||
time = System.currentTimeMillis() + "";
|
||||
}
|
||||
PostRequest<String> request = OkGo.<String>post("https://newht.yaoulive.com/index.php/api/error_log/report")
|
||||
.params("log", err)
|
||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||
.params("time",time)
|
||||
.params("time", time)
|
||||
.params("isGoogle", CommonAppConfig.IS_GOOGLE_PLAY)
|
||||
.params("appVersion", CommonAppConfig.getInstance().getVersion())
|
||||
.tag("errorLog")
|
||||
@@ -119,4 +147,70 @@ public class LogUtil {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static void shareFile(Context context) {
|
||||
if(true){
|
||||
return;
|
||||
}
|
||||
if (PermissionChecker.checkCallingOrSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions((Activity) context, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 100);
|
||||
return;
|
||||
}
|
||||
String title = "[PDLIVE]" + CommonAppConfig.getInstance().getUid() + "_";
|
||||
String today = title + SimpleDateFormat.getDateInstance(DEFAULT, Locale.CHINA).format(new Date());
|
||||
File dir = new File(context.getDir("files", Context.MODE_PRIVATE).getAbsolutePath() + File.separator);
|
||||
File zip = new File(context.getDir("files", Context.MODE_PRIVATE).getAbsolutePath() + File.separator + today + ".zip");
|
||||
|
||||
try {
|
||||
ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zip)));
|
||||
FileInputStream fis = null;
|
||||
WritableByteChannel writableByteChannel = Channels.newChannel(zos);
|
||||
if (dir.listFiles() != null) {
|
||||
for (File file : dir.listFiles()) {
|
||||
if (file.getName().endsWith(".log")) {
|
||||
ZipEntry entry = new ZipEntry(file.getName());
|
||||
zos.putNextEntry(entry);
|
||||
fis = new FileInputStream(file);
|
||||
FileChannel channel = fis.getChannel();
|
||||
channel.transferTo(0, file.length() - 1, writableByteChannel);
|
||||
fis.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
zos.close();
|
||||
writableByteChannel.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (zip.exists()) {
|
||||
Intent share = new Intent(Intent.ACTION_SEND);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
Uri contentUri = FileProvider.getUriForFile(context, context.getPackageName() + ".fileprovider", zip);
|
||||
share.putExtra(Intent.EXTRA_STREAM, contentUri);
|
||||
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
} else {
|
||||
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(zip));
|
||||
}
|
||||
share.setType("application/vnd.ms-excel");
|
||||
share.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
context.startActivity(Intent.createChooser(share, "分享文件"));
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && !CommonAppConfig.IS_GOOGLE_PLAY) {
|
||||
if (!Environment.isExternalStorageManager()) {
|
||||
Intent intent = new Intent(ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
File out = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + zip.getName());
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Files.copy(zip.toPath(), out.toPath());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleCallback;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 统一管理连麦状态
|
||||
*/
|
||||
public class MicStatusManager {
|
||||
public static final int MIC_TYPE_DEFAULT = 0;//默认状态,未连麦
|
||||
public static final int MIC_TYPE_REQUEST = 1;//请求连麦中
|
||||
public static final int MIC_TYPE_OPEN = 2;//连麦中
|
||||
private static MicStatusManager manager;
|
||||
private int micStatus;//连麦状态
|
||||
private String micLiveId;//主播uid
|
||||
private boolean anchorOpenRoom = false;//主播是否开启连麦房
|
||||
private List<OnMicStatusListener> listeners;
|
||||
|
||||
public static MicStatusManager getInstance() {
|
||||
if (manager == null) {
|
||||
manager = new MicStatusManager();
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
private MicStatusManager() {
|
||||
listeners = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 连麦状态监听器,申请、连麦中触发onStart,退出连麦触发onClose
|
||||
*/
|
||||
public void addOnMicListener(OnMicStatusListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeOnMicListener(OnMicStatusListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
public void setMicData(int micStatus, String micLiveId) {
|
||||
this.micLiveId = micLiveId;
|
||||
this.micStatus = micStatus;
|
||||
|
||||
for (OnMicStatusListener listener : listeners) {
|
||||
listener.onStart();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAnchorOpenRoom() {
|
||||
return anchorOpenRoom;
|
||||
}
|
||||
|
||||
public void setAnchorOpenRoom(boolean anchorOpenRoom) {
|
||||
this.anchorOpenRoom = anchorOpenRoom;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
micStatus = 0;
|
||||
micLiveId = "";
|
||||
for (OnMicStatusListener listener : listeners) {
|
||||
listener.onClose();
|
||||
}
|
||||
}
|
||||
|
||||
public int getMicStatus() {
|
||||
return micStatus;
|
||||
}
|
||||
|
||||
public String getMicLiveId() {
|
||||
return micLiveId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MicStatusManager{" +
|
||||
"micStatus=" + micStatus +
|
||||
", micLiveId='" + micLiveId + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
/**
|
||||
* 断开连麦
|
||||
*/
|
||||
public void downMic() {
|
||||
HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm")
|
||||
.params("roomid", micLiveId)
|
||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.e("ry", code + "退出多人");
|
||||
RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() {
|
||||
|
||||
/**
|
||||
* 当切换失败且SDK处于无法回退状态时回调,该角色已经无法使用当前角色继续进行音视频。
|
||||
* SDK内部会退出房间并清理所有资源,该用户只能重新加入房间才能继续音视频。
|
||||
*/
|
||||
@Override
|
||||
public void onKicked() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("ry", "下麦成功");
|
||||
// 该用户切换为观众成功,可以以观众身份进行音视频
|
||||
//退出rtc播放
|
||||
RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("ry", "退出多人房间成功");
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
public void run() {
|
||||
MicStatusManager.getInstance().clear();
|
||||
ToastUtil.show("已成功退出語音連麥");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
Log.e("ry", errorCode + "退出多人房间成功");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 当切换失败且不影响当前角色继续音视频时回调
|
||||
* @param errorCode 失败错误码
|
||||
*/
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
Log.e("ry", "下麦失败" + errorCode);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播关闭连麦权限
|
||||
*/
|
||||
public void closeMic(Context mContext) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.delDrLm()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<BaseModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<BaseModel> stringResponseModel) throws Exception {
|
||||
System.out.println("stringResponseModel.getData() = " + stringResponseModel.getData());
|
||||
anchorOpenRoom = false;
|
||||
}
|
||||
}, Throwable::printStackTrace)
|
||||
.isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否在连麦中
|
||||
*
|
||||
* @param toUid 目标uid
|
||||
*/
|
||||
public boolean isMic(String toUid) {
|
||||
return micStatus == MIC_TYPE_OPEN && !micLiveId.equals(toUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示退出连麦状态对话框
|
||||
*/
|
||||
public void showDownMicDialog(Context context) {
|
||||
DialogUitl.showSimpleDialog(context, "當前正在連麥中", new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
// downMic(); //不做下麦跳转
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface OnMicStatusListener {
|
||||
void onStart();
|
||||
|
||||
void onClose();
|
||||
}
|
||||
}
|
||||
@@ -22,4 +22,41 @@ public class NobleUtil {
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
public static String nobleIdToStringName(int id){
|
||||
switch (id){
|
||||
case 1:return "男爵";
|
||||
case 2:return "子爵";
|
||||
case 3:return "侯爵";
|
||||
case 4:return "公爵";
|
||||
case 5:return "国王";
|
||||
case 6:return "皇帝";
|
||||
case 7:return "超皇";
|
||||
}
|
||||
return "未开通";
|
||||
}
|
||||
public static int getNobleBackgroundId(int id){
|
||||
switch (id){
|
||||
case 1:return R.mipmap.img_aristocrat_nanjue;
|
||||
case 2:return R.mipmap.img_aristocrat_zijue;
|
||||
case 3:return R.mipmap.img_aristocrat_houjue;
|
||||
case 4:return R.mipmap.img_aristocrat_gongjue;
|
||||
case 5:return R.mipmap.img_aristocrat_guowang;
|
||||
case 6:return R.mipmap.img_aristocrat_huangdi;
|
||||
case 7:return R.mipmap.img_aristocrat_chaohuang;
|
||||
}
|
||||
return R.mipmap.img_aristocrat_notopen;
|
||||
}
|
||||
|
||||
public static int getUserCardTitleBackgroundId(int id) {
|
||||
switch (id){
|
||||
case 1:return R.drawable.bg_user_card_title_nanjue;
|
||||
case 2:return R.drawable.bg_user_card_title_zijue;
|
||||
case 3:return R.drawable.bg_user_card_title_houjue;
|
||||
case 4:return R.drawable.bg_user_card_title_gongjue;
|
||||
case 5:return R.drawable.bg_user_card_title_guowang;
|
||||
case 6:return R.drawable.bg_user_card_title_huangdi;
|
||||
case 7:return R.drawable.bg_user_card_title_chaohuang;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.yunbao.common.utils;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.alibaba.android.arouter.facade.Postcard;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.HtmlConfig;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
@@ -24,11 +26,26 @@ public class RouteUtil {
|
||||
public static final String PATH_LIVEREPORT = "/live/LiveReportActivity";
|
||||
public static final String PATH_MYWEBVIEWACTIVTITY = "/main/MyWebViewActivity";
|
||||
public static final String PATH_ZHUANGBANACTIVITY = "/main/ZhuangBanActivity";
|
||||
public static final String PATH_LiveZHUANGBANACTIVITY = "/live/ZhuangBanActivity";
|
||||
public static final String PATH_FACEBOOKACTIVITY = "/baidu/FacebookLoginActivity";
|
||||
public static final String PATH_MAIN = "/main/MainActivity";
|
||||
public static final String PATH_ENTRY = "/main/EntryActivity";
|
||||
public static final String PATH_LIVE_AUDIENCE = "/live/LiveAudienceActivity";
|
||||
public static final String PATH_SETTING = "/main/SettingActivity";
|
||||
public static final String PATH_FANSACTIVITY = "/main/FansActivity";
|
||||
public static final String PATH_MYWEBVIEWACTIVTITY2 = "/main/MyWebViewActivity2";
|
||||
|
||||
public static void forwardFansActivity(String uid) {
|
||||
ARouter.getInstance().build(PATH_FANSACTIVITY)
|
||||
.withString(Constants.TO_UID, uid)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
public static void forwardMyWebViewActivity2(String url) {
|
||||
ARouter.getInstance().build(PATH_MYWEBVIEWACTIVTITY2)
|
||||
.withString(Constants.URL, url)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动页
|
||||
@@ -85,6 +102,7 @@ public class RouteUtil {
|
||||
}
|
||||
Constants.myUrl = url + "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&t=" + System.currentTimeMillis();
|
||||
ARouter.getInstance().build(PATH_MYWEBVIEWACTIVTITY)
|
||||
.withString(Constants.URL, url)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
@@ -98,6 +116,48 @@ public class RouteUtil {
|
||||
.navigation();
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到装扮
|
||||
*/
|
||||
public static void forwardZhuangBanActivity(String url, boolean isFull) {
|
||||
ARouter.getInstance().build(PATH_ZHUANGBANACTIVITY)
|
||||
.withString("url", url)
|
||||
.withBoolean("isFull", isFull)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到装扮
|
||||
*/
|
||||
public static void forwardLiveZhuangBanActivity(String url, boolean isFull) {
|
||||
ARouter.getInstance().build(PATH_LiveZHUANGBANACTIVITY)
|
||||
.withString("url", url)
|
||||
.withBoolean("isFull", isFull)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到装扮
|
||||
*/
|
||||
public static void forwardLiveZhuangBanActivity(String url, String title) {
|
||||
ARouter.getInstance().build(PATH_LiveZHUANGBANACTIVITY)
|
||||
.withString("url", url)
|
||||
.withString("title", title)
|
||||
.withBoolean("isFull", false)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到装扮
|
||||
*/
|
||||
public static void forwardZhuangBanActivity(String url, String title) {
|
||||
ARouter.getInstance().build(PATH_ZHUANGBANACTIVITY)
|
||||
.withString("url", url)
|
||||
.withString("title", title)
|
||||
.withBoolean("isFull", false)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到充值页面
|
||||
*/
|
||||
@@ -114,6 +174,7 @@ public class RouteUtil {
|
||||
ARouter.getInstance().build(PATH_EDITPROFILE)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改个人资料
|
||||
*/
|
||||
@@ -121,18 +182,30 @@ public class RouteUtil {
|
||||
ARouter.getInstance().build(PATH_SETTING)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开直播页面
|
||||
*/
|
||||
public static void forwardLiveAudienceActivity(LiveBean mLiveBean, int mLiveType, int mLiveSDK, int mLiveTypeVal) {
|
||||
ARouter.getInstance().build(PATH_LIVE_AUDIENCE)
|
||||
if (MicStatusManager.getInstance().isMic(mLiveBean.getUid())) {
|
||||
MicStatusManager.getInstance().showDownMicDialog(CommonAppContext.activityWeakReference.get());
|
||||
return;
|
||||
}
|
||||
Postcard postcard = ARouter.getInstance().build(PATH_LIVE_AUDIENCE)
|
||||
.withBoolean(Constants.NEW_ENTER_ROOM, false)
|
||||
.withParcelable(Constants.LIVE_BEAN, mLiveBean)
|
||||
.withInt(Constants.LIVE_TYPE, mLiveType)
|
||||
.withInt(Constants.LIVE_SDK, mLiveSDK)
|
||||
.withInt(Constants.LIVE_TYPE_VAL, mLiveTypeVal)
|
||||
.navigation();
|
||||
.withInt(Constants.LIVE_TYPE_VAL, mLiveTypeVal);
|
||||
if (mLiveBean.getParams() != null) {
|
||||
for (String key : mLiveBean.getParams().keySet()) {
|
||||
postcard.withString(key, mLiveBean.getParams().get(key));
|
||||
}
|
||||
}
|
||||
postcard.navigation();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 举报个人
|
||||
*/
|
||||
@@ -142,6 +215,15 @@ public class RouteUtil {
|
||||
.navigation();
|
||||
}
|
||||
|
||||
public static void forwardLiveReportActivity(String dynamicId, int intoIndex, String communityType, String commentId) {
|
||||
ARouter.getInstance().build(PATH_LIVEREPORT)
|
||||
.withString(Constants.TO_UID, dynamicId)
|
||||
.withInt(Constants.INTOINDEX, intoIndex)
|
||||
.withString("community_type", communityType)
|
||||
.withString("comment_id", commentId)
|
||||
.navigation();
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入facebook登录
|
||||
*/
|
||||
|
||||
@@ -10,26 +10,29 @@ import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.king.app.dialog.AppDialog;
|
||||
import com.king.app.updater.AppUpdater;
|
||||
import com.king.app.updater.UpdateConfig;
|
||||
import com.king.app.updater.callback.UpdateCallback;
|
||||
import com.king.app.updater.http.OkHttpManager;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
|
||||
import constant.UiType;
|
||||
import model.UiConfig;
|
||||
import model.UpdateConfig;
|
||||
import update.UpdateAppUtils;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/10/9.
|
||||
*/
|
||||
import java.io.File;
|
||||
|
||||
public class VersionUtil {
|
||||
|
||||
private static String sVersion;
|
||||
|
||||
|
||||
public TextView tvProgress;
|
||||
public ProgressBar progressBar;
|
||||
/**
|
||||
* 是否是最新版本
|
||||
*/
|
||||
@@ -46,170 +49,177 @@ public class VersionUtil {
|
||||
else return false;
|
||||
// return curVersion.equal(version);
|
||||
}
|
||||
|
||||
|
||||
//是否是谷歌版本
|
||||
public static void showDialog(final Activity context, ConfigBean configBean, final String downloadUrl) {
|
||||
if (configBean.getForceUpdate() != 0) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
||||
if (!TextUtils.isEmpty(downloadUrl)) {
|
||||
try {
|
||||
UpdateAppUtils.init(context);
|
||||
UpdateConfig updateConfig = new UpdateConfig();
|
||||
updateConfig.setForce(true);
|
||||
updateConfig.setShowNotification(true);
|
||||
updateConfig.setAlwaysShowDownLoadDialog(true);
|
||||
|
||||
//UI
|
||||
UiConfig uiConfig = new UiConfig();
|
||||
uiConfig.setUiType(UiType.PLENTIFUL);
|
||||
UpdateAppUtils
|
||||
.getInstance()
|
||||
.uiConfig(uiConfig)
|
||||
.apkUrl(downloadUrl)
|
||||
.updateConfig(updateConfig)
|
||||
.updateTitle("发现新版本")
|
||||
.updateContent(configBean.getUpdateDes())
|
||||
.update();
|
||||
|
||||
} catch (Exception e) {
|
||||
ToastUtil.show(R.string.version_download_url_error);
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(R.string.version_download_url_error);
|
||||
}
|
||||
|
||||
//谷歌更新
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
if ("0".equals(configBean.getGoogle_isup())) {
|
||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||
.setContent(configBean.getUpdateDes())
|
||||
.setConfrimString(WordUtil.getString(R.string.version_immediate_use))
|
||||
.setCancelString(WordUtil.getString(R.string.version_not_update))
|
||||
.setCancelable(true)
|
||||
.setClickCallback(new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
try {
|
||||
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
||||
context.startActivity(i);
|
||||
} catch (Exception e) {
|
||||
ToastUtil.show(R.string.version_download_url_error);
|
||||
}
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.show();
|
||||
} else {
|
||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||
.setContent(configBean.getUpdateDes())
|
||||
.setConfrimString(WordUtil.getString(R.string.version_immediate_use))
|
||||
.setCancelString(WordUtil.getString(R.string.version_not_update))
|
||||
.setCancelable(false)
|
||||
.setClickCallback(new DialogUitl.SimpleCallback2() {
|
||||
public void onCancelClick() {
|
||||
context.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
||||
context.startActivity(i);
|
||||
context.finish();
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.show();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
||||
if (!TextUtils.isEmpty(downloadUrl)) {
|
||||
try {
|
||||
UpdateAppUtils.init(context);
|
||||
UpdateConfig updateConfig = new UpdateConfig();
|
||||
updateConfig.setShowNotification(true);
|
||||
updateConfig.setAlwaysShowDownLoadDialog(true);
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//UI
|
||||
UiConfig uiConfig = new UiConfig();
|
||||
uiConfig.setUiType(UiType.PLENTIFUL);
|
||||
UpdateAppUtils
|
||||
.getInstance()
|
||||
.uiConfig(uiConfig)
|
||||
.apkUrl(downloadUrl)
|
||||
.updateConfig(updateConfig)
|
||||
.updateTitle("新版本更新")
|
||||
.updateContent(configBean.getUpdateDes())
|
||||
.update();
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
ToastUtil.show(R.string.version_download_url_error);
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(R.string.version_download_url_error);
|
||||
}
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY) {
|
||||
if ( "0".equals(configBean.getGoogle_isup())) {
|
||||
Log.e("tagg", "111111");
|
||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||
.setContent(configBean.getUpdateDes())
|
||||
.setConfrimString(WordUtil.getString(R.string.version_immediate_use))
|
||||
.setCancelString(WordUtil.getString(R.string.version_not_update))
|
||||
.setCancelable(true)
|
||||
.setClickCallback(new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
try {
|
||||
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
||||
context.startActivity(i);
|
||||
} catch (Exception e) {
|
||||
ToastUtil.show(R.string.version_download_url_error);
|
||||
}
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.show();
|
||||
} else {
|
||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||
.setContent(configBean.getUpdateDes())
|
||||
.setConfrimString(WordUtil.getString(R.string.version_immediate_use))
|
||||
.setCancelString(WordUtil.getString(R.string.version_not_update))
|
||||
.setCancelable(false)
|
||||
.setClickCallback(new DialogUitl.SimpleCallback2() {
|
||||
public void onCancelClick() {
|
||||
context.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
||||
context.startActivity(i);
|
||||
context.finish();
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.show();
|
||||
}
|
||||
|
||||
}
|
||||
public void updateProgress(long progress, long total){
|
||||
if(tvProgress == null || progressBar == null){
|
||||
return;
|
||||
}
|
||||
if(progress > 0){
|
||||
int currProgress = (int)(progress * 1.0f / total * 100.0f);
|
||||
tvProgress.setText(currProgress + "%");
|
||||
progressBar.setProgress(currProgress);
|
||||
}else{
|
||||
tvProgress.setText("稍等");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void upd( Activity context, ConfigBean configBean, String downloadUrl){
|
||||
UpdateConfig config = new UpdateConfig();
|
||||
config.setUrl(downloadUrl);
|
||||
config.addHeader("token","xxxxxx");
|
||||
AppUpdater mAppUpdater = new AppUpdater(context,config)
|
||||
.setHttpManager(OkHttpManager.getInstance())
|
||||
.setUpdateCallback(new UpdateCallback() {
|
||||
|
||||
@Override
|
||||
public void onDownloading(boolean isDownloading) {
|
||||
if(isDownloading){
|
||||
ToastUtil.show("已经在下载中,请勿重复下载。");
|
||||
}else{
|
||||
// showToast("开始下载…");
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.dialog_progress,null);
|
||||
tvProgress = view.findViewById(R.id.tvProgress);
|
||||
progressBar = view.findViewById(R.id.progressBar);
|
||||
AppDialog.INSTANCE.showDialog(context,view,false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(String url) {
|
||||
updateProgress(0,100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(long progress, long total, boolean isChange) {
|
||||
if(isChange){
|
||||
updateProgress(progress,total);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish(File file) {
|
||||
AppDialog.INSTANCE.dismissDialog();
|
||||
ToastUtil.show("下载完成");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception e) {
|
||||
AppDialog.INSTANCE.dismissDialog();
|
||||
ToastUtil.show("下载失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
AppDialog.INSTANCE.dismissDialog();
|
||||
ToastUtil.show("取消下载");
|
||||
}
|
||||
});
|
||||
mAppUpdater.start();
|
||||
}
|
||||
//是否是谷歌版本
|
||||
public void showDialog( Activity context, ConfigBean configBean, String downloadUrl) {
|
||||
//不是谷歌
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
||||
//不强更
|
||||
if(configBean.getForceUpdate()!=1){
|
||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||
.setContent(configBean.getUpdateDes())
|
||||
.setConfrimString(WordUtil.getString(R.string.version_immediate_use))
|
||||
.setCancelString(WordUtil.getString(R.string.version_not_update))
|
||||
.setCancelable(false)
|
||||
.setClickCallback(new DialogUitl.SimpleCallback2() {
|
||||
public void onCancelClick() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
context.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
upd(context,configBean,downloadUrl);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.show();
|
||||
}else{
|
||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||
.setContent(configBean.getUpdateDes())
|
||||
.setConfrimString(WordUtil.getString(R.string.version_immediate_use))
|
||||
.setCancelString(WordUtil.getString(R.string.version_not_update))
|
||||
.setCancelable(false)
|
||||
.setClickCallback(new DialogUitl.SimpleCallback2() {
|
||||
public void onCancelClick() {
|
||||
context.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
upd(context,configBean,downloadUrl);
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.show();
|
||||
}
|
||||
|
||||
//谷歌版本
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
//谷歌强制更新
|
||||
if(configBean.getGoogle_isup().equals("1")) {
|
||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||
.setContent(configBean.getUpdateDes())
|
||||
.setConfrimString(WordUtil.getString(R.string.version_immediate_use))
|
||||
.setCancelString(WordUtil.getString(R.string.version_not_update))
|
||||
.setCancelable(false)
|
||||
.setClickCallback(new DialogUitl.SimpleCallback2() {
|
||||
public void onCancelClick() {
|
||||
context.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
||||
context.startActivity(i);
|
||||
context.finish();
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.show();
|
||||
//谷歌不强制
|
||||
}else {
|
||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||
.setContent(configBean.getUpdateDes())
|
||||
.setConfrimString(WordUtil.getString(R.string.version_immediate_use))
|
||||
.setCancelString(WordUtil.getString(R.string.version_not_update))
|
||||
.setCancelable(false)
|
||||
.setClickCallback(new DialogUitl.SimpleCallback2() {
|
||||
public void onCancelClick() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
||||
context.startActivity(i);
|
||||
context.finish();
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取版本号
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user