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

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() {

View File

@ -29,10 +29,17 @@
<ImageView
android:layout_width="30dp"
android:visibility="gone"
android:layout_height="30dp"
android:layout_marginEnd="16dp"
android:src="@mipmap/icon_interactive_game_create_room_seats" />
android:src="@mipmap/icon_interactive_game_create_room_seats"
android:visibility="gone" />
<ImageView
android:id="@+id/sud_history"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginEnd="14dp"
android:src="@mipmap/icon_sud_history_live" />
<TextView
android:id="@+id/exit"
@ -65,10 +72,10 @@
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="35dp"
android:visibility="gone"
android:layout_height="35dp"
android:layout_marginStart="6dp"
android:scaleType="centerCrop"
android:visibility="gone"
app:riv_oval="true" />
<LinearLayout

View File

@ -27,6 +27,13 @@
android:layout_height="1dp"
android:layout_weight="1" />
<ImageView
android:id="@+id/sud_history"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginEnd="14dp"
android:src="@mipmap/icon_sud_history_live" />
<ImageView
android:id="@+id/min_game"
android:layout_width="30dp"
@ -92,9 +99,10 @@
<TextView
android:id="@+id/room_name"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxWidth="98dp"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="12sp" />

View File

@ -0,0 +1,213 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="555dp"
android:background="@mipmap/background_sud_history"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:gravity="center"
android:text="@string/sud_in_game_game_record"
android:textColor="#000000"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:text="@string/interactive_game_room_game"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/interactive_game_room_game"
android:layout_width="58dp"
android:layout_height="28dp"
android:layout_marginStart="4dp"
android:background="@drawable/bg_home_sud_list_btn"
android:gravity="center_vertical">
<TextView
android:id="@+id/game_title"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/interactive_game_create_unlimited"
android:textColor="#666666"
android:textSize="10sp" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<ImageView
android:id="@+id/room_game_arrow"
android:layout_width="8dp"
android:layout_height="14dp"
android:layout_marginEnd="8dp"
android:src="@mipmap/icon_home_interactive_game_arrow" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@string/sud_in_game_game_time"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="bold" />
<FrameLayout
android:id="@+id/room_sill"
android:layout_width="82dp"
android:layout_height="28dp"
android:layout_marginStart="4dp"
android:background="@drawable/bg_home_sud_list_btn">
<TextView
android:id="@+id/room_sill_text"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="6dp"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/interactive_game_create_unlimited"
android:textColor="#666666"
android:textSize="10sp" />
<ImageView
android:id="@+id/room_sill_arrow"
android:layout_width="8dp"
android:layout_height="14dp"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="8dp"
android:src="@mipmap/icon_home_interactive_game_arrow" />
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@string/sud_in_game_game_currency"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/house_owner"
android:layout_width="70dp"
android:layout_height="28dp"
android:layout_marginStart="4dp"
android:background="@drawable/bg_home_sud_list_btn"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/house_owner_text"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/interactive_game_create_unlimited"
android:textColor="#666666"
android:textSize="10sp" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<ImageView
android:id="@+id/house_owner_arrow"
android:layout_width="8dp"
android:layout_height="14dp"
android:layout_marginEnd="5dp"
android:src="@mipmap/icon_home_interactive_game_arrow" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="20dp">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:maxWidth="150dp"
android:singleLine="true"
android:text="@string/sud_in_game_game_game_type"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:maxWidth="150dp"
android:singleLine="true"
android:text="@string/sud_in_game_game_currency_item"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:maxWidth="150dp"
android:singleLine="true"
android:text="@string/sud_in_game_game_game_settlement_time"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:maxWidth="150dp"
android:singleLine="true"
android:text="@string/sud_in_game_game_game_peer_user"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
<com.yunbao.common.custom.CommonRefreshView
android:id="@+id/refreshView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_marginRight="5dp" />
</LinearLayout>
</FrameLayout>

View File

@ -32,6 +32,14 @@
android:layout_height="1dp"
android:layout_weight="1" />
<ImageView
android:id="@+id/sud_history"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="14dp"
android:src="@mipmap/icon_sud_history_live2" />
<ImageView
android:id="@+id/search"
android:layout_width="30dp"

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<TextView
android:id="@+id/sud_game_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:maxLines="2"
android:text="@string/sud_in_game_game_game_type"
android:textColor="#000000"
android:textSize="14sp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center">
<ImageView
android:id="@+id/sud_game_type"
android:layout_width="16dp"
android:layout_height="16dp"
android:src="@mipmap/icon_collectibles" />
<TextView
android:id="@+id/sud_game_coin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:text="@string/sud_in_game_game_game_type"
android:textColor="#000000"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/sud_game_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:maxLines="2"
android:text="@string/sud_in_game_game_game_type"
android:textColor="#000000"
android:textSize="14sp" />
<TextView
android:id="@+id/sud_game_user"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:maxLines="2"
android:text="@string/sud_in_game_game_game_type"
android:textColor="#000000"
android:textSize="14sp" />
</LinearLayout>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/icon_sud_no_data" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/image"
android:layout_centerHorizontal="true"
android:layout_marginTop="-80dp"
android:gravity="center"
android:text="@string/sud_in_game_game_game_peer_user_nodata"
android:textColor="#333333"
android:textSize="14sp" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

View File

@ -1371,6 +1371,17 @@ Limited ride And limited avatar frame</string>
<string name="sud_in_game">IN GAME</string>
<string name="sud_in_game_minimize">minimize</string>
<string name="sud_in_game_random_name">随机</string>
<string name="sud_in_game_game_record">游戲記錄</string>
<string name="sud_in_game_game_time">時間:</string>
<string name="sud_in_game_game_currency">貨幣:</string>
<string name="sud_in_game_game_currency_item">貨幣</string>
<string name="sud_in_game_game_game_type">游戲類型</string>
<string name="sud_in_game_game_game_settlement_time">結算時間</string>
<string name="sud_in_game_game_game_peer_user">對局用戶</string>
<string name="sud_in_game_game_game_peer_user_nodata">暫無記錄~</string>
<string name="sud_in_game_game_game_peer_today">今日</string>
<string name="sud_in_game_game_game_peer_today_7">7日内</string>
<string name="sud_in_game_game_game_peer_today_30">30日内</string>
<string name="sud_in_game_rule_hint1">1. Interactive games are a new section provided by PDLIVE for users, who can participate in the game section on the homepage or in the live room;</string>
<string name="sud_in_game_rule_hint2">2. Currently, we have launched \'GoBang\',\' Bumper car \',\' Flying Chess\', \'Minesweeping\', \'Dart Master\', and \'Monster Eliminating\'. We will provide more game types in the future. Stay tuned;</string>
<string name="sud_in_game_rule_hint3">3. Users can customize the game threshold, which must be between 100 to 50000 gold beans or 10 to 1000 star coins, and the amount must be a multiple of 10;</string>

View File

@ -43,6 +43,7 @@ import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.LiveSudGameHistoryPopup;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.main.R;
@ -109,7 +110,7 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
@Override
public void loadData(int p, com.yunbao.common.http.HttpCallback callback) {
LiveHttpUtil.getRoomList(id, mSill, roomHolderType, "0", "1", p - 1, callback);
LiveHttpUtil.getRoomList(id, mSill, roomHolderType, "0", "3", p - 1, callback);
}
@Override
@ -281,7 +282,15 @@ public class MainHomeGameViewHolder extends AbsMainHomeChildViewHolder implement
new SudGameSearchDialogPopup(mContext, true).showDialog();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(com.yunbao.common.R.id.sud_history), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
new XPopup.Builder(mContext)
.enableDrag(false)
.asCustom(new LiveSudGameHistoryPopup(mContext, customSidebarChildModels)).show();
}
});
LiveNetManager.get(mContext)
.getCustomSidebarInfo("1", new HttpCallback<List<CustomSidebarInfoModel>>() {
@Override

View File

@ -25,6 +25,14 @@
android:layout_height="1dp"
android:layout_weight="1" />
<ImageView
android:id="@+id/sud_history"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="14dp"
android:src="@mipmap/icon_sud_history" />
<ImageView
android:id="@+id/search"
android:layout_width="30dp"
@ -152,9 +160,9 @@
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="@string/interactive_game_create_unlimited"
android:singleLine="true"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/interactive_game_create_unlimited"
android:textColor="#000"
android:textSize="10sp" />