1、直播间-互动游戏角标优化
This commit is contained in:
parent
8f82c7c785
commit
f14fb4612b
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存一个字符串
|
||||
*/
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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">
|
||||
<!--身份特权-->
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="40dp"
|
||||
|
||||
android:layout_height="40dp">
|
||||
<!--普通工具合集-->
|
||||
<ImageView
|
||||
@ -27,7 +27,6 @@
|
||||
android:layout_height="6dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="3dp"
|
||||
|
||||
android:layout_marginEnd="5dp"
|
||||
android:background="@drawable/bg_red_point"
|
||||
tools:visibility="visible" />
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/child_list"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
@ -23,16 +23,13 @@
|
||||
android:textColor="#F6F7FB"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/child_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<LinearLayout
|
||||
|
@ -2,14 +2,14 @@
|
||||
<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_width="200dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="7dp"
|
||||
android:gravity="start"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content">
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/child_list"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
@ -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;
|
||||
|
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 |
Loading…
Reference in New Issue
Block a user