diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/FaceManager.java b/FaceUnity/src/main/java/com/yunbao/faceunity/FaceManager.java index 82786f636..9cbef67ef 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/FaceManager.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/FaceManager.java @@ -118,8 +118,12 @@ public class FaceManager implements SensorEventListener { 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")); + 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; } } @@ -127,8 +131,12 @@ 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; } } @@ -136,8 +144,12 @@ public class FaceManager implements SensorEventListener { 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; } } diff --git a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/ContainerRecyclerAdapter.java b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/ContainerRecyclerAdapter.java index 80ecfc4d9..717131a36 100644 --- a/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/ContainerRecyclerAdapter.java +++ b/FaceUnity/src/main/java/com/yunbao/faceunity/adapters/ContainerRecyclerAdapter.java @@ -80,11 +80,11 @@ public class ContainerRecyclerAdapter extends RecyclerView.Adapter= 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 { @@ -86,19 +88,22 @@ 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")){ - DialogUitl.showSimpleDialog(context, "应用需要通知权限", 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()); - context.startActivity(intent); - } - }); + 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()); @@ -218,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); @@ -252,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); @@ -295,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); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6d30238ee..1f229165b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,4 +1,5 @@ PDLIVE + assertk.Assert \ No newline at end of file diff --git a/common/build.gradle b/common/build.gradle index a0649a127..1e849bc76 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -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') @@ -168,7 +167,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' @@ -189,5 +187,8 @@ dependencies { 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' } diff --git a/common/src/main/AndroidManifest.xml b/common/src/main/AndroidManifest.xml index 780df206f..c1c7b4e46 100644 --- a/common/src/main/AndroidManifest.xml +++ b/common/src/main/AndroidManifest.xml @@ -32,8 +32,9 @@ android:resource="@xml/file_paths" /> + + 支付宝 - + 支付宝 end +--> 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,30 +63,23 @@ 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); } @@ -111,11 +100,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); } } diff --git a/common/src/main/java/com/yunbao/common/Constants.java b/common/src/main/java/com/yunbao/common/Constants.java index cf043fdb8..6e215977b 100644 --- a/common/src/main/java/com/yunbao/common/Constants.java +++ b/common/src/main/java/com/yunbao/common/Constants.java @@ -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"; diff --git a/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java b/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java index c124caad8..8856fff3a 100644 --- a/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java +++ b/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java @@ -27,6 +27,7 @@ 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; @@ -67,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) { @@ -96,6 +96,9 @@ public class WebViewActivity extends AbsActivity { if (url.contains("for")) { mWebView.loadUrl("javascript:goAnchorTab()"); } + //屏幕高度-ft_title的paddingTop + int height = DeviceUtils.getScreenHeight(mContext)-DpUtil.dp2px(24); + view.loadUrl("javascript:window.androidObject.setHeight("+height+",0,false)"); } }); diff --git a/common/src/main/java/com/yunbao/common/bean/AnchorRecommendItemModel.java b/common/src/main/java/com/yunbao/common/bean/AnchorRecommendItemModel.java index c41269d80..6c4673751 100644 --- a/common/src/main/java/com/yunbao/common/bean/AnchorRecommendItemModel.java +++ b/common/src/main/java/com/yunbao/common/bean/AnchorRecommendItemModel.java @@ -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 = ""; diff --git a/common/src/main/java/com/yunbao/common/bean/CheckLiveModel.java b/common/src/main/java/com/yunbao/common/bean/CheckLiveModel.java new file mode 100644 index 000000000..ccb6274c8 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/CheckLiveModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/EnterRoomInfoModel.java b/common/src/main/java/com/yunbao/common/bean/EnterRoomInfoModel.java new file mode 100644 index 000000000..87e6e14c4 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/EnterRoomInfoModel.java @@ -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 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 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 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 getGamebet() { + return gamebet; + } + + public EnterRoomInfoModel setGamebet(List 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 getUserlists() { + return userlists; + } + + public EnterRoomInfoModel setUserlists(List 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 getGreetings() { + return greetings; + } + + public EnterRoomInfoModel setGreetings(List 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; + } + + +} diff --git a/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java b/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java new file mode 100644 index 000000000..b8245fe3f --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java @@ -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 activeList = new ArrayList<>();//活动列表 + @SerializedName("isUseHotCard") + private String isUseHotCard = "";//是否使用热度卡 + @SerializedName("liveRoomActivity") + private List liveRoomActivityModels = new ArrayList<>();//活动列表 + + public List getLiveRoomActivityModels() { + return liveRoomActivityModels; + } + + public EnterRoomNewModel setLiveRoomActivityModels(List 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 getActiveList() { + return activeList; + } + + public EnterRoomNewModel setActiveList(List activeList) { + this.activeList = activeList; + return this; + } + + public String getIsUseHotCard() { + return isUseHotCard; + } + + public EnterRoomNewModel setIsUseHotCard(String isUseHotCard) { + this.isUseHotCard = isUseHotCard; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/GiftModel.java b/common/src/main/java/com/yunbao/common/bean/GiftModel.java new file mode 100644 index 000000000..d03401e0e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GiftModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/GuardModel.java b/common/src/main/java/com/yunbao/common/bean/GuardModel.java new file mode 100644 index 000000000..c89531dcf --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GuardModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/GuardUserModel.java b/common/src/main/java/com/yunbao/common/bean/GuardUserModel.java new file mode 100644 index 000000000..2d8a12f2f --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GuardUserModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/IMLoginModel.java b/common/src/main/java/com/yunbao/common/bean/IMLoginModel.java index e7cbf396a..c9c22e008 100644 --- a/common/src/main/java/com/yunbao/common/bean/IMLoginModel.java +++ b/common/src/main/java/com/yunbao/common/bean/IMLoginModel.java @@ -66,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 @@ -224,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; diff --git a/common/src/main/java/com/yunbao/common/bean/LinkMicUserBean.java b/common/src/main/java/com/yunbao/common/bean/LinkMicUserBean.java new file mode 100644 index 000000000..820dc6062 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LinkMicUserBean.java @@ -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 + + '}'; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/LinkMicUserBeanV2.java b/common/src/main/java/com/yunbao/common/bean/LinkMicUserBeanV2.java new file mode 100644 index 000000000..23bac2d3f --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LinkMicUserBeanV2.java @@ -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 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 getUserlist() { + return userlist; + } + + public void setUserlist(List userlist) { + this.userlist = userlist; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/LiveBean.java b/common/src/main/java/com/yunbao/common/bean/LiveBean.java index 3637a43da..b5567764b 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveBean.java @@ -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 params;//用于跳转Activity时扩展参数,例:从首页Banner跳转到直播间时需要根据携带参数判断是否弹出新人特惠对话框 + public String getRecommendCardIconSizeTwo() { return recommendCardIconSizeTwo; } @@ -83,6 +84,14 @@ public class LiveBean implements Parcelable { return this; } + public Map getParams() { + return params; + } + + public void setParams(Map params) { + this.params = params; + } + public String getRecommendcardtype() { return recommendCardtype; } @@ -380,25 +389,26 @@ public class LiveBean implements Parcelable { if (!TextUtils.isEmpty(this.goodNum) && !"0".equals(this.goodNum)) { return this.goodNum; } - return 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 CREATOR = new Creator() { diff --git a/common/src/main/java/com/yunbao/common/bean/LiveInfoModel.java b/common/src/main/java/com/yunbao/common/bean/LiveInfoModel.java index a619aa83d..91b759205 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveInfoModel.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveInfoModel.java @@ -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; } diff --git a/common/src/main/java/com/yunbao/common/bean/LiveRoomActivityModel.java b/common/src/main/java/com/yunbao/common/bean/LiveRoomActivityModel.java new file mode 100644 index 000000000..f060c64db --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LiveRoomActivityModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/LiveUserGiftBean.java b/common/src/main/java/com/yunbao/common/bean/LiveUserGiftBean.java new file mode 100644 index 000000000..118825cd0 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LiveUserGiftBean.java @@ -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 + '\'' + + '}'; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/LminfoModel.java b/common/src/main/java/com/yunbao/common/bean/LminfoModel.java new file mode 100644 index 000000000..749f1da7c --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LminfoModel.java @@ -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; + } +} diff --git a/live/src/main/java/com/yunbao/live/bean/MicUserBean.java b/common/src/main/java/com/yunbao/common/bean/MicUserBean.java similarity index 86% rename from live/src/main/java/com/yunbao/live/bean/MicUserBean.java rename to common/src/main/java/com/yunbao/common/bean/MicUserBean.java index 6e4faec8e..48591cb96 100644 --- a/live/src/main/java/com/yunbao/live/bean/MicUserBean.java +++ b/common/src/main/java/com/yunbao/common/bean/MicUserBean.java @@ -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; + } } diff --git a/common/src/main/java/com/yunbao/common/bean/NewPeopleTaskModel.java b/common/src/main/java/com/yunbao/common/bean/NewPeopleTaskModel.java new file mode 100644 index 000000000..6d45fc3e2 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/NewPeopleTaskModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/PKTopThreeModel.java b/common/src/main/java/com/yunbao/common/bean/PKTopThreeModel.java new file mode 100644 index 000000000..7230497e4 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/PKTopThreeModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/PkTopUsersModel.java b/common/src/main/java/com/yunbao/common/bean/PkTopUsersModel.java new file mode 100644 index 000000000..11a138222 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/PkTopUsersModel.java @@ -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; +} diff --git a/common/src/main/java/com/yunbao/common/bean/PkinfoModel.java b/common/src/main/java/com/yunbao/common/bean/PkinfoModel.java new file mode 100644 index 000000000..6bf4929f0 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/PkinfoModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/RankHourModel.java b/common/src/main/java/com/yunbao/common/bean/RankHourModel.java new file mode 100644 index 000000000..cdf33eb76 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/RankHourModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/RewardAllModel.java b/common/src/main/java/com/yunbao/common/bean/RewardAllModel.java new file mode 100644 index 000000000..cae2b2d2e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/RewardAllModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/TaskModel.java b/common/src/main/java/com/yunbao/common/bean/TaskModel.java new file mode 100644 index 000000000..fb804317e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/TaskModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/WishListModel.java b/common/src/main/java/com/yunbao/common/bean/WishListModel.java new file mode 100644 index 000000000..fef8be6b9 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/WishListModel.java @@ -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 wishList; + @SerializedName("img") + private String img; + + public List getWishList() { + return wishList; + } + + public WishListModel setWishList(List wishList) { + this.wishList = wishList; + return this; + } + + public String getImg() { + return img; + } + + public WishListModel setImg(String img) { + this.img = img; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/WishModel.java b/common/src/main/java/com/yunbao/common/bean/WishModel.java new file mode 100644 index 000000000..e4429727d --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/WishModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/AbsDialogFragment.java b/common/src/main/java/com/yunbao/common/dialog/AbsDialogFragment.java index 4771da0ef..c59f81807 100644 --- a/common/src/main/java/com/yunbao/common/dialog/AbsDialogFragment.java +++ b/common/src/main/java/com/yunbao/common/dialog/AbsDialogFragment.java @@ -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(); + } + } } diff --git a/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java b/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java index c7dc2c6aa..93cb3691b 100644 --- a/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java @@ -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(); } diff --git a/common/src/main/java/com/yunbao/common/http/API.java b/common/src/main/java/com/yunbao/common/http/API.java index 06c72a665..02c5c12ba 100644 --- a/common/src/main/java/com/yunbao/common/http/API.java +++ b/common/src/main/java/com/yunbao/common/http/API.java @@ -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); } diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java index af8e85523..ccc77a95f 100644 --- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java @@ -4,7 +4,6 @@ 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; @@ -196,6 +195,10 @@ public class CommonHttpUtil { 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); @@ -417,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); +// } } diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 8ebe3d505..255462408 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -3,11 +3,14 @@ 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; @@ -171,10 +174,10 @@ public interface PDLiveApi { Observable>> getActiveList(); /** - * 获取活动 + * 获取多人连麦列表 */ @GET("/api/public/?service=live.getDrLm") - Observable>> getDrLm(); + Observable>> getDrLm(@Query("uid")String uid); /** * 获取日榜、周榜数据 @@ -268,5 +271,71 @@ public interface PDLiveApi { * PK排位赛接口 */ @GET("/api/public/?service=Ranking.getAnchorRankData") - Observable> getPkRanksList(@Query("anchor_id") String anchorId,@Query("anchor_id2")String pkUid); + Observable> getPkRanksList(@Query("anchor_id") String anchorId, @Query("anchor_id2") String pkUid); + + /** + * 多人连麦-创建房间 + */ + @GET("/api/public/?service=Live.createDrLm") + Observable> createDrLm(); + + /** + * 多人连麦-关闭房间 + */ + @GET("/api/public/?service=Live.delDrLm") + Observable> delDrLm(); + + /** + * 多人连麦-踢出用户 + * @param uid 对方uid + * @param roomId 当前房间号 + */ + @GET("/api/public/?service=Live.killDrLm") + Observable> 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> 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>> checkLive( + @Query("liveuid") String liveUid, + @Query("stream") String stream + ); + + /** + * 加入房间推送Im欢迎语 + */ + @GET("/api/public/?service=Tx.userJoinRoomNew") + Observable> userJoinRoomNew( + @Query("GroupId") String GroupId, + @Query("stream") String stream + ); + + /** + * 加入房间推送Im欢迎语 + */ + @GET("/api/public/?service=Tx.leaveRoomNew") + Observable>> leaveRoomNew( + @Query("GroupId") String GroupId, + @Query("stream") String stream + ); } diff --git a/common/src/main/java/com/yunbao/common/http/base/CheckLiveCallBack.java b/common/src/main/java/com/yunbao/common/http/base/CheckLiveCallBack.java new file mode 100644 index 000000000..56e1d2067 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/http/base/CheckLiveCallBack.java @@ -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); +} diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 4083c7650..e35962d1d 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -2,26 +2,35 @@ 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.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.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.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.disposables.Disposable; import io.reactivex.functions.Consumer; import io.reactivex.schedulers.Schedulers; @@ -291,4 +300,219 @@ public class LiveNetManager { } }, 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>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (listResponseModel.getData().getCode() == 0) { + List 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() { + @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 callback) { + enterRoomDisposable = API.get().pdLiveApi(mContext) + .enterRoomNew("g" + liveUid, stream, liveUid, city) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel enterRoomNewModelResponseModel) throws Exception { + Log.e("进入房间", "enterRoomNew--------------------------------------------"); + enterRoomDisposable = null; + if (callback != null) { + callback.onSuccess(enterRoomNewModelResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @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>() { + @Override + public void accept(ResponseModel stringResponseModel) throws Exception { + Log.e("进入房间", "userJoinRoomNew--------------------------------------------"); + userJoinDisposable = null; + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + userJoinDisposable = null; + } + }); + } + + /** + * 离开直播间 + * + * @param stream + * @param liveUid + */ + public void leaveRoomNew(String stream, String liveUid, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .leaveRoomNew("g" + liveUid, stream) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(null); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + } + }).isDisposed(); + } + + /** + * 获取多人连麦用户列表 + */ + public void getDRMicUserList(String uid, HttpCallback> callback) { + API.get().createPDLiveApi(false) + .getDrLm(uid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + List 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() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + } + }).isDisposed(); + } + + private Disposable randomPkApi; + + public void getRandomPk(String mLiveUid, String pkUid, HttpCallback callback) { + randomPkApi = API.get().pdLiveApi(mContext) + .getPkRanksList(mLiveUid, pkUid) + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe(listResponseModel -> { + callback.onSuccess(listResponseModel.getData().getInfo()); + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + } + }); + } + + /** + * 直播间取消网络请求 + */ + public void cancelLive() { + if (userJoinDisposable != null) { + userJoinDisposable.dispose(); + } + if (enterRoomDisposable != null) { + enterRoomDisposable.dispose(); + } + if (randomPkApi != null) { + randomPkApi.dispose(); + } + } } diff --git a/common/src/main/java/com/yunbao/common/manager/NewLevelManager.java b/common/src/main/java/com/yunbao/common/manager/NewLevelManager.java index 1972cef00..919da14af 100644 --- a/common/src/main/java/com/yunbao/common/manager/NewLevelManager.java +++ b/common/src/main/java/com/yunbao/common/manager/NewLevelManager.java @@ -15,7 +15,9 @@ 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 newLevelModels = new ArrayList<>(); + private List keyAnchorLevel = new ArrayList<>(); public NewLevelManager(Context context) { super(context); @@ -41,5 +43,24 @@ public class NewLevelManager extends BaseCacheManager { return getList(KEY_USER_LEVEL, new TypeToken>() { }.getType()); } + /** + * 缓存等级图标 + * + * @param json + */ + public void UpAnchorDataLevel(String json) { + newLevelModels = new Gson().fromJson(json, new TypeToken>() { + }.getType()); + put(KEY_ANCHOR_LEVEL, newLevelModels); + } + /** + * 获取等级数据 + * + * @return + */ + public List getNewAnchorLevelModels() { + return getList(KEY_ANCHOR_LEVEL, new TypeToken>() { + }.getType()); + } } diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/PDMessageInterceptor.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/PDMessageInterceptor.java index c07379eee..ac9f16792 100644 --- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/PDMessageInterceptor.java +++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/PDMessageInterceptor.java @@ -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 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); } } diff --git a/common/src/main/java/com/yunbao/common/pay/PayPresenter.java b/common/src/main/java/com/yunbao/common/pay/PayPresenter.java index caf5c90c8..cef5e3b2c 100644 --- a/common/src/main/java/com/yunbao/common/pay/PayPresenter.java +++ b/common/src/main/java/com/yunbao/common/pay/PayPresenter.java @@ -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(); } diff --git a/common/src/main/java/com/yunbao/common/pay/ali/AliPayBuilder.java b/common/src/main/java/com/yunbao/common/pay/ali/AliPayBuilder.java index a2fa25e89..83dc7b994 100644 --- a/common/src/main/java/com/yunbao/common/pay/ali/AliPayBuilder.java +++ b/common/src/main/java/com/yunbao/common/pay/ali/AliPayBuilder.java @@ -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 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 result = (Map) 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 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 result = (Map) msg.obj; +// if ("9000".equals(result.get("resultStatus"))) { +// mPayCallback.onSuccess(); +// } else { +// mPayCallback.onFailed(); +// } +// } +// mPayCallback = null; +// } +// } } diff --git a/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java b/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java index 23557d78e..207accd38 100644 --- a/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java @@ -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="下载"; diff --git a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java index a1a3200a4..cc1d35230 100644 --- a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java @@ -64,14 +64,13 @@ public class JavascriptInterfaceUtils { } public static JavascriptInterfaceUtils getInstance() { - if (sInstance == null) { - synchronized (CityUtil.class) { - if (sInstance == null) { - sInstance = new JavascriptInterfaceUtils(); - } - } + + synchronized (JavascriptInterfaceUtils.class) { + + sInstance = new JavascriptInterfaceUtils(); + + return sInstance; } - return sInstance; } @@ -117,8 +116,13 @@ public class JavascriptInterfaceUtils { @JavascriptInterface public void androidClickToNewH5PageView(String url) { url = CommonAppConfig.HOST + url; - url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken(); + 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 { @@ -135,8 +139,13 @@ public class JavascriptInterfaceUtils { @JavascriptInterface public void androidClickToNewH5PageView(String url, String title) { url = CommonAppConfig.HOST + url; - url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken(); + 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 { @@ -467,15 +476,23 @@ public class JavascriptInterfaceUtils { } + /** + * 设置webView高度 + * @param useDp 是否用dp换算 + */ @JavascriptInterface - public void setHeight(String height, String width) { + 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(); - params.height = DpUtil.dp2px(Integer.parseInt(height)); + 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); }); diff --git a/common/src/main/java/com/yunbao/common/utils/MicStatusManager.java b/common/src/main/java/com/yunbao/common/utils/MicStatusManager.java new file mode 100644 index 000000000..78ee85a88 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/utils/MicStatusManager.java @@ -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 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>() { + @Override + public void accept(ResponseModel 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(); + } +} diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index 9af0bfdd2..34a1be8cd 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -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; @@ -100,7 +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) + .withString(Constants.URL, url) .navigation(); } @@ -185,14 +187,25 @@ public class RouteUtil { * 打开直播页面 */ 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(); } + /** * 举报个人 */ diff --git a/common/src/main/java/com/yunbao/common/utils/VersionUtil.java b/common/src/main/java/com/yunbao/common/utils/VersionUtil.java index 6eace2b38..55b441bda 100644 --- a/common/src/main/java/com/yunbao/common/utils/VersionUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/VersionUtil.java @@ -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,171 @@ 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) { + 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(); + } + } + } + + + /** * 获取版本号 diff --git a/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java b/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java index 57fcb2773..e111905c0 100644 --- a/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java +++ b/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java @@ -59,7 +59,7 @@ public class CustomDrawerPopupView extends DrawerPopupView { Bus.getOn(this); super.onCreate(); initView(); - initData(); + initData(null); } @@ -148,19 +148,24 @@ public class CustomDrawerPopupView extends DrawerPopupView { }); } - private void initData() { - LiveNetManager.get(mContext) - .getCustomSidebarInfo(new com.yunbao.common.http.base.HttpCallback>() { - @Override - public void onSuccess(List data) { - adapter.updateData(data); - } + public void initData(List data) { + if (data != null) { + adapter.updateData(data); + } else { + LiveNetManager.get(mContext) + .getCustomSidebarInfo(new com.yunbao.common.http.base.HttpCallback>() { + @Override + public void onSuccess(List data) { + adapter.updateData(data); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + } - @Override - public void onError(String error) { - ToastUtil.show(error); - } - }); } private CustomDrawerPopupCallBack callBack; @@ -226,7 +231,7 @@ public class CustomDrawerPopupView extends DrawerPopupView { } if (event.isRefresh()) { - initData(); + initData(null); } } diff --git a/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java b/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java index 47abc6d2a..251818e8e 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java +++ b/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java @@ -73,8 +73,8 @@ public class LiveFloatView implements Function1 { CardView layout = magnetView.findViewById(R.id.layout); RelativeLayout.LayoutParams cardParams = (RelativeLayout.LayoutParams) layout.getLayoutParams(); if (mLiveBean.getLandscape() == 1) { - cardParams.height = DpUtil.dp2px(130); - cardParams.width = DpUtil.dp2px(230); + cardParams.height = DpUtil.dp2px(190); + cardParams.width = DpUtil.dp2px(255); } else { cardParams.height = DpUtil.dp2px(224); cardParams.width = DpUtil.dp2px(126); @@ -91,8 +91,8 @@ public class LiveFloatView implements Function1 { Log.e("视频流有", "videoWidth:" + videoWidth + " videoHeight:" + videoHeight); if (mLiveBean.getLandscape() != 1){ if (videoWidth > 720) { - cardParams.height = DpUtil.dp2px(130); - cardParams.width = DpUtil.dp2px(230); + cardParams.height = DpUtil.dp2px(190); + cardParams.width = DpUtil.dp2px(255); } else { cardParams.height = DpUtil.dp2px(224); cardParams.width = DpUtil.dp2px(126); @@ -206,8 +206,8 @@ public class LiveFloatView implements Function1 { CardView layout = view.findViewById(R.id.layout); RelativeLayout.LayoutParams cardParams = (RelativeLayout.LayoutParams) layout.getLayoutParams(); if (mLiveBean.getLandscape() == 1) { - cardParams.height = DpUtil.dp2px(130); - cardParams.width = DpUtil.dp2px(230); + cardParams.height = DpUtil.dp2px(190); + cardParams.width = DpUtil.dp2px(255); } else { cardParams.height = DpUtil.dp2px(224); cardParams.width = DpUtil.dp2px(126); @@ -224,8 +224,8 @@ public class LiveFloatView implements Function1 { Log.e("视频流有", "videoWidth:" + videoWidth + " videoHeight:" + videoHeight); if (mLiveBean.getLandscape() != 1){ if (videoWidth > 720) { - cardParams.height = DpUtil.dp2px(130); - cardParams.width = DpUtil.dp2px(230); + cardParams.height = DpUtil.dp2px(190); + cardParams.width = DpUtil.dp2px(255); } else { cardParams.height = DpUtil.dp2px(224); cardParams.width = DpUtil.dp2px(126); diff --git a/common/src/main/java/com/yunbao/common/views/weight/LiveLoadingViewHolder.java b/common/src/main/java/com/yunbao/common/views/weight/LiveLoadingViewHolder.java new file mode 100644 index 000000000..ba9ef0aa9 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/weight/LiveLoadingViewHolder.java @@ -0,0 +1,68 @@ +package com.yunbao.common.views.weight; + +import android.app.Activity; +import android.graphics.drawable.AnimationDrawable; +import android.view.Gravity; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.RelativeLayout; + +import com.lzf.easyfloat.EasyFloat; +import com.lzf.easyfloat.enums.ShowPattern; +import com.lzf.easyfloat.interfaces.FloatCallbacks; +import com.lzf.easyfloat.interfaces.OnInvokeView; +import com.yunbao.common.R; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.DeviceUtils; + +import kotlin.Unit; +import kotlin.jvm.functions.Function1; + +public class LiveLoadingViewHolder implements Function1 { + private String TAG = "LiveLoadingViewHolder"; + private Activity mContext; + private String url; + + public void builderSystemFloat(Activity mContext, String url) { + this.mContext = mContext; + this.url = url; + EasyFloat.with(mContext) + .setTag(TAG) + .setLayout(R.layout.layout_portrait_live_item, new LiveOnInvokeView()) + .setShowPattern(ShowPattern.CURRENT_ACTIVITY) + .setFilter() + .setGravity(Gravity.CENTER) + .setAnimator(null) + .setMatchParent(true,true) + .registerCallback(this) + .show(); + } + + /** + * loading + */ + private class LiveOnInvokeView implements OnInvokeView { + + @Override + public void invoke(View view) { + + RelativeLayout layout = view.findViewById(R.id.layout); + FrameLayout.LayoutParams cardParams = (FrameLayout.LayoutParams) layout.getLayoutParams(); + cardParams.width = DeviceUtils.getScreenWidth(mContext); + cardParams.height = DeviceUtils.getScreenHeight(mContext); + layout.setLayoutParams(cardParams); + ImageView ivBg = view.findViewById(R.id.iv_bg); + ImgLoader.displayBlurLive(mContext, url, ivBg); + // 加载动画 + ImageView ivLoading = view.findViewById(R.id.iv_loading); + AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground(); + frameAnimation.start(); + } + } + + @Override + public Unit invoke(FloatCallbacks.Builder builder) { + return null; + } +} diff --git a/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java b/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java index 371e892b0..20eb8fa88 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java +++ b/common/src/main/java/com/yunbao/common/views/weight/NobleNoticeView.java @@ -1,6 +1,5 @@ package com.yunbao.common.views.weight; -import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Bitmap; import android.text.TextUtils; @@ -32,8 +31,6 @@ import com.yunbao.common.utils.SVGAViewUtils; import org.jetbrains.annotations.NotNull; -import java.lang.reflect.Field; - import io.reactivex.Observable; import io.reactivex.ObservableEmitter; import io.reactivex.ObservableOnSubscribe; @@ -80,7 +77,7 @@ public class NobleNoticeView extends FrameLayout { rootView = LayoutInflater.from(mContext).inflate(R.layout.view_noble_notice, this, true); svagaBc = rootView.findViewById(R.id.svaga_bc); rootLayout = rootView.findViewById(R.id.root_layout); - gotoRoomView = rootView.findViewById(R.id.goto_room_view); + gotoRoomView = rootView.findViewById(R.id.got_room_view); contextLayout = rootView.findViewById(R.id.context_layout); scrollLayout = rootView.findViewById(R.id.scroll_layout); nobleIcon = rootView.findViewById(R.id.noble_icon); @@ -111,7 +108,6 @@ public class NobleNoticeView extends FrameLayout { findViewById(R.id.anchor_nickname).setVisibility(GONE); openNoble.setText(mContext.getString(R.string.open_noble2)); }else { - gotoRoomView.setVisibility(VISIBLE); findViewById(R.id.in).setVisibility(VISIBLE); findViewById(R.id.anchor_nickname).setVisibility(VISIBLE); openNoble.setText(mContext.getString(R.string.open_noble)); @@ -254,7 +250,7 @@ public class NobleNoticeView extends FrameLayout { @Override public void onStep(int frame, double v) { System.out.println("frame = " + frame); - if (frame == 10) { + if (frame == 20) { setButtonPosition(roleType); observable.observeOn(AndroidSchedulers.mainThread()) .subscribe(bitmap -> { @@ -270,7 +266,7 @@ public class NobleNoticeView extends FrameLayout { }).isDisposed(); } - if (frame == 150) { + if (frame == 135) { contextLayout.setVisibility(GONE); gotoRoomView.setVisibility(GONE); scrollLayout.clearAnimation(); diff --git a/common/src/main/res/anim/in_from_right.xml b/common/src/main/res/anim/in_from_right.xml new file mode 100644 index 000000000..7729bdc16 --- /dev/null +++ b/common/src/main/res/anim/in_from_right.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/common/src/main/res/anim/in_from_right_abit.xml b/common/src/main/res/anim/in_from_right_abit.xml new file mode 100644 index 000000000..0901efc3c --- /dev/null +++ b/common/src/main/res/anim/in_from_right_abit.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/common/src/main/res/anim/out_from_right.xml b/common/src/main/res/anim/out_from_right.xml new file mode 100644 index 000000000..3b2030e82 --- /dev/null +++ b/common/src/main/res/anim/out_from_right.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/common/src/main/res/anim/out_to_right.xml b/common/src/main/res/anim/out_to_right.xml new file mode 100644 index 000000000..4344ae837 --- /dev/null +++ b/common/src/main/res/anim/out_to_right.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/common/src/main/res/anim/out_to_right_abit.xml b/common/src/main/res/anim/out_to_right_abit.xml new file mode 100644 index 000000000..57bffad36 --- /dev/null +++ b/common/src/main/res/anim/out_to_right_abit.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_anchor_mic_info_btn_invite.xml b/common/src/main/res/drawable/bg_anchor_mic_info_btn_invite.xml new file mode 100644 index 000000000..ee73ee2f4 --- /dev/null +++ b/common/src/main/res/drawable/bg_anchor_mic_info_btn_invite.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_anchor_mic_info_btn_ok.xml b/common/src/main/res/drawable/bg_anchor_mic_info_btn_ok.xml new file mode 100644 index 000000000..2db049480 --- /dev/null +++ b/common/src/main/res/drawable/bg_anchor_mic_info_btn_ok.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/loading_00000.png b/common/src/main/res/drawable/loading_00000.png similarity index 100% rename from live/src/main/res/drawable/loading_00000.png rename to common/src/main/res/drawable/loading_00000.png diff --git a/live/src/main/res/drawable/loading_00001.png b/common/src/main/res/drawable/loading_00001.png similarity index 100% rename from live/src/main/res/drawable/loading_00001.png rename to common/src/main/res/drawable/loading_00001.png diff --git a/live/src/main/res/drawable/loading_00002.png b/common/src/main/res/drawable/loading_00002.png similarity index 100% rename from live/src/main/res/drawable/loading_00002.png rename to common/src/main/res/drawable/loading_00002.png diff --git a/live/src/main/res/drawable/loading_00003.png b/common/src/main/res/drawable/loading_00003.png similarity index 100% rename from live/src/main/res/drawable/loading_00003.png rename to common/src/main/res/drawable/loading_00003.png diff --git a/live/src/main/res/drawable/loading_00004.png b/common/src/main/res/drawable/loading_00004.png similarity index 100% rename from live/src/main/res/drawable/loading_00004.png rename to common/src/main/res/drawable/loading_00004.png diff --git a/live/src/main/res/drawable/loading_00005.png b/common/src/main/res/drawable/loading_00005.png similarity index 100% rename from live/src/main/res/drawable/loading_00005.png rename to common/src/main/res/drawable/loading_00005.png diff --git a/live/src/main/res/drawable/loading_00006.png b/common/src/main/res/drawable/loading_00006.png similarity index 100% rename from live/src/main/res/drawable/loading_00006.png rename to common/src/main/res/drawable/loading_00006.png diff --git a/live/src/main/res/drawable/loading_00007.png b/common/src/main/res/drawable/loading_00007.png similarity index 100% rename from live/src/main/res/drawable/loading_00007.png rename to common/src/main/res/drawable/loading_00007.png diff --git a/live/src/main/res/drawable/loading_00008.png b/common/src/main/res/drawable/loading_00008.png similarity index 100% rename from live/src/main/res/drawable/loading_00008.png rename to common/src/main/res/drawable/loading_00008.png diff --git a/live/src/main/res/drawable/loading_00009.png b/common/src/main/res/drawable/loading_00009.png similarity index 100% rename from live/src/main/res/drawable/loading_00009.png rename to common/src/main/res/drawable/loading_00009.png diff --git a/live/src/main/res/drawable/loading_00010.png b/common/src/main/res/drawable/loading_00010.png similarity index 100% rename from live/src/main/res/drawable/loading_00010.png rename to common/src/main/res/drawable/loading_00010.png diff --git a/live/src/main/res/drawable/loading_00011.png b/common/src/main/res/drawable/loading_00011.png similarity index 100% rename from live/src/main/res/drawable/loading_00011.png rename to common/src/main/res/drawable/loading_00011.png diff --git a/live/src/main/res/drawable/loading_00012.png b/common/src/main/res/drawable/loading_00012.png similarity index 100% rename from live/src/main/res/drawable/loading_00012.png rename to common/src/main/res/drawable/loading_00012.png diff --git a/live/src/main/res/drawable/loading_00013.png b/common/src/main/res/drawable/loading_00013.png similarity index 100% rename from live/src/main/res/drawable/loading_00013.png rename to common/src/main/res/drawable/loading_00013.png diff --git a/live/src/main/res/drawable/loading_00014.png b/common/src/main/res/drawable/loading_00014.png similarity index 100% rename from live/src/main/res/drawable/loading_00014.png rename to common/src/main/res/drawable/loading_00014.png diff --git a/live/src/main/res/drawable/loading_00015.png b/common/src/main/res/drawable/loading_00015.png similarity index 100% rename from live/src/main/res/drawable/loading_00015.png rename to common/src/main/res/drawable/loading_00015.png diff --git a/common/src/main/res/drawable/loading_animation.xml b/common/src/main/res/drawable/loading_animation.xml new file mode 100644 index 000000000..4a98f36b8 --- /dev/null +++ b/common/src/main/res/drawable/loading_animation.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/activity_webview.xml b/common/src/main/res/layout/activity_webview.xml index c67a6132b..da9a6f211 100644 --- a/common/src/main/res/layout/activity_webview.xml +++ b/common/src/main/res/layout/activity_webview.xml @@ -63,4 +63,9 @@ android:layout_height="3dp" android:progressDrawable="@drawable/bg_horizontal_progressbar" android:visibility="gone" /> + + \ No newline at end of file diff --git a/common/src/main/res/layout/custom_drawer_popup.xml b/common/src/main/res/layout/custom_drawer_popup.xml index e7e390913..d80a71d15 100644 --- a/common/src/main/res/layout/custom_drawer_popup.xml +++ b/common/src/main/res/layout/custom_drawer_popup.xml @@ -108,6 +108,7 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_progress.xml b/common/src/main/res/layout/dialog_progress.xml new file mode 100644 index 000000000..eb1bbbfb2 --- /dev/null +++ b/common/src/main/res/layout/dialog_progress.xml @@ -0,0 +1,45 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/layout_portrait_live_item.xml b/common/src/main/res/layout/layout_portrait_live_item.xml similarity index 93% rename from live/src/main/res/layout/layout_portrait_live_item.xml rename to common/src/main/res/layout/layout_portrait_live_item.xml index f6a4bce29..87df8f2ca 100644 --- a/live/src/main/res/layout/layout_portrait_live_item.xml +++ b/common/src/main/res/layout/layout_portrait_live_item.xml @@ -1,6 +1,6 @@ diff --git a/common/src/main/res/layout/view_noble_notice.xml b/common/src/main/res/layout/view_noble_notice.xml index 0d540e02e..d719d673d 100644 --- a/common/src/main/res/layout/view_noble_notice.xml +++ b/common/src/main/res/layout/view_noble_notice.xml @@ -12,7 +12,7 @@ ApplyMic Cancel Mic + Close Mic Quit Mic Birthday Gender diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 1ffbbec77..bcb7f4c6c 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -70,6 +70,7 @@ 性別 申请連麥 取消申請 + 關閉連麥 退出連麥 所在地 編輯個人資料 @@ -617,6 +618,7 @@ 魅力榜 豪氣榜 當前沒有人在語音連麥中 + 語音連麥未開啟 網絡請求失敗 請檢查網絡連接後重試~ 加載中 @@ -963,4 +965,5 @@ 畫質選擇 更多設置 查看更多 + 礼物正在获取中... diff --git a/common/src/main/res/values/style.xml b/common/src/main/res/values/style.xml index 8198d657c..f58f596c4 100644 --- a/common/src/main/res/values/style.xml +++ b/common/src/main/res/values/style.xml @@ -6,9 +6,9 @@ @color/colorPrimaryDark @color/colorAccent @color/background - @style/Animation + @style/AnimationActivity - @color/colorPrimary + @color/colorPrimary + + + + + + + \ No newline at end of file diff --git a/config.gradle b/config.gradle index e8971d031..b1defc16c 100644 --- a/config.gradle +++ b/config.gradle @@ -4,7 +4,7 @@ ext { buildToolsVersion: "28.0.3", minSdkVersion : 21, targetSdkVersion : 31, - versionCode : 307, + versionCode : 310, versionName : "6.4.5" ] manifestPlaceholders = [ diff --git a/live/src/main/AndroidManifest.xml b/live/src/main/AndroidManifest.xml index a94f66af7..d780e2f5e 100644 --- a/live/src/main/AndroidManifest.xml +++ b/live/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" package="com.yunbao.live"> + outRankHide = new ArrayList<>(); private boolean outRankHideFirst = true; - + protected TreeMap mMicQueueList = new TreeMap<>(); + protected List mAudienceList = new ArrayList<>(); + protected LiveMicAnchorDialogFragment.OnMicListener micListener = null; @Override protected void main() { getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); @@ -374,15 +379,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL */ @Override public void onSendGiftPk(long leftGift, long rightGift, LivePKUserListBean bean) { -// if (isRy == false) { -// if (mLiveLinkMicPkPresenter != null) { -// mLiveLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean); -// } -// } else { + if (mLiveRyLinkMicPkPresenter != null) { mLiveRyLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean); } -// } + } /** @@ -617,9 +618,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL */ @Override public void onLinkMicAnchorPlayUrl(String pkUid, String playUrl) { - if (LiveAudienceActivity.anyway == null) { + if (anyway == null) { mLiveLinkMicAnchorPresenter.onLinkMicAnchorPlayUrl(pkUid, playUrl); - } else if (mLiveLinkMicAnchorPresenter != null && LiveAudienceActivity.anyway.equals("0")) { + } else if (mLiveLinkMicAnchorPresenter != null && anyway.equals("0")) { mLiveLinkMicAnchorPresenter.onLinkMicAnchorPlayUrl(pkUid, playUrl); } if (this instanceof LiveAudienceActivity) { @@ -843,13 +844,13 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL * 打开聊天输入框 */ public void openChatWindow() { - if (mKeyBoardHeightUtil == null) { - mKeyBoardHeightUtil = new KeyBoardHeightUtil2(mContext, super.findViewById(android.R.id.content), this); - mKeyBoardHeightUtil.start(); - } - if (mLiveRoomViewHolder != null) { - mLiveRoomViewHolder.chatScrollToBottom(); - } +// if (mKeyBoardHeightUtil == null) { +// mKeyBoardHeightUtil = new KeyBoardHeightUtil2(mContext, super.findViewById(android.R.id.content), this); +// mKeyBoardHeightUtil.start(); +// } +// if (mLiveRoomViewHolder != null) { +// mLiveRoomViewHolder.chatScrollToBottom(); +// } LiveInputDialogFragment fragment = new LiveInputDialogFragment(); Bundle bundle = new Bundle(); bundle.putString(Constants.LIVE_DANMU_PRICE, mDanmuPrice); @@ -1200,11 +1201,12 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL * 守护列表弹窗 */ public void openNewGuardListWindow(boolean showBuyView) { - openNewGuardListWindow(showBuyView,null); + openNewGuardListWindow(showBuyView, null); } - public void openNewGuardListWindow(boolean showBuyView,String uid) { - if(uid==null){ - uid=mLiveUid; + + public void openNewGuardListWindow(boolean showBuyView, String uid) { + if (uid == null) { + uid = mLiveUid; } LiveHttpUtil.getGuardList(uid, 1, new HttpCallback() { @Override @@ -1234,9 +1236,10 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL public void openFansWindow() { openFansWindow(null); } + public void openFansWindow(String uid) { - if(uid==null){ - uid=mLiveUid; + if (uid == null) { + uid = mLiveUid; } LiveFansFragment fragment = new LiveFansFragment(mContext); Bundle bundle = new Bundle(); @@ -1277,7 +1280,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL bundle.putBoolean("showBuyView", !showBuyView); fragment.setArguments(bundle); fragment.show(getSupportFragmentManager(), "LiveUserMoreDialogFragment"); - LiveUserMoreDialogFragment.activity = (LiveActivity) mContext; outRankHideFirst = false; } @@ -1299,7 +1301,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL bundle.putString("outRankHide", GsonUtils.toJson(outRankHide)); fragment.setArguments(bundle); fragment.show(getSupportFragmentManager(), "LiveUserMoreDialogFragment"); - LiveUserMoreDialogFragment.activity = this; } @@ -1556,6 +1557,41 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL } } + /** + * 打开连麦UI + */ + protected void openMicWindow(int index) { + LiveMicAnchorDialogFragment fragment = new LiveMicAnchorDialogFragment(); + Bundle bundle = new Bundle(); + bundle.putString(Constants.LIVE_UID, mLiveUid); + bundle.putString(Constants.STREAM, mStream); + bundle.putString("By", index + ""); + fragment.setArguments(bundle); + micListener = fragment.getMicListener(); + fragment.setMicQueueList(mMicQueueList); + fragment.setAudienceList(mAudienceList); + fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveMicAnchorDialogFragment"); + } + + /** + * 获取连麦列表 + */ + public void showMicList(String uid,LiveRoomViewHolder mLiveRoomViewHolder) { + LiveNetManager.get(mContext) + .getDRMicUserList(uid, new com.yunbao.common.http.base.HttpCallback>() { + @Override + public void onSuccess(List data) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.updataMicList(data); + } + } + + @Override + public void onError(String error) { + System.out.println("live.getDrLm error = " + error); + } + }); + } @Override protected void onDestroy() { release(); diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index d30ad0c41..d89051cde 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -1,9 +1,7 @@ package com.yunbao.live.activity; -import static com.yunbao.live.views.LivePlayRyViewHolder.Micing; - import android.annotation.SuppressLint; -import android.content.Context; +import android.app.Dialog; import android.content.Intent; import android.content.res.Configuration; import android.media.AudioManager; @@ -24,8 +22,6 @@ import androidx.core.view.WindowInsetsCompat; import androidx.core.view.WindowInsetsControllerCompat; import androidx.viewpager.widget.ViewPager; -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.JSONArray; @@ -46,8 +42,10 @@ import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.CrashSaveBean; import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveGiftBean; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.SlideInfoModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.EffectsSettingsDialog; @@ -70,9 +68,12 @@ import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.L; +import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.CustomDrawerPopupView; import com.yunbao.common.views.floatingview.APPEasyFloat; import com.yunbao.common.views.weight.VerticalViewPager; @@ -98,6 +99,7 @@ import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.views.LiveRoomPlayViewHolder; import com.yunbao.live.views.PortraitLiveManager; +import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -105,7 +107,6 @@ import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Map; /** * Created by cxf on 2018/10/10. @@ -115,9 +116,8 @@ import java.util.Map; public class LiveAudienceActivity extends LiveActivity { private static final String TAG = "LiveAudienceActivity"; - public static String anyway; + public JSONObject pkInfo; - public static LiveAudienceActivity liveAudienceActivity; // 竖直滑动 ViewPager private VerticalViewPager verticalViewPager; @@ -139,7 +139,7 @@ public class LiveAudienceActivity extends LiveActivity { private LiveBean mLiveBean; //当前直播间下标 private int mCurrentItem, mCurrentPage; - private static PortraitLiveManager manager; + private PortraitLiveManager manager; private int mLastPosition = -1; private ViewGroup mViewGroup; @@ -148,6 +148,7 @@ public class LiveAudienceActivity extends LiveActivity { private Handler liveHandler = new Handler(); private ImageView voicePress; private View titleLine; + private boolean liveIndex = true; @Override public T findViewById(@IdRes int id) { @@ -164,7 +165,6 @@ public class LiveAudienceActivity extends LiveActivity { protected void main() { Bus.getOn(this); super.main(); - liveAudienceActivity = this; CrashSaveBean.getInstance().addEnterRoom(); mProcessResultUtil = new ProcessResultUtil(this); Intent intent = getIntent(); @@ -172,15 +172,28 @@ public class LiveAudienceActivity extends LiveActivity { L.e(TAG, "直播sdk----->" + (mLiveSDK == Constants.LIVE_SDK_KSY ? "金山云" : "腾讯云")); mLiveType = intent.getIntExtra(Constants.LIVE_TYPE, Constants.LIVE_TYPE_NORMAL); mLiveTypeVal = intent.getIntExtra(Constants.LIVE_TYPE_VAL, 0); + initView(); + setVolumeControlStream(AudioManager.STREAM_MUSIC); + manager = new PortraitLiveManager(this, intent); mLiveBean = intent.getParcelableExtra(Constants.LIVE_BEAN); mLiveUid = mLiveBean.getUid(); mStream = mLiveBean.getStream(); - setVolumeControlStream(AudioManager.STREAM_MUSIC); - manager = new PortraitLiveManager(this, intent); - initView(); initData(); + MicStatusManager.getInstance().addOnMicListener(onMicStatusListener); } + private final MicStatusManager.OnMicStatusListener onMicStatusListener = new MicStatusManager.OnMicStatusListener() { + @Override + public void onStart() { + verticalViewPager.setEnableScroll(false); + } + + @Override + public void onClose() { + verticalViewPager.setEnableScroll(true); + } + }; + /** * 初始化界面 */ @@ -202,12 +215,12 @@ public class LiveAudienceActivity extends LiveActivity { manager.setBackIndex(backIndex); } - public static LiveRoomPlayViewHolder getmLivePlayViewHolder() { + public LiveRoomPlayViewHolder getmLivePlayViewHolder() { return manager == null ? null : manager.getmLivePlayViewHolder(); } - public static void setCurrentItem(int index) { + public void setCurrentItem(int index) { manager.mViewPager.setCurrentItem(index); } @@ -224,11 +237,11 @@ public class LiveAudienceActivity extends LiveActivity { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - if (Micing == 1) { + if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) { manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal); verticalViewPager.setEnableScroll(false); - } else if (Micing == 2) { + } else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) { verticalViewPager.setEnableScroll(false); manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal); @@ -291,13 +304,13 @@ public class LiveAudienceActivity extends LiveActivity { }); getDrawer(); + } private void loadData(ViewGroup viewGroup, int currentItem) { mViewGroup = viewGroup; mLastPosition = currentItem; liveHandler.post(liveRunnable); - Log.e("收到socket--->", "mLiveUid--------------------------->" + mLiveUid); } @@ -305,37 +318,46 @@ public class LiveAudienceActivity extends LiveActivity { private Runnable liveRunnable = new Runnable() { @Override public void run() { - + if (itemModelList.size() <= mCurrentPage) { + mCurrentPage = 0; + } AnchorRecommendItemModel data = itemModelList.get(mCurrentPage); + if (mCurrentPage == 0 && liveIndex) { + View rootView = manager.getRootView(); + if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) { + ((ViewGroup) (rootView.getParent())).removeView(rootView); + manager.onRemove(false); + } + mViewGroup.addView(manager.getRootView()); + mLiveUid = mLiveBean.getUid(); + mStream = mLiveBean.getStream(); + mAncherName = mLiveBean.getUserNiceName(); + mAncherIcon = mLiveBean.getAvatar(); + manager.onAdd(mLiveBean, mLiveType, mLiveTypeVal, mLiveSDK); + //加载完页面后再后台静默下载礼物svga + downloadAllGift(); + over(); - //获取直播间状态 - LiveHttpUtil.getLiveInfo(data.getUid(), liveInfo); - - } - }; - - /** - * 获取直播间状态 - */ - private HttpCallback liveInfo = new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { - LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> { - //主播正在直播 - if (liveBean1 == null) { - return; - } - runOnUiThread(() -> { - mLiveSDK = liveSdk; + } else { + new LiveRoomCheckLivePresenter(mContext, data.getUid(), data.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + liveIndex = false; + try { + mLiveSDK = Integer.parseInt(liveSdk); + mLiveTypeVal = Integer.parseInt(liveTypeVal); + } catch (NumberFormatException e) { + mLiveSDK = 0; + mLiveTypeVal = 0; + } mLiveType = liveType; - mLiveTypeVal = liveTypeVal; - mLiveBean = liveBean1; - mLiveUid = liveBean1.getUid(); - mStream = liveBean1.getStream(); - mAncherName = liveBean1.getUserNiceName(); - mAncherIcon = liveBean1.getAvatar(); + String json = GsonUtils.toJson(data); + mLiveBean = GsonUtils.fromJson(json, LiveBean.class); + mLiveBean.setUserNiceName(data.getUserNicename()); + mLiveUid = mLiveBean.getUid(); + mStream = mLiveBean.getStream(); + mAncherName = mLiveBean.getUserNiceName(); + mAncherIcon = mLiveBean.getAvatar(); Log.e(TAG, "mLiveUid--------------------------->" + mLiveUid); //加载当前页面数据 View rootView = manager.getRootView(); @@ -345,20 +367,19 @@ public class LiveAudienceActivity extends LiveActivity { } mViewGroup.addView(manager.getRootView()); - manager.onAdd(liveBean1, liveType, liveTypeVal, liveSdk); + manager.onAdd(mLiveBean, liveType, mLiveTypeVal, mLiveSDK); //加载完页面后再后台静默下载礼物svga downloadAllGift(); over(); - }); - + } + @Override + public void onCheckError(String contextError) { + finish(); + } }); - - mCheckLivePresenter.checkLive(liveBean); - } else { - //主播未直播时自动下滑至下一个直播间 - verticalViewPager.setCurrentItem(mCurrentPage + 1); } + } }; @@ -492,9 +513,9 @@ public class LiveAudienceActivity extends LiveActivity { public void onBackPressed() { try { manager.onBackPressed(); - if (Micing == 1) { + if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) { manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal); - } else if (Micing == 2) { + } else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) { manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal); } else { manager.onRemove(true); @@ -524,6 +545,7 @@ public class LiveAudienceActivity extends LiveActivity { super.onDestroy(); ImgLoader.clearMemory(this); overridePendingTransition(0, 0); + MicStatusManager.getInstance().removeOnMicListener(onMicStatusListener); Bus.getOff(this); L.e("LiveAudienceActivity-------onDestroy------->"); } @@ -531,21 +553,30 @@ public class LiveAudienceActivity extends LiveActivity { @Override protected void onPause() { super.onPause(); - manager.onPause(); + if (manager != null) { + manager.onPause(); + } + GiftCacheUtil.getInstance().pause(); } @Override protected void onStop() { super.onStop(); - manager.onStop(); + if (manager != null) { + manager.onStop(); + } + } /** * 点亮 */ public void light() { - manager.light(); + if (manager != null) { + manager.light(); + } + } @@ -553,21 +584,24 @@ public class LiveAudienceActivity extends LiveActivity { * 计时收费更新主播映票数 */ public void roomChargeUpdateVotes() { - manager.sendUpdateVotesMessage(); + if (manager != null) + manager.sendUpdateVotesMessage(); } /** * 暂停播放 */ public void pausePlay() { - manager.pausePlay(); + if (manager != null) + manager.pausePlay(); } /** * 恢复播放 */ public void resumePlay() { - manager.resumePlay(); + if (manager != null) + manager.resumePlay(); } public CountDownTimer getCountDownTimer() { @@ -578,7 +612,8 @@ public class LiveAudienceActivity extends LiveActivity { * 充值成功 */ public void onChargeSuccess() { - manager.onChargeSuccess(); + if (manager != null) + manager.onChargeSuccess(); } public void setCoinNotEnough(boolean coinNotEnough) { @@ -665,7 +700,9 @@ public class LiveAudienceActivity extends LiveActivity { @Override protected void onResume() { super.onResume(); - manager.onResume(); + if (manager != null) { + manager.onResume(); + } GiftCacheUtil.getInstance().restart(); } @@ -718,6 +755,7 @@ public class LiveAudienceActivity extends LiveActivity { list.remove(userIndex); } CustomDrawerPopupView customDrawerPopupView = new CustomDrawerPopupView(mContext).setList(list).setLiveId(mLiveBean.getUid()); + customDrawerPopupView.setCallBack(new CustomDrawerPopupView.CustomDrawerPopupCallBack() { @Override public void funGamesID(int zfunGamesID) { @@ -734,7 +772,30 @@ public class LiveAudienceActivity extends LiveActivity { @Override public void goToLive(AnchorRecommendItemModel model) { //获取直播间状态 - LiveHttpUtil.getLiveInfo(model.getUid(), liveInfo); + LiveHttpUtil.getLiveInfo(model.getUid(), new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + if (liveBean == null) { + return; + } + if (MicStatusManager.getInstance().isMic(liveUid)) { + MicStatusManager.getInstance().showDownMicDialog(mContext); + return; + } + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + } + }); customDrawerPopupView.dismiss(); } @@ -838,7 +899,6 @@ public class LiveAudienceActivity extends LiveActivity { @Override public void onShow(BasePopupView popupView) { - } @Override @@ -944,6 +1004,10 @@ public class LiveAudienceActivity extends LiveActivity { if (event.getMicIng() == 1) { manager.micIngTypeOne(event.getBean(), event.getLiveType(), event.getLiveTypeVal()); } else if (event.getMicIng() == 2) { + if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) { + MicStatusManager.getInstance().showDownMicDialog(mContext); + return; + } manager.micIngTypeTwo(event.getBean(), event.getLiveType(), event.getLiveTypeVal()); } else { //获取房间连麦状态 @@ -1020,9 +1084,8 @@ public class LiveAudienceActivity extends LiveActivity { break; case LIVE_ROOM_EXCEPTION: //主播未直播时自动下滑至下一个直播间 - itemModelList.remove(mCurrentPage); - mPagerAdapter.notifyDataSetChanged(); - verticalViewPager.setCurrentItem(mCurrentPage + 1); + mCurrentPage = mCurrentPage + 1; + liveHandler.post(liveRunnable); break; case REFRESH_THE_LIVEl_PAGE: getDrawer(); @@ -1100,7 +1163,72 @@ public class LiveAudienceActivity extends LiveActivity { case LUCKY_ANGEL: manager.luckyAngel(event.getMsgModel()); break; - + case LINK_MIC: + if (!StringUtil.isEmpty(((LinkMicUserBean) event.getObject()).getUid())) { + mMicQueueList.put(((LinkMicUserBean) event.getObject()).getUid(), (LinkMicUserBean) event.getObject()); + } + if (micListener != null) { + micListener.updateMicList(mMicQueueList); + DialogUitl.showSimpleDialog(mContext, + String.format(WordUtil.getString(R.string.live_mic_user_apply), ((LinkMicUserBean) event.getObject()).getUname()), + new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + openMicWindow(2); + dialog.dismiss(); + } + } + ); + } + break; + case LINK_MIC_CANCEL: + mMicQueueList.remove(((LinkMicUserBean) event.getObject()).getUid()); + if (micListener != null) { + micListener.updateMicList(mMicQueueList); + } + break; + case LINK_MIC_UPDATE_MIC_LIST: + List list = (List) event.getObject(); + mMicQueueList.clear(); + for (LinkMicUserBean bean : list) { + if (!StringUtil.isEmpty(bean.getUid())) { + mMicQueueList.put(bean.getUid(), bean); + } + } + if (micListener != null) { + micListener.updateMicList(mMicQueueList); + } + if (manager.mLiveRoomViewHolder != null) { + manager.mLiveRoomViewHolder.updataMicList(list); + Log.i("多人连麦", "onOpenDrawer: " + list.size()); + for (LinkMicUserBean userBean : list) { + Log.i("多人连麦", "u list: " + userBean.toString()); + } + } + break; + case LINK_MIC_UPDATE_AUDIENCE_LIST: + mAudienceList = (List) event.getObject(); + if (micListener != null) { + micListener.updateAudienceList(mAudienceList); + } + break; + case LINK_MIC_CLOSE: + if (manager.mLiveRoomViewHolder != null) { + manager.mLiveRoomViewHolder.updataCleanMic(); + } + break; + case SOCKET_LIVE_DRPK_SET_PK_VIEW: + ToastUtil.show("setPkView"); + if (manager.getmLivePlayViewHolder() != null) { + manager.getmLivePlayViewHolder().setPkview(); + } + break; + case SOCKET_LIVE_DRPK_SET_PK_END_VIEW: + ToastUtil.show("setPkEndview"); + if (manager.getmLivePlayViewHolder() != null) { + manager.getmLivePlayViewHolder().setPkEndview(); + } + break; } @@ -1132,8 +1260,6 @@ public class LiveAudienceActivity extends LiveActivity { case "3": FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null); AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service"); - AdjustEvent adjustEvent1 = new AdjustEvent("ww5z2p"); - Adjust.trackEvent(adjustEvent1); if (bean.getLink() != null && !"".equals(bean.getLink())) { WebViewActivity.forward(mContext, bean.getLink()); } else { @@ -1159,33 +1285,6 @@ public class LiveAudienceActivity extends LiveActivity { return super.canBackPressed(); } - /** - * 跳转当前页面 - */ - public static void forward(Context context, LiveBean liveBean, int liveType, - int liveTypeVal, String key, int position, int liveSdk) { - forward(context, liveBean, liveType, liveTypeVal, key, null, position, liveSdk); - } - - public static void forward(Context context, LiveBean liveBean, int liveType, - int liveTypeVal, String key, Map map, int position, int liveSdk) { - Intent intent = new Intent(context, LiveAudienceActivity.class); - intent.putExtra(Constants.LIVE_BEAN, liveBean); - intent.putExtra(Constants.LIVE_TYPE, liveType); - intent.putExtra(Constants.LIVE_TYPE_VAL, liveTypeVal); - intent.putExtra(Constants.LIVE_KEY, key); - intent.putExtra(Constants.LIVE_POSITION, position); - intent.putExtra(Constants.LIVE_SDK, liveSdk); - intent.putExtra(Constants.LIVE_SDK, liveSdk); - if (map != null) { - for (String _key : map.keySet()) { - intent.putExtra(_key, map.get(_key)); - } - } - intent.putExtra("landscape", liveBean.getLandscape()); - context.startActivity(intent); - } - /** * 获取侧边栏数据 @@ -1212,6 +1311,8 @@ public class LiveAudienceActivity extends LiveActivity { public void onError(String error) { } }); + + } public void onFollowEvent(FollowEvent e) { diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index 2f3a8e78d..e5052a6b7 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -39,6 +39,7 @@ import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.NotCancelableDialog; @@ -47,6 +48,7 @@ import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.BitmapUtil; import com.yunbao.common.utils.Bus; @@ -56,6 +58,7 @@ import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.L; import com.yunbao.common.utils.LogUtil; import com.yunbao.common.utils.ScreenDimenUtil; +import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.faceunity.FaceManager; @@ -63,7 +66,10 @@ import com.yunbao.live.R; import com.yunbao.live.bean.LiveGuardInfo; import com.yunbao.live.bean.LiveKsyConfigBean; import com.yunbao.live.bean.LiveReceiveGiftBean; +import com.yunbao.common.bean.LiveUserGiftBean; +import com.yunbao.common.bean.MicUserBean; import com.yunbao.live.dialog.LiveLinkMicListDialogFragment; +import com.yunbao.live.dialog.LiveMicAnchorDialogFragment; import com.yunbao.live.dialog.LiveNewFunctionDialogFragment; import com.yunbao.live.dialog.LiveNewWishListDialogFragment; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; @@ -81,6 +87,7 @@ import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter; import com.yunbao.live.socket.SocketRyChatUtil; import com.yunbao.live.socket.SocketRyClient; import com.yunbao.live.socket.SocketSendBean; +import com.yunbao.common.utils.MicStatusManager; import com.yunbao.live.views.LiveEndViewHolder; import com.yunbao.live.views.LiveMusicViewHolder; import com.yunbao.live.views.LiveNewReadyRyViewHolder; @@ -92,7 +99,9 @@ import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import java.io.File; +import java.util.ArrayList; import java.util.List; +import java.util.TreeMap; import cn.rongcloud.rtc.api.RCRTCEngine; import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback; @@ -144,7 +153,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl public static int backIndex = 0;//0=未判断,1=已判断 private FaceManager manager; - @Override protected int getLayoutId() { return R.layout.activity_live_anchor; @@ -233,6 +241,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl int mrr = 0; public int leave = 0; + @Override public void onClick(int functionID) { switch (functionID) { @@ -240,7 +249,8 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl ToastUtil.show("開發中,敬請期待"); break; case Constants.LIVE_FUNC_MIC://語音 - ToastUtil.show("開發中,敬請期待"); + //ToastUtil.show("開發中,敬請期待"); + openMicWindow(1); break; case Constants.LIVE_FUNC_DR://多人PK if (isDRPK != 1) { @@ -386,6 +396,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl } } + /** * 主播展示离开直播间 */ @@ -899,6 +910,9 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLivePushViewHolder = null; mLiveReadyViewHolder = null; mLiveAnchorViewHolder = null; + if (MicStatusManager.getInstance().isAnchorOpenRoom()) { + MicStatusManager.getInstance().closeMic(mContext); + } L.e("LiveAnchorActivity-------onDestroy------->"); Bus.getOff(this); } @@ -1314,6 +1328,82 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl leaveLive(); } break; + case LINK_MIC: + if (!StringUtil.isEmpty(((LinkMicUserBean) event.getObject()).getUid())) { + mMicQueueList.put(((LinkMicUserBean) event.getObject()).getUid(), (LinkMicUserBean) event.getObject()); + } + if (micListener != null) { + micListener.updateMicList(mMicQueueList); + DialogUitl.showSimpleDialog(mContext, + String.format(WordUtil.getString(R.string.live_mic_user_apply), ((LinkMicUserBean) event.getObject()).getUname()), + new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + openMicWindow(2); + dialog.dismiss(); + } + } + ); + } + break; + case LINK_MIC_CANCEL: + mMicQueueList.remove(((LinkMicUserBean) event.getObject()).getUid()); + if (micListener != null) { + micListener.updateMicList(mMicQueueList); + } + break; + case LINK_MIC_UPDATE_MIC_LIST: + List list = (List) event.getObject(); + mMicQueueList.clear(); + for (LinkMicUserBean bean : list) { + if (!StringUtil.isEmpty(bean.getUid())) { + mMicQueueList.put(bean.getUid(), bean); + } + } + if (micListener != null) { + micListener.updateMicList(mMicQueueList); + } + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.updataMicList(list); + Log.i("多人连麦", "onOpenDrawer: "+list.size()); + for (LinkMicUserBean userBean : list) { + Log.i("多人连麦", "u list: "+userBean.toString()); + } + } + break; + case LINK_MIC_UPDATE_AUDIENCE_LIST: + mAudienceList = (List) event.getObject(); + if (micListener != null) { + micListener.updateAudienceList(mAudienceList); + } + break; + case LINK_MIC_CLOSE: + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.updataCleanMic(); + } + break; } } + /** + * 检查指定直播间连麦人数 + * + * @param mLiveUid 直播间 + */ + public static void checkMicUserLength(String mLiveUid, LiveFunctionClickListener listener) { + LiveHttpUtil.getMicList(mLiveUid, 0, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + try { + JSONObject obj = JSON.parseObject(info[0]); + List list = JSON.parseArray(obj.getString("userlist"), MicUserBean.class); + listener.onClick(list.size()); + } catch (Exception e) { + e.printStackTrace(); + } + + } + } + }); + } } diff --git a/live/src/main/java/com/yunbao/live/activity/MyTUIConversationFragment.java b/live/src/main/java/com/yunbao/live/activity/MyTUIConversationFragment.java index b4b7f46cf..f3783bc35 100644 --- a/live/src/main/java/com/yunbao/live/activity/MyTUIConversationFragment.java +++ b/live/src/main/java/com/yunbao/live/activity/MyTUIConversationFragment.java @@ -1,5 +1,6 @@ package com.yunbao.live.activity; + import android.annotation.SuppressLint; import android.content.Intent; import android.graphics.drawable.BitmapDrawable; @@ -24,8 +25,6 @@ import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.adjust.sdk.Adjust; -import com.adjust.sdk.AdjustEvent; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; @@ -64,9 +63,6 @@ import io.rong.imlib.model.Message; import io.rong.message.RecallNotificationMessage; import io.rong.message.TextMessage; -import static com.yunbao.common.CommonAppContext.logger; -import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; - public class MyTUIConversationFragment extends Fragment { private LinearLayout lt_nodata_msg; @@ -168,18 +164,7 @@ public class MyTUIConversationFragment extends Fragment { mAdapter.setActionListener(new ImListAdapter.ActionListener() { @Override public void onItemClick(ImUserBean bean) { - if (bean.getContent().equals("在線客服")) { - mFirebaseAnalytics.logEvent("FS_customer_service", null); - logger.logEvent("FB_customer_service"); - AdjustEvent adjustEvent1 = new AdjustEvent("ww5z2p"); - Adjust.trackEvent(adjustEvent1); - } else if (bean.getContent().equals("新手指導員")) { - mFirebaseAnalytics.logEvent("FS_guide", null); - logger.logEvent("FB_guide", null); - AdjustEvent adjustEvent1 = new AdjustEvent("m0nfpn"); - Adjust.trackEvent(adjustEvent1); - } if (bean.getLink() != null && !bean.getLink().equals("")) { // startActivity(new Intent(getContext(), ZhuangBanActivity.class).putExtra("url", bean.getLink())); startActivity(new Intent(getContext(), WebViewActivity.class).putExtra("url", bean.getLink())); diff --git a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java index b55f3cc7d..ca3142eda 100644 --- a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java @@ -17,6 +17,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.alibaba.fastjson.JSON; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager; @@ -25,8 +26,6 @@ import com.yunbao.common.utils.RouteUtil; import com.yunbao.live.R; import com.yunbao.live.adapter.SystemChatMessageAdapter; import com.yunbao.live.bean.ImUserBean; -import com.yunbao.common.bean.LiveBean; -import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.event.RecommendLiveRoomEvent; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; @@ -196,14 +195,18 @@ public class PDLIiveChatActivity extends FragmentActivity { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> { - if (liveBean1 == null) { - return; + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + } - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); - finish(); }); - mCheckLivePresenter.checkLive(liveBean); + } else { RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0); } diff --git a/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java b/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java index dafc26dd2..d90774d92 100644 --- a/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/PDLiveConversationActivity.java @@ -8,7 +8,6 @@ import android.text.TextUtils; import android.util.Log; import android.view.View; import android.view.WindowManager; -import android.view.animation.AnimationUtils; import android.view.inputmethod.InputMethodManager; import android.widget.ImageView; import android.widget.TextView; @@ -18,18 +17,12 @@ import androidx.core.content.ContextCompat; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; -import com.adjust.sdk.Adjust; -import com.adjust.sdk.AdjustEvent; import com.blankj.utilcode.util.GsonUtils; -import com.facebook.appevents.AppEventsLogger; -import com.google.firebase.analytics.FirebaseAnalytics; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.SelectImageActivity; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.ImageEntity; import com.yunbao.common.bean.NoviceInstructorModel; -import com.yunbao.common.http.CommonHttpUtil; -import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager; @@ -111,18 +104,6 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl } isAdmin = true; imgMore.setVisibility(View.GONE); - AdjustEvent adjustEvent1 = new AdjustEvent("exlgn3"); - Adjust.trackEvent(adjustEvent1); - CommonHttpUtil.setAdvertisingChannels("exlgn3", new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - FirebaseAnalytics.getInstance(mContext).logEvent("FS_director_read", null); - AppEventsLogger.newLogger(mContext).logEvent("FB_director_read"); - } - } - }); - } else {//非指导员 isAdmin = false; imgMore.setVisibility(View.VISIBLE); diff --git a/live/src/main/java/com/yunbao/live/activity/WebViewActivityMedal.java b/live/src/main/java/com/yunbao/live/activity/WebViewActivityMedal.java index b4291c799..e9e98e524 100644 --- a/live/src/main/java/com/yunbao/live/activity/WebViewActivityMedal.java +++ b/live/src/main/java/com/yunbao/live/activity/WebViewActivityMedal.java @@ -140,7 +140,7 @@ public class WebViewActivityMedal extends AbsActivity { } }); - mWebView.addJavascriptInterface( JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView), "androidObject"); + mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView), "androidObject"); mWebView.getSettings().setJavaScriptEnabled(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); @@ -166,10 +166,18 @@ public class WebViewActivityMedal extends AbsActivity { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } - LiveAudienceActivity.forward(mContext, liveBean, 0, 0, "", 0, 0); + @Override + public void onCheckError(String contextError) { + + } + }); } else { - RouteUtil.forwardUserHome(mContext, String.valueOf(live_id), 0); } } diff --git a/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java b/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java index f5fc8f859..29a15a830 100644 --- a/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java @@ -1,7 +1,5 @@ package com.yunbao.live.activity; -import static com.yunbao.common.CommonAppContext.logger; -import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; import android.content.ClipData; import android.content.ClipboardManager; @@ -29,8 +27,6 @@ import android.widget.TextView; import androidx.annotation.RequiresApi; -import com.adjust.sdk.Adjust; -import com.adjust.sdk.AdjustEvent; import com.alibaba.android.arouter.facade.annotation.Route; import com.opensource.svgaplayer.SVGACallback; import com.opensource.svgaplayer.SVGADrawable; @@ -57,6 +53,8 @@ import org.greenrobot.eventbus.ThreadMode; import java.net.MalformedURLException; import java.net.URL; +; + @Route(path = RouteUtil.PATH_LiveZHUANGBANACTIVITY) public class ZhuangBanActivity extends AbsActivity { @@ -97,9 +95,6 @@ public class ZhuangBanActivity extends AbsActivity { } else { if (TextUtils.equals(titleString, "blank")) { title.setVisibility(View.GONE); - RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) rootView.getLayoutParams(); - params.topMargin = DpUtil.dp2px(24); - rootView.setLayoutParams(params); } else { title.setVisibility(View.VISIBLE); titleView.setText(titleString); @@ -152,9 +147,9 @@ public class ZhuangBanActivity extends AbsActivity { // 这个方法在6.0才出现 int statusCode = errorResponse.getStatusCode(); if (404 == statusCode || 500 == statusCode) { - if ( !request.getUrl().toString().contains("favicon")){ + if (!request.getUrl().toString().contains("favicon")) { htmlError.setVisibility(View.VISIBLE); - htmlError.setText("errorCode:" + statusCode +"\n failingUrl:" + request.getUrl()); + htmlError.setText("errorCode:" + statusCode + "\n failingUrl:" + request.getUrl()); } } } @@ -374,11 +369,6 @@ public class ZhuangBanActivity extends AbsActivity { } catch (MalformedURLException e) { e.printStackTrace(); } - } else if (TextUtils.equals(event.getMethod(), "AndroidAdjustConsume")) { - mFirebaseAnalytics.logEvent("FS_event_interaction", null); - logger.logEvent("FB_event_interaction", null); - AdjustEvent adjustEvent1 = new AdjustEvent("rq2c5n"); - Adjust.trackEvent(adjustEvent1); } } diff --git a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java new file mode 100644 index 000000000..f6a403849 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java @@ -0,0 +1,264 @@ +package com.yunbao.live.adapter; + +import android.content.Context; +import android.util.Log; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.opensource.svgaplayer.SVGADrawable; +import com.opensource.svgaplayer.SVGAImageView; +import com.opensource.svgaplayer.SVGAParser; +import com.opensource.svgaplayer.SVGAVideoEntity; +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.Constants; +import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.custom.CommonRefreshView; +import com.yunbao.common.dialog.AbsDialogFragment; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.API; +import com.yunbao.common.http.ResponseModel; +import com.yunbao.common.utils.CommonIconUtil; +import com.yunbao.common.utils.SVGAViewUtils; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.R; +import com.yunbao.live.activity.LiveActivity; +import com.yunbao.live.activity.LiveRyAnchorActivity; +import com.yunbao.common.bean.MicUserBean; +import com.yunbao.live.interfaces.LiveFunctionClickListener; +import com.yunbao.live.socket.SocketSendBean; + +import java.net.MalformedURLException; +import java.net.URL; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.functions.Consumer; +import io.reactivex.schedulers.Schedulers; +import io.rong.imkit.IMCenter; +import io.rong.imlib.IRongCallback; +import io.rong.imlib.RongIMClient; +import io.rong.imlib.model.Conversation; +import io.rong.imlib.model.Message; +import io.rong.message.TextMessage; + +public class AnchorUserMicInfoAdapter extends RefreshAdapter { + public static final int TYPE_MIC_LIST = 1;//连麦列表 + public static final int TYPE_MIC_REQUEST = 2;//请求连麦 + public static final int TYPE_MIC_INVITE = 3;//邀请连麦 + + private AbsDialogFragment fragments; + private CommonRefreshView refreshView; + private String mLiveUid; + + public AnchorUserMicInfoAdapter(Context context, AbsDialogFragment fragment) { + super(context); + this.fragments = fragment; + } + + + @Override + public int getItemViewType(int position) { + return position; + } + + public void setRefreshView(CommonRefreshView refreshView) { + this.refreshView = refreshView; + } + + public void setLiveUid(String mLiveUid) { + this.mLiveUid = mLiveUid; + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + + return new AnchorUserMicInfoAdapter.Vh(mInflater.inflate(R.layout.item_anchor_mic_info, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) { +// vh.setIsRecyclable(false); + ((AnchorUserMicInfoAdapter.Vh) vh).setData(mList.get(position), position); + + } + + @Override + public int getItemCount() { + return mList.size(); + } + + + class Vh extends RecyclerView.ViewHolder { + ImageView mAvatar; + TextView mName; + ImageView mSex; + ImageView mLevel; + ImageView mClose; + SVGAImageView gift_svga; + Button mBtn; + + public Vh(@NonNull View itemView) { + super(itemView); + mAvatar = (ImageView) itemView.findViewById(R.id.avatar); + mName = (TextView) itemView.findViewById(R.id.name); + mSex = (ImageView) itemView.findViewById(R.id.sex); + mLevel = (ImageView) itemView.findViewById(R.id.level); + gift_svga = (SVGAImageView) itemView.findViewById(R.id.gift_svga); + mBtn = itemView.findViewById(R.id.mic_btn); + mClose = itemView.findViewById(R.id.mic_exit); + mBtn.setOnClickListener(v -> { + if (v.getTag() != null) { + MicUserBean tag = (MicUserBean) v.getTag(); + LiveRyAnchorActivity.checkMicUserLength(mLiveUid, new LiveFunctionClickListener() { + @Override + public void onClick(int length) { + //只允许最多3人连麦(加主播4人) + if (length <= 4) { + if (tag.getType() == TYPE_MIC_REQUEST) { + applyMic(tag, 4, createSocketSendBean()); + ToastUtil.show(WordUtil.getString(R.string.live_mic_request)); + } else if (tag.getType() == TYPE_MIC_INVITE) { + SocketSendBean bean = createSocketSendBean().param("targetId", tag.getId()); + applyMic(tag, 1, bean); + ToastUtil.show(WordUtil.getString(R.string.live_mic_invite)); + } + } else { + ToastUtil.show(WordUtil.getString(R.string.live_mic_max)); + } + } + }); + + } + }); + mClose.setOnClickListener(v -> { + if (v.getTag() != null) { + API.get().createPDLiveApi(true) + .killDrLm(((MicUserBean) v.getTag()).getId(), mLiveUid) + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel stringResponseModel) throws Exception { + applyMic((MicUserBean) v.getTag(), 8, createSocketSendBean()); + ToastUtil.show(WordUtil.getString(R.string.live_mic_user_down)); + } + }, Throwable::printStackTrace).isDisposed(); + + } + }); + } + + SocketSendBean createSocketSendBean() { + return new SocketSendBean() + .param("_method_", Constants.LIAN_MAI) + .param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()) + .param("avatar", CommonAppConfig.getInstance().getUserBean().getAvatar()) + .param("uid", CommonAppConfig.getInstance().getUid()); + } + + /** + * 发送IM消息 + * @param action 4为同意请求,1为邀请,其余见 {@link com.yunbao.live.socket.SocketRyClient} Constants.LIAN_MAI解析 + */ + void applyMic(MicUserBean bean, int action, SocketSendBean msg) { + msg.param("action", action); + msg.create(); + Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE; + TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); + io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(bean.getId(), conversationType, messageContent); + RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + @Override + public void onAttached(io.rong.imlib.model.Message message) { + + } + + @Override + public void onSuccess(io.rong.imlib.model.Message message) { + Log.e("ry", "发送成功"); + refreshView.initData(); + IMCenter.getInstance().deleteRemoteMessages(Conversation.ConversationType.PRIVATE, message.getTargetId(), new Message[]{message}, null); + IMCenter.getInstance().clearMessagesUnreadStatus(Conversation.ConversationType.PRIVATE, message.getTargetId(), null); + } + + @Override + public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) { + Log.e("ry", "发送失敗" + errorCode.toString()); + refreshView.initData(); + } + }); + } + + void setData(final MicUserBean bean, int position) { + + itemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ((LiveActivity) mContext).showUserDialog(bean.getId()); + fragments.dismiss(); + } + }); + mClose.setTag(bean); + mBtn.setTag(bean); + switch (bean.getType()) { + case TYPE_MIC_LIST: + mClose.setVisibility(View.VISIBLE); + mBtn.setVisibility(View.GONE); + break; + case TYPE_MIC_REQUEST: + case TYPE_MIC_INVITE: + mClose.setVisibility(View.GONE); + mBtn.setVisibility(View.VISIBLE); + break; + } + if (bean.getType() == TYPE_MIC_REQUEST) { + mBtn.setText("同意"); + mBtn.setBackgroundResource(R.drawable.bg_anchor_mic_info_btn_ok); + } else if (bean.getType() == TYPE_MIC_INVITE) { + mBtn.setText("邀请"); + mBtn.setBackgroundResource(R.drawable.bg_anchor_mic_info_btn_invite); + } + ImgLoader.display(mContext, bean.getAvatar(), mAvatar); + if (bean.getDress_avatar() != null) { + if (bean.getDress_avatar().contains("svga")) { + try { + new SVGAParser(mContext).parse(new URL(bean.getDress_avatar()), new SVGAParser.ParseCompletion() { + @Override + public void onComplete(SVGAVideoEntity videoItem) { + SVGADrawable drawable = new SVGADrawable(videoItem); + gift_svga.setImageDrawable(drawable); + SVGAViewUtils.playEndClear(gift_svga); + } + + @Override + public void onError() { + } + }); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + } else { + ImgLoader.display(mContext, bean.getDress_avatar(), gift_svga); + } + } + + mName.setText(bean.getUserNiceName()); + + mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); + LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); + if (levelBean != null) { + ImgLoader.display(mContext, levelBean.getThumb(), mLevel); + } + } + } + + +} diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java index 9096d03e8..e0a9e4b1f 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -319,17 +319,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } } else if (bean.getType() == -2) {//自动消息,点击发言 - boolean isContains = false; - for (LiveChatBean model : mList) { - if (bean.getType() == -2) { - isContains = true; - } - } - if (isContains) { - mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item); - mTextView.setText(R.string.automatic_chat); - bean.setHeart(position); - } + + mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item); + mTextView.setText(R.string.automatic_chat); + bean.setHeart(position); } else if (bean.getType() == MSG_HOUR_RANK_CHANGE) { mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item); mTextView.setText(bean.getContent()); @@ -388,7 +381,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { mList.add(bean); if (isSlideToBottom(mRecyclerView)) { - mRecyclerView.scrollToPosition(getItemCount() - 1); + scrollToBottom(mRecyclerView); } else { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER)); @@ -403,6 +396,19 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } + private void scrollToBottom(final RecyclerView recyclerView) { + // scroll to last item to get the view of last item + final LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); + final int lastItemPosition = getItemCount() - 1; + recyclerView.post(new Runnable() { + @Override + public void run() { + layoutManager.scrollToPositionWithOffset(lastItemPosition, Integer.MIN_VALUE); + + } + }); + } + /** * 判断是否滚到底部 * @@ -411,8 +417,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { */ public boolean isSlideToBottom(RecyclerView recyclerView) { if (recyclerView == null) return false; - if (recyclerView.computeVerticalScrollExtent() + recyclerView.computeVerticalScrollOffset() - >= recyclerView.computeVerticalScrollRange()) + if (recyclerView.computeVerticalScrollExtent() + recyclerView.computeVerticalScrollOffset() >= recyclerView.computeVerticalScrollRange()) return true; return false; } diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveNewGuardBuyItemsAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveNewGuardBuyItemsAdapter.java index b4b1bb8a4..4a5632e97 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveNewGuardBuyItemsAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveNewGuardBuyItemsAdapter.java @@ -1,6 +1,12 @@ package com.yunbao.live.adapter; import android.content.Context; +import android.graphics.Color; +import android.graphics.LinearGradient; +import android.graphics.Shader; +import android.text.Spannable; +import android.text.SpannableStringBuilder; +import android.text.style.ForegroundColorSpan; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -34,8 +40,9 @@ public class LiveNewGuardBuyItemsAdapter extends RecyclerView.Adapter items) { this.items = items; } - public void setOnItemSelectListener(OnItemSelectListener listener){ - this.itemSelect=listener; + + public void setOnItemSelectListener(OnItemSelectListener listener) { + this.itemSelect = listener; } @NonNull @@ -75,10 +82,10 @@ public class LiveNewGuardBuyItemsAdapter extends RecyclerView.Adapter { buyButton.setBackgroundResource(R.drawable.img_k_selected); - changeItem((int)title.getTag()); + changeItem((int) title.getTag()); notifyDataSetChanged(); - if(itemSelect!=null){ - itemSelect.onSelectId((int)title.getTag()); + if (itemSelect != null) { + itemSelect.onSelectId((int) title.getTag()); } }); @@ -87,13 +94,32 @@ public class LiveNewGuardBuyItemsAdapter extends RecyclerView.Adapter { ImgLoader.display2(mContext, userBean.getAvatar(), mAvatar,100,100); // ImageLoadUtils.loadUrl(userBean.getAvatar(),32,32,mAvatar); } - + gift_svga.setImageDrawable(null); if (userBean.getDress() != null) { if (userBean.getDress().getAvatar_frame().contains("svga")) { diff --git a/live/src/main/java/com/yunbao/live/adapter/SystemChatMessageAdapter.java b/live/src/main/java/com/yunbao/live/adapter/SystemChatMessageAdapter.java index 4343056e3..d326bb009 100644 --- a/live/src/main/java/com/yunbao/live/adapter/SystemChatMessageAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/SystemChatMessageAdapter.java @@ -1,5 +1,6 @@ package com.yunbao.live.adapter; +import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.Intent; @@ -11,8 +12,6 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import com.adjust.sdk.Adjust; -import com.adjust.sdk.AdjustEvent; import com.alibaba.fastjson.JSON; import com.facebook.appevents.AppEventsLogger; import com.google.firebase.analytics.FirebaseAnalytics; @@ -50,6 +49,7 @@ public class SystemChatMessageAdapter extends RecyclerView.Adapter { return new SystemChatMessageViewHolder(mInflater.inflate(R.layout.view_system_message_item, parent, false)); } + @SuppressLint("MissingPermission") @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { ImUserBean model = listUserBean.get(position); @@ -90,8 +90,7 @@ public class SystemChatMessageAdapter extends RecyclerView.Adapter { if (model1.getContent().equals("在線客服")) { FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null); AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service"); - AdjustEvent adjustEvent1 = new AdjustEvent("ww5z2p"); - Adjust.trackEvent(adjustEvent1); + } if (!TextUtils.isEmpty(model1.getLink())) { mContext.startActivity(new Intent(mContext, WebViewActivity.class).putExtra("url", model1.getLink())); diff --git a/live/src/main/java/com/yunbao/live/adapter/UserMicInfoAdapter.java b/live/src/main/java/com/yunbao/live/adapter/UserMicInfoAdapter.java index f01e0bab5..4bd7681ef 100644 --- a/live/src/main/java/com/yunbao/live/adapter/UserMicInfoAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/UserMicInfoAdapter.java @@ -3,7 +3,6 @@ package com.yunbao.live.adapter; import android.content.Context; import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.RecyclerView; import android.view.View; @@ -24,7 +23,7 @@ import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; -import com.yunbao.live.bean.MicUserBean; +import com.yunbao.common.bean.MicUserBean; import java.net.MalformedURLException; import java.net.URL; diff --git a/live/src/main/java/com/yunbao/live/adapter/UserMoreInfoAdapter.java b/live/src/main/java/com/yunbao/live/adapter/UserMoreInfoAdapter.java index 16c39a661..933a78efb 100644 --- a/live/src/main/java/com/yunbao/live/adapter/UserMoreInfoAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/UserMoreInfoAdapter.java @@ -25,6 +25,7 @@ import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.LiveUserRankBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.glide.ImgLoader; @@ -35,7 +36,6 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.weight.ClipPathCircleImage; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; -import com.yunbao.live.bean.LiveUserGiftBean; import com.yunbao.live.dialog.LiveUserMoreDialogFragment; import com.yunbao.live.utils.LiveTextRender; @@ -153,7 +153,7 @@ public class UserMoreInfoAdapter extends RefreshAdapter { title.setVisibility(View.GONE); title1.setVisibility(View.GONE); Log.i("tag", "" + num); - ivIcon.setVisibility(View.VISIBLE); + ivIcon.setVisibility(View.GONE); mIcon.setImageBitmap(null); tvName.setVisibility(View.GONE); @@ -175,7 +175,7 @@ public class UserMoreInfoAdapter extends RefreshAdapter { if (guardType == Constants.GUARD_TYPE_DAY) { mIcon.setImageDrawable(mGuardDrawable0); } else if (guardType == Constants.GUARD_TYPE_MONTH) { - mIcon.setImageDrawable(mGuardDrawable1); + // mIcon.setImageDrawable(mGuardDrawable1); //观众列表不显示粉丝牌 } else if (guardType == Constants.GUARD_TYPE_YEAR) { mIcon.setImageDrawable(mGuardDrawable2); } @@ -206,8 +206,13 @@ public class UserMoreInfoAdapter extends RefreshAdapter { ImgLoader.displayDrawable(mContext, bean.getFans_pic(), new ImgLoader.DrawableCallback() { @Override public void onLoadSuccess(Drawable drawable) { + RelativeLayout.LayoutParams ivLayoutParams = (RelativeLayout.LayoutParams) ivIcon.getLayoutParams(); + ivLayoutParams.height = DpUtil.dp2px(40); + ivLayoutParams.width = DpUtil.dp2px(70); + ivIcon.setLayoutParams(ivLayoutParams); ivIcon.setImageDrawable(drawable); tvName.setText(bean.getMedal_name()); + tvName.setTextSize(9); } @Override @@ -220,6 +225,7 @@ public class UserMoreInfoAdapter extends RefreshAdapter { tvName.setText(((LiveUserRankBean) bean).getTotal() + ""); tvName.setTextColor(Color.parseColor("#9E9E9E")); tvName.setTextSize(12); + switch (position) { case 0: rankImage.setImageResource(R.mipmap.day_list_no_1); diff --git a/live/src/main/java/com/yunbao/live/adapter/VerticalPagerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/VerticalPagerAdapter.java index 6edabd64f..e7e24200a 100644 --- a/live/src/main/java/com/yunbao/live/adapter/VerticalPagerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/VerticalPagerAdapter.java @@ -55,7 +55,6 @@ public class VerticalPagerAdapter extends androidx.viewpager.widget.PagerAdapter ImageView ivLoading = view.findViewById(R.id.iv_loading); AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground(); frameAnimation.start(); -// ImgLoader.displayGif(mContext, R.drawable.live_loading, ivLoading); view.setId(position); container.addView(view); return view; @@ -63,6 +62,7 @@ public class VerticalPagerAdapter extends androidx.viewpager.widget.PagerAdapter @Override public void destroyItem(ViewGroup container, int position, Object object) { - container.removeView(container.findViewById(position)); + +// container.removeView(container.findViewById(position)); } } diff --git a/live/src/main/java/com/yunbao/live/bean/LiveEnterRoomBean.java b/live/src/main/java/com/yunbao/live/bean/LiveEnterRoomBean.java index 1b42f5177..bf728a951 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveEnterRoomBean.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveEnterRoomBean.java @@ -1,5 +1,7 @@ package com.yunbao.live.bean; +import com.yunbao.common.bean.LiveUserGiftBean; + /** * Created by cxf on 2018/10/12. */ diff --git a/live/src/main/java/com/yunbao/live/bean/LiveUserGiftBean.java b/live/src/main/java/com/yunbao/live/bean/LiveUserGiftBean.java deleted file mode 100644 index 37d01b5d8..000000000 --- a/live/src/main/java/com/yunbao/live/bean/LiveUserGiftBean.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.yunbao.live.bean; - -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 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; - } -} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java index 46699371b..750f56dc7 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGameDialogFragment.java @@ -1,7 +1,5 @@ package com.yunbao.live.dialog; -import static com.yunbao.common.CommonAppContext.logger; -import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; import android.content.DialogInterface; import android.graphics.Color; @@ -22,8 +20,6 @@ import android.widget.LinearLayout; import androidx.annotation.Nullable; -import com.adjust.sdk.Adjust; -import com.adjust.sdk.AdjustEvent; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.google.android.material.tabs.TabLayout; @@ -47,11 +43,9 @@ import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; -import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; -import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -293,8 +287,6 @@ public class LiveGameDialogFragment extends AbsDialogFragment { } - private LiveRoomCheckLivePresenter mCheckLivePresenter; - private void gotoLive(final String live_id) { if (!TextUtils.equals(roomId, live_id)) { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { @@ -302,20 +294,17 @@ public class LiveGameDialogFragment extends AbsDialogFragment { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - dismiss(); - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } - } - }); - } - mCheckLivePresenter.checkLive(liveBean); + @Override + public void onCheckError(String contextError) { + + } + }); } else { RouteUtil.forwardUserHome(mContext, live_id, 0); } @@ -368,11 +357,6 @@ public class LiveGameDialogFragment extends AbsDialogFragment { if (event.getData() != null && !event.getData().isEmpty()) { onTrickerySendGiftInto(new JsWishBean(event.getData())); } - } else if (TextUtils.equals(event.getMethod(), "AndroidAdjustPrank")) { - AdjustEvent adjustEvent1 = new AdjustEvent("v1nekv"); - Adjust.trackEvent(adjustEvent1); - mFirebaseAnalytics.logEvent("FS_prank_interaction", null); - logger.logEvent("FB_prank_interaction", null); } else if (TextUtils.equals(event.getMethod(), "androidMethodClickUser")) { if (!(mContext instanceof LiveRyAnchorActivity)) { //点击用户头像 diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java index f24723467..c814aebb1 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java @@ -1,8 +1,6 @@ package com.yunbao.live.dialog; import static com.yunbao.common.CommonAppConfig.isGetNewWrap; -import static com.yunbao.common.CommonAppContext.logger; -import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; import static com.yunbao.common.utils.RouteUtil.PATH_COIN; import static com.yunbao.live.views.LiveRoomViewHolder.bean1; @@ -32,8 +30,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager.widget.ViewPager; -import com.adjust.sdk.Adjust; -import com.adjust.sdk.AdjustEvent; + import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; @@ -148,7 +145,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On window.setWindowAnimations(R.style.bottomToTopAnim); WindowManager.LayoutParams params = window.getAttributes(); params.width = WindowManager.LayoutParams.MATCH_PARENT; - params.height = DpUtil.dp2px(350); + params.height = DpUtil.dp2px(355); params.gravity = Gravity.BOTTOM; window.setAttributes(params); } @@ -251,7 +248,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On mVipGoldTitle = mRootView.findViewById(R.id.vipGoldTitle); mVipGoldDesc = mRootView.findViewById(R.id.vipGoldDesc); mVipGold.setOnClickListener(this); - mGiftPackage= mRootView.findViewById(R.id.btn_gift_package); + mGiftPackage = mRootView.findViewById(R.id.btn_gift_package); mGiftPackage.setOnClickListener(this); mRootView.findViewById(R.id.live_gift_download_all).setOnClickListener(this); mHandler = new Handler() { @@ -295,7 +292,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On JSONObject user = JSONObject.parseObject(info[0]); int nobleId = user.getIntValue("noble_id"); int resId = NobleUtil.nobleIdToImageResId(nobleId); - if(resId!=-1){ + if (resId != -1) { mVipGoldIcon.setImageResource(resId); mVipGoldTitle.setText(user.getString("noble_name")); mVipGoldDesc.setText(R.string.live_gift_buy_gold_desc_to); @@ -385,7 +382,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On String giftJson = obj.getString("giftlist"); List list = JSON.parseArray(giftJson, LiveGiftBean.class); GiftCacheUtil.getInstance().addDownloadList(list); - if(!GiftCacheUtil.getInstance().isDownloading()){ + if (!GiftCacheUtil.getInstance().isDownloading()) { GiftCacheUtil.getInstance().downloadAllGift(); } if (list.size() == 0) { @@ -405,7 +402,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On } private void showGiftList(List list) { - if (bean1!=null&&IMLoginManager.get(mContext).isNewUserGif() && (type_name.equals("熱門") || type_name.equals("Hot"))) { + if (bean1 != null && IMLoginManager.get(mContext).isNewUserGif() && (type_name.equals("熱門") || type_name.equals("Hot"))) { list.add(0, bean1); if (mWishGiftId == null) { mWishGiftId = "" + bean1.getId(); @@ -503,11 +500,11 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On } else if (i == R.id.btn_choose) { showGiftCount(); } else if (i == R.id.coin) { - forwardMyCoin(); + forwardMyCoin(0); } else if (i == R.id.goldCoin) { - forwardMyCoin(); + forwardMyCoin(2); } else if (i == R.id.go_charge) { - forwardMyCoin(); + forwardMyCoin(0); } else if (i == R.id.btn_luck_gift_tip) { dismiss(); ((LiveActivity) mContext).openLuckGiftTip(); @@ -556,10 +553,10 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On /** * 跳转到我的钻石 */ - private void forwardMyCoin() { + private void forwardMyCoin(int page) { dismiss(); //我们的 - ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + ARouter.getInstance().build(PATH_COIN).withInt("p", page).navigation(); } /** @@ -709,6 +706,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On /** * 收到礼物下载完成的通知 + * * @param status */ @Subscribe(threadMode = ThreadMode.MAIN) @@ -727,10 +725,6 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0) { - mFirebaseAnalytics.logEvent("FS_present_interaction", null); - logger.logEvent("FB_present_interaction"); - AdjustEvent adjustEvent1 = new AdjustEvent("22x4u2"); - Adjust.trackEvent(adjustEvent1); if (mLiveGiftBean.getSwf().contains("svga")) { LiveGiftDialogFragment.this.dismiss(); } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java index 389575861..fe8dcf21a 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java @@ -1,7 +1,5 @@ package com.yunbao.live.dialog; -import static com.yunbao.common.CommonAppContext.logger; -import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; import android.content.DialogInterface; import android.graphics.Color; @@ -28,8 +26,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.FragmentManager; -import com.adjust.sdk.Adjust; -import com.adjust.sdk.AdjustEvent; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.yunbao.common.Constants; @@ -41,6 +37,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.JavascriptInterfaceUtils; import com.yunbao.common.utils.L; +import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.R; @@ -63,6 +60,7 @@ public class LiveHDDialogFragment extends AbsDialogFragment { private String roomId; private DialogInterface.OnShowListener listener; private TextView htmlError; + private boolean isSetHeight =false; public LiveHDDialogFragment() { @@ -176,6 +174,7 @@ public class LiveHDDialogFragment extends AbsDialogFragment { findViewById(R.id.title_laout).setVisibility(View.VISIBLE); } if (bundle.getInt("height", -1) != -1) { + isSetHeight =true; LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, bundle.getInt("height", -1)); mWebView.setLayoutParams(params); } @@ -196,7 +195,9 @@ public class LiveHDDialogFragment extends AbsDialogFragment { @Override public void onPageFinished(WebView view, String url) { - view.loadUrl("javascript:window.androidObject.setHeight(document.body.clientHeight,document.body.clientWidth)"); + if(!isSetHeight) { + view.loadUrl("javascript:window.androidObject.setHeight(document.body.clientHeight,document.body.clientWidth,true)"); + } if (listener != null) { listener.onShow(LiveHDDialogFragment.this.getDialog()); listener = null; @@ -209,9 +210,9 @@ public class LiveHDDialogFragment extends AbsDialogFragment { // 这个方法在6.0才出现 int statusCode = errorResponse.getStatusCode(); if (404 == statusCode || 500 == statusCode) { - if ( !request.getUrl().toString().contains("favicon")){ + if (!request.getUrl().toString().contains("favicon")) { htmlError.setVisibility(View.VISIBLE); - htmlError.setText("errorCode:" + statusCode +"\n failingUrl:" + request.getUrl()); + htmlError.setText("errorCode:" + statusCode + "\n failingUrl:" + request.getUrl()); } } } @@ -229,7 +230,6 @@ public class LiveHDDialogFragment extends AbsDialogFragment { } - private LiveRoomCheckLivePresenter mCheckLivePresenter; private void gotoLive(final String live_id) { if (!TextUtils.equals(roomId, live_id)) { @@ -238,20 +238,25 @@ public class LiveHDDialogFragment extends AbsDialogFragment { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - dismiss(); - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); - + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + if (liveBean == null) { + return; } - }); - } - mCheckLivePresenter.checkLive(liveBean); + if(MicStatusManager.getInstance().isMic(liveUid)){ + MicStatusManager.getInstance().showDownMicDialog(mContext); + return; + } + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); + dismiss(); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } else { RouteUtil.forwardUserHome(mContext, live_id, 0); } @@ -313,11 +318,6 @@ public class LiveHDDialogFragment extends AbsDialogFragment { if (event.getData() != null && !event.getData().isEmpty()) { onTrickerySendGiftInto(new JsWishBean(event.getData())); } - } else if (TextUtils.equals(event.getMethod(), "AndroidAdjustPrank")) { - AdjustEvent adjustEvent1 = new AdjustEvent("v1nekv"); - Adjust.trackEvent(adjustEvent1); - mFirebaseAnalytics.logEvent("FS_prank_interaction", null); - logger.logEvent("FB_prank_interaction", null); } else if (TextUtils.equals(event.getMethod(), "androidMethodClickUser")) { //点击用户头像 if (!(mContext instanceof LiveRyAnchorActivity)) { diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java index b17edacc4..691cb0e04 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java @@ -238,6 +238,9 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O case GENERALMESSAGE: ((LiveActivity) mContext).sendChatMessage(content, atTextWatcher.getAtUserID(), atTextWatcher.getAtUserName()); atTextWatcher.clearMsg(); + if (imm != null) { + imm.hideSoftInputFromWindow(mInput.getWindowToken(), 0); + } dismiss(); break; } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveMicAnchorDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveMicAnchorDialogFragment.java new file mode 100644 index 000000000..237aec02a --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveMicAnchorDialogFragment.java @@ -0,0 +1,383 @@ +package com.yunbao.live.dialog; + +import android.app.ActionBar; +import android.app.Dialog; +import android.graphics.Color; +import android.os.Bundle; +import android.util.Log; +import android.view.Gravity; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.LinearLayoutManager; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.yunbao.common.Constants; +import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.LinkMicUserBean; +import com.yunbao.common.custom.CommonRefreshView; +import com.yunbao.common.dialog.AbsDialogFragment; +import com.yunbao.common.http.API; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.ResponseModel; +import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.DpUtil; +import com.yunbao.live.R; +import com.yunbao.live.activity.LiveActivity; +import com.yunbao.live.adapter.AnchorUserMicInfoAdapter; +import com.yunbao.live.bean.LiveGuardInfo; +import com.yunbao.common.bean.LiveUserGiftBean; +import com.yunbao.common.bean.MicUserBean; +import com.yunbao.live.http.LiveHttpUtil; +import com.yunbao.live.utils.LiveImDeletUtil; +import com.yunbao.common.utils.MicStatusManager; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.TreeMap; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.functions.Consumer; +import io.reactivex.schedulers.Schedulers; + +/** + * 连麦列表 + * 主播端 + */ +public class LiveMicAnchorDialogFragment extends AbsDialogFragment implements View.OnClickListener { + + private CommonRefreshView mRefreshView; + private View view_no; + private AnchorUserMicInfoAdapter userMicInfoAdapter; + private String mLiveUid; + private String stream; + private LiveGuardInfo mLiveGuardInfo; + public static LiveActivity activity = null; + public eightbitlab.com.blurview.BlurView blurView; + + public TextView listMicbtn, requestMicBtn, inviteMicBtn, mDisconnectMic; + private TextView mNoMoreDesc; + private String Tips = "1"; + private String type = "guanzhong"; + View mOpenMicLayout, no_more; + View mOpenMicBtn; + private TreeMap mMicQueueList = new TreeMap<>(); + private List mAudienceList = new ArrayList<>(); + private LiveImDeletUtil liveImDeletUtil; + private OnMicListener micListener; + + @Override + protected int getLayoutId() { + return R.layout.dialog_anchor_mic_list; + } + + @Override + protected int getDialogStyle() { + return R.style.dialog2; + } + + @Override + protected boolean canCancel() { + return true; + } + + @Override + protected void setWindowAttributes(Window window) { + WindowManager.LayoutParams params = window.getAttributes(); + params.width = ActionBar.LayoutParams.MATCH_PARENT; + params.height = DpUtil.dp2px(460); + params.gravity = Gravity.BOTTOM; + window.setAttributes(params); + } + + public void setLiveGuardInfo(LiveGuardInfo info) { + mLiveGuardInfo = info; + } + + public void setMicQueueList(TreeMap mMicQueueList) { + this.mMicQueueList = mMicQueueList; + } + + public void setAudienceList(List mAudienceList) { + this.mAudienceList = mAudienceList; + } + + public OnMicListener getMicListener() { + if (micListener == null) { + micListener = new OnMicListener() { + @Override + public void updateMicList(TreeMap list) { + mMicQueueList = list; + if ("2".equals(Tips)) { + mRefreshView.initData(); + } + } + + @Override + public void updateAudienceList(List list) { + mAudienceList = list; + if ("3".equals(Tips)) { + mRefreshView.initData(); + } + } + }; + } + return micListener; + } + + int nums = 0; + int pg = 1; + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + Bundle bundle = getArguments(); + if (bundle == null) { + return; + } + liveImDeletUtil = new LiveImDeletUtil(); + + mLiveUid = bundle.getString(Constants.LIVE_UID); + stream = bundle.getString(Constants.STREAM); + listMicbtn = mRootView.findViewById(R.id.audience_btn); + mOpenMicLayout = mRootView.findViewById(R.id.anchor_open_mic); + no_more = mRootView.findViewById(R.id.no_more); + mOpenMicBtn = mRootView.findViewById(R.id.open_mic); + mNoMoreDesc = mRootView.findViewById(R.id.no_more_desc); + Tips = bundle.getString("By"); + + listMicbtn.setOnClickListener(view -> { + if (!MicStatusManager.getInstance().isAnchorOpenRoom()) { + return; + } + Tips = "1"; + Up(); + type = "guanzhong"; + mRefreshView.initData(); + }); + requestMicBtn = mRootView.findViewById(R.id.guard_btn); + requestMicBtn.setOnClickListener(view -> { + if (!MicStatusManager.getInstance().isAnchorOpenRoom()) { + return; + } + Tips = "2"; + Up(); + type = "guard"; + mRefreshView.initData(); + }); + inviteMicBtn = mRootView.findViewById(R.id.fans_btn); + inviteMicBtn.setVisibility(View.VISIBLE); + inviteMicBtn.setOnClickListener(view -> { + if (!MicStatusManager.getInstance().isAnchorOpenRoom()) { + return; + } + Tips = "3"; + Up(); + type = "fans"; + mRefreshView.initData(); + }); + mOpenMicBtn.setOnClickListener(v -> { + API.get().pdLiveApi(mContext) + .createDrLm() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel stringResponseModel) throws Exception { + mOpenMicLayout.setVisibility(View.GONE); + mRefreshView.setVisibility(View.VISIBLE); + mDisconnectMic.setVisibility(View.VISIBLE); + MicStatusManager.getInstance().setAnchorOpenRoom(true); + mRefreshView.initData(); + } + }, Throwable::printStackTrace) + .isDisposed(); + }); + + mRefreshView = mRootView.findViewById(R.id.refreshView); + view_no = mRootView.findViewById(R.id.view_no); + mDisconnectMic = mRootView.findViewById(R.id.apply_btn); + mDisconnectMic.setBackgroundResource(R.drawable.background_eb6877); + mDisconnectMic.setText(R.string.close_mic); + mDisconnectMic.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + DialogUitl.showSimpleDialog(mContext, "是否確認關閉語音連麥", new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + MicStatusManager.getInstance().closeMic(mContext); + LiveMicAnchorDialogFragment.this.dismiss(); + } + }); + } + }); + userMicInfoAdapter = new AnchorUserMicInfoAdapter(mContext, LiveMicAnchorDialogFragment.this); + userMicInfoAdapter.setLiveUid(mLiveUid); + userMicInfoAdapter.setRefreshView(mRefreshView); + Up(); + mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); + mRefreshView.setDataHelper(new CommonRefreshView.DataHelper() { + @Override + public RefreshAdapter getAdapter() { + userMicInfoAdapter.notifyDataSetChanged(); + return userMicInfoAdapter; + } + + @Override + public void loadData(int p, HttpCallback callback) { + Log.e("tag111", p + "ssss"); + LiveHttpUtil.getMicList(mLiveUid, p, callback); + pg = p; + if (p == 1) { + no_more.setVisibility(View.VISIBLE); + mRefreshView.setVisibility(View.GONE); + } + } + + @Override + public List processData(String[] info) { + Log.e("tag222", Tips + "ssss" + MicStatusManager.getInstance().toString()); + JSONObject obj = JSON.parseObject(info[0]); + List data = new ArrayList<>(); + + if (Tips.equals("2")) { + for (String uid : mMicQueueList.keySet()) { + LinkMicUserBean userBean = mMicQueueList.get(uid); + MicUserBean bean = new MicUserBean(); + bean.setAvatar(userBean.getAvatar()); + bean.setId(uid); + bean.setUserNiceName(userBean.getUname()); + bean.setSex(userBean.getSex()); + bean.setDress_avatar(userBean.getDress_avatar()); + bean.setLevel(userBean.getLevel()); + bean.setType(AnchorUserMicInfoAdapter.TYPE_MIC_REQUEST); + data.add(bean); + } + } else if ("3".equals(Tips)) { + for (LiveUserGiftBean userBean : mAudienceList) { + MicUserBean bean = new MicUserBean(); + bean.setAvatar(userBean.getAvatar()); + bean.setId(userBean.getId()); + bean.setUserNiceName(userBean.getUserNiceName()); + bean.setSex(userBean.getSex()); + bean.setDress_avatar(userBean.getDress().getAvatar_frame()); + bean.setLevel(userBean.getLevel()); + bean.setType(AnchorUserMicInfoAdapter.TYPE_MIC_INVITE); + data.add(bean); + } + mRefreshView.setNotLoadMore(); + } else { + data = JSON.parseArray(obj.getString("userlist"), MicUserBean.class); + for (MicUserBean bean : data) { + bean.setType(AnchorUserMicInfoAdapter.TYPE_MIC_LIST); + } + if (data.size() != 0) { + data.remove(0); + } + } + if (data.size() > 0 && pg == 1) { + nums = 0; + view_no.setVisibility(View.GONE); + if (nums == 0) { + view_no.setVisibility(View.VISIBLE); + } + mRefreshView.mRecyclerView.getRecycledViewPool().setMaxRecycledViews(0, data.size()); + mRefreshView.setVisibility(View.VISIBLE); + no_more.setVisibility(View.GONE); + } + return data; + } + + @Override + public void onRefreshSuccess(List list, int listCount) { + + } + + @Override + public void onRefreshFailure() { + + } + + @Override + public void onLoadMoreSuccess(List loadItemList, int loadItemCount) { + Log.e("tag333", "是" + nums); + } + + @Override + public void onLoadMoreFailure() { + } + }); + initData(); + } + + @Override + public void onClick(View v) { + dismiss(); + } + + @Override + public void onDestroy() { + mLiveGuardInfo = null; + LiveHttpUtil.cancel("getUserLists"); + super.onDestroy(); + } + + void Up() { + if (Tips.equals("1")) { + listMicbtn.setTextColor(Color.parseColor("#fff6f7fb")); + requestMicBtn.setTextColor(Color.parseColor("#ff646464")); + inviteMicBtn.setTextColor(Color.parseColor("#ff646464")); + mNoMoreDesc.setText(R.string.no_more_mic); + type = "guanzhong"; + } else if (Tips.equals("2")) { + listMicbtn.setTextColor(Color.parseColor("#ff646464")); + requestMicBtn.setTextColor(Color.parseColor("#fff6f7fb")); + inviteMicBtn.setTextColor(Color.parseColor("#ff646464")); + mNoMoreDesc.setText("當前沒有人申請"); + type = "guard"; + } else if (Tips.equals("3")) { + listMicbtn.setTextColor(Color.parseColor("#ff646464")); + requestMicBtn.setTextColor(Color.parseColor("#ff646464")); + inviteMicBtn.setTextColor(Color.parseColor("#fff6f7fb")); + mNoMoreDesc.setText("當前沒有觀眾"); + type = "fans"; + } + } + + + private void initData() { + LiveHttpUtil.getMicList(mLiveUid, 0, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info)); + //非0认为未开通连麦权限 + if (code != 0) { + mOpenMicLayout.setVisibility(View.VISIBLE); + mRefreshView.setVisibility(View.GONE); + no_more.setVisibility(View.GONE); + mDisconnectMic.setVisibility(View.INVISIBLE); + } else { + MicStatusManager.getInstance().setAnchorOpenRoom(true); + mRefreshView.initData(); + } + } + }); + } + + + /** + * 用于更新连麦对话框数据 + */ + public interface OnMicListener { + void updateMicList(TreeMap list); + + void updateAudienceList(List list); + } + +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java index 18e98352f..e61cc6db6 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java @@ -1,7 +1,5 @@ package com.yunbao.live.dialog; -import static com.yunbao.live.views.LivePlayRyViewHolder.Micing; - import android.Manifest; import android.app.ActionBar; import android.app.Dialog; @@ -34,17 +32,17 @@ import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.adapter.UserMicInfoAdapter; import com.yunbao.live.bean.LiveGuardInfo; -import com.yunbao.live.bean.MicUserBean; +import com.yunbao.common.bean.MicUserBean; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.socket.SocketSendBean; import com.yunbao.live.utils.LiveImDeletUtil; +import com.yunbao.common.utils.MicStatusManager; import org.greenrobot.eventbus.EventBus; import java.util.ArrayList; import java.util.List; -import io.rong.imkit.IMCenter; import io.rong.imlib.IRongCallback; import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Conversation; @@ -149,20 +147,20 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View mRefreshView = mRootView.findViewById(R.id.refreshView); view_no = mRootView.findViewById(R.id.view_no); apply_btn = mRootView.findViewById(R.id.apply_btn); - if (Micing == 0) { + if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_DEFAULT) { apply_btn.setBackgroundResource(R.drawable.background_0fdab8); apply_btn.setText(R.string.apply_for_lianmai); - } else if (Micing == 1) { + } else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) { apply_btn.setBackgroundResource(R.drawable.background_00a0e9); apply_btn.setText(R.string.cancel_application); - } else if (Micing == 2) { + } else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) { apply_btn.setBackgroundResource(R.drawable.background_eb6877); apply_btn.setText(R.string.quit_mic); } apply_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (Micing == 0) { + if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_DEFAULT) { LiveAudienceActivity.mProcessResultUtil.requestPermissions(new String[]{ Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, @@ -183,7 +181,10 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View .param("_method_", Constants.LIAN_MAI) .param("action", 3) .param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()) + .param("sex", CommonAppConfig.getInstance().getUserBean().getSex()) + .param("level", CommonAppConfig.getInstance().getUserBean().getLevel()) .param("avatar", CommonAppConfig.getInstance().getUserBean().getAvatar()) + .param("dress_avatar", CommonAppConfig.getInstance().getUserBean().getDress().getAvatar_frame()) .param("uid", CommonAppConfig.getInstance().getUid()); msg1.create(); @@ -204,7 +205,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View ToastUtil.show(""); apply_btn.setBackgroundResource(R.drawable.background_00a0e9); apply_btn.setText(R.string.cancel_application); - Micing = 1; + MicStatusManager.getInstance().setMicData(MicStatusManager.MIC_TYPE_REQUEST,mLiveUid); dismiss(); io.rong.imlib.model.Message ids[] = {message}; RongIMClient.getInstance().deleteRemoteMessages(conversationType,message.getTargetId(),ids, null); @@ -224,7 +225,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View }); } }); - } else if (Micing == 1) { + } else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) { //取消申請 dismiss(); //用户申请联麦 @@ -250,7 +251,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View @Override public void onSuccess(io.rong.imlib.model.Message message) { Log.e("ry", "发送成功"); - Micing = 0; + MicStatusManager.getInstance().clear(); dismiss(); io.rong.imlib.model.Message ids[] = {message}; RongIMClient.getInstance().deleteRemoteMessages(conversationType,message.getTargetId(),ids, null); @@ -265,7 +266,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View } }); - } else if (Micing == 2) { + } else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) { //退出连麦 DialogUitl.showSimpleDialog(mContext, "連麥中,退出將斷開語音連麥!", new DialogUitl.SimpleCallback() { @Override @@ -316,11 +317,11 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View @Override public List processData(String[] info) { - Log.e("tag222", Tips + "ssss" + Micing); + Log.e("tag222", Tips + "ssss" + MicStatusManager.getInstance().toString()); JSONObject obj = JSON.parseObject(info[0]); List data = new ArrayList<>(); if (Tips.equals("2")) { - if (Micing == 1) { + if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) { MicUserBean micuser = new MicUserBean(); micuser.setAvatar(CommonAppConfig.getInstance().getUserBean().getAvatar()); micuser.setUserNiceName(CommonAppConfig.getInstance().getUserBean().getUserNiceName()); @@ -332,7 +333,9 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View } } else { data = JSON.parseArray(obj.getString("userlist"), MicUserBean.class); - data.remove(0); + if(data.size()!=0) { + data.remove(0); + } } if (data.size() > 0 && pg == 1) { nums = 0; diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveMoreDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveMoreDialogFragment.java index fe59af87a..3e54fd76f 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveMoreDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveMoreDialogFragment.java @@ -1,5 +1,7 @@ package com.yunbao.live.dialog; +import static com.yunbao.live.activity.LiveActivity.mLiveUid; + import android.os.Bundle; import android.view.Gravity; import android.view.View; @@ -13,11 +15,8 @@ import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveReportActivity; -import com.yunbao.live.views.LivePlayRyViewHolder; import com.yunbao.live.views.LiveRoomViewHolder; -import static com.yunbao.live.activity.LiveActivity.mLiveUid; - /** * 全屏 分享 弹出框 */ @@ -61,12 +60,13 @@ public class LiveMoreDialogFragment extends AbsDialogFragment { @Override public void onClick(View v) { dismiss(); - if (LivePlayRyViewHolder.landscape != 1) { - - } else if (((LiveAudienceActivity) mContext).pkInfo != null && ((LiveAudienceActivity) mContext).pkInfo.getIntValue("ifpk") == 0 && ((LiveAudienceActivity) mContext).anyway.equals("1") && LiveRoomViewHolder.d_pk_view.getVisibility() != View.VISIBLE) { + if (mContext instanceof LiveAudienceActivity && (((LiveAudienceActivity) mContext).pkInfo != null && + ((LiveAudienceActivity) mContext).pkInfo.getIntValue("ifpk") == 0 && + ((LiveAudienceActivity) mContext).anyway.equals("1") && + LiveRoomViewHolder.d_pk_view.getVisibility() != View.VISIBLE)) { ((LiveAudienceActivity) mContext).btnSmallScreen.setVisibility(View.VISIBLE); - LiveAudienceActivity.setCurrentItem(0); - LiveAudienceActivity.getmLivePlayViewHolder().fullScreen(); + ((LiveAudienceActivity) mContext).setCurrentItem(0); + ((LiveAudienceActivity) mContext).getmLivePlayViewHolder().fullScreen(); } else { Toast.makeText(mContext, "当前模式不能全屏", Toast.LENGTH_SHORT).show(); } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java index f979a9dd7..2407a5453 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java @@ -137,7 +137,6 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View return true; } - private LiveRoomCheckLivePresenter mCheckLivePresenter; private void gotoLive(String live_id) { DialogUitl.showSimpleDialog(mContext, "是否確認前往對方直播間?", new DialogUitl.SimpleCallback() { @@ -185,26 +184,17 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); -// if (mFromLiveRoom) { -// ((UserHomeActivity) mContext).onBackPressed(); - dismiss(); - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); -// } else { -// LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); -// } - } - }); - } - mCheckLivePresenter.checkLive(liveBean); + @Override + public void onCheckError(String contextError) { + + } + }); } } }); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java index 2a445f86f..0f0a2867d 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -37,8 +37,10 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.CommonCallback; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.NobleUtil; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SVGAViewUtils; @@ -53,6 +55,7 @@ import com.yunbao.live.bean.GuardUserBean; import com.yunbao.live.bean.ImpressBean; import com.yunbao.common.bean.LiveBean; import com.yunbao.live.custom.MyTextView; +import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; @@ -153,11 +156,10 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On return true; } - private LiveRoomCheckLivePresenter mCheckLivePresenter; - @Override protected void setWindowAttributes(Window window) { + window.setWindowAnimations(R.style.bottomToTopAnim); WindowManager.LayoutParams params = window.getAttributes(); window.setWindowAnimations(R.style.bottomToTopAnim); params.width = WindowManager.LayoutParams.MATCH_PARENT; @@ -252,6 +254,25 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On mSetting.setOnClickListener(this); mHonorLayout.setOnClickListener(v -> forwardHomePage()); + //用户名片连点三次粉丝弹出视频debug窗 + mFansVal.setOnClickListener(new View.OnClickListener() { + long time=0; + int index=0; + @Override + public void onClick(View v) { + if(time==0){ + time=System.currentTimeMillis(); + } + index++; + if(System.currentTimeMillis()-time<1000&&index==3){ + EventBus.getDefault().post("Debug"); + }else if(System.currentTimeMillis()-time>1000){ + index=0; + time=0; + } + } + }); + } private void initListener() { @@ -304,7 +325,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On private void showData(String data) { Log.i(TAG, "showData: " + data); JSONObject obj = JSON.parseObject(data); - isAnchor = obj.getInteger("is_anchor")==1; + isAnchor = obj.getInteger("is_anchor") == 1; mUserBean = JSON.toJavaObject(obj, UserBean.class); mToName = obj.getString("user_nicename"); @@ -314,7 +335,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } else { btn_live.setVisibility(View.GONE); } - switch (mType){ + switch (mType) { case TYPE_ANC_AUD: case SETTING_ACTION_ADM: case SETTING_ACTION_SUP: @@ -322,7 +343,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On case SETTING_ACTION_ANC_ADM: mSetting.setVisibility(View.VISIBLE); } - switch (mAction){ + switch (mAction) { case TYPE_ANC_AUD: case SETTING_ACTION_ADM: case SETTING_ACTION_SUP: @@ -345,8 +366,10 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } mName.setText(obj.getString("user_nicename")); if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) { - if(!isAnchor) { + if (!isAnchor) { good_nub_ico.setImageResource(R.mipmap.good_nub); + } else { + good_nub_ico.setImageResource(R.mipmap.usercard_good_nub); } good_nub_ico.setVisibility(View.VISIBLE); mID.setText(mUserBean.getGoodnum()); @@ -365,10 +388,10 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On userLv.setText("Lv." + mUserBean.getLevel()); mLvDesc.setText(R.string.live_user_card_level); } - if(isAnchor){ - ImgLoader.display2(mContext,obj.getJSONObject("level_thumb").getString("thumb"),mLiveIcon); - mLvVal.setText(obj.getInteger("level_anchor")+""); - }else { + if (isAnchor) { + ImgLoader.display2(mContext, obj.getJSONObject("level_thumb").getString("thumb"), mLiveIcon); + mLvVal.setText(obj.getInteger("level_anchor") + ""); + } else { new LiveTextRender().getLevelImage(mContext, levelBean.getLevel(), new ImgLoader.DrawableCallback() { @Override public void onLoadSuccess(Drawable drawable) { @@ -569,6 +592,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On DialogUitl.showSimpleDialog(mContext, "是否確認前往對方直播間?", new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { + LiveUserDialogFragment.this.dismiss(); RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveUid, new IRongCoreCallback.OperationCallback() { @Override public void onSuccess() { @@ -611,21 +635,24 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); - dismiss(); - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + if (liveBean == null) { + return; } - }); - } - mCheckLivePresenter.checkLive(liveBean); + if (MicStatusManager.getInstance().isMic(liveUid)) { + MicStatusManager.getInstance().showDownMicDialog(mContext); + return; + } + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); } } }); @@ -648,13 +675,16 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } else if (i == R.id.avatar) { forwardHomePage(); } else if (i == R.id.btn_guard) { - ((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity,mToUid); + ((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity, mToUid); } else if (i == R.id.btn_live) { gotoLive(mToUid); } else if (i == R.id.noble_icon_layout) { if (isAnchor) { dismiss(); ((LiveActivity) mContext).openFansWindow(mToUid); + }else{ + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.NOBLE)); } } else if (i == R.id.btn_setting) { setting(); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java index 18dcfbab7..93ca57183 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java @@ -38,7 +38,7 @@ import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.adapter.UserMoreInfoAdapter; import com.yunbao.live.bean.LiveGuardInfo; -import com.yunbao.live.bean.LiveUserGiftBean; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.live.http.LiveHttpUtil; import java.util.ArrayList; @@ -59,7 +59,6 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie private String mLiveUid; private String stream; private LiveGuardInfo mLiveGuardInfo; - public static LiveActivity activity = null; public eightbitlab.com.blurview.BlurView blurView; public TextView audience_btn, guard_btn, fans_btn, tags, btn, gz_view, dayRank, weekRank, title; @@ -90,6 +89,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie @Override protected void setWindowAttributes(Window window) { + window.setWindowAnimations(R.style.bottomToTopAnim); WindowManager.LayoutParams params = window.getAttributes(); params.width = ActionBar.LayoutParams.MATCH_PARENT; params.height = DpUtil.dp2px(460); @@ -167,10 +167,10 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie @Override public void onClick(View view) { Tips = "2"; + no_more.setImageResource(R.mipmap.grayicon); Up(); type = "guard"; mRefreshView.initData(); - no_more.setImageResource(R.mipmap.grayicon); } }); fans_btn = mRootView.findViewById(R.id.fans_btn); @@ -178,25 +178,25 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie @Override public void onClick(View view) { Tips = "3"; + no_more.setImageResource(R.mipmap.bixin); Up(); type = "fans"; mRefreshView.initData(); - no_more.setImageResource(R.mipmap.bixin); } }); dayRank.setOnClickListener(View -> { Tips = "4"; + no_more.setImageResource(R.drawable.img_rank_empty); Up(); type = "dayRank"; mRefreshView.initData(); - no_more.setImageResource(R.drawable.img_rank_empty); }); weekRank.setOnClickListener(View -> { Tips = "5"; + no_more.setImageResource(R.drawable.img_rank_empty); Up(); type = "weekRank"; mRefreshView.initData(); - no_more.setImageResource(R.drawable.img_rank_empty); }); mRefreshView = mRootView.findViewById(R.id.refreshView); @@ -387,7 +387,9 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie setTextColor(guard_btn, audience_btn, fans_btn, dayRank, weekRank); gz_view.setVisibility(View.GONE); userMoreInfoAdapter.type = "2"; - no_more.setImageResource(R.mipmap.grayicon); + no_more.setImageResource(R.mipmap.ic_guard_not); + noMoreText.setText("主播正在等待您成為TA的守護,\n為TA保駕護航!"); + noMoreText.setVisibility(View.VISIBLE); type = "guard"; } else if (Tips.equals("3")) { tags.setText("快加入您喜歡的主播粉絲團吧"); diff --git a/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java b/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java index 68eb14007..cfe2cd33f 100644 --- a/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java @@ -11,15 +11,9 @@ import androidx.annotation.Nullable; 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.dialog.AbsDialogFragment; -import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.live.R; @@ -110,17 +104,6 @@ public class NewUserDialog extends AbsDialogFragment { btn_confirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - AdjustEvent adjustEvent1 = new AdjustEvent("a50ofs"); - Adjust.trackEvent(adjustEvent1); - CommonHttpUtil.setAdvertisingChannels("a50ofs", new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - FirebaseAnalytics.getInstance(mContext).logEvent("FS_newbie_reward", null); - AppEventsLogger.newLogger(mContext).logEvent("FB_newbie_reward"); - } - } - }); EventBus.getDefault().post("showBanner"); EventBus.getDefault().post("svga_new_user_gif"); IMLoginManager.get(mContext).setNewUserGif(true); diff --git a/live/src/main/java/com/yunbao/live/dialog/PDLIiveChatConversationFragment.java b/live/src/main/java/com/yunbao/live/dialog/PDLIiveChatConversationFragment.java index 2a56793f9..017cf7742 100644 --- a/live/src/main/java/com/yunbao/live/dialog/PDLIiveChatConversationFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/PDLIiveChatConversationFragment.java @@ -18,18 +18,12 @@ import androidx.core.content.ContextCompat; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; -import com.adjust.sdk.Adjust; -import com.adjust.sdk.AdjustEvent; import com.blankj.utilcode.util.GsonUtils; -import com.facebook.appevents.AppEventsLogger; -import com.google.firebase.analytics.FirebaseAnalytics; import com.yunbao.common.activity.SelectImageActivity; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.ImageEntity; import com.yunbao.common.bean.NoviceInstructorModel; import com.yunbao.common.dialog.AbsDialogFragment; -import com.yunbao.common.http.CommonHttpUtil; -import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.live.R; @@ -58,6 +52,7 @@ public class PDLIiveChatConversationFragment extends AbsDialogFragment implement private final int SELECT_IMAGE_REQUEST = 0x0001; private ArrayList mSelectImages = new ArrayList<>(); private boolean isAdmin = false; + @Override protected int getLayoutId() { return R.layout.fragment_chat_conversation; @@ -139,18 +134,6 @@ public class PDLIiveChatConversationFragment extends AbsDialogFragment implement if (!TextUtils.isEmpty(userBean.getIs_admin()) && TextUtils.equals(userBean.getIs_admin(), "1")) { isAdmin = true; imgMore.setVisibility(View.GONE); - AdjustEvent adjustEvent1 = new AdjustEvent("exlgn3"); - Adjust.trackEvent(adjustEvent1); - CommonHttpUtil.setAdvertisingChannels("exlgn3", new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - FirebaseAnalytics.getInstance(mContext).logEvent("FS_director_read", null); - AppEventsLogger.newLogger(mContext).logEvent("FB_director_read"); - } - } - }); - } else {//非指导员 isAdmin = false; imgMore.setVisibility(View.VISIBLE); @@ -202,6 +185,7 @@ public class PDLIiveChatConversationFragment extends AbsDialogFragment implement startActivityForResult(intent, SELECT_IMAGE_REQUEST); } } + /** * 获取草稿箱信息系 */ diff --git a/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java b/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java index 89e28ad83..592ab829a 100644 --- a/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java +++ b/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java @@ -20,7 +20,7 @@ import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; -import com.yunbao.live.views.LivePlayRyViewHolder; +import com.yunbao.common.utils.MicStatusManager; import org.greenrobot.eventbus.EventBus; @@ -74,42 +74,7 @@ public class SidebarLiveAudience extends AbsDialogFragment { } - /** - * 前往直播间 - */ - private void gotoLive(final String liveId) { - LiveHttpUtil.getLiveInfo(liveId, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { - LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(getActivity(), (liveBean1, liveType, liveTypeVal, liveSdk) -> { - if (liveBean1 == null) { - return; - } - if (LivePlayRyViewHolder.Micing == 1) { - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) - .setMicIng(1) - .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal)); - } else if (LivePlayRyViewHolder.Micing == 2) { - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) - .setMicIng(2) - .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal)); - } else { - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); - } - }); - mCheckLivePresenter.checkLive(liveBean); - - } else { - RouteUtil.forwardUserHome(getActivity(), liveId, 0); - } - } - }); - } @Override public void onDismiss(DialogInterface dialog) { diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 183e6bf26..9f4fdec6a 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -189,6 +189,13 @@ public class LiveAudienceEvent extends BaseModel { PK_TWO_START(36, "双人PK开始"), PK_TWO_UPDATE_HEAD_DATA(37, "更新PK头像信息"), PK_TWO_END(38, "双人PK开始"), + LINK_MIC(39, "连麦"), + LINK_MIC_CANCEL(40, "取消连麦"), + LINK_MIC_UPDATE_MIC_LIST(41, "更新连麦列表"), + LINK_MIC_UPDATE_AUDIENCE_LIST(42, "更新观众/可邀请列表"), + LINK_MIC_CLOSE(43, "主播关闭连麦房"), + SOCKET_LIVE_DRPK_SET_PK_VIEW(44, "setPkview"), + SOCKET_LIVE_DRPK_SET_PK_END_VIEW(45, "setPkEndview"), ; private int type; diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java index 8ce58270f..9033417f5 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -36,6 +36,7 @@ import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.HtmlConfig; import com.yunbao.common.activity.WebViewActivity; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; @@ -46,11 +47,10 @@ import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.GiftCacheUtil; import com.yunbao.common.utils.HtmlTagHandler; 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 com.yunbao.live.R; -import com.yunbao.live.activity.LiveAudienceActivity; -import com.yunbao.common.bean.LiveBean; import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LiveReceiveGiftBean; @@ -195,10 +195,12 @@ public class LiveGiftAnimPresenter { private WindowManager mWindowManager; private static FrameImageView mFrameImageView; private static ValueAnimator mAnimator; + private AllMsgTextRender textRender; public LiveGiftAnimPresenter(Context context, View v, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { mContext = context; this.mWindowManager = windowManager; + textRender = new AllMsgTextRender(this); mParent2 = (ViewGroup) v.findViewById(R.id.gift_group_1); mTopLuckContainer = v.findViewById(R.id.luck_container); mGifImageView = gifImageView; @@ -231,13 +233,6 @@ public class LiveGiftAnimPresenter { mFrameImageView = (FrameImageView) v.findViewById(R.id.all_frame_img); -// mGifGiftTipAllServer.setSelected(true); -// mGifGiftTipBuyGuard.setSelected(true); -// mGifGiftTipBuyZuoji.setSelected(true); -// mGifGiftTipBuyLiangName.setSelected(true); -// mGifGiftTipBuyVip.setSelected(true); - - mIvLookClick(); mIvLookBuyGuardClick(); mIvLookBuyZuojiClick(); @@ -285,11 +280,6 @@ public class LiveGiftAnimPresenter { mAnimator.setDuration(800); mAnimator.setRepeatCount(3); mAnimator.setInterpolator(new LinearInterpolator()); - - -// mGifGiftTipAllServer.init(windowManager); -// mGifGiftTipBuyGuard.init(windowManager); -// mGifGiftTipBuyVip.init(windowManager); } @@ -361,10 +351,6 @@ public class LiveGiftAnimPresenter { mGifGiftTipGroupBuyVip.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { -// UserBean u = CommonAppConfig.getInstance().getUserBean(); -// String url = CommonAppConfig.HOST+"/h5/Noble/index.html?nickname="+u.getUserNiceName()+"&usernobId="+u.getNoble_id()+"&token="+ CommonAppConfig.getInstance().getToken()+"&uid="+CommonAppConfig.getInstance().getUid(); -// startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url",url)); - // WebViewActivity.forward(mContext, HtmlConfig.SHOP); changeLiveRoom(); } }); @@ -389,20 +375,17 @@ public class LiveGiftAnimPresenter { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - ((LiveAudienceActivity) mContext).onBackPressed(); - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - } - }); - } - mCheckLivePresenter.checkLive(liveBean); + @Override + public void onCheckError(String contextError) { + + } + }); } } }); @@ -558,7 +541,6 @@ public class LiveGiftAnimPresenter { }); mDp10 = DpUtil.dp2px(10); mGifGiftTipHideAnimatorBuyVip = ObjectAnimator.ofFloat(mGifGiftTipGroupBuyVip, "translationX", 0);//平移 -// mGifGiftTipHideAnimatorBuyVip = ObjectAnimator.ofFloat(mGifGiftTipGroupBuyVip, "alpha", 1f, 0f);//渐变 mGifGiftTipHideAnimatorBuyVip.setDuration(3000); mGifGiftTipHideAnimatorBuyVip.setInterpolator(new AccelerateDecelerateInterpolator()); mGifGiftTipHideAnimatorBuyVip.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @@ -616,9 +598,6 @@ public class LiveGiftAnimPresenter { diffTime = 0; } mSVGAImageViewFront.clear(); -// if (mHandler != null) { -// mHandler.sendEmptyMessageDelayed(WHAT_GIF_All_SERVER, diffTime); -// } } @Override @@ -673,7 +652,6 @@ public class LiveGiftAnimPresenter { if (!mIsSameRoom) { mGifGiftTipHideAnimatorAllServer.setFloatValues(0, -mDp10 - mGifGiftTipGroupAllServer.getWidth()); mGifGiftTipHideAnimatorAllServer.start(); -// mHandler.sendEmptyMessageDelayed(WHAT_GIF_All_SERVER, 800); } } else if (msg.what == WHAT_ALL_SERVER_1) { mGifGiftTipHideAnimatorAllServer.setFloatValues(0, -mDp10 - mGifGiftTipGroupAllServer.getWidth()); @@ -804,7 +782,6 @@ public class LiveGiftAnimPresenter { //同一直播间,其他玩家也能看到全服通知 String userId = CommonAppConfig.getInstance().getUid(); String uid = bean.getUid(); -// if (userId.equals(uid)) if (mIsAllServerNotify) { if (!isAncher) { if (!bean.getDrpk_status().equals("1")) { @@ -860,7 +837,7 @@ public class LiveGiftAnimPresenter { mGifGiftTipGroupAllServer.setVisibility(View.VISIBLE); mGifGiftTipShowAnimatorAllServer.start(); - AllMsgTextRender.render(mContext, mGifGiftTipAllServer, mTempGifGiftBean.getGiftIcon(), mTempGifGiftBean.getUserNiceName(), mAncherName, mTempGifGiftBean.getGiftName(), 1, mWindowManager, ""); + textRender.render(mContext, mGifGiftTipAllServer, mTempGifGiftBean.getGiftIcon(), mTempGifGiftBean.getUserNiceName(), mAncherName, mTempGifGiftBean.getGiftName(), 1, mWindowManager, ""); } } @@ -916,7 +893,7 @@ public class LiveGiftAnimPresenter { mGifGiftTipGroupBuyGuard.setVisibility(View.VISIBLE); mGifGiftTipShowAnimatorBuyGuard.start(); - AllMsgTextRender.render(mContext, mGifGiftTipBuyGuard, "", mTempGifGiftBean.getUserNiceName(), mAncherName, "", 2, mWindowManager, mTempGifGiftBean.getGuardType()); + textRender.render(mContext, mGifGiftTipBuyGuard, "", mTempGifGiftBean.getUserNiceName(), mAncherName, "", 2, mWindowManager, mTempGifGiftBean.getGuardType()); } } } @@ -1045,7 +1022,7 @@ public class LiveGiftAnimPresenter { mGifGiftTipGroupBuyVip.setVisibility(View.VISIBLE); mGifGiftTipShowAnimatorBuyVip.start(); - AllMsgTextRender.render(mContext, mGifGiftTipBuyVip, "", mTempGifGiftBean.getUserNiceName(), mAncherName, bean.getNobilityname(), 3, mWindowManager, bean.getOpentype()); + textRender.render(mContext, mGifGiftTipBuyVip, "", mTempGifGiftBean.getUserNiceName(), mAncherName, bean.getNobilityname(), 3, mWindowManager, bean.getOpentype()); } } } @@ -1076,7 +1053,7 @@ public class LiveGiftAnimPresenter { mGifGiftTipGroupAllServer.setVisibility(View.VISIBLE); mGifGiftTipShowAnimatorAllServer.start(); - AllMsgTextRender.render(mContext, mGifGiftTipAllServer, "", bean.getVipName(), "", "", 4, mWindowManager, ""); + textRender.render(mContext, mGifGiftTipAllServer, "", bean.getVipName(), "", "", 4, mWindowManager, ""); } } @@ -1516,9 +1493,11 @@ public class LiveGiftAnimPresenter { public void release() { clearAnim(); if (mLiveGiftViewHolders[0] != null) { + mLiveGiftViewHolders[0].hideNormal(); mLiveGiftViewHolders[0].release(); } if (mLiveGiftViewHolders[1] != null) { + mLiveGiftViewHolders[1].hideNormal(); mLiveGiftViewHolders[1].release(); } if (mSVGAImageView != null) { @@ -1651,7 +1630,7 @@ public class LiveGiftAnimPresenter { public static CountDownTimer countDownTimer, countDownTimerStart; //intoIndex 横幅类型 - public static void setCountDownTimerEnd(int intoIndex) { + public void setCountDownTimerEnd(int intoIndex) { countDownTimer = new CountDownTimer(500, 250) { @Override public void onTick(long millisUntilFinished) { @@ -1709,7 +1688,7 @@ public class LiveGiftAnimPresenter { countDownTimer.start(); } - public static void setCountDownTimerStart(int intoIndex) { + public void setCountDownTimerStart(int intoIndex) { countDownTimerStart = new CountDownTimer(2000, 1000) { @Override public void onTick(long millisUntilFinished) { @@ -1743,7 +1722,7 @@ public class LiveGiftAnimPresenter { countDownTimerStart.start(); } - public static void setCountDownTimerStartAll() { + public void setCountDownTimerStartAll() { mFrameImageView.setVisibility(View.VISIBLE); mAnimator.start(); mFrameImageView.setImageList(LiveIconUtil.getSAllMSG());//PK开始动画 diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPkPresenter.java index efec10260..440fcdce3 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPkPresenter.java @@ -1002,8 +1002,8 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener { mLiveLinkMicPkViewHolder = new LiveLinkMicPkViewHolder(mContext, mPkContainer); mLiveLinkMicPkViewHolder.addToParent(); mLiveLinkMicPkViewHolder.setIsAnchor(mIsAnchor); - if (LiveAudienceActivity.getmLivePlayViewHolder() != null) { - LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); + if (mContext instanceof LiveAudienceActivity) { + ((LiveAudienceActivity) mContext).getmLivePlayViewHolder().setPkview(); } } @@ -1081,8 +1081,8 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener { public void run() { try { Thread.sleep(4000); - if ( LiveAudienceActivity.getmLivePlayViewHolder() != null) { - LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview(); + if (mContext instanceof LiveAudienceActivity) { + ((LiveAudienceActivity) mContext).getmLivePlayViewHolder().setPkEndview(); } } catch (InterruptedException e) { e.printStackTrace(); diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java index 8855e7d8a..adab13ca6 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java @@ -1,7 +1,6 @@ package com.yunbao.live.presenter; import android.Manifest; -import android.annotation.SuppressLint; import android.app.Activity; import android.app.Dialog; import android.content.Context; @@ -20,19 +19,15 @@ import android.widget.PopupWindow; import android.widget.TextView; import android.widget.Toast; -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.Constants; import com.yunbao.common.bean.BannerBean; import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.UserBean; 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.utils.ClickUtil; @@ -117,82 +112,10 @@ public class LiveLinkMicPresenter implements View.OnClickListener { @Subscribe(threadMode = ThreadMode.MAIN) public void onUpdata(String str) { if ("stop_svga_new_user_double1".equals(str)) { - AdjustEvent adjustEvent1 = new AdjustEvent("80lzdi"); - Adjust.trackEvent(adjustEvent1); - CommonHttpUtil.setAdvertisingChannels("80lzdi", new HttpCallback() { - @SuppressLint("MissingPermission") - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - FirebaseAnalytics.getInstance(mContext).logEvent("FS_mission_3", null); - AppEventsLogger.newLogger(mContext).logEvent("FB_mission_3"); - } - } - }); - AdjustEvent adjustEvent2 = new AdjustEvent("6va52i"); - Adjust.trackEvent(adjustEvent2); - CommonHttpUtil.setAdvertisingChannels("6va52i", new HttpCallback() { - @SuppressLint("MissingPermission") - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - FirebaseAnalytics.getInstance(mContext).logEvent("FS_mission_either", null); - AppEventsLogger.newLogger(mContext).logEvent("FB_mission_either"); - } - } - }); publicToast(mContext); } else if ("stop_svga_new_user_follow1".equals(str)) { - AdjustEvent adjustEvent1 = new AdjustEvent("f084wh"); - Adjust.trackEvent(adjustEvent1); - CommonHttpUtil.setAdvertisingChannels("f084wh", new HttpCallback() { - @SuppressLint("MissingPermission") - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - FirebaseAnalytics.getInstance(mContext).logEvent("FS_mission_2", null); - AppEventsLogger.newLogger(mContext).logEvent("FB_mission_2"); - } - } - }); - AdjustEvent adjustEvent2 = new AdjustEvent("6va52i"); - Adjust.trackEvent(adjustEvent2); - CommonHttpUtil.setAdvertisingChannels("6va52i", new HttpCallback() { - @SuppressLint("MissingPermission") - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - FirebaseAnalytics.getInstance(mContext).logEvent("FS_mission_either", null); - AppEventsLogger.newLogger(mContext).logEvent("FB_mission_either"); - } - } - }); publicToast(mContext); } else if ("stop_new_user_gif1".equals(str)) { - AdjustEvent adjustEvent1 = new AdjustEvent("aqqz70"); - Adjust.trackEvent(adjustEvent1); - CommonHttpUtil.setAdvertisingChannels("aqqz70", new HttpCallback() { - @SuppressLint("MissingPermission") - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - FirebaseAnalytics.getInstance(mContext).logEvent("FS_mission_1", null); - AppEventsLogger.newLogger(mContext).logEvent("FB_mission_1"); - } - } - }); - AdjustEvent adjustEvent2 = new AdjustEvent("6va52i"); - Adjust.trackEvent(adjustEvent2); - CommonHttpUtil.setAdvertisingChannels("6va52i", new HttpCallback() { - @SuppressLint("MissingPermission") - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - FirebaseAnalytics.getInstance(mContext).logEvent("FS_mission_either", null); - AppEventsLogger.newLogger(mContext).logEvent("FB_mission_either"); - } - } - }); publicToast(mContext); } } @@ -857,6 +780,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener { } public void setLiveSdk(int mLiveSDK) { - this.mLiveSdk=mLiveSDK; + this.mLiveSdk = mLiveSDK; } } diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java index 1bc0616cf..eb3670fe7 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java @@ -9,14 +9,17 @@ 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.CheckLiveModel; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.base.CheckLiveCallBack; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.MD5Util; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; -import com.yunbao.common.bean.LiveBean; import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; @@ -37,6 +40,83 @@ public class LiveRoomCheckLivePresenter { //搜索页面不提示密码 public static boolean isRoom = false; + /** + * 新的检查直播间状态方法 + * + * @param context 上下文 + * @param liveUid 直播间ID + * @param stream + */ + public LiveRoomCheckLivePresenter(Context context, String liveUid, String stream, NewActionListener actionListener) { + LiveNetManager.get(context) + .checkLive(liveUid, stream, new CheckLiveCallBack() { + @Override + public void forwardNormalRoom(CheckLiveModel model) { + if (actionListener != null) { + actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk()); + } + } + + @Override + public void forwardPwdRoom(CheckLiveModel model) { + DialogUitl.showSimpleInputDialog(context, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + if (mContext instanceof Activity) { + ((Activity) mContext).finish(); + } + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + if (TextUtils.isEmpty(content)) { + ToastUtil.show(WordUtil.getString(R.string.live_input_password)); + return; + } + String password = MD5Util.getMD5(content); + if (model.getTypeMsg().equalsIgnoreCase(password)) { + dialog.dismiss(); + if (actionListener != null) { + actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk()); + } + } else { + ToastUtil.show(WordUtil.getString(R.string.live_password_error)); + } + } + }); + } + + @Override + public void forwardPayRoom(CheckLiveModel model) { + DialogUitl.showSimpleDialog(context, mLiveTypeMsg, new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + LiveHttpUtil.roomCharge(liveUid, stream, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + if (actionListener != null) { + actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk()); + } + } else { + ToastUtil.show(msg); + } + } + }); + } + }); + } + + @Override + public void onError(String error) { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LIVE_ROOM_EXCEPTION)); + ToastUtil.show(error); + } + }); + } + + public LiveRoomCheckLivePresenter(Context context, ActionListener actionListener) { mContext = context; mActionListener = actionListener; @@ -110,7 +190,7 @@ public class LiveRoomCheckLivePresenter { DialogUitl.showSimpleInputDialog(mContext, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback2() { @Override public void onCancelClick() { - if(mContext instanceof Activity) { + if (mContext instanceof Activity) { ((Activity) mContext).finish(); } } @@ -194,4 +274,10 @@ public class LiveRoomCheckLivePresenter { public interface ActionListener { void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk); } + + public interface NewActionListener { + void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk); + + void onCheckError(String contextError); + } } diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java index 5bef0d5ee..753250175 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -1197,14 +1197,17 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onSuccess(int code, String msg, String[] info) { Log.i(TAG, "code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info)); + JSONObject datas = JSONObject.parseObject(info[0]); boolean agree=true; - if (code != 0) { + if (datas.getIntValue("pk_num_day") <= 0) { ToastUtil.show("多人PK次数已用完"); agree=false; } + boolean finalAgree = agree; rtcRoom.getLocalUser().responseJoinOtherRoom(mApplyUid, mApplyUid, agree, true, SOCKET_LIVE_DRPK, new IRCRTCResultCallback() { @Override public void onSuccess() { + if(finalAgree == true){ HttpClient.getInstance().get("live.joinDRPKroom", "live.joinDRPKroom") .params("uid", CommonAppConfig.getInstance().getUid()) .params("roomid", u.getId()) @@ -1286,7 +1289,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { } } }); - + } } @Override @@ -1835,8 +1838,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { mLiveLinkMicPkViewHolder = new LiveLinkMicPkViewHolder(mContext, mPkContainer); mLiveLinkMicPkViewHolder.addToParent(); mLiveLinkMicPkViewHolder.setIsAnchor(mIsAnchor); - if (LiveAudienceActivity.getmLivePlayViewHolder() != null) { - LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); + if (mContext instanceof LiveAudienceActivity) { + ((LiveAudienceActivity) mContext).getmLivePlayViewHolder().setPkview(); } } @@ -1954,8 +1957,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { public void run() { // try { // Thread.sleep(4000); - if (mContext instanceof LiveAudienceActivity && LiveAudienceActivity.getmLivePlayViewHolder() != null) { - LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview(); + if (mContext instanceof LiveAudienceActivity) { + ((LiveAudienceActivity) mContext).getmLivePlayViewHolder().setPkEndview(); } // } catch (InterruptedException e) { // e.printStackTrace(); diff --git a/live/src/main/java/com/yunbao/live/socket/SocketClient.java b/live/src/main/java/com/yunbao/live/socket/SocketClient.java index 1752860c3..1e313692c 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketClient.java @@ -19,6 +19,7 @@ import com.yunbao.common.bean.FansMedalBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.L; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; @@ -32,7 +33,8 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; -import com.yunbao.live.bean.LiveUserGiftBean; +import com.yunbao.common.bean.LiveUserGiftBean; +import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.presenter.LiveLinkMicPkPresenter; import com.yunbao.live.views.LivePlayKsyViewHolder; import com.yunbao.live.views.LivePushTxViewHolder; @@ -171,7 +173,10 @@ public class SocketClient { LiveRoomViewHolder.d_pk_view.setVisibility(View.GONE); //創建了多人房間 } else if (action3 == 9) { - LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); + // LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW) + ); } break; case Constants.SOCKET_ALL_SERVER_NOTIFY://全服通知 diff --git a/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java b/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java index 664feb37f..3d5040038 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java @@ -10,7 +10,7 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; -import com.yunbao.live.bean.LiveUserGiftBean; +import com.yunbao.common.bean.LiveUserGiftBean; import java.util.List; diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java index 4e3deaeff..17a1df676 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java @@ -1,18 +1,13 @@ package com.yunbao.live.socket; -import static com.yunbao.common.CommonAppContext.logger; -import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; import android.util.Log; -import com.adjust.sdk.Adjust; -import com.adjust.sdk.AdjustEvent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.UserBean; -import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.ToastUtil; @@ -130,24 +125,6 @@ public class SocketRyChatUtil { @Override public void onSuccess(Message message) { - Log.i("tx", "ssss" + "发送成功" + mLiveUid); - //首发言成功 - AdjustEvent adjustEvent1 = new AdjustEvent("j7isvr"); - Adjust.trackEvent(adjustEvent1); - CommonHttpUtil.setAdvertisingChannels("j7isvr", new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - mFirebaseAnalytics.logEvent("FS_liveinteraction", null); - logger.logEvent("FB_liveinteraction "); - } - } - }); - - mFirebaseAnalytics.logEvent("FS_type_interaction", null); - logger.logEvent("FB_type_interaction"); - AdjustEvent adjustEvent = new AdjustEvent("cs6j0s"); - Adjust.trackEvent(adjustEvent); if (SocketRyClient.mSocketHandler != null) { SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); } diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index 835d68fdd..f1b4f4e0c 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -16,13 +16,17 @@ import android.view.View; import android.widget.LinearLayout; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; +import com.google.gson.reflect.TypeToken; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.FansMedalBean; +import com.yunbao.common.bean.LinkMicUserBean; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.SocketModel; @@ -45,7 +49,6 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; -import com.yunbao.live.bean.LiveUserGiftBean; import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.views.LiveEndViewHolder; import com.yunbao.live.views.LivePlayKsyViewHolder; @@ -127,17 +130,22 @@ public class SocketRyClient { if (mListener == null) { return; } - switch (msg.what) { - case Constants.SOCKET_WHAT_CONN: - mListener.onConnect((Boolean) msg.obj); - break; - case Constants.SOCKET_WHAT_BROADCAST: - processBroadcast((String) msg.obj); - break; - case Constants.SOCKET_WHAT_DISCONN: - mListener.onDisConnect(); - break; + try { + switch (msg.what) { + case Constants.SOCKET_WHAT_CONN: + mListener.onConnect((Boolean) msg.obj); + break; + case Constants.SOCKET_WHAT_BROADCAST: + processBroadcast((String) msg.obj); + break; + case Constants.SOCKET_WHAT_DISCONN: + mListener.onDisConnect(); + break; + } + } catch (Exception e) { + e.printStackTrace(); } + } @@ -169,18 +177,36 @@ public class SocketRyClient { EventBus.getDefault().post("UsertoRY"); } else if (actions == 5) { JSONObject mic_data = map.getJSONObject("ct"); - LiveRoomViewHolder.updataMicList(mic_data.getJSONArray("userlist")); + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_UPDATE_MIC_LIST) + .setObject(JSONArray.parseArray(mic_data.getJSONArray("userlist").toString(), LinkMicUserBean.class)) + ); } else if (actions == 6) { ToastUtil.show("主播已關閉當前語音連麥功能"); - LiveRoomViewHolder.updataCleanMic(); EventBus.getDefault().post("endMic"); + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CLOSE) + .setObject(map.toJavaObject(LinkMicUserBean.class))); } else if (actions == 8) { ToastUtil.show("您已被移出多人語音連麥"); EventBus.getDefault().post("endMic"); + } else if (actions == 3) { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC) + .setObject(map.toJavaObject(LinkMicUserBean.class)) + ); + } else if (actions == 7) {//取消连麦 + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_CANCEL) + ); } break; case Constants.UP_USER_LIST: mListener.onUpUserList(map.getJSONObject("ct")); + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LINK_MIC_UPDATE_AUDIENCE_LIST) + .setObject(JSON.parseArray(map.getJSONObject("ct").getString("userlist"), LiveUserGiftBean.class)) + ); break; case Constants.CARD: // LiveLinkMicPresenter.setHD(map.getString("ct")); @@ -190,12 +216,16 @@ public class SocketRyClient { break; } UserBean us = CommonAppConfig.getInstance().getUserBean(); - if (map.getString("uid") != null && map.getString("uid").equals(us.getId())) { + if (map.getString("uid") != null && us != null && map.getString("uid").equals(us.getId())) { int num = LiveAudienceActivity.fansNum + 1; LiveRoomViewHolder.setFansNum(num); } + if (map.getString("ct").contains("堅決維護青少年群體精神文明健康") || map.getString("ct").contains("click to register if you like. pdlive conducts")) { + systemChatMessage(map.getString("ct")); + } else { + systemChatMessage2(map.getString("ct")); + } - systemChatMessage(map.getString("ct")); int action21 = map.getIntValue("action"); //主播離開 if (action21 == 13 && map.getString("ct").contains("離開")) { @@ -258,7 +288,10 @@ public class SocketRyClient { } LiveRoomViewHolder.UpPkBar(map.getJSONArray("userlist"), mLiveUid, map.getIntValue("drpk_time")); if (livePushRyViewHolder == null) { - LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); + // LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW) + ); } } else if (action3 == 5) { @@ -272,17 +305,27 @@ public class SocketRyClient { leaveDRRoom(); isDRPK = 0; } else { - LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview(); + // LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview(); + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_END_VIEW) + ); + } //創建了多人房間 } else if (action3 == 3) { - if (LiveAudienceActivity.getmLivePlayViewHolder() != null) { + /* if (LiveAudienceActivity.getmLivePlayViewHolder() != null) { LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); - } + }*/ + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW) + ); isDRPK = 1; } else if (action3 == 10) { if (!map.getString("uid").equals(CommonAppConfig.getInstance().getUid())) { - LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); + // LiveAudienceActivity.getmLivePlayViewHolder().setPkview(); + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.SOCKET_LIVE_DRPK_SET_PK_VIEW) + ); } } @@ -517,9 +560,9 @@ public class SocketRyClient { .setMsgModel(GsonUtils.fromJson(map.getJSONObject("ct").toString(), MsgModel.class))); break; case Constants.PK_RANK_UPDATE: - Log.i("PK排位",map.toString()); - JSONObject item=map.getJSONObject("ct"); - PkRankBean pkRankBean=new PkRankBean(); + Log.i("PK排位", map.toString()); + JSONObject item = map.getJSONObject("ct"); + PkRankBean pkRankBean = new PkRankBean(); pkRankBean.setId(Integer.parseInt(item.getString("new_rank_id"))); pkRankBean.setName(item.getString("new_rank_name")); pkRankBean.setImg(item.getString("new_rank_img")); @@ -688,7 +731,7 @@ public class SocketRyClient { mListener.onChat(chatBean, 1); } else if ("0".equals(msgtype)) {//用户进入房间 JSONObject obj = JSON.parseObject(map.getString("ct")); - LiveUserGiftBean u = JSON.toJavaObject(obj, LiveUserGiftBean.class); + LiveUserGiftBean u = GsonUtils.fromJson(obj.toJSONString(), LiveUserGiftBean.class); UserBean.Vip vip = new UserBean.Vip(); int vipType = obj.getIntValue("vip_type"); vip.setType(vipType); @@ -731,6 +774,7 @@ public class SocketRyClient { chatBean.setBubbleSrc(obj.getString("bubbleSrc"));//氣泡 //增加粉丝徽章信息 chatBean.setMedalNmae(obj.getString("medal_name")); + chatBean.setUserNiceName(obj.getString("user_nicename"));//名字 FansMedalBean fansMedalBean = CommonAppConfig.getInstance().getAnchorFansMedal(obj.getIntValue("medal_level")); if (fansMedalBean != null) chatBean.setMedalLevelImageUrl(fansMedalBean.getThumb()); @@ -1004,13 +1048,13 @@ public class SocketRyClient { break; case 2://收到对方主播PK回调 mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname")); - mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid")); + mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid")); break; case 3://对方主播拒绝PK的回调 mListener.onLinkMicPkRefuse(); break; case 4://所有人收到PK开始址的回调 - mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders")); + mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders")); break; case 5://PK时候断开连麦的回调 if (rtcRoom != null) { @@ -1051,7 +1095,7 @@ public class SocketRyClient { msg1.put("pkuid", CommonAppConfig.getInstance().getUid()); msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()); msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar()); - if(rtcRoom==null){ + if (rtcRoom == null) { return; } rtcRoom.getLocalUser().requestJoinOtherRoom(map.getString("uid"), map.getString("uid"), true, msg1.toString(), new IRCRTCResultCallback() { diff --git a/live/src/main/java/com/yunbao/live/utils/AllMsgTextRender.java b/live/src/main/java/com/yunbao/live/utils/AllMsgTextRender.java index 5bcc50e4c..53e515f8b 100644 --- a/live/src/main/java/com/yunbao/live/utils/AllMsgTextRender.java +++ b/live/src/main/java/com/yunbao/live/utils/AllMsgTextRender.java @@ -16,12 +16,17 @@ import com.yunbao.live.presenter.LiveGiftAnimPresenter; public class AllMsgTextRender { - public static SpannableStringBuilder builder; + public SpannableStringBuilder builder; + private LiveGiftAnimPresenter giftAnimPresenter; - public static void render(final Context context, final TextView textView, final String url, String name, String nameAncher, final String text, int intoIndex, WindowManager windowManager, String type) { + public AllMsgTextRender(LiveGiftAnimPresenter giftAnimPresenter) { + this.giftAnimPresenter = giftAnimPresenter; + } + + public void render(final Context context, final TextView textView, final String url, String name, String nameAncher, final String text, int intoIndex, WindowManager windowManager, String type) { if (intoIndex == 4) { textView.setText(name); - LiveGiftAnimPresenter.setCountDownTimerEnd(1); + giftAnimPresenter.setCountDownTimerEnd(1); return; } builder = new SpannableStringBuilder(); @@ -66,7 +71,7 @@ public class AllMsgTextRender { builder = createPrefix(drawable, builder); builder = renderMsg(color2, builder, text); textView.setText(builder); - LiveGiftAnimPresenter.setCountDownTimerEnd(intoIndex); + giftAnimPresenter.setCountDownTimerEnd(intoIndex); } @Override @@ -74,7 +79,7 @@ public class AllMsgTextRender { builder = createPrefix(null, builder); builder = renderMsg(color2, builder, text); textView.setText(builder); - LiveGiftAnimPresenter.setCountDownTimerEnd(intoIndex); + giftAnimPresenter.setCountDownTimerEnd(intoIndex); } }); } else { @@ -112,14 +117,14 @@ public class AllMsgTextRender { builder = renderMsg(color2, builder, text2); textView.setText(builder); // textView.init(windowManager); - LiveGiftAnimPresenter.setCountDownTimerEnd(intoIndex); + giftAnimPresenter.setCountDownTimerEnd(intoIndex); } } /** * 渲染消息 */ - private static SpannableStringBuilder renderMsg(int color, SpannableStringBuilder builder, String str) { + private SpannableStringBuilder renderMsg(int color, SpannableStringBuilder builder, String str) { int length = builder.length(); builder.append(str); builder.setSpan(new ForegroundColorSpan(color), length, length + str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); @@ -130,7 +135,7 @@ public class AllMsgTextRender { /** * 图片 */ - private static SpannableStringBuilder createPrefix(Drawable levelDrawable, SpannableStringBuilder builder) { + private SpannableStringBuilder createPrefix(Drawable levelDrawable, SpannableStringBuilder builder) { int index = builder.length(); if (levelDrawable != null) { diff --git a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java index 71892da7f..4cf3ed5e6 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java @@ -230,28 +230,28 @@ public class LiveTextRender { int index = 0; if (levelDrawable != null) { - builder.append(" "); + builder.append(" "); levelDrawable.setBounds(0, 0, DpUtil.dp2px(32), DpUtil.dp2px(14)); builder.setSpan(new VerticalImageSpan(levelDrawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); index = builder.length(); } if (gzDrawablesMap.containsKey(bean)) {//贵族 - builder.append(" "); - gzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(32), DpUtil.dp2px(18)); + builder.append(" "); + gzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(35), DpUtil.dp2px(20)); builder.setSpan(new VerticalImageSpan(gzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); index = builder.length(); } if (ryxzDrawablesMap.containsKey(bean)) {//荣誉勋章 - builder.append(" "); + builder.append(" "); ryxzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(18), DpUtil.dp2px(18)); builder.setSpan(new VerticalImageSpan(ryxzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); index = builder.length(); } if (nhDrawablesMap.containsKey(bean)) {//靓号 - builder.append(" "); + builder.append(" "); nhDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17)); builder.setSpan(new VerticalImageSpan(nhDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); index = builder.length(); @@ -268,7 +268,7 @@ public class LiveTextRender { } if (drawable != null) { - builder.append(" "); + builder.append(" "); drawable.setBounds(0, 0, DpUtil.dp2px(18), DpUtil.dp2px(16)); builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); index = builder.length(); @@ -280,7 +280,7 @@ public class LiveTextRender { && !bean.getMedalNmae().equals("null") && !bean.getMedalNmae().equals("(null)") && !bean.getMedalNmae().equals("")) {//粉丝徽章图标 Drawable drawable = getMedalImage(bean); if (drawable != null) { - builder.append(" "); + builder.append(" "); drawable.setBounds(0, 0, DpUtil.dp2px(44), DpUtil.dp2px(17)); builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); index = builder.length(); @@ -291,7 +291,7 @@ public class LiveTextRender { if (bean.isManager()) {//直播间管理员图标 Drawable drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_m); if (drawable != null) { - builder.append(" "); + builder.append(" "); drawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14)); builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); index = builder.length(); @@ -301,7 +301,7 @@ public class LiveTextRender { if (!TextUtils.isEmpty(bean.getLiangName())) {//靓号图标 Drawable drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_liang); if (drawable != null) { - builder.append(" "); + builder.append(" "); drawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14)); builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // new add @@ -528,9 +528,9 @@ public class LiveTextRender { int indexX = 80; //水印的位置坐标 if (level.length() > 2) { - indexX = 75; + indexX = 87; } else { - indexX = 84; + indexX = 95; } mCanvas.drawText(level, indexX, 53, mPaint); mCanvas.save(); diff --git a/live/src/main/java/com/yunbao/live/views/CustomViewHolder.java b/live/src/main/java/com/yunbao/live/views/CustomViewHolder.java index 766aef76d..085d8de5a 100644 --- a/live/src/main/java/com/yunbao/live/views/CustomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/CustomViewHolder.java @@ -11,6 +11,7 @@ import android.widget.TextView; import com.bumptech.glide.Glide; import com.ms.banner.holder.BannerViewHolder; import com.yunbao.common.bean.BannerBean; +import com.yunbao.common.utils.StringUtil; import com.yunbao.common.views.weight.ProgressView; import com.yunbao.live.R; @@ -63,9 +64,11 @@ public class CustomViewHolder implements BannerViewHolder { currentAssist.setText(String.valueOf(currentAssistNum)); title.setText(String.format(context.getString(R.string.star_change),data.getModel().getTaskNum())); } else { - String imagerUrl = data.getImageUrl().replace("qny", "downs"); - Glide.with(context).load(imagerUrl).into(bannerBack); - startContext.setVisibility(View.GONE); + if(data!=null&&!StringUtil.isEmpty(data.getImageUrl())) { + String imagerUrl = data.getImageUrl().replace("qny", "downs"); + Glide.with(context).load(imagerUrl).into(bannerBack); + startContext.setVisibility(View.GONE); + } } return contextView; diff --git a/live/src/main/java/com/yunbao/live/views/InputPanelViewHolder.java b/live/src/main/java/com/yunbao/live/views/InputPanelViewHolder.java index a62ddc2c6..3aa7e9c11 100644 --- a/live/src/main/java/com/yunbao/live/views/InputPanelViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/InputPanelViewHolder.java @@ -16,12 +16,8 @@ import android.widget.LinearLayout; import androidx.annotation.Nullable; -import com.adjust.sdk.Adjust; -import com.adjust.sdk.AdjustEvent; import com.facebook.appevents.AppEventsLogger; import com.google.firebase.analytics.FirebaseAnalytics; -import com.yunbao.common.http.CommonHttpUtil; -import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.utils.FileUtil; import com.yunbao.common.utils.TimeUtils; @@ -175,20 +171,7 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi @Override public void onSuccess(Message message) { - if(isAdmin){ - AdjustEvent adjustEvent1 = new AdjustEvent("2kjbwx"); - Adjust.trackEvent(adjustEvent1); - CommonHttpUtil.setAdvertisingChannels("2kjbwx", new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - FirebaseAnalytics.getInstance(getContext()).logEvent("FS_director_first_chat", null); - AppEventsLogger.newLogger(getContext()).logEvent("FB_director_first_chat"); - } - } - }); - AdjustEvent adjustEvent2 = new AdjustEvent("g9lzss"); - Adjust.trackEvent(adjustEvent2); + if (isAdmin) { FirebaseAnalytics.getInstance(getContext()).logEvent("FS_director_chat", null); AppEventsLogger.newLogger(getContext()).logEvent("FB_director_chat"); } diff --git a/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java index 0ee9fb147..0ed15d730 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveEndViewHolder.java @@ -26,6 +26,7 @@ import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.main.MainNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.views.AbsViewHolder; @@ -200,12 +201,22 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList public static void upData(String votes, String length, int nums, String uname) { Log.e("收", votes + "votes" + length + "length" + nums + "nums"); if (type == LiveOfType.USER) { - liveDurationUser.setText(length); - liveNameUser.setText(uname); + if (liveDurationUser != null) { + liveDurationUser.setText(length); + } + if (liveNameUser != null) { + liveNameUser.setText(uname); + } } else { - liveDurationAnchor.setText(length); - liveVotes.setText(votes); - liveWatchNum.setText(StringUtil.toWan(nums)); + if (liveDurationAnchor != null) { + liveDurationAnchor.setText(length); + } + if (liveVotes != null) { + liveVotes.setText(votes); + } + if (liveWatchNum != null) { + liveWatchNum.setText(StringUtil.toWan(nums)); + } } } @@ -313,18 +324,26 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { + + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { if (liveBean == null) { return; } - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal).setLiveEnd(true)); + if(MicStatusManager.getInstance().isMic(liveUid)){ + MicStatusManager.getInstance().showDownMicDialog(mContext); + return; + } + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); + } + + @Override + public void onCheckError(String contextError) { } }); Bus.get().post(new CloseEvent()); - mCheckLivePresenter.checkLive(liveBean); } else { Bus.get().post(new CloseEvent()); RouteUtil.forwardUserHome(mContext, String.valueOf(event.getModel().getId()), 0); diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java index 13477491f..6c53de969 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -1,8 +1,14 @@ package com.yunbao.live.views; +import static com.lzy.okgo.utils.HttpUtils.runOnUiThread; +import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL; + +import android.Manifest; +import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.graphics.Bitmap; +import android.graphics.Color; import android.media.AudioManager; import android.os.Bundle; import android.os.Handler; @@ -16,8 +22,10 @@ import android.view.ViewParent; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.RelativeLayout; +import android.widget.TextView; import com.alibaba.fastjson.JSON; +import com.lzf.easyfloat.EasyFloat; import com.lzy.okserver.OkDownload; import com.lzy.okserver.download.DownloadTask; import com.tencent.live2.V2TXLiveDef; @@ -25,25 +33,31 @@ import com.tencent.live2.V2TXLivePlayer; import com.tencent.live2.V2TXLivePlayerObserver; import com.tencent.live2.impl.V2TXLivePlayerImpl; import com.tencent.rtmp.ui.TXCloudVideoView; -import com.yunbao.common.glide.ImgLoader; -import com.yunbao.common.http.CommonHttpConsts; +import com.yunbao.common.Constants; +import com.yunbao.common.bean.CrashSaveBean; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.utils.DeviceUtils; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.L; +import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; +import com.yunbao.live.activity.LiveAudienceActivity; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.List; +import java.util.Locale; import java.util.Map; import cn.rongcloud.rtc.api.RCRTCEngine; @@ -55,6 +69,7 @@ import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback; import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener; import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleCallback; import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleDataCallback; +import cn.rongcloud.rtc.api.callback.IRCRTCVideoInputFrameListener; import cn.rongcloud.rtc.api.stream.RCRTCInputStream; import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo; import cn.rongcloud.rtc.api.stream.RCRTCOutputStream; @@ -64,12 +79,10 @@ import cn.rongcloud.rtc.api.stream.RCRTCVideoView; import cn.rongcloud.rtc.base.RCRTCLiveRole; import cn.rongcloud.rtc.base.RCRTCMediaType; import cn.rongcloud.rtc.base.RCRTCParamsType; +import cn.rongcloud.rtc.base.RCRTCRemoteVideoFrame; import cn.rongcloud.rtc.base.RCRTCRoomType; import cn.rongcloud.rtc.base.RTCErrorCode; -import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL; -import static com.lzy.okgo.utils.HttpUtils.runOnUiThread; - public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { private static final String TAG = "LivePlayViewHolder"; @@ -80,7 +93,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { private RelativeLayout mPkContainer; public static TXCloudVideoView mVideoView; - private View mLoading; + private View mLoading, mLoading2; private ImageView mCover; private boolean mPaused;//是否切后台了 private boolean mStarted;//是否开始了播放 @@ -88,23 +101,27 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { public static ImageView leave; private boolean mPausedPlay;//是否被动暂停了播放 - public static int landscape; //1h 2s + public int landscape; //1h 2s public static Context contexts; public V2TXLivePlayer mPlayer; public static FrameLayout ry_view; - - int screenWidth; // 屏幕宽(像素,如:480px) - int screenHeight; // 屏幕高(像素,如:800p) + private static final int VIDEO_VERTICAL = 1; + private static final int VIDEO_HORIZONTAL = 2; + int videoLandscape; // 视频方向,1=竖屏,2=横屏 static int vHeight;//视频高 + private TextView debugView; //0未申请1申请中2连麦中 - public static int Micing = 0; RCRTCRoom rcrtcRoom; String purl; + public int getLandscape() { + return landscape; + } + public LivePlayRyViewHolder(Context context, ViewGroup parentView, int landscapes) { super(context, parentView); contexts = context; @@ -112,14 +129,6 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { Log.i("收收收", landscape + ""); } - public LivePlayRyViewHolder(Context context, ViewGroup parentView) { - super(context, parentView); - } - - public static void setLandscape(int landscape) { - Log.i("收", "是的" + landscape); - LivePlayKsyViewHolder.landscape = landscape; - } @Override protected int getLayoutId() { @@ -138,6 +147,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { ry_view = (FrameLayout) findViewById(R.id.ry_view); leave = (ImageView) findViewById(R.id.leave); mLoading = findViewById(R.id.loading); + mLoading2 = findViewById(R.id.loading2); mCover = (ImageView) findViewById(R.id.cover); ScreenDimenUtil util = ScreenDimenUtil.getInstance(); int mScreenWdith = util.getScreenWdith(); @@ -148,25 +158,82 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { mPkContainer.requestLayout(); mPlayer = new V2TXLivePlayerImpl(mContext); mPlayer.setRenderView(mVideoView); + + debugView = new TextView(mContext); + debugView.setBackgroundColor(Color.WHITE); + } @Override public void hideCover() { - if (mCover != null) { - mCover.animate().alpha(0).setDuration(500).start(); - } +// if (mCover != null) { +// if (mCover.getVisibility()==View.VISIBLE){ +//// new Handler().postDelayed(new Runnable() { +//// @Override +//// public void run() { +//// +//// } +//// },200); +// mCover.setVisibility(View.GONE); +// mLoading2.setVisibility(View.GONE); +// } +// +// +// } } @Override public void setCover(String coverUrl) { - if (mCover != null) { - ImgLoader.displayBlur(mContext, coverUrl, mCover); - } +// if (mCover != null) { +// mCover.setVisibility(View.VISIBLE); +// mLoading2.setVisibility(View.VISIBLE); +// ImgLoader.displayBlurLive(mContext, coverUrl, mCover, 400, 600); +// +// } } @Override - public void setLiveBeanLandscape(int landscape) { - LivePlayRyViewHolder.landscape =landscape; + public synchronized void setLiveBeanLandscape(int landscape) { + this.landscape = landscape; + if (landscape == 2) { + Log.i("收到socket--->", "还原9:16"); + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); + params.height = RelativeLayout.LayoutParams.MATCH_PARENT; + params.topMargin = 0; + mVideoView.setLayoutParams(params); + mVideoView.requestLayout(); + + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams(); + params1.height = RelativeLayout.LayoutParams.MATCH_PARENT; + params1.topMargin = 0; + ry_view.setLayoutParams(params1); + ry_view.requestLayout(); + RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) mCover.getLayoutParams(); + params2.height = RelativeLayout.LayoutParams.MATCH_PARENT; + params2.topMargin = 0; + mCover.setLayoutParams(params2); + mCover.requestLayout(); + + } else { + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); + params.height = vHeight; + params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); + params.addRule(RelativeLayout.ALIGN_TOP); + mVideoView.setLayoutParams(params); + mVideoView.requestLayout(); + + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams(); + params1.height = vHeight; + params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); + params1.addRule(RelativeLayout.ALIGN_TOP); + ry_view.setLayoutParams(params1); + ry_view.requestLayout(); + RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) mCover.getLayoutParams(); + params2.height = DpUtil.dp2px(270); + params2.topMargin = DpUtil.dp2px(120); + mCover.setLayoutParams(params2); + mCover.requestLayout(); + } } /** @@ -182,7 +249,15 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { */ @Override public void resumePlay() { - + if (mPlayer.isPlaying() != 1) { + new Handler(Looper.getMainLooper()) + .postDelayed(() -> { + mPlayer.stopPlay(); + int val = mPlayer.startPlay(purl); + // ToastUtil.show("强制播放" + val); + Log.i(TAG, "强制播放: " + val); + }, 100); + } } /** @@ -202,7 +277,6 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { if (TextUtils.isEmpty(url) || mVideoView == null) { return; } - //mPlayer.setCacheParams(1.0f, 5.0f); mVideoView.clearLastFrame(true); mPlayer.setObserver(new V2TXLivePlayerObserver() { String TAG = "播放流"; @@ -211,6 +285,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { public void onError(V2TXLivePlayer player, int code, String msg, Bundle extraInfo) { super.onError(player, code, msg, extraInfo); Log.i(TAG, "onError: player = " + player + ", code = " + code + ", msg = " + msg + ", extraInfo = " + extraInfo); + debugView.setText("播放出错code=" + code + " msg=" + msg); } @Override @@ -223,6 +298,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { mPlayer.stopPlay(); mPlayer.startPlay(purl); } + debugView.setText("播放警告code=" + code + " msg=" + msg); } @Override @@ -271,11 +347,28 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { break; case 5: buffer.append("完成"); + break; } + buffer.append("|"); } - //Log.i(TAG, "onStatisticsUpdate: " + JSON.toJSONString(statistics) + " |当前下载数 : " + OkDownload.getInstance().getTaskMap().size() + buffer); + hideCover(); + String debugText = "视频码率:" + statistics.videoBitrate + "\n" + + "音频码率:" + statistics.audioBitrate + "\n" + + "FPS:" + statistics.fps + "\n" + + "CPU:" + statistics.appCpu + "\n" + + "剩余内存:" + DeviceUtils.getMemory(mContext) + "\n" + + "分辨率:" + statistics.height + "x" + statistics.width + "\n" + + "播放状态:" + mPlayer.isPlaying() + "\n" + + "运行时间:" + (System.currentTimeMillis()- CrashSaveBean.getInstance().getStartTime())/1000 + "\n"; + debugView.setText(debugText); + Log.i(TAG, "onStatisticsUpdate: " + JSON.toJSONString(statistics) + " |当前下载数 : " + OkDownload.getInstance().getTaskMap().size() + buffer); + if (statistics.height > statistics.width) { + videoLandscape = VIDEO_VERTICAL; + } else { + videoLandscape = VIDEO_HORIZONTAL; + } if (statistics.fps == 0) { OkDownload.getInstance().pauseAll(); } else { @@ -300,7 +393,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { }); purl = url; - mPlayer.startPlay(url); + int V2TXLiveCode = mPlayer.startPlay(url); onPrepared(); } @@ -337,7 +430,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { public static void setViewUP(int i) { if (mVideoView == null) return; - Log.i("收", "整理" + i); + Log.e("收", "整理" + i); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); params.height = vHeight; params.topMargin = contexts.getResources().getDimensionPixelOffset(R.dimen.live_top); @@ -359,32 +452,57 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { release(); return; } + int height; + if (videoLandscape == VIDEO_VERTICAL) { + height = ViewGroup.LayoutParams.MATCH_PARENT; + } else { + height = DpUtil.dp2px(285); + } if (landscape == 2) { Log.i("收到socket--->", "还原9:16"); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); - params.height = RelativeLayout.LayoutParams.MATCH_PARENT; + params.height = height; params.topMargin = 0; + params.addRule(RelativeLayout.ALIGN_TOP); + mVideoView.setLayoutParams(params); mVideoView.requestLayout(); RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams(); - params1.height = RelativeLayout.LayoutParams.MATCH_PARENT; + params1.height = height; params1.topMargin = 0; + ry_view.setLayoutParams(params1); ry_view.requestLayout(); - + RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) mCover.getLayoutParams(); + params2.height = height; + params2.topMargin = 0; + mCover.setLayoutParams(params2); + mCover.requestLayout(); } else { RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); - params.height = vHeight; - params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); + params.height = height; + params.topMargin = 0; + if (videoLandscape == VIDEO_HORIZONTAL) { + params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); + } params.addRule(RelativeLayout.ALIGN_TOP); + mVideoView.setLayoutParams(params); mVideoView.requestLayout(); RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) ry_view.getLayoutParams(); - params1.height = vHeight; - params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); + params1.height = height; + params1.topMargin = 0; params1.addRule(RelativeLayout.ALIGN_TOP); + if (videoLandscape == VIDEO_HORIZONTAL) { + params1.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); + } + ry_view.setLayoutParams(params1); ry_view.requestLayout(); + RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) mCover.getLayoutParams(); + params2.height = height; + params2.topMargin = DpUtil.dp2px(120); + mCover.setLayoutParams(params2); + mCover.requestLayout(); } - hideCover(); } @Override @@ -398,7 +516,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } @Override - public void setPkEndview() { + public synchronized void setPkEndview() { Log.i("收收收", landscape + ""); @@ -412,7 +530,6 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } else { RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams(); params.height = vHeight; -// params.height = mContext.getResources().getDimensionPixelOffset(R.dimen.live_view); params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top); params.addRule(RelativeLayout.ALIGN_TOP); mVideoView.requestLayout(); @@ -539,12 +656,29 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } }); } else if ("inviteMic".equals(str)) { - DialogUitl.showSimpleDialog(mContext, "主播邀請您進行語音連麥", new DialogUitl.SimpleCallback() { - @Override - public void onConfirmClick(Dialog dialog, String content) { - UsertoRY(); - } - }); + DialogUitl.Builder builder = new DialogUitl.Builder(mContext) + .setContent("邀請您進行語音連麥") + .setTitle(mLiveBean.getUserNiceName()) + .setConfrimString("接受") + .setCancelString("拒絕") + .setView(R.layout.dialog_live_mic_invite) + .setClickCallback(new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + LiveAudienceActivity.mProcessResultUtil.requestPermissions(new String[]{ + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.WRITE_EXTERNAL_STORAGE, + Manifest.permission.RECORD_AUDIO + }, new Runnable() { + @Override + public void run() { + UsertoRY(); + + } + }); + } + }); + builder.build().show(); } else if ("endMic".equals(str)) { if (rcrtcRoom != null) { @@ -577,10 +711,15 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { mPlayer.startPlay(purl); } ry_view.removeAllViews(); + ry_view.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT; onPrepared(); rcrtcRoom = null; - Micing = 0; + MicStatusManager.getInstance().clear(); ToastUtil.show("已成功退出語音連麥"); + resumePlay(); + if (onMicCallback != null) { + onMicCallback.onMikUpdate(); + } } }); } @@ -605,6 +744,16 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } }); } + } else if ("Debug".equals(str)) { + if (EasyFloat.isShow("Debug")) { + EasyFloat.dismiss("Debug"); + return; + } + EasyFloat.with(mContext) + .setDragEnable(true) + .setTag("Debug") + .setLayout(debugView) + .show(); } } @@ -792,6 +941,9 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { Log.e("ry", "切换成功"); new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { + if (onMicCallback != null) { + onMicCallback.onMikUpdate(); + } //遍历远端用户列表 for (int i = 0; i < rcrtcRoom.getRemoteUsers().size(); i++) { Log.e("ry", rcrtcRoom.getRemoteUsers().get(i).getUserId() + "收到rcrtcOtherRoom" + rcrtcRoom.getRemoteUsers().size()); @@ -803,6 +955,20 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { //如果远端用户发布的是视频流,创建显示视图RCRTCVideoView,并添加到布局中显示 RCRTCVideoView remoteView = new RCRTCVideoView(contexts); ((RCRTCVideoInputStream) stream).setVideoView(remoteView); + ((RCRTCVideoInputStream) stream).setVideoFrameListener(new IRCRTCVideoInputFrameListener() { + @Override + public void onFrame(RCRTCRemoteVideoFrame videoFrame) { + String debugText = "视频类型:" + videoFrame.getFrameType().name() + "\n" + + "rotation:" + videoFrame.getRotation() + "\n" + + "timestampNs:" + videoFrame.getTimestampNs() + "\n" + + "分辨率:" + videoFrame.getBuffer().getHeight() + "x" + videoFrame.getBuffer().getWidth() + "\n" + + "当前时间:" + new SimpleDateFormat("HH:mm:ss", Locale.CHINA).format(new Date()) + "\n"; + new Handler(Looper.getMainLooper()).post(() -> { + debugView.setText(debugText); + + }); + } + }); //todo 本demo只演示添加1个远端用户的视图 ry_view.removeAllViews(); remoteView.setScalingType(SCALE_ASPECT_FILL); @@ -818,7 +984,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { @Override public void onSuccess() { Log.e("ry", "订阅资源成功"); - Micing = 2; + MicStatusManager.getInstance().setMicData(MicStatusManager.MIC_TYPE_OPEN, LiveActivity.mLiveUid); AudioManager audioManager = (AudioManager) contexts.getSystemService(Context.AUDIO_SERVICE); RCRTCEngine.getInstance().enableSpeaker(true); audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION); diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomPlayViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomPlayViewHolder.java index 55a6412e4..32ad18a89 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomPlayViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomPlayViewHolder.java @@ -3,6 +3,7 @@ package com.yunbao.live.views; import android.content.Context; import android.view.ViewGroup; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.views.AbsViewHolder; import com.yunbao.live.interfaces.ILiveLinkMicViewHolder; @@ -11,6 +12,9 @@ import com.yunbao.live.interfaces.ILiveLinkMicViewHolder; */ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements ILiveLinkMicViewHolder { + protected LiveBean mLiveBean; + + OnMicCallback onMicCallback;//连麦回调 public LiveRoomPlayViewHolder(Context context, ViewGroup parentView) { super(context, parentView); @@ -41,4 +45,22 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL public abstract void setPkEndview(); public abstract void setLiveBeanLandscape(int landscape); + + public void setLiveBean(LiveBean data) { + this.mLiveBean = data; + } + + public OnMicCallback getOnMicCallback() { + return onMicCallback; + } + + public void setOnMicCallback(OnMicCallback onMicCallback) { + this.onMicCallback = onMicCallback; + } + + + public interface OnMicCallback{ + void onMikUpdate(); + + } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index a96375ebd..d8b52023f 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1,7 +1,5 @@ package com.yunbao.live.views; -import static com.yunbao.common.CommonAppContext.logger; -import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY; import android.app.Activity; @@ -38,8 +36,6 @@ import androidx.constraintlayout.widget.ConstraintLayout; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.adjust.sdk.Adjust; -import com.adjust.sdk.AdjustEvent; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -63,15 +59,23 @@ import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.BannerBean; +import com.yunbao.common.bean.GiftModel; +import com.yunbao.common.bean.GuardUserModel; import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveRoomActivityBanner; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.MsgModel; +import com.yunbao.common.bean.NewPeopleTaskModel; import com.yunbao.common.bean.PkRankBean; +import com.yunbao.common.bean.RankHourModel; +import com.yunbao.common.bean.RewardAllModel; import com.yunbao.common.bean.StarChallengeStatusModel; +import com.yunbao.common.bean.TaskModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.API; @@ -86,12 +90,12 @@ import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DeviceUtils; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.StringUtil; -import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.formatBigNum; import com.yunbao.common.views.AbsViewHolder; @@ -117,7 +121,6 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; -import com.yunbao.live.bean.LiveUserGiftBean; import com.yunbao.live.bean.LiveWishlistBean; import com.yunbao.live.bean.WishlistItemModel; import com.yunbao.live.custom.LiveLightView; @@ -258,9 +261,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis static ImageView pk5Ico; static RelativeLayout pk5; - static RelativeLayout mic_view; - static RelativeLayout mic_view1; - static RelativeLayout mic_view2; + RelativeLayout mic_view; + RelativeLayout mic_view1; + RelativeLayout mic_view2; static ImageView mic_ico; static RoundedImageView mic_ico1; @@ -317,6 +320,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private TextView mRedVal, mBlueVal; private String pkUid = ""; + //接口整合新加参数 + private GuardUserModel guardUserModel; + private ViewFlipper flipper; + public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { super(context, parentView); Contexts = context; @@ -334,26 +341,26 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } //更新连麦人 - public static List mic_ids = new ArrayList<>(); + public List mic_ids = new ArrayList<>(); - public static void updataMicList(JSONArray obj) { + public void updataMicList(List list) { mic_ids.clear(); updataCleanMic(); //拿到原始数据 - for (int j = 0; j < obj.size(); j++) { - JSONObject mic = obj.getJSONObject(j); - if (j == 1) { + for (int i = 0; i < list.size(); i++) { + LinkMicUserBean bean = list.get(i); + if (i == 1) { mic_view.setVisibility(View.VISIBLE); - mic_ids.add(mic.getString("id")); - ImgLoader.display2(Contexts, mic.getString("avatar"), mic_ico); - } else if (j == 2) { + mic_ids.add(bean.getId()); + ImgLoader.display2(Contexts, bean.getAvatar(), mic_ico); + } else if (i == 2) { mic_view1.setVisibility(View.VISIBLE); - mic_ids.add(mic.getString("id")); - ImgLoader.display2(Contexts, mic.getString("avatar"), mic_ico1); - } else if (j == 3) { + mic_ids.add(bean.getId()); + ImgLoader.display2(Contexts, bean.getAvatar(), mic_ico1); + } else if (i == 3) { mic_view2.setVisibility(View.VISIBLE); - mic_ids.add(mic.getString("id")); - ImgLoader.display2(Contexts, mic.getString("avatar"), mic_ico2); + mic_ids.add(bean.getId()); + ImgLoader.display2(Contexts, bean.getAvatar(), mic_ico2); } } mic_view.setOnClickListener(new View.OnClickListener() { @@ -376,7 +383,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); } - public static void updataCleanMic() { + public void updataCleanMic() { mic_view.setVisibility(View.GONE); mic_view1.setVisibility(View.GONE); mic_view2.setVisibility(View.GONE); @@ -691,7 +698,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mic_view = (RelativeLayout) findViewById(R.id.mic_view); mic_view1 = (RelativeLayout) findViewById(R.id.mic_view1); mic_view2 = (RelativeLayout) findViewById(R.id.mic_view2); - + flipper = (ViewFlipper) findViewById(R.id.hour_rank_list); mic_ico = (ImageView) findViewById(R.id.mic_ico); newMessage = (ImageView) findViewById(R.id.new_message); atMessage = (ImageView) findViewById(R.id.at_message); @@ -846,7 +853,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis layoutManager.setStackFromEnd(true); mChatRecyclerView.setLayoutManager(layoutManager); mChatRecyclerView.addItemDecoration(new TopGradual()); + mChatRecyclerView.setItemViewCacheSize(10); mLiveChatAdapter = new LiveChatAdapter(mContext); + mChatRecyclerView.setAdapter(mLiveChatAdapter); mLiveChatAdapter.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(LiveChatBean bean, int position) { @@ -875,7 +884,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } }); - mChatRecyclerView.setAdapter(mLiveChatAdapter); + mChatRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { @@ -1048,8 +1057,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis findViewById(R.id.open_sidebar).setVisibility(View.GONE); findViewById(R.id.btn_follow).setVisibility(View.GONE); findViewById(R.id.live_rank_pk).setVisibility(View.GONE); - } else { - configBanner3(); } reloadIM(); initStarChallengeStatus(); @@ -1075,20 +1082,33 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } - public void resetView() { + /** + * 重置该隐藏的view + */ + public void resetViewGone() { goto_room_view.setVisibility(View.GONE); + mPkRankTopIcon.setVisibility(View.GONE); + lt_pk_line.setVisibility(View.GONE); + time.setVisibility(View.GONE); if (!SpUtil.getInstance().getBooleanValue("private_chat_message_switch")) { msgLayout.setVisibility(View.GONE); } if (!IMLoginManager.get(mContext).hintChat()) { msgLayout.setVisibility(View.VISIBLE); } + if (d_pk_view != null) { + d_pk_view.setVisibility(View.GONE); + } if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) { fans_btn.setVisibility(View.GONE); } - mPkRankTopIcon.setVisibility(View.GONE); - lt_pk_line.setVisibility(View.GONE); - time.setVisibility(View.GONE); + } + + /** + * 重置数据 + */ + public void resetView() { + resetViewGone(); mBannerList1.clear(); mBannerList2.clear(); mBannerList3.clear(); @@ -1149,8 +1169,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis msgLayout.setVisibility(View.GONE); } - public void addWishList(BannerBean bannerModel) { - mBannerList2.add(bannerModel); + /** + * 添加心愿单轮播he活动 + */ + public void addWishListActivity(List bannerModels) { + mBannerList2.addAll(bannerModels); if (mBanner2.isStart()) { mBanner2.update(mBannerList2); } else { @@ -1480,11 +1503,58 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); } + public void initHourRank(RankHourModel model) { + if (flipper.getChildCount() > 0) { + flipper.removeAllViews(); + } + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16)); + LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + textParams.leftMargin = DpUtil.dp2px(5); + View hotView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); + View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); + ImageView hotPic = hotView.findViewById(R.id.wish_pic); + ImageView hourPic = hourView.findViewById(R.id.wish_pic); + mHotText = hotView.findViewById(R.id.wish_index); + mHourRank = hourView.findViewById(R.id.wish_index); + mHotText.setText("0"); + mHotText.setLayoutParams(textParams); + mHourRank.setLayoutParams(textParams); + mHotText.setGravity(Gravity.CENTER); + mHourRank.setGravity(Gravity.CENTER); + setHourRankData(Long.parseLong(model.getRank())); + hotPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hot : R.drawable.live_tags_hot_en); + hourPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hour_list : R.drawable.live_tags_hour_list_en); + hotPic.setLayoutParams(params); + hourPic.setLayoutParams(params); + flipper.addView(hotView); + flipper.addView(hourView); + flipper.startFlipping(); + flipper.setOnClickListener(view -> { + Bundle bundle = new Bundle(); + String path = model.getHourchartH5Url(); + if (!path.startsWith("/")) { + path = "/" + path; + } + String url = CommonAppConfig.HOST + path; + url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; + bundle.putString("url", url); + bundle.putInt("height", DpUtil.dp2px(500)); + bundle.putInt("show_type", 0); + bundle.putString("roomId", mLiveUid); + LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); + liveHDDialogFragment.setArguments(bundle); + liveHDDialogFragment.show(((AbsActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + }); + } + /** * 初始化小时榜 */ public void initHourRankList() { - ViewFlipper flipper = (ViewFlipper) findViewById(R.id.hour_rank_list); + if (flipper.getChildCount() > 0) { + flipper.removeAllViews(); + } LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16)); LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); textParams.leftMargin = DpUtil.dp2px(5); @@ -1534,7 +1604,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } }, Throwable::printStackTrace) .isDisposed(); - initPkRank(); } private void initPkRankView(PkRankBean bean) { @@ -1570,66 +1639,68 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } public void initPkRank(String isLadders) { - API.get().pdLiveApi(mContext) - .getPkRanksList(mLiveUid, pkUid) - .observeOn(AndroidSchedulers.mainThread()) - .subscribeOn(Schedulers.io()) - .subscribe(listResponseModel -> { - PkRankBean bean = listResponseModel.getData().getInfo(); - if (bean != null) { - Log.i("PK", bean.toString() + " | " + isLadders); - initPkRankView(bean); - if (!StringUtil.isEmpty(bean.getClickUrl())) { - pkRankVf.setOnClickListener(v -> { - Bundle bundle = new Bundle(); - String path = bean.getClickUrl(); - if (!path.startsWith("/")&&!path.startsWith("http")) { - path = "/" + path; - } - String url = null; - if (path.startsWith("http") || path.startsWith("/http")) { - url = path; - } else { - url = CommonAppConfig.HOST + path; - } - if (!url.contains("?")) { - url += "?"; - } else { - url += "&"; - } - url += "uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; - bundle.putString("url", url); - //bundle.putInt("height", DpUtil.dp2px(600)); - bundle.putInt("show_type", 0); - bundle.putString("roomId", mLiveUid); - LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); - liveHDDialogFragment.setArguments(bundle); - liveHDDialogFragment.show(((AbsActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); - }); + LiveNetManager.get(mContext) + .getRandomPk(mLiveUid, pkUid, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(PkRankBean bean) { + if (bean != null) { + initPkRankView(bean); + if (!StringUtil.isEmpty(bean.getClickUrl())) { + pkRankVf.setOnClickListener(v -> { + Bundle bundle = new Bundle(); + String path = bean.getClickUrl(); + if (!path.startsWith("/") && !path.startsWith("http")) { + path = "/" + path; + } + String url = null; + if (path.startsWith("http") || path.startsWith("/http")) { + url = path; + } else { + url = CommonAppConfig.HOST + path; + } + if (!url.contains("?")) { + url += "?"; + } else { + url += "&"; + } + url += "uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; + bundle.putString("url", url); + bundle.putInt("height", DpUtil.dp2px(500)); + bundle.putInt("show_type", 0); + bundle.putString("roomId", mLiveUid); + LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); + liveHDDialogFragment.setArguments(bundle); + liveHDDialogFragment.show(((AbsActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + }); + } + pkRankLayout.setVisibility(View.VISIBLE); + mPkRankText.setText(bean.getName()); + ImgLoader.display(mContext, bean.getImg(), mPkRankIcon); + if (StringUtil.isEmpty(bean.getPkTopImgUrl())) { + return; + } + if (!StringUtil.isEmpty(isLadders)) { + bean.setPkTopImgUrl(isLadders); + } + if (Integer.parseInt(bean.getRedVal()) > 2) { + mRedVal.setVisibility(View.VISIBLE); + mRedVal.setText(bean.getRedVal() + "連勝"); + } + if (Integer.parseInt(bean.getBlueVal()) > 2) { + mBlueVal.setVisibility(View.VISIBLE); + mBlueVal.setText(bean.getBlueVal() + "連勝"); + } + mPkRankTopIcon.setVisibility(View.VISIBLE); + ImgLoader.display(mContext, bean.getPkTopImgUrl(), mPkRankTopIcon); } - - mPkRankText.setText(bean.getName()); - ImgLoader.display(mContext, bean.getImg(), mPkRankIcon); - if (StringUtil.isEmpty(bean.getPkTopImgUrl()) || StringUtil.isEmpty(isLadders)) { - return; - } - if (!StringUtil.isEmpty(isLadders)) { - bean.setPkTopImgUrl(isLadders); - } - if (Integer.parseInt(bean.getRedVal()) > 2) { - mRedVal.setVisibility(View.VISIBLE); - mRedVal.setText(bean.getRedVal() + "連勝"); - } - if (Integer.parseInt(bean.getBlueVal()) > 2) { - mBlueVal.setVisibility(View.VISIBLE); - mBlueVal.setText(bean.getBlueVal() + "連勝"); - } - mPkRankTopIcon.setVisibility(View.VISIBLE); - ImgLoader.display(mContext, bean.getPkTopImgUrl(), mPkRankTopIcon); } - }, Throwable::printStackTrace) - .isDisposed(); + + @Override + public void onError(String error) { + + } + }); } @@ -1666,7 +1737,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private void updatePkRank(PkRankBean bean) { mPkRankText.setText(bean.getName()); ImgLoader.display(mContext, bean.getImg(), mPkRankIcon); - initPkRank(); } /** @@ -1942,14 +2012,20 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } + public boolean pkHandler = true; + //左上角显示对方主播头像及昵称 public void setOtherInfo(String touids, String url, String name) { Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { + if (!pkHandler) { + return; + } goto_room_view.setVisibility(View.VISIBLE); touid = touids; + pkUid = touids; ImgLoader.displayAvatar(mContext, url, avatarOther); tv_avatarOther_name.setText(name); goto_room_view.setOnClickListener(new View.OnClickListener() { @@ -1958,6 +2034,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis showUserDialog(touids); } }); + initPkRank(); } }, 4000);//3秒后执行Runnable中的run方法 @@ -2042,9 +2119,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } else { setHideMedalIcon(false); } - - getIsHot(); - getGuardInfo(); + if (IMLoginManager.get(mContext).getUserInfo().anchorUserType()) { + getIsHot(); + getGuardInfo(); + } } private void getGuardInfo() { @@ -2060,6 +2138,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); } + /** + * 旧接口,主播端还在用这个,暂时保留,用户端用{@link #setGuardIcon(GuardUserModel)} + */ + @Deprecated private void setGuardIcon(LiveUserGiftBean guard) { if (guard != null) { nowGuardUser = guard; @@ -2072,6 +2154,21 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } + /** + * 接口整合守护展示,用户端使用 + */ + public void setGuardIcon(GuardUserModel model) { + if (model != null && !TextUtils.isEmpty(model.getGuardUserAvatar())) { + guardUserModel = model; + ViewGroup.LayoutParams params = userGuard.getLayoutParams(); + params.height = DpUtil.dp2px(30); + params.width = DpUtil.dp2px(30); + userGuard.setLayoutParams(params); + ImgLoader.displayAvatar(mContext, model.getGuardUserAvatar(), userGuard); + gift_svga.setVisibility(View.VISIBLE); + } + } + /** * 守护信息发生变化 @@ -2310,11 +2407,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void callback(Integer isAttention) { if (isAttention == 1) { - mFirebaseAnalytics.logEvent("FS_Follow", null); - logger.logEvent("FB_Follow", null); - AdjustEvent adjustEvent1 = new AdjustEvent("oess6a"); - Adjust.trackEvent(adjustEvent1); -// SocketChatUtil.sendSystemMessage(mLiveUid, CommonAppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor)); LiveActivity.sendSystemMessage( CommonAppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor)); } @@ -2532,6 +2624,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis tmp = chatBean; } setGuardIcon(tmp); + if (mContext instanceof LiveAudienceActivity) { + int type = 0; + GuardUserModel model = new GuardUserModel(); + if (TextUtils.isEmpty(guardUserModel.getGuardType())) { + type = Integer.parseInt(guardUserModel.getGuardType()); + } + if (chatBean.getGuardType() != 0 && chatBean.getGuardType() > type) { + model.setGuardType(String.valueOf(chatBean.getGuardType())); + model.setGuardUserAvatar(chatBean.getAvatar()); + } + setGuardIcon(model); + } } } @@ -2643,6 +2747,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis ((LiveAudienceActivity) mContext).openFansMedalOkWindow(); } + if (!isAncher && bean.getGiftName().equals("粉絲牌")) { + LiveAudienceActivity.is_fans = "1"; + } Log.i("tvss", bean.getDrpk_status() + "是" + mLiveUid + "vsss" + bean.getRoomnum()); if (mLiveGiftAnimPresenter == null) { mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager); @@ -2681,12 +2788,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * @param bean */ public void showBuyVipMessage(LiveReceiveGiftBean bean) { -// if (mLiveGiftAnimPresenter == null) { -// mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager); -// } -// mLiveGiftAnimPresenter.showBuyVipGiftAnim(bean); - + noble.setVisibility(View.VISIBLE); switch (bean.getNobilityid()) { + case "1": noble.setRootView(bean.getUhead(), bean.getUname(), @@ -2923,12 +3027,31 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); } + /** + * 获取是否有热度卡加成 + */ + public static void getIsHot(String isUseHotCard) { + ImgLoader.display2(Contexts, "https://downs.yaoulive.com/img_hot_gif.gif", img_hot_gif); + if ("1".equals(isUseHotCard)) { + ft_hot_add.setVisibility(View.VISIBLE); + } else { + ft_hot_add.setVisibility(View.GONE); + } + + } + public void resetUserListWidth(int width) { ViewGroup.LayoutParams params = mUserRecyclerView.getLayoutParams(); params.width = width; mUserRecyclerView.setLayoutParams(params); } + public void releaseGift() { + if (mLiveGiftAnimPresenter != null) { + mLiveGiftAnimPresenter.cancelAllAnim(); + } + } + public void release() { EventBus.getDefault().unregister(this); LiveHttpUtil.cancel(LiveHttpConsts.GET_USER_LIST); @@ -2949,6 +3072,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } mRefreshUserListCallback = null; mTimeChargeCallback = null; + Contexts = null; } public void clearData() { @@ -3093,59 +3217,56 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis /** * 初始化新人任务 */ - private void configBanner3() { - LiveHttpUtil.getFrontTask(IMLoginManager.get(mContext).getUserInfo().getToken(), "" + IMLoginManager.get(mContext).getUserInfo().getId(), new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - JSONObject old_obj = JSON.parseObject(info[0]); + public void configBanner3(NewPeopleTaskModel newPeopleTask) { + TaskModel taskModel = newPeopleTask.getTask(); - JSONObject obj = old_obj.getJSONObject("task"); - if (obj != null) { - JSONObject obj1 = old_obj.getJSONObject("gift"); - JSONObject reward_one = old_obj.getJSONObject("reward_one"); + if (taskModel != null) { + GiftModel giftModel = newPeopleTask.getGift(); + if (giftModel != null) { + RewardAllModel rewardOne = newPeopleTask.getRewardOne(); + String gold = rewardOne.getGold(); + String experience = rewardOne.getExperience(); + bean1 = new LiveGiftBean(); + bean1.setSwf(giftModel.getSwf()); + bean1.setChecked(false); + bean1.setIcon(giftModel.getGifticon()); + bean1.setId(Integer.parseInt(giftModel.getId())); + bean1.setName(giftModel.getGiftname()); + bean1.setTag("1"); - String gold = reward_one.getString("gold"); - String experience = reward_one.getString("experience"); - bean1 = new LiveGiftBean(); - bean1.setSwf(obj1.getString("swf")); - bean1.setChecked(false); - bean1.setIcon(obj1.getString("gifticon")); - bean1.setId(obj1.getIntValue("id")); - bean1.setName(obj1.getString("giftname")); - bean1.setTag("1"); - - if (IMLoginManager.get(mContext).isisNewUserOne() == false) { - if (obj.getString("sendgift").equals("0")) { - IMLoginManager.get(mContext).setNewUserGif(true); - EventBus.getDefault().post("svga_new_user_gif"); - } - } - BannerBean banner3Bean = new BannerBean(); - banner3Bean.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); - banner3Bean.setLink(obj.getString("sendgift")); - mBannerList3.add(banner3Bean); - - - BannerBean banner3Bean1 = new BannerBean(); - banner3Bean1.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); - banner3Bean1.setLink(obj.getString("attent")); - mBannerList3.add(banner3Bean1); - - BannerBean banner3Bean2 = new BannerBean(); - banner3Bean2.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); - banner3Bean2.setLink(obj.getString("illumine")); - mBannerList3.add(banner3Bean2); - - if (obj.getString("sendgift").equals("0") && !IMLoginManager.get(mContext).isisNewUserOne()) { - showBanner3(bean1); - } else if (obj.getString("attent").equals("0") && !IMLoginManager.get(mContext).isisNewUserOne()) { - showBanner3(bean1); - } else if (obj.getString("illumine").equals("0") && !IMLoginManager.get(mContext).isisNewUserOne()) { - showBanner3(bean1); + if (!IMLoginManager.get(mContext).isisNewUserOne()) { + if (TextUtils.equals(taskModel.getSendgift(), "0")) { + IMLoginManager.get(mContext).setNewUserGif(true); + EventBus.getDefault().post("svga_new_user_gif"); } } + BannerBean banner3Bean = new BannerBean(); + banner3Bean.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); + banner3Bean.setLink(taskModel.getSendgift()); + mBannerList3.add(banner3Bean); + + + BannerBean banner3Bean1 = new BannerBean(); + banner3Bean1.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); + banner3Bean1.setLink(taskModel.getAttent()); + mBannerList3.add(banner3Bean1); + + BannerBean banner3Bean2 = new BannerBean(); + banner3Bean2.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); + banner3Bean2.setLink(taskModel.getIllumine()); + mBannerList3.add(banner3Bean2); + + if (TextUtils.equals(taskModel.getSendgift(), "0") && !IMLoginManager.get(mContext).isisNewUserOne()) { + showBanner3(bean1); + } else if (TextUtils.equals(taskModel.getAttent(), "0") && !IMLoginManager.get(mContext).isisNewUserOne()) { + showBanner3(bean1); + } else if (TextUtils.equals(taskModel.getIllumine(), "0") && !IMLoginManager.get(mContext).isisNewUserOne()) { + showBanner3(bean1); + } } - }); + + } + } /** @@ -3489,32 +3610,42 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 前往直播间 */ private void gotoLive(final String liveId) { + noble.setVisibility(View.GONE); LiveHttpUtil.getLiveInfo(liveId, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> { - if (liveBean1 == null) { - return; - } - if (LivePlayRyViewHolder.Micing == 1) { - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) - .setMicIng(1) - .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal)); - } else if (LivePlayRyViewHolder.Micing == 2) { - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) - .setMicIng(2) - .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal)); - } else { - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + if (liveBean == null) { + return; + } + if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) + .setMicIng(1) + .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(Integer.parseInt(liveTypeVal))); + } else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) + .setMicIng(2) + .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(Integer.parseInt(liveTypeVal))); + } else { + if (MicStatusManager.getInstance().isMic(liveUid)) { + MicStatusManager.getInstance().showDownMicDialog(mContext); + return; + } + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal))); + } } + @Override + public void onCheckError(String contextError) { + + } }); - mCheckLivePresenter.checkLive(liveBean); - } else { RouteUtil.forwardUserHome(mContext, liveId, 0); } diff --git a/live/src/main/java/com/yunbao/live/views/OlineListActivity.java b/live/src/main/java/com/yunbao/live/views/OlineListActivity.java index bffc3ee67..234afcd59 100644 --- a/live/src/main/java/com/yunbao/live/views/OlineListActivity.java +++ b/live/src/main/java/com/yunbao/live/views/OlineListActivity.java @@ -79,12 +79,14 @@ public class OlineListActivity extends AbsActivity { List audiencelistModels = new ArrayList<>(); List>> mapList = new ArrayList<>(); //讲贵族前置顺序 - for (OlineUserlistModel model : userlistModels) { - int nobleId = Integer.parseInt(model.getNobleId()); - if (nobleId > 0) { - noblelistModels.add(model); - } else { - audiencelistModels.add(model); + if (userlistModels != null) { + for (OlineUserlistModel model : userlistModels) { + int nobleId = Integer.parseInt(model.getNobleId()); + if (nobleId > 0) { + noblelistModels.add(model); + } else { + audiencelistModels.add(model); + } } } Map> noblerMap = new HashMap<>(); diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 7e1fa33e5..388557c48 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -1,14 +1,12 @@ package com.yunbao.live.views; -import static com.yunbao.common.CommonAppContext.logger; -import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; -import static com.yunbao.live.views.LivePlayRyViewHolder.Micing; import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive; import android.app.Activity; import android.app.Dialog; import android.content.Intent; import android.content.res.Configuration; +import android.graphics.drawable.AnimationDrawable; import android.os.CountDownTimer; import android.os.Handler; import android.text.TextUtils; @@ -23,24 +21,21 @@ import androidx.annotation.NonNull; import androidx.drawerlayout.widget.DrawerLayout; import androidx.viewpager.widget.PagerAdapter; -import com.adjust.sdk.Adjust; -import com.adjust.sdk.AdjustEvent; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; -import com.facebook.appevents.AppEventsLogger; import com.lzf.easyfloat.EasyFloat; import com.lzf.easyfloat.permission.PermissionUtils; import com.lzf.easyfloat.utils.LifecycleUtils; -import com.tencent.imsdk.v2.V2TIMCallback; -import com.tencent.imsdk.v2.V2TIMManager; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.BannerBean; +import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.bean.LiveRoomActivityModel; +import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.UserBean; @@ -52,9 +47,11 @@ import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.RandomUtil; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; @@ -73,9 +70,7 @@ import com.yunbao.live.bean.LiveGuardInfo; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; -import com.yunbao.live.bean.LiveUserGiftBean; import com.yunbao.live.bean.OpenParametersModel; -import com.yunbao.live.bean.WishlistModel; import com.yunbao.live.dialog.BlowkissDialog; import com.yunbao.live.dialog.NewUserDialog; import com.yunbao.live.event.LinkMicTxAccEvent; @@ -128,7 +123,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe private ImageView btnSmallScreen; private Intent mIntent; //直播间背景 - private ImageView liveBack; + private ImageView liveBack, ivBg, ivLoading; private View mask; //侧滑布局 @@ -136,12 +131,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe //直播间拆分布局 private LiveRoomPlayViewHolder mLivePlayViewHolder; //头部布局 - private LiveRoomViewHolder mLiveRoomViewHolder; + public LiveRoomViewHolder mLiveRoomViewHolder; //底部布局 public LiveAudienceViewHolder mLiveAudienceViewHolder; //观众与主播连麦逻辑 private LiveLinkMicPresenter mLiveLinkMicPresenter; private LiveBean mLiveBean; + //sdk类型 0金山 1腾讯 private int mLiveSDK; //主播与主播连麦逻辑 @@ -186,6 +182,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe private boolean isEnterRoom = false; private boolean kick = false; + private View loading; + + private int landscape; + private String leaveStream = "", leaveGroupId = ""; + public PortraitLiveManager setQuitF(boolean quitF) { isQuitF = quitF; return this; @@ -207,6 +208,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe playContainer = mRootContainer.findViewById(R.id.play_container); mViewPager = mRootContainer.findViewById(R.id.viewPager); btnSmallScreen = mRootContainer.findViewById(R.id.btn_small_screen); + loading = mRootContainer.findViewById(R.id.loading); + ivBg = mRootContainer.findViewById(R.id.iv_bg); + ivLoading = mRootContainer.findViewById(R.id.iv_loading); mSecondPage = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.view_audience_page, mViewPager, false); mContainerWrap = mSecondPage.findViewById(R.id.container_wrap); mContainer = mSecondPage.findViewById(R.id.container); @@ -223,8 +227,21 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe //直播页面背景 liveBack = mRootContainer.findViewById(R.id.live_back); mask = mRootContainer.findViewById(R.id.mask); + MicStatusManager.getInstance().addOnMicListener(micStatusListener); } + private final MicStatusManager.OnMicStatusListener micStatusListener = new MicStatusManager.OnMicStatusListener() { + @Override + public void onStart() { + mViewPager.setCanScroll(false); + } + + @Override + public void onClose() { + mViewPager.setCanScroll(true); + } + }; + @Override public synchronized void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) { isEnterRoom = false; @@ -243,8 +260,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe .setParametersModel(openParametersModel .setmLiveType(mLiveType) .setmLiveTypeVal(mLiveTypeVal))); + loading.setVisibility(View.VISIBLE); + ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), ivBg); + AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground(); + frameAnimation.start(); if (mLivePlayViewHolder == null) { - mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, mLiveBean.getLandscape()); + mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1); mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager()); mLiveAudienceViewHolder = new LiveAudienceViewHolder(mContext, mContainer); mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView()); @@ -257,19 +278,34 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.addToParent(); mLiveAudienceViewHolder.subscribeActivityLifeCycle(); } else { - mLivePlayViewHolder.setLiveBeanLandscape(mLiveBean.getLandscape()); + mLivePlayViewHolder.setLiveBeanLandscape(1); mLiveLinkMicPresenter.setLiveSdk(mLiveSDK); mLiveLinkMicAnchorPresenter.setLiveSdk(mLiveSDK); - + } + //去除主播离开画面 + if (LivePlayKsyViewHolder.leave != null) { + LivePlayKsyViewHolder.leave.setVisibility(View.GONE); + } + if (LivePlayRyViewHolder.leave != null) { + LivePlayRyViewHolder.leave.setVisibility(View.GONE); } //直播间背景 + ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack, 400, 600); - //ImageLoadUtils.loadUrlToBlur(mContext,mLiveBean.getAvatar(),400,600,liveBack); + mask.setVisibility(View.VISIBLE); - mLivePlayViewHolder.setCover(data.getThumb()); - mLivePlayViewHolder.play(data.getPull()); + mLivePlayViewHolder.setLiveBean(mLiveBean); + mLivePlayViewHolder.setCover(mLiveBean.getAvatar()); + mLivePlayViewHolder.play(mLiveBean.getPull()); + mLivePlayViewHolder.setOnMicCallback(new LiveRoomPlayViewHolder.OnMicCallback() { + @Override + public void onMikUpdate() { + if (mContext instanceof LiveActivity) { + ((LiveActivity) mContext).showMicList(mLiveBean.getUid(), mLiveRoomViewHolder); + } + } + }); mLiveRoomViewHolder.resetView(); - mLiveRoomViewHolder.clearChat(); mLiveRoomViewHolder.setAvatar(data.getAvatar()); mLiveRoomViewHolder.setAnchorLevel(data.getLevelAnchor()); mLiveRoomViewHolder.setName(data.getUserNiceName()); @@ -277,50 +313,273 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.setTitle(data.getTitle()); mLiveRoomViewHolder.setAnchorGoodNumber(data.getGoodNum()); mLiveRoomViewHolder.clearGuardIcon(); - + mLiveRoomViewHolder.clearChat(); + mLiveRoomViewHolder.releaseGift(); mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), ""); - - mLiveRoomViewHolder.setLiveUid(data.getUid()); - mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), PortraitLiveManager.this); if (mLiveLinkMicPresenter != null) { mLiveLinkMicPresenter.setSocketClient(mSocketClient); } - //心愿单 - LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (info.length > 0) { - String json = info[0]; - WishlistModel model = GsonUtils.fromJson(json, WishlistModel.class); - if (mLiveRoomViewHolder != null && model != null && model.getWishlist().size() > 0) { - BannerBean bannerModel = new BannerBean(); - bannerModel.setShow_type("2"); - bannerModel.setLink(CommonAppConfig.HOST + "/index.php"); - bannerModel.setImageUrl(model.getImg()); - mLiveRoomViewHolder.addWishList(bannerModel); - - } - - } - } - - @Override - public void onFinish() { - - - } - }); - enterRoom(); - mLiveRoomViewHolder.initHourRankList(); - mLiveRoomViewHolder.showLiveRoomActivityBanner(); + enterRoomNew(); } }); } + private Runnable sendFIm = new Runnable() { + @Override + public void run() { + //加入房间发送Im消息 + LiveNetManager.get(mContext).userJoinRoomNew(mLiveBean.getStream(), mLiveBean.getUid()); + } + }; + + /** + * 新进入房间接口 + */ + private void enterRoomNew() { + timeIndex = 0; + LiveNetManager.get(mContext) + .enterRoomNew(mLiveBean.getStream(), mLiveBean.getUid(), mLiveBean.getCity(), new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(EnterRoomNewModel data) { + + isEnterRoom = true; + if (TextUtils.isEmpty(leaveStream)) { + leaveStream = mLiveBean.getStream(); + leaveGroupId = mLiveBean.getUid(); + } + landscape = data.getLiveInfo().getLandscape(); + mLivePlayViewHolder.setLiveBeanLandscape(landscape); + //是否热度卡加成 + liveHandler.postDelayed(() -> mLiveRoomViewHolder.getIsHot(data.getIsUseHotCard()), 700); + + //延时1秒发送 + liveHandler.postDelayed(sendFIm, 700); + + //新人任務 + mLiveRoomViewHolder.configBanner3(data.getNewPeopleTask()); + //小时榜 + mLiveRoomViewHolder.initHourRank(data.getRankHour()); + //守护 + mLiveRoomViewHolder.setGuardIcon(data.getGuardUserAvatar()); + //在线列表 + mLiveRoomViewHolder.setUserList(data.getEnterRoomInfo().getUserlists()); + List bannerBeans = new ArrayList<>(); + //心愿单 + if (data.getWishList().getWishList().size() > 0) { + BannerBean bannerModel = new BannerBean(); + bannerModel.setShow_type("2"); + bannerModel.setLink(CommonAppConfig.HOST + "/index.php"); + bannerModel.setImageUrl(data.getWishList().getImg()); + bannerBeans.add(bannerModel); + } + //活动列表 + if (data.getLiveRoomActivityModels().size() > 0) { + + for (LiveRoomActivityModel model : data.getLiveRoomActivityModels()) { + BannerBean bannerModel = new BannerBean(); + bannerModel.setShow_type(model.getShowType()); + bannerModel.setStart(false); + bannerModel.setLink(model.getLink()); + bannerModel.setImageUrl(model.getImg()); + if (TextUtils.equals(model.getIsHidden(), "0")) { + bannerBeans.add(bannerModel); + } + + } + + } + //底部轮播 + mLiveRoomViewHolder.addWishListActivity(bannerBeans); + //直播间上部轮播【新人特惠】【趣味游戏】【幸运天使】 轮播接口 + mLiveRoomViewHolder.showLiveRoomActivityBanner(); + //兼容老接口数据 + mDanmuPrice = data.getEnterRoomInfo().getBarrageFee(); + mSocketUserType = Integer.parseInt(data.getEnterRoomInfo().getUsertype()); + mChatLevel = Integer.parseInt(data.getEnterRoomInfo().getSpeakLimit()); + mDanMuLevel = Integer.parseInt(data.getEnterRoomInfo().getBarrageLimit()); + + leave = Integer.parseInt(data.getEnterRoomInfo().getIsleave()); + if (!data.getEnterRoomInfo().getGreetings().isEmpty()) { + greetings = data.getEnterRoomInfo().getGreetings(); + } + if (!TextUtils.isEmpty(data.getEnterRoomInfo().getLiveBg())) { + if (liveBg == 0) { + + //直播间背景 + ImgLoader.display(mContext, R.mipmap.live_bg, liveBack); + mask.setVisibility(View.GONE); + } + } else { + liveBg = -1; + } + //回传参数 + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) + .setParametersModel(openParametersModel.setmDanmuPrice(mDanmuPrice) + .setmSocketUserType(mSocketUserType) + .setmChatLevel(mChatLevel) + .setmDanMuLevel(mDanMuLevel) + .setLiveBg(liveBg))); + //数据设置 + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), Integer.parseInt(data.getEnterRoomInfo().getUserlistTime()) * 4000); + mLiveRoomViewHolder.setFastMessage(greetings); + mLiveRoomViewHolder.setVotes(data.getEnterRoomInfo().getVotestotal()); + //真爱排行 数量 + mLiveRoomViewHolder.setMedaRankNum(data.getEnterRoomInfo().getMedalRankNum()); + isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention()); + if (isattention == 0) { + if (countDownTimer != null) { + countDownTimer.cancel(); + timeIndex = 0; + countDownTimer = null; + setTime(); + } else { + setTime(); + } + } else { + if (countDownTimer != null) { + countDownTimer.cancel(); + countDownTimer = null; + } + } + mLiveAudienceViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), mLiveBean.getAvatar(), isattention); + mLiveRoomViewHolder.setAttention(isattention); + List list = data.getEnterRoomInfo().getUserlists(); + mLiveRoomViewHolder.setUserList(list); + mLiveRoomViewHolder.startRefreshUserList(); + if (mLiveType == Constants.LIVE_TYPE_TIME) {//计时收费 + mLiveRoomViewHolder.startRequestTimeCharge(); + } + } + + if (leave == 1) { + if (LivePlayRyViewHolder.leave != null) { + LivePlayRyViewHolder.leave.setVisibility(View.VISIBLE); + } + } + //判断是否有连麦,要显示连麦窗口 + String linkMicUid = data.getEnterRoomInfo().getLinkmicUid(); + String linkMicPull = data.getEnterRoomInfo().getLinkmicPull(); + if (!TextUtils.isEmpty(linkMicUid) && !"0".equals(linkMicUid) && !TextUtils.isEmpty(linkMicPull)) { + if (mLiveSDK != Constants.LIVE_SDK_TX && mLiveLinkMicPresenter != null) { + mLiveLinkMicPresenter.onLinkMicPlay(linkMicUid, linkMicPull); + } + } + + //判断是否有主播连麦 + pkInfo = JSON.parseObject(GsonUtils.toJson(data.getEnterRoomInfo().getPkinfo())); + if (pkInfo != null && pkInfo.getIntValue("drpk_status") != 1) { + String pkUid = pkInfo.getString("pkuid"); + anyway = "1"; + if (!TextUtils.isEmpty(pkUid) && !"0".equals(pkUid) && anyway.equals("0")) { + if (mLiveSDK != Constants.LIVE_SDK_TX) { + String pkPull = pkInfo.getString("pkpull"); + if (!TextUtils.isEmpty(pkPull) && mLiveLinkMicAnchorPresenter != null) { + mLiveLinkMicAnchorPresenter.onLinkMicAnchorPlayUrl(pkUid, pkPull); + } + } else { + if (mLivePlayViewHolder instanceof LivePlayTxViewHolder) { + ((LivePlayTxViewHolder) mLivePlayViewHolder).setAnchorLinkMic(true, 0); + } + } + } + + if (data.getEnterRoomInfo().getIsconnection() != null && data.getEnterRoomInfo().getIsconnection().equals("1")) { + + LivePlayRyViewHolder.setViewUP(1); + + } + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.pkHandler = false; + } + if (pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了 + + LivePlayRyViewHolder.setViewUP(2); + + //pk排名数据 + LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.pkHandler = true; + mLiveRoomViewHolder.setOtherInfo(pkInfo.getString("pkuid"), pkInfo.getString("pkuimg"), pkInfo.getString("pkuname")); + } + mLiveRyLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean); + } else if (!pkInfo.getString("end_pk_time").equals("0")) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.pkHandler = true; + mLiveRoomViewHolder.initPkRank(null); + } + LivePlayRyViewHolder.setViewUP(3); + + //pk排名数据 + LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); + mLiveRyLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean); + } else { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.initPkRank(null); + } + } + //多人PK + } else if (pkInfo != null && pkInfo.getIntValue("drpk_status") == 1) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.initPkRank(null); + } + LivePlayRyViewHolder.setViewUP(4); + + mLiveRoomViewHolder.UpPkBar(pkInfo.getJSONArray("userlist"), mLiveBean.getUid(), pkInfo.getIntValue("drpk_time")); + } + //守护相关 + mLiveGuardInfo = new LiveGuardInfo(); + int guardNum = Integer.parseInt(data.getEnterRoomInfo().getGuardNums()); + fansNum = Integer.parseInt(data.getEnterRoomInfo().getCountFans()); + is_fans = data.getEnterRoomInfo().getIsFans(); + mLiveGuardInfo.setGuardNum(guardNum); + JSONObject guardObj = JSONObject.parseObject(GsonUtils.toJson(data.getEnterRoomInfo().getGuard())); + if (guardObj != null) { + mLiveGuardInfo.setMyGuardType(guardObj.getIntValue("type")); + mLiveGuardInfo.setMyGuardEndTime(guardObj.getString("endtime")); + } + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) + .setParametersModel(openParametersModel.setmLiveGuardInfo(mLiveGuardInfo) + .setFansNum(fansNum) + .setIs_fans(is_fans))); + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.setGuardNum(guardNum); + mLiveRoomViewHolder.setFansNum(fansNum); + //红包相关 + mLiveRoomViewHolder.setRedPackBtnVisible(Integer.parseInt(data.getEnterRoomInfo().getIsred()) == 1); + } + + //奖池等级 + int giftPrizePoolLevel = Integer.parseInt(data.getEnterRoomInfo().getJackpotLevel()); + if (giftPrizePoolLevel >= 0) { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel)); + } + } + liveHandler.postDelayed(() -> loading.setVisibility(View.GONE), 700); + + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + //直播间上部轮播【新人特惠】【趣味游戏】【幸运天使】 轮播接口 + mLiveRoomViewHolder.showLiveRoomActivityBanner(); + } + }); + if (mContext instanceof LiveActivity) { + ((LiveActivity) mContext).showMicList(mLiveBean.getUid(), mLiveRoomViewHolder); + } + } + + public void removeLiveEnd() { if (mLiveAudienceViewHolder != null) { + mLiveAudienceViewHolder.removeFromParent(); mLiveAudienceViewHolder.removeCallbacks(); mLiveAudienceViewHolder.release(); @@ -351,6 +610,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onRemove(boolean isQuit) { + LiveNetManager.get(mContext).cancelLive(); + liveHandler.removeCallbacks(sendFIm); LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE); LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM); LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE); @@ -358,8 +619,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe CommonHttpUtil.cancel(LiveHttpConsts.GET_WISH_LIST); IMLoginManager.get(mContext).setisNewUserOne(false); //子线程执行退出操作 - exitLiveRoom(false); - + exitLiveRoom(isEnterRoom); + if (mLiveAudienceViewHolder != null) { + mLiveAudienceViewHolder.removeCallbacks(); + } //断开socket @@ -446,8 +709,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onResume() { -// if (mLivePlayViewHolder != null) -// mLivePlayViewHolder.onResume(); //判断是否有直播悬浮窗,有直接关闭 if (EasyFloat.isShow("LiveFloatView")) { EasyFloat.dismiss("LiveFloatView", true); @@ -474,7 +735,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onDestroy() { - + MicStatusManager.getInstance().removeOnMicListener(micStatusListener); + mContext = null;//上下文置空防止内存泄漏 } @Override @@ -504,7 +766,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe DialogUitl.showSimpleDialog(mContext, null, "您已申請,退出將取消語音連麥申請!", false, new DialogUitl.SimpleCallback3() { @Override public void onConfirmClick(Dialog dialog) { - Micing = 0; + MicStatusManager.getInstance().clear(); //用户申请联麦 final SocketSendBean msg = new SocketSendBean() .param("_method_", Constants.LIAN_MAI) @@ -597,7 +859,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe Log.e("ry", "退出多人房间成功"); if (isBackPressed) { - Micing = 0; + MicStatusManager.getInstance().clear(); ((LiveAudienceActivity) mContext).closeRoom(); } else { EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal)); @@ -627,7 +889,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onCancel() { - ((LiveAudienceActivity) mContext).setEnableScroll(true); + // ((LiveAudienceActivity) mContext).setEnableScroll(true); } }); @@ -975,6 +1237,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe }, 4000);//3秒后执行Runnable中的run方法 } + if (mLivePlayViewHolder != null) { + mLivePlayViewHolder.setLiveBeanLandscape(1); + } } @Override @@ -982,6 +1247,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe if (mLiveRyLinkMicPkPresenter != null) { mLiveRyLinkMicPkPresenter.onLinkMicPkClose(i); + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.resetViewGone(); + } + } + if (mLiveRoomViewHolder != null) { + mLivePlayViewHolder.setLiveBeanLandscape(landscape); } } @@ -1006,6 +1277,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRyLinkMicPkPresenter.onLinkMicPkEnd(winUid); mLiveRoomViewHolder.setDelOtherInfo(); } + if (mLiveRoomViewHolder != null) { + mLivePlayViewHolder.setLiveBeanLandscape(landscape); + } } @Override @@ -1104,246 +1378,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe }; - private void enterRoom() { - //进入直播间IM - - - timeIndex = 0; - LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - isEnterRoom = true; - if (code == 0 && info.length > 0) { - JSONObject obj = JSON.parseObject(info[0]); - mDanmuPrice = obj.getString("barrage_fee"); - mSocketUserType = obj.getIntValue("usertype"); - mChatLevel = obj.getIntValue("speak_limit"); - mDanMuLevel = obj.getIntValue("barrage_limit"); - liveBg = obj.getIntValue("live_bg"); - leave = obj.getInteger("isleave"); - if (obj.containsKey("greetings")) { - greetings = JSONArray.parseArray(obj.getJSONArray("greetings").toJSONString(), String.class); - } - if (obj.containsKey("live_bg")) { - if (liveBg == 0) { - - //直播间背景 - ImgLoader.display(mContext, R.mipmap.live_bg, liveBack); - mask.setVisibility(View.GONE); - } - } - //回传参数 - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) - .setParametersModel(openParametersModel.setmDanmuPrice(mDanmuPrice) - .setmSocketUserType(mSocketUserType) - .setmChatLevel(mChatLevel) - .setmDanMuLevel(mDanMuLevel) - .setLiveBg(liveBg))); - - - //进入直播间 - AdjustEvent adjustEvent1 = new AdjustEvent("hiepcu"); - Adjust.trackEvent(adjustEvent1); - mFirebaseAnalytics.logEvent("FS_enterroom", null); - logger.logEvent("FB_enterroom"); - - AdjustEvent adjustEvent2 = new AdjustEvent("unutgg"); - Adjust.trackEvent(adjustEvent2); - CommonHttpUtil.setAdvertisingChannels("unutgg", new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - mFirebaseAnalytics.logEvent("FS_first_Enterroom", null); - AppEventsLogger.newLogger(mContext).logEvent("FB_first_Enterroom"); - } - } - }); - - //观看1分钟 - if (obj.getLongValue("see_time") >= 60) { - AdjustEvent good_user = new AdjustEvent("7zxuxz"); - Adjust.trackEvent(good_user); - CommonHttpUtil.setAdvertisingChannels("7zxuxz", new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - mFirebaseAnalytics.logEvent("FS_enter_app_1min", null); - logger.logEvent("FB_enter_app_1min", null); - } - } - }); - } - if (obj.getLongValue("see_time") >= 600 && obj.getIntValue("un_charge") == 1) { - AdjustEvent good_user = new AdjustEvent("val8lv"); - Adjust.trackEvent(good_user); - CommonHttpUtil.setAdvertisingChannels("val8lv", new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - mFirebaseAnalytics.logEvent("FS_good_user", null); - logger.logEvent("FB_good_user", null); - } - } - }); - - //有效用户 - } else if (obj.getLongValue("see_time") >= 600) { - AdjustEvent valid_user = new AdjustEvent("xuf8ep"); - Adjust.trackEvent(valid_user); - CommonHttpUtil.setAdvertisingChannels("xuf8ep", new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - mFirebaseAnalytics.logEvent("FS_Valid_user", null); - logger.logEvent("FB_Valid_user", null); - } - } - }); - } - //连接socket - LiveHttpUtil.enterBackRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - //链接上socket以后隐藏Loading加载直播间内容 - } - }); - if (mLiveRoomViewHolder != null) { - LivePlayKsyViewHolder.setLandscape(obj.getIntValue("landscape")); - - mLiveRoomViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), obj.getIntValue("userlist_time") * 4000); - mLiveRoomViewHolder.setFastMessage(greetings); - mLiveRoomViewHolder.setVotes(obj.getString("votestotal")); - //真爱排行 数量 - mLiveRoomViewHolder.setMedaRankNum(obj.getString("medalRankNum")); - isattention = obj.getIntValue("isattention"); - if (isattention == 0) { - if (countDownTimer != null) { - countDownTimer.cancel(); - timeIndex = 0; - countDownTimer = null; - setTime(); - } else { - setTime(); - } - } else { - if (countDownTimer != null) { - countDownTimer.cancel(); - countDownTimer = null; - } - } - mLiveAudienceViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), mLiveBean.getAvatar(), isattention); - mLiveRoomViewHolder.setAttention(isattention); - if (obj.containsKey("lminfo")) { - JSONObject mic_data = obj.getJSONObject("lminfo"); - if (mic_data.containsKey("userlist")) { - mLiveRoomViewHolder.updataMicList(mic_data.getJSONArray("userlist")); - } - } - List list = JSON.parseArray(obj.getString("userlists"), LiveUserGiftBean.class); - mLiveRoomViewHolder.setUserList(list); - // resetUserListWidth(list); - mLiveRoomViewHolder.startRefreshUserList(); - if (mLiveType == Constants.LIVE_TYPE_TIME) {//计时收费 - mLiveRoomViewHolder.startRequestTimeCharge(); - } - } - if (leave == 1) { - if (LivePlayRyViewHolder.leave != null) { - LivePlayRyViewHolder.leave.setVisibility(View.VISIBLE); - } - } - //判断是否有连麦,要显示连麦窗口 - String linkMicUid = obj.getString("linkmic_uid"); - String linkMicPull = obj.getString("linkmic_pull"); - if (!TextUtils.isEmpty(linkMicUid) && !"0".equals(linkMicUid) && !TextUtils.isEmpty(linkMicPull)) { - if (mLiveSDK != Constants.LIVE_SDK_TX && mLiveLinkMicPresenter != null) { - mLiveLinkMicPresenter.onLinkMicPlay(linkMicUid, linkMicPull); - } - } - //判断是否有主播连麦 - pkInfo = JSON.parseObject(obj.getString("pkinfo")); - if (pkInfo != null && pkInfo.getIntValue("drpk_status") != 1) { - String pkUid = pkInfo.getString("pkuid"); - anyway = "1"; - if (!TextUtils.isEmpty(pkUid) && !"0".equals(pkUid) && anyway.equals("0")) { - if (mLiveSDK != Constants.LIVE_SDK_TX) { - String pkPull = pkInfo.getString("pkpull"); - if (!TextUtils.isEmpty(pkPull) && mLiveLinkMicAnchorPresenter != null) { - mLiveLinkMicAnchorPresenter.onLinkMicAnchorPlayUrl(pkUid, pkPull); - } - } else { - if (mLivePlayViewHolder instanceof LivePlayTxViewHolder) { - ((LivePlayTxViewHolder) mLivePlayViewHolder).setAnchorLinkMic(true, 0); - } - } - } - - if (obj.getString("isconnection") != null && obj.getString("isconnection").equals("1")) { - - LivePlayRyViewHolder.setViewUP(1); - - } - if (pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了 - - LivePlayRyViewHolder.setViewUP(2); - - //pk排名数据 - LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); - if (mLiveRoomViewHolder != null) { - mLiveRoomViewHolder.setOtherInfo(pkInfo.getString("pkuid"), pkInfo.getString("pkuimg"), pkInfo.getString("pkuname")); - } - mLiveRyLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean); - } else if (!pkInfo.getString("end_pk_time").equals("0")) { - - LivePlayRyViewHolder.setViewUP(3); - - //pk排名数据 - LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); - mLiveRyLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean); - } - //多人PK - } else if (pkInfo != null && pkInfo.getIntValue("drpk_status") == 1) { - - LivePlayRyViewHolder.setViewUP(4); - - mLiveRoomViewHolder.UpPkBar(pkInfo.getJSONArray("userlist"), mLiveBean.getUid(), pkInfo.getIntValue("drpk_time")); - } - - //守护相关 - mLiveGuardInfo = new LiveGuardInfo(); - int guardNum = obj.getIntValue("guard_nums"); - fansNum = obj.getIntValue("count_fans"); - is_fans = obj.getString("is_fans") + ""; - mLiveGuardInfo.setGuardNum(guardNum); - JSONObject guardObj = obj.getJSONObject("guard"); - if (guardObj != null) { - mLiveGuardInfo.setMyGuardType(guardObj.getIntValue("type")); - mLiveGuardInfo.setMyGuardEndTime(guardObj.getString("endtime")); - } - Bus.get().post(new LiveAudienceEvent() - .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) - .setParametersModel(openParametersModel.setmLiveGuardInfo(mLiveGuardInfo) - .setFansNum(fansNum) - .setIs_fans(is_fans))); - if (mLiveRoomViewHolder != null) { - mLiveRoomViewHolder.setGuardNum(guardNum); - mLiveRoomViewHolder.setFansNum(fansNum); - //红包相关 - mLiveRoomViewHolder.setRedPackBtnVisible(obj.getIntValue("isred") == 1); - } - //奖池等级 - int giftPrizePoolLevel = obj.getIntValue("jackpot_level"); - if (giftPrizePoolLevel >= 0) { - if (mLiveRoomViewHolder != null) { - mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel)); - } - } - } - } - }); - } - //定时器 public CountDownTimer countDownTimer = null; private int timeIndex = 1; @@ -1468,55 +1502,63 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe * 退出直播间 */ public void exitLiveRoom(boolean isQuitF) { - if (mLiveBean == null && !isEnterRoom) { + if (!isEnterRoom) { return; } - RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveBean.getUid(), new IRongCoreCallback.OperationCallback() { - @Override - public void onSuccess() { - Log.i("tx", "退出成功"); - //连接socket - LiveHttpUtil.qBackRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (isQuitF) { - onRemove(true); - } + if (mLiveBean != null) { + isEnterRoom = false; - } - }); - } - - @Override - public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) { - - } - }); - - try { - V2TIMManager.getInstance().quitGroup("g" + mLiveBean.getUid(), new V2TIMCallback() { + RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveBean.getUid(), new IRongCoreCallback.OperationCallback() { @Override public void onSuccess() { + try { + Log.i("tx", "退出成功" + mLiveBean.getUid()); + LiveNetManager.get(mContext) + .leaveRoomNew(leaveStream, leaveGroupId, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(String data) { - Log.i("tx", "退出成功" + mLiveBean.getUid()); - //连接socket - LiveHttpUtil.qBackRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { + } + + @Override + public void onError(String error) { + } + }); + leaveStream = ""; + leaveGroupId = ""; + + } catch (Exception e) { + e.printStackTrace(); + } - } - }); } @Override - public void onError(int code, String desc) { - Log.i("tx", "退出失败"); + public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) { + try { + + Log.i("tx", "退出成功" + mLiveBean.getUid()); + LiveNetManager.get(mContext) + .leaveRoomNew(leaveStream, leaveGroupId, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(String data) { + } + + @Override + public void onError(String error) { + } + }); + leaveStream = ""; + leaveGroupId = ""; + } catch (Exception e) { + e.printStackTrace(); + } } }); - } catch (Exception e) { - e.printStackTrace(); + } + } @@ -1699,4 +1741,5 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public void setSecondPageEnableScroll(boolean enableScroll) { mViewPager.setCanScroll(enableScroll); } + } diff --git a/live/src/main/java/com/yunbao/live/views/SidebarViewHoler.java b/live/src/main/java/com/yunbao/live/views/SidebarViewHoler.java index 298edf6ed..4d4406f92 100644 --- a/live/src/main/java/com/yunbao/live/views/SidebarViewHoler.java +++ b/live/src/main/java/com/yunbao/live/views/SidebarViewHoler.java @@ -19,13 +19,10 @@ import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.views.SlideInBannerViewHolder; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; -import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; -import java.util.HashMap; import java.util.List; -import java.util.Map; public class SidebarViewHoler extends RecyclerView.ViewHolder { //侧边栏轮播 @@ -98,24 +95,25 @@ public class SidebarViewHoler extends RecyclerView.ViewHolder { public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(itemView.getContext(), (liveBean1, liveType, liveTypeVal, liveSdk) -> { - if (liveBean1 == null) { - if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing()) - mShowLoadingDialog.dismiss(); - return; - } - Map map = null; - if (type == 2) { - map = new HashMap<>(); - map.put("OPEN", "NEWUSER"); - } - LiveAudienceActivity.forward(itemView.getContext(), liveBean1, liveType, liveTypeVal, "", map, 0, liveSdk); + if (liveBean == null) { if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing()) mShowLoadingDialog.dismiss(); - ((Activity) itemView.getContext()).finish(); - }); - mCheckLivePresenter.checkLive(liveBean); + return; + } + new LiveRoomCheckLivePresenter(itemView.getContext(), liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + @Override + public void onCheckError(String contextError) { + + } + }); + if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing()) + mShowLoadingDialog.dismiss(); + ((Activity) itemView.getContext()).finish(); } else { if (mShowLoadingDialog != null && mShowLoadingDialog.isShowing()) mShowLoadingDialog.dismiss(); diff --git a/live/src/main/res/drawable/bg_live_anchor_open_mic.xml b/live/src/main/res/drawable/bg_live_anchor_open_mic.xml new file mode 100644 index 000000000..df73ed351 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_anchor_open_mic.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_mic_av.xml b/live/src/main/res/drawable/bg_live_mic_av.xml new file mode 100644 index 000000000..685fa0657 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_mic_av.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/activity_live_anchor.xml b/live/src/main/res/layout/activity_live_anchor.xml index eea5fe516..9d6bf5af3 100644 --- a/live/src/main/res/layout/activity_live_anchor.xml +++ b/live/src/main/res/layout/activity_live_anchor.xml @@ -1,19 +1,16 @@ - + android:background="@mipmap/live_bg"> + android:layout_height="match_parent" /> - + android:layout_height="match_parent" /> - + android:scaleType="centerCrop" /> + app:loopCount="1" /> + android:layout_height="match_parent" /> \ No newline at end of file diff --git a/live/src/main/res/layout/activity_live_audience.xml b/live/src/main/res/layout/activity_live_audience.xml index dbdb835bb..352e09a8e 100644 --- a/live/src/main/res/layout/activity_live_audience.xml +++ b/live/src/main/res/layout/activity_live_audience.xml @@ -1,6 +1,5 @@ @@ -53,6 +52,9 @@ android:visibility="gone" /> + \ No newline at end of file diff --git a/live/src/main/res/layout/anchor_open_mic_view.xml b/live/src/main/res/layout/anchor_open_mic_view.xml new file mode 100644 index 000000000..7d11c3aa3 --- /dev/null +++ b/live/src/main/res/layout/anchor_open_mic_view.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_anchor_mic_list.xml b/live/src/main/res/layout/dialog_anchor_mic_list.xml new file mode 100644 index 000000000..49a0d3d15 --- /dev/null +++ b/live/src/main/res/layout/dialog_anchor_mic_list.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_gift_wrap.xml b/live/src/main/res/layout/dialog_live_gift_wrap.xml index 05570e3d2..bfb498451 100644 --- a/live/src/main/res/layout/dialog_live_gift_wrap.xml +++ b/live/src/main/res/layout/dialog_live_gift_wrap.xml @@ -2,181 +2,196 @@ + - - - - - - - - - - + android:id="@+id/live_gift_download_all" + android:layout_width="155dp" + android:layout_height="32dp" + android:layout_alignParentStart="true" + android:layout_marginStart="12dp" + android:background="@drawable/bg_live_gift_download_all" + android:gravity="center" + android:orientation="horizontal" + android:visibility="invisible"> + + + - + android:gravity="center" + android:text="一鍵下載所有禮物動畫" + android:textSize="10sp" + android:visibility="visible" /> + - + + + + + + + + + + + + + + + android:orientation="horizontal"> + + android:layout_marginEnd="5dp" + android:layout_weight="1" /> - - + + + + android:layout_weight="1" /> - - - + android:layout_height="66dp" + android:layout_weight="0"> + + + + android:layout_height="match_parent" + android:layout_marginStart="10dp" + android:layout_marginEnd="10dp"> + + android:visibility="invisible" + app:tint="@color/global" /> + + android:layout_height="match_parent" + android:layout_marginBottom="5dp" + android:gravity="bottom" + android:layout_marginStart="20dp" + android:orientation="horizontal"> + + android:layout_height="match_parent" + android:orientation="vertical"> + diff --git a/live/src/main/res/layout/dialog_new_live_room_class.xml b/live/src/main/res/layout/dialog_new_live_room_class.xml index 90c572a97..754b35fb1 100644 --- a/live/src/main/res/layout/dialog_new_live_room_class.xml +++ b/live/src/main/res/layout/dialog_new_live_room_class.xml @@ -22,7 +22,7 @@ android:id="@+id/textView2" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="5dp" + android:layout_marginStart="10dp" android:layout_marginTop="10dp" android:text="@string/live_class_tip_title" android:textColor="#F6F7FB" @@ -37,11 +37,9 @@ android:layout_marginStart="10dp" android:layout_marginTop="8dp" - android:layout_marginEnd="10dp" android:text="@string/live_class_tip" android:textColor="#B3F6F7FB" android:textSize="14sp" - app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView2" /> diff --git a/live/src/main/res/layout/dialog_new_live_user.xml b/live/src/main/res/layout/dialog_new_live_user.xml index cfa62e07d..5e99717cd 100644 --- a/live/src/main/res/layout/dialog_new_live_user.xml +++ b/live/src/main/res/layout/dialog_new_live_user.xml @@ -156,6 +156,7 @@ android:layout_height="17dp" android:layout_marginTop="13dp" android:gravity="center" + android:layout_gravity="center" android:orientation="horizontal"> @@ -196,7 +196,6 @@ android:id="@+id/fans_val" android:layout_width="wrap_content" android:layout_height="match_parent" - android:paddingRight="10dp" android:textColor="#B1B1B1" android:textSize="13sp" /> @@ -213,7 +212,6 @@ android:id="@+id/praise_val" android:layout_width="wrap_content" android:layout_height="match_parent" - android:paddingRight="10dp" android:textColor="#B1B1B1" android:textSize="13sp" /> @@ -221,7 +219,7 @@ @@ -229,13 +227,13 @@ @@ -252,7 +250,7 @@ + android:visibility="gone"> + android:textSize="9sp" /> diff --git a/live/src/main/res/layout/dialog_user_more_list.xml b/live/src/main/res/layout/dialog_user_more_list.xml index f8f6de373..fa6551727 100644 --- a/live/src/main/res/layout/dialog_user_more_list.xml +++ b/live/src/main/res/layout/dialog_user_more_list.xml @@ -114,8 +114,8 @@ diff --git a/live/src/main/res/layout/item_anchor_mic_info.xml b/live/src/main/res/layout/item_anchor_mic_info.xml new file mode 100644 index 000000000..1c254dd47 --- /dev/null +++ b/live/src/main/res/layout/item_anchor_mic_info.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +