创建游戏,游戏界面完成
This commit is contained in:
parent
866024ae95
commit
ce48a7dcf0
@ -0,0 +1,41 @@
|
|||||||
|
package com.yunbao.common.adapter;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.bean.playerObject;
|
||||||
|
import com.yunbao.common.views.AvatarListViewHolder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AvatarListAdapter extends RecyclerView.Adapter {
|
||||||
|
private List<playerObject> playerObjects = new ArrayList<>();
|
||||||
|
|
||||||
|
public AvatarListAdapter(List<playerObject> playerObjects) {
|
||||||
|
this.playerObjects = playerObjects;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_sud_avatar_list_view, parent, false);
|
||||||
|
return new AvatarListViewHolder(runGamesView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||||
|
AvatarListViewHolder avatarListViewHolder = (AvatarListViewHolder) holder;
|
||||||
|
avatarListViewHolder.setData(playerObjects.get(position));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return playerObjects.size();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
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.SudRoomListModel;
|
||||||
|
import com.yunbao.common.views.SudGameListViewHolder;
|
||||||
|
|
||||||
|
public class SudGameListAdapter extends RefreshAdapter<SudRoomListModel> {
|
||||||
|
public SudGameListAdapter(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
return new SudGameListViewHolder(mInflater.inflate(R.layout.item_sud_game_list, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||||
|
SudGameListViewHolder sudGameListViewHolder = (SudGameListViewHolder) holder;
|
||||||
|
sudGameListViewHolder.setData(mList.get(position));
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,9 @@ package com.yunbao.common.bean;
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class SudRoomListModel extends BaseModel {
|
public class SudRoomListModel extends BaseModel {
|
||||||
|
|
||||||
|
|
||||||
@ -31,4 +34,161 @@ public class SudRoomListModel extends BaseModel {
|
|||||||
private String playerTotal;
|
private String playerTotal;
|
||||||
@SerializedName("ob_total")
|
@SerializedName("ob_total")
|
||||||
private String obTotal;
|
private String obTotal;
|
||||||
|
@SerializedName("liveuid")
|
||||||
|
private String liveUid;
|
||||||
|
@SerializedName("sex")
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
public String getLiveUid() {
|
||||||
|
return liveUid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setLiveUid(String liveUid) {
|
||||||
|
this.liveUid = liveUid;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSex() {
|
||||||
|
return sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setSex(String sex) {
|
||||||
|
this.sex = sex;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SerializedName("player_object")
|
||||||
|
private List<playerObject> playerObjects = new ArrayList<>();
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoomHolderId() {
|
||||||
|
return roomHolderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setRoomHolderId(String roomHolderId) {
|
||||||
|
this.roomHolderId = roomHolderId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoomName() {
|
||||||
|
return roomName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setRoomName(String roomName) {
|
||||||
|
this.roomName = roomName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoomHolderType() {
|
||||||
|
return roomHolderType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setRoomHolderType(String roomHolderType) {
|
||||||
|
this.roomHolderType = roomHolderType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSudGameId() {
|
||||||
|
return sudGameId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setSudGameId(String sudGameId) {
|
||||||
|
this.sudGameId = sudGameId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGoldenBeanNumber() {
|
||||||
|
return goldenBeanNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setGoldenBeanNumber(String goldenBeanNumber) {
|
||||||
|
this.goldenBeanNumber = goldenBeanNumber;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoomStatus() {
|
||||||
|
return roomStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setRoomStatus(String roomStatus) {
|
||||||
|
this.roomStatus = roomStatus;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSudGameRoomId() {
|
||||||
|
return sudGameRoomId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setSudGameRoomId(String sudGameRoomId) {
|
||||||
|
this.sudGameRoomId = sudGameRoomId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoomHolderName() {
|
||||||
|
return roomHolderName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setRoomHolderName(String roomHolderName) {
|
||||||
|
this.roomHolderName = roomHolderName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAvatar() {
|
||||||
|
return avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setAvatar(String avatar) {
|
||||||
|
this.avatar = avatar;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSudGameName() {
|
||||||
|
return sudGameName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setSudGameName(String sudGameName) {
|
||||||
|
this.sudGameName = sudGameName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlayerTotal() {
|
||||||
|
return playerTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setPlayerTotal(String playerTotal) {
|
||||||
|
this.playerTotal = playerTotal;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getObTotal() {
|
||||||
|
return obTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setObTotal(String obTotal) {
|
||||||
|
this.obTotal = obTotal;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<playerObject> getPlayerObjects() {
|
||||||
|
return playerObjects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModel setPlayerObjects(List<playerObject> playerObjects) {
|
||||||
|
this.playerObjects = playerObjects;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTotal() {
|
||||||
|
int obT = Integer.parseInt(obTotal);
|
||||||
|
int playerO = Integer.parseInt(playerTotal);
|
||||||
|
return String.valueOf(obT + playerO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class playerObject extends BaseModel {
|
||||||
|
@SerializedName("avatar")
|
||||||
|
private String avatar;
|
||||||
|
@SerializedName("id")
|
||||||
|
private String id;
|
||||||
|
public boolean isChange = false;
|
||||||
|
|
||||||
|
public boolean isChange() {
|
||||||
|
return isChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public playerObject setChange(boolean change) {
|
||||||
|
isChange = change;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAvatar() {
|
||||||
|
return avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public playerObject setAvatar(String avatar) {
|
||||||
|
this.avatar = avatar;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public playerObject setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
@ -3,25 +3,34 @@ package com.yunbao.common.dialog;
|
|||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.animation.LinearInterpolator;
|
import android.view.animation.LinearInterpolator;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.lxj.xpopup.XPopup;
|
import com.lxj.xpopup.XPopup;
|
||||||
import com.lxj.xpopup.core.BottomPopupView;
|
import com.lxj.xpopup.core.BottomPopupView;
|
||||||
import com.lxj.xpopup.enums.PopupPosition;
|
import com.lxj.xpopup.enums.PopupPosition;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
|
import com.yunbao.common.adapter.SudGameListAdapter;
|
||||||
|
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||||
import com.yunbao.common.bean.SudRoomListModel;
|
import com.yunbao.common.bean.SudRoomListModel;
|
||||||
|
import com.yunbao.common.custom.CommonRefreshView;
|
||||||
import com.yunbao.common.event.RoomHolderTypeEvent;
|
import com.yunbao.common.event.RoomHolderTypeEvent;
|
||||||
import com.yunbao.common.event.SudGameListDissMissEvent;
|
import com.yunbao.common.event.SudGameListDissMissEvent;
|
||||||
import com.yunbao.common.event.SudGameListEvent;
|
import com.yunbao.common.event.SudGameListEvent;
|
||||||
import com.yunbao.common.event.SudGameListSillEvent;
|
import com.yunbao.common.event.SudGameListSillEvent;
|
||||||
import com.yunbao.common.http.base.HttpCallback;
|
import com.yunbao.common.event.SudRoomListModelEvent;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
|
import com.yunbao.common.http.LiveHttpUtil;
|
||||||
import com.yunbao.common.utils.Bus;
|
import com.yunbao.common.utils.Bus;
|
||||||
|
import com.yunbao.common.views.LiveSudGamePopup;
|
||||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@ -39,6 +48,8 @@ public class SudGameListPopup extends BottomPopupView {
|
|||||||
private String id = "0", mLiveUid;
|
private String id = "0", mLiveUid;
|
||||||
private int page = 0;
|
private int page = 0;
|
||||||
private String mSill = "0,0", mSillName, roomHolderType = "0", roomHolderTypeName;
|
private String mSill = "0,0", mSillName, roomHolderType = "0", roomHolderTypeName;
|
||||||
|
private CommonRefreshView mRefreshView;
|
||||||
|
private SudGameListAdapter sudGameListAdapter;
|
||||||
|
|
||||||
public SudGameListPopup(@NonNull Context context, long interactionID, List<CustomSidebarChildModel> child, String liveUid) {
|
public SudGameListPopup(@NonNull Context context, long interactionID, List<CustomSidebarChildModel> child, String liveUid) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -64,18 +75,8 @@ public class SudGameListPopup extends BottomPopupView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initDate() {
|
private void initDate() {
|
||||||
LiveNetManager.get(getContext())
|
|
||||||
.getRoomList(id, mSill, roomHolderType, mLiveUid, page, new HttpCallback<List<SudRoomListModel>>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<SudRoomListModel> data) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(String error) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
@ -85,6 +86,60 @@ public class SudGameListPopup extends BottomPopupView {
|
|||||||
gameTitle = findViewById(R.id.game_title);
|
gameTitle = findViewById(R.id.game_title);
|
||||||
sillTitle = findViewById(R.id.room_sill_text);
|
sillTitle = findViewById(R.id.room_sill_text);
|
||||||
houseOwnerTitle = findViewById(R.id.house_owner_text);
|
houseOwnerTitle = findViewById(R.id.house_owner_text);
|
||||||
|
|
||||||
|
mRefreshView = findViewById(R.id.refreshView);
|
||||||
|
mRefreshView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||||
|
sudGameListAdapter = new SudGameListAdapter(getContext());
|
||||||
|
mRefreshView.setLoadMoreEnable(true);
|
||||||
|
mRefreshView.setRecyclerViewAdapter(sudGameListAdapter);
|
||||||
|
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<SudRoomListModel>() {
|
||||||
|
@Override
|
||||||
|
public RefreshAdapter<SudRoomListModel> getAdapter() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadData(int p, HttpCallback callback) {
|
||||||
|
page = p;
|
||||||
|
LiveHttpUtil.getRoomList(id, mSill, roomHolderType, mLiveUid, p, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SudRoomListModel> processData(String[] info) {
|
||||||
|
if (info.length > 0) {
|
||||||
|
List<SudRoomListModel> sudRoomListModels = new ArrayList<>();
|
||||||
|
for (String json : info) {
|
||||||
|
SudRoomListModel model = new Gson().fromJson(json, SudRoomListModel.class);
|
||||||
|
sudRoomListModels.add(model);
|
||||||
|
}
|
||||||
|
return sudRoomListModels;
|
||||||
|
} else {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRefreshSuccess(List<SudRoomListModel> list, int listCount) {
|
||||||
|
Log.i("onRefreshSuccess", listCount + "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRefreshFailure() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadMoreSuccess(List<SudRoomListModel> loadItemList, int loadItemCount) {
|
||||||
|
sudGameListAdapter.insertList(loadItemList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadMoreFailure() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mRefreshView.initData();
|
||||||
for (CustomSidebarChildModel model : customSidebarChildModels) {
|
for (CustomSidebarChildModel model : customSidebarChildModels) {
|
||||||
if (TextUtils.equals(String.valueOf(interactionID), model.getSrc())) {
|
if (TextUtils.equals(String.valueOf(interactionID), model.getSrc())) {
|
||||||
gameTitle.setText(model.getTitle().substring(0, 2));
|
gameTitle.setText(model.getTitle().substring(0, 2));
|
||||||
@ -175,8 +230,7 @@ public class SudGameListPopup extends BottomPopupView {
|
|||||||
animator.setDuration(500);
|
animator.setDuration(500);
|
||||||
animator.setInterpolator(new LinearInterpolator());
|
animator.setInterpolator(new LinearInterpolator());
|
||||||
animator.start();
|
animator.start();
|
||||||
page=0;
|
mRefreshView.initData();
|
||||||
initDate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
@ -194,8 +248,7 @@ public class SudGameListPopup extends BottomPopupView {
|
|||||||
animator.setDuration(500);
|
animator.setDuration(500);
|
||||||
animator.setInterpolator(new LinearInterpolator());
|
animator.setInterpolator(new LinearInterpolator());
|
||||||
animator.start();
|
animator.start();
|
||||||
page=0;
|
mRefreshView.initData();
|
||||||
initDate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
@ -207,8 +260,24 @@ public class SudGameListPopup extends BottomPopupView {
|
|||||||
animator.setDuration(500);
|
animator.setDuration(500);
|
||||||
animator.setInterpolator(new LinearInterpolator());
|
animator.setInterpolator(new LinearInterpolator());
|
||||||
animator.start();
|
animator.start();
|
||||||
page=0;
|
mRefreshView.initData();
|
||||||
initDate();
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void onSudGameListEvent(SudRoomListModelEvent event) {
|
||||||
|
CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel();
|
||||||
|
createSudRoomModel.setSudGameId(event.getModel().getSudGameId());
|
||||||
|
createSudRoomModel.setSudGameRoomId(event.getModel().getSudGameRoomId());
|
||||||
|
createSudRoomModel.setAvatar(event.getModel().getAvatar());
|
||||||
|
createSudRoomModel.setRoomName(event.getModel().getRoomName());
|
||||||
|
createSudRoomModel.setSudGameName(event.getModel().getSudGameName());
|
||||||
|
new XPopup.Builder(getContext())
|
||||||
|
.enableDrag(false)
|
||||||
|
.dismissOnTouchOutside(false)
|
||||||
|
.dismissOnBackPressed(false)
|
||||||
|
.asCustom(new LiveSudGamePopup(getContext(), createSudRoomModel))
|
||||||
|
.show();
|
||||||
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.yunbao.common.event;
|
||||||
|
|
||||||
|
import com.yunbao.common.bean.BaseModel;
|
||||||
|
import com.yunbao.common.bean.SudRoomListModel;
|
||||||
|
|
||||||
|
public class SudRoomListModelEvent extends BaseModel {
|
||||||
|
private SudRoomListModel model;
|
||||||
|
|
||||||
|
public SudRoomListModel getModel() {
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudRoomListModelEvent setModel(SudRoomListModel model) {
|
||||||
|
this.model = model;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
@ -967,6 +967,16 @@ public class LiveHttpUtil {
|
|||||||
HttpClient.getInstance().get("Home.getFollow", "Home.getFollow")
|
HttpClient.getInstance().get("Home.getFollow", "Home.getFollow")
|
||||||
.params("p", p)
|
.params("p", p)
|
||||||
.execute(callback);
|
.execute(callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid,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("page",page)
|
||||||
|
.execute(callback);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.yunbao.common.views;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.makeramen.roundedimageview.RoundedImageView;
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.bean.playerObject;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
|
||||||
|
public class AvatarListViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private RoundedImageView mAvatar;
|
||||||
|
|
||||||
|
public AvatarListViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
mAvatar = itemView.findViewById(R.id.avatar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(playerObject model) {
|
||||||
|
ImgLoader.display(itemView.getContext(), model.getAvatar(), mAvatar);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
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.makeramen.roundedimageview.RoundedImageView;
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.bean.SudRoomListModel;
|
||||||
|
import com.yunbao.common.bean.playerObject;
|
||||||
|
import com.yunbao.common.event.SudRoomListModelEvent;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.utils.Bus;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
|
|
||||||
|
public class SudGameListViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private RoundedImageView mAvatar;
|
||||||
|
private TextView roomName, playerWeAre, playerWeAre2, goldenBeanNumber;
|
||||||
|
private RoundedImageView avatarList1, avatarList2, avatarList3, avatarList4, avatarList5;
|
||||||
|
private GifImageView gifImageView;
|
||||||
|
private ImageView sex;
|
||||||
|
|
||||||
|
public SudGameListViewHolder(@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);
|
||||||
|
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);
|
||||||
|
sex = itemView.findViewById(R.id.sex);
|
||||||
|
avatarList1.setVisibility(View.GONE);
|
||||||
|
avatarList2.setVisibility(View.GONE);
|
||||||
|
avatarList3.setVisibility(View.GONE);
|
||||||
|
avatarList4.setVisibility(View.GONE);
|
||||||
|
avatarList5.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(SudRoomListModel model) {
|
||||||
|
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), model.getPlayerTotal()));
|
||||||
|
playerWeAre2.setText(String.format(itemView.getContext().getString(R.string.interactive_game_player_we_are_2), model.getTotal()));
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
List<playerObject> playerObjects = model.getPlayerObjects();
|
||||||
|
for (int i = 0; i < playerObjects.size(); i++) {
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
avatarList1.setVisibility(View.VISIBLE);
|
||||||
|
ImgLoader.display(itemView.getContext(), playerObjects.get(i).getAvatar(), avatarList1);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
avatarList2.setVisibility(View.VISIBLE);
|
||||||
|
ImgLoader.display(itemView.getContext(), playerObjects.get(i).getAvatar(), avatarList2);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
avatarList3.setVisibility(View.VISIBLE);
|
||||||
|
ImgLoader.display(itemView.getContext(), playerObjects.get(i).getAvatar(), avatarList3);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
avatarList4.setVisibility(View.VISIBLE);
|
||||||
|
ImgLoader.display(itemView.getContext(), playerObjects.get(i).getAvatar(), avatarList4);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
avatarList5.setVisibility(View.VISIBLE);
|
||||||
|
ImgLoader.display(itemView.getContext(), playerObjects.get(i).getAvatar(), avatarList5);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
Bus.get().post(new SudRoomListModelEvent().setModel(model));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
7
common/src/main/res/drawable/bg_live_sud_list_sill.xml
Normal file
7
common/src/main/res/drawable/bg_live_sud_list_sill.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="12dp"
|
||||||
|
android:topRightRadius="12dp" />
|
||||||
|
<solid android:color="#4A4A4A" />
|
||||||
|
</shape>
|
@ -91,6 +91,8 @@
|
|||||||
android:id="@+id/room_name"
|
android:id="@+id/room_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -166,9 +166,12 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<com.yunbao.common.custom.CommonRefreshView
|
||||||
|
android:id="@+id/refreshView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="174dp"
|
android:layout_width="174dp"
|
||||||
|
157
common/src/main/res/layout/item_sud_game_list.xml
Normal file
157
common/src/main/res/layout/item_sud_game_list.xml
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="88dp"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginTop="14dp"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
android:background="@mipmap/background_sud_game_list"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="55dp"
|
||||||
|
android:layout_height="55dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="17dp">
|
||||||
|
|
||||||
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
android:id="@+id/avatar"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:riv_oval="true" />
|
||||||
|
|
||||||
|
<pl.droidsonroids.gif.GifImageView
|
||||||
|
android:id="@+id/btn_live"
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="14dp"
|
||||||
|
android:layout_gravity="bottom|center_horizontal"
|
||||||
|
android:layout_marginEnd="3dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:src="@mipmap/icon_user_home_living"
|
||||||
|
android:visibility="visible" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sex"
|
||||||
|
android:layout_width="10dp"
|
||||||
|
android:layout_height="10dp"
|
||||||
|
android:layout_gravity="bottom|end" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/room_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:text="@string/interactive_game_create_room_name"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/player_we_are"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/interactive_game_player_we_are"
|
||||||
|
android:textColor="#80ffffff"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="79dp"
|
||||||
|
android:layout_height="20dp">
|
||||||
|
|
||||||
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
android:id="@+id/avatar_list1"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:riv_oval="true" />
|
||||||
|
|
||||||
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
android:id="@+id/avatar_list2"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_marginStart="-6dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:riv_oval="true" />
|
||||||
|
|
||||||
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
android:id="@+id/avatar_list3"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_marginStart="-6dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:riv_oval="true" />
|
||||||
|
|
||||||
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
android:id="@+id/avatar_list4"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_marginStart="-6dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:riv_oval="true" />
|
||||||
|
|
||||||
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
android:id="@+id/avatar_list5"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_marginStart="-6dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:riv_oval="true" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/avatar_list"
|
||||||
|
android:layout_width="76dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/player_we_are_2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/interactive_game_player_we_are_2"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="68dp"
|
||||||
|
android:layout_height="26dp"
|
||||||
|
android:background="@drawable/bg_live_sud_list_sill"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/golden_bean_number"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:text="1000"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="13dp"
|
||||||
|
android:layout_height="13dp"
|
||||||
|
android:layout_marginStart="2dp"
|
||||||
|
android:background="@mipmap/gold_coin" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
14
common/src/main/res/layout/view_sud_avatar_list_view.xml
Normal file
14
common/src/main/res/layout/view_sud_avatar_list_view.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
android:id="@+id/avatar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:riv_oval="true" />
|
||||||
|
</LinearLayout>
|
BIN
common/src/main/res/mipmap-xxhdpi/background_sud_game_list.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/background_sud_game_list.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_sex_man.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/icon_sex_man.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 291 B |
BIN
common/src/main/res/mipmap-xxhdpi/icon_sex_woman.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/icon_sex_woman.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 238 B |
@ -1342,4 +1342,6 @@ Limited ride And limited avatar frame</string>
|
|||||||
<string name="interactive_game_create_2_5">2K-5K金豆</string>
|
<string name="interactive_game_create_2_5">2K-5K金豆</string>
|
||||||
<string name="interactive_game_create_5">5K以上金豆</string>
|
<string name="interactive_game_create_5">5K以上金豆</string>
|
||||||
<string name="interactive_game_player">玩家</string>
|
<string name="interactive_game_player">玩家</string>
|
||||||
|
<string name="interactive_game_player_we_are">%s人組隊中,一起來玩吧</string>
|
||||||
|
<string name="interactive_game_player_we_are_2">%s人在綫</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user