排麦模式增加GroupType参数
This commit is contained in:
@@ -3,10 +3,12 @@ package com.yizhuan.erban.avroom.dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.SpannableStringBuilder;
|
||||
@@ -35,6 +37,7 @@ import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg;
|
||||
import com.yizhuan.xchat_android_core.room.model.HomePartyModel;
|
||||
import com.yizhuan.xchat_android_core.room.model.MicQueueModel;
|
||||
import com.yizhuan.xchat_android_core.room.queuing_mic.bean.GroupType;
|
||||
import com.yizhuan.xchat_android_core.room.queuing_mic.bean.QueuingMicMemeberInfo;
|
||||
import com.yizhuan.xchat_android_core.room.queuing_mic.bean.RespQueuingMicListInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.BaseInfo;
|
||||
@@ -84,6 +87,13 @@ public class MicQueueDialog extends BaseDialog implements
|
||||
FrameLayout flBottomButton;
|
||||
@BindView(R.id.fl_main_content)
|
||||
FrameLayout flMainContent;
|
||||
@BindView(R.id.ll_join_queue)
|
||||
View llJoinQueue;
|
||||
@BindView(R.id.tv_join_male)
|
||||
TextView tvJoinMale;
|
||||
@BindView(R.id.tv_join_female)
|
||||
TextView tvJoinFemale;
|
||||
|
||||
private LoadPageDataHelper<List<QueuingMicMemeberInfo>> loadPageDataHelper;
|
||||
private boolean noMoreData = false;
|
||||
private MicQueueAdapter adapter;
|
||||
@@ -171,7 +181,9 @@ public class MicQueueDialog extends BaseDialog implements
|
||||
refreshData();
|
||||
}
|
||||
|
||||
/**抱TA上麦*/
|
||||
/**
|
||||
* 抱TA上麦
|
||||
*/
|
||||
private void inviteToMic(QueuingMicMemeberInfo member, int itemPos) {
|
||||
int micPosition = -1;
|
||||
for (int i = 0; i < AvRoomDataManager.get().mMicQueueMemberMap.size(); i++) {
|
||||
@@ -232,11 +244,13 @@ public class MicQueueDialog extends BaseDialog implements
|
||||
}
|
||||
|
||||
|
||||
/**将队列减一*/
|
||||
/**
|
||||
* 将队列减一
|
||||
*/
|
||||
private void reduceQueueInfo() {
|
||||
if (queueMicListInfo != null) {
|
||||
int count = queueMicListInfo.getCount();
|
||||
count --;
|
||||
count--;
|
||||
if (count < 0) {
|
||||
count = 0;
|
||||
}
|
||||
@@ -502,24 +516,31 @@ public class MicQueueDialog extends BaseDialog implements
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.tv_apply_mic_queue)
|
||||
public void onViewClicked() {
|
||||
@OnClick({R.id.tv_apply_mic_queue, R.id.tv_join_male, R.id.tv_join_female})
|
||||
public void onViewClicked(View view) {
|
||||
if (queueMicListInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
//报名排麦
|
||||
if (AvRoomDataManager.get().isManager()) {
|
||||
if (actionListener != null) {
|
||||
actionListener.onShareRoom(MicQueueDialog.this);
|
||||
}
|
||||
} else {
|
||||
int groupType = 0;
|
||||
if (view.getId() == R.id.tv_join_male) {
|
||||
groupType = GroupType.MALE;
|
||||
} else if (view.getId() == R.id.tv_join_female) {
|
||||
groupType = GroupType.FEMALE;
|
||||
}
|
||||
if (actionListener != null) {
|
||||
if (queueMicListInfo.getMyPos() < 0) {
|
||||
if (!AvRoomDataManager.get().isQueuingMicro()) {
|
||||
toast("排麦模式已关闭");
|
||||
return;
|
||||
}
|
||||
actionListener.onApplyMicQueue(MicQueueDialog.this);
|
||||
actionListener.onApplyMicQueue(MicQueueDialog.this, groupType);
|
||||
} else {
|
||||
actionListener.onCancelMicQueue(MicQueueDialog.this);
|
||||
}
|
||||
@@ -534,7 +555,7 @@ public class MicQueueDialog extends BaseDialog implements
|
||||
public interface OnActionListener {
|
||||
void onShareRoom(MicQueueDialog micQueueDialog);
|
||||
|
||||
void onApplyMicQueue(MicQueueDialog micQueueDialog);
|
||||
void onApplyMicQueue(MicQueueDialog micQueueDialog, int groupType);
|
||||
|
||||
void onCancelMicQueue(MicQueueDialog micQueueDialog);
|
||||
}
|
||||
@@ -543,7 +564,4 @@ public class MicQueueDialog extends BaseDialog implements
|
||||
this.actionListener = actionListener;
|
||||
}
|
||||
|
||||
private void onReceiveRoomEvent(RoomEvent roomEvent) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -174,7 +174,7 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
return;
|
||||
}
|
||||
String str = AvRoomDataManager.get().isDatingMode() ? "相亲中..." :"相亲模式";
|
||||
int icon = AvRoomDataManager.get().isOpenPKMode() ?
|
||||
int icon = AvRoomDataManager.get().isDatingMode() ?
|
||||
R.drawable.ic_room_opt_op_dating :
|
||||
R.drawable.ic_room_opt_in_dating;
|
||||
optAdapter.addData(new OptAction(icon, str, () -> {
|
||||
|
@@ -2347,15 +2347,16 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplyMicQueue(final MicQueueDialog micQueueDialog) {
|
||||
public void onApplyMicQueue(final MicQueueDialog micQueueDialog,int groupType) {
|
||||
long myUid = AuthModel.get().getCurrentUid();
|
||||
if (AvRoomDataManager.get().isOnMic(myUid)) {
|
||||
toast("已经在麦上不需要报名啦~");
|
||||
return;
|
||||
}
|
||||
//加入排队
|
||||
MicQueueModel.get().applyForQueuing(
|
||||
AvRoomDataManager.get().getRoomUid(), AuthModel.get().getCurrentUid()
|
||||
MicQueueModel.get().applyForQueuing(AvRoomDataManager.get().getRoomUid(),
|
||||
AuthModel.get().getCurrentUid(),
|
||||
groupType
|
||||
)
|
||||
.subscribe(new SingleObserver<RespQueuingMicListInfo>() {
|
||||
@Override
|
||||
|
8
app/src/main/res/drawable/shape_518eff_20dp_round.xml
Normal file
8
app/src/main/res/drawable/shape_518eff_20dp_round.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#518EFF" />
|
||||
|
||||
<corners android:radius="20dp" />
|
||||
</shape>
|
8
app/src/main/res/drawable/shape_ff6b77_20dp_round.xml
Normal file
8
app/src/main/res/drawable/shape_ff6b77_20dp_round.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#FF6B77" />
|
||||
|
||||
<corners android:radius="20dp" />
|
||||
</shape>
|
@@ -99,9 +99,48 @@
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/shape_appcolor_corner"
|
||||
tools:text="@string/apply_mic_queue" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_join_queue"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_join_male"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="14sp"
|
||||
android:background="@drawable/shape_518eff_20dp_round"
|
||||
android:text="报名男神" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_join_female"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="14sp"
|
||||
android:background="@drawable/shape_ff6b77_20dp_round"
|
||||
android:text="报名女神" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
|
@@ -1600,6 +1600,7 @@ public final class IMNetEaseManager {
|
||||
// 1----房间信息更新 2-----麦序信息更新
|
||||
// 3----更新房间信息和麦序信息(排麦模式)
|
||||
int type = (int) extension.get("type");
|
||||
LogUtil.print("chatRoomInfoUpdate type =" + type);
|
||||
if (type == 2) {
|
||||
roomQueueMicUpdate(extension);
|
||||
} else if (type == 1) {
|
||||
@@ -1620,6 +1621,7 @@ public final class IMNetEaseManager {
|
||||
private void roomInfoUpdate(Map<String, Object> extension) {
|
||||
String roomInfoStr = (String) extension.get("roomInfo");
|
||||
if (!TextUtils.isEmpty(roomInfoStr)) {
|
||||
LogUtil.print(roomInfoStr);
|
||||
RoomInfo roomInfo = gson.fromJson(roomInfoStr, RoomInfo.class);
|
||||
if (roomInfo != null) {
|
||||
AvRoomDataManager.get().mCurrentRoomInfo = roomInfo;
|
||||
|
@@ -833,8 +833,7 @@ public final class AvRoomDataManager {
|
||||
* @return
|
||||
*/
|
||||
public boolean isQueuingMicro() {
|
||||
if (mCurrentRoomInfo == null) return false;
|
||||
return mCurrentRoomInfo.getRoomModeType() == RoomModeType.OPEN_MICRO_MODE;
|
||||
return isRoomInQueuingMicMode(mCurrentRoomInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -844,7 +843,8 @@ public final class AvRoomDataManager {
|
||||
*/
|
||||
public boolean isRoomInQueuingMicMode(RoomInfo roomInfo) {
|
||||
if (roomInfo == null) return false;
|
||||
return roomInfo.getRoomModeType() == RoomModeType.OPEN_MICRO_MODE;
|
||||
return roomInfo.getRoomModeType() == RoomModeType.OPEN_MICRO_MODE
|
||||
||roomInfo.getRoomModeType() == RoomModeType.OPEN_DATING_MODE;
|
||||
}
|
||||
|
||||
public void addManagerMember(ChatRoomMember member) {
|
||||
|
@@ -116,8 +116,8 @@ public class MicQueueModel extends BaseModel implements IMicQueueModel {
|
||||
* @return 新的排麦列表
|
||||
*/
|
||||
@Override
|
||||
public Single<RespQueuingMicListInfo> applyForQueuing(long roomUid, long openUid) {
|
||||
return api.applyForQueuing(roomUid, openUid)
|
||||
public Single<RespQueuingMicListInfo> applyForQueuing(long roomUid, long openUid,int groupType) {
|
||||
return api.applyForQueuing(roomUid, openUid,groupType)
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
@@ -192,12 +192,14 @@ public class MicQueueModel extends BaseModel implements IMicQueueModel {
|
||||
*
|
||||
* @param roomUid 房间 UID
|
||||
* @param operUid 操作者的 UID (房主 or 管理员)
|
||||
* @param groupType 报名的分组类型
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/room/queue")
|
||||
Single<ServiceResult<RespQueuingMicListInfo>> applyForQueuing(@Field("roomUid") long roomUid,
|
||||
@Field("operUid") long operUid);
|
||||
@Field("operUid") long operUid,
|
||||
@Field("groupType") int groupType);
|
||||
|
||||
/**
|
||||
* 取消报名排麦
|
||||
|
@@ -38,7 +38,7 @@ public interface IMicQueueModel {
|
||||
* @param openUid 报名者uid
|
||||
* @return 新的排麦列表
|
||||
*/
|
||||
Single<RespQueuingMicListInfo> applyForQueuing(long roomUid, long openUid);
|
||||
Single<RespQueuingMicListInfo> applyForQueuing(long roomUid, long openUid,int groupType);
|
||||
|
||||
/**
|
||||
* 取消报名排麦
|
||||
|
@@ -0,0 +1,6 @@
|
||||
package com.yizhuan.xchat_android_core.room.queuing_mic.bean;
|
||||
|
||||
public interface GroupType {
|
||||
int MALE = 1;
|
||||
int FEMALE = 2;
|
||||
}
|
@@ -18,4 +18,9 @@ public class QueuingMicMemeberInfo {
|
||||
private String avatar;
|
||||
// 排麦用户性别
|
||||
private int gender;
|
||||
|
||||
/**
|
||||
* {@link GroupType}
|
||||
*/
|
||||
private int groupType;
|
||||
}
|
||||
|
Reference in New Issue
Block a user