diff --git a/common/src/main/java/com/yunbao/common/adapter/SudGameListAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudGameListAdapter.java index 027340dd4..5a5639ff9 100644 --- a/common/src/main/java/com/yunbao/common/adapter/SudGameListAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/SudGameListAdapter.java @@ -9,6 +9,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.R; import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.views.SudGameListViewHolder; +import com.yunbao.common.views.SudGameListViewHolder2; public class SudGameListAdapter extends RefreshAdapter { private boolean isHome = false; @@ -22,7 +23,7 @@ public class SudGameListAdapter extends RefreshAdapter { @Override 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)); + return new SudGameListViewHolder2(mInflater.inflate(R.layout.item_home_sud_game_list2, parent, false)); }else { return new SudGameListViewHolder(mInflater.inflate(R.layout.item_sud_game_list, parent, false)); } @@ -30,7 +31,13 @@ public class SudGameListAdapter extends RefreshAdapter { @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { - SudGameListViewHolder sudGameListViewHolder = (SudGameListViewHolder) holder; - sudGameListViewHolder.setData(mList.get(position),isHome); + if (isHome){ + SudGameListViewHolder2 sudGameListViewHolder = (SudGameListViewHolder2) holder; + sudGameListViewHolder.setData(mList.get(position)); + }else { + SudGameListViewHolder sudGameListViewHolder = (SudGameListViewHolder) holder; + sudGameListViewHolder.setData(mList.get(position),isHome); + } + } } diff --git a/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder2.java b/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder2.java index 280da2818..76e45f549 100644 --- a/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder2.java +++ b/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder2.java @@ -36,54 +36,48 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake; import java.util.Locale; public class SudGameListViewHolder2 extends RecyclerView.ViewHolder { - private RoundedImageView mAvatar; - private TextView roomName, playerWeAre, playerWeAre2, goldenBeanNumber; - private RoundedImageView avatarList1, avatarList2, avatarList3, avatarList4, avatarList5; - private ImageView gifImageView; - private ImageView sex, game_icon, gold_coin; + + public RoundedImageView avatar; + public ImageView btnLive; + public ImageView topBgImg; + public ImageView goldCoin; + public TextView goldenBeanNumber; + public TextView roomName; + public TextView gameNumberTv; + public TextView roomNumberTv; public SudGameListViewHolder2(@NonNull View itemView) { super(itemView); - mAvatar = itemView.findViewById(R.id.avatar); - roomName = itemView.findViewById(R.id.room_name); - playerWeAre = itemView.findViewById(R.id.player_we_are); - playerWeAre2 = itemView.findViewById(R.id.player_we_are_2); - game_icon = itemView.findViewById(R.id.game_icon); + avatar = itemView.findViewById(R.id.avatar); + btnLive = itemView.findViewById(R.id.btn_live); + topBgImg = itemView.findViewById(R.id.topBgImg); + goldCoin = itemView.findViewById(R.id.gold_coin); goldenBeanNumber = itemView.findViewById(R.id.golden_bean_number); - gifImageView = itemView.findViewById(R.id.btn_live); - avatarList1 = itemView.findViewById(R.id.avatar_list1); - avatarList2 = itemView.findViewById(R.id.avatar_list2); - avatarList3 = itemView.findViewById(R.id.avatar_list3); - avatarList4 = itemView.findViewById(R.id.avatar_list4); - avatarList5 = itemView.findViewById(R.id.avatar_list5); - gold_coin = itemView.findViewById(R.id.gold_coin); - sex = itemView.findViewById(R.id.sex); - avatarList1.setVisibility(View.GONE); - avatarList2.setVisibility(View.GONE); - avatarList3.setVisibility(View.GONE); - avatarList4.setVisibility(View.GONE); - avatarList5.setVisibility(View.GONE); + roomName = itemView.findViewById(R.id.room_name); + gameNumberTv = itemView.findViewById(R.id.gameNumberTv); + roomNumberTv = itemView.findViewById(R.id.roomNumberTv); } - public void setData(SudRoomListModel model, boolean isHome) { - ImgLoader.display(itemView.getContext(), model.getAvatar(), mAvatar); + public void setData(SudRoomListModel model) { + ImgLoader.display(itemView.getContext(), model.getAvatar(), avatar); roomName.setText(model.getRoomName()); - playerWeAre.setText(String.format(itemView.getContext().getString(R.string.interactive_game_player_we_are), model.getPlayerTotal())); - playerWeAre2.setText(String.format(itemView.getContext().getString(R.string.interactive_game_player_we_are_2), model.getTotal())); + +// playerWeAre.setText(String.format(itemView.getContext().getString(R.string.interactive_game_player_we_are), model.getPlayerTotal())); +// playerWeAre2.setText(String.format(itemView.getContext().getString(R.string.interactive_game_player_we_are_2), model.getTotal())); +// gifImageView.setVisibility(TextUtils.equals(model.getLiveUid(), "0") ? View.GONE : View.VISIBLE); + + gameNumberTv.setText(gameNumberTv.getContext().getString(R.string.number_of_players)+":"+model.getTotal()); + roomNumberTv.setText(gameNumberTv.getContext().getString(R.string.number_of_online)+":"+model.getPlayerTotal() ); + + goldenBeanNumber.setText(model.getGoldenBeanNumber()); - gifImageView.setVisibility(TextUtils.equals(model.getLiveUid(), "0") ? View.GONE : View.VISIBLE); - if (TextUtils.equals(model.getSex(), "1")) { - ImgLoader.display(itemView.getContext(), R.mipmap.icon_sex_man, sex); - } else if (TextUtils.equals(model.getSex(), "2")) { - ImgLoader.display(itemView.getContext(), R.mipmap.icon_sex_woman, sex); - } if (TextUtils.equals(model.getCurrencyType(), "2")) { - ImgLoader.display(itemView.getContext(), R.mipmap.icon_collectibles, gold_coin); + ImgLoader.display(itemView.getContext(), R.mipmap.icon_collectibles, goldCoin); } else { - ImgLoader.display(itemView.getContext(), R.mipmap.gold_coin, gold_coin); + ImgLoader.display(itemView.getContext(), R.mipmap.ic_yola_game_dou, goldCoin); } - ImgLoader.display(itemView.getContext(), model.getSudgameicon(), game_icon); + ViewClicksAntiShake.clicksAntiShake(itemView.findViewById(R.id.layout), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { @@ -104,75 +98,69 @@ public class SudGameListViewHolder2 extends RecyclerView.ViewHolder { createSudRoomModel.setAvatar(model.getAvatar()); createSudRoomModel.setRoomName(model.getRoomName()); createSudRoomModel.setSudGameName(model.getSudGameName()); - if (isHome) { - if (TextUtils.equals(model.getLiveUid(), "0")) { - if(CommonAppConfig.getInstance().getConfig().isSw()){ - RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel),true,isHome); - }else{ - RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel),true,isHome); - } + if (TextUtils.equals(model.getLiveUid(), "0")) { + if (CommonAppConfig.getInstance().getConfig().isSw()) { + RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel), true, true); } else { - String yes = "是"; - if (IMLoginManager.get(itemView.getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - yes = "是"; - } else { - yes = "Yes"; - } - new XPopup.Builder(itemView.getContext()) - .asCustom(new HintCustomPopup(itemView.getContext(), - itemView.getContext().getString(R.string.interactive_game_search_room_currently_live), - itemView.getContext().getString(R.string.interactive_game_search_room_broadcast_room)) - .setLiveOpenOk(yes) - .setLiveOpenCancel(itemView.getContext().getString(R.string.interactive_game_search_room_bhe_game)) - .setCallBack(new HintCustomPopup.HintCustomCallBack() { - @Override - public void onSure() { - LiveHttpUtil.getLiveInfo(model.getLiveUid() + "", new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { - LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - new LiveRoomCheckLivePresenter(itemView.getContext(), liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { - @Override - public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) { - RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw); - new Handler().postDelayed(new Runnable() { - @Override - public void run() { - Bus.get().post(new LiveOpenSudRoomEvent().setCreateSudRoomModel(createSudRoomModel)); - } - }, 1500); - } - - @Override - public void onCheckError(String contextError) { - - } - }); - } else { - RouteUtil.forwardUserHome(itemView.getContext(), model.getLiveUid(), 0); - } - } - }); - } - - @Override - public void onCancel() { - if(CommonAppConfig.getInstance().getConfig().isSw()){ - RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel),true,isHome); - }else{ - RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel),true,isHome); - } - } - })).show(); - + RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel), true, true); } - } else { + String yes = "是"; + if (IMLoginManager.get(itemView.getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + yes = "是"; + } else { + yes = "Yes"; + } + new XPopup.Builder(itemView.getContext()) + .asCustom(new HintCustomPopup(itemView.getContext(), + itemView.getContext().getString(R.string.interactive_game_search_room_currently_live), + itemView.getContext().getString(R.string.interactive_game_search_room_broadcast_room)) + .setLiveOpenOk(yes) + .setLiveOpenCancel(itemView.getContext().getString(R.string.interactive_game_search_room_bhe_game)) + .setCallBack(new HintCustomPopup.HintCustomCallBack() { + @Override + public void onSure() { + LiveHttpUtil.getLiveInfo(model.getLiveUid() + "", new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + new LiveRoomCheckLivePresenter(itemView.getContext(), liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal), isSw); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + Bus.get().post(new LiveOpenSudRoomEvent().setCreateSudRoomModel(createSudRoomModel)); + } + }, 1500); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + } else { + RouteUtil.forwardUserHome(itemView.getContext(), model.getLiveUid(), 0); + } + } + }); + } + + @Override + public void onCancel() { + if (CommonAppConfig.getInstance().getConfig().isSw()) { + RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel), true, true); + } else { + RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel), true, true); + } + } + })).show(); - Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(createSudRoomModel)); - Bus.get().post(new SudGameListDissMissEvent()); } + } } diff --git a/common/src/main/res/layout/item_home_sud_game_list2.xml b/common/src/main/res/layout/item_home_sud_game_list2.xml index d9dde73ae..dc6fe15d1 100644 --- a/common/src/main/res/layout/item_home_sud_game_list2.xml +++ b/common/src/main/res/layout/item_home_sud_game_list2.xml @@ -15,8 +15,8 @@ android:layout_width="0dp" android:layout_height="0dp" android:layout_marginStart="16dp" - android:layout_marginTop="15dp" - android:layout_marginBottom="15dp" + android:layout_marginTop="18dp" + android:layout_marginBottom="18dp" android:scaleType="centerCrop" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintDimensionRatio="1" @@ -52,12 +52,15 @@ @@ -87,18 +90,30 @@ app:layout_constraintBottom_toBottomOf="@+id/avatar" app:layout_constraintStart_toEndOf="@+id/avatar" app:layout_constraintTop_toTopOf="@+id/avatar" - app:layout_constraintVertical_bias="0.25" /> + app:layout_constraintVertical_bias="0.16" /> + \ No newline at end of file diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index d0c2decc7..0955ccadd 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1426,4 +1426,6 @@ Limited ride And limited avatar frame 遊戲大廳 不限門檻 不限玩家 + 遊戲人數 + 在線人數 diff --git a/main/src/main/res/layout/activity_main.xml b/main/src/main/res/layout/activity_main.xml index 8c7d34cad..c1312181b 100644 --- a/main/src/main/res/layout/activity_main.xml +++ b/main/src/main/res/layout/activity_main.xml @@ -10,6 +10,7 @@ app:slideMode="left" app:slidePadding="60dp"> +