游戏部分提交

This commit is contained in:
ningwenqiang 2024-10-31 17:25:03 +08:00
parent 7d68640200
commit 4631bb1a50
6 changed files with 124 additions and 111 deletions

View File

@ -9,6 +9,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.bean.SudRoomListModel; import com.yunbao.common.bean.SudRoomListModel;
import com.yunbao.common.views.SudGameListViewHolder; import com.yunbao.common.views.SudGameListViewHolder;
import com.yunbao.common.views.SudGameListViewHolder2;
public class SudGameListAdapter extends RefreshAdapter<SudRoomListModel> { public class SudGameListAdapter extends RefreshAdapter<SudRoomListModel> {
private boolean isHome = false; private boolean isHome = false;
@ -22,7 +23,7 @@ public class SudGameListAdapter extends RefreshAdapter<SudRoomListModel> {
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if (isHome){ 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 { }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));
} }
@ -30,7 +31,13 @@ public class SudGameListAdapter extends RefreshAdapter<SudRoomListModel> {
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
SudGameListViewHolder sudGameListViewHolder = (SudGameListViewHolder) holder; if (isHome){
sudGameListViewHolder.setData(mList.get(position),isHome); SudGameListViewHolder2 sudGameListViewHolder = (SudGameListViewHolder2) holder;
sudGameListViewHolder.setData(mList.get(position));
}else {
SudGameListViewHolder sudGameListViewHolder = (SudGameListViewHolder) holder;
sudGameListViewHolder.setData(mList.get(position),isHome);
}
} }
} }

View File

@ -36,54 +36,48 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake;
import java.util.Locale; import java.util.Locale;
public class SudGameListViewHolder2 extends RecyclerView.ViewHolder { public class SudGameListViewHolder2 extends RecyclerView.ViewHolder {
private RoundedImageView mAvatar;
private TextView roomName, playerWeAre, playerWeAre2, goldenBeanNumber; public RoundedImageView avatar;
private RoundedImageView avatarList1, avatarList2, avatarList3, avatarList4, avatarList5; public ImageView btnLive;
private ImageView gifImageView; public ImageView topBgImg;
private ImageView sex, game_icon, gold_coin; public ImageView goldCoin;
public TextView goldenBeanNumber;
public TextView roomName;
public TextView gameNumberTv;
public TextView roomNumberTv;
public SudGameListViewHolder2(@NonNull View itemView) { public SudGameListViewHolder2(@NonNull View itemView) {
super(itemView); super(itemView);
mAvatar = itemView.findViewById(R.id.avatar); avatar = itemView.findViewById(R.id.avatar);
roomName = itemView.findViewById(R.id.room_name); btnLive = itemView.findViewById(R.id.btn_live);
playerWeAre = itemView.findViewById(R.id.player_we_are); topBgImg = itemView.findViewById(R.id.topBgImg);
playerWeAre2 = itemView.findViewById(R.id.player_we_are_2); goldCoin = itemView.findViewById(R.id.gold_coin);
game_icon = itemView.findViewById(R.id.game_icon);
goldenBeanNumber = itemView.findViewById(R.id.golden_bean_number); goldenBeanNumber = itemView.findViewById(R.id.golden_bean_number);
gifImageView = itemView.findViewById(R.id.btn_live); roomName = itemView.findViewById(R.id.room_name);
avatarList1 = itemView.findViewById(R.id.avatar_list1); gameNumberTv = itemView.findViewById(R.id.gameNumberTv);
avatarList2 = itemView.findViewById(R.id.avatar_list2); roomNumberTv = itemView.findViewById(R.id.roomNumberTv);
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);
} }
public void setData(SudRoomListModel model, boolean isHome) { public void setData(SudRoomListModel model) {
ImgLoader.display(itemView.getContext(), model.getAvatar(), mAvatar); ImgLoader.display(itemView.getContext(), model.getAvatar(), avatar);
roomName.setText(model.getRoomName()); 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()); 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")) { 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 { } 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() { ViewClicksAntiShake.clicksAntiShake(itemView.findViewById(R.id.layout), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
@ -104,75 +98,69 @@ public class SudGameListViewHolder2 extends RecyclerView.ViewHolder {
createSudRoomModel.setAvatar(model.getAvatar()); createSudRoomModel.setAvatar(model.getAvatar());
createSudRoomModel.setRoomName(model.getRoomName()); createSudRoomModel.setRoomName(model.getRoomName());
createSudRoomModel.setSudGameName(model.getSudGameName()); createSudRoomModel.setSudGameName(model.getSudGameName());
if (isHome) { if (TextUtils.equals(model.getLiveUid(), "0")) {
if (TextUtils.equals(model.getLiveUid(), "0")) { if (CommonAppConfig.getInstance().getConfig().isSw()) {
if(CommonAppConfig.getInstance().getConfig().isSw()){ RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel), true, true);
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel),true,isHome);
}else{
RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel),true,isHome);
}
} else { } else {
String yes = ""; RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel), true, true);
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();
} }
} else { } 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());
} }
} }
} }

View File

@ -15,8 +15,8 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="15dp" android:layout_marginTop="18dp"
android:layout_marginBottom="15dp" android:layout_marginBottom="18dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1" app:layout_constraintDimensionRatio="1"
@ -52,12 +52,15 @@
<ImageView <ImageView
android:id="@+id/gold_coin" android:id="@+id/gold_coin"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
app:layout_constraintDimensionRatio="1"
android:background="@mipmap/ic_yola_game_dou" android:background="@mipmap/ic_yola_game_dou"
app:layout_constraintBottom_toBottomOf="@+id/topBgImg" app:layout_constraintBottom_toBottomOf="@+id/topBgImg"
app:layout_constraintEnd_toEndOf="@+id/topBgImg" app:layout_constraintEnd_toEndOf="@+id/topBgImg"
app:layout_constraintHorizontal_bias="0.81" app:layout_constraintHorizontal_bias="0.78"
app:layout_constraintStart_toStartOf="@+id/topBgImg" app:layout_constraintStart_toStartOf="@+id/topBgImg"
app:layout_constraintTop_toTopOf="@+id/topBgImg" /> app:layout_constraintTop_toTopOf="@+id/topBgImg" />
@ -87,18 +90,30 @@
app:layout_constraintBottom_toBottomOf="@+id/avatar" app:layout_constraintBottom_toBottomOf="@+id/avatar"
app:layout_constraintStart_toEndOf="@+id/avatar" app:layout_constraintStart_toEndOf="@+id/avatar"
app:layout_constraintTop_toTopOf="@+id/avatar" app:layout_constraintTop_toTopOf="@+id/avatar"
app:layout_constraintVertical_bias="0.25" /> app:layout_constraintVertical_bias="0.16" />
<TextView <TextView
android:id="@+id/room_number" android:id="@+id/gameNumberTv"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="遊戲人數:2" android:text="@string/number_of_players"
android:textColor="#777" android:textColor="#777"
android:textSize="11sp" android:textSize="11sp"
app:layout_constraintVertical_bias="0.6"
app:layout_constraintBottom_toBottomOf="@+id/avatar" app:layout_constraintBottom_toBottomOf="@+id/avatar"
app:layout_constraintStart_toStartOf="@+id/room_name" app:layout_constraintStart_toStartOf="@+id/room_name"
app:layout_constraintTop_toBottomOf="@+id/room_name" /> app:layout_constraintTop_toBottomOf="@+id/room_name" />
<TextView
android:id="@+id/roomNumberTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/number_of_online"
android:textColor="#777"
android:textSize="11sp"
android:layout_marginStart="9dp"
app:layout_constraintBottom_toBottomOf="@+id/gameNumberTv"
app:layout_constraintStart_toEndOf="@+id/gameNumberTv"
app:layout_constraintTop_toTopOf="@+id/gameNumberTv" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1426,4 +1426,6 @@ Limited ride And limited avatar frame</string>
<string name="game_hall">遊戲大廳</string> <string name="game_hall">遊戲大廳</string>
<string name="unlimited_threshold">不限門檻</string> <string name="unlimited_threshold">不限門檻</string>
<string name="unrestricted_players">不限玩家</string> <string name="unrestricted_players">不限玩家</string>
<string name="number_of_players">遊戲人數</string>
<string name="number_of_online">在線人數</string>
</resources> </resources>

View File

@ -10,6 +10,7 @@
app:slideMode="left" app:slideMode="left"
app:slidePadding="60dp"> app:slidePadding="60dp">
<include <include
layout="@layout/view_homemain" layout="@layout/view_homemain"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB