diff --git a/common/src/main/java/com/yunbao/common/adapter/InteractionGamesAdapter.java b/common/src/main/java/com/yunbao/common/adapter/InteractionGamesAdapter.java index bbbc9e328..1143372ba 100644 --- a/common/src/main/java/com/yunbao/common/adapter/InteractionGamesAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/InteractionGamesAdapter.java @@ -13,6 +13,7 @@ import com.yunbao.common.R; import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.SpUtil; import com.yunbao.common.views.InteractionGamesChildViewHolder; import java.util.ArrayList; @@ -36,7 +37,7 @@ public class InteractionGamesAdapter extends RecyclerView.Adapter { @Override 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); - return new InteractionGamesChildViewHolder(runGamesView); + return new InteractionGamesChildViewHolder(runGamesView,mContext); } @Override @@ -51,6 +52,9 @@ public class InteractionGamesAdapter extends RecyclerView.Adapter { if (activityID != 0) { Bus.get().post(new CustomDrawerPopupEvent() .setDisMiss(true).setInteractionID(activityID).setInteraction(true).setChild(srcChild)); + if(model.getSudGameIsNew().equals("1")){ + SpUtil.getInstance().setLiveGameId(model.getId()); + } } diff --git a/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleInteractionGamesAdapter.java b/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleInteractionGamesAdapter.java index 109792917..cfc99a595 100644 --- a/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleInteractionGamesAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleInteractionGamesAdapter.java @@ -11,12 +11,11 @@ import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.R; import com.yunbao.common.bean.CustomSidebarChildModel; -import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.event.LiveNewRoleEvent; import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent; import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.SpUtil; import com.yunbao.common.views.InteractionGamesChildBottomViewHolder; -import com.yunbao.common.views.InteractionGamesChildViewHolder; import java.util.ArrayList; import java.util.List; @@ -53,6 +52,9 @@ public class LiveNewRoleInteractionGamesAdapter extends RecyclerView.Adapter { .setInteractionID(activityID) .setChild(child) .setInteraction(true)); + if(model.getSudGameIsNew().equals("1")){ + SpUtil.getInstance().setLiveGameId(model.getId()); + } } diff --git a/common/src/main/java/com/yunbao/common/utils/SpUtil.java b/common/src/main/java/com/yunbao/common/utils/SpUtil.java index 11184c438..e188b7f0d 100644 --- a/common/src/main/java/com/yunbao/common/utils/SpUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/SpUtil.java @@ -4,8 +4,13 @@ import android.content.Context; import android.content.SharedPreferences; import android.text.TextUtils; +import com.alibaba.fastjson.JSONArray; +import com.google.gson.Gson; import com.yunbao.common.CommonAppContext; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -37,9 +42,8 @@ public class SpUtil { public static final String ANCHOR_PK_TIME = "anchorPkTime"; //播放短视频上下滑动引导页 public static final String READ_VIDEO_GUIDE = "readVideoGuide"; - public static final String MESSAGE_SYS_DEL = "FIRST_DEL"; - + public static final String LIVE_GAME_NEWED_LIST = "LIVE_GAME_NEWED_LIST"; public SpUtil() { mSharedPreferences = CommonAppContext.sInstance.getSharedPreferences("SharedPreferences", Context.MODE_PRIVATE); @@ -56,6 +60,41 @@ public class SpUtil { return sInstance; } + public static void setLiveGameId(String gameId) { + String gameMap = getStringValue(LIVE_GAME_NEWED_LIST); + List 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 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; + } + + /** * 保存一个字符串 */ diff --git a/common/src/main/java/com/yunbao/common/views/InteractionGamesChildBottomViewHolder.java b/common/src/main/java/com/yunbao/common/views/InteractionGamesChildBottomViewHolder.java index 82ce39f46..76918b2ce 100644 --- a/common/src/main/java/com/yunbao/common/views/InteractionGamesChildBottomViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/InteractionGamesChildBottomViewHolder.java @@ -13,12 +13,12 @@ import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.R; import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.SpUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; public class InteractionGamesChildBottomViewHolder extends RecyclerView.ViewHolder { private ImageView funGamePic; private TextView funGameName; - private Context mContext; public InteractionGamesChildBottomViewHolder(@NonNull View itemView, Context context) { @@ -39,7 +39,7 @@ public class InteractionGamesChildBottomViewHolder extends RecyclerView.ViewHold ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic); } 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); }else { itemView.findViewById(R.id.icon_new_game).setVisibility(View.GONE); @@ -50,8 +50,6 @@ public class InteractionGamesChildBottomViewHolder extends RecyclerView.ViewHold if (interactionGamesCallBack != null) { interactionGamesCallBack.onItemViewClicks(model, rigts); } - - } }); } diff --git a/common/src/main/java/com/yunbao/common/views/InteractionGamesChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/InteractionGamesChildViewHolder.java index c989802b0..b4956c4d0 100644 --- a/common/src/main/java/com/yunbao/common/views/InteractionGamesChildViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/InteractionGamesChildViewHolder.java @@ -1,7 +1,9 @@ package com.yunbao.common.views; +import android.content.Context; import android.text.TextUtils; import android.view.View; +import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; @@ -13,28 +15,36 @@ import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.SpUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; public class InteractionGamesChildViewHolder extends RecyclerView.ViewHolder { private ImageView funGamePic; private TextView funGameName; + private Context mContext; - public InteractionGamesChildViewHolder(@NonNull View itemView) { + public InteractionGamesChildViewHolder(@NonNull View itemView,Context mContext) { super(itemView); + this.mContext = mContext; funGamePic = itemView.findViewById(R.id.fun_game_pic); funGameName = itemView.findViewById(R.id.fun_game_name); } 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) { ImgLoader.display(itemView.getContext(), model.getIcon(), funGamePic); } else { ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic); } - 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); }else { itemView.findViewById(R.id.icon_new_game).setVisibility(View.GONE); @@ -45,8 +55,6 @@ public class InteractionGamesChildViewHolder extends RecyclerView.ViewHolder { if (interactionGamesCallBack != null) { interactionGamesCallBack.onItemViewClicks(model, rigts); } - - } }); } diff --git a/common/src/main/res/layout/view_fun_games_child_view.xml b/common/src/main/res/layout/view_fun_games_child_view.xml index cf798f976..7db74bcc6 100644 --- a/common/src/main/res/layout/view_fun_games_child_view.xml +++ b/common/src/main/res/layout/view_fun_games_child_view.xml @@ -4,13 +4,13 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="12dp" + android:paddingEnd="7dp" android:gravity="center" android:orientation="vertical"> diff --git a/common/src/main/res/layout/view_fun_games_view.xml b/common/src/main/res/layout/view_fun_games_view.xml index a28b889fc..78a853118 100644 --- a/common/src/main/res/layout/view_fun_games_view.xml +++ b/common/src/main/res/layout/view_fun_games_view.xml @@ -39,6 +39,7 @@ diff --git a/common/src/main/res/layout/view_interaction_games_view.xml b/common/src/main/res/layout/view_interaction_games_view.xml index 9019b793c..78a29bb1c 100644 --- a/common/src/main/res/layout/view_interaction_games_view.xml +++ b/common/src/main/res/layout/view_interaction_games_view.xml @@ -23,16 +23,13 @@ android:textColor="#F6F7FB" android:textSize="14sp" /> - - - diff --git a/common/src/main/res/layout/view_live_new_roler_ights_interests.xml b/common/src/main/res/layout/view_live_new_roler_ights_interests.xml index 0cf062d9b..296ced4ea 100644 --- a/common/src/main/res/layout/view_live_new_roler_ights_interests.xml +++ b/common/src/main/res/layout/view_live_new_roler_ights_interests.xml @@ -22,6 +22,7 @@ \ No newline at end of file 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 46de579c3..316645f99 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -103,6 +103,7 @@ import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; diff --git a/live/src/main/res/mipmap-xxxhdpi/icon_one_guard.png b/live/src/main/res/mipmap-xxxhdpi/icon_one_guard.png index 3abf5768b..2627d8735 100644 Binary files a/live/src/main/res/mipmap-xxxhdpi/icon_one_guard.png and b/live/src/main/res/mipmap-xxxhdpi/icon_one_guard.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/icon_three_guard.png b/live/src/main/res/mipmap-xxxhdpi/icon_three_guard.png index e01b05325..bc7c56098 100644 Binary files a/live/src/main/res/mipmap-xxxhdpi/icon_three_guard.png and b/live/src/main/res/mipmap-xxxhdpi/icon_three_guard.png differ diff --git a/live/src/main/res/mipmap-xxxhdpi/icon_two_guard.png b/live/src/main/res/mipmap-xxxhdpi/icon_two_guard.png index 9d60ad85d..79468f42a 100644 Binary files a/live/src/main/res/mipmap-xxxhdpi/icon_two_guard.png and b/live/src/main/res/mipmap-xxxhdpi/icon_two_guard.png differ