游戏部分提交
This commit is contained in:
parent
7d68640200
commit
4631bb1a50
@ -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<SudRoomListModel> {
|
||||
private boolean isHome = false;
|
||||
@ -22,7 +23,7 @@ public class SudGameListAdapter extends RefreshAdapter<SudRoomListModel> {
|
||||
@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<SudRoomListModel> {
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (isHome){
|
||||
SudGameListViewHolder2 sudGameListViewHolder = (SudGameListViewHolder2) holder;
|
||||
sudGameListViewHolder.setData(mList.get(position));
|
||||
}else {
|
||||
SudGameListViewHolder sudGameListViewHolder = (SudGameListViewHolder) holder;
|
||||
sudGameListViewHolder.setData(mList.get(position),isHome);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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,12 +98,11 @@ 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 (CommonAppConfig.getInstance().getConfig().isSw()) {
|
||||
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel), true, true);
|
||||
} else {
|
||||
RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel), true, true);
|
||||
}
|
||||
} else {
|
||||
String yes = "是";
|
||||
@ -134,8 +127,8 @@ public class SudGameListViewHolder2 extends RecyclerView.ViewHolder {
|
||||
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);
|
||||
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() {
|
||||
@ -158,21 +151,16 @@ public class SudGameListViewHolder2 extends RecyclerView.ViewHolder {
|
||||
|
||||
@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);
|
||||
if (CommonAppConfig.getInstance().getConfig().isSw()) {
|
||||
RouteUtil.forwardSwSudGameActivity(new Gson().toJson(createSudRoomModel), true, true);
|
||||
} else {
|
||||
RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel), true, true);
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(createSudRoomModel));
|
||||
Bus.get().post(new SudGameListDissMissEvent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/gold_coin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
app:layout_constraintDimensionRatio="1"
|
||||
android:background="@mipmap/ic_yola_game_dou"
|
||||
app:layout_constraintBottom_toBottomOf="@+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_constraintTop_toTopOf="@+id/topBgImg" />
|
||||
|
||||
@ -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" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/room_number"
|
||||
android:id="@+id/gameNumberTv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="遊戲人數:2"
|
||||
android:text="@string/number_of_players"
|
||||
android:textColor="#777"
|
||||
android:textSize="11sp"
|
||||
app:layout_constraintVertical_bias="0.6"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/avatar"
|
||||
app:layout_constraintStart_toStartOf="@+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>
|
@ -1426,4 +1426,6 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="game_hall">遊戲大廳</string>
|
||||
<string name="unlimited_threshold">不限門檻</string>
|
||||
<string name="unrestricted_players">不限玩家</string>
|
||||
<string name="number_of_players">遊戲人數</string>
|
||||
<string name="number_of_online">在線人數</string>
|
||||
</resources>
|
||||
|
@ -10,6 +10,7 @@
|
||||
app:slideMode="left"
|
||||
app:slidePadding="60dp">
|
||||
|
||||
|
||||
<include
|
||||
layout="@layout/view_homemain"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
BIN
main/src/main/res/mipmap-xxxhdpi/bg_yola_index.png
Normal file
BIN
main/src/main/res/mipmap-xxxhdpi/bg_yola_index.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 MiB |
Loading…
Reference in New Issue
Block a user