游戏列表跳转游戏

This commit is contained in:
18401019693
2023-09-26 14:56:55 +08:00
parent a6faf12ff6
commit 210e755fed
20 changed files with 386 additions and 111 deletions

View File

@@ -20,17 +20,18 @@ public class LiveNewRoleFunGamesAdapter extends RecyclerView.Adapter {
private Context mContext;
private boolean rigts;
private List<CustomSidebarChildModel> child = new ArrayList<>();
public LiveNewRoleFunGamesAdapter(Context mContext, boolean rigts) {
private boolean showRed = false;
public LiveNewRoleFunGamesAdapter(Context mContext, boolean rigts,boolean showRed) {
this.mContext = mContext;
this.rigts = rigts;
this.showRed = showRed;
}
@NonNull
@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);
return new NewRoleFunGamesChildViewHolder(runGamesView,showRed);
}
@Override

View File

@@ -27,9 +27,10 @@ public class LiveNewRolerPopupAdapter extends RecyclerView.Adapter {
private final int FUN_GAMES = 3;
private final int RIGHTS_INTERESTS = 4;
private List<CustomSidebarInfoModel> infoModels = new ArrayList<>();
public LiveNewRolerPopupAdapter(Context mContext) {
private boolean showRed = false;
public LiveNewRolerPopupAdapter(Context mContext,boolean showRed) {
this.mContext = mContext;
this.showRed = showRed;
}
@NonNull
@@ -41,7 +42,7 @@ public class LiveNewRolerPopupAdapter extends RecyclerView.Adapter {
return new LiveNewRoleFunGamesViewHolder(runGamesView);
case RIGHTS_INTERESTS:
View rightsInterestsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_roler_ights_interests, parent, false);
return new LiveNewRoleRigtsInterestsViewHolder(rightsInterestsView);
return new LiveNewRoleRigtsInterestsViewHolder(rightsInterestsView,showRed);
default:
View gamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_interaction_games_view, parent, false);
return new LiveNewRoleInteractionGamesViewHolder(gamesView);

View File

@@ -30,7 +30,7 @@ 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);
return new NewRoleFunGamesChildViewHolder(runGamesView,false);
}
@Override

View File

@@ -11,14 +11,21 @@ import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.views.SudGameListViewHolder;
public class SudGameListAdapter extends RefreshAdapter<SudRoomListModel> {
public SudGameListAdapter(Context context) {
private boolean isHome = false;
public SudGameListAdapter(Context context, boolean isHome) {
super(context);
this.isHome = isHome;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new SudGameListViewHolder(mInflater.inflate(R.layout.item_sud_game_list, parent, false));
if (isHome){
return new SudGameListViewHolder(mInflater.inflate(R.layout.item_home_sud_game_list, parent, false));
}else {
return new SudGameListViewHolder(mInflater.inflate(R.layout.item_sud_game_list, parent, false));
}
}
@Override

View File

@@ -19,8 +19,10 @@ public class SudGameSearchHistoryListAdapter extends RecyclerView.Adapter<SudGam
private List<String> mList;
private Context mContext;
private OnItemClickListener<String> onItemClickListener;
private boolean isHome = false;
public SudGameSearchHistoryListAdapter(Context mContext) {
public SudGameSearchHistoryListAdapter(Context mContext, boolean isHome) {
this.isHome = isHome;
this.mContext = mContext;
mList = new ArrayList<>();
}
@@ -37,7 +39,13 @@ public class SudGameSearchHistoryListAdapter extends RecyclerView.Adapter<SudGam
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_search_history, parent, false));
if (isHome) {
return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_search_history, parent, false));
} else {
return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_home_search_history, parent, false));
}
}
@Override
@@ -66,8 +74,8 @@ public class SudGameSearchHistoryListAdapter extends RecyclerView.Adapter<SudGam
public void setData(String name) {
nameView.setText(name);
nameView.setOnClickListener(v -> {
if(onItemClickListener!=null){
onItemClickListener.onItemClick(name,0);
if (onItemClickListener != null) {
onItemClickListener.onItemClick(name, 0);
}
});
}

View File

@@ -17,10 +17,12 @@ import java.util.List;
public class SudHomeGameListAdapter extends RecyclerView.Adapter<SudGameListViewHolder> {
private Context mContext;
private List<SudRoomListModel> mList;
private boolean isHome = false;
public SudHomeGameListAdapter(Context mContext) {
public SudHomeGameListAdapter(Context mContext, boolean isHome) {
this.mContext = mContext;
mList=new ArrayList<>();
this.isHome = isHome;
mList = new ArrayList<>();
}
public void setList(List<SudRoomListModel> mList) {
@@ -31,7 +33,12 @@ public class SudHomeGameListAdapter extends RecyclerView.Adapter<SudGameListView
@NonNull
@Override
public SudGameListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new SudGameListViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_home_sud_game_list, parent, false));
if (isHome) {
return new SudGameListViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_home_sud_game_list, parent, false));
} else {
return new SudGameListViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_sud_game_list, parent, false));
}
}
@Override

View File

@@ -21,9 +21,12 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.List;
public class LiveNewRolePopup extends BottomPopupView {
public LiveNewRolePopup(@NonNull Context context) {
private boolean showRed = false;
public LiveNewRolePopup(@NonNull Context context, boolean showRed) {
super(context);
mContext = context;
this.showRed = showRed;
}
private RecyclerView drawerList;
@@ -63,7 +66,7 @@ public class LiveNewRolePopup extends BottomPopupView {
private void initView() {
drawerList = findViewById(R.id.drawerList);
adapter = new LiveNewRolerPopupAdapter(mContext);
adapter = new LiveNewRolerPopupAdapter(mContext, showRed);
drawerList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
drawerList.setAdapter(adapter);
}

View File

@@ -89,7 +89,7 @@ public class SudGameListPopup extends BottomPopupView {
mRefreshView = findViewById(R.id.refreshView);
mRefreshView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
sudGameListAdapter = new SudGameListAdapter(getContext());
sudGameListAdapter = new SudGameListAdapter(getContext(), false);
mRefreshView.setLoadMoreEnable(true);
mRefreshView.setRecyclerViewAdapter(sudGameListAdapter);
@@ -154,7 +154,7 @@ public class SudGameListPopup extends BottomPopupView {
public void onViewClicks() {
List<SudRoomListModel> sudRoomListModels = sudGameListAdapter.getList();
if (sudRoomListModels.size()>1){
if (sudRoomListModels.size() > 1) {
int random = RandomUtil.nextInt(sudRoomListModels.size() - 1);
CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel();
createSudRoomModel.setSudGameId(sudRoomListModels.get(random).getSudGameId());
@@ -173,6 +173,12 @@ public class SudGameListPopup extends BottomPopupView {
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.search), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
new SudGameSearchDialogPopup(getContext(), false).showDialog();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.interactive_game_room_game), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {

View File

@@ -1,12 +1,9 @@
package com.yunbao.common.dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import androidx.annotation.NonNull;
@@ -16,10 +13,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSONArray;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.R;
import com.yunbao.common.adapter.SudGameListAdapter;
import com.yunbao.common.adapter.SudGameSearchHistoryListAdapter;
import com.yunbao.common.adapter.SudHomeGameListAdapter;
import com.yunbao.common.bean.CreateSudRoomModel;
@@ -31,6 +25,7 @@ import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.views.LiveSudGamePopup;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@@ -46,19 +41,26 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow {
private SudGameSearchHistoryListAdapter historyListAdapter;
private SudHomeGameListAdapter sudGameListAdapter;
private boolean isHome = false;
public SudGameSearchDialogPopup(@NonNull Context context) {
public SudGameSearchDialogPopup(@NonNull Context context, boolean isHome) {
super(context);
this.isHome = isHome;
}
@Override
public void buildDialog(XPopup.Builder builder) {
builder.moveUpToKeyboard(false);
builder.moveUpToKeyboard(false);
}
@Override
public int bindLayoutId() {
return R.layout.dialog_home_search_sud_game;
if (isHome) {
return R.layout.dialog_home_search_sud_game;
} else {
return R.layout.dialog_search_sud_game;
}
}
@Override
@@ -75,15 +77,15 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow {
manager.setReverseLayout(true);
}
historyListAdapter = new SudGameSearchHistoryListAdapter(mContext);
sudGameListAdapter = new SudHomeGameListAdapter(mContext);
historyListAdapter = new SudGameSearchHistoryListAdapter(mContext, isHome);
sudGameListAdapter = new SudHomeGameListAdapter(mContext, isHome);
historyListAdapter.setOnItemClickListener(new OnItemClickListener<String>() {
@Override
public void onItemClick(String bean, int position) {
editSearch.setText(bean);
}
});
listRoom.setLayoutManager(new LinearLayoutManager(mContext,LinearLayoutManager.VERTICAL,false));
listRoom.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
listRoom.setAdapter(sudGameListAdapter);
listHistory.setAdapter(historyListAdapter);
initHistoryData();
@@ -110,6 +112,12 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow {
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_back), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
dialog.dismiss();
}
});
}
private void initHistoryData() {

View File

@@ -20,14 +20,14 @@ public class LiveNewRoleRigtsInterestsViewHolder extends RecyclerView.ViewHolder
private LiveNewRoleFunGamesAdapter funGamesAdapter;
private TextView sendGoodGift;
private RecyclerView childList;
public LiveNewRoleRigtsInterestsViewHolder(@NonNull View itemView) {
private boolean showRed = false;
public LiveNewRoleRigtsInterestsViewHolder(@NonNull View itemView,boolean showRed) {
super(itemView);
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);
funGamesAdapter = new LiveNewRoleFunGamesAdapter(itemView.getContext(), false,showRed);
childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4));
childList.setAdapter(funGamesAdapter);
}

View File

@@ -1,6 +1,7 @@
package com.yunbao.common.views;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
@@ -12,7 +13,6 @@ import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.R;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.event.CustomDrawerPopupEvent;
import com.yunbao.common.event.LiveNewRoleEvent;
import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent;
import com.yunbao.common.glide.ImgLoader;
@@ -23,11 +23,15 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake;
public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder {
private ImageView funGamePic;
private TextView funGameName;
private View red_point;
private boolean showRed = false;
public NewRoleFunGamesChildViewHolder(@NonNull View itemView) {
public NewRoleFunGamesChildViewHolder(@NonNull View itemView, boolean showRed) {
super(itemView);
this.showRed = showRed;
funGamePic = itemView.findViewById(R.id.fun_game_pic);
funGameName = itemView.findViewById(R.id.fun_game_name);
red_point = itemView.findViewById(R.id.red_point);
}
public void setData(CustomSidebarChildModel model, boolean rigts) {
@@ -36,7 +40,12 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder {
} else {
ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic);
}
Log.e("GamesChildViewHolder", "model.getTitle::::::::::" + model.getTitle());
Log.e("GamesChildViewHolder", "itemView.getContext().getString::::::::::" + model.getTitle());
Log.e("GamesChildViewHolder", "showRed::::::::::" + showRed);
if (TextUtils.equals(model.getTitle(), itemView.getContext().getString(R.string.fan_club))) {
red_point.setVisibility(showRed ? View.VISIBLE : View.GONE);
}
funGameName.setText(model.getTitle());
@@ -75,7 +84,6 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder {
.setScreen(TextUtils.equals(model.getShowType(), "2")));
}
}

View File

@@ -15,7 +15,6 @@ import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.bean.playerObject;
import com.yunbao.common.event.SudGameListDissMissEvent;
import com.yunbao.common.event.SudRoomListModelEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.ViewClicksAntiShake;