From a6b5c102d24ca99c57cc8790200100cd9eaab570 Mon Sep 17 00:00:00 2001
From: zlzw <583819556@qq.com>
Date: Wed, 10 May 2023 14:31:15 +0800
Subject: [PATCH 1/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E3=80=90=E9=9D=9E?=
=?UTF-8?q?=E8=B4=B5=E6=97=8F=EF=BC=8C=E5=AE=88=E6=8A=A4=EF=BC=8C=E7=B2=89?=
=?UTF-8?q?=E4=B8=9D=E7=89=8C=E9=80=81=E7=A4=BC=E4=BA=A4=E4=BA=92=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E3=80=91=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/yunbao/common/bean/LiveGiftBean.java | 2 +-
.../com/yunbao/common/utils/AppManager.java | 2 +-
.../com/yunbao/common/utils/DialogUitl.java | 11 +++--
.../com/yunbao/common/utils/VersionUtil.java | 8 ++--
common/src/main/res/values-en-rUS/string.xml | 12 ++++++
common/src/main/res/values-zh-rHK/strings.xml | 6 +++
common/src/main/res/values-zh-rTW/strings.xml | 6 +++
common/src/main/res/values-zh/strings.xml | 6 +++
common/src/main/res/values/strings.xml | 6 +++
config.gradle | 4 +-
.../live/activity/LiveAudienceActivity.java | 6 ++-
.../adapter/LiveUserAnchorMailBoxAdapter.java | 6 +--
.../live/dialog/LiveGiftDialogFragment.java | 42 +++++++++++++++++++
.../dialog/LiveNewGuardBuyDialogFragment.java | 4 +-
.../live/dialog/LiveUserDialogFragment.java | 11 +----
.../presenter/LiveRyLinkMicPkPresenter.java | 3 +-
.../live/views/LiveNewReadyRyViewHolder.java | 4 +-
.../live/views/LivePlayRyViewHolder.java | 13 +-----
.../live/views/LiveReadyRyViewHolder.java | 3 +-
.../live/views/LiveReadyViewHolder.java | 3 +-
20 files changed, 104 insertions(+), 54 deletions(-)
diff --git a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java
index 458f6a9ab..a1baad0a0 100644
--- a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java
+++ b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java
@@ -18,7 +18,7 @@ public class LiveGiftBean {
// public static final int MARK_LUCK = 3;
private int id;
- private int type;//0 普通礼物 1是豪华礼物
+ private int type;//0 普通礼物 1是贵族 2守护 3粉丝团
private int mark;// 0 普通 1热门 2守护 3幸运
private String name;
private String price;
diff --git a/common/src/main/java/com/yunbao/common/utils/AppManager.java b/common/src/main/java/com/yunbao/common/utils/AppManager.java
index 7101d3221..5bda4db57 100644
--- a/common/src/main/java/com/yunbao/common/utils/AppManager.java
+++ b/common/src/main/java/com/yunbao/common/utils/AppManager.java
@@ -121,7 +121,7 @@ public class AppManager {
*/
public static void runDebugCode(Runnable runnable) {
if (BuildConfig.DEBUG) {
- // runnable.run();
+ runnable.run();
}
}
diff --git a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java
index 0e40c91ba..347023335 100644
--- a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java
+++ b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java
@@ -8,7 +8,6 @@ import android.os.Handler;
import android.os.Looper;
import android.text.InputFilter;
import android.text.InputType;
-import android.text.Spanned;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.util.SparseArray;
@@ -331,7 +330,7 @@ public class DialogUitl {
private Context mContext;
private String mTitle;
private String mContent;
- private String mConfrimString;
+ private String mConfirmString;
private String mCancelString;
private boolean mCancelable;
private boolean mBackgroundDimEnabled;//显示区域以外是否使用黑色半透明背景
@@ -371,8 +370,8 @@ public class DialogUitl {
return this;
}
- public Builder setConfrimString(String confrimString) {
- mConfrimString = confrimString;
+ public Builder setConfirmString(String confirmString) {
+ mConfirmString = confirmString;
return this;
}
@@ -460,8 +459,8 @@ public class DialogUitl {
content.setFilters(new InputFilter[]{new InputFilter.LengthFilter(mLength)});
}
TextView btnConfirm = (TextView) dialog.findViewById(R.id.btn_confirm);
- if (!TextUtils.isEmpty(mConfrimString)) {
- btnConfirm.setText(mConfrimString);
+ if (!TextUtils.isEmpty(mConfirmString)) {
+ btnConfirm.setText(mConfirmString);
}
TextView btnCancel = (TextView) dialog.findViewById(R.id.btn_cancel);
if (!TextUtils.isEmpty(mCancelString)) {
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 6527c7fc4..0bea8f7e9 100644
--- a/common/src/main/java/com/yunbao/common/utils/VersionUtil.java
+++ b/common/src/main/java/com/yunbao/common/utils/VersionUtil.java
@@ -50,7 +50,7 @@ public class VersionUtil {
DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(context.getString(R.string.version_update))
.setContent(configBean.getUpdateDes())
- .setConfrimString(context.getString(R.string.version_immediate_use))
+ .setConfirmString(context.getString(R.string.version_immediate_use))
.setCancelString(context.getString(R.string.version_not_update))
.setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() {
@@ -81,7 +81,7 @@ public class VersionUtil {
DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(context.getString(R.string.version_update))
.setContent(configBean.getUpdateDes())
- .setConfrimString(context.getString(R.string.version_immediate_use))
+ .setConfirmString(context.getString(R.string.version_immediate_use))
.setCancelString(context.getString(R.string.version_not_update))
.setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() {
@@ -111,7 +111,7 @@ public class VersionUtil {
DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(context.getString(R.string.version_update))
.setContent(configBean.getUpdateDes())
- .setConfrimString(context.getString(R.string.version_immediate_use))
+ .setConfirmString(context.getString(R.string.version_immediate_use))
.setCancelString(context.getString(R.string.version_not_update))
.setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() {
@@ -134,7 +134,7 @@ public class VersionUtil {
DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(context.getString(R.string.version_update))
.setContent(configBean.getUpdateDes())
- .setConfrimString(context.getString(R.string.version_immediate_use))
+ .setConfirmString(context.getString(R.string.version_immediate_use))
.setCancelString(context.getString(R.string.version_not_update))
.setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() {
diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml
index 240b00fa7..4c3a07c0c 100644
--- a/common/src/main/res/values-en-rUS/string.xml
+++ b/common/src/main/res/values-en-rUS/string.xml
@@ -872,6 +872,7 @@ Limited ride And limited avatar frame
Activity
Basic tools
Effect settings
+ Font settings
Shield gift effect
Shield car effect
You are in the current live room
@@ -1125,6 +1126,11 @@ Limited ride And limited avatar frame
Where is the host doing badly~\nBrother, are you sure you want to unfollow?
follow
Heat Add
+ LOW
+ DEFAULT
+ HIGH
+ Select font size
+ confirm
Private chat prompt
A private buoy on the side of the broadcast room
Dynamic message
@@ -1143,4 +1149,10 @@ Limited ride And limited avatar frame
Do you want to delete the account
After clicking delete, it will take effect immediately and cannot be restored. Are you sure you want to continue?
Confirm deletion
+ This gift is exclusive to the nobility~
+ "This gift is exclusive to guardianship~ "
+ This gift is exclusive to the fan group~
+ VIP
+ Open Guard
+ Open Fan group
diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml
index aac081a1b..0de513139 100644
--- a/common/src/main/res/values-zh-rHK/strings.xml
+++ b/common/src/main/res/values-zh-rHK/strings.xml
@@ -1144,4 +1144,10 @@
是否刪除賬號
點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎?
確認刪除
+ 該禮物是貴族專屬禮物噢~
+ 該禮物是守護專屬禮物噢~
+ "該禮物是粉絲團專屬禮物噢~ "
+ 開通貴族
+ 開通守護
+ 開通粉絲團
diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml
index d46e5a539..245ff9e8c 100644
--- a/common/src/main/res/values-zh-rTW/strings.xml
+++ b/common/src/main/res/values-zh-rTW/strings.xml
@@ -1143,4 +1143,10 @@
是否刪除賬號
點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎?
確認刪除
+ 該禮物是貴族專屬禮物噢~
+ 該禮物是守護專屬禮物噢~
+ "該禮物是粉絲團專屬禮物噢~ "
+ 開通貴族
+ 開通守護
+ 開通粉絲團
diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml
index aac081a1b..0de513139 100644
--- a/common/src/main/res/values-zh/strings.xml
+++ b/common/src/main/res/values-zh/strings.xml
@@ -1144,4 +1144,10 @@
是否刪除賬號
點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎?
確認刪除
+ 該禮物是貴族專屬禮物噢~
+ 該禮物是守護專屬禮物噢~
+ "該禮物是粉絲團專屬禮物噢~ "
+ 開通貴族
+ 開通守護
+ 開通粉絲團
diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml
index ea893a064..ee792f556 100644
--- a/common/src/main/res/values/strings.xml
+++ b/common/src/main/res/values/strings.xml
@@ -1150,4 +1150,10 @@ Limited ride And limited avatar frame
Do you want to delete the account
After clicking delete, it will take effect immediately and cannot be restored. Are you sure you want to continue?
Confirm deletion
+ This gift is exclusive to the nobility~
+ This gift is exclusive to guardianship~
+ This gift is exclusive to the fan group~
+ VIP
+ Open Guard
+ Open Fan group
diff --git a/config.gradle b/config.gradle
index 2d4dd7c75..f5fc026ba 100644
--- a/config.gradle
+++ b/config.gradle
@@ -9,9 +9,9 @@ ext {
]
manifestPlaceholders = [
//正式、
- serverHost : "https://napi.yaoulive.com",
+// serverHost : "https://napi.yaoulive.com",
// 测试
-// serverHost : "https://ceshi.yaoulive.com",
+ serverHost : "https://ceshi.yaoulive.com",
//腾讯地图
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
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 9e63b6738..094db35c3 100644
--- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java
+++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java
@@ -1044,7 +1044,11 @@ public class LiveAudienceActivity extends LiveActivity {
liveFansFragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment");
break;
case GUARD:
- openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity);
+ if(event.getObject()==null) {
+ openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity);
+ }else{
+ openNewBuyGuardWindow(true);
+ }
break;
case LIVE_WKS://周星榜
String weeklyStarUrl = CommonAppConfig.HOST + "/h5/activity/weekStar/index.html?&uid="
diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java
index 82aabb89c..68a9c66ff 100644
--- a/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java
+++ b/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java
@@ -1,6 +1,5 @@
package com.yunbao.live.adapter;
-import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Build;
@@ -13,14 +12,11 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
-import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.LiveUserMailBoxModel;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DialogUitl;
-import com.yunbao.common.utils.ToastUtil;
-import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog;
@@ -94,7 +90,7 @@ public class LiveUserAnchorMailBoxAdapter extends RecyclerView.Adapter {
+ LiveAudienceEvent event = new LiveAudienceEvent()
+ .setType(finalType);
+ if (finalType == LiveAudienceEvent.LiveAudienceType.GUARD) {
+ event = event.setObject("");
+ }
+ Bus.get().post(event);
+ }).build().show();
+
+ AppManager.runDebugCode(() -> {
+ Log.i("gifBean", mLiveGiftBean.toString());
+ });
} else {
hideLianBtn();
ToastUtil.show(msg);
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java
index b84836937..5f4629551 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java
@@ -1,6 +1,5 @@
package com.yunbao.live.dialog;
-import android.annotation.SuppressLint;
import android.app.Dialog;
import android.os.Bundle;
import android.text.Html;
@@ -35,7 +34,6 @@ import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.DialogUitl;
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.LiveActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
@@ -438,7 +436,7 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements
.setView(R.layout.dialog_live_random_pk)
.setTitle(mContext.getString(R.string.dialog_tip))
.setCancelString(mContext.getString(R.string.live_use_discount_no))
- .setConfrimString(mContext.getString(R.string.live_use_discount_yes))
+ .setConfirmString(mContext.getString(R.string.live_use_discount_yes))
.setClickCallback(new DialogUitl.SimpleCallback2() {
@Override
public void onCancelClick() {
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 44a868bb7..844af5d14 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java
@@ -5,8 +5,6 @@ import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
-import androidx.core.content.ContextCompat;
-
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
@@ -46,29 +44,22 @@ import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.StringUtil;
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.LiveReportActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
-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;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.utils.LiveTextRender;
-import com.yunbao.live.views.LiveRoomViewHolder;
import org.greenrobot.eventbus.EventBus;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import io.rong.imlib.IRongCoreCallback;
@@ -534,7 +525,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
if (mFollowing) {
DialogUitl.Builder builder = new DialogUitl.Builder(mContext)
.setContent(mContext.getString(R.string.unfollow))
- .setConfrimString(mContext.getString(R.string.unfollow_confrim))
+ .setConfirmString(mContext.getString(R.string.unfollow_confrim))
.setCancelString(mContext.getString(R.string.unfollow_cancel))
.setView(R.layout.dialog_live_unfollow)
.setClickCallback3(new DialogUitl.SimpleCallback3() {
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 61c3e5d06..409f79daa 100644
--- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java
+++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java
@@ -54,7 +54,6 @@ import com.yunbao.common.utils.DpUtil;
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.live.R;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
@@ -1242,7 +1241,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
"有人向您发起PK请求。
" +
"若拒绝PK,将会10分钟内不会再收到任何随机PK请求。"
))
- .setConfrimString("接受")
+ .setConfirmString("接受")
.setCancelString("拒絕")
.setView(R.layout.dialog_live_random_pk)
.setSimpleCallbackView(new DialogUitl.SimpleCallbackView() {
diff --git a/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java
index c8ac7930a..6630f9411 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java
@@ -46,7 +46,6 @@ import com.yunbao.common.utils.ProcessImageUtil;
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.AbsViewHolder;
import com.yunbao.common.views.LiveClarityCustomPopup;
import com.yunbao.common.views.LiveNewWishListPopup;
@@ -62,7 +61,6 @@ import com.yunbao.live.dialog.LiveAnchorSayPopDialog;
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
import com.yunbao.live.dialog.LiveNewRoomClassDialogFragment;
import com.yunbao.live.dialog.LiveNewRoomTypeDialogFragment;
-import com.yunbao.live.dialog.LiveNewWishListDialogFragment;
import com.yunbao.live.dialog.LiveTimeDialogFragment;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.http.LiveHttpConsts;
@@ -664,7 +662,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
new DialogUitl.Builder(mContext)
.setContent(mContext.getString(R.string.live_location_close_3))
.setCancelable(true)
- .setConfrimString(mContext.getString(R.string.live_location_close_2))
+ .setConfirmString(mContext.getString(R.string.live_location_close_2))
.setClickCallback(new DialogUitl.SimpleCallback() {
@Override
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 b55dfe006..9d6867df3 100644
--- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java
@@ -7,25 +7,19 @@ import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.media.AudioManager;
-import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
-import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
-import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.FrameLayout;
import android.widget.ImageView;
-import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.ui.StyledPlayerView;
@@ -35,10 +29,8 @@ import com.lxj.xpopup.core.BasePopupView;
import com.lxj.xpopup.interfaces.XPopupCallback;
import com.lzf.easyfloat.EasyFloat;
import com.lzy.okserver.OkDownload;
-import com.yunbao.common.Constants;
import com.yunbao.common.bean.EnterRoomNewModel;
import com.yunbao.common.dialog.LiveFontSizeSettingDialog;
-import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.interfaces.OnItemClickListener;
@@ -50,14 +42,11 @@ import com.yunbao.common.utils.L;
import com.yunbao.common.utils.MicStatusManager;
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.views.LiveClarityCustomPopup;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity;
-import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.utils.LiveExoPlayerManager;
@@ -700,7 +689,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
DialogUitl.Builder builder = new DialogUitl.Builder(mContext)
.setContent("邀請您進行語音連麥")
.setTitle(mLiveBean.getUserNiceName())
- .setConfrimString("接受")
+ .setConfirmString("接受")
.setCancelString("拒絕")
.setView(R.layout.dialog_live_mic_invite)
.setClickCallback(new DialogUitl.SimpleCallback() {
diff --git a/live/src/main/java/com/yunbao/live/views/LiveReadyRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveReadyRyViewHolder.java
index 24ad829a7..99eff8d70 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveReadyRyViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveReadyRyViewHolder.java
@@ -29,7 +29,6 @@ import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessImageUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
-import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
@@ -231,7 +230,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
new DialogUitl.Builder(mContext)
.setContent(mContext.getString(R.string.live_location_close_3))
.setCancelable(true)
- .setConfrimString(mContext.getString(R.string.live_location_close_2))
+ .setConfirmString(mContext.getString(R.string.live_location_close_2))
.setClickCallback(new DialogUitl.SimpleCallback() {
@Override
diff --git a/live/src/main/java/com/yunbao/live/views/LiveReadyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveReadyViewHolder.java
index 3d965ee08..4b157a36f 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveReadyViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveReadyViewHolder.java
@@ -41,7 +41,6 @@ import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ProcessImageUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
-import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
@@ -255,7 +254,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi
new DialogUitl.Builder(mContext)
.setContent(mContext.getString(R.string.live_location_close_3))
.setCancelable(true)
- .setConfrimString(mContext.getString(R.string.live_location_close_2))
+ .setConfirmString(mContext.getString(R.string.live_location_close_2))
.setClickCallback(new DialogUitl.SimpleCallback() {
@Override
From 0d86d142c944dddf19d1edbf797053cecabdc0dd Mon Sep 17 00:00:00 2001
From: zlzw <583819556@qq.com>
Date: Sat, 13 May 2023 14:47:35 +0800
Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=8E=E4=BE=A7?=
=?UTF-8?q?=E8=BE=B9=E6=A0=8F=E4=BB=BB=E5=8A=A1=E8=BF=9B=E5=8E=BB=E7=9A=84?=
=?UTF-8?q?=E9=82=80=E8=AF=B7=E4=BB=BB=E5=8A=A1=E6=97=A0=E6=B3=95=E5=94=A4?=
=?UTF-8?q?=E8=B5=B7=E9=82=80=E8=AF=B7=E5=AF=B9=E8=AF=9D=E6=A1=86=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/yunbao/live/activity/ZhuangBanActivity.java | 5 +++++
1 file changed, 5 insertions(+)
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 e4511553d..af28b0cf5 100644
--- a/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java
+++ b/live/src/main/java/com/yunbao/live/activity/ZhuangBanActivity.java
@@ -46,6 +46,7 @@ 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.share.ui.InvitePopDialog;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@@ -369,6 +370,10 @@ public class ZhuangBanActivity extends AbsActivity {
} catch (MalformedURLException e) {
e.printStackTrace();
}
+ }else if (event.getMethod().equals("androidInviteShare")) {
+ new InvitePopDialog(mContext)
+ .setUrl(event.getData())
+ .showDialog();
}
}
From 46e37b14e479e5f1fdc5602d3de44bcde531b6ac Mon Sep 17 00:00:00 2001
From: zlzw <583819556@qq.com>
Date: Sat, 13 May 2023 15:35:08 +0800
Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=8E=E3=80=90?=
=?UTF-8?q?=E6=88=91=E7=9A=84=E3=80=91-=E3=80=90=E7=8D=8E=E5=8B=B5?=
=?UTF-8?q?=E4=B8=AD=E5=BF=83=E3=80=91=E9=80=B2=E5=8E=BB=E6=97=A0=E6=B3=95?=
=?UTF-8?q?=E5=94=A4=E8=B5=B7=E9=82=80=E8=AF=B7=E5=AF=B9=E8=AF=9D=E6=A1=86?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/yunbao/main/activity/RewardActivity.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/main/src/main/java/com/yunbao/main/activity/RewardActivity.java b/main/src/main/java/com/yunbao/main/activity/RewardActivity.java
index 185f65de6..47655f3bb 100644
--- a/main/src/main/java/com/yunbao/main/activity/RewardActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/RewardActivity.java
@@ -43,6 +43,7 @@ import com.yunbao.common.interfaces.ActivityResultCallback;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.ImageResultCallback;
import com.yunbao.common.manager.IMLoginManager;
+import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.JavascriptInterfaceUtils;
import com.yunbao.common.utils.L;
@@ -53,6 +54,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.main.R;
import com.yunbao.main.http.MainHttpUtil;
+import com.yunbao.share.ui.InvitePopDialog;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@@ -83,6 +85,7 @@ public class RewardActivity extends AbsActivity {
@Override
protected void main() {
+ Bus.getOn(this);
String url = getIntent().getStringExtra(Constants.URL);
L.e("H5---10>" + url);
LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView);
@@ -330,6 +333,7 @@ public class RewardActivity extends AbsActivity {
@Override
protected void onDestroy() {
+ Bus.getOff(this);
if (mWebView != null) {
ViewGroup parent = (ViewGroup) mWebView.getParent();
if (parent != null) {
@@ -420,6 +424,10 @@ public class RewardActivity extends AbsActivity {
} else if (TextUtils.equals(event.getMethod(), "openUpdataAutograph")) {
isUpdataUser = true;
forwardSign();
+ }else if (event.getMethod().equals("androidInviteShare")) {
+ new InvitePopDialog(mContext)
+ .setUrl(event.getData())
+ .showDialog();
}
}
}
From df0f5f31e01dd8ee01147af199aaebad6c464627 Mon Sep 17 00:00:00 2001
From: zlzw <583819556@qq.com>
Date: Wed, 17 May 2023 15:12:51 +0800
Subject: [PATCH 4/5] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=BB=E6=92=AD?=
=?UTF-8?q?=E6=8A=95=E7=A5=A8=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/yunbao/common/Constants.java | 3 +
.../common/bean/EnterRoomInfoModel.java | 10 +
.../yunbao/common/bean/LiveRoomVoteModel.java | 173 ++++++++++
.../common/dialog/AbsDialogPopupWindow.java | 3 +
.../com/yunbao/common/http/PDLiveApi.java | 22 ++
.../common/http/live/LiveNetManager.java | 73 +++++
.../res/layout/dialog_live_new_function.xml | 305 ++++++++++--------
common/src/main/res/values-en-rUS/string.xml | 11 +
common/src/main/res/values-zh-rHK/strings.xml | 11 +
common/src/main/res/values-zh-rTW/strings.xml | 11 +
common/src/main/res/values-zh/strings.xml | 11 +
common/src/main/res/values/strings.xml | 11 +
.../live/activity/LiveAudienceActivity.java | 31 +-
.../yunbao/live/adapter/LiveChatAdapter.java | 19 +-
.../com/yunbao/live/bean/LiveChatBean.java | 1 +
.../live/dialog/LiveAnchorCreateQADialog.java | 75 +++++
.../dialog/LiveNewFunctionDialogFragment.java | 5 +-
.../yunbao/live/event/LiveAnchorEvent.java | 295 +++++++++++++++++
.../yunbao/live/event/LiveAudienceEvent.java | 5 +-
.../yunbao/live/socket/SocketRyClient.java | 63 +++-
.../live/utils/LiveAnchorVoteManager.java | 121 +++++++
.../live/utils/LiveRoomVoteManager.java | 259 +++++++++++++++
.../yunbao/live/views/LiveRoomViewHolder.java | 80 ++++-
.../live/views/PortraitLiveManager.java | 7 +
.../res/anim/view_live_anchor_vote_in.xml | 12 +
.../res/anim/view_live_anchor_vote_out.xml | 12 +
.../main/res/drawable/background_292929.xml | 9 +
.../main/res/drawable/background_cc000.xml | 9 +
.../drawable/background_live_vote_cc000.xml | 9 +
.../res/drawable/bg_live_room_vote_hide.xml | 10 +
.../res/drawable/live_room_qa_progress.xml | 36 +++
.../layout/dialog_anchor_call_edit_app.xml | 2 +-
.../layout/dialog_live_anchor_create_qa.xml | 115 +++++++
.../main/res/layout/sim_live_room_vote.xml | 138 ++++++++
live/src/main/res/layout/view_live_room.xml | 8 +-
35 files changed, 1799 insertions(+), 166 deletions(-)
create mode 100644 common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java
create mode 100644 live/src/main/java/com/yunbao/live/dialog/LiveAnchorCreateQADialog.java
create mode 100644 live/src/main/java/com/yunbao/live/event/LiveAnchorEvent.java
create mode 100644 live/src/main/java/com/yunbao/live/utils/LiveAnchorVoteManager.java
create mode 100644 live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java
create mode 100644 live/src/main/res/anim/view_live_anchor_vote_in.xml
create mode 100644 live/src/main/res/anim/view_live_anchor_vote_out.xml
create mode 100644 live/src/main/res/drawable/background_292929.xml
create mode 100644 live/src/main/res/drawable/background_cc000.xml
create mode 100644 live/src/main/res/drawable/background_live_vote_cc000.xml
create mode 100644 live/src/main/res/drawable/bg_live_room_vote_hide.xml
create mode 100644 live/src/main/res/drawable/live_room_qa_progress.xml
create mode 100644 live/src/main/res/layout/dialog_live_anchor_create_qa.xml
create mode 100644 live/src/main/res/layout/sim_live_room_vote.xml
diff --git a/common/src/main/java/com/yunbao/common/Constants.java b/common/src/main/java/com/yunbao/common/Constants.java
index 164614260..b597b23f7 100644
--- a/common/src/main/java/com/yunbao/common/Constants.java
+++ b/common/src/main/java/com/yunbao/common/Constants.java
@@ -179,6 +179,9 @@ public class Constants {
public static final String CUSTOM_FULL_SERVICE_NOTIFY = "customFullServiceNotify";//全服通知
public static final String XYD_COMPLETE = "XydComplete";//心愿单完成通知
public static final String WISH_LIST_PROGRESS = "wishListProgress";//心愿单进度通知
+ public static final String LIVE_VOTE_CREATE="createVote";
+ public static final String LIVE_VOTE_UPDATE="updateVote";
+ public static final String LIVE_VOTE_END="endVote";
//游戏socket
public static final String SOCKET_GAME_ZJH = "startGame";//炸金花
diff --git a/common/src/main/java/com/yunbao/common/bean/EnterRoomInfoModel.java b/common/src/main/java/com/yunbao/common/bean/EnterRoomInfoModel.java
index 1a6af9aa9..34e300886 100644
--- a/common/src/main/java/com/yunbao/common/bean/EnterRoomInfoModel.java
+++ b/common/src/main/java/com/yunbao/common/bean/EnterRoomInfoModel.java
@@ -104,12 +104,22 @@ public class EnterRoomInfoModel extends BaseModel {
private String anchorGoodnum;
@SerializedName("jackpot_level")
private String jackpotLevel="-1";
+ @SerializedName("live_vote")
+ private LiveRoomVoteModel voteModel;
public String getJackpotLevel() {
return jackpotLevel;
}
+ public LiveRoomVoteModel getVoteModel() {
+ return voteModel;
+ }
+
+ public void setVoteModel(LiveRoomVoteModel voteModel) {
+ this.voteModel = voteModel;
+ }
+
public EnterRoomInfoModel setJackpotLevel(String jackpotLevel) {
this.jackpotLevel = jackpotLevel;
return this;
diff --git a/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java b/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java
new file mode 100644
index 000000000..e08329ec4
--- /dev/null
+++ b/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java
@@ -0,0 +1,173 @@
+package com.yunbao.common.bean;
+
+import com.google.gson.annotations.SerializedName;
+import com.yunbao.common.utils.StringUtil;
+
+import java.util.List;
+
+/**
+ * 主播创建投票
+ * {
+ * "live_vote_id": "20",
+ * "question_content": "123",
+ * "vote_end_time": 180,
+ * "option_content_first_num": 0,
+ * "option_content_second_num": 0,
+ * "users_id": []
+ * }
+ */
+public class LiveRoomVoteModel extends BaseModel {
+ @SerializedName("vote_status")
+ private int status;
+ @SerializedName("live_vote_id")
+ private String voteId;
+ @SerializedName("question_content")
+ private String content;
+ @SerializedName("vote_end_time")
+ private int time;
+ @SerializedName("option_content_first_num")
+ private int answer1Num;
+ @SerializedName("option_content_second_num")
+ private int answer2Num;
+ @SerializedName("users_id")
+ private List userIds;
+ @SerializedName("option_content_first")
+ private String answer1;
+ @SerializedName("option_content_second")
+ private String answer2;
+ @SerializedName("result")
+ private String result;
+ @SerializedName("option_text")
+ private String optionText;
+ @SerializedName("option_content_key")
+ private String vote;
+
+ private String liveUid;
+
+ public String getLiveUid() {
+ return liveUid;
+ }
+
+ public void setLiveUid(String liveUid) {
+ this.liveUid = liveUid;
+ }
+
+ public String getAnswer1() {
+ return answer1;
+ }
+
+ public void setAnswer1(String answer1) {
+ this.answer1 = answer1;
+ }
+
+ public String getAnswer2() {
+ return answer2;
+ }
+
+ public void setAnswer2(String answer2) {
+ this.answer2 = answer2;
+ }
+
+ public String getVoteId() {
+ return voteId;
+ }
+
+ public void setVoteId(String voteId) {
+ this.voteId = voteId;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public int getTime() {
+ return time;
+ }
+
+ public void setTime(int time) {
+ this.time = time;
+ }
+
+ public int getAnswer1Num() {
+ return answer1Num;
+ }
+
+ public void setAnswer1Num(int answer1Num) {
+ this.answer1Num = answer1Num;
+ }
+
+ public int getAnswer2Num() {
+ return answer2Num;
+ }
+
+ public void setAnswer2Num(int answer2Num) {
+ this.answer2Num = answer2Num;
+ }
+
+ public List getUserIds() {
+ return userIds;
+ }
+
+ public void setUserIds(List userIds) {
+ this.userIds = userIds;
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+ public String getOptionText() {
+ return optionText;
+ }
+
+ public void setOptionText(String optionText) {
+ this.optionText = optionText;
+ }
+
+ @Override
+ public String toString() {
+ return "LiveRoomVoteModel{" +
+ "status=" + status +
+ ", voteId='" + voteId + '\'' +
+ ", content='" + content + '\'' +
+ ", time=" + time +
+ ", answer1Num=" + answer1Num +
+ ", answer2Num=" + answer2Num +
+ ", userIds=" + userIds +
+ ", answer1='" + answer1 + '\'' +
+ ", answer2='" + answer2 + '\'' +
+ ", result='" + result + '\'' +
+ ", optionText='" + optionText + '\'' +
+ ", vote='" + vote + '\'' +
+ ", liveUid='" + liveUid + '\'' +
+ '}';
+ }
+
+ public String getVote() {
+ return vote;
+ }
+
+ public void setVote(String vote) {
+ this.vote = vote;
+ }
+ public boolean isVoteLeft(){
+ return vote.equals("option_content_first_num");
+ }
+
+}
diff --git a/common/src/main/java/com/yunbao/common/dialog/AbsDialogPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/AbsDialogPopupWindow.java
index 94503aa4b..c74e3ea45 100644
--- a/common/src/main/java/com/yunbao/common/dialog/AbsDialogPopupWindow.java
+++ b/common/src/main/java/com/yunbao/common/dialog/AbsDialogPopupWindow.java
@@ -16,6 +16,9 @@ public abstract class AbsDialogPopupWindow extends BottomPopupView {
this.mContext = context;
}
+ /**
+ * 参考配置
+ */
public abstract void buildDialog(XPopup.Builder builder);
public abstract int bindLayoutId();
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 555f0108a..3119fff54 100644
--- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java
+++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java
@@ -17,6 +17,7 @@ import com.yunbao.common.bean.LinkMicUserBeanV2;
import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveAnchorCallMeModel;
+import com.yunbao.common.bean.LiveRoomVoteModel;
import com.yunbao.common.bean.LiveAnchorSayModel;
import com.yunbao.common.bean.LiveDataInfoModel;
import com.yunbao.common.bean.LiveInfoModel;
@@ -694,4 +695,25 @@ public interface PDLiveApi {
*/
@GET("/api/public/?service=User.setLogOff")
Observable>> setLogOff();
+
+ /**
+ * 创建投票
+ */
+ @GET("/api/public/?service=Live.createLiveVote")
+ Observable> createLiveVote(@Query("liveuid") String liveUid,
+ @Query("question_content") String content,
+ @Query("option_content_first") String first,
+ @Query("option_content_second") String second);
+
+ /**
+ * 更新投票
+ */
+ @GET("/api/public/?service=Live.setLiveVote")
+ Observable>> updateLiveVote(@Query("liveuid") String liveUid,
+ @Query("option_content_key") String key);
+ /**
+ * 主动结束投票
+ */
+ @GET("/api/public/?service=Live.endLiveVote")
+ Observable>> endLiveVote(@Query("liveuid") String liveUid);
}
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 41bfecaaf..083b6babe 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
@@ -18,6 +18,7 @@ import com.yunbao.common.bean.LinkMicUserBeanV2;
import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveAnchorCallMeModel;
+import com.yunbao.common.bean.LiveRoomVoteModel;
import com.yunbao.common.bean.LiveAnchorSayModel;
import com.yunbao.common.bean.LiveDataInfoModel;
import com.yunbao.common.bean.LiveInfoModel;
@@ -1427,6 +1428,78 @@ public class LiveNetManager {
}).isDisposed();
}
+ public void createLiveVote(String liveUid, String content, String first, String second, HttpCallback callback) {
+ API.get().pdLiveApi(mContext)
+ .createLiveVote(liveUid, content, first, second)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new Consumer>() {
+ @Override
+ public void accept(ResponseModel listResponseModel) throws Exception {
+ if (callback != null) {
+ callback.onSuccess(listResponseModel.getData().getInfo());
+ }
+ }
+ }, new Consumer() {
+ @Override
+ public void accept(Throwable throwable) throws Exception {
+ if (callback != null) {
+ callback.onError(throwable.getMessage());
+ }
+ }
+ }).isDisposed();
+ }
+
+ public void updateLiveVote(String liveUid, boolean isLeftVote, HttpCallback callback) {
+ String key;
+ if (isLeftVote) {//是左边的投票
+ key = "option_content_first_num";
+ } else {
+ key = "option_content_second_num";
+ }
+ API.get().pdLiveApi(mContext)
+ .updateLiveVote(liveUid, key)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new Consumer>>() {
+ @Override
+ public void accept(ResponseModel> listResponseModel) throws Exception {
+ if (callback != null) {
+ callback.onSuccess("");
+ }
+ }
+ }, new Consumer() {
+ @Override
+ public void accept(Throwable throwable) throws Exception {
+ if (callback != null) {
+ callback.onError(throwable.getMessage());
+ }
+ }
+ }).isDisposed();
+ }
+
+ public void endLiveVote(String liveUid, HttpCallback callback) {
+ API.get().pdLiveApi(mContext)
+ .endLiveVote(liveUid)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new Consumer>>() {
+ @Override
+ public void accept(ResponseModel> listResponseModel) throws Exception {
+ if (callback != null) {
+ callback.onSuccess(listResponseModel.getData().getMsg());
+ }
+ }
+ }, new Consumer() {
+ @Override
+ public void accept(Throwable throwable) throws Exception {
+ if (callback != null) {
+ callback.onError(throwable.getMessage());
+ }
+ }
+ }).isDisposed();
+ }
+
/**
* 直播间取消网络请求
*/
diff --git a/common/src/main/res/layout/dialog_live_new_function.xml b/common/src/main/res/layout/dialog_live_new_function.xml
index 7a444507f..8a1234d84 100644
--- a/common/src/main/res/layout/dialog_live_new_function.xml
+++ b/common/src/main/res/layout/dialog_live_new_function.xml
@@ -246,140 +246,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml
index 4c3a07c0c..5bfc21860 100644
--- a/common/src/main/res/values-en-rUS/string.xml
+++ b/common/src/main/res/values-en-rUS/string.xml
@@ -1155,4 +1155,15 @@ Limited ride And limited avatar frame
VIP
Open Guard
Open Fan group
+ QA
+ submit
+ cancel
+ question:
+ answer:
+ Do you want to end this voting early?
+ Yes
+ No
+ VOTE
+ %s \n box disappears after %s seconds
+ Please complete the form.
diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml
index 0de513139..aca95a68b 100644
--- a/common/src/main/res/values-zh-rHK/strings.xml
+++ b/common/src/main/res/values-zh-rHK/strings.xml
@@ -1150,4 +1150,15 @@
開通貴族
開通守護
開通粉絲團
+ 發啟問答
+ 發啟問答
+ 取消
+ 問題設置:
+ 答案設置:
+ 是否提前結束本次投票?
+ 是
+ 否
+ 投票中
+ %s \n 問答框%s秒后消失
+ 請完整填寫
diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml
index 245ff9e8c..c41ee0c59 100644
--- a/common/src/main/res/values-zh-rTW/strings.xml
+++ b/common/src/main/res/values-zh-rTW/strings.xml
@@ -1149,4 +1149,15 @@
開通貴族
開通守護
開通粉絲團
+ 發啟問答
+ 發啟問答
+ 取消
+ 問題設置:
+ 答案設置:
+ 是否提前結束本次投票?
+ 是
+ 否
+ 投票中
+ %s \n 問答框%s秒后消失
+ 請完整填寫
diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml
index 0de513139..aca95a68b 100644
--- a/common/src/main/res/values-zh/strings.xml
+++ b/common/src/main/res/values-zh/strings.xml
@@ -1150,4 +1150,15 @@
開通貴族
開通守護
開通粉絲團
+ 發啟問答
+ 發啟問答
+ 取消
+ 問題設置:
+ 答案設置:
+ 是否提前結束本次投票?
+ 是
+ 否
+ 投票中
+ %s \n 問答框%s秒后消失
+ 請完整填寫
diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml
index ee792f556..62463aead 100644
--- a/common/src/main/res/values/strings.xml
+++ b/common/src/main/res/values/strings.xml
@@ -1156,4 +1156,15 @@ Limited ride And limited avatar frame
VIP
Open Guard
Open Fan group
+ QA
+ submit
+ cancel
+ question:
+ answer:
+ Do you want to end this voting early?
+ Yes
+ No
+ VOTE
+ %s \n box disappears after %s seconds
+ Please complete the form.
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 094db35c3..2f2a4e1ab 100644
--- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java
+++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java
@@ -1,5 +1,6 @@
package com.yunbao.live.activity;
+
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Intent;
@@ -47,6 +48,7 @@ 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.LiveRoomVoteModel;
import com.yunbao.common.bean.LiveUserGiftBean;
import com.yunbao.common.bean.LiveUserMailBoxModel;
import com.yunbao.common.bean.SlideInfoModel;
@@ -1044,9 +1046,9 @@ public class LiveAudienceActivity extends LiveActivity {
liveFansFragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment");
break;
case GUARD:
- if(event.getObject()==null) {
+ if (event.getObject() == null) {
openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity);
- }else{
+ } else {
openNewBuyGuardWindow(true);
}
break;
@@ -1333,6 +1335,31 @@ public class LiveAudienceActivity extends LiveActivity {
manager.showXydComplete(event.getXydCompleteModel(), event.getLiveReceiveGiftBean());
}
break;
+ case VOTE_CREATE:
+ case VOTE_UPDATE:
+ JSONObject map = (JSONObject) event.getObject();
+ manager.mLiveRoomViewHolder.setVoteData(
+ map.getString("question"),
+ map.getString("answer1"),
+ map.getString("answer2"),
+ map.getString("num1"),
+ map.getString("num2")
+ );
+ break;
+ case VOTE_END:
+ try {
+ LiveRoomVoteModel voteModel = JSONObject.parseObject(event.getObject().toString(), LiveRoomVoteModel.class);
+ System.out.println(">>>" + voteModel);
+ String content = voteModel.getResult();
+ if (!StringUtil.isEmpty(voteModel.getOptionText())) {
+ content =voteModel.getResult().replace(voteModel.getOptionText(), "" + voteModel.getOptionText() + "");
+ }
+ manager.mLiveRoomViewHolder.dismissVote(voteModel.getResult(), content);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ break;
}
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 3022cd9c5..06c2750fe 100644
--- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java
+++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java
@@ -5,6 +5,7 @@ import static com.yunbao.live.bean.LiveChatBean.LUCKY_100_CHECK;
import static com.yunbao.live.bean.LiveChatBean.LUCKY_ANGEL;
import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY;
import static com.yunbao.live.bean.LiveChatBean.STAR_CHALLENGE_UPGRADE_NOTIFY;
+import static com.yunbao.live.bean.LiveChatBean.SYSTEM3_COLOR;
import static com.yunbao.live.bean.LiveChatBean.WISH_LIST_PROGRESS;
import static com.yunbao.live.bean.LiveChatBean.XYD_COMPLETE;
@@ -13,6 +14,7 @@ import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.text.Html;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
@@ -47,6 +49,7 @@ import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.SpUtil;
+import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ClipPathCircleImage;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity;
@@ -82,7 +85,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
private int mPosition;
private boolean isBottom = false;
- private int fountSize=13;
+ private int fountSize = 13;
public LiveChatAdapter(Context context) {
mContext = context;
@@ -100,10 +103,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
}
}
};
- if(SpUtil.getInstance().isExists("pd_live_room_fount_size")){
+ if (SpUtil.getInstance().isExists("pd_live_room_fount_size")) {
try {
- fountSize=Integer.parseInt(SpUtil.getStringValue("pd_live_room_fount_size"));
- }catch (Exception ignored){
+ fountSize = Integer.parseInt(SpUtil.getStringValue("pd_live_room_fount_size"));
+ } catch (Exception ignored) {
}
}
@@ -173,8 +176,8 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
}
public void switchFount(int fount) {
- fountSize=fount;
- SpUtil.setStringValue("pd_live_room_fount_size",fountSize+"");
+ fountSize = fount;
+ SpUtil.setStringValue("pd_live_room_fount_size", fountSize + "");
notifyDataSetChanged();
}
@@ -198,7 +201,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
class Vh extends RecyclerView.ViewHolder {
LinearLayout mBg, view_follow, view_action_game, view_zg, xydComplete;
- TextView mTextView, tv_chat_active_into, tv_chat_avtive_name, tv_zg_anchorname, textTxt2,automatic_chat;
+ TextView mTextView, tv_chat_active_into, tv_chat_avtive_name, tv_zg_anchorname, textTxt2, automatic_chat;
RoundedImageView avatar;
View v_chat_active_close;
RecyclerView rv_chat_active;
@@ -477,6 +480,8 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystem_bubble(), 1);
new LiveTextRender().lucky100(mContext, mTextView, bean.getMsgModel());
}
+ } else if (bean.getType() == SYSTEM3_COLOR) {
+ mTextView.setText(Html.fromHtml(bean.getContent()));
} else {
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
//加载.9图聊天气泡
diff --git a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java
index 85a6697cd..c57e9fb9f 100644
--- a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java
+++ b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java
@@ -23,6 +23,7 @@ public class LiveChatBean {
public static final int STAR_CHALLENGE_UPGRADE_NOTIFY = 105;
public static final int LUCKY_ANGEL = 106;//幸运天使
public static final int LUCKY_100_CHECK = 107;//幸运天使
+ public static final int SYSTEM3_COLOR = 108;//带颜色的系统消息,格式 XXXXYYY
public static final int XYD_COMPLETE = 207;//心愿单完成通知
public static final int WISH_LIST_PROGRESS = 307;//心愿单进度通知
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveAnchorCreateQADialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorCreateQADialog.java
new file mode 100644
index 000000000..243f2a568
--- /dev/null
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorCreateQADialog.java
@@ -0,0 +1,75 @@
+package com.yunbao.live.dialog;
+
+import android.content.Context;
+import android.widget.Button;
+import android.widget.EditText;
+
+import androidx.annotation.NonNull;
+
+import com.lxj.xpopup.XPopup;
+import com.yunbao.common.dialog.AbsDialogPopupWindow;
+import com.yunbao.common.utils.ToastUtil;
+import com.yunbao.live.R;
+import com.yunbao.live.utils.LiveAnchorVoteManager;
+
+/**
+ * 主播创建问答弹框
+ */
+public class LiveAnchorCreateQADialog extends AbsDialogPopupWindow {
+ private EditText question, answer1, answer2;
+ private Button submit, cancel;
+
+ private String liveUid;
+
+ public LiveAnchorCreateQADialog setLiveUid(String liveUid) {
+ this.liveUid = liveUid;
+ return this;
+ }
+
+
+ public LiveAnchorCreateQADialog(@NonNull Context context) {
+ super(context);
+ }
+
+ @Override
+ public void buildDialog(XPopup.Builder builder) {
+ builder.dismissOnTouchOutside(false);
+ builder.autoFocusEditText(false);
+ }
+
+ @Override
+ public int bindLayoutId() {
+ return R.layout.dialog_live_anchor_create_qa;
+ }
+
+ @Override
+ protected void onCreate() {
+ super.onCreate();
+ question = findViewById(R.id.edit_question);
+ answer1 = findViewById(R.id.edit_answer1);
+ answer2 = findViewById(R.id.edit_answer2);
+ submit = findViewById(R.id.submit);
+ cancel = findViewById(R.id.cancel);
+ cancel.setOnClickListener(v -> dismiss());
+ submit.setOnClickListener(v -> {
+ if (question.getText().toString().trim().length() == 0 ||
+ answer1.getText().toString().trim().length() == 0 ||
+ answer2.getText().toString().trim().length() == 0
+ ) {
+ ToastUtil.show(getContext().getString(R.string.live_anchor_vote_tip));
+ return;
+ }
+ createVote(question.getText().toString(), answer1.getText().toString(), answer2.getText().toString());
+ });
+ }
+
+ private void createVote(String question, String answer1, String answer2) {
+ LiveAnchorVoteManager.getInstance().createVote(liveUid, question, answer1, answer2, (bean, position) -> {
+ if(position!=0){
+ ToastUtil.show(bean.getContent());
+ return;
+ }
+ dismiss();
+ });
+ }
+}
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java
index 12a8fd209..00aca5d9c 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java
@@ -120,6 +120,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
findViewById(R.id.live_tool_robot).setOnClickListener(this);
findViewById(R.id.live_tool_call_me).setOnClickListener(this);
findViewById(R.id.live_tool_anchor_say).setOnClickListener(this);
+ findViewById(R.id.live_tool_qa).setOnClickListener(this);
if (leave == 0) {
((ImageView) mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave);
@@ -198,7 +199,9 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
new LiveAnchorEditCallMeDialog(mContext).setLiveUid(liveUid).showDialog();
} else if (id == R.id.live_tool_anchor_say) {
new LiveAnchorSayPopDialog(mContext).setLiveUid(liveUid).setOnItemClickListener((bean, position)
- -> mLiveRoomHandler.postDelayed(()-> ((LiveRyAnchorActivity)(mContext)).mLiveRoomViewHolder.initAnchorSayData(),1000)).showDialog();
+ -> mLiveRoomHandler.postDelayed(() -> ((LiveRyAnchorActivity) (mContext)).mLiveRoomViewHolder.initAnchorSayData(), 1000)).showDialog();
+ } else if (id == R.id.live_tool_qa) {
+ new LiveAnchorCreateQADialog(mContext).setLiveUid(liveUid).showDialog();
}
}
diff --git a/live/src/main/java/com/yunbao/live/event/LiveAnchorEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAnchorEvent.java
new file mode 100644
index 000000000..5138ce67c
--- /dev/null
+++ b/live/src/main/java/com/yunbao/live/event/LiveAnchorEvent.java
@@ -0,0 +1,295 @@
+package com.yunbao.live.event;
+
+import com.alibaba.fastjson.JSONArray;
+import com.yunbao.common.bean.ActiveModel;
+import com.yunbao.common.bean.AiAutomaticSpeechModel;
+import com.yunbao.common.bean.AnchorRecommendItemModel;
+import com.yunbao.common.bean.BaseModel;
+import com.yunbao.common.bean.LiveBean;
+import com.yunbao.common.bean.MsgModel;
+import com.yunbao.common.bean.WishModel;
+import com.yunbao.common.bean.XydCompleteModel;
+import com.yunbao.common.event.CustomFullServiceNotifyEvent;
+import com.yunbao.live.bean.LivePKUserListBean;
+import com.yunbao.live.bean.LiveReceiveGiftBean;
+import com.yunbao.live.bean.OpenParametersModel;
+
+
+public class LiveAnchorEvent extends BaseModel {
+ private LiveAnchorType type;
+ private ActiveModel model = new ActiveModel();
+ private String avatar = "";
+ private OpenParametersModel parametersModel = new OpenParametersModel();
+ private AnchorRecommendItemModel anchorRecommendItemModel = new AnchorRecommendItemModel();
+ private int micIng = 0;//连麦状态
+ private LiveBean bean;
+ private Object object;
+ private int liveType;
+ private int liveTypeVal;
+ private MsgModel msgModel;//全服消息
+ private AiAutomaticSpeechModel aiAutomaticSpeechModel;//机器人消息
+ private boolean voicePress = false;
+ private boolean isActivity = false;//是否展示趣味活动和增值权益
+ private JSONArray pkScores;
+ private String uid;
+ private int time;
+ private CustomFullServiceNotifyEvent customFullServiceNotifyEvent;
+ private LivePKUserListBean livePKUserListBean;
+ private String votes;
+ private String length;
+ private int nums;
+ private String uname;
+ private WishModel wishListProgress;
+ private XydCompleteModel xydCompleteModel;
+ private LiveReceiveGiftBean liveReceiveGiftBean;
+
+ public LiveReceiveGiftBean getLiveReceiveGiftBean() {
+ return liveReceiveGiftBean;
+ }
+
+ public LiveAnchorEvent setLiveReceiveGiftBean(LiveReceiveGiftBean liveReceiveGiftBean) {
+ this.liveReceiveGiftBean = liveReceiveGiftBean;
+ return this;
+ }
+
+ public XydCompleteModel getXydCompleteModel() {
+ return xydCompleteModel;
+ }
+
+ public LiveAnchorEvent setXydCompleteModel(XydCompleteModel xydCompleteModel) {
+ this.xydCompleteModel = xydCompleteModel;
+ return this;
+ }
+
+ public WishModel getWishListProgress() {
+ return wishListProgress;
+ }
+
+ public LiveAnchorEvent setWishListProgress(WishModel wishListProgress) {
+ this.wishListProgress = wishListProgress;
+ return this;
+ }
+
+ public String getVotes() {
+ return votes;
+ }
+
+ public LiveAnchorEvent setVotes(String votes) {
+ this.votes = votes;
+ return this;
+ }
+
+ public String getLength() {
+ return length;
+ }
+
+ public LiveAnchorEvent setLength(String length) {
+ this.length = length;
+ return this;
+ }
+
+ public int getNums() {
+ return nums;
+ }
+
+ public LiveAnchorEvent setNums(int nums) {
+ this.nums = nums;
+ return this;
+ }
+
+ public String getUname() {
+ return uname;
+ }
+
+ public LiveAnchorEvent setUname(String uname) {
+ this.uname = uname;
+ return this;
+ }
+
+ public LivePKUserListBean getLivePKUserListBean() {
+ return livePKUserListBean;
+ }
+
+ public LiveAnchorEvent setLivePKUserListBean(LivePKUserListBean livePKUserListBean) {
+ this.livePKUserListBean = livePKUserListBean;
+ return this;
+ }
+
+ public CustomFullServiceNotifyEvent getCustomFullServiceNotifyEvent() {
+ return customFullServiceNotifyEvent;
+ }
+
+ public LiveAnchorEvent setCustomFullServiceNotifyEvent(CustomFullServiceNotifyEvent customFullServiceNotifyEvent) {
+ this.customFullServiceNotifyEvent = customFullServiceNotifyEvent;
+ return this;
+ }
+
+ public JSONArray getPkScores() {
+ return pkScores;
+ }
+
+ public LiveAnchorEvent setPkScores(JSONArray pkScores) {
+ this.pkScores = pkScores;
+ return this;
+ }
+
+ public String getUid() {
+ return uid;
+ }
+
+ public LiveAnchorEvent setUid(String uid) {
+ this.uid = uid;
+ return this;
+ }
+
+ public int getTime() {
+ return time;
+ }
+
+ public LiveAnchorEvent setTime(int time) {
+ this.time = time;
+ return this;
+ }
+
+ public boolean isActivity() {
+ return isActivity;
+ }
+
+ public LiveAnchorEvent setActivity(boolean activity) {
+ isActivity = activity;
+ return this;
+ }
+
+ public boolean isVoicePress() {
+ return voicePress;
+ }
+
+ public LiveAnchorEvent setVoicePress(boolean voicePress) {
+ this.voicePress = voicePress;
+ return this;
+ }
+
+ public AiAutomaticSpeechModel getAiAutomaticSpeechModel() {
+ return aiAutomaticSpeechModel;
+ }
+
+ public LiveAnchorEvent setAiAutomaticSpeechModel(AiAutomaticSpeechModel aiAutomaticSpeechModel) {
+ this.aiAutomaticSpeechModel = aiAutomaticSpeechModel;
+ return this;
+ }
+
+ public MsgModel getMsgModel() {
+ return msgModel;
+ }
+
+ public LiveAnchorEvent setMsgModel(MsgModel msgModel) {
+ this.msgModel = msgModel;
+ return this;
+ }
+
+ public int getLiveType() {
+ return liveType;
+ }
+
+ public LiveAnchorEvent setLiveType(int liveType) {
+ this.liveType = liveType;
+ return this;
+ }
+
+ public int getLiveTypeVal() {
+ return liveTypeVal;
+ }
+
+ public LiveAnchorEvent setLiveTypeVal(int liveTypeVal) {
+ this.liveTypeVal = liveTypeVal;
+ return this;
+ }
+
+ public LiveBean getBean() {
+ return bean;
+ }
+
+ public LiveAnchorEvent setBean(LiveBean bean) {
+ this.bean = bean;
+ return this;
+ }
+
+ public int getMicIng() {
+ return micIng;
+ }
+
+ public LiveAnchorEvent setMicIng(int micIng) {
+ this.micIng = micIng;
+ return this;
+ }
+
+ public AnchorRecommendItemModel getAnchorRecommendItemModel() {
+ return anchorRecommendItemModel;
+ }
+
+ public LiveAnchorEvent setAnchorRecommendItemModel(AnchorRecommendItemModel anchorRecommendItemModel) {
+ this.anchorRecommendItemModel = anchorRecommendItemModel;
+ return this;
+ }
+
+ public OpenParametersModel getParametersModel() {
+ return parametersModel;
+ }
+
+ public LiveAnchorEvent setParametersModel(OpenParametersModel parametersModel) {
+ this.parametersModel = parametersModel;
+ return this;
+ }
+
+ public String getAvatar() {
+ return avatar;
+ }
+
+ public LiveAnchorEvent setAvatar(String avatar) {
+ this.avatar = avatar;
+ return this;
+ }
+
+ public ActiveModel getModel() {
+ return model;
+ }
+
+ public LiveAnchorEvent setModel(ActiveModel model) {
+ this.model = model;
+ return this;
+ }
+
+ public LiveAnchorType getType() {
+ return type;
+ }
+
+ public LiveAnchorEvent setType(LiveAnchorType type) {
+ this.type = type;
+ return this;
+ }
+
+ public Object getObject() {
+ return object;
+ }
+
+ public LiveAnchorEvent setObject(Object object) {
+ this.object = object;
+ return this;
+ }
+
+ public enum LiveAnchorType {
+ VOTE_CREATE(1, "创建投票"),
+ VOTE_ANCHOR_END(2, "投票结束"),
+ VOTE_ANCHOR_UPDATE(3, "投票结束");
+
+
+ private int type;
+ private String name;
+
+ LiveAnchorType(int type, String name) {
+ this.type = type;
+ this.name = name;
+ }
+
+ }
+}
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 bf09ae1e1..7d72304c6 100644
--- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java
+++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java
@@ -341,7 +341,10 @@ public class LiveAudienceEvent extends BaseModel {
WISH_LIST_PROGRESS(61, "心愿单进度"),
CLOSE_LIVE_ROOM(62, "关闭直播间"),
FONT_SIZE(63, "侧边字号设置"),
- LIVE_FONT_SIZE(64, "字号设置");
+ LIVE_FONT_SIZE(64, "字号设置"),
+ VOTE_CREATE(65, "创建投票"),
+ VOTE_UPDATE(66, "更新投票"),
+ VOTE_END(67, "投票结束");
private int type;
private String name;
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 f86d0ab75..332c18aa8 100644
--- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java
+++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java
@@ -52,6 +52,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.event.LiveAnchorEvent;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.views.LiveEndViewHolder;
import com.yunbao.live.views.LivePlayKsyViewHolder;
@@ -72,10 +73,10 @@ import io.rong.imlib.chatroom.base.RongChatRoomClient;
public class SocketRyClient {
- private final String TAG = "socket";
+ private final String TAG = "socket";
private String mLiveUid;
private String mStream;
- public static SocketRyClient.SocketHandler mSocketHandler;
+ public static SocketRyClient.SocketHandler mSocketHandler;
private Context mContext;
public SocketRyClient(String mLiveUid, SocketMessageListener listener, Activity mContext) {
@@ -111,11 +112,11 @@ public class SocketRyClient {
mSocketHandler = null;
}
- public class SocketHandler extends Handler {
+ public class SocketHandler extends Handler {
- private SocketMessageListener mListener;
+ private SocketMessageListener mListener;
private LivePushRyViewHolder livePushRyViewHolder;
- private String mLiveUid;
+ private String mLiveUid;
public SocketHandler(SocketMessageListener listener) {
mListener = new WeakReference<>(listener).get();
@@ -621,11 +622,39 @@ public class SocketRyClient {
.setGiftType(map.getInteger("giftId"))
.setLuid(conString.toString())).setUname(map.getString("userName")).setLiveType(Integer.parseInt(map.getString("level"))));
break;
+ case Constants.LIVE_VOTE_CREATE:
+ Bus.get().post(new LiveAudienceEvent()
+ .setType(LiveAudienceEvent.LiveAudienceType.VOTE_CREATE)
+ .setObject(map)
+ );
+ break;
+ case Constants.LIVE_VOTE_END:
+ Bus.get().post(new LiveAudienceEvent()
+ .setType(LiveAudienceEvent.LiveAudienceType.VOTE_END)
+ .setObject(map)
+ );
+ EventBus.getDefault().post(new LiveAnchorEvent()
+ .setType(LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_END)
+ .setObject(map)
+ );
+ break;
+ case Constants.LIVE_VOTE_UPDATE:
+ //通知给观众
+ Bus.get().post(new LiveAudienceEvent()
+ .setType(LiveAudienceEvent.LiveAudienceType.VOTE_UPDATE)
+ .setObject(map)
+ );
+ //通知给主播
+ EventBus.getDefault().post(new LiveAnchorEvent()
+ .setType(LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_UPDATE)
+ .setObject(map)
+ );
+ break;
}
}
- private void buyGuardInSameRoom(JSONObject map) {
+ private void buyGuardInSameRoom(JSONObject map) {
LiveBuyGuardMsgBean buyGuardMsgBean = new LiveBuyGuardMsgBean();
buyGuardMsgBean.setUid(map.getString("uid"));
buyGuardMsgBean.setUserName(map.getString("ct"));
@@ -635,7 +664,7 @@ public class SocketRyClient {
mListener.onBuyGuard(buyGuardMsgBean);
}
- private void buyGuardByNotify(JSONObject map) {
+ private void buyGuardByNotify(JSONObject map) {
if (mLiveUid.equals(map.getString("liveuid"))) {
buyGuardInSameRoom(map);
//同一直播间,玩家自己开通,也能看到全服通知
@@ -668,7 +697,7 @@ public class SocketRyClient {
}
- private void buyZuoJiByNotify(JSONObject map) {
+ private void buyZuoJiByNotify(JSONObject map) {
LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean();
receiveGiftBean.setUserNiceName(map.getString("nickname"));
receiveGiftBean.setCarName(map.getString("carname"));
@@ -677,7 +706,7 @@ public class SocketRyClient {
}
- private void buyLiangNameByNotify(JSONObject map) {
+ private void buyLiangNameByNotify(JSONObject map) {
LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean();
receiveGiftBean.setUserNiceName(map.getString("nickname"));
receiveGiftBean.setLiangName(map.getString("liangname"));
@@ -685,7 +714,7 @@ public class SocketRyClient {
mListener.onBuyLiangName(receiveGiftBean);
}
- private void buyVipByNotify(JSONObject map) {
+ private void buyVipByNotify(JSONObject map) {
LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean();
receiveGiftBean.setUserNiceName(map.getString("nicename"));
receiveGiftBean.setVipName(map.getString("ct"));
@@ -709,7 +738,7 @@ public class SocketRyClient {
mListener.onBuyVip(receiveGiftBean);
}
- private void sendActiveMsg(JSONObject map, SocketReceiveBean received) {
+ private void sendActiveMsg(JSONObject map, SocketReceiveBean received) {
String msgtype = map.getString("msgtype");
if ("1".equals(msgtype)) {//新年大作战活动
LiveChatBean chatBean = new LiveChatBean();
@@ -900,7 +929,7 @@ public class SocketRyClient {
}
}
- private void xydComplete(JSONObject map) {
+ private void xydComplete(JSONObject map) {
LiveReceiveGiftBean receiveGiftBean = new LiveReceiveGiftBean();
receiveGiftBean.setAvatar(map.getString("uhead") + "");
receiveGiftBean.setUserNiceName(map.getString("uname"));
@@ -1014,7 +1043,7 @@ public class SocketRyClient {
/**
* 接收到系统消息,显示在聊天栏中
*/
- private void systemChatMessage(String content) {
+ private void systemChatMessage(String content) {
LiveChatBean bean = new LiveChatBean();
bean.setContent(content);
bean.setType(LiveChatBean.SYSTEM);
@@ -1024,7 +1053,7 @@ public class SocketRyClient {
/**
* 接收到系统消息,显示在聊天栏中
*/
- private void systemChatMessage2(String content) {
+ private void systemChatMessage2(String content) {
LiveChatBean bean = new LiveChatBean();
bean.setContent(content);
bean.setType(LiveChatBean.SYSTEM2);
@@ -1034,7 +1063,7 @@ public class SocketRyClient {
/**
* 处理观众与主播连麦逻辑
*/
- private void processLinkMic(JSONObject map) {
+ private void processLinkMic(JSONObject map) {
int action = map.getIntValue("action");
switch (action) {
case 1://主播收到观众连麦的申请
@@ -1089,7 +1118,7 @@ public class SocketRyClient {
*
* @param map
*/
- private void processLinkMicAnchor(JSONObject map) {
+ private void processLinkMicAnchor(JSONObject map) {
int action = map.getIntValue("action");
switch (action) {
case 1://收到其他主播连麦的邀请的回调
@@ -1128,7 +1157,7 @@ public class SocketRyClient {
*
* @param map
*/
- private void processAnchorLinkMicPk(JSONObject map) {
+ private void processAnchorLinkMicPk(JSONObject map) {
int action = map.getIntValue("action");
Log.i("Socket", "action = " + action + " json = " + map.toString());
diff --git a/live/src/main/java/com/yunbao/live/utils/LiveAnchorVoteManager.java b/live/src/main/java/com/yunbao/live/utils/LiveAnchorVoteManager.java
new file mode 100644
index 000000000..8ea230e2a
--- /dev/null
+++ b/live/src/main/java/com/yunbao/live/utils/LiveAnchorVoteManager.java
@@ -0,0 +1,121 @@
+package com.yunbao.live.utils;
+
+import android.os.Handler;
+import android.os.Looper;
+
+import com.yunbao.common.CommonAppContext;
+import com.yunbao.common.bean.LiveRoomVoteModel;
+import com.yunbao.common.http.base.HttpCallback;
+import com.yunbao.common.http.live.LiveNetManager;
+import com.yunbao.common.interfaces.OnItemClickListener;
+import com.yunbao.common.utils.ToastUtil;
+import com.yunbao.live.event.LiveAnchorEvent;
+
+import org.greenrobot.eventbus.EventBus;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+/**
+ * 主播投票管理器,可以创建投票和手动结束投票
+ */
+public class LiveAnchorVoteManager {
+ private static LiveAnchorVoteManager manager;
+ private String liveUid;
+ private boolean isVoting = false;
+ private LiveRoomVoteModel vote;
+ private TimerTask task;
+
+
+ private LiveAnchorVoteManager() {
+ }
+
+
+ public static LiveAnchorVoteManager getInstance() {
+ if (manager == null) {
+ manager = new LiveAnchorVoteManager();
+ }
+ return manager;
+ }
+
+
+ public void createVote(String liveUid, String question, String answer1, String answer2, OnItemClickListener listener) {
+ if (isVoting) {
+ return;
+ }
+ this.liveUid = liveUid;
+ LiveNetManager.get(CommonAppContext.getTopActivity())
+ .createLiveVote(liveUid, question, answer1, answer2, new HttpCallback() {
+ @Override
+ public void onSuccess(LiveRoomVoteModel data) {
+ data.setAnswer1(answer1);
+ data.setAnswer2(answer2);
+ data.setLiveUid(liveUid);
+ vote = data;
+ createTimerTask();
+ EventBus.getDefault().post(new LiveAnchorEvent()
+ .setType(LiveAnchorEvent.LiveAnchorType.VOTE_CREATE)
+ .setObject(data)
+ );
+ listener.onItemClick(vote, 0);
+ }
+
+ @Override
+ public void onError(String error) {
+ ToastUtil.show(error);
+ LiveRoomVoteModel voteModel = new LiveRoomVoteModel();
+ voteModel.setContent(error);
+ listener.onItemClick(voteModel, -1);
+ }
+ });
+ }
+
+ private void createTimerTask() {
+ if (isVoting) {
+ task.cancel();
+ }
+ task = new TimerTask() {
+ @Override
+ public void run() {
+ isVoting = true;
+ new Handler(Looper.getMainLooper()).post(() -> {
+ entVote((bean, position) -> {
+ EventBus.getDefault().post(new LiveAnchorEvent()
+ .setType(LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_END)
+ .setObject(bean)
+ );
+ });
+ });
+ }
+ };
+ new Timer().schedule(task, vote.getTime() * 1000L);
+
+ }
+
+ public void entVote(OnItemClickListener msg) {
+ if (isVoting) {
+ task.cancel();
+ }
+ LiveNetManager.get(CommonAppContext.getTopActivity())
+ .endLiveVote(liveUid, new HttpCallback() {
+ @Override
+ public void onSuccess(String data) {
+ isVoting = false;
+ msg.onItemClick(data, 0);
+ }
+
+ @Override
+ public void onError(String error) {
+ msg.onItemClick(error, -1);
+ }
+ });
+
+ }
+
+ public void clear() {
+ if (task != null) {
+ task.cancel();
+ task = null;
+ }
+ }
+}
diff --git a/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java b/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java
new file mode 100644
index 000000000..4bdd5ec68
--- /dev/null
+++ b/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java
@@ -0,0 +1,259 @@
+package com.yunbao.live.utils;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.os.Handler;
+import android.os.Looper;
+import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.widget.ImageView;
+import android.widget.ProgressBar;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.yunbao.common.bean.LiveRoomVoteModel;
+import com.yunbao.common.http.base.HttpCallback;
+import com.yunbao.common.http.live.LiveNetManager;
+import com.yunbao.common.utils.StringUtil;
+import com.yunbao.common.utils.ToastUtil;
+import com.yunbao.live.R;
+import com.yunbao.live.activity.LiveRyAnchorActivity;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+/**
+ * 直播间投票控件管理器
+ */
+public class LiveRoomVoteManager {
+ private final Context mContext;
+ private final View voteLayout;
+ private final View voteRoot;
+ private final View mVoteShow;
+ private final View mClose;
+ private final ImageView mAnchorVoteHide;
+ private final boolean isAnchor;
+
+ private final TextView mTitle;
+ private final TextView mSubmit;
+ private final TextView mCancel;
+ private final ProgressBar mProgress;
+
+
+ LiveRoomVoteModel createVoteModel;
+
+ public LiveRoomVoteManager(Context mContext, View root) {
+ this.mContext = mContext;
+ mAnchorVoteHide = root.findViewById(R.id.vote_hide);
+ mVoteShow = root.findViewById(R.id.vote_show);
+ mClose = root.findViewById(R.id.vote_close);
+ voteLayout = root.findViewById(R.id.vote_layout);
+ voteRoot = root.findViewById(R.id.live_room_vote);
+ mTitle = root.findViewById(R.id.title);
+ mSubmit = root.findViewById(R.id.vote_sub1);
+ mCancel = root.findViewById(R.id.vote_sub2);
+ mProgress = root.findViewById(R.id.vote_progress);
+ mAnchorVoteHide.setOnClickListener(v -> hideAnchorVote());
+ mVoteShow.setOnClickListener(v -> hideAnchorVote());
+ mClose.setOnClickListener(v -> close());
+ if (mContext instanceof LiveRyAnchorActivity) {
+ isAnchor = true;
+ } else {
+ isAnchor = false;
+ mClose.setVisibility(View.INVISIBLE);
+ }
+ hide();
+ initClick();
+ }
+
+ private void close() {
+ mTitle.setText(R.string.live_vote_close_title);
+ mSubmit.setText(R.string.live_vote_close_yes);
+ mCancel.setText(R.string.live_vote_close_no);
+ mCancel.setOnClickListener(v -> {
+ mTitle.setText(createVoteModel.getContent());
+ mSubmit.setText(createVoteModel.getAnswer1());
+ mCancel.setText(createVoteModel.getAnswer2());
+ initClick();
+ });
+ mSubmit.setOnClickListener(v -> endAnchorVote());
+ }
+
+ private void initClick() {
+ if (isAnchor) {
+ return;
+ }
+ mSubmit.setOnClickListener(v -> updateVote(true));
+ mCancel.setOnClickListener(v -> updateVote(false));
+ }
+
+ private void updateVote(boolean isSubmit) {
+ LiveNetManager.get(mContext)
+ .updateLiveVote(createVoteModel.getLiveUid(), isSubmit, new HttpCallback() {
+ @Override
+ public void onSuccess(String data) {
+ mCancel.setOnClickListener(null);
+ mSubmit.setOnClickListener(null);
+
+ if (isSubmit) {
+ mSubmit.setTextColor(Color.parseColor("#FFB800"));
+ mCancel.setTextColor(Color.parseColor("#999999"));
+ } else {
+ mCancel.setTextColor(Color.parseColor("#FFB800"));
+ mSubmit.setTextColor(Color.parseColor("#999999"));
+ }
+ mSubmit.setTag(createVoteModel.getLiveUid());
+
+ }
+
+ @Override
+ public void onError(String error) {
+ ToastUtil.show(error);
+ }
+ });
+ }
+
+ private void endAnchorVote() {
+ LiveAnchorVoteManager.getInstance().entVote((bean, position) -> {
+ if (position == -1) {
+ ToastUtil.show(bean);
+ return;
+ }
+ mClose.setVisibility(View.INVISIBLE);
+ });
+ }
+
+ public void endTimerTask(String msg) {
+ if (isAnchor) {
+ LiveAnchorVoteManager.getInstance().clear();
+ }
+ mCancel.setOnClickListener(null);
+ mSubmit.setOnClickListener(null);
+
+ mSubmit.setText(createVoteModel.getAnswer1());
+ mCancel.setText(createVoteModel.getAnswer2());
+
+ new Timer().schedule(new TimerTask() {
+ int time = 6;
+
+ @Override
+ public void run() {
+ new Handler(Looper.getMainLooper()).post(() -> {
+ if (--time == 0) {
+ hide();
+ cancel();
+ return;
+ }
+ mTitle.setText(String.format(mContext.getString(R.string.live_room_vote_over_tip), msg, time + ""));
+ });
+ }
+ }, 0, 1000);
+ }
+
+ public void setCreateVoteModel(LiveRoomVoteModel createVoteModel) {
+ try {
+ if (createVoteModel.getStatus() == 0) {
+ hide();
+ return;
+ }
+ this.createVoteModel = createVoteModel;
+ mTitle.setText(createVoteModel.getContent());
+ mSubmit.setText(createVoteModel.getAnswer1());
+ mCancel.setText(createVoteModel.getAnswer2());
+ mCancel.setOnClickListener(null);
+ mSubmit.setOnClickListener(null);
+ if (mSubmit.getTag() == null || !mSubmit.getTag().equals(createVoteModel.getLiveUid())) {
+ mSubmit.setTextColor(Color.WHITE);
+ mCancel.setTextColor(Color.WHITE);
+ initClick();
+ }
+ if (!StringUtil.isEmpty(createVoteModel.getVote())) {
+ mCancel.setOnClickListener(null);
+ mSubmit.setOnClickListener(null);
+
+ if (createVoteModel.isVoteLeft()) {
+ mSubmit.setTextColor(Color.parseColor("#FFB800"));
+ mCancel.setTextColor(Color.parseColor("#999999"));
+ } else {
+ mCancel.setTextColor(Color.parseColor("#FFB800"));
+ mSubmit.setTextColor(Color.parseColor("#999999"));
+ }
+ mSubmit.setTag(createVoteModel.getLiveUid());
+ }
+ if (createVoteModel.getAnswer1Num() == 0 && createVoteModel.getAnswer2Num() == 0) {
+ mProgress.setMax(20);
+ setLength(10);
+ } else {
+ mProgress.setMax(createVoteModel.getAnswer1Num() + createVoteModel.getAnswer2Num());
+ setLength(createVoteModel.getAnswer1Num());
+ }
+ show();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ public void setLength(int length) {
+ length = mProgress.getMax() - length;
+ mProgress.setProgress(length);
+ }
+
+ private void hideAnchorVote() {
+ boolean hide = mAnchorVoteHide.getTag() == null || (boolean) mAnchorVoteHide.getTag();
+ Animation animation;
+ if (hide) {
+ animation = AnimationUtils.loadAnimation(mContext, R.anim.view_live_anchor_vote_out);
+ } else {
+ animation = AnimationUtils.loadAnimation(mContext, R.anim.view_live_anchor_vote_in);
+ }
+ animation.setAnimationListener(new Animation.AnimationListener() {
+ @Override
+ public void onAnimationStart(Animation animation) {
+ if (!hide) {
+ voteRoot.setVisibility(View.VISIBLE);
+ mAnchorVoteHide.setVisibility(View.VISIBLE);
+ mVoteShow.setVisibility(View.GONE);
+ if (isAnchor) {
+ mClose.setVisibility(View.VISIBLE);
+ }
+ }
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ if (hide) {
+ voteRoot.setVisibility(View.INVISIBLE);
+ mAnchorVoteHide.setVisibility(View.GONE);
+ mVoteShow.setVisibility(View.VISIBLE);
+ if (isAnchor) {
+ mClose.setVisibility(View.INVISIBLE);
+ }
+ }
+ mAnchorVoteHide.setTag(!hide);
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+
+ }
+ });
+ voteRoot.startAnimation(animation);
+ }
+
+ public void setMarginPosition(int position) {
+ RelativeLayout.LayoutParams voteLayoutParams = (RelativeLayout.LayoutParams) voteLayout.getLayoutParams();
+ voteLayoutParams.topMargin = position;
+ voteLayout.setLayoutParams(voteLayoutParams);
+ }
+
+ public void show() {
+ voteLayout.setVisibility(View.VISIBLE);
+ }
+
+ public void hide() {
+ voteLayout.setVisibility(View.GONE);
+ mSubmit.setTag(null);
+ }
+}
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 1b409fe14..18ca369c4 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
@@ -71,6 +71,7 @@ import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.LinkMicUserBean;
import com.yunbao.common.bean.LiveAnchorCallMeModel;
+import com.yunbao.common.bean.LiveRoomVoteModel;
import com.yunbao.common.bean.LiveAnchorSayModel;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveGiftBean;
@@ -99,6 +100,7 @@ import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.RandomPkManager;
+import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.utils.DialogUitl;
@@ -148,6 +150,7 @@ import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog;
import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
+import com.yunbao.live.event.LiveAnchorEvent;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpConsts;
@@ -157,6 +160,7 @@ import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter;
import com.yunbao.live.presenter.LiveGiftAnimPresenter;
import com.yunbao.live.presenter.LiveLightAnimPresenter;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
+import com.yunbao.live.utils.LiveRoomVoteManager;
import com.yunbao.live.utils.LiveTextRender;
import com.yunbao.live.utils.LoadDian9TuUtil;
@@ -352,6 +356,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private TextView mAnchorSayText;
private ImageView mAnchorSayHide;
//----!主播说组件---//
+ //----投票组件---//
+ private LiveRoomVoteManager voteManager;
+ //----!投票组件---//
private Banner topBanner1, topBanner2;//心愿单&联系方式
public SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow;
private String mAnchorName;//主播名字
@@ -996,6 +1003,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
};
mRoot = (ViewGroup) findViewById(R.id.root);
+ voteManager = new LiveRoomVoteManager(mContext, mRoot);
mAvatar = (ImageView) findViewById(R.id.avatar);
mLevelAnchor = (ImageView) findViewById(R.id.level_anchor);
@@ -1085,6 +1093,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
RelativeLayout.LayoutParams msgLayoutLayoutParams = (RelativeLayout.LayoutParams) msgLayout.getLayoutParams();
msgLayoutLayoutParams.topMargin = topMargin + DpUtil.dp2px(50);
msgLayout.setLayoutParams(msgLayoutLayoutParams);
+ voteManager.setMarginPosition(topMargin + DpUtil.dp2px(50));
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)
mChatRecyclerView.getLayoutParams();
@@ -1475,6 +1484,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (!IMLoginManager.get(mContext).hintChat()) {
msgLayout.setVisibility(View.VISIBLE);
}
+ AppManager.runDebugCode(() -> msgLayout.setVisibility(View.GONE));
+ voteManager.hide();
if (d_pk_view != null) {
d_pk_view.setVisibility(View.GONE);
}
@@ -3104,7 +3115,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (mContext instanceof LiveAudienceActivity) {
int type = 0;
GuardUserModel model = new GuardUserModel();
- if (TextUtils.isEmpty(guardUserModel.getGuardType())) {
+ if (guardUserModel != null && TextUtils.isEmpty(guardUserModel.getGuardType())) {
type = Integer.parseInt(guardUserModel.getGuardType());
}
if (chatBean.getGuardType() != 0 && chatBean.getGuardType() > type) {
@@ -3669,6 +3680,39 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
}
+ public void setVoteData(String question, String answer1, String answer2, String num1, String num2) {
+ try {
+ LiveRoomVoteModel voteModel = new LiveRoomVoteModel();
+ voteModel.setStatus(1);
+ voteModel.setContent(question);
+ voteModel.setAnswer1(answer1);
+ voteModel.setAnswer2(answer2);
+ voteModel.setAnswer1Num(Integer.parseInt(num1));
+ voteModel.setAnswer2Num(Integer.parseInt(num2));
+ voteModel.setLiveUid(mLiveUid);
+ Log.i("voteManager", voteManager.toString());
+ voteManager.setCreateVoteModel(voteModel);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ public void dismissVote(String msg, String data) {
+ voteManager.endTimerTask(msg);
+ LiveChatBean bean = new LiveChatBean();
+ bean.setType(LiveChatBean.SYSTEM3_COLOR);
+ bean.setContent(data);
+ mLiveChatAdapter.insertItem(bean);
+ }
+
+ public void setVoteData(LiveRoomVoteModel voteModel) {
+ Log.i("voteModel", voteModel.toString());
+ voteModel.setLiveUid(mLiveUid);
+ voteManager.setCreateVoteModel(voteModel);
+ }
+
+
private static class LiveRoomHandler extends Handler {
private LiveRoomViewHolder mLiveRoomViewHolder;
@@ -4232,6 +4276,33 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
}
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void updateSubForAnchor(LiveAnchorEvent event) {
+ if (mContext instanceof LiveAudienceActivity) {
+ return;
+ }
+ if (event.getType() == LiveAnchorEvent.LiveAnchorType.VOTE_CREATE) {
+ voteManager.setCreateVoteModel((LiveRoomVoteModel) event.getObject());
+ } else if (event.getType() == LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_END) {
+ LiveRoomVoteModel voteModel = JSONObject.parseObject(event.getObject().toString(), LiveRoomVoteModel.class);
+ Log.i(">>>", voteModel.toString());
+ String content = voteModel.getResult();
+ if (!StringUtil.isEmpty(voteModel.getOptionText())) {
+ content = voteModel.getResult().replace(voteModel.getOptionText(), "" + voteModel.getOptionText() + "");
+ }
+ dismissVote(voteModel.getResult(), content);
+ } else if (event.getType() == LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_UPDATE) {
+ JSONObject map = (JSONObject) event.getObject();
+ setVoteData(
+ map.getString("question"),
+ map.getString("answer1"),
+ map.getString("answer2"),
+ map.getString("num1"),
+ map.getString("num2")
+ );
+ }
+ }
+
@Subscribe(threadMode = ThreadMode.MAIN)
public void updateSub(LiveAudienceEvent event) {
switch (event.getType()) {
@@ -4914,6 +4985,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override
public void onBannerClick(List datas, int position) {
if (datas.size() > 0) {
+ if (position >= mTopBannerList.size()) {
+ position = 0;
+ }
if (mTopBannerList.get(position).getType() == TopBannerCustomViewHolder.TYPE_CALL_ANCHOR) {
Dialog loading = DialogUitl.loadingDialog(mContext);
loading.show();
@@ -4999,7 +5073,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
call.setType(TopBannerCustomViewHolder.TYPE_CALL_ANCHOR);
mTopBannerList.add(0, call);
topBanner1.update(mTopBannerList);
- topBanner2.update(mTopBannerList);
+ if (topBanner2.getVisibility() == View.VISIBLE) {
+ topBanner2.update(mTopBannerList);
+ }
}
}
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 ec5f3a44d..40aff0c3d 100644
--- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java
+++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java
@@ -269,6 +269,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override
public void run() {
+ try{
+
Log.e("ImgLoader1", data.getAvatar());
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.clearData();
@@ -364,6 +366,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
}
enterRoomNew();
+
+ }catch (Exception e){
+ e.printStackTrace();
+ }
}
});
@@ -497,6 +503,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
//初始化顶部banner
mLiveRoomViewHolder.initTopBanner();
mLiveRoomViewHolder.updateTopBanner();
+ mLiveRoomViewHolder.setVoteData(data.getEnterRoomInfo().getVoteModel());
isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention());
if (isattention == 0) {
diff --git a/live/src/main/res/anim/view_live_anchor_vote_in.xml b/live/src/main/res/anim/view_live_anchor_vote_in.xml
new file mode 100644
index 000000000..66653d76e
--- /dev/null
+++ b/live/src/main/res/anim/view_live_anchor_vote_in.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/anim/view_live_anchor_vote_out.xml b/live/src/main/res/anim/view_live_anchor_vote_out.xml
new file mode 100644
index 000000000..7cc876eeb
--- /dev/null
+++ b/live/src/main/res/anim/view_live_anchor_vote_out.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/drawable/background_292929.xml b/live/src/main/res/drawable/background_292929.xml
new file mode 100644
index 000000000..1d68201b3
--- /dev/null
+++ b/live/src/main/res/drawable/background_292929.xml
@@ -0,0 +1,9 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/drawable/background_cc000.xml b/live/src/main/res/drawable/background_cc000.xml
new file mode 100644
index 000000000..a242d6264
--- /dev/null
+++ b/live/src/main/res/drawable/background_cc000.xml
@@ -0,0 +1,9 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/drawable/background_live_vote_cc000.xml b/live/src/main/res/drawable/background_live_vote_cc000.xml
new file mode 100644
index 000000000..985c06422
--- /dev/null
+++ b/live/src/main/res/drawable/background_live_vote_cc000.xml
@@ -0,0 +1,9 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/drawable/bg_live_room_vote_hide.xml b/live/src/main/res/drawable/bg_live_room_vote_hide.xml
new file mode 100644
index 000000000..8fc2af891
--- /dev/null
+++ b/live/src/main/res/drawable/bg_live_room_vote_hide.xml
@@ -0,0 +1,10 @@
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/drawable/live_room_qa_progress.xml b/live/src/main/res/drawable/live_room_qa_progress.xml
new file mode 100644
index 000000000..586780551
--- /dev/null
+++ b/live/src/main/res/drawable/live_room_qa_progress.xml
@@ -0,0 +1,36 @@
+
+
+
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/layout/dialog_anchor_call_edit_app.xml b/live/src/main/res/layout/dialog_anchor_call_edit_app.xml
index 329aea0e5..5002ca0bd 100644
--- a/live/src/main/res/layout/dialog_anchor_call_edit_app.xml
+++ b/live/src/main/res/layout/dialog_anchor_call_edit_app.xml
@@ -69,7 +69,7 @@
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:background="@drawable/bg_live_ready_btn2"
- android:text="保存"
+ android:text="@string/save"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
diff --git a/live/src/main/res/layout/dialog_live_anchor_create_qa.xml b/live/src/main/res/layout/dialog_live_anchor_create_qa.xml
new file mode 100644
index 000000000..a88e63a8c
--- /dev/null
+++ b/live/src/main/res/layout/dialog_live_anchor_create_qa.xml
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/layout/sim_live_room_vote.xml b/live/src/main/res/layout/sim_live_room_vote.xml
new file mode 100644
index 000000000..0696585ba
--- /dev/null
+++ b/live/src/main/res/layout/sim_live_room_vote.xml
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml
index ef9aa8d2a..db2e6b405 100644
--- a/live/src/main/res/layout/view_live_room.xml
+++ b/live/src/main/res/layout/view_live_room.xml
@@ -1303,7 +1303,13 @@
android:layout_marginBottom="-30dp"
android:background="@color/white"
android:visibility="invisible" />
-
+
Date: Wed, 17 May 2023 16:14:50 +0800
Subject: [PATCH 5/5] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=BB=E6=92=AD?=
=?UTF-8?q?=E6=8A=95=E7=A5=A8=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../yunbao/common/bean/LiveRoomVoteModel.java | 7 +++-
.../live/activity/LiveAudienceActivity.java | 32 ++++++++++++-----
.../live/utils/LiveRoomVoteManager.java | 15 ++++++++
.../yunbao/live/views/LiveRoomViewHolder.java | 36 +++++--------------
4 files changed, 53 insertions(+), 37 deletions(-)
diff --git a/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java b/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java
index e08329ec4..c9de60a77 100644
--- a/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java
+++ b/common/src/main/java/com/yunbao/common/bean/LiveRoomVoteModel.java
@@ -1,5 +1,6 @@
package com.yunbao.common.bean;
+import com.alibaba.fastjson.annotation.JSONField;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.utils.StringUtil;
@@ -166,8 +167,12 @@ public class LiveRoomVoteModel extends BaseModel {
public void setVote(String vote) {
this.vote = vote;
}
- public boolean isVoteLeft(){
+
+ public boolean isVoteLeft() {
return vote.equals("option_content_first_num");
}
+ public boolean isVote() {
+ return !StringUtil.isEmpty(vote);
+ }
}
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 2f2a4e1ab..b9fc80899 100644
--- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java
+++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java
@@ -1337,22 +1337,36 @@ public class LiveAudienceActivity extends LiveActivity {
break;
case VOTE_CREATE:
case VOTE_UPDATE:
+ LiveRoomVoteModel voteModel = new LiveRoomVoteModel();
JSONObject map = (JSONObject) event.getObject();
- manager.mLiveRoomViewHolder.setVoteData(
- map.getString("question"),
- map.getString("answer1"),
- map.getString("answer2"),
- map.getString("num1"),
- map.getString("num2")
- );
+ try {
+ voteModel.setStatus(1);
+ voteModel.setLiveUid(mLiveUid);
+ voteModel.setContent(map.getString("question"));
+ voteModel.setAnswer1(map.getString("answer1"));
+ voteModel.setAnswer2(map.getString("answer2"));
+ voteModel.setAnswer1Num(map.getInteger("num1"));
+ voteModel.setAnswer2Num(map.getInteger("num2"));
+ manager.mLiveRoomViewHolder.setVoteData(voteModel);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
break;
case VOTE_END:
try {
- LiveRoomVoteModel voteModel = JSONObject.parseObject(event.getObject().toString(), LiveRoomVoteModel.class);
+ voteModel = new LiveRoomVoteModel();
+ map = (JSONObject) event.getObject();
+ voteModel.setStatus(map.getInteger("status"));
+ voteModel.setContent(map.getString("question"));
+ voteModel.setAnswer1(map.getString("answer1"));
+ voteModel.setAnswer2(map.getString("answer2"));
+ voteModel.setAnswer1Num(map.getInteger("num1"));
+ voteModel.setAnswer2Num(map.getInteger("num2"));
System.out.println(">>>" + voteModel);
String content = voteModel.getResult();
if (!StringUtil.isEmpty(voteModel.getOptionText())) {
- content =voteModel.getResult().replace(voteModel.getOptionText(), "" + voteModel.getOptionText() + "");
+ content = voteModel.getResult().replace(voteModel.getOptionText(), "" + voteModel.getOptionText() + "");
}
manager.mLiveRoomViewHolder.dismissVote(voteModel.getResult(), content);
} catch (Exception e) {
diff --git a/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java b/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java
index 4bdd5ec68..1ed2c70b9 100644
--- a/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java
+++ b/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java
@@ -82,6 +82,8 @@ public class LiveRoomVoteManager {
private void initClick() {
if (isAnchor) {
+ mCancel.setOnClickListener(null);
+ mSubmit.setOnClickListener(null);
return;
}
mSubmit.setOnClickListener(v -> updateVote(true));
@@ -188,6 +190,9 @@ public class LiveRoomVoteManager {
mProgress.setMax(createVoteModel.getAnswer1Num() + createVoteModel.getAnswer2Num());
setLength(createVoteModel.getAnswer1Num());
}
+ if(isAnchor){
+ mClose.setVisibility(View.VISIBLE);
+ }
show();
} catch (Exception e) {
e.printStackTrace();
@@ -256,4 +261,14 @@ public class LiveRoomVoteManager {
voteLayout.setVisibility(View.GONE);
mSubmit.setTag(null);
}
+ public void fold(){
+ if(mVoteShow.getVisibility()!=View.VISIBLE){
+ hideAnchorVote();
+ }
+ }
+ public void expansion(){
+ if(mVoteShow.getVisibility()==View.VISIBLE){
+ hideAnchorVote();
+ }
+ }
}
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 18ca369c4..b2e79b4fd 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
@@ -1519,7 +1519,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
enterRoomLeave.setVisibility(View.GONE);
topBanner1.setVisibility(View.GONE);
topBanner2.setVisibility(View.GONE);
-
+ topBanner1.update(mTopBannerList);
+ topBanner2.update(mTopBannerList);
removeDetailView();
}
@@ -3680,24 +3681,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
}
- public void setVoteData(String question, String answer1, String answer2, String num1, String num2) {
- try {
- LiveRoomVoteModel voteModel = new LiveRoomVoteModel();
- voteModel.setStatus(1);
- voteModel.setContent(question);
- voteModel.setAnswer1(answer1);
- voteModel.setAnswer2(answer2);
- voteModel.setAnswer1Num(Integer.parseInt(num1));
- voteModel.setAnswer2Num(Integer.parseInt(num2));
- voteModel.setLiveUid(mLiveUid);
- Log.i("voteManager", voteManager.toString());
- voteManager.setCreateVoteModel(voteModel);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
public void dismissVote(String msg, String data) {
voteManager.endTimerTask(msg);
LiveChatBean bean = new LiveChatBean();
@@ -3709,6 +3692,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void setVoteData(LiveRoomVoteModel voteModel) {
Log.i("voteModel", voteModel.toString());
voteModel.setLiveUid(mLiveUid);
+ if(voteModel.isVote()){
+ voteManager.fold();
+ }else{
+ voteManager.expansion();
+ }
voteManager.setCreateVoteModel(voteModel);
}
@@ -4292,14 +4280,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
dismissVote(voteModel.getResult(), content);
} else if (event.getType() == LiveAnchorEvent.LiveAnchorType.VOTE_ANCHOR_UPDATE) {
- JSONObject map = (JSONObject) event.getObject();
- setVoteData(
- map.getString("question"),
- map.getString("answer1"),
- map.getString("answer2"),
- map.getString("num1"),
- map.getString("num2")
- );
+ LiveRoomVoteModel voteModel = JSONObject.parseObject(event.getObject().toString(), LiveRoomVoteModel.class);
+ setVoteData(voteModel);
}
}