直播间侧边栏美化

This commit is contained in:
Martin 2024-07-03 15:21:32 +08:00
parent 40a2843696
commit a68bee94a9
20 changed files with 78 additions and 45 deletions

View File

@ -31,11 +31,16 @@ public class LiveNewRoleFunGamesAdapter 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_view, parent, false);
return new NewRoleFunGamesChildViewHolder(runGamesView,showRed);
return new NewRoleFunGamesChildViewHolder(runGamesView,showRed,mContext);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams((int)
(mContext.getResources().getDisplayMetrics().widthPixels / 4.5),
ViewGroup.LayoutParams.WRAP_CONTENT);
holder.itemView.setLayoutParams(layoutParams);
NewRoleFunGamesChildViewHolder childViewHolder = (NewRoleFunGamesChildViewHolder) holder;
childViewHolder.setData(child.get(position), rigts);
}

View File

@ -63,12 +63,14 @@ public class LiveNewRoleInteractionGamesAdapter extends RecyclerView.Adapter {
});
}
@Override
public int getItemCount() {
return child.size();
}
public void updateData(List<CustomSidebarChildModel> mChild) {
child.clear();
/* if (mChild.size() > 8) {
for (int i = 0; i < 8; i++) {

View File

@ -39,10 +39,11 @@ public class LiveNewRolerPopupAdapter extends RecyclerView.Adapter {
switch (viewType) {
case FUN_GAMES:
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_new_roler_fun_games_view, parent, false);
return new LiveNewRoleFunGamesViewHolder(runGamesView);
return new LiveNewRoleFunGamesViewHolder(runGamesView,mContext);
case RIGHTS_INTERESTS:
//特权
View rightsInterestsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_roler_ights_interests, parent, false);
return new LiveNewRoleRigtsInterestsViewHolder(rightsInterestsView,showRed);
return new LiveNewRoleRigtsInterestsViewHolder(rightsInterestsView,showRed,mContext);
default:
View gamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_interaction_games_view, parent, false);
return new LiveNewRoleInteractionGamesViewHolder(gamesView,mContext);

View File

@ -30,11 +30,15 @@ public class NewRoleFunGamesAdapter 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_view2, parent, false);
return new NewRoleFunGamesChildViewHolder(runGamesView,false);
return new NewRoleFunGamesChildViewHolder(runGamesView,false,mContext);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams((int)
(mContext.getResources().getDisplayMetrics().widthPixels / 4.5),
ViewGroup.LayoutParams.WRAP_CONTENT);
holder.itemView.setLayoutParams(layoutParams);
NewRoleFunGamesChildViewHolder childViewHolder = (NewRoleFunGamesChildViewHolder) holder;
childViewHolder.setData(child.get(position), rigts);
}

View File

@ -10,6 +10,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.R;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.glide.ImgLoader;
@ -17,7 +18,7 @@ import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
public class InteractionGamesChildBottomViewHolder extends RecyclerView.ViewHolder {
private ImageView funGamePic;
private RoundedImageView funGamePic;
private TextView funGameName;
private Context mContext;

View File

@ -4,22 +4,20 @@ import android.content.Context;
import android.text.TextUtils;
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.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.R;
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 RoundedImageView funGamePic;
private TextView funGameName;
private Context mContext;

View File

@ -1,6 +1,8 @@
package com.yunbao.common.views;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
@ -25,21 +27,22 @@ public class LiveNewRoleFunGamesViewHolder extends RecyclerView.ViewHolder {
private RecyclerView childList;
private ImageView selectMoreIcon;
boolean isShowMore = true;
private Context mContext;
public LiveNewRoleFunGamesViewHolder(@NonNull View itemView) {
public LiveNewRoleFunGamesViewHolder(@NonNull View itemView, Context context) {
super(itemView);
this.mContext = context;
sendGoodGift = itemView.findViewById(R.id.send_good_gift);
childList = itemView.findViewById(R.id.child_list);
selectMoreIcon = itemView.findViewById(R.id.select_more_icon);
selectMore = itemView.findViewById(R.id.select_more);
funGamesAdapter = new NewRoleFunGamesAdapter(itemView.getContext(),true);
funGamesAdapter = new NewRoleFunGamesAdapter(itemView.getContext(), true);
childList.setLayoutManager(new LinearLayoutManager(itemView.getContext(), LinearLayoutManager.HORIZONTAL, false));
childList.setAdapter(funGamesAdapter);
}
public void setData(CustomSidebarInfoModel model) {
List<CustomSidebarChildModel> sidebarChildModels = model.getChild();
itemView.findViewById(R.id.select_more_layout).setVisibility(sidebarChildModels.size() >= 8 ? View.VISIBLE : View.GONE);
sendGoodGift.setText(model.getTitle());

View File

@ -1,10 +1,13 @@
package com.yunbao.common.views;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
@ -21,19 +24,21 @@ public class LiveNewRoleRigtsInterestsViewHolder extends RecyclerView.ViewHolder
private TextView sendGoodGift;
private RecyclerView childList;
private boolean showRed = false;
public LiveNewRoleRigtsInterestsViewHolder(@NonNull View itemView,boolean showRed) {
private Context mContext;
public LiveNewRoleRigtsInterestsViewHolder(@NonNull View itemView, boolean showRed,Context mContext) {
super(itemView);
this.mContext = mContext;
sendGoodGift = itemView.findViewById(R.id.send_good_gift);
childList = itemView.findViewById(R.id.child_list);
sendGoodGift = itemView.findViewById(R.id.send_good_gift);
childList = itemView.findViewById(R.id.child_list);
funGamesAdapter = new LiveNewRoleFunGamesAdapter(itemView.getContext(), false,showRed);
childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4));
LinearLayoutManager layoutManager = new LinearLayoutManager(itemView.getContext(), LinearLayoutManager.HORIZONTAL, false);
childList.setLayoutManager(layoutManager);
childList.setAdapter(funGamesAdapter);
}
public void setData(CustomSidebarInfoModel model) {
sendGoodGift.setText(model.getTitle());
funGamesAdapter.updateData(generateData());
}

View File

@ -1,8 +1,10 @@
package com.yunbao.common.views;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
@ -27,8 +29,10 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder {
private View red_point;
private boolean showRed = false;
private View total_image_red_point;
public NewRoleFunGamesChildViewHolder(@NonNull View itemView, boolean showRed) {
private Context mContext;
public NewRoleFunGamesChildViewHolder(@NonNull View itemView, boolean showRed, Context mContext) {
super(itemView);
this.mContext = mContext;
this.showRed = showRed;
funGamePic = itemView.findViewById(R.id.fun_game_pic);
funGameName = itemView.findViewById(R.id.fun_game_name);

View File

@ -1,16 +1,16 @@
<?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:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:paddingEnd="7dp"
android:gravity="center"
android:gravity="start"
android:orientation="vertical">
<!--身份特权-->
<RelativeLayout
android:layout_width="40dp"
android:layout_width="55dp"
android:layout_height="40dp">
<!--普通工具合集-->
<ImageView
@ -34,10 +34,11 @@
<TextView
android:id="@+id/fun_game_name"
android:layout_width="wrap_content"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/guard_guard"
android:gravity="center"
android:textColor="#9A9A9A"
android:textSize="10sp" />

View File

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

View File

@ -16,13 +16,12 @@
<RelativeLayout
android:layout_width="50dp"
android:layout_height="50dp">
<!--普通工具合集-->
<ImageView
android:id="@+id/fun_game_pic"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/live_more_icon_guard" />
@ -63,6 +62,6 @@
android:maxLines="1"
android:text="@string/guard_guard"
android:textColor="#9A9A9A"
android:textSize="14sp" />
android:textSize="10sp" />
</LinearLayout>

View File

@ -1,17 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:paddingEnd="30dp"
android:clickable="true"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/fun_game_pic"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="38dp"
android:layout_height="38dp"
android:src="@mipmap/live_more_icon_guard" />
<TextView
@ -21,6 +20,6 @@
android:layout_marginTop="2dp"
android:text="@string/guard_guard"
android:textColor="#9A9A9A"
android:textSize="14sp" />
android:textSize="10sp" />
</LinearLayout>

View File

@ -15,15 +15,20 @@
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="60dp"
android:layout_width="55dp"
android:layout_height="wrap_content">
<ImageView
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/fun_game_pic"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:src="@mipmap/live_more_icon_guard" />
android:layout_centerVertical="true"
android:scaleType="centerCrop"
android:src="@mipmap/live_more_icon_guard"
android:visibility="visible"
app:riv_oval="true" />
<View
android:id="@+id/red_point"
@ -39,8 +44,8 @@
<ImageView
android:id="@+id/icon_new_game"
android:layout_width="26dp"
android:layout_height="13dp"
android:layout_width="23dp"
android:layout_height="10dp"
android:layout_gravity="end"
android:layout_alignParentEnd="true"
android:visibility="gone"
@ -60,7 +65,7 @@
app:autoSizeMinTextSize="5sp"
app:autoSizeStepGranularity="1sp"
app:autoSizeTextType="uniform"
android:textSize="14sp" />
android:textSize="10sp" />
</LinearLayout>

View File

@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginStart="15dp"
android:orientation="vertical">
<FrameLayout

View File

@ -2,12 +2,12 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="14dp">
<TextView
@ -22,7 +22,8 @@
<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_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp" />
</LinearLayout>

View File

@ -2,12 +2,12 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="14dp">
<TextView
@ -23,7 +23,10 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/child_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:overScrollMode="never" />
<LinearLayout
android:id="@+id/select_more_layout"

View File

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

View File

@ -448,7 +448,7 @@ public class SudRyGameActivity extends AbsActivity implements GameRyMicManager.M
// 设置游戏安全操作区域
GameViewInfoModel.GameViewRectModel gameViewRectModel = new GameViewInfoModel.GameViewRectModel();
gameViewRectModel.left = 0;
gameViewRectModel.top = DpUtil.dp2px(155);
gameViewRectModel.top = DpUtil.dp2px(320);
gameViewRectModel.right = 0;
gameViewRectModel.bottom = DpUtil.dp2px(155);
gameViewModel.gameViewRectModel = gameViewRectModel;

View File

@ -496,7 +496,7 @@ public class SudSwGameActivity extends AbsActivity implements GameSwMicManager.M
// 设置游戏安全操作区域
GameViewInfoModel.GameViewRectModel gameViewRectModel = new GameViewInfoModel.GameViewRectModel();
gameViewRectModel.left = 0;
gameViewRectModel.top = DpUtil.dp2px(155);
gameViewRectModel.top = DpUtil.dp2px(320); //游戏安全区域
gameViewRectModel.right = 0;
gameViewRectModel.bottom = DpUtil.dp2px(155);
gameViewModel.gameViewRectModel = gameViewRectModel;