密码房部分,幸运抽奖部分。
This commit is contained in:
@@ -249,6 +249,13 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
|
||||
var isBackPrivate = false //是否主动返回小黑屋
|
||||
|
||||
/**
|
||||
* 1:踩头条
|
||||
* 2:小时榜
|
||||
* 3:MQTT
|
||||
*/
|
||||
private var skipRoomType = -1
|
||||
|
||||
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_DOWN) {
|
||||
// 拦截返回键,显示退出对话框而不是直接退出
|
||||
@@ -1660,6 +1667,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
// }
|
||||
|
||||
AgoraManager.getInstance().lastRoomId = roomId
|
||||
skipRoomType = -1
|
||||
//进入小黑屋无所谓
|
||||
MvpPre?.getRoomIn(messageEvent.text.room_id, "")
|
||||
MessageExListenerSingleton.getInstance().joinGroup(messageEvent.text.room_id)
|
||||
if (publicScreenFragment != null) {
|
||||
@@ -2446,6 +2455,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
MessageListenerSingleton.quitGroup(pendingRoomId)
|
||||
MessageListenerSingleton.getInstance().joinGroup(pendingRoomId)
|
||||
AgoraManager.getInstance().lastRoomId = roomId
|
||||
skipRoomType = -1
|
||||
//交友房卡关系完成进入小黑屋
|
||||
MvpPre!!.getRoomIn(pendingRoomId, "")
|
||||
lastSwitchedRoomId = pendingRoomId!!
|
||||
|
||||
@@ -3053,8 +3064,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
fun setRoomTime(roomInfoResp: RoomInfoResp){
|
||||
this.mRoomInfoResp=roomInfoResp
|
||||
fun setRoomTime(roomInfoResp: RoomInfoResp) {
|
||||
this.mRoomInfoResp = roomInfoResp
|
||||
}
|
||||
|
||||
|
||||
@@ -3080,7 +3091,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
AgoraManager.getInstance().muteLocalAudioStream(false)
|
||||
AgoraManager.getInstance().ClientRole(true)
|
||||
CommonAppContext.getInstance().isMai = true
|
||||
var userId : String =""
|
||||
var userId: String = ""
|
||||
mRoomInfoResp?.room_info?.pit_list?.size?.let {
|
||||
if (it < 9) {
|
||||
return
|
||||
@@ -3353,6 +3364,22 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
setView(resp)
|
||||
}
|
||||
|
||||
override fun beforeJoinRoomCheck(isJoinRoom: Boolean, errorCode: Int, skipRoomId: String) {
|
||||
if (errorCode == 0) {
|
||||
MessageListenerSingleton.getInstance().joinGroup(roomId)
|
||||
initPublicScreenFragment()
|
||||
} else {
|
||||
if (isJoinRoom) {
|
||||
when (skipRoomType) {
|
||||
1,2,3 -> {
|
||||
roomId2 = skipRoomId
|
||||
getHour()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//隐藏视图
|
||||
private fun instView() {
|
||||
val countText = mRoomInfoResp?.room_info?.queue_number.toString()
|
||||
@@ -3414,8 +3441,10 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
// )
|
||||
// MessageListenerSingleton.getInstance()
|
||||
// .joinGroup(mRoomInfoResp?.room_info?.head_line?.room_id)
|
||||
roomId2 = mRoomInfoResp?.room_info?.head_line?.room_id
|
||||
getHour()
|
||||
// roomId2 = mRoomInfoResp?.room_info?.head_line?.room_id
|
||||
// getHour()
|
||||
skipRoomType = 1
|
||||
//踩头条加入房间
|
||||
MvpPre?.getRoomIn(mRoomInfoResp?.room_info?.head_line?.room_id, "")
|
||||
} else {
|
||||
com.blankj.utilcode.util.ToastUtils.showLong("您就在当前房间")
|
||||
@@ -3684,9 +3713,11 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
return
|
||||
}
|
||||
|
||||
roomId2 = event.room_id
|
||||
MessageListenerSingleton.getInstance().joinGroup(event.room_id)
|
||||
getHour()
|
||||
// roomId2 = event.room_id
|
||||
// MessageListenerSingleton.getInstance().joinGroup(event.room_id)
|
||||
// getHour()
|
||||
skipRoomType = 2
|
||||
//小时榜跳转房间
|
||||
MvpPre?.getRoomIn(event.room_id, "")
|
||||
}
|
||||
|
||||
@@ -3737,7 +3768,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
|
||||
ClickUtils.clearAllClickRecords()
|
||||
AgoraManager.getInstance().cleanup()
|
||||
roomId = roomId2
|
||||
// 重新连接房间相关服务
|
||||
resumeRoomState()
|
||||
publicScreenFragment?.onDestroy()
|
||||
@@ -3825,8 +3855,10 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
|
||||
fun refreshRoomInfo(roomId: String) {
|
||||
roomId2 = roomId
|
||||
getHour()
|
||||
// roomId2 = roomId
|
||||
// getHour()
|
||||
skipRoomType = 3
|
||||
//MQTT 进入房间
|
||||
MvpPre?.getRoomIn(roomId, "")
|
||||
}
|
||||
|
||||
@@ -3834,13 +3866,13 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
// 添加检查房间连接状态的方法
|
||||
private fun resumeRoomState() {
|
||||
// 恢复房间相关状态
|
||||
if (MvpPre != null && roomId != null) {
|
||||
if (MvpPre != null && roomId2 != null) {
|
||||
// MvpPre!!.postRoomInfo(roomId)
|
||||
}
|
||||
|
||||
// 重新连接房间相关服务
|
||||
if (MessageListenerSingleton.getInstance() != null) {
|
||||
MessageListenerSingleton.getInstance().joinGroup(roomId)
|
||||
MessageListenerSingleton.getInstance().joinGroup(roomId2)
|
||||
}
|
||||
|
||||
// 恢复音频状态
|
||||
@@ -3928,6 +3960,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
// 只有在没有房间信息时才重新获取
|
||||
if (mRoomInfoResp == null) {
|
||||
cleanupResources()
|
||||
skipRoomType = -1
|
||||
MvpPre!!.getRoomIn(roomId, password)
|
||||
}
|
||||
return
|
||||
@@ -4103,14 +4136,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
publicScreenFragment?.clearExMessageListener()
|
||||
publicScreenFragment?.setIsPriRoom(false, arrayListOf())
|
||||
}
|
||||
|
||||
// if (publicScreenFragment != null) {
|
||||
// publicScreenFragment!!.onFragmentShowDestroy()
|
||||
// publicScreenFragment = null
|
||||
// }
|
||||
|
||||
// MvpPre?.getRoomIn(AgoraManager.getInstance().lastRoomId, "")
|
||||
// AgoraManager.getInstance().lastRoomId = ""
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ public class RoomContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void roomInfo(RoomInfoResp resp);
|
||||
|
||||
void beforeJoinRoomCheck(Boolean isJoinRoom,int errorCode,String roomId);
|
||||
|
||||
void showPasswordDialog();
|
||||
|
||||
void enterFail();
|
||||
|
||||
@@ -661,6 +661,11 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
setRoomSeatViewType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeJoinRoomCheck(Boolean isJoinRoom, int errorCode, String roomId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPasswordDialog() {
|
||||
|
||||
|
||||
@@ -1005,6 +1005,11 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeJoinRoomCheck(Boolean isJoinRoom, int errorCode, String roomId) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void showPasswordDialog() {
|
||||
|
||||
@@ -129,7 +129,7 @@ public class HotListPresenter extends BasePresenter<HotListContacts.View> implem
|
||||
MvpRef.get().enterFail();
|
||||
}
|
||||
}
|
||||
});
|
||||
},null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,9 +4,15 @@ import static com.liulishuo.okdownload.OkDownloadProvider.context;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.blankj.utilcode.util.ActivityUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.xscm.modulemain.activity.main.activity.MainActivity;
|
||||
import com.xscm.modulemain.activity.room.contacts.RoomContacts;
|
||||
import com.xscm.modulemain.activity.user.activity.DailyTasksActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.MyRoomActivity;
|
||||
import com.xscm.modulemain.dialog.DialogEditRoomPwd;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.BeforeJoinRoomCheckBean;
|
||||
import com.xscm.moduleutil.bean.RedPacketConfig;
|
||||
@@ -20,6 +26,7 @@ import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.http.APIException;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
import com.xscm.moduleutil.listener.JoinRoomErrorListener;
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
@@ -34,11 +41,14 @@ import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class RoomPresenter extends BasePresenter<RoomContacts.View> implements RoomContacts.IRoomPre {
|
||||
RoomContacts.View mView;
|
||||
private Context mContext;
|
||||
public RoomPresenter(RoomContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView = view;
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
|
||||
// TODO: 2025/6/10 加入房间
|
||||
@Override
|
||||
public void getRoomIn(String roomId, String password) {
|
||||
@@ -50,16 +60,44 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
||||
|
||||
@Override
|
||||
public void onNext(BeforeJoinRoomCheckBean beforeJoinRoomCheckBean) {
|
||||
if (beforeJoinRoomCheckBean.getRoom_id() == null || beforeJoinRoomCheckBean.getRoom_id().equals("")) {
|
||||
joinRoom(roomId, password);
|
||||
}else {
|
||||
queren(beforeJoinRoomCheckBean.getRoom_id(), beforeJoinRoomCheckBean.getMsg());
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
|
||||
if(beforeJoinRoomCheckBean.getCode() == 101){
|
||||
new DialogEditRoomPwd(mContext).show(new DialogEditRoomPwd.OnDialogDismissListener() {
|
||||
@Override
|
||||
public void onDialogDismiss() {
|
||||
MvpRef.get().beforeJoinRoomCheck(false,-1,"");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPwdListener(@NonNull String pwd) {
|
||||
if (beforeJoinRoomCheckBean.getRoom_id() == null || beforeJoinRoomCheckBean.getRoom_id().equals("")) {
|
||||
joinRoom(roomId, pwd);
|
||||
}else {
|
||||
queren(beforeJoinRoomCheckBean.getRoom_id(), beforeJoinRoomCheckBean.getMsg());
|
||||
}
|
||||
}
|
||||
});
|
||||
}else {
|
||||
if (beforeJoinRoomCheckBean.getRoom_id() == null || beforeJoinRoomCheckBean.getRoom_id().equals("")) {
|
||||
joinRoom(roomId, password);
|
||||
}else {
|
||||
queren(beforeJoinRoomCheckBean.getRoom_id(), beforeJoinRoomCheckBean.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void joinRoom(String roomId, String password){
|
||||
if (MvpRef == null) {
|
||||
MvpRef = new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().beforeJoinRoomCheck(true,-1,roomId);
|
||||
|
||||
api.roomGetIn(roomId, password, new BaseObserver<RoomInfoResp>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
@@ -68,11 +106,9 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
||||
|
||||
@Override
|
||||
public void onNext(RoomInfoResp resp) {
|
||||
|
||||
if(!resp.getRoom_id().isEmpty()){
|
||||
queren(resp.getRoom_id(),resp.getMsg());
|
||||
}else {
|
||||
|
||||
if (!resp.getRoom_id().isEmpty()) {
|
||||
queren(resp.getRoom_id(), resp.getMsg());
|
||||
} else {
|
||||
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId();
|
||||
String token = resp.getUser_info().getAgora_token(); // 如果启用了鉴权才需要
|
||||
String roomId = resp.getRoom_info().getRoom_id(); // 房间 ID
|
||||
@@ -88,17 +124,16 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
||||
LogUtils.e("roomId:", roomId);
|
||||
AgoraManager.getInstance()
|
||||
.joinRoom(token, roomId, uid, enableMic, enableJs);
|
||||
if (MvpRef == null) {
|
||||
MvpRef = new WeakReference<>(mView);
|
||||
}
|
||||
|
||||
MvpRef.get().roomInfo(resp);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
if (MvpRef == null) {
|
||||
MvpRef = new WeakReference<>(mView);
|
||||
}
|
||||
if (e instanceof APIException) {
|
||||
APIException apiException = (APIException) e;
|
||||
@@ -111,6 +146,11 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
||||
MvpRef.get().enterFail();
|
||||
}
|
||||
}
|
||||
}, (errorCode, errorMsg) -> {
|
||||
if (MvpRef == null) {
|
||||
MvpRef = new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().beforeJoinRoomCheck(false,errorCode,"");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -126,6 +166,10 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
||||
getRoomIn(roomId,"");
|
||||
},
|
||||
v -> {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().beforeJoinRoomCheck(false,-1,"");
|
||||
// 点击“取消”按钮时什么都不做
|
||||
}, false, 0).show();
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ import android.text.TextWatcher;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.activity.OnBackPressedCallback;
|
||||
@@ -140,16 +142,16 @@ public class CreatedRoomActivity extends BaseMvpActivity<CreatedRoomPresenter, A
|
||||
|
||||
// roomInfoResp = (RoomInfoResp) getIntent().getSerializableExtra("roomInfo");
|
||||
|
||||
if (roomInfoResp!=null){
|
||||
if (roomInfoResp != null) {
|
||||
ImageUtils.loadHeadCC(roomInfoResp.getRoom_info().getRoom_cover(), mBinding.ivTrendContent);
|
||||
mBinding.edNickName.setText(roomInfoResp.getRoom_info().getRoom_name());
|
||||
mBinding.etG.setText(roomInfoResp.getRoom_info().getRoom_intro());
|
||||
roomUrl=roomInfoResp.getRoom_info().getRoom_cover();
|
||||
roomUrl = roomInfoResp.getRoom_info().getRoom_cover();
|
||||
mBinding.llSj.setVisibility(View.VISIBLE);
|
||||
mBinding.tvSj.setText(roomInfoResp.getRoom_info().getStart_time() + "-" + roomInfoResp.getRoom_info().getEnd_time());
|
||||
}else {
|
||||
if (handler!=null ){
|
||||
if (showPopupRunnable!=null){
|
||||
} else {
|
||||
if (handler != null) {
|
||||
if (showPopupRunnable != null) {
|
||||
handler.post(showPopupRunnable);
|
||||
}
|
||||
}
|
||||
@@ -209,13 +211,25 @@ public class CreatedRoomActivity extends BaseMvpActivity<CreatedRoomPresenter, A
|
||||
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvSave, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
||||
mBinding.tvSave.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
|
||||
mBinding.switchShowPwd.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
mBinding.etRoomPwd.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBinding.etRoomPwd.setVisibility(View.GONE);
|
||||
mBinding.etRoomPwd.setText("");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (handler!=null ) {
|
||||
if (showPopupRunnable!=null) {
|
||||
if (handler != null) {
|
||||
if (showPopupRunnable != null) {
|
||||
handler.removeCallbacks(showPopupRunnable);
|
||||
if (popupWindow != null) {
|
||||
popupWindow.dissmiss();
|
||||
@@ -247,9 +261,16 @@ public class CreatedRoomActivity extends BaseMvpActivity<CreatedRoomPresenter, A
|
||||
ToastUtils.show("请输入房间名");
|
||||
return;
|
||||
}
|
||||
if (roomInfoResp!=null){
|
||||
MvpPre.editRoom(roomInfoResp.getRoom_info().getRoom_id(), roomName, roomUrl,mBinding.etG.getText().toString(), "");
|
||||
}else {
|
||||
String roomPwd = mBinding.etRoomPwd.getText().toString().trim();
|
||||
if (mBinding.etRoomPwd.getVisibility() == View.VISIBLE) {
|
||||
if (TextUtils.isEmpty(roomPwd))
|
||||
ToastUtils.show("请输入密码");
|
||||
return;
|
||||
}
|
||||
|
||||
if (roomInfoResp != null) {
|
||||
MvpPre.editRoom(roomInfoResp.getRoom_info().getRoom_id(), roomName, roomUrl, mBinding.etG.getText().toString(), "");
|
||||
} else {
|
||||
MvpPre.checkTxt(roomName, roomUrl, mBinding.etG.getText().toString());
|
||||
}
|
||||
}
|
||||
@@ -350,7 +371,7 @@ public class CreatedRoomActivity extends BaseMvpActivity<CreatedRoomPresenter, A
|
||||
if (imgMedia.isCompressed()) {
|
||||
url = imgMedia.getCompressPath();
|
||||
} else {
|
||||
url = imgMedia.getRealPath();
|
||||
url = imgMedia.getCutPath();
|
||||
}
|
||||
MvpPre.uploadFile(new File(url), 0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.xscm.modulemain.dialog
|
||||
|
||||
import android.content.Context
|
||||
import android.view.Gravity
|
||||
import android.view.ViewGroup
|
||||
import com.blankj.utilcode.util.ScreenUtils
|
||||
import com.blankj.utilcode.util.ToastUtils
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.modulemain.databinding.DialogEditRoomPwdLayoutBinding
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog
|
||||
|
||||
class DialogEditRoomPwd(context: Context) : BaseDialog<DialogEditRoomPwdLayoutBinding>(context) {
|
||||
|
||||
init {
|
||||
// 设置对话框的宽度为屏幕宽度
|
||||
window?.setLayout(
|
||||
(ScreenUtils.getScreenWidth() * 315f / 375).toInt(),
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
setCancelable(false)
|
||||
setCanceledOnTouchOutside(false)
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.dialog_edit_room_pwd_layout
|
||||
}
|
||||
|
||||
private var onDialogDismissListener:OnDialogDismissListener? = null
|
||||
|
||||
override fun initView() {
|
||||
mBinding.ivClose.setOnClickListener {
|
||||
onDialogDismissListener?.onDialogDismiss()
|
||||
dismiss()
|
||||
}
|
||||
|
||||
mBinding.tvCancel.setOnClickListener {
|
||||
onDialogDismissListener?.onDialogDismiss()
|
||||
dismiss()
|
||||
}
|
||||
|
||||
mBinding.tvConfirm.setOnClickListener {
|
||||
if (mBinding.etRoomPwd.text.toString().trim()
|
||||
.isNotEmpty() && mBinding.etRoomPwd.text.toString().trim().length == 4
|
||||
) {
|
||||
onDialogDismissListener?.onPwdListener(mBinding.etRoomPwd.text.toString().trim())
|
||||
dismiss()
|
||||
} else {
|
||||
ToastUtils.showShort("请输入正确密码!")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
|
||||
}
|
||||
|
||||
fun show(onDialogDismissListener: OnDialogDismissListener) {
|
||||
super.show()
|
||||
this.onDialogDismissListener = onDialogDismissListener
|
||||
}
|
||||
|
||||
interface OnDialogDismissListener {
|
||||
fun onPwdListener(pwd: String)
|
||||
|
||||
fun onDialogDismiss()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.xscm.modulemain.dialog
|
||||
|
||||
import android.content.Context
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import com.blankj.utilcode.util.ToastUtils
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.opensource.svgaplayer.SVGACallback
|
||||
import com.opensource.svgaplayer.SVGAParser
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.modulemain.databinding.DialogLuckyDrawLayoutBinding
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog
|
||||
|
||||
class DialogLuckyDraw(context: Context) : BaseDialog<DialogLuckyDrawLayoutBinding>(context) {
|
||||
|
||||
init {
|
||||
window?.apply {
|
||||
setGravity(Gravity.BOTTOM)
|
||||
}
|
||||
|
||||
setCancelable(false)
|
||||
setCanceledOnTouchOutside(false)
|
||||
}
|
||||
|
||||
private var isLottery = false
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.dialog_lucky_draw_layout
|
||||
}
|
||||
|
||||
override fun initView() {
|
||||
mBinding.ivClose.setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
|
||||
mBinding.iv1.setOnClickListener {
|
||||
lottery(1)
|
||||
}
|
||||
|
||||
mBinding.iv10.setOnClickListener {
|
||||
lottery(10)
|
||||
}
|
||||
|
||||
mBinding.iv100.setOnClickListener {
|
||||
lottery(100)
|
||||
}
|
||||
mBinding.ivOnOrOff.tag = 1
|
||||
mBinding.ivOnOrOff.setOnClickListener {
|
||||
if (mBinding.ivOnOrOff.tag == 1) {
|
||||
mBinding.ivOnOrOff.tag = 0
|
||||
mBinding.ivOnOrOff.setImageResource(R.mipmap.icon_lucky_donghua_pre)
|
||||
} else {
|
||||
mBinding.ivOnOrOff.tag = 1
|
||||
mBinding.ivOnOrOff.setImageResource(R.mipmap.icon_lucky_donghua_nor)
|
||||
}
|
||||
}
|
||||
}
|
||||
//913073443 13837096053
|
||||
private fun lottery(count: Int) {
|
||||
if (isLottery) {
|
||||
ToastUtils.showShort("正在抽取中...")
|
||||
return
|
||||
}
|
||||
isLottery = true
|
||||
|
||||
if (mBinding.ivOnOrOff.tag == 1) {
|
||||
startAnim()
|
||||
}
|
||||
|
||||
fetchLotteryResult(count)
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private fun fetchLotteryResult(count: Int) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private fun showLotteryResult() {
|
||||
|
||||
}
|
||||
|
||||
private fun startAnim() {
|
||||
mBinding.svgaAnim.visibility = View.VISIBLE
|
||||
// 停止并清除当前动画
|
||||
mBinding.svgaAnim.stopAnimation()
|
||||
mBinding.svgaAnim.clear()
|
||||
// 使用SVGAParser重新解析
|
||||
val parser = SVGAParser(context)
|
||||
parser.decodeFromAssets("room_wish_crystal_animation.svga",
|
||||
object : SVGAParser.ParseCompletion {
|
||||
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||
mBinding.svgaAnim.setVideoItem(videoItem)
|
||||
mBinding.svgaAnim.clearsAfterStop = true
|
||||
|
||||
// 设置回调
|
||||
mBinding.svgaAnim.callback = object : SVGACallback {
|
||||
override fun onFinished() {
|
||||
isLottery = false
|
||||
mBinding.svgaAnim.visibility = View.GONE
|
||||
mBinding.ivSvgaBg.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun onPause() {}
|
||||
override fun onRepeat() {}
|
||||
override fun onStep(frame: Int, percentage: Double) {
|
||||
if (frame == 1) {
|
||||
mBinding.ivSvgaBg.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 开始动画
|
||||
mBinding.svgaAnim.startAnimation()
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
// 处理错误
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
class itemAdapter : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_lottery_gift_layout) {
|
||||
override fun convert(helper: BaseViewHolder, item: String) {
|
||||
helper.setText(R.id.tv_name, item)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -211,6 +211,11 @@ public class RoomOnlineDialogFragment extends BaseMvpDialogFragment<RoomPresente
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeJoinRoomCheck(Boolean isJoinRoom, int errorCode, String roomId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPasswordDialog() {
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.ActivityUtils;
|
||||
import com.blankj.utilcode.util.FragmentUtils;
|
||||
@@ -18,6 +20,7 @@ import com.xscm.modulemain.activity.main.activity.MainActivity;
|
||||
import com.xscm.modulemain.activity.room.activity.RoomActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.DailyTasksActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.MyRoomActivity;
|
||||
import com.xscm.modulemain.dialog.DialogEditRoomPwd;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.BeforeJoinRoomCheckBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
@@ -86,10 +89,34 @@ public class RoomManager {
|
||||
|
||||
@Override
|
||||
public void onNext(BeforeJoinRoomCheckBean beforeJoinRoomCheckBean) {
|
||||
if (beforeJoinRoomCheckBean.getRoom_id() == null || beforeJoinRoomCheckBean.getRoom_id().equals("")) {
|
||||
joinRoom(context, roomId, password, taskId);
|
||||
if(beforeJoinRoomCheckBean.getCode() == 101){
|
||||
new DialogEditRoomPwd(context).show(new DialogEditRoomPwd.OnDialogDismissListener() {
|
||||
@Override
|
||||
public void onDialogDismiss() {
|
||||
if (ActivityUtils.getTopActivity() instanceof MainActivity){
|
||||
((MainActivity) ActivityUtils.getTopActivity()).isShowLoading(false);
|
||||
}else if (ActivityUtils.getTopActivity() instanceof MyRoomActivity){
|
||||
((MyRoomActivity) ActivityUtils.getTopActivity()).isShowLoading(false);
|
||||
}else if (ActivityUtils.getTopActivity() instanceof DailyTasksActivity){
|
||||
((DailyTasksActivity) ActivityUtils.getTopActivity()).isShowLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPwdListener(@NonNull String pwd) {
|
||||
if (beforeJoinRoomCheckBean.getRoom_id() == null || beforeJoinRoomCheckBean.getRoom_id().equals("")) {
|
||||
joinRoom(context, roomId, pwd, taskId);
|
||||
}else {
|
||||
queren(beforeJoinRoomCheckBean.getRoom_id(), beforeJoinRoomCheckBean.getMsg());
|
||||
}
|
||||
}
|
||||
});
|
||||
}else {
|
||||
queren(beforeJoinRoomCheckBean.getRoom_id(), beforeJoinRoomCheckBean.getMsg());
|
||||
if (beforeJoinRoomCheckBean.getRoom_id() == null || beforeJoinRoomCheckBean.getRoom_id().equals("")) {
|
||||
joinRoom(context, roomId, password, taskId);
|
||||
}else {
|
||||
queren(beforeJoinRoomCheckBean.getRoom_id(), beforeJoinRoomCheckBean.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -221,7 +248,7 @@ public class RoomManager {
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
}
|
||||
});
|
||||
},null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user