1、直播间-互动游戏角标优化

This commit is contained in:
Martin 2024-07-01 16:55:46 +08:00
parent 8f82c7c785
commit f14fb4612b
14 changed files with 72 additions and 22 deletions

View File

@ -13,6 +13,7 @@ import com.yunbao.common.R;
import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.event.CustomDrawerPopupEvent;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.views.InteractionGamesChildViewHolder; import com.yunbao.common.views.InteractionGamesChildViewHolder;
import java.util.ArrayList; import java.util.ArrayList;
@ -36,7 +37,7 @@ public class InteractionGamesAdapter extends RecyclerView.Adapter {
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_fun_games_child_view3, parent, false); View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_fun_games_child_view3, parent, false);
return new InteractionGamesChildViewHolder(runGamesView); return new InteractionGamesChildViewHolder(runGamesView,mContext);
} }
@Override @Override
@ -51,6 +52,9 @@ public class InteractionGamesAdapter extends RecyclerView.Adapter {
if (activityID != 0) { if (activityID != 0) {
Bus.get().post(new CustomDrawerPopupEvent() Bus.get().post(new CustomDrawerPopupEvent()
.setDisMiss(true).setInteractionID(activityID).setInteraction(true).setChild(srcChild)); .setDisMiss(true).setInteractionID(activityID).setInteraction(true).setChild(srcChild));
if(model.getSudGameIsNew().equals("1")){
SpUtil.getInstance().setLiveGameId(model.getId());
}
} }

View File

@ -11,12 +11,11 @@ import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.event.CustomDrawerPopupEvent;
import com.yunbao.common.event.LiveNewRoleEvent; import com.yunbao.common.event.LiveNewRoleEvent;
import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent; import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.views.InteractionGamesChildBottomViewHolder; import com.yunbao.common.views.InteractionGamesChildBottomViewHolder;
import com.yunbao.common.views.InteractionGamesChildViewHolder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -53,6 +52,9 @@ public class LiveNewRoleInteractionGamesAdapter extends RecyclerView.Adapter {
.setInteractionID(activityID) .setInteractionID(activityID)
.setChild(child) .setChild(child)
.setInteraction(true)); .setInteraction(true));
if(model.getSudGameIsNew().equals("1")){
SpUtil.getInstance().setLiveGameId(model.getId());
}
} }

View File

@ -4,8 +4,13 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.text.TextUtils; import android.text.TextUtils;
import com.alibaba.fastjson.JSONArray;
import com.google.gson.Gson;
import com.yunbao.common.CommonAppContext; import com.yunbao.common.CommonAppContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -37,9 +42,8 @@ public class SpUtil {
public static final String ANCHOR_PK_TIME = "anchorPkTime"; public static final String ANCHOR_PK_TIME = "anchorPkTime";
//播放短视频上下滑动引导页 //播放短视频上下滑动引导页
public static final String READ_VIDEO_GUIDE = "readVideoGuide"; public static final String READ_VIDEO_GUIDE = "readVideoGuide";
public static final String MESSAGE_SYS_DEL = "FIRST_DEL"; public static final String MESSAGE_SYS_DEL = "FIRST_DEL";
public static final String LIVE_GAME_NEWED_LIST = "LIVE_GAME_NEWED_LIST";
public SpUtil() { public SpUtil() {
mSharedPreferences = CommonAppContext.sInstance.getSharedPreferences("SharedPreferences", Context.MODE_PRIVATE); mSharedPreferences = CommonAppContext.sInstance.getSharedPreferences("SharedPreferences", Context.MODE_PRIVATE);
@ -56,6 +60,41 @@ public class SpUtil {
return sInstance; return sInstance;
} }
public static void setLiveGameId(String gameId) {
String gameMap = getStringValue(LIVE_GAME_NEWED_LIST);
List<String> gameNewList;
gameNewList = JSONArray.parseArray(gameMap, String.class);
L.eSw("gameMap:" + gameMap);
if (gameNewList == null) {
gameNewList = new ArrayList<>();
}
for (int i = 0; i < gameNewList.size(); i++) {
if (gameNewList.get(i).equals(gameId)) {
gameNewList.remove(i);
break;
}
}
gameNewList.add(gameId);
setStringValue(LIVE_GAME_NEWED_LIST, new Gson().toJson(gameNewList));
}
public static boolean isLiveGameNew(String gameId) {
String gameMap = getStringValue(LIVE_GAME_NEWED_LIST);
List<String> gameNewList = new ArrayList<>();
gameNewList = JSONArray.parseArray(gameMap, String.class);
if (gameNewList == null) {
gameNewList = new ArrayList<>();
}
boolean isNew = false;
for (int i = 0; i < gameNewList.size(); i++) {
if (gameNewList.get(i).equals(gameId)) {
isNew = true;
}
}
return !isNew;
}
/** /**
* 保存一个字符串 * 保存一个字符串
*/ */

View File

@ -13,12 +13,12 @@ import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
public class InteractionGamesChildBottomViewHolder extends RecyclerView.ViewHolder { public class InteractionGamesChildBottomViewHolder extends RecyclerView.ViewHolder {
private ImageView funGamePic; private ImageView funGamePic;
private TextView funGameName; private TextView funGameName;
private Context mContext; private Context mContext;
public InteractionGamesChildBottomViewHolder(@NonNull View itemView, Context context) { public InteractionGamesChildBottomViewHolder(@NonNull View itemView, Context context) {
@ -39,7 +39,7 @@ public class InteractionGamesChildBottomViewHolder extends RecyclerView.ViewHold
ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic); ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic);
} }
funGameName.setText(model.getTitle()); funGameName.setText(model.getTitle());
if (!TextUtils.isEmpty(model.getSudGameIsNew())&&TextUtils.equals(model.getSudGameIsNew(),"1")){ if (!TextUtils.isEmpty(model.getSudGameIsNew())&&TextUtils.equals(model.getSudGameIsNew(),"1")&& SpUtil.isLiveGameNew(model.getId())){
itemView.findViewById(R.id.icon_new_game).setVisibility(View.VISIBLE); itemView.findViewById(R.id.icon_new_game).setVisibility(View.VISIBLE);
}else { }else {
itemView.findViewById(R.id.icon_new_game).setVisibility(View.GONE); itemView.findViewById(R.id.icon_new_game).setVisibility(View.GONE);
@ -50,8 +50,6 @@ public class InteractionGamesChildBottomViewHolder extends RecyclerView.ViewHold
if (interactionGamesCallBack != null) { if (interactionGamesCallBack != null) {
interactionGamesCallBack.onItemViewClicks(model, rigts); interactionGamesCallBack.onItemViewClicks(model, rigts);
} }
} }
}); });
} }

View File

@ -1,7 +1,9 @@
package com.yunbao.common.views; package com.yunbao.common.views;
import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@ -13,28 +15,36 @@ import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.event.CustomDrawerPopupEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
public class InteractionGamesChildViewHolder extends RecyclerView.ViewHolder { public class InteractionGamesChildViewHolder extends RecyclerView.ViewHolder {
private ImageView funGamePic; private ImageView funGamePic;
private TextView funGameName; private TextView funGameName;
private Context mContext;
public InteractionGamesChildViewHolder(@NonNull View itemView) { public InteractionGamesChildViewHolder(@NonNull View itemView,Context mContext) {
super(itemView); super(itemView);
this.mContext = mContext;
funGamePic = itemView.findViewById(R.id.fun_game_pic); funGamePic = itemView.findViewById(R.id.fun_game_pic);
funGameName = itemView.findViewById(R.id.fun_game_name); funGameName = itemView.findViewById(R.id.fun_game_name);
} }
public void setData(CustomSidebarChildModel model, boolean rigts) { public void setData(CustomSidebarChildModel model, boolean rigts) {
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams((int)
(mContext.getResources().getDisplayMetrics().widthPixels / 4.5),
ViewGroup.LayoutParams.WRAP_CONTENT);
itemView.setLayoutParams(layoutParams);
if (rigts) { if (rigts) {
ImgLoader.display(itemView.getContext(), model.getIcon(), funGamePic); ImgLoader.display(itemView.getContext(), model.getIcon(), funGamePic);
} else { } else {
ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic); ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic);
} }
funGameName.setText(model.getTitle()); funGameName.setText(model.getTitle());
if (!TextUtils.isEmpty(model.getSudGameIsNew())&&TextUtils.equals(model.getSudGameIsNew(),"1")){ if (!TextUtils.isEmpty(model.getSudGameIsNew())&&TextUtils.equals(model.getSudGameIsNew(),"1")&& SpUtil.isLiveGameNew(model.getId())){
itemView.findViewById(R.id.icon_new_game).setVisibility(View.VISIBLE); itemView.findViewById(R.id.icon_new_game).setVisibility(View.VISIBLE);
}else { }else {
itemView.findViewById(R.id.icon_new_game).setVisibility(View.GONE); itemView.findViewById(R.id.icon_new_game).setVisibility(View.GONE);
@ -45,8 +55,6 @@ public class InteractionGamesChildViewHolder extends RecyclerView.ViewHolder {
if (interactionGamesCallBack != null) { if (interactionGamesCallBack != null) {
interactionGamesCallBack.onItemViewClicks(model, rigts); interactionGamesCallBack.onItemViewClicks(model, rigts);
} }
} }
}); });
} }

View File

@ -4,13 +4,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:paddingEnd="7dp"
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<!--身份特权--> <!--身份特权-->
<RelativeLayout <RelativeLayout
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp"> android:layout_height="40dp">
<!--普通工具合集--> <!--普通工具合集-->
<ImageView <ImageView
@ -27,7 +27,6 @@
android:layout_height="6dp" android:layout_height="6dp"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:background="@drawable/bg_red_point" android:background="@drawable/bg_red_point"
tools:visibility="visible" /> tools:visibility="visible" />

View File

@ -39,6 +39,7 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/child_list" android:id="@+id/child_list"
android:layout_marginTop="10dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="16dp" /> android:layout_marginBottom="16dp" />

View File

@ -23,16 +23,13 @@
android:textColor="#F6F7FB" android:textColor="#F6F7FB"
android:textSize="14sp" /> android:textSize="14sp" />
</FrameLayout> </FrameLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/child_list" android:id="@+id/child_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="10dp"
android:layout_marginBottom="16dp" /> android:layout_marginBottom="16dp" />
<LinearLayout <LinearLayout

View File

@ -2,14 +2,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="200dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="7dp" android:layout_marginEnd="7dp"
android:gravity="start" android:gravity="start"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_marginTop="15dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:layout_height="wrap_content"> android:layout_height="wrap_content">

View File

@ -22,6 +22,7 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/child_list" android:id="@+id/child_list"
android:layout_marginTop="10dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>

View File

@ -103,6 +103,7 @@ import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB