添加接口
This commit is contained in:
@@ -13,7 +13,7 @@ class SignInfo : Serializable {
|
||||
// 倒计时 时间戳
|
||||
end_time;*/
|
||||
|
||||
var sign_id: Int = 0
|
||||
var sign_id: String = ""
|
||||
var sign_status: Int = 0
|
||||
var sign_day: Int = 0
|
||||
var current_body_value: Int = 0
|
||||
|
||||
@@ -870,6 +870,18 @@ public interface ApiServer {
|
||||
@POST(Constants.POST_FAMILY_EARNINGS)
|
||||
Call<BaseModel<List<FamilyEarnings>>> familyEarnings( @Field("user_id") String user_id,@Field("page") int page,@Field("start_time") String start_time,@Field("end_time") String end_time);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_SIGN_START)
|
||||
Call<BaseModel<String>> signStart(@Field("room_id") String room_id,@Field("user_id") String user_id);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_SIGN_END)
|
||||
Call<BaseModel<String>> signEnd(@Field("sign_id") String sign_id);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_SIGN_DELAY)
|
||||
Call<BaseModel<String>> signDelay(@Field("sign_id") String sign_id,@Field("room_id") String room_id);
|
||||
|
||||
@GET(Constants.GET_SKILL_LIST)
|
||||
Call<BaseModel<List<String>>> skillList();
|
||||
}
|
||||
|
||||
@@ -4693,5 +4693,50 @@ public class RetrofitClient {
|
||||
}
|
||||
});
|
||||
}
|
||||
public void signStart(String room_id, String user_id, BaseObserver<String> observer) {
|
||||
sApiServer.signStart(room_id, user_id).enqueue(new Callback<BaseModel<String>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
onNextRetu(response, observer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void signEnd(String sign_id, BaseObserver<String> observer) {
|
||||
sApiServer.signEnd(sign_id).enqueue(new Callback<BaseModel<String>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
onNextRetu(response, observer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void signDelay(String sign_id, String roomId, BaseObserver<String> observer) {
|
||||
sApiServer.signDelay(sign_id, roomId).enqueue(new Callback<BaseModel<String>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
onNextRetu(response, observer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -438,6 +438,10 @@ public class Constants {
|
||||
public static final String BIND_MOBILE = "/api/UserData/bind_mobile";//手机绑定
|
||||
|
||||
|
||||
public static final String POST_SIGN_START = "/api/Sign/start_sign";//签约开始
|
||||
public static final String POST_SIGN_END = "/api/Sign/end_sign";//签约结束
|
||||
public static final String POST_SIGN_DELAY = "/api/Sign/sign_delay";//签约延时
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,12 @@ class MentorShipContacts {
|
||||
interface Ipre : IPresenter{
|
||||
fun applyPit(roomId:String,pitNumber:String)
|
||||
|
||||
fun signStart(roomId:String,userId:String)
|
||||
|
||||
fun signEnd(signId:String)
|
||||
|
||||
fun signDelay(signId:String,roomId:String)
|
||||
|
||||
fun setMutePit(roomId:String,pitNumber:String,isMute:String)
|
||||
|
||||
fun setLockPit(roomId:String,pitNumber:String,isLock:String)
|
||||
|
||||
@@ -9,7 +9,6 @@ import android.widget.Switch
|
||||
import android.widget.TextView
|
||||
import com.blankj.utilcode.util.ActivityUtils
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.modulemain.activity.room.activity.RoomActivity
|
||||
import com.xscm.modulemain.activity.room.contacts.MentorShipContacts
|
||||
import com.xscm.modulemain.activity.room.presenter.MentorShipPresenter
|
||||
import com.xscm.modulemain.databinding.FragmentMentorShipBinding
|
||||
@@ -27,7 +26,8 @@ import com.xscm.moduleutil.utils.ClickUtils
|
||||
* 1234 5 9
|
||||
*/
|
||||
class RoomMentorShipFragment(var mRoomInfo: RoomInfoResp?) :
|
||||
BaseMvpFragment<MentorShipPresenter, FragmentMentorShipBinding>(), MentorShipContacts.View {
|
||||
BaseMvpFragment<MentorShipPresenter, FragmentMentorShipBinding>(), MentorShipContacts.View,
|
||||
View.OnClickListener {
|
||||
|
||||
companion object {
|
||||
@Volatile
|
||||
@@ -45,9 +45,9 @@ class RoomMentorShipFragment(var mRoomInfo: RoomInfoResp?) :
|
||||
private val indexList: MutableList<String> = mutableListOf("9", "1", "2", "3", "4", "5")
|
||||
private var popupWindow: PopupWindow? = null
|
||||
|
||||
private var pitBean: RoomPitBean? = null
|
||||
private var mPitBean: RoomPitBean? = null
|
||||
private var roomId: String = mRoomInfo?.room_info?.room_id!!
|
||||
|
||||
private var signPitBean: RoomPitBean? = null
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_mentor_ship
|
||||
@@ -73,11 +73,14 @@ class RoomMentorShipFragment(var mRoomInfo: RoomInfoResp?) :
|
||||
for ((idx, view) in viewList.withIndex()) {
|
||||
if (mRoomInfo?.room_info?.pit_list!!.size > indexList[idx].toInt() - 1) {
|
||||
view.setRoomWheatNumber(indexList[idx])
|
||||
val bean = mRoomInfo?.room_info?.pit_list!![indexList[idx].toInt() - 1]
|
||||
if (idx == 0) {
|
||||
view.setHostTv(mBinding.tvHostName)
|
||||
}else if (idx == 1){
|
||||
signPitBean = bean
|
||||
}
|
||||
view.isMentorShip(true)
|
||||
view.setData(mRoomInfo?.room_info?.pit_list!![indexList[idx].toInt() - 1])
|
||||
view.setData(bean)
|
||||
view.setOnClickListener { v ->
|
||||
if (ClickUtils.isFastDoubleClick(v)) {
|
||||
return@setOnClickListener
|
||||
@@ -96,7 +99,7 @@ class RoomMentorShipFragment(var mRoomInfo: RoomInfoResp?) :
|
||||
)
|
||||
} else {
|
||||
if (getHostUser() == 4) {
|
||||
MvpPre!!.applyPit(mRoomInfo?.room_info?.room_id!!, "")
|
||||
// MvpPre!!.applyPit(mRoomInfo?.room_info?.room_id!!, "")
|
||||
} else {
|
||||
when (indexList[idx]) {
|
||||
"9" -> {
|
||||
@@ -108,13 +111,13 @@ class RoomMentorShipFragment(var mRoomInfo: RoomInfoResp?) :
|
||||
}
|
||||
|
||||
"1", "3", "4", "5" -> {
|
||||
pitBean =
|
||||
mPitBean =
|
||||
mRoomInfo?.room_info?.pit_list!![indexList[idx].toInt() - 1]
|
||||
|
||||
// 处理抱麦逻辑
|
||||
RoomOnlineDialogFragment.show(
|
||||
roomId,
|
||||
pitBean?.pit_number,
|
||||
mPitBean?.pit_number,
|
||||
mRoomInfo?.user_info,
|
||||
mRoomInfo,
|
||||
childFragmentManager
|
||||
@@ -126,17 +129,47 @@ class RoomMentorShipFragment(var mRoomInfo: RoomInfoResp?) :
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mBinding.ivApplyForMai.setOnClickListener(this)
|
||||
mBinding.tvTimeLeft.setOnClickListener(this)
|
||||
mBinding.tvTimeRight.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
when (v?.id) {
|
||||
R.id.iv_apply_for_mai -> {
|
||||
MvpPre!!.applyPit(mRoomInfo?.room_info?.room_id!!, "")
|
||||
}
|
||||
|
||||
R.id.tv_time_left -> {
|
||||
if (mBinding.tvTimeLeft.text.toString() == "开始") {
|
||||
MvpPre.signStart(roomId,signPitBean?.user_id!!)
|
||||
} else {
|
||||
MvpPre.signDelay(mRoomInfo?.sign_info?.sign_id!!,roomId)
|
||||
}
|
||||
}
|
||||
|
||||
R.id.tv_time_right -> {
|
||||
MvpPre.signEnd(mRoomInfo?.sign_info?.sign_id!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showHostOrAboveBottomView(isSignUser:Boolean) {
|
||||
if (getHostUser() < 4) {
|
||||
mBinding.tvTimeLeft.visibility = View.VISIBLE
|
||||
mBinding.tvTimeLeft.text = "开始"
|
||||
mBinding.tvTime.text = "倒计时 00:00"
|
||||
} else {
|
||||
mBinding.tvHostName.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun roomInfoUpdate(mRoomInfoResp: RoomInfoResp) {
|
||||
mRoomInfo = mRoomInfoResp
|
||||
}
|
||||
|
||||
private fun setPitData() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
fun event1003(messageEvent: RoomMessageEvent) {
|
||||
val fromUserInfo = messageEvent.text.fromUserInfo ?: return
|
||||
|
||||
@@ -145,10 +178,14 @@ class RoomMentorShipFragment(var mRoomInfo: RoomInfoResp?) :
|
||||
|
||||
if (indexList.contains(pitNumber)) {
|
||||
val viewPos = indexList.indexOf(pitNumber)
|
||||
viewList[viewPos].setData(mRoomInfo?.room_info?.pit_list!![pitNumber.toInt() - 1])
|
||||
val pitBean = mRoomInfo?.room_info?.pit_list!![pitNumber.toInt() - 1]
|
||||
viewList[viewPos].setData(pitBean)
|
||||
if (pitNumber == "1") {
|
||||
showHostOrAboveBottomView(true)
|
||||
signPitBean = pitBean
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun event1004(messageEvent: RoomMessageEvent) {
|
||||
@@ -159,9 +196,13 @@ class RoomMentorShipFragment(var mRoomInfo: RoomInfoResp?) :
|
||||
|
||||
if (indexList.contains(pitNumber)) {
|
||||
val viewPos = indexList.indexOf(pitNumber)
|
||||
viewList[viewPos].setData(mRoomInfo?.room_info?.pit_list!![pitNumber.toInt() - 1])
|
||||
|
||||
val pitBean = mRoomInfo?.room_info?.pit_list!![pitNumber.toInt() - 1]
|
||||
viewList[viewPos].setData(pitBean)
|
||||
|
||||
if (pitNumber == "1") {
|
||||
showHostOrAboveBottomView(false)
|
||||
signPitBean = pitBean
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,13 +266,13 @@ class RoomMentorShipFragment(var mRoomInfo: RoomInfoResp?) :
|
||||
val switchCloseMic = popupView.findViewById<Switch>(R.id.sw_close_mic)
|
||||
val switchLockMic = popupView.findViewById<Switch>(R.id.sw_lock_mic)
|
||||
if (view != null) {
|
||||
switchCloseMic.isChecked = pitBean?.is_mute == 1 //是否禁麦
|
||||
switchLockMic.isChecked = pitBean?.is_lock == 1 //是否闭麦
|
||||
switchCloseMic.isChecked = mPitBean?.is_mute == 1 //是否禁麦
|
||||
switchLockMic.isChecked = mPitBean?.is_lock == 1 //是否闭麦
|
||||
}
|
||||
switchCloseMic.setOnCheckedChangeListener { compoundButton, b ->
|
||||
MvpPre.setMutePit(
|
||||
roomId,
|
||||
pitBean?.pit_number!!,
|
||||
mPitBean?.pit_number!!,
|
||||
if (b) "2" else "4"
|
||||
)
|
||||
}
|
||||
@@ -240,7 +281,7 @@ class RoomMentorShipFragment(var mRoomInfo: RoomInfoResp?) :
|
||||
switchLockMic.setOnCheckedChangeListener { compoundButton, b ->
|
||||
MvpPre.setLockPit(
|
||||
roomId,
|
||||
pitBean?.pit_number!!,
|
||||
mPitBean?.pit_number!!,
|
||||
if (b) "1" else "0"
|
||||
)
|
||||
}
|
||||
@@ -249,7 +290,7 @@ class RoomMentorShipFragment(var mRoomInfo: RoomInfoResp?) :
|
||||
tvHugMic.setOnClickListener { v: View? ->
|
||||
// 处理抱麦逻辑
|
||||
RoomOnlineDialogFragment.show(
|
||||
roomId, pitBean?.pit_number, mRoomInfo?.user_info, mRoomInfo,
|
||||
roomId, mPitBean?.pit_number, mRoomInfo?.user_info, mRoomInfo,
|
||||
childFragmentManager
|
||||
)
|
||||
popupWindow!!.dismiss()
|
||||
|
||||
@@ -24,6 +24,43 @@ class MentorShipPresenter(context: Context, val view: MentorShipContacts.View) :
|
||||
})
|
||||
}
|
||||
|
||||
override fun signStart(roomId: String, userId: String) {
|
||||
RetrofitClient.getInstance().signStart(roomId, userId, object : BaseObserver<String?>() {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
addDisposable(d)
|
||||
}
|
||||
|
||||
override fun onNext(s: String) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun signEnd(signId: String) {
|
||||
RetrofitClient.getInstance().signEnd(signId, object : BaseObserver<String?>() {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
addDisposable(d)
|
||||
}
|
||||
|
||||
override fun onNext(s: String) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun signDelay(signId: String, roomId: String) {
|
||||
RetrofitClient.getInstance().signDelay(signId, roomId, object : BaseObserver<String?>() {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
addDisposable(d)
|
||||
}
|
||||
|
||||
override fun onNext(s: String) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
override fun setMutePit(roomId: String, pitNumber: String, isMute: String) {
|
||||
RetrofitClient.getInstance()
|
||||
.setMutePit(roomId, pitNumber, isMute, object : BaseObserver<String?>() {
|
||||
|
||||
@@ -25,7 +25,7 @@ class RoomMentorShipWheatView : BaseWheatView {
|
||||
|
||||
|
||||
private var iv_tag_type: ImageView? = null
|
||||
private var hostTv:TextView? = null
|
||||
private var hostTv: TextView? = null
|
||||
|
||||
override fun initPit(context: Context, attrs: AttributeSet) {
|
||||
var typedArray: TypedArray? = null
|
||||
@@ -57,27 +57,42 @@ class RoomMentorShipWheatView : BaseWheatView {
|
||||
this.pitNumber = number
|
||||
}
|
||||
|
||||
fun setHostTv(hostTv:TextView){
|
||||
fun setHostTv(hostTv: TextView) {
|
||||
this.hostTv = hostTv
|
||||
}
|
||||
|
||||
public override fun setPitData(bean: RoomPitBean) {
|
||||
pitBean = bean // 统一使用参数 bean
|
||||
stopAndClearAnimation() // 清理之前的动画资源
|
||||
|
||||
if ((pitBean.pit_number == "9" || pitBean.pit_number == "1") && bean.user_id != "0") {
|
||||
mCharmView.visibility = VISIBLE
|
||||
if (pitBean.pit_number == "9") {
|
||||
mTvName.visibility = GONE
|
||||
hostTv?.visibility = VISIBLE
|
||||
hostTv?.text = bean.nickname
|
||||
mCharmView.setBg(0)
|
||||
when (bean.pit_number) {
|
||||
"9" -> {
|
||||
if (bean.user_id != "0") {
|
||||
mCharmView.visibility = VISIBLE
|
||||
mTvName.visibility = GONE
|
||||
hostTv?.visibility = VISIBLE
|
||||
hostTv?.text = bean.nickname
|
||||
} else {
|
||||
mTvName.visibility = VISIBLE
|
||||
mCharmView.visibility = INVISIBLE
|
||||
hostTv?.visibility = GONE
|
||||
}
|
||||
}
|
||||
|
||||
"1" -> {
|
||||
if (bean.user_id != "0") {
|
||||
mCharmView.visibility = VISIBLE
|
||||
} else {
|
||||
mCharmView.visibility = INVISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
mCharmView.visibility = GONE
|
||||
}
|
||||
}else{
|
||||
mTvName.visibility = VISIBLE
|
||||
mCharmView.visibility = INVISIBLE
|
||||
hostTv?.visibility = GONE
|
||||
}
|
||||
|
||||
|
||||
if (isOn) {
|
||||
handleOnState(bean)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user