在游戏列表和游戏房间页面增加【游戏记录】按钮,点击可跳转至游戏记录界面,界面记录用户所参与的对局记录;

This commit is contained in:
18401019693
2023-11-09 15:48:28 +08:00
parent b60031d2d0
commit bcc86a899c
28 changed files with 1009 additions and 35 deletions

View File

@@ -8,10 +8,13 @@ import android.widget.TextView;
import androidx.lifecycle.Observer;
import com.google.gson.Gson;
import com.lxj.xpopup.XPopup;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.R;
import com.yunbao.common.bean.CheckRemainingBalance;
import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.event.CheckRemainingBalanceEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback;
@@ -22,11 +25,14 @@ import com.yunbao.common.sud.model.GameConfigModel;
import com.yunbao.common.sud.state.SudMGPMGState;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.LiveSudGameHistoryPopup;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class SudGameActivity extends AbsActivity {
@@ -49,8 +55,28 @@ public class SudGameActivity extends AbsActivity {
Bus.getOn(this);
super.main();
initView();
initDate();
}
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
private void initDate() {
LiveNetManager.get(mContext)
.getCustomSidebarInfo("1", new HttpCallback<List<CustomSidebarInfoModel>>() {
@Override
public void onSuccess(List<CustomSidebarInfoModel> data) {
for (CustomSidebarInfoModel datum : data) {
if (datum.getType().equals("6")) {
customSidebarChildModels = datum.getChild();
return;
}
}
}
@Override
public void onError(String error) {
}
});
}
@Override
protected void onDestroy() {
Bus.getOff(this);
@@ -81,6 +107,15 @@ public class SudGameActivity extends AbsActivity {
finish();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.sud_history), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
new XPopup.Builder(mContext)
.enableDrag(false)
.asCustom(new LiveSudGameHistoryPopup(mContext, customSidebarChildModels)).show();
}
});
gameViewModel.gameViewLiveData.observe(this, new Observer<View>() {
@Override
public void onChanged(View view) {

View File

@@ -0,0 +1,30 @@
package com.yunbao.common.adapter;
import android.content.Context;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.GameRecordModel;
import com.yunbao.common.views.LiveSudGameHistoryViewHolder;
public class LiveSudGameHistoryAdapter extends RefreshAdapter<GameRecordModel> {
public LiveSudGameHistoryAdapter(Context context) {
super(context);
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new LiveSudGameHistoryViewHolder(mInflater.inflate(R.layout.item_live_sud_game_history, parent, false));
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
LiveSudGameHistoryViewHolder sudGameListViewHolder = (LiveSudGameHistoryViewHolder) holder;
sudGameListViewHolder.setData(mList.get(position));
}
}

View File

@@ -0,0 +1,69 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class GameRecordModel extends BaseModel{
@SerializedName("id")
private int id;
@SerializedName("title")
private String title;
@SerializedName("currency_type")
private int currencyType;
@SerializedName("settlement")
private int settlement;
@SerializedName("game_end_time")
private String gameEndTime;
@SerializedName("user_name")
private List<String> userName;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getCurrencyType() {
return currencyType;
}
public void setCurrencyType(int currencyType) {
this.currencyType = currencyType;
}
public int getSettlement() {
return settlement;
}
public void setSettlement(int settlement) {
this.settlement = settlement;
}
public String getGameEndTime() {
return gameEndTime;
}
public void setGameEndTime(String gameEndTime) {
this.gameEndTime = gameEndTime;
}
public List<String> getUserName() {
return userName;
}
public void setUserName(List<String> userName) {
this.userName = userName;
}
}

View File

@@ -54,7 +54,7 @@ public class CreateSudGamePopup extends BottomPopupView {
private boolean isHome = false;
private List<String> roomNames = new ArrayList<>();
private String currencyType = "1", currencyTypeName;
private String currencyType = "3", currencyTypeName;
private long animDuration = 500;
private ImageView roomGameArrow;
@@ -95,9 +95,8 @@ public class CreateSudGamePopup extends BottomPopupView {
userName = IMLoginManager.get(getContext()).getUserInfo().getUserNicename();
roomNames.add(WordUtil.isNewZh() ? "一起玩吧!" : "Let's play together!");
roomNames.add(WordUtil.isNewZh() ? "來戰斗吧!" : "Let's fight!");
roomNames.add(WordUtil.isNewZh() ? "你的籌碼我收下了!" : ".I have taken your chips!");
roomNames.add(WordUtil.isNewZh() ? "在線等遊戲夥伴~" : "Waiting for game partners online~ ");
roomNames.add(WordUtil.isNewZh() ? "決戰到天亮 " : "Fight until dawn");
roomNames.add(WordUtil.isNewZh() ? "在線等遊戲夥伴~" : "Waiting for game partners~");
roomNames.add(WordUtil.isNewZh() ? userName + "的房间 " : userName + "s room");
}
@@ -162,8 +161,8 @@ public class CreateSudGamePopup extends BottomPopupView {
}
if (IMLoginManager.get(getContext()).getLocaleLanguage() != Locale.SIMPLIFIED_CHINESE) {
if (name.length() > 15) {
ToastUtil.show("Room name length is [1-15]");
if (name.length() > 30) {
ToastUtil.show("Room name length is [1-30]");
return;
}
@@ -186,7 +185,7 @@ public class CreateSudGamePopup extends BottomPopupView {
}
if (TextUtils.isEmpty(sill)) {
if (TextUtils.equals(currencyType, "1")) {
if (TextUtils.equals(currencyType, "3")) {
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
ToastUtil.show("数量区间为10~1000");
} else {
@@ -202,7 +201,7 @@ public class CreateSudGamePopup extends BottomPopupView {
return;
}
if (TextUtils.equals(currencyType, "1")) {
if (TextUtils.equals(currencyType, "3")) {
if (sill.length() > 6) {
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
ToastUtil.show("数量区间为100--5W");
@@ -222,9 +221,9 @@ public class CreateSudGamePopup extends BottomPopupView {
}
if (sillNumber % 10 != 0) {
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
ToastUtil.show("數量必須為10的倍數");
ToastUtil.show("貨幣數量必須為10的倍數");
} else {
ToastUtil.show("The number must be a multiple of 10");
ToastUtil.show("The number of currency must be a multiple of 10");
}
return;
}
@@ -232,9 +231,9 @@ public class CreateSudGamePopup extends BottomPopupView {
} else {
if (sill.length() > 4) {
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
ToastUtil.show("数量区间为10~1000");
ToastUtil.show("星幣數量區間為[10 - 1000]");
} else {
ToastUtil.show("The quantity range is 10 to 1000");
ToastUtil.show("The number range of star coins is [10-1000]");
}
return;
} else {
@@ -249,9 +248,9 @@ public class CreateSudGamePopup extends BottomPopupView {
}
if (sillNumber % 10 != 0) {
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
ToastUtil.show("數量必須為10的倍數");
ToastUtil.show("貨幣數量必須為10的倍數");
} else {
ToastUtil.show("The number must be a multiple of 10");
ToastUtil.show("The number of currency must be a multiple of 10");
}
return;
}
@@ -344,7 +343,7 @@ public class CreateSudGamePopup extends BottomPopupView {
currencyTypeName = event.getCurrencyTypeName();
currencyType = event.getCurrencyType();
selectCurrencyType.setText(currencyTypeName);
if (TextUtils.equals(currencyType, "1")) {
if (TextUtils.equals(currencyType, "3")) {
gameSill.setHint(getContext().getString(R.string.interactive_game_create_gold_bean_quantity));
} else {
gameSill.setHint(WordUtil.isNewZh() ? "請選擇星幣數量" : "Please enter the number of Coins");

View File

@@ -34,6 +34,7 @@ import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.LiveSudGameHistoryPopup;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import org.greenrobot.eventbus.Subscribe;
@@ -113,7 +114,7 @@ public class SudGameListPopup extends BottomPopupView {
@Override
public void loadData(int p, HttpCallback callback) {
page = p;
LiveHttpUtil.getRoomList(id, mSill, roomHolderType, mLiveUid, "1",p - 1, callback);
LiveHttpUtil.getRoomList(id, mSill, roomHolderType, mLiveUid, "3", p - 1, callback);
}
@Override
@@ -265,7 +266,15 @@ public class SudGameListPopup extends BottomPopupView {
.asCustom(new SudGameRuleBottom(getContext())).show();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.sud_history), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
new XPopup.Builder(getContext())
.enableDrag(false)
.asCustom(new LiveSudGameHistoryPopup(getContext(), customSidebarChildModels)).show();
}
});
}
@Override

View File

@@ -3,7 +3,6 @@ package com.yunbao.common.dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.text.TextUtils;
import android.widget.PopupMenu;
import android.widget.TextView;
import androidx.annotation.NonNull;
@@ -16,6 +15,7 @@ import com.yunbao.common.adapter.SudTitleSelectAdapter;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.event.CreateSudGameEvent;
import com.yunbao.common.event.CurrencyTypeEvent;
import com.yunbao.common.event.LiveSudGameHistoryEvent;
import com.yunbao.common.event.RoomHolderTypeEvent;
import com.yunbao.common.event.SudGameListEvent;
import com.yunbao.common.event.SudGameListSillEvent;
@@ -59,6 +59,13 @@ public class SudGameListSelectPopup extends AttachPopupView {
mSill = sill;
}
public SudGameListSelectPopup(@NonNull Context context, String sill, List<CustomSidebarChildModel> child) {
super(context);
this.mType = 8;
mSill = sill;
customSidebarChildModels = child;
}
protected int getImplLayoutId() {
return R.layout.view_sud_game_slelect;
@@ -164,7 +171,7 @@ public class SudGameListSelectPopup extends AttachPopupView {
} else if (mType == 5) {
selectString.add(getContext().getString(R.string.golden_bean));
selectString.add(getContext().getString(R.string.coins));
selectSill.put(getContext().getString(R.string.golden_bean), "1");
selectSill.put(getContext().getString(R.string.golden_bean), "3");
selectSill.put(getContext().getString(R.string.coins), "2");
index = 0;
for (int i = 0; i < selectString.size(); i++) {
@@ -183,7 +190,96 @@ public class SudGameListSelectPopup extends AttachPopupView {
String roomHolderType = selectSill.get(roomHolderTypeName);
Bus.get().post(new CurrencyTypeEvent().setCurrencyType(roomHolderType).setCurrencyTypeName(roomHolderTypeName));
dialog.dismiss();
if(onDismissListener!=null){
if (onDismissListener != null) {
onDismissListener.onDismiss(null);
}
}
});
} else if (mType == 6) {
selectString.add(getContext().getString(R.string.interactive_game_create_unlimited));
selectString.add(getContext().getString(R.string.golden_bean));
selectString.add(getContext().getString(R.string.coins));
selectSill.put(getContext().getString(R.string.interactive_game_create_unlimited), "0");
selectSill.put(getContext().getString(R.string.golden_bean), "3");
selectSill.put(getContext().getString(R.string.coins), "2");
index = 0;
for (int i = 0; i < selectString.size(); i++) {
if (TextUtils.equals(mSill, selectString.get(i))) {
index = i;
}
}
sudTitleSelectAdapter = new SudTitleSelectAdapter(selectString, index, mType);
sudTitleSelect.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
sudTitleSelect.setAdapter(sudTitleSelectAdapter);
topSelect.setVisibility(GONE);
sudTitleSelectAdapter.setSudTitleSelectCallBack(new SudTitleSelectAdapter.SudTitleSelectCallBack() {
@Override
public void onSudTitleSelectCallBack(int index) {
String roomHolderTypeName = selectString.get(index);
String roomHolderType = selectSill.get(roomHolderTypeName);
Bus.get().post(new LiveSudGameHistoryEvent().setType(roomHolderType).setTypeName(roomHolderTypeName).setIndex(3));
dialog.dismiss();
if (onDismissListener != null) {
onDismissListener.onDismiss(null);
}
}
});
} else if (mType == 7) {
selectString.add(getContext().getString(R.string.interactive_game_create_unlimited));
selectString.add(getContext().getString(R.string.sud_in_game_game_game_peer_today));
selectString.add(getContext().getString(R.string.sud_in_game_game_game_peer_today_7));
selectString.add(getContext().getString(R.string.sud_in_game_game_game_peer_today_30));
selectSill.put(getContext().getString(R.string.interactive_game_create_unlimited), "0");
selectSill.put(getContext().getString(R.string.sud_in_game_game_game_peer_today), "1");
selectSill.put(getContext().getString(R.string.sud_in_game_game_game_peer_today_7), "2");
selectSill.put(getContext().getString(R.string.sud_in_game_game_game_peer_today_30), "3");
index = 0;
for (int i = 0; i < selectString.size(); i++) {
if (TextUtils.equals(mSill, selectString.get(i))) {
index = i;
}
}
sudTitleSelectAdapter = new SudTitleSelectAdapter(selectString, index, mType);
sudTitleSelect.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
sudTitleSelect.setAdapter(sudTitleSelectAdapter);
topSelect.setVisibility(GONE);
sudTitleSelectAdapter.setSudTitleSelectCallBack(new SudTitleSelectAdapter.SudTitleSelectCallBack() {
@Override
public void onSudTitleSelectCallBack(int index) {
String roomHolderTypeName = selectString.get(index);
String roomHolderType = selectSill.get(roomHolderTypeName);
Bus.get().post(new LiveSudGameHistoryEvent().setType(roomHolderType).setTypeName(roomHolderTypeName).setIndex(2));
dialog.dismiss();
if (onDismissListener != null) {
onDismissListener.onDismiss(null);
}
}
});
} else if (mType == 8) {
selectString.add(getContext().getString(R.string.interactive_game_create_unlimited));
selectSill.put(getContext().getString(R.string.interactive_game_create_unlimited), "0");
for (int i = 0; i < customSidebarChildModels.size(); i++) {
selectString.add(customSidebarChildModels.get(i).getTitle());
selectSill.put(customSidebarChildModels.get(i).getTitle(), customSidebarChildModels.get(i).getId());
}
index = 0;
for (int i = 0; i < selectString.size(); i++) {
if (TextUtils.equals(mSill, selectString.get(i))) {
index = i;
}
}
sudTitleSelectAdapter = new SudTitleSelectAdapter(selectString, index, mType);
sudTitleSelect.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
sudTitleSelect.setAdapter(sudTitleSelectAdapter);
topSelect.setVisibility(GONE);
sudTitleSelectAdapter.setSudTitleSelectCallBack(new SudTitleSelectAdapter.SudTitleSelectCallBack() {
@Override
public void onSudTitleSelectCallBack(int index) {
String roomHolderTypeName = selectString.get(index);
String roomHolderType = selectSill.get(roomHolderTypeName);
Bus.get().post(new LiveSudGameHistoryEvent().setType(roomHolderType).setTypeName(roomHolderTypeName).setIndex(1));
dialog.dismiss();
if (onDismissListener != null) {
onDismissListener.onDismiss(null);
}
}
@@ -201,7 +297,7 @@ public class SudGameListSelectPopup extends AttachPopupView {
@Override
protected void onDismiss() {
super.onDismiss();
if(onDismissListener!=null){
if (onDismissListener != null) {
onDismissListener.onDismiss(null);
}
}

View File

@@ -172,7 +172,7 @@ public class SudGameSearchDialogPopup extends AbsDialogPopupWindow {
private void search(String value) {
LiveNetManager.get(mContext)
.searchRoomList("0", "0,0", "0", value, "1", 0, new HttpCallback<List<SudRoomListModel>>() {
.searchRoomList("0", "0,0", "0", value, "3", 0, new HttpCallback<List<SudRoomListModel>>() {
@Override
public void onSuccess(List<SudRoomListModel> data) {
if (data.size() > 0) {

View File

@@ -0,0 +1,36 @@
package com.yunbao.common.event;
import com.yunbao.common.bean.BaseModel;
public class LiveSudGameHistoryEvent extends BaseModel {
private String type;
private String typeName;
private int index;
public String getType() {
return type;
}
public LiveSudGameHistoryEvent setType(String type) {
this.type = type;
return this;
}
public String getTypeName() {
return typeName;
}
public LiveSudGameHistoryEvent setTypeName(String typeName) {
this.typeName = typeName;
return this;
}
public int getIndex() {
return index;
}
public LiveSudGameHistoryEvent setIndex(int index) {
this.index = index;
return this;
}
}

View File

@@ -970,14 +970,34 @@ public class LiveHttpUtil {
}
public static void getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid,String currencyType,int page,HttpCallback callback ) {
public static void getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid, String currencyType, int page, HttpCallback callback) {
HttpClient.getInstance().get("Sudgameserver.getRoomList", "Sudgameserver.getRoomList")
.params("sud_game_id",sudGameId)
.params("threshold",threshold)
.params("room_holder_type",roomHolderType)
.params("liveuid",liveUid)
.params("currency_type ",currencyType )
.params("page",page)
.params("sud_game_id", sudGameId)
.params("threshold", threshold)
.params("room_holder_type", roomHolderType)
.params("liveuid", liveUid)
.params("currency_type ", currencyType)
.params("page", page)
.execute(callback);
}
/**
* 游戲記錄
*
* @param sudGameId sud_game_id 游戏ID
* @param currencyType currency_type 游戏货币类型 3=>金豆 2=>星币 0=>星币
* @param dateType date_type 时间 0=>不限 1=>今日 2=>7日内 3=>30日内
* @param page
* @param callback
*/
public static void gameRecord(String sudGameId, String currencyType, String dateType, int page, HttpCallback callback) {
HttpClient.getInstance().get("Sudgameserver.gameRecord", "Sudgameserver.gameRecord")
.params("sud_game_id", sudGameId)
.params("currency_type", currencyType)
.params("date_type", dateType)
.params("page", page)
.execute(callback);
}
}

View File

@@ -0,0 +1,245 @@
package com.yunbao.common.views;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.DialogInterface;
import android.util.Log;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.google.gson.Gson;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BottomPopupView;
import com.lxj.xpopup.enums.PopupPosition;
import com.yunbao.common.R;
import com.yunbao.common.adapter.LiveSudGameHistoryAdapter;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.GameRecordModel;
import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.dialog.SudGameListSelectPopup;
import com.yunbao.common.event.LiveSudGameHistoryEvent;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
public class LiveSudGameHistoryPopup extends BottomPopupView {
private CommonRefreshView mRefreshView;
private LiveSudGameHistoryAdapter sudGameListAdapter;
private String sudGameId = "0", currencyType = "0", dateType = "0";
private String sudGameIdName, currencyTypeName, dateTypeName;
private int page = 1;
private TextView gameTitle, roomSillText, houseOwnerText;
private ImageView houseOwnerArrow, roomSillArrow, roomGameArrow;
private long animDuration = 500;
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
public LiveSudGameHistoryPopup(@NonNull Context context, List<CustomSidebarChildModel> customSidebarChildModels) {
super(context);
this.customSidebarChildModels = customSidebarChildModels;
}
@Override
protected int getImplLayoutId() {
return R.layout.dialog_live_sud_game_history;
}
// 执行初始化操作比如findView设置点击或者任何你弹窗内的业务逻辑
@Override
protected void onCreate() {
super.onCreate();
Bus.getOn(this);
initView();
initDate();
}
@Override
protected void onDismiss() {
Bus.getOff(this);
super.onDismiss();
}
private void initView() {
mRefreshView = findViewById(R.id.refreshView);
gameTitle = findViewById(R.id.game_title);
roomSillText = findViewById(R.id.room_sill_text);
houseOwnerText = findViewById(R.id.house_owner_text);
houseOwnerArrow = findViewById(R.id.house_owner_arrow);
roomSillArrow = findViewById(R.id.room_sill_arrow);
roomGameArrow = findViewById(R.id.room_game_arrow);
mRefreshView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
sudGameListAdapter = new LiveSudGameHistoryAdapter(getContext());
mRefreshView.setLoadMoreEnable(true);
mRefreshView.setRecyclerViewAdapter(sudGameListAdapter);
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<GameRecordModel>() {
@Override
public RefreshAdapter<GameRecordModel> getAdapter() {
return null;
}
@Override
public void loadData(int p, HttpCallback callback) {
page = p;
LiveHttpUtil.gameRecord(sudGameId, currencyType, dateType, p - 1, callback);
}
@Override
public List<GameRecordModel> processData(String[] info) {
if (info.length > 0) {
List<GameRecordModel> sudRoomListModels = new ArrayList<>();
for (String json : info) {
GameRecordModel model = new Gson().fromJson(json, GameRecordModel.class);
sudRoomListModels.add(model);
}
return sudRoomListModels;
} else {
return new ArrayList<>();
}
}
@Override
public void onRefreshSuccess(List<GameRecordModel> list, int listCount) {
Log.i("onRefreshSuccess", listCount + "");
}
@Override
public void onRefreshFailure() {
}
@Override
public void onLoadMoreSuccess(List<GameRecordModel> loadItemList, int loadItemCount) {
sudGameListAdapter.insertList(loadItemList);
}
@Override
public void onLoadMoreFailure() {
}
});
mRefreshView.initData();
mRefreshView.setEmptyLayoutId(R.layout.sud_game_no);
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.house_owner), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
ObjectAnimator animator = ObjectAnimator.ofFloat(houseOwnerArrow, "rotation", 0f, 90f);
animator.setDuration(500);
animator.setInterpolator(new LinearInterpolator());
animator.start();
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.house_owner));
builder.hasShadowBg(false)
.isDestroyOnDismiss(true)
.isLightStatusBar(false)
.popupPosition(PopupPosition.Bottom)
.asCustom(new SudGameListSelectPopup(getContext(), 6, currencyTypeName)
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
closeAnimSudGameListEvent(houseOwnerArrow);
}
})
)
.show();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.room_sill), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
ObjectAnimator animator = ObjectAnimator.ofFloat(roomSillArrow, "rotation", 0f, 90f);
animator.setDuration(500);
animator.setInterpolator(new LinearInterpolator());
animator.start();
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.room_sill));
builder.hasShadowBg(false)
.isDestroyOnDismiss(true)
.isLightStatusBar(false)
.popupPosition(PopupPosition.Bottom)
.asCustom(new SudGameListSelectPopup(getContext(), 7, dateTypeName)
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
closeAnimSudGameListEvent(roomSillArrow);
}
})
)
.show();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.interactive_game_room_game), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
ObjectAnimator animator = ObjectAnimator.ofFloat(roomGameArrow, "rotation", 0f, 90f);
animator.setDuration(500);
animator.setInterpolator(new LinearInterpolator());
animator.start();
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.interactive_game_room_game));
builder.hasShadowBg(false)
.isDestroyOnDismiss(true)
.isLightStatusBar(false)
.popupPosition(PopupPosition.Bottom)
.asCustom(new SudGameListSelectPopup(getContext(), sudGameIdName, customSidebarChildModels)
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
closeAnimSudGameListEvent(roomGameArrow);
}
})
)
.show();
}
});
}
private void closeAnimSudGameListEvent(View view) {
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotation", 90f, 0f);
animator.setDuration(animDuration);
animator.setInterpolator(new LinearInterpolator());
animator.start();
}
private void initDate() {
sudGameIdName = getContext().getString(R.string.interactive_game_create_unlimited);
currencyTypeName = getContext().getString(R.string.interactive_game_create_unlimited);
dateTypeName = getContext().getString(R.string.interactive_game_create_unlimited);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveSudGameHistoryEvent(LiveSudGameHistoryEvent event) {
if (event.getIndex() == 3) {
currencyTypeName = event.getTypeName();
currencyType = event.getType();
houseOwnerText.setText(currencyTypeName);
} else if (event.getIndex() == 2) {
dateTypeName = event.getTypeName();
dateType = event.getType();
roomSillText.setText(dateTypeName);
}else if (event.getIndex() == 1) {
sudGameIdName = event.getTypeName();
sudGameId = event.getType();
gameTitle.setText(sudGameIdName);
}
mRefreshView.initData();
}
}

View File

@@ -0,0 +1,51 @@
package com.yunbao.common.views;
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.yunbao.common.R;
import com.yunbao.common.bean.GameRecordModel;
import com.yunbao.common.glide.ImgLoader;
public class LiveSudGameHistoryViewHolder extends RecyclerView.ViewHolder {
private TextView sudGameName, sudGameTime, sudGameUser, sudGameCoin;
private ImageView sudGameType;
public LiveSudGameHistoryViewHolder(@NonNull View itemView) {
super(itemView);
sudGameName = itemView.findViewById(R.id.sud_game_name);
sudGameTime = itemView.findViewById(R.id.sud_game_time);
sudGameUser = itemView.findViewById(R.id.sud_game_user);
sudGameCoin = itemView.findViewById(R.id.sud_game_coin);
sudGameType = itemView.findViewById(R.id.sud_game_type);
}
public void setData(GameRecordModel model) {
sudGameName.setText(model.getTitle());
sudGameTime.setText(model.getGameEndTime());
sudGameCoin.setText(String.valueOf(model.getSettlement()));
if (model.getCurrencyType()==3){
ImgLoader.display(itemView.getContext(),R.mipmap.gold_coin,sudGameType);
} if (model.getCurrencyType()==2) {
ImgLoader.display(itemView.getContext(),R.mipmap.icon_collectibles,sudGameType);
}
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < model.getUserName().size(); i++) {
if (i > model.getUserName().size() - 2) {
stringBuffer.append(model.getUserName().get(i))
.append(" / ");
} else {
stringBuffer.append(model.getUserName().get(i));
}
}
sudGameUser.setText(stringBuffer.toString());
}
}

View File

@@ -15,6 +15,8 @@ import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.R;
import com.yunbao.common.bean.CheckRemainingBalance;
import com.yunbao.common.bean.CreateSudRoomModel;
import com.yunbao.common.bean.CustomSidebarChildModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.event.CheckRemainingBalanceEvent;
import com.yunbao.common.event.HideShowEvent;
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
@@ -100,6 +102,15 @@ public class LiveSudGamePopup extends BottomPopupView {
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(2));
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.sud_history), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
new XPopup.Builder(getContext())
.enableDrag(false)
.asCustom(new LiveSudGameHistoryPopup(getContext(), customSidebarChildModels)).show();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.min_game), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
@@ -156,9 +167,25 @@ public class LiveSudGamePopup extends BottomPopupView {
// SudMGP平台64bit游戏ID
gameViewModel.switchGame((Activity) getContext(), mLiveUid, mInteractionID);
}
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
private void initDate() {
LiveNetManager.get(getContext())
.getCustomSidebarInfo("1", new HttpCallback<List<CustomSidebarInfoModel>>() {
@Override
public void onSuccess(List<CustomSidebarInfoModel> data) {
for (CustomSidebarInfoModel datum : data) {
if (datum.getType().equals("6")) {
customSidebarChildModels = datum.getChild();
return;
}
}
}
@Override
public void onError(String error) {
}
});
}
public void BusGetOff() {