Merge remote-tracking branch 'origin/dev_6.7.0' into dev_6.7.0

This commit is contained in:
余前卫 2024-06-14 14:40:51 +08:00
commit 002f0ad654
13 changed files with 216 additions and 99 deletions

View File

@ -882,6 +882,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
//加载整蛊
if(mLiveRoomViewHolder!=null){
mLiveRoomViewHolder.initPrankProgress();
mLiveRoomViewHolder.sendMsgPrank();
}
}

View File

@ -62,7 +62,6 @@ public class ComboAdapter extends RecyclerView.Adapter<ComboAdapter.MyViewHolder
combo_item_combo = itemView.findViewById(R.id.combo_item_combo);
combo_item_icon = itemView.findViewById(R.id.combo_item_icon);
}
}
private OnItemClickListener onItemClickListener;

View File

@ -6,6 +6,7 @@ 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.TYPE_TO_ANCHOR_PRANK;
import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_USER_MSG;
import static com.yunbao.live.bean.LiveChatBean.WISH_LIST_PROGRESS;
import static com.yunbao.live.bean.LiveChatBean.XYD_COMPLETE;
@ -520,7 +521,13 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
if (!StringUtil.isEmpty(bean.getBubble())) {
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
}
} else {
} else if(bean.getType() == TYPE_TO_ANCHOR_PRANK){
String str1 = "<font color='#ff1a1a'>娛樂整蠱</font>";
String str2 = "<font color='#0d0d0d'>全新升級,快去設置整蠱内容,給直播間增加更多趣味吧!</font>";
String str3 = "<font color='#3384ff'>>>立即前往>></font>";
mTextView.setText(Html.fromHtml(str1+str2+str3));
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
}else{
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
//加载.9图聊天气泡
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1);

View File

@ -14,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.PrankProgressBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.MarqueeTextView;
import com.yunbao.live.R;
@ -22,16 +23,23 @@ import com.yunbao.live.views.LiveRoomViewHolder;
import java.util.ArrayList;
import java.util.List;
public class PrankAdapter extends RecyclerView.Adapter<PrankAdapter.MyViewHolder> {
public class PrankAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private List<PrankProgressBean.PrankList> mList = new ArrayList<>();
private Context mContext;
private boolean isAn;
public static final int TYPE_GIFT = 1;
public static final int TYPE_COMBO = 2;
private int viewType1 = TYPE_GIFT;
public PrankAdapter(Context context){
mContext = context;
}
public void setViewType(int viewType) {
this.viewType1 = viewType;
}
public void setList(List<PrankProgressBean.PrankList> list){
mList.clear();
@ -48,14 +56,20 @@ public class PrankAdapter extends RecyclerView.Adapter<PrankAdapter.MyViewHolder
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if (viewType1 ==TYPE_GIFT){
return new MyViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_prank_progress, parent, false));
}else{
return new MyComboViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_combo_vote, parent, false));
}
}
@SuppressLint("SetTextI18n")
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
PrankProgressBean.PrankList data = mList.get(position);
if(viewHolder instanceof MyViewHolder){
MyViewHolder holder = (MyViewHolder) viewHolder;
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());
@ -65,7 +79,7 @@ public class PrankAdapter extends RecyclerView.Adapter<PrankAdapter.MyViewHolder
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());
holder.an_prank_name.setText(WordUtil.isNewZh() ? data.getGift_name() : data.getGift_name_en());
holder.an_prank_name.setText(data.getPrank_content());
holder.an_prank_remove.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -81,6 +95,13 @@ public class PrankAdapter extends RecyclerView.Adapter<PrankAdapter.MyViewHolder
holder.progressLayout.setVisibility(View.VISIBLE);
holder.nameLayout.setVisibility(View.VISIBLE);
}
}else{
MyComboViewHolder holder = (MyComboViewHolder) viewHolder;
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
@ -116,6 +137,20 @@ public class PrankAdapter extends RecyclerView.Adapter<PrankAdapter.MyViewHolder
}
}
class MyComboViewHolder extends RecyclerView.ViewHolder{
private TextView combo_item_prank_name,combo_item_combo;
private ImageView combo_item_icon;
public MyComboViewHolder(@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 {

View File

@ -31,6 +31,7 @@ public class LiveChatBean {
public static final int BLIND_BOX = 409;//盲盒礼物消息
public static final int TYPE_TO_USER_MSG = 500;//指定信息
public static final int TYPE_TO_ANCHOR_PRANK = 501;//整蠱-開播提示語
private String id;
private String userNiceName;

View File

@ -85,7 +85,7 @@ public class LivePrankAddGiftNumberDialog extends AbsDialogPopupWindow {
ViewClicksAntiShake.clicksAntiShake(mBtnNumber, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
DialogUitl.showSimpleInputDialog(mContext, WordUtil.isNewZh() ? "输入数量" : "Input number", DialogUitl.INPUT_TYPE_NUMBER, new DialogUitl.SimpleCallback() {
DialogUitl.showSimpleInputDialog(mContext, WordUtil.isNewZh() ? "输入数量" : "Input number", DialogUitl.INPUT_TYPE_NUMBER,4, new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
try {

View File

@ -249,6 +249,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O
mBtnAddGift.setVisibility(View.VISIBLE);
mGiftNotDate.setVisibility(View.VISIBLE);
}
ToastUtil.show(WordUtil.isNewZh()?"清空成功!":"Cleared successfully!");
}
});
mPrankBtn.setTag(0);

View File

@ -1,5 +1,6 @@
package com.yunbao.live.views;
import static com.yunbao.live.activity.LiveRyAnchorActivity.mLiveAnchorViewHolder;
import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY;
import android.app.Activity;
@ -183,6 +184,7 @@ import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
import com.yunbao.live.dialog.LiveGameDialogFragment;
import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LivePrankDialogFragment;
import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog;
import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
@ -415,17 +417,22 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
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<>();
private JsonElement completedList = new JsonArray();
private List<PrankProgressBean.PrankList> completedList = new ArrayList<>();
private int isPrank;
private boolean prankAnisShow;
private LinearLayout prank_top_layout;
private ImageView prank_group_top_icon;
public LiveRoomViewHolder setGuardType(int guardType) {
this.guardType = guardType;
return this;
}
@Override
protected int getLayoutId() {
return R.layout.view_live_room;
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onUpdata(String str) {
if ("svga_new_user_gif".equals(str)) {
@ -736,11 +743,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
sudNameHandler.postDelayed(sudNameRunnable, 10000);
}
@Override
protected int getLayoutId() {
return R.layout.view_live_room;
}
private View sudGameMin;
public void onShowHideEvent() {
@ -1367,20 +1369,36 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mLiveChatAdapter.removetItem(bean);
((LiveActivity) mContext).sendChatMessage("Hi~", null, null);
} else if (bean.getType() == -5) {
String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Turntable&a=tricky";
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
String url = CommonAppConfig.HOST + "/h5/activity/Turntable/index.html";
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken() +
"&active_id=6";
Log.i("tag", url);
Bundle bundle1 = new Bundle();
bundle1.putString("url", url);
LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment();
liveHDDialogFragment.setArguments(bundle1);
if(mContext instanceof LiveAudienceActivity){
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}else if(mContext instanceof LiveRyAnchorActivity){
liveHDDialogFragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
} else if (bean.getType() == RECOMMEND_CARD_NOTIFY) {
gotoLive(bean.getMsgModel().getAnchorId());
} else if (bean.getType() == bean.STAR_CHALLENGE_UPGRADE_NOTIFY) {
gotoLive(bean.getMsgModel().getLiveUid());
} else {
} else if(bean.getType()==bean.TYPE_TO_ANCHOR_PRANK){
LivePrankDialogFragment fragment = new LivePrankDialogFragment();
fragment.setOnPrankResultListener(new LivePrankDialogFragment.onPrankResultListener() {
@Override
public void OpenAndCloseListener() {
initPrankProgress();
}
});
fragment.setmLiveUid(mLiveUid);
fragment.show(((LiveRyAnchorActivity)mContext).getSupportFragmentManager(), "LivePrankDialogFragment");
mLiveAnchorViewHolder.closeMenuRed();
}else{
showUserDialog(bean.getId());
}
}
@ -1651,6 +1669,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
// dragonImmediateParticipation.setVisibility(View.GONE);
//整蛊转盘优化更新
prank_top_layout= (LinearLayout) findViewById(R.id.prank_top_layout);
prank_group_top_icon= (ImageView) findViewById(R.id.prank_group_top_icon);
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);//列表
@ -1661,18 +1681,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
//点击文字转盘整蛊(跳转转盘整蛊)
prank_group_turntable.setOnClickListener(v->{
prankAnisShow = !prankAnisShow;
List<PrankProgressBean.PrankList> tempList = new ArrayList<>();
for (int i = 0; i <prankAndComboList.size(); i++) {
if(prankAndComboList.get(i).getCompleted_num()!=0){
tempList.add(prankAndComboList.get(i));
}
if(isPrank==1){
prankAdapter.setViewType(PrankAdapter.TYPE_GIFT);
}else{
prankAdapter.setViewType(PrankAdapter.TYPE_COMBO);
}
if(prankAnisShow){
prankAdapter.showAnView(tempList,prankAnisShow);
prankAdapter.showAnView(completedList,prankAnisShow);
prank_group_turntable.setText(WordUtil.isNewZh()?"待完成整蠱":"progress");
}else{
prankAdapter.showAnView(prankAndComboList,prankAnisShow);
prank_group_turntable.setText(WordUtil.isNewZh()?"待完成整蠱":"To do");
}
L.e("prankAnisShow:"+prankAnisShow);
});
//点击收起
@ -1695,52 +1715,38 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
recycler_prank.setLayoutManager(new LinearLayoutManager(mContext));
prankAdapter = new PrankAdapter(mContext);
comboAdapter = new ComboAdapter(mContext);
initPrankAdapter();
}
//整蛊礼物点击
prankAdapter.addOnItemClickListener(new PrankAdapter.OnItemClickListener() {
public void sendMsgPrank(){
new Handler().postDelayed(new Runnable() {
@Override
public void onItemClick(View view, int giftId) {
openGiftDialog(String.valueOf(giftId));
public void run() {
LiveChatBean bean = new LiveChatBean();
bean.setContent("开播整蛊通知");
bean.setType(LiveChatBean.TYPE_TO_ANCHOR_PRANK);
mLiveChatAdapter.insertItem(bean);
}
@Override
public void onItemDel(int giftId) {
LiveNetManager.get(mContext).anchorClickFinish(mLiveUid, String.valueOf(giftId), new com.yunbao.common.http.base.HttpCallback<List<BaseModel>>() {
@Override
public void onSuccess(List<BaseModel> data) {
}, 1000);
}
@Override
public void onError(String error) {
}
});
L.e("onItemDel:"+giftId);
}
});
//连击投票礼物点击
comboAdapter.addOnItemClickListener((view, giftId) -> {
// LogUtils.e("yqw=====>点击投票礼物:"+giftId);
openGiftDialog(String.valueOf(giftId));
});
}
//初始化整蛊列表进度
public void initPrankProgress(){
prankAnisShow = false; //默认展示整蛊列表
// 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);
isPrank = data.getPrank_type();
prankAndComboList.clear();
prankAndComboList.addAll(data.getPrank_list());
completedList.clear();
completedList.addAll(data.getCompleted_list());
setPrankList(data.getStatus(),data.getPrank_type(),data.getPrank_turntable_status());
}
@ -1781,6 +1787,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
// LogUtils.e("yqw=====>整蛊礼物数据2:"+prankList.toString());
prankAndComboList.clear();
prankAndComboList.addAll(prankList);
String completedString = ctString.getString("completed_list");
List<PrankProgressBean.PrankList> completeds = GsonUtils.fromJson(completedString,new TypeToken<List<PrankProgressBean.PrankList>>() {}.getType());
completedList.clear();
completedList.addAll(completeds);
setPrankList(Integer.parseInt(ctString.getString("status")), Integer.parseInt(ctString.getString("prank_type")), Integer.parseInt(ctString.getString("prank_turntable_status")));
}
}catch (Exception e){
@ -1788,7 +1800,36 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
}
private void initPrankAdapter() {
prankAdapter = new PrankAdapter(mContext);
//整蛊礼物点击
prankAdapter.addOnItemClickListener(new PrankAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, int giftId) {
if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){
return;
}
openGiftDialog(String.valueOf(giftId));
}
@Override
public void onItemDel(int giftId) {
LiveNetManager.get(mContext).anchorClickFinish(mLiveUid, String.valueOf(giftId), new com.yunbao.common.http.base.HttpCallback<List<BaseModel>>() {
@Override
public void onSuccess(List<BaseModel> data) {
}
@Override
public void onError(String error) {
}
});
L.e("onItemDel:"+giftId);
}
});
}
//设置整蛊礼物数据
private void setPrankList(int status,int mPrankType,int prankTurntableStatus){
// LogUtils.e("yqw=====>显示转盘icon:是否显示:"+(prankTurntableStatus == 1)+",是否在倒计时"+(lt_trickery.getVisibility() == View.VISIBLE));
@ -1800,21 +1841,36 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
// LogUtils.e("yqw=====>显示整蛊列表或者投票列表:"+status);
if (status == 1){
prank_group.setVisibility(View.VISIBLE);
if (mPrankType == 1){
initPrankAdapter();
if (mPrankType == 1){//礼物
sortByCompletionRate(prankAndComboList);
prankAdapter.setViewType(PrankAdapter.TYPE_GIFT);
prankAdapter.setList(prankAndComboList);
recycler_prank.setAdapter(prankAdapter);
}else { //连击
sortBySendNum(prankAndComboList);
prankAdapter.setViewType(PrankAdapter.TYPE_COMBO);
prankAdapter.setList(prankAndComboList);
// prank_group_title.setText(R.string.combo_vote);
}
if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){
prank_top_layout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
prank_group.setVisibility(View.GONE);
prank_small_icon.setVisibility(View.VISIBLE);
}
});
prank_group_top_icon.setVisibility(View.VISIBLE);
if(mPrankType==1){
prank_group_turntable.setVisibility(View.VISIBLE);
}
prank_group_bottom_icon.setVisibility(View.GONE);
}else{
prank_group_turntable.setVisibility(View.GONE);
prank_group_top_icon.setVisibility(View.GONE);
}
}else {
sortBySendNum(prankAndComboList);
comboAdapter.setList(prankAndComboList);
recycler_prank.setAdapter(comboAdapter);
prank_group_title.setText(R.string.combo_vote);
}
recycler_prank.setAdapter(prankAdapter);
//主播可能打开整蛊功能但是不设置整蛊礼物这里会是空列表
if (!prankAndComboList.isEmpty()){
limitItem(mPrankType,Math.min(prankAndComboList.size(), 4));
@ -1828,6 +1884,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
}
//根据完成度排序
private void sortByCompletionRate(List<PrankProgressBean.PrankList> items) {
Collections.sort(items, (item1, item2) -> Double.compare(item2.getCompletionRate(), item1.getCompletionRate()));

View File

@ -157,7 +157,8 @@
android:layout_height="43dp"
android:layout_gravity="center"
android:background="@drawable/bg_prank_coin"
android:ems="10"
android:ems="20"
android:maxLength="20"
android:gravity="start|center"
android:hint="@string/live_prank_gift_add_gift_contnet_select"
android:paddingStart="12dp"

View File

@ -55,7 +55,6 @@
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/gift_add_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title">

View File

@ -109,8 +109,11 @@
<LinearLayout
android:id="@+id/anLayout"
android:layout_margin="5dp"
android:visibility="gone"
android:layout_marginBottom="5dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="2dp"
android:gravity="center_vertical"
tools:visibility="visible"
android:layout_width="match_parent"
@ -118,7 +121,8 @@
<com.yunbao.common.views.weight.MarqueeTextView
android:id="@+id/an_prank_name"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
@ -133,6 +137,7 @@
android:layout_width="20dp"
android:text="@string/prank_complete"
android:layout_marginLeft="5dp"
android:layout_gravity="end"
android:gravity="center"
android:paddingBottom="1dp"
android:textColor="#372B2B"

View File

@ -16,6 +16,7 @@
android:orientation="vertical">
<LinearLayout
android:id="@+id/prank_top_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
@ -33,6 +34,16 @@
android:layout_height="wrap_content"
tools:ignore="SmallSp" />
<ImageView
android:id="@+id/prank_group_top_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginStart="3dp"
tools:visibility="visible"
android:scaleType="centerInside"
android:src="@mipmap/bottom_icon" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView

View File

@ -118,8 +118,8 @@
<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="prank_progress">Tricky progress</string>
<string name="turntable_prank">Turntable</string>
<string name="prank_progress">Progress</string>
<string name="turntable_prank">To do</string>
<string name="details">Details></string>
<string name="combo_vote">Combo</string>
<string name="combo_vote_more">Most first</string>