1、新版 广场界面 完成
2、新版 娱乐界面 完成
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -8,29 +10,43 @@ 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.NewSudGameListViewHolder;
|
||||
|
||||
public class SudGameListAdapter extends RefreshAdapter<SudRoomListModel> {
|
||||
private boolean isHome = false;
|
||||
|
||||
private final Drawable[] bgList = new Drawable[6];
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
public SudGameListAdapter(Context context, boolean isHome) {
|
||||
super(context);
|
||||
this.isHome = isHome;
|
||||
|
||||
bgList[0] = mContext.getDrawable(R.drawable.grid_item_bg_1);
|
||||
bgList[1] = mContext.getDrawable(R.drawable.grid_item_bg_2);
|
||||
bgList[2] = mContext.getDrawable(R.drawable.grid_item_bg_3);
|
||||
bgList[3] = mContext.getDrawable(R.drawable.grid_item_bg_4);
|
||||
bgList[4] = mContext.getDrawable(R.drawable.grid_item_bg_5);
|
||||
bgList[5] = mContext.getDrawable(R.drawable.grid_item_bg_6);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
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));
|
||||
}else {
|
||||
return new SudGameListViewHolder(mInflater.inflate(R.layout.item_sud_game_list, parent, false));
|
||||
}
|
||||
}*/
|
||||
|
||||
return new NewSudGameListViewHolder(mInflater.inflate(R.layout.item_new_game_room, parent, false));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
SudGameListViewHolder sudGameListViewHolder = (SudGameListViewHolder) holder;
|
||||
NewSudGameListViewHolder sudGameListViewHolder = (NewSudGameListViewHolder) holder;
|
||||
sudGameListViewHolder.itemView.setBackground(bgList[position % 6]);
|
||||
sudGameListViewHolder.setData(mList.get(position),isHome);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,16 @@ public class CustomSidebarChildModel extends BaseModel {
|
||||
private String isShow;
|
||||
@SerializedName("sud_game_is_new")
|
||||
private String sudGameIsNew;
|
||||
@SerializedName("is_click")
|
||||
private boolean isClick;
|
||||
|
||||
public boolean isClick() {
|
||||
return isClick;
|
||||
}
|
||||
|
||||
public void setClick(boolean click) {
|
||||
isClick = click;
|
||||
}
|
||||
|
||||
public String getSudGameIsNew() {
|
||||
return sudGameIsNew;
|
||||
|
||||
@@ -412,6 +412,10 @@ public class CommonRefreshView extends FrameLayout implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
public void addItemDecoration(RecyclerView.ItemDecoration gridSpacingItemDecoration) {
|
||||
mRecyclerView.addItemDecoration(gridSpacingItemDecoration);
|
||||
}
|
||||
|
||||
public interface DataHelperNew {
|
||||
void loadData(int p);
|
||||
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.gson.Gson;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.SudGameScoreBean;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
import com.yunbao.common.event.LiveOpenSudRoomEvent;
|
||||
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
|
||||
import com.yunbao.common.event.SudGameListDissMissEvent;
|
||||
import com.yunbao.common.event.SudGameListRefreshEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.RandomSudGameManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class NewSudGameListViewHolder extends RecyclerView.ViewHolder {
|
||||
private RoundedImageView mAvatar;
|
||||
private TextView roomName, playerWeAre, playerWeAre2, goldenBeanNumber;
|
||||
private ImageView sex, gold_coin;
|
||||
|
||||
public NewSudGameListViewHolder(@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);
|
||||
|
||||
goldenBeanNumber = itemView.findViewById(R.id.golden_bean_number);
|
||||
|
||||
gold_coin = itemView.findViewById(R.id.gold_coin);
|
||||
sex = itemView.findViewById(R.id.sex);
|
||||
|
||||
}
|
||||
|
||||
public void setData(SudRoomListModel model, boolean isHome) {
|
||||
ImgLoader.display(itemView.getContext(), model.getAvatar(), mAvatar);
|
||||
roomName.setText(model.getRoomName());
|
||||
playerWeAre.setText(String.format(itemView.getContext().getString(R.string.interactive_game_player_we_are_4), model.getPlayerTotal()));
|
||||
playerWeAre2.setText(String.format(itemView.getContext().getString(R.string.interactive_game_player_we_are_3), model.getTotal()));
|
||||
goldenBeanNumber.setText(model.getGoldenBeanNumber());
|
||||
if (TextUtils.equals(model.getSex(), "1")) {
|
||||
ImgLoader.display(itemView.getContext(), R.mipmap.man, sex);
|
||||
} else if (TextUtils.equals(model.getSex(), "2")) {
|
||||
ImgLoader.display(itemView.getContext(), R.mipmap.girl, sex);
|
||||
}
|
||||
if (TextUtils.equals(model.getCurrencyType(), "2")) {
|
||||
ImgLoader.display(itemView.getContext(), R.mipmap.icon_collectibles, gold_coin);
|
||||
} else {
|
||||
ImgLoader.display(itemView.getContext(), R.mipmap.gold_coin, gold_coin);
|
||||
}
|
||||
ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
LiveNetManager.get(itemView.getContext()).checkRoomStatus(model.getId(), new com.yunbao.common.http.base.HttpCallback<CreateSudRoomModel>() {
|
||||
@Override
|
||||
public void onSuccess(CreateSudRoomModel data) {
|
||||
if (TextUtils.equals(data.getRoomStatus(), "0")) {
|
||||
if (IMLoginManager.get(itemView.getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("房间不存在");
|
||||
} else {
|
||||
ToastUtil.show("The room does not exist");
|
||||
}
|
||||
Bus.get().post(new SudGameListRefreshEvent());
|
||||
} else {
|
||||
if (TextUtils.equals(model.getIsActivity(), "1")) {
|
||||
LiveNetManager.get(mAvatar.getContext())
|
||||
.getScore(model.getSudGameRoomId(), new com.yunbao.common.http.base.HttpCallback<SudGameScoreBean>() {
|
||||
@Override
|
||||
public void onSuccess(SudGameScoreBean data) {
|
||||
if(data.getGolden_bean_remaining_balance()!=1){
|
||||
RandomSudGameManager.getManager().showNotActivityTicketDialog(itemView.getContext(), true, new DialogUitl.SimpleCallback2() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
toGame(model, isHome, true);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
toGame(model, isHome, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
toGame(model, isHome, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void toGame(SudRoomListModel model, boolean isHome,boolean isActivity) {
|
||||
|
||||
|
||||
CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel();
|
||||
createSudRoomModel.setSudGameId(model.getSudGameId());
|
||||
createSudRoomModel.setSudGameRoomId(model.getSudGameRoomId());
|
||||
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), isActivity,false, isHome);
|
||||
} else {
|
||||
RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel), true, isHome);
|
||||
}
|
||||
} 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() {
|
||||
LiveNetManager.get(mAvatar.getContext())
|
||||
.getScore(model.getSudGameRoomId(), new com.yunbao.common.http.base.HttpCallback<SudGameScoreBean>() {
|
||||
@Override
|
||||
public void onSuccess(SudGameScoreBean data) {
|
||||
if(data.getGolden_bean_remaining_balance()!=1){
|
||||
RandomSudGameManager.getManager().showNotActivityTicketDialog(itemView.getContext(), true, new DialogUitl.SimpleCallback2() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
Bus.get().post(new LiveOpenSudRoomEvent().setActivity(isActivity).setCreateSudRoomModel(createSudRoomModel));
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
Bus.get().post(new LiveOpenSudRoomEvent().setActivity(isActivity).setCreateSudRoomModel(createSudRoomModel));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 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), isActivity,false, isHome);
|
||||
} else {
|
||||
RouteUtil.forwardRySudGameActivity(new Gson().toJson(createSudRoomModel), true, isHome);
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setActivityGame(isActivity).setCreateSudRoomModel(createSudRoomModel));
|
||||
Bus.get().post(new SudGameListDissMissEvent());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user