diff --git a/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java index 7d8afc5ff..82bf6df02 100644 --- a/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java @@ -18,10 +18,12 @@ public class SudTitleSelectAdapter extends RecyclerView.Adapter { private List selectString = new ArrayList<>(); private int mIndex; + private int mType; - public SudTitleSelectAdapter(List selectString, int index) { + public SudTitleSelectAdapter(List selectString, int index, int type) { this.selectString = selectString; mIndex = index; + mType = type; } @NonNull @@ -39,6 +41,7 @@ public class SudTitleSelectAdapter extends RecyclerView.Adapter { public void onSudTitleSelectCallBack(int index) { if (sudTitleSelectCallBack != null) { sudTitleSelectCallBack.onSudTitleSelectCallBack(index); + } } }); diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java b/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java index 67ead1b0f..b72724037 100644 --- a/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java @@ -15,8 +15,10 @@ import com.lxj.xpopup.enums.PopupPosition; import com.yunbao.common.R; import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.SudRoomListModel; +import com.yunbao.common.event.RoomHolderTypeEvent; import com.yunbao.common.event.SudGameListDissMissEvent; import com.yunbao.common.event.SudGameListEvent; +import com.yunbao.common.event.SudGameListSillEvent; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.Bus; @@ -31,11 +33,12 @@ import java.util.List; public class SudGameListPopup extends BottomPopupView { private long interactionID = 0; private List customSidebarChildModels = new ArrayList<>(); - private ImageView roomGameArrow; + private ImageView roomGameArrow, roomSillArrow, houseOwnerArrow; - private TextView gameTitle; + private TextView gameTitle, sillTitle, houseOwnerTitle; private String id = "0", mLiveUid; private int page = 0; + private String mSill = "0,0", mSillName, roomHolderType = "0", roomHolderTypeName; public SudGameListPopup(@NonNull Context context, long interactionID, List child, String liveUid) { super(context); @@ -62,7 +65,7 @@ public class SudGameListPopup extends BottomPopupView { private void initDate() { LiveNetManager.get(getContext()) - .getRoomList(id, "0,0", "0", mLiveUid, page, new HttpCallback>() { + .getRoomList(id, mSill, roomHolderType, mLiveUid, page, new HttpCallback>() { @Override public void onSuccess(List data) { @@ -77,7 +80,11 @@ public class SudGameListPopup extends BottomPopupView { private void initView() { roomGameArrow = findViewById(R.id.room_game_arrow); + roomSillArrow = findViewById(R.id.room_sill_arrow); + houseOwnerArrow = findViewById(R.id.house_owner_arrow); gameTitle = findViewById(R.id.game_title); + sillTitle = findViewById(R.id.room_sill_text); + houseOwnerTitle = findViewById(R.id.house_owner_text); for (CustomSidebarChildModel model : customSidebarChildModels) { if (TextUtils.equals(String.valueOf(interactionID), model.getSrc())) { gameTitle.setText(model.getTitle().substring(0, 2)); @@ -101,6 +108,42 @@ public class SudGameListPopup extends BottomPopupView { .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(), 1, mSillName)) + .show(); + + + } + }); + 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(), 2, roomHolderTypeName)) + .show(); + + } }); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.interactive_game_add), new ViewClicksAntiShake.ViewClicksCallBack() { @@ -132,6 +175,40 @@ public class SudGameListPopup extends BottomPopupView { animator.setDuration(500); animator.setInterpolator(new LinearInterpolator()); animator.start(); + page=0; + initDate(); + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onSudGameListEvent(SudGameListSillEvent event) { + mSill = event.getSill(); + mSillName = event.getSillName(); + if (TextUtils.equals("0,0", mSill)) { + sillTitle.setText(mSillName); + } else { + sillTitle.setText(mSillName.substring(0, mSillName.length() - 2)); + } + + + ObjectAnimator animator = ObjectAnimator.ofFloat(roomSillArrow, "rotation", 90f, 0f); + animator.setDuration(500); + animator.setInterpolator(new LinearInterpolator()); + animator.start(); + page=0; + initDate(); + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onSudGameListEvent(RoomHolderTypeEvent event) { + roomHolderType = event.getRoomHolderType(); + roomHolderTypeName = event.getRoomHolderTypeName(); + houseOwnerTitle.setText(roomHolderTypeName); + ObjectAnimator animator = ObjectAnimator.ofFloat(houseOwnerArrow, "rotation", 90f, 0f); + animator.setDuration(500); + animator.setInterpolator(new LinearInterpolator()); + animator.start(); + page=0; + initDate(); } @Subscribe(threadMode = ThreadMode.MAIN) diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java b/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java index b269d0323..c61116fdb 100644 --- a/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java @@ -13,23 +13,29 @@ import com.yunbao.common.R; import com.yunbao.common.adapter.SudTitleSelectAdapter; import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.event.CreateSudGameEvent; +import com.yunbao.common.event.RoomHolderTypeEvent; import com.yunbao.common.event.SudGameListEvent; +import com.yunbao.common.event.SudGameListSillEvent; import com.yunbao.common.utils.Bus; import com.yunbao.common.views.weight.ViewClicksAntiShake; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class SudGameListSelectPopup extends AttachPopupView { private int mType; private List customSidebarChildModels = new ArrayList<>(); private List selectString = new ArrayList<>(); + private Map selectSill = new HashMap<>(); private TextView topSelect; private RecyclerView sudTitleSelect; private SudTitleSelectAdapter sudTitleSelectAdapter; private long interactionID = 0; + private String mSill; public SudGameListSelectPopup(@NonNull Context context, int type, List child, long interactionID) { super(context); @@ -38,6 +44,13 @@ public class SudGameListSelectPopup extends AttachPopupView { this.interactionID = interactionID; } + public SudGameListSelectPopup(@NonNull Context context, int mType, String sill) { + super(context); + this.mType = mType; + mSill = sill; + } + + protected int getImplLayoutId() { return R.layout.view_sud_game_slelect; } @@ -55,7 +68,7 @@ public class SudGameListSelectPopup extends AttachPopupView { index = i; } } - sudTitleSelectAdapter = new SudTitleSelectAdapter(selectString, index); + sudTitleSelectAdapter = new SudTitleSelectAdapter(selectString, index, mType); sudTitleSelect.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); sudTitleSelect.setAdapter(sudTitleSelectAdapter); if (interactionID == 0) { @@ -80,6 +93,62 @@ public class SudGameListSelectPopup extends AttachPopupView { .setTitle(customSidebarChildModels.get(index).getTitle())); } + dialog.dismiss(); + } + }); + } else if (mType == 1) { + selectString.add(getContext().getString(R.string.interactive_game_create_unlimited)); + selectString.add(getContext().getString(R.string.interactive_game_create_0_1)); + selectString.add(getContext().getString(R.string.interactive_game_create_1_2)); + selectString.add(getContext().getString(R.string.interactive_game_create_2_5)); + selectString.add(getContext().getString(R.string.interactive_game_create_5)); + selectSill.put(getContext().getString(R.string.interactive_game_create_unlimited), "0,0"); + selectSill.put(getContext().getString(R.string.interactive_game_create_0_1), "0,1"); + selectSill.put(getContext().getString(R.string.interactive_game_create_1_2), "1,2"); + selectSill.put(getContext().getString(R.string.interactive_game_create_2_5), "2,5"); + selectSill.put(getContext().getString(R.string.interactive_game_create_5), "5,0"); + 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 sillName = selectString.get(index); + String sill = selectSill.get(sillName); + Bus.get().post(new SudGameListSillEvent().setSill(sill).setSillName(sillName)); + dialog.dismiss(); + } + }); + } else if (mType == 2) { + selectString.add(getContext().getString(R.string.interactive_game_create_unlimited)); + selectString.add(getContext().getString(R.string.live_anchor)); + selectString.add(getContext().getString(R.string.interactive_game_player)); + selectSill.put(getContext().getString(R.string.interactive_game_create_unlimited), "0"); + selectSill.put(getContext().getString(R.string.live_anchor), "1"); + selectSill.put(getContext().getString(R.string.interactive_game_player), "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 RoomHolderTypeEvent().setRoomHolderType(roomHolderType).setRoomHolderTypeName(roomHolderTypeName)); dialog.dismiss(); } }); diff --git a/common/src/main/java/com/yunbao/common/event/RoomHolderTypeEvent.java b/common/src/main/java/com/yunbao/common/event/RoomHolderTypeEvent.java new file mode 100644 index 000000000..1b42752cd --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/RoomHolderTypeEvent.java @@ -0,0 +1,26 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +public class RoomHolderTypeEvent extends BaseModel { + private String roomHolderType; + private String roomHolderTypeName; + + public String getRoomHolderType() { + return roomHolderType; + } + + public RoomHolderTypeEvent setRoomHolderType(String roomHolderType) { + this.roomHolderType = roomHolderType; + return this; + } + + public String getRoomHolderTypeName() { + return roomHolderTypeName; + } + + public RoomHolderTypeEvent setRoomHolderTypeName(String roomHolderTypeName) { + this.roomHolderTypeName = roomHolderTypeName; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/SudGameListSillEvent.java b/common/src/main/java/com/yunbao/common/event/SudGameListSillEvent.java new file mode 100644 index 000000000..00be65be7 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/SudGameListSillEvent.java @@ -0,0 +1,26 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +public class SudGameListSillEvent extends BaseModel { + private String sillName; + private String sill; + + public String getSillName() { + return sillName; + } + + public SudGameListSillEvent setSillName(String sillName) { + this.sillName = sillName; + return this; + } + + public String getSill() { + return sill; + } + + public SudGameListSillEvent setSill(String sill) { + this.sill = sill; + return this; + } +} diff --git a/common/src/main/res/layout/dialog_sud_game_list.xml b/common/src/main/res/layout/dialog_sud_game_list.xml index 04041e402..4f11f6425 100644 --- a/common/src/main/res/layout/dialog_sud_game_list.xml +++ b/common/src/main/res/layout/dialog_sud_game_list.xml @@ -103,21 +103,24 @@ android:textSize="14sp" /> 游戲門檻: 請選擇游戲 請選擇金豆數量 + 不限 + 0K-1K金豆 + 1K-2K金豆 + 2K-5K金豆 + 5K以上金豆 + 玩家