Merge branch 'yuqianwei' into dev_6.7.0

# Conflicts:
#	live/src/main/res/values/strings.xml
This commit is contained in:
余前卫 2024-06-07 15:46:53 +08:00
commit c20147bf8f
32 changed files with 891 additions and 2 deletions

View File

@ -202,6 +202,8 @@ public class Constants {
public static final String LuckyAngel = "LuckyCheck";//幸运天使 public static final String LuckyAngel = "LuckyCheck";//幸运天使
public static final String Lucky100Check = "Lucky100Check";//幸运天使 public static final String Lucky100Check = "Lucky100Check";//幸运天使
public static final String PrankSendData = "PrankSendData";//整蛊进度
public static final int SOCKET_WHAT_CONN = 0; public static final int SOCKET_WHAT_CONN = 0;
public static final int SOCKET_WHAT_DISCONN = 2; public static final int SOCKET_WHAT_DISCONN = 2;
public static final int SOCKET_WHAT_BROADCAST = 1; public static final int SOCKET_WHAT_BROADCAST = 1;

View File

@ -0,0 +1,162 @@
package com.yunbao.common.bean;
import java.util.List;
public class PrankProgressBean extends BaseModel {
private int status;//整蛊状态 0.关闭 1.开启
private int prank_turntable_status;// 转盘整蛊状态 0=关闭 1=开启
private int prank_type;// 整蛊类型 1.礼物整蛊 2.连击整蛊
private List<PrankList> prank_list;// 整蛊进度
private List<PrankList> completed_list;// 待完成的整蛊
public PrankProgressBean(){
}
public static class PrankList{
private int gift_id;// 礼物ID
private int gift_num;// 整蛊需要的礼物数量
private String prank_content; // 整蛊内容
private int send_num; // 用户已赠送的礼物数量
private int completed_num;// 待完成的整蛊次数
private String gift_name;// 礼物名称
private String gift_icon; // 礼物图片链接
public int getGift_id() {
return gift_id;
}
public void setGift_id(int gift_id) {
this.gift_id = gift_id;
}
public int getGift_num() {
return gift_num;
}
public void setGift_num(int gift_num) {
this.gift_num = gift_num;
}
public String getPrank_content() {
return prank_content;
}
public void setPrank_content(String prank_content) {
this.prank_content = prank_content;
}
public int getSend_num() {
return send_num;
}
public void setSend_num(int send_num) {
this.send_num = send_num;
}
public int getCompleted_num() {
return completed_num;
}
public void setCompleted_num(int completed_num) {
this.completed_num = completed_num;
}
public String getGift_name() {
return gift_name;
}
public void setGift_name(String gift_name) {
this.gift_name = gift_name;
}
public String getGift_icon() {
return gift_icon;
}
public void setGift_icon(String gift_icon) {
this.gift_icon = gift_icon;
}
//计算完成度
public double getCompletionRate() {
if (gift_num == 0) return 0; // Avoid division by zero
return (double) send_num / gift_num;
}
public PrankList(int gift_id, int gift_num, String prank_content, int send_num, int completed_num, String gift_name, String gift_icon) {
this.gift_id = gift_id;
this.gift_num = gift_num;
this.prank_content = prank_content;
this.send_num = send_num;
this.completed_num = completed_num;
this.gift_name = gift_name;
this.gift_icon = gift_icon;
}
@Override
public String toString() {
return "PrankList{" +
"gift_id=" + gift_id +
", gift_num=" + gift_num +
", prank_content='" + prank_content + '\'' +
", send_num=" + send_num +
", completed_num=" + completed_num +
", gift_name='" + gift_name + '\'' +
", gift_icon='" + gift_icon + '\'' +
'}';
}
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getPrank_type() {
return prank_type;
}
public void setPrank_type(int prank_type) {
this.prank_type = prank_type;
}
public List<PrankList> getPrank_list() {
return prank_list;
}
public void setPrank_list(List<PrankList> prank_list) {
this.prank_list = prank_list;
}
public List<PrankList> getCompleted_list() {
return completed_list;
}
public void setCompleted_list(List<PrankList> completed_list) {
this.completed_list = completed_list;
}
public int getPrank_turntable_status() {
return prank_turntable_status;
}
public void setPrank_turntable_status(int prank_turntable_status) {
this.prank_turntable_status = prank_turntable_status;
}
@Override
public String toString() {
return "PrankProgressBean{" +
"status=" + status +
", prank_turntable_status=" + prank_turntable_status +
", prank_type=" + prank_type +
", prank_list=" + prank_list +
", completed_list=" + completed_list +
'}';
}
}

View File

@ -56,6 +56,7 @@ import com.yunbao.common.bean.PkRankBean;
import com.yunbao.common.bean.PrankGiftBean; import com.yunbao.common.bean.PrankGiftBean;
import com.yunbao.common.bean.PrankGiftResultBean; import com.yunbao.common.bean.PrankGiftResultBean;
import com.yunbao.common.bean.PrankHttpTurntableBean; import com.yunbao.common.bean.PrankHttpTurntableBean;
import com.yunbao.common.bean.PrankProgressBean;
import com.yunbao.common.bean.QuickGiftSendGiftModel; import com.yunbao.common.bean.QuickGiftSendGiftModel;
import com.yunbao.common.bean.RandomPkUserBean; import com.yunbao.common.bean.RandomPkUserBean;
import com.yunbao.common.bean.RankPkInfoBean; import com.yunbao.common.bean.RankPkInfoBean;
@ -510,6 +511,12 @@ public interface PDLiveApi {
@Query("prank_type") String prank_type @Query("prank_type") String prank_type
); );
/**
* 获取整蛊进度列表
*/
@GET("/api/public/?service=Prank.prankCompletedList")
Observable<ResponseModel<PrankProgressBean>> getPrankProgressList(@Query("anchor_id") String anchor_id);
/** /**
* 设置礼物整蛊 * 设置礼物整蛊
*/ */

View File

@ -56,6 +56,7 @@ import com.yunbao.common.bean.PkRankBean;
import com.yunbao.common.bean.PrankGiftBean; import com.yunbao.common.bean.PrankGiftBean;
import com.yunbao.common.bean.PrankGiftResultBean; import com.yunbao.common.bean.PrankGiftResultBean;
import com.yunbao.common.bean.PrankHttpTurntableBean; import com.yunbao.common.bean.PrankHttpTurntableBean;
import com.yunbao.common.bean.PrankProgressBean;
import com.yunbao.common.bean.QuickGiftSendGiftModel; import com.yunbao.common.bean.QuickGiftSendGiftModel;
import com.yunbao.common.bean.RandomPkUserBean; import com.yunbao.common.bean.RandomPkUserBean;
import com.yunbao.common.bean.RankPkInfoBean; import com.yunbao.common.bean.RankPkInfoBean;
@ -899,6 +900,25 @@ public class LiveNetManager {
}).isDisposed(); }).isDisposed();
} }
/**
* 获取整蛊进度列表
*/
public void getPrankProgressList(String mLiveUid, HttpCallback<PrankProgressBean> callback){
API.get().pdLiveApi(mContext)
.getPrankProgressList(mLiveUid)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(responseModel->{
if (callback != null){
callback.onSuccess(responseModel.getData().getInfo());
}
},throwable->{
if (callback != null){
callback.onError(throwable.getMessage());
}
} ).isDisposed();
}
/** /**
* 设置礼物整蛊 * 设置礼物整蛊
*/ */

View File

@ -1048,6 +1048,11 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
} }
@Override
public void onUpdatePrankProgress(String prankString) {
}
/** /**
* 腾讯sdk连麦时候主播混流 * 腾讯sdk连麦时候主播混流
*/ */

View File

@ -579,6 +579,11 @@ public class LiveAudienceActivity extends LiveActivity {
manager.prankTurntable(msgtype, time, jsonObject); manager.prankTurntable(msgtype, time, jsonObject);
} }
@Override
public void onUpdatePrankProgress(String prankString) {
}
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (manager != null && manager.getsudGameMin()) { if (manager != null && manager.getsudGameMin()) {

View File

@ -1452,6 +1452,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
} }
} }
@Override
public void onUpdatePrankProgress(String prankString) {
}
/** /**
* 腾讯sdk连麦时候主播混流 * 腾讯sdk连麦时候主播混流

View File

@ -0,0 +1,77 @@
package com.yunbao.live.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.PrankProgressBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.live.R;
import java.util.ArrayList;
import java.util.List;
public class ComboAdapter extends RecyclerView.Adapter<ComboAdapter.MyViewHolder>{
private List<PrankProgressBean.PrankList> mList = new ArrayList<>();
private Context mContext;
public ComboAdapter(Context context){
mContext = context;
}
public void setList(List<PrankProgressBean.PrankList> list){
mList.clear();
mList.addAll(list);
notifyDataSetChanged();
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new MyViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_combo_vote, parent, false));
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
PrankProgressBean.PrankList data = mList.get(position);
holder.itemView.setOnClickListener(v-> onItemClickListener.onItemClick(v,data.getGift_id()));
holder.combo_item_prank_name.setText(data.getPrank_content());
ImgLoader.display(mContext,data.getGift_icon(),holder.combo_item_icon);
holder.combo_item_combo.setText(String.valueOf(data.getSend_num()));
}
@Override
public int getItemCount() {
return mList.size();
}
class MyViewHolder extends RecyclerView.ViewHolder{
private TextView combo_item_prank_name,combo_item_combo;
private ImageView combo_item_icon;
public MyViewHolder(@NonNull View itemView){
super(itemView);
combo_item_prank_name = itemView.findViewById(R.id.combo_item_prank_name);
combo_item_combo = itemView.findViewById(R.id.combo_item_combo);
combo_item_icon = itemView.findViewById(R.id.combo_item_icon);
}
}
private OnItemClickListener onItemClickListener;
public interface OnItemClickListener {
void onItemClick(View view,int giftId);
}
public void addOnItemClickListener(OnItemClickListener onItemClickListener){
this.onItemClickListener = onItemClickListener;
}
}

View File

@ -42,6 +42,7 @@ public class FrameGiftAdapter extends RecyclerView.Adapter {
if (!TextUtils.isEmpty(wishGiftId) && TextUtils.equals(giftJson.get(position).getId() + "", wishGiftId)) { if (!TextUtils.isEmpty(wishGiftId) && TextUtils.equals(giftJson.get(position).getId() + "", wishGiftId)) {
Bus.get().post(new LiveGiftItemEvent().setLiveGiftModel(giftJson.get(position))); Bus.get().post(new LiveGiftItemEvent().setLiveGiftModel(giftJson.get(position)));
wishGiftId = null;
} }
FrameGiftViewHolder frameGiftViewHolder = (FrameGiftViewHolder) holder; FrameGiftViewHolder frameGiftViewHolder = (FrameGiftViewHolder) holder;

View File

@ -0,0 +1,88 @@
package com.yunbao.live.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.PrankProgressBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.live.R;
import com.yunbao.live.views.LiveRoomViewHolder;
import java.util.ArrayList;
import java.util.List;
public class PrankAdapter extends RecyclerView.Adapter<PrankAdapter.MyViewHolder> {
private List<PrankProgressBean.PrankList> mList = new ArrayList<>();
private Context mContext;
public PrankAdapter(Context context){
mContext = context;
}
public void setList(List<PrankProgressBean.PrankList> list){
mList.clear();
mList.addAll(list);
notifyDataSetChanged();
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new MyViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_prank_progress, parent, false));
}
@SuppressLint("SetTextI18n")
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
PrankProgressBean.PrankList data = mList.get(position);
holder.itemView.setOnClickListener(v-> onItemClickListener.onItemClick(v,data.getGift_id()));
holder.prank_item_subscript.setText(String.valueOf(data.getCompleted_num()));
holder.prank_item_prank_name.setText(data.getPrank_content());
holder.prank_item_gift_name.setText(data.getGift_name());
holder.prank_item_now_progress.setText(String.valueOf(data.getSend_num()));
holder.prank_item_total_progress.setText("/"+ data.getGift_num());
ImgLoader.display(mContext,data.getGift_icon(),holder.prank_item_icon);
holder.prank_item_progress.setMax(data.getGift_num());
holder.prank_item_progress.setProgress(data.getSend_num());
}
@Override
public int getItemCount() {
return mList.size();
}
class MyViewHolder extends RecyclerView.ViewHolder{
private TextView prank_item_subscript,prank_item_prank_name,prank_item_gift_name,prank_item_now_progress,prank_item_total_progress;
private ImageView prank_item_icon;
private ProgressBar prank_item_progress;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
prank_item_subscript = itemView.findViewById(R.id.prank_item_subscript);
prank_item_prank_name = itemView.findViewById(R.id.prank_item_prank_name);
prank_item_gift_name = itemView.findViewById(R.id.prank_item_gift_name);
prank_item_now_progress = itemView.findViewById(R.id.prank_item_now_progress);
prank_item_total_progress = itemView.findViewById(R.id.prank_item_total_progress);
prank_item_icon = itemView.findViewById(R.id.prank_item_icon);
prank_item_progress = itemView.findViewById(R.id.prank_item_progress);
}
}
private OnItemClickListener onItemClickListener;
public interface OnItemClickListener {
void onItemClick(View view,int giftId);
}
public void addOnItemClickListener(OnItemClickListener onItemClickListener){
this.onItemClickListener = onItemClickListener;
}
}

View File

@ -341,4 +341,9 @@ public interface SocketMessageListener {
* *
*/ */
void onHourRank(LiveChatBean bean,JSONObject ranks); void onHourRank(LiveChatBean bean,JSONObject ranks);
/**
* 整蛊列表数据更新
*/
void onUpdatePrankProgress(String prankString);
} }

View File

@ -19,6 +19,9 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils; import com.blankj.utilcode.util.GsonUtils;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext; import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
@ -192,7 +195,7 @@ public class SocketRyClient {
SocketReceiveBean received = JSON.parseObject(socketMsg, SocketReceiveBean.class); SocketReceiveBean received = JSON.parseObject(socketMsg, SocketReceiveBean.class);
JSONObject map = received.getMsg().getJSONObject(0); JSONObject map = received.getMsg().getJSONObject(0);
// LogUtils.e("yqw=====>收到的socket:"+map.getString("_method_")+","+map.getString("ct"));
switch (map.getString("_method_")) { switch (map.getString("_method_")) {
//用户连麦 //用户连麦
case Constants.LIAN_MAI: case Constants.LIAN_MAI:
@ -251,7 +254,7 @@ public class SocketRyClient {
// LiveLinkMicPresenter.setHD(map.getString("ct")); // LiveLinkMicPresenter.setHD(map.getString("ct"));
break; break;
case Constants.SOCKET_SYSTEM://系统消息 case Constants.SOCKET_SYSTEM://系统消息
if (map.getString("ct").contains("甜蜜不停")) { if (map.getString("ct").contains("甜蜜不停")) {
break; break;
} }
UserBean us = CommonAppConfig.getInstance().getUserBean(); UserBean us = CommonAppConfig.getInstance().getUserBean();
@ -290,6 +293,19 @@ public class SocketRyClient {
} }
} }
break; break;
case Constants.PrankSendData:
//整蛊礼物刷新
if (map.getIntValue("action") == 13 && map.getString("msgtype").equals("4")){
String ctString = map.getString("ct");
JsonElement jsonElement = JsonParser.parseString(ctString);
if (jsonElement == null) break;
// LogUtils.e("yqw=====>整蛊礼物列表:"+ctString);
JsonObject jsonObject = jsonElement.getAsJsonObject();
systemChatMessage2(WordUtil.isNewZh() ? jsonObject.get("msg").getAsString() : jsonObject.get("msg_en").getAsString());
mListener.onUpdatePrankProgress(ctString);
}
break;
case Constants.SOCKET_KICK://踢人 case Constants.SOCKET_KICK://踢人
systemChatMessage2(map.getString("ct")); systemChatMessage2(map.getString("ct"));
mListener.onKick(map.getString("touid")); mListener.onKick(map.getString("touid"));

View File

@ -56,6 +56,16 @@ public class LiveGiftItemFragment extends BaseFragment {
frameGiftList.setLayoutManager(new GridLayoutManager(getActivity(), 4, GridLayoutManager.VERTICAL, false)); frameGiftList.setLayoutManager(new GridLayoutManager(getActivity(), 4, GridLayoutManager.VERTICAL, false));
frameGiftAdapter = new FrameGiftAdapter(contextLayoutGiftHeight, giftJson, mStream, mLiveUid, wishGiftId); frameGiftAdapter = new FrameGiftAdapter(contextLayoutGiftHeight, giftJson, mStream, mLiveUid, wishGiftId);
frameGiftList.setAdapter(frameGiftAdapter); frameGiftList.setAdapter(frameGiftAdapter);
frameGiftList.post(()->{
if (!TextUtils.isEmpty(wishGiftId) && !giftJson.isEmpty()){
for (int i = 0; i < giftJson.size(); i++) {
if (giftJson.get(i).getId()== Integer.parseInt(wishGiftId)){
frameGiftAdapter.giftSelect(giftJson.get(i));
}
}
}
});
} }
@Override @Override

View File

@ -44,6 +44,9 @@ import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.SizeUtils;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource; import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException; import com.bumptech.glide.load.engine.GlideException;
@ -51,6 +54,7 @@ import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target; import com.bumptech.glide.request.target.Target;
import com.google.gson.reflect.TypeToken;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.makeramen.roundedimageview.RoundedImageView; import com.makeramen.roundedimageview.RoundedImageView;
import com.ms.banner.Banner; import com.ms.banner.Banner;
@ -61,6 +65,7 @@ import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity; import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.bean.PrankProgressBean;
import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.utils.MobclickAgent;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
@ -148,9 +153,11 @@ import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.ZhuangBanActivity; import com.yunbao.live.activity.ZhuangBanActivity;
import com.yunbao.live.adapter.ComboAdapter;
import com.yunbao.live.adapter.LiveChatAdapter; import com.yunbao.live.adapter.LiveChatAdapter;
import com.yunbao.live.adapter.LiveRoomFastMessageRecyclerViewAdapter; import com.yunbao.live.adapter.LiveRoomFastMessageRecyclerViewAdapter;
import com.yunbao.live.adapter.LiveUserAdapter; import com.yunbao.live.adapter.LiveUserAdapter;
import com.yunbao.live.adapter.PrankAdapter;
import com.yunbao.live.bean.DrPkbean; import com.yunbao.live.bean.DrPkbean;
import com.yunbao.live.bean.LiveBuyGuardMsgBean; import com.yunbao.live.bean.LiveBuyGuardMsgBean;
import com.yunbao.live.bean.LiveChatBean; import com.yunbao.live.bean.LiveChatBean;
@ -195,6 +202,7 @@ import java.lang.ref.WeakReference;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -396,6 +404,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private View quick_gift_reminder; private View quick_gift_reminder;
private int guardType = 0; private int guardType = 0;
//整蛊进度列表功能
private View prank_group;
private TextView prank_group_title,prank_group_turntable;
private RecyclerView recycler_prank;
private ImageView prank_group_bottom_icon,prank_group_turntable_icon,prank_small_icon;
private PrankAdapter prankAdapter;
private ComboAdapter comboAdapter;
private List<PrankProgressBean.PrankList> prankAndComboList = new ArrayList<>();
public LiveRoomViewHolder setGuardType(int guardType) { public LiveRoomViewHolder setGuardType(int guardType) {
this.guardType = guardType; this.guardType = guardType;
return this; return this;
@ -1624,6 +1641,164 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
}); });
// dragonImmediateParticipation.setVisibility(View.GONE); // dragonImmediateParticipation.setVisibility(View.GONE);
//整蛊转盘优化更新
prank_group = findViewById(R.id.prank_group);//浮窗
prank_group_title = (TextView) findViewById(R.id.prank_group_title);//浮窗标题
recycler_prank = (RecyclerView) findViewById(R.id.recycler_prank);//列表
prank_group_turntable = (TextView) findViewById(R.id.prank_group_turntable);//文字转盘整蛊(用户端已删除,主播端为待完成整蛊按钮)
prank_group_bottom_icon = (ImageView) findViewById(R.id.prank_group_bottom_icon);//收起icon
prank_group_turntable_icon = (ImageView) findViewById(R.id.prank_group_turntable_icon);//转盘图标
prank_small_icon = (ImageView) findViewById(R.id.prank_small_icon);//收起后图标
//点击文字转盘整蛊(跳转转盘整蛊)
prank_group_turntable.setOnClickListener(v->{
});
//点击收起
prank_group_bottom_icon.setOnClickListener(v->{
prank_group.setVisibility(View.GONE);
prank_small_icon.setVisibility(View.VISIBLE);
});
//点击收起整蛊icon
prank_small_icon.setOnClickListener(v->{
prank_group.setVisibility(View.VISIBLE);
prank_small_icon.setVisibility(View.GONE);
});
//点击图片转盘整蛊(跳转转盘整蛊)
prank_group_turntable_icon.setOnClickListener(v->{
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.WE_CHEAT));
});
recycler_prank.setLayoutManager(new LinearLayoutManager(mContext));
prankAdapter = new PrankAdapter(mContext);
comboAdapter = new ComboAdapter(mContext);
//整蛊礼物点击
prankAdapter.addOnItemClickListener((view, giftId) -> {
// LogUtils.e("yqw=====>点击整蛊礼物:"+giftId);
openGiftDialog(String.valueOf(giftId));
});
//连击投票礼物点击
comboAdapter.addOnItemClickListener((view, giftId) -> {
// LogUtils.e("yqw=====>点击投票礼物:"+giftId);
openGiftDialog(String.valueOf(giftId));
});
}
//初始化整蛊列表进度
public void initPrankProgress(){
// LogUtils.e("yqw=====>主播id:"+mLiveUid);
//获取整蛊列表
LiveNetManager.get(mContext).getPrankProgressList(mLiveUid, new com.yunbao.common.http.base.HttpCallback<PrankProgressBean>() {
@Override
public void onSuccess(PrankProgressBean data) {
// LogUtils.e("yqw=====>整蛊列表:"+data);
prankAndComboList.clear();
prankAndComboList.addAll(data.getPrank_list());
setPrankList(data.getStatus(),data.getPrank_type(),data.getPrank_turntable_status());
}
@Override
public void onError(String error) {
prank_group.setVisibility(View.GONE);
prank_small_icon.setVisibility(View.GONE);
prank_group_turntable_icon.setVisibility(View.GONE);
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
}
});
}
//刷新整蛊礼物列表
public void refreshPrank(String newPrankData){
try {
// LogUtils.e("yqw=====>整蛊礼物数据1:"+newPrankData);
org.json.JSONObject ctString = new org.json.JSONObject(newPrankData);
if (ctString.getInt("is_update") == 1){
//列表全部更新
if (ctString.getInt("status")==1){
//编辑添加整蛊
initPrankProgress();
}else {
//编辑取消整蛊
prank_group.setVisibility(View.GONE);
prank_small_icon.setVisibility(View.GONE);
}
if (Integer.parseInt(ctString.getString("prank_turntable_status")) == 0){
prank_group_turntable_icon.setVisibility(View.GONE);
}
}else {
//送整蛊礼物更新
String prankListString = ctString.getString("prank_list");
List<PrankProgressBean.PrankList> prankList = GsonUtils.fromJson(prankListString,new TypeToken<List<PrankProgressBean.PrankList>>() {}.getType());
// LogUtils.e("yqw=====>整蛊礼物数据2:"+prankList.toString());
prankAndComboList.clear();
prankAndComboList.addAll(prankList);
setPrankList(Integer.parseInt(ctString.getString("status")), Integer.parseInt(ctString.getString("prank_type")), Integer.parseInt(ctString.getString("prank_turntable_status")));
}
}catch (Exception e){
LogUtils.e("yqw=====>转换错误:"+e.getMessage());
}
}
//设置整蛊礼物数据
private void setPrankList(int status,int mPrankType,int prankTurntableStatus){
// LogUtils.e("yqw=====>显示转盘icon:是否显示:"+(prankTurntableStatus == 1)+",是否在倒计时"+(lt_trickery.getVisibility() == View.VISIBLE));
if (prankTurntableStatus == 1 && lt_trickery.getVisibility() == View.GONE){
prank_group_turntable_icon.setVisibility(View.VISIBLE);
}else {
prank_group_turntable_icon.setVisibility(View.GONE);
}
// LogUtils.e("yqw=====>显示整蛊列表或者投票列表:"+status);
if (status == 1){
prank_group.setVisibility(View.VISIBLE);
if (mPrankType == 1){
sortByCompletionRate(prankAndComboList);
prankAdapter.setList(prankAndComboList);
recycler_prank.setAdapter(prankAdapter);
}else {
sortBySendNum(prankAndComboList);
comboAdapter.setList(prankAndComboList);
recycler_prank.setAdapter(comboAdapter);
prank_group_title.setText(R.string.combo_vote);
}
limitItem(Math.min(prankAndComboList.size(), 4));
}else {
prank_group.setVisibility(View.GONE);
prank_small_icon.setVisibility(View.GONE);
}
}
//根据完成度排序
private void sortByCompletionRate(List<PrankProgressBean.PrankList> items) {
Collections.sort(items, (item1, item2) -> Double.compare(item2.getCompletionRate(), item1.getCompletionRate()));
}
//根据连击数排列
private void sortBySendNum(List<PrankProgressBean.PrankList> items) {
Collections.sort(items, (item1, item2) -> {
return Integer.compare(item2.getSend_num(), item1.getSend_num()); // 从高到低排序
});
}
//设置最多显示4个项目
private void limitItem(int maxItem){
recycler_prank.post(() -> {
View itemView = recycler_prank.getChildAt(0);
int height = (itemView.getHeight()+ SizeUtils.dp2px(3f))*maxItem;
ViewGroup.LayoutParams layoutParams = recycler_prank.getLayoutParams();
layoutParams.height = height;
recycler_prank.setLayoutParams(layoutParams);
});
} }
int ttttttype = 0; int ttttttype = 0;
@ -4725,6 +4900,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
content = jsonObject.getString("content"); content = jsonObject.getString("content");
name = jsonObject.getString("user_nicename"); name = jsonObject.getString("user_nicename");
lt_trickery.setVisibility(View.VISIBLE); lt_trickery.setVisibility(View.VISIBLE);
prank_group_turntable_icon.setVisibility(View.GONE);
lt_trickery.setBackground(mContext.getResources().getDrawable(R.mipmap.img_buoy)); lt_trickery.setBackground(mContext.getResources().getDrawable(R.mipmap.img_buoy));
isClose = false; isClose = false;
starTimeloud(1, time); starTimeloud(1, time);
@ -4768,6 +4944,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
countDownTimerTrickery.cancel(); countDownTimerTrickery.cancel();
countDownTimerTrickery = null; countDownTimerTrickery = null;
lt_trickery.setVisibility(View.GONE); lt_trickery.setVisibility(View.GONE);
prank_group_turntable_icon.setVisibility(View.VISIBLE);
LiveNetManager.get(mContext).endPrankTurntable(mLiveUid, new com.yunbao.common.http.base.HttpCallback<BaseModel>() { LiveNetManager.get(mContext).endPrankTurntable(mLiveUid, new com.yunbao.common.http.base.HttpCallback<BaseModel>() {
@Override @Override
public void onSuccess(BaseModel data) { public void onSuccess(BaseModel data) {

View File

@ -589,6 +589,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.setVoteData(data.getEnterRoomInfo().getVoteModel()); mLiveRoomViewHolder.setVoteData(data.getEnterRoomInfo().getVoteModel());
mLiveRoomViewHolder.updateFansMessageRed(); mLiveRoomViewHolder.updateFansMessageRed();
mLiveRoomViewHolder.setFansGroup(data.getEnterRoomInfo().getIsFans()); mLiveRoomViewHolder.setFansGroup(data.getEnterRoomInfo().getIsFans());
//初始化整蛊进度列表
mLiveRoomViewHolder.initPrankProgress();
isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention()); isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention());
if (isattention == 0) { if (isattention == 0) {
@ -1736,6 +1738,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
} }
//整蛊进度数据更新
@Override
public void onUpdatePrankProgress(String prankString) {
if (mLiveRoomViewHolder != null){
mLiveRoomViewHolder.refreshPrank(prankString);
}
}
private PagerAdapter pagerAdapter = new PagerAdapter() { private PagerAdapter pagerAdapter = new PagerAdapter() {
@Override @Override
public int getCount() { public int getCount() {

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="6dp"/>
<solid android:color="#8065615A"/>
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="7dp"/>
<solid android:color="#80727272"/>
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="4dp"/>
<solid android:color="#8065615A"/>
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:topLeftRadius="4dp"/>
<solid android:color="#A6848484"/>
</shape>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="1dp"/>
<solid android:color="#FFA5A193"/>
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="1dp"/>
<solid android:color="#FFFFC949"/>
</shape>
</clip>
</item>
</layer-list>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="SmallSp"
android:layout_width="match_parent"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_height="21dp">
<ImageView
android:id="@+id/combo_item_icon"
android:layout_width="14dp"
android:layout_height="14dp"/>
<com.yunbao.common.views.weight.MarqueeTextView
android:id="@+id/combo_item_prank_name"
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="center"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed-medium"
android:textSize="8sp"
android:textColor="@color/white"
android:layout_marginStart="1dp" />
<TextView
android:id="@+id/combo_item_combo"
android:layout_width="wrap_content"
android:minWidth="12dp"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_marginStart="3dp"
android:textStyle="bold"
android:text="12"
android:textColor="#FFFFC949"
android:textSize="8sp"/>
</LinearLayout>

View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_marginTop="3dp"
android:background="@drawable/bg_prank_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="SmallSp">
<TextView
android:id="@+id/prank_item_subscript"
android:layout_width="11dp"
android:layout_height="11dp"
android:gravity="center"
android:background="@drawable/bg_prank_item_subscript"
android:textStyle="bold"
android:text="8"
android:textColor="#FFF9B003"
android:textSize="8sp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="16dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/prank_item_icon"
android:layout_marginEnd="3dp"
android:layout_width="14dp"
android:layout_height="14dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.yunbao.common.views.weight.MarqueeTextView
android:id="@+id/prank_item_prank_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:marqueeRepeatLimit="marquee_forever"
android:fontFamily="sans-serif-condensed-medium"
android:textColor="@color/white"
android:textSize="8sp"
android:text="跳舞跳舞跳"/>
<ProgressBar
android:id="@+id/prank_item_progress"
android:layout_width="match_parent"
android:layout_height="2dp"
android:progress="50"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:progressDrawable="@drawable/progress_prank_bg" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="3dp"
android:layout_marginEnd="3dp"
android:orientation="horizontal">
<com.yunbao.common.views.weight.MarqueeTextView
android:id="@+id/prank_item_gift_name"
android:layout_width="17dp"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="8sp"
android:singleLine="true"
android:marqueeRepeatLimit="marquee_forever"
android:ellipsize="marquee"
android:text="气球"
android:fontFamily="sans-serif-condensed-medium"/>
<TextView
android:id="@+id/prank_item_now_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:textStyle="bold"
android:textSize="8sp"
android:textColor="#FFFFC949"
android:text="12"/>
<TextView
android:id="@+id/prank_item_total_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="6sp"
android:text="/45"/>
</LinearLayout>
</LinearLayout>

View File

@ -2396,6 +2396,32 @@
android:gravity="bottom" android:gravity="bottom"
android:orientation="vertical"> android:orientation="vertical">
<!--整蛊进度列表-->
<include
android:id="@+id/prank_group"
android:visibility="gone"
layout="@layout/view_prank_group"/>
<ImageView
android:id="@+id/prank_small_icon"
android:layout_gravity="end"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:src="@mipmap/prank_icon"/>
<ImageView
android:id="@+id/prank_group_turntable_icon"
android:src="@mipmap/turntable_icon"
android:layout_gravity="end"
android:visibility="gone"
android:layout_marginBottom="5dp"
android:layout_marginEnd="16dp"
android:layout_width="44dp"
android:layout_height="46dp"/>
<LinearLayout <LinearLayout
android:id="@+id/sud_game_min" android:id="@+id/sud_game_min"
android:layout_width="75dp" android:layout_width="75dp"

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_marginBottom="5dp"
android:layout_marginEnd="3dp"
android:orientation="vertical"
android:layout_width="72dp"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp"
android:background="@drawable/bg_prank_group"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<TextView
android:id="@+id/prank_group_title"
android:ellipsize="end"
android:textColor="@color/white"
android:textSize="10sp"
android:singleLine="true"
android:textStyle="bold"
android:text="@string/prank_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:ignore="SmallSp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_prank"
android:overScrollMode="never"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="6dp"
android:gravity="center">
<TextView
android:id="@+id/prank_group_turntable"
android:background="@drawable/bg_prank_bottom_detail"
android:visibility="gone"
android:padding="3dp"
android:textSize="8sp"
android:ellipsize="end"
android:singleLine="true"
android:maxWidth="50dp"
android:textColor="@color/white"
android:fontFamily="sans-serif-condensed-medium"
android:text="@string/turntable_prank"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:ignore="SmallSp" />
<ImageView
android:id="@+id/prank_group_bottom_icon"
android:layout_width="wrap_content"
android:layout_height="12dp"
android:scaleType="centerInside"
android:layout_weight="1"
android:src="@mipmap/bottom_icon" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -117,6 +117,12 @@
<string name="live_fans_group_send_gift_tips">Fan group level Of Lv%s Can send this gift</string> <string name="live_fans_group_send_gift_tips">Fan group level Of Lv%s Can send this gift</string>
<string name="live_rad_pack_join_fans_group_tip">Join the fan group can be opened [Join]</string> <string name="live_rad_pack_join_fans_group_tip">Join the fan group can be opened [Join]</string>
<string name="live_rad_pack_join_fans_group_click_tip">Join the fan group to open</string> <string name="live_rad_pack_join_fans_group_click_tip">Join the fan group to open</string>
<string name="prank_progress">Tricky progress</string>
<string name="turntable_prank">Turntable</string>
<string name="details">Details></string>
<string name="combo_vote">Combo</string>
<string name="combo_vote_more">Most first</string>
<string name="live_prank_dialog_save">Clear</string> <string name="live_prank_dialog_save">Clear</string>
<string name="live_prank_dialog_clear">Save</string> <string name="live_prank_dialog_clear">Save</string>
<string name="live_prank_dialog_gift_type_todo">Switch to</string> <string name="live_prank_dialog_gift_type_todo">Switch to</string>

View File

@ -134,5 +134,11 @@
<string name="alive_prank_gift_add_gift_content_sub">確定</string> <string name="alive_prank_gift_add_gift_content_sub">確定</string>
<string name="alive_prank_gift_dialog_number_title">禮物數量</string> <string name="alive_prank_gift_dialog_number_title">禮物數量</string>
<string name="live_prank_gift_dialog_number_btn">+ 設置其他數量(最多9999)</string> <string name="live_prank_gift_dialog_number_btn">+ 設置其他數量(最多9999)</string>
<string name="prank_progress">整蠱進度</string>
<string name="turntable_prank">轉盤整蠱</string>
<string name="details">詳情></string>
<string name="combo_vote">連擊投票</string>
<string name="combo_vote_more">連擊最多優先</string>
<string name="alive_prank_gift_dialog_explain">整蠱說明</string> <string name="alive_prank_gift_dialog_explain">整蠱說明</string>
</resources> </resources>