游戏列表跳转游戏

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 Context mContext;
private boolean rigts; private boolean rigts;
private List<CustomSidebarChildModel> child = new ArrayList<>(); private List<CustomSidebarChildModel> child = new ArrayList<>();
private boolean showRed = false;
public LiveNewRoleFunGamesAdapter(Context mContext, boolean rigts) { public LiveNewRoleFunGamesAdapter(Context mContext, boolean rigts,boolean showRed) {
this.mContext = mContext; this.mContext = mContext;
this.rigts = rigts; this.rigts = rigts;
this.showRed = showRed;
} }
@NonNull @NonNull
@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_view, parent, false); 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 @Override

View File

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

View File

@ -30,7 +30,7 @@ public class NewRoleFunGamesAdapter 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_view2, parent, false); 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 @Override

View File

@ -11,15 +11,22 @@ import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.views.SudGameListViewHolder; import com.yunbao.common.views.SudGameListViewHolder;
public class SudGameListAdapter extends RefreshAdapter<SudRoomListModel> { public class SudGameListAdapter extends RefreshAdapter<SudRoomListModel> {
public SudGameListAdapter(Context context) { private boolean isHome = false;
public SudGameListAdapter(Context context, boolean isHome) {
super(context); super(context);
this.isHome = isHome;
} }
@NonNull @NonNull
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
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)); return new SudGameListViewHolder(mInflater.inflate(R.layout.item_sud_game_list, parent, false));
} }
}
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
package com.yunbao.common.views; package com.yunbao.common.views;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@ -12,7 +13,6 @@ import com.yunbao.common.CommonAppConfig;
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.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
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.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
@ -23,11 +23,15 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake;
public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder { public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder {
private ImageView funGamePic; private ImageView funGamePic;
private TextView funGameName; 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); super(itemView);
this.showRed = showRed;
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);
red_point = itemView.findViewById(R.id.red_point);
} }
public void setData(CustomSidebarChildModel model, boolean rigts) { public void setData(CustomSidebarChildModel model, boolean rigts) {
@ -36,7 +40,12 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder {
} else { } else {
ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic); 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()); funGameName.setText(model.getTitle());
@ -75,7 +84,6 @@ public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder {
.setScreen(TextUtils.equals(model.getShowType(), "2"))); .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.SudRoomListModel;
import com.yunbao.common.bean.playerObject; import com.yunbao.common.bean.playerObject;
import com.yunbao.common.event.SudGameListDissMissEvent; import com.yunbao.common.event.SudGameListDissMissEvent;
import com.yunbao.common.event.SudRoomListModelEvent;
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.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="51dp" android:height="28dp">
<shape android:shape="rectangle">
<solid android:color="#343434" />
<corners android:topLeftRadius="14dp" android:topRightRadius="14dp" android:bottomLeftRadius="14dp" android:bottomRightRadius="14dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<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="match_parent"
android:layout_height="486dp"
android:background="@drawable/bg_live_sud_list"
android:orientation="vertical"
tools:ignore="MissingDefaultResource">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:gravity="center"
android:text="@string/interactive_game"
android:textColor="#fff"
android:textSize="18sp" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="12dp"
android:text="@string/interactive_game_search_room"
android:textColor="#FFFFFF"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/btn_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="15dp"
android:src="@mipmap/icon_interactive_game_create_room_back" />
</FrameLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:background="@drawable/bg_live_sud_list_input">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="11dp"
android:src="@mipmap/ic_home_game_search" />
<EditText
android:id="@+id/edit_search"
android:layout_width="266dp"
android:layout_height="match_parent"
android:background="@null"
android:hint="@string/interactive_game_search_room_name_input"
android:paddingStart="5dp"
android:paddingTop="9dp"
android:paddingBottom="9dp"
android:textColor="#8fff"
android:textColorHint="#8fff"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="12dp"
android:text="@string/interactive_game_search_history"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_history"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="3"
tools:itemCount="5"
tools:layoutManager="GridLayoutManager"
tools:listitem="@layout/item_search_history" />
<LinearLayout
android:id="@+id/layout_history_empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="vertical">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/bg_home_search_not"
android:gravity="center"
android:paddingStart="30dp"
android:paddingTop="12dp"
android:paddingEnd="30dp"
android:paddingBottom="12dp"
android:text="暫未搜索結果~"
android:textColor="#CCFFFFFF"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_room"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
tools:visibility="visible" />
</LinearLayout>

View File

@ -33,6 +33,7 @@
android:layout_weight="1" /> android:layout_weight="1" />
<ImageView <ImageView
android:id="@+id/search"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
@ -52,7 +53,8 @@
android:layout_height="30dp" android:layout_height="30dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="17dp" android:layout_marginEnd="17dp"
android:src="@mipmap/icon_interactive_game__ranking" /> android:src="@mipmap/icon_interactive_game__ranking"
android:visibility="gone" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/bg_item_home_search_history">
<TextView
android:id="@+id/history"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_marginTop="6dp"
android:textColor="#FFFFFF"
android:layout_marginEnd="13dp"
android:layout_marginBottom="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/full_names" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<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:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
@ -7,18 +9,37 @@
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView <ImageView
android:id="@+id/fun_game_pic" android:id="@+id/fun_game_pic"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:src="@mipmap/live_more_icon_guard" /> android:src="@mipmap/live_more_icon_guard" />
<View
android:id="@+id/red_point"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="end"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:background="@drawable/bg_red_point"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="gone" />
</FrameLayout>
<TextView <TextView
android:id="@+id/fun_game_name" android:id="@+id/fun_game_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1"
android:layout_marginTop="2dp" android:layout_marginTop="2dp"
android:maxLines="1"
android:text="@string/guard_guard" android:text="@string/guard_guard"
android:textColor="#9A9A9A" android:textColor="#9A9A9A"
android:textSize="14sp" /> android:textSize="14sp" />

View File

@ -467,7 +467,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
// fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoleDialogFragment"); // fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveRoleDialogFragment");
new XPopup.Builder(mContext) new XPopup.Builder(mContext)
.enableDrag(false) .enableDrag(false)
.asCustom(new LiveNewRolePopup(mContext)) .asCustom(new LiveNewRolePopup(mContext, mRedPointPrivilege.getVisibility() == View.VISIBLE))
.show(); .show();
} }

View File

@ -1,57 +1,31 @@
package com.yunbao.main.views; package com.yunbao.main.views;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.graphics.Outline;
import android.graphics.drawable.Drawable;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.animation.LinearInterpolator; import android.view.animation.LinearInterpolator;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON; import com.google.gson.Gson;
import com.alibaba.fastjson.JSONObject;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.DrawableImageViewTarget;
import com.bumptech.glide.request.target.Target;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupPosition; import com.lxj.xpopup.enums.PopupPosition;
import com.ms.banner.Banner;
import com.ms.banner.listener.OnBannerClickListener;
import com.umeng.analytics.MobclickAgent;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.adapter.SudGameListAdapter;
import com.yunbao.common.bean.BannerBean; import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveClassBean; import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.bean.WeekListBean;
import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.custom.ItemDecoration;
import com.yunbao.common.dialog.CreateSudGamePopup; import com.yunbao.common.dialog.CreateSudGamePopup;
import com.yunbao.common.dialog.SudGameListSelectPopup; import com.yunbao.common.dialog.SudGameListSelectPopup;
import com.yunbao.common.dialog.SudGameSearchDialogPopup; import com.yunbao.common.dialog.SudGameSearchDialogPopup;
import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.event.RoomHolderTypeEvent; import com.yunbao.common.event.RoomHolderTypeEvent;
import com.yunbao.common.event.SudGameListEvent; import com.yunbao.common.event.SudGameListEvent;
import com.yunbao.common.event.SudGameListSillEvent; import com.yunbao.common.event.SudGameListSillEvent;
@ -59,34 +33,17 @@ import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.LiveClassManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.RandomUtil;
import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.views.LiveSudGamePopup;
import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.CustomViewHolder;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.utils.LiveStorge;
import com.yunbao.live.views.LiveRoomViewHolder;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.activity.MainActivity;
import com.yunbao.main.adapter.MainHomeLiveAdapter;
import com.yunbao.main.adapter.MainHomeLivesClassAdapter;
import com.yunbao.main.http.MainHttpConsts;
import com.yunbao.main.http.MainHttpUtil;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created by cxf on 2018/9/22. * Created by cxf on 2018/9/22.
@ -103,6 +60,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
private String mSill = "0,0", mSillName, roomHolderType = "0", roomHolderTypeName; private String mSill = "0,0", mSillName, roomHolderType = "0", roomHolderTypeName;
private long animDuration = 500; private long animDuration = 500;
private String id = "0"; private String id = "0";
private SudGameListAdapter sudGameListAdapter;
public MainHomeGameViewHolder(Context context, ViewGroup parentView) { public MainHomeGameViewHolder(Context context, ViewGroup parentView) {
super(context, parentView); super(context, parentView);
@ -119,12 +77,91 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
public void init() { public void init() {
initData(); initData();
mSill = "0,0";
roomHolderType = "0";
id = "0";
roomGameArrow = (ImageView) findViewById(R.id.room_game_arrow); roomGameArrow = (ImageView) findViewById(R.id.room_game_arrow);
roomSillArrow = (ImageView) findViewById(R.id.room_sill_arrow); roomSillArrow = (ImageView) findViewById(R.id.room_sill_arrow);
houseOwnerArrow = (ImageView) findViewById(R.id.house_owner_arrow); houseOwnerArrow = (ImageView) findViewById(R.id.house_owner_arrow);
gameTitle = (TextView) findViewById(R.id.game_title); gameTitle = (TextView) findViewById(R.id.game_title);
sillTitle = (TextView) findViewById(R.id.room_sill_text); sillTitle = (TextView) findViewById(R.id.room_sill_text);
houseOwnerTitle = (TextView) findViewById(R.id.house_owner_text); houseOwnerTitle = (TextView) findViewById(R.id.house_owner_text);
mRefreshView = (CommonRefreshView) findViewById(R.id.refreshView);
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
sudGameListAdapter = new SudGameListAdapter(mContext, true);
mRefreshView.setLoadMoreEnable(true);
mRefreshView.setRecyclerViewAdapter(sudGameListAdapter);
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<SudRoomListModel>() {
@Override
public RefreshAdapter<SudRoomListModel> getAdapter() {
return null;
}
@Override
public void loadData(int p, com.yunbao.common.http.HttpCallback callback) {
LiveHttpUtil.getRoomList(id, mSill, roomHolderType, "0", p, callback);
}
@Override
public List<SudRoomListModel> processData(String[] info) {
if (info.length > 0) {
List<SudRoomListModel> sudRoomListModels = new ArrayList<>();
for (String json : info) {
SudRoomListModel model = new Gson().fromJson(json, SudRoomListModel.class);
sudRoomListModels.add(model);
}
return sudRoomListModels;
} else {
return new ArrayList<>();
}
}
@Override
public void onRefreshSuccess(List<SudRoomListModel> list, int listCount) {
Log.i("onRefreshSuccess", listCount + "");
}
@Override
public void onRefreshFailure() {
}
@Override
public void onLoadMoreSuccess(List<SudRoomListModel> loadItemList, int loadItemCount) {
sudGameListAdapter.insertList(loadItemList);
}
@Override
public void onLoadMoreFailure() {
}
});
mRefreshView.initData();
ViewClicksAntiShake.clicksAntiShake(findViewById(com.yunbao.common.R.id.random_start), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
List<SudRoomListModel> sudRoomListModels = sudGameListAdapter.getList();
if (sudRoomListModels.size() > 1) {
int random = RandomUtil.nextInt(sudRoomListModels.size() - 1);
CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel();
createSudRoomModel.setSudGameId(sudRoomListModels.get(random).getSudGameId());
createSudRoomModel.setSudGameRoomId(sudRoomListModels.get(random).getSudGameRoomId());
createSudRoomModel.setAvatar(sudRoomListModels.get(random).getAvatar());
createSudRoomModel.setRoomName(sudRoomListModels.get(random).getRoomName());
createSudRoomModel.setSudGameName(sudRoomListModels.get(random).getSudGameName());
new XPopup.Builder(mContext)
.enableDrag(false)
.dismissOnTouchOutside(false)
.dismissOnBackPressed(false)
.asCustom(new LiveSudGamePopup(mContext, createSudRoomModel))
.show();
}
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.interactive_game_room_game), new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.interactive_game_room_game), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
@ -204,7 +241,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.search), new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.search), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
new SudGameSearchDialogPopup(mContext).showDialog(); new SudGameSearchDialogPopup(mContext, true).showDialog();
} }
}); });
@ -237,7 +274,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
interactionID = event.getInteractionID(); interactionID = event.getInteractionID();
gameTitle.setText(event.getTitle().substring(0, 2)); gameTitle.setText(event.getTitle().substring(0, 2));
id = event.getId(); id = event.getId();
initData(); mRefreshView.initData();
closeAnimSudGameListEvent(); closeAnimSudGameListEvent();
} }
@ -251,7 +288,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
sillTitle.setText(mSillName.substring(0, mSillName.length() - 2)); sillTitle.setText(mSillName.substring(0, mSillName.length() - 2));
} }
closeAnimSudGameListSillEvent(); closeAnimSudGameListSillEvent();
initData(); mRefreshView.initData();
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
@ -259,7 +296,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
roomHolderType = event.getRoomHolderType(); roomHolderType = event.getRoomHolderType();
roomHolderTypeName = event.getRoomHolderTypeName(); roomHolderTypeName = event.getRoomHolderTypeName();
houseOwnerTitle.setText(roomHolderTypeName); houseOwnerTitle.setText(roomHolderTypeName);
initData(); mRefreshView.initData();
closeAnimRoomHolderTypeEvent(); closeAnimRoomHolderTypeEvent();
} }

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@mipmap/bg_main_home_sub_game" android:background="@mipmap/bg_main_home_sub_game"
@ -16,10 +15,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="15dp" android:layout_marginStart="15dp"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:textStyle="bold"
android:text="@string/interactive_game_room_list" android:text="@string/interactive_game_room_list"
android:textColor="#000" android:textColor="#000"
android:textSize="16sp" /> android:textSize="16sp"
android:textStyle="bold" />
<View <View
android:layout_width="0dp" android:layout_width="0dp"
@ -47,7 +46,8 @@
android:layout_height="30dp" android:layout_height="30dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="17dp" android:layout_marginEnd="17dp"
android:src="@mipmap/icon_home_interactive_game_ranking" /> android:src="@mipmap/icon_home_interactive_game_ranking"
android:visibility="gone" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -62,8 +62,8 @@
android:layout_marginStart="14dp" android:layout_marginStart="14dp"
android:text="@string/interactive_game_room_game" android:text="@string/interactive_game_room_game"
android:textColor="#000" android:textColor="#000"
android:textStyle="bold" android:textSize="14sp"
android:textSize="14sp" /> android:textStyle="bold" />
<LinearLayout <LinearLayout
android:id="@+id/interactive_game_room_game" android:id="@+id/interactive_game_room_game"
@ -96,8 +96,8 @@
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
android:text="@string/interactive_game_room_sill" android:text="@string/interactive_game_room_sill"
android:textColor="#000" android:textColor="#000"
android:textStyle="bold" android:textSize="14sp"
android:textSize="14sp" /> android:textStyle="bold" />
<FrameLayout <FrameLayout
android:id="@+id/room_sill" android:id="@+id/room_sill"
@ -131,8 +131,8 @@
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
android:text="@string/interactive_game_room_house_owner" android:text="@string/interactive_game_room_house_owner"
android:textColor="#000" android:textColor="#000"
android:textStyle="bold" android:textSize="14sp"
android:textSize="14sp" /> android:textStyle="bold" />
<LinearLayout <LinearLayout
android:id="@+id/house_owner" android:id="@+id/house_owner"
@ -174,6 +174,7 @@
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<Button <Button
android:id="@+id/random_start"
android:layout_width="174dp" android:layout_width="174dp"
android:layout_height="61dp" android:layout_height="61dp"
android:layout_gravity="center_horizontal|bottom" android:layout_gravity="center_horizontal|bottom"