跨房PK:发起PK相关页面
5
app/src/common/res/drawable/selector_room_pk_search.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_room_pk_search_checked" android:state_checked="true" />
|
||||
<item android:drawable="@drawable/ic_room_pk_search_unchecked" />
|
||||
</selector>
|
@@ -1242,8 +1242,15 @@
|
||||
<activity
|
||||
android:name=".module_hall.hall.activity.SuperAdminAddActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity android:name=".module_hall.hall.activity.SuperAdminRoomSetActivity" />
|
||||
|
||||
<activity android:name=".avroom.anotherroompk.RoomPKCreateActivity"
|
||||
android:theme="@style/dialog_web_view_activity"/>
|
||||
|
||||
<activity android:name=".avroom.anotherroompk.RoomPKSearchActivity"
|
||||
android:theme="@style/dialog_web_view_activity"/>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
@@ -0,0 +1,134 @@
|
||||
package com.yizhuan.erban.avroom.anotherroompk
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.text.Editable
|
||||
import android.view.Gravity
|
||||
import android.view.WindowManager
|
||||
import androidx.core.view.isVisible
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||
import com.yizhuan.erban.databinding.ActivityRoomPkCreateBinding
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||
import com.yizhuan.erban.ui.widget.TextWatcherSimple
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||
import com.yizhuan.xchat_android_core.room.anotherroompk.RoomPKModel
|
||||
import com.yizhuan.xchat_android_core.room.anotherroompk.SimpleRoomInfo
|
||||
import com.yizhuan.xchat_android_core.utils.ifNotNullOrEmpty
|
||||
import com.yizhuan.xchat_android_core.utils.toIntOrDef
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
|
||||
class RoomPKCreateActivity : BaseViewBindingActivity<ActivityRoomPkCreateBinding>() {
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun start(context: Context) {
|
||||
val starter = Intent(context, RoomPKCreateActivity::class.java)
|
||||
context.startActivity(starter)
|
||||
}
|
||||
}
|
||||
|
||||
private var currSimpleRoomInfo: SimpleRoomInfo? = null
|
||||
|
||||
private var pkTime: Int = 10
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun init() {
|
||||
//这里的height用MATCH_PARENT状态栏会被顶上去,不知道什么鬼
|
||||
window.setLayout(
|
||||
WindowManager.LayoutParams.MATCH_PARENT,
|
||||
ScreenUtil.screenHeight - ScreenUtil.getStatusBarHeight(context)
|
||||
)
|
||||
window.setGravity(Gravity.BOTTOM)
|
||||
binding.ivHelp.setOnClickListener {
|
||||
|
||||
}
|
||||
|
||||
binding.ivAddPkRoom.setOnClickListener {
|
||||
RoomPKSearchActivity.start(this)
|
||||
}
|
||||
binding.ivDelPkRoom.setOnClickListener {
|
||||
binding.ivAddPkRoom.isVisible = true
|
||||
binding.llPkRoom.isVisible = false
|
||||
currSimpleRoomInfo = null
|
||||
checkCommitEnable()
|
||||
}
|
||||
|
||||
binding.rg.setOnCheckedChangeListener { _, checkedId ->
|
||||
if (checkedId == -1) return@setOnCheckedChangeListener
|
||||
binding.editTime.setText("")
|
||||
pkTime = when (checkedId) {
|
||||
R.id.rb_min_10 -> 10
|
||||
R.id.rb_min_20 -> 20
|
||||
else -> 30
|
||||
}
|
||||
checkCommitEnable()
|
||||
}
|
||||
binding.editTime.addTextChangedListener(object : TextWatcherSimple() {
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
s?.toString().ifNotNullOrEmpty {
|
||||
pkTime = it.toIntOrDef(0)
|
||||
if (pkTime > 180) {
|
||||
binding.editTime.setText("180")
|
||||
}
|
||||
if (pkTime < 3) {
|
||||
binding.editTime.setText("3")
|
||||
}
|
||||
if (pkTime != 0) {
|
||||
binding.rg.clearCheck()
|
||||
}
|
||||
checkCommitEnable()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
binding.tvOk.setOnClickListener {
|
||||
if (!checkCommitEnable()) return@setOnClickListener
|
||||
currSimpleRoomInfo?.let {
|
||||
RoomPKModel.initiateRoomPK(
|
||||
it.roomUid,
|
||||
pkTime,
|
||||
AvRoomDataManager.get().roomUid,
|
||||
AuthModel.get().currentUid,
|
||||
binding.editDesc.text?.toString()
|
||||
)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(
|
||||
{
|
||||
"发起邀请成功!".toast()
|
||||
finish()
|
||||
}, { throwable ->
|
||||
throwable.message.toast()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (resultCode == RESULT_OK && requestCode == RoomPKSearchActivity.REQUEST_CODE) {
|
||||
(data?.getSerializableExtra(RoomPKSearchActivity.KEY_ROOM_INFO) as? SimpleRoomInfo)?.let {
|
||||
currSimpleRoomInfo = it
|
||||
binding.ivAddPkRoom.isVisible = false
|
||||
binding.llPkRoom.isVisible = true
|
||||
ImageLoadUtils.loadImage(this,it.avatar,binding.ivAvatar)
|
||||
binding.tvRoomTitle.text = it.title
|
||||
binding.tvRoomId.text = "音游号:${it.erbanNo}"
|
||||
checkCommitEnable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkCommitEnable(): Boolean {
|
||||
val isEnabled = currSimpleRoomInfo != null && pkTime != 0
|
||||
binding.tvOk.isEnabled = isEnabled
|
||||
return isEnabled
|
||||
}
|
||||
}
|
@@ -0,0 +1,116 @@
|
||||
package com.yizhuan.erban.avroom.anotherroompk
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.text.Editable
|
||||
import android.view.Gravity
|
||||
import android.view.WindowManager
|
||||
import android.widget.CheckBox
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||
import com.yizhuan.erban.common.EmptyViewHelper
|
||||
import com.yizhuan.erban.databinding.ActivityRoomPkSearchBinding
|
||||
import com.yizhuan.erban.ui.user.UserInfoActivity
|
||||
import com.yizhuan.erban.ui.utils.RVDelegate
|
||||
import com.yizhuan.erban.ui.widget.TextWatcherSimple
|
||||
import com.yizhuan.xchat_android_core.room.anotherroompk.RoomPKModel
|
||||
import com.yizhuan.xchat_android_core.room.anotherroompk.SimpleRoomInfo
|
||||
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo
|
||||
import com.yizhuan.xchat_android_core.utils.toast
|
||||
import kotlinx.android.synthetic.main.activity_give_gold_search.*
|
||||
|
||||
class RoomPKSearchActivity : BaseViewBindingActivity<ActivityRoomPkSearchBinding>() {
|
||||
|
||||
companion object {
|
||||
|
||||
const val REQUEST_CODE = 0xffaa
|
||||
const val KEY_ROOM_INFO = "SimpleRoomInfo"
|
||||
|
||||
@JvmStatic
|
||||
fun start(context: Activity) {
|
||||
val starter = Intent(context, RoomPKSearchActivity::class.java)
|
||||
context.startActivityForResult(starter, REQUEST_CODE)
|
||||
}
|
||||
}
|
||||
|
||||
private lateinit var rvDelegate: RVDelegate<SimpleRoomInfo>
|
||||
private var pageNum = 1
|
||||
private val pageSize = 20
|
||||
private val roomPKSearchAdapter = RoomPKSearchAdapter()
|
||||
private var searchKey: String? = null
|
||||
private var currRoomInfo: SimpleRoomInfo? = null
|
||||
override fun init() {
|
||||
|
||||
//这里的height用MATCH_PARENT状态栏会被顶上去,不知道什么鬼
|
||||
window.setLayout(
|
||||
WindowManager.LayoutParams.MATCH_PARENT,
|
||||
ScreenUtil.screenHeight - ScreenUtil.getStatusBarHeight(context)
|
||||
)
|
||||
window.setGravity(Gravity.BOTTOM)
|
||||
|
||||
rvDelegate = RVDelegate.Builder<SimpleRoomInfo>()
|
||||
.setPageSize(pageSize)
|
||||
.setEmptyView(EmptyViewHelper.createEmptyView(this, "暂无搜索内容"))
|
||||
.setLayoutManager(LinearLayoutManager(this))
|
||||
.setRecyclerView(binding.recyclerView)
|
||||
.setAdapter(roomPKSearchAdapter)
|
||||
.build()
|
||||
|
||||
roomPKSearchAdapter.setOnLoadMoreListener({ loadData(false) }, binding.recyclerView)
|
||||
|
||||
roomPKSearchAdapter.setOnItemChildClickListener { _, view, position ->
|
||||
roomPKSearchAdapter.getItem(position)?.let {
|
||||
when (view.id) {
|
||||
R.id.iv_avatar -> UserInfoActivity.Companion.start(this, it.roomUid)
|
||||
R.id.check_box -> {
|
||||
val isChecked = (view as CheckBox).isChecked
|
||||
roomPKSearchAdapter.data.forEach { roomInfo ->
|
||||
roomInfo.checked = it.roomUid == roomInfo.roomUid && isChecked
|
||||
}
|
||||
binding.tvOk.isEnabled = isChecked
|
||||
currRoomInfo = if (isChecked) it else null
|
||||
roomPKSearchAdapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binding.ivBack.setOnClickListener { finish() }
|
||||
binding.tvOk.setOnClickListener {
|
||||
if (currRoomInfo == null) {
|
||||
"请选择PK对象".toast()
|
||||
return@setOnClickListener
|
||||
}
|
||||
setResult(RESULT_OK, Intent().putExtra(KEY_ROOM_INFO, currRoomInfo))
|
||||
finish()
|
||||
}
|
||||
|
||||
|
||||
binding.editSearch.addTextChangedListener(object : TextWatcherSimple() {
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
searchKey = s?.toString()
|
||||
}
|
||||
})
|
||||
binding.ivSearch.setOnClickListener {
|
||||
loadData(true)
|
||||
}
|
||||
loadData(true)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun loadData(isRefresh: Boolean) {
|
||||
pageNum = if (isRefresh) 1 else pageNum + 1
|
||||
RoomPKModel.searchPermitRoom(searchKey, pageNum, pageSize)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe({
|
||||
rvDelegate.loadData(it, isRefresh)
|
||||
}, {
|
||||
rvDelegate.loadErr(isRefresh)
|
||||
})
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.yizhuan.erban.avroom.anotherroompk
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.BaseViewHolder
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils
|
||||
import com.yizhuan.xchat_android_core.room.anotherroompk.SimpleRoomInfo
|
||||
|
||||
class RoomPKSearchAdapter :
|
||||
BaseQuickAdapter<SimpleRoomInfo, BaseViewHolder>(R.layout.item_room_pk_search) {
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: SimpleRoomInfo) {
|
||||
helper.setText(R.id.tv_room_title,item.title)
|
||||
.setText(R.id.tv_room_id,"音游号${item.erbanNo}")
|
||||
.setChecked(R.id.check_box,item.checked)
|
||||
ImageLoadUtils.loadImage(mContext,item.avatar,helper.getView(R.id.iv_avatar))
|
||||
helper.addOnClickListener(R.id.iv_avatar,R.id.check_box)
|
||||
}
|
||||
}
|
@@ -86,6 +86,7 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
rvOPtList.setLayoutManager(new FullyGridLayoutManager(getContext(), 5));
|
||||
optAdapter = new OptAdapter(context, null);
|
||||
addPKAction(optAdapter);
|
||||
addRoomPKAction(optAdapter);
|
||||
addDatingAction(optAdapter);
|
||||
addRedPacketAction(optAdapter);
|
||||
addKTVAction(optAdapter);
|
||||
@@ -150,6 +151,34 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PK 模式
|
||||
*
|
||||
* @param optAdapter
|
||||
*/
|
||||
private void addRoomPKAction(OptAdapter optAdapter) {
|
||||
if (SuperAdminUtil.isSuperAdmin()) {
|
||||
return;
|
||||
}
|
||||
if (AvRoomDataManager.get().isManager() && !AvRoomDataManager.get().isCpRoom()) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) {
|
||||
return;
|
||||
}
|
||||
String str = "跨房PK";
|
||||
int icon = AvRoomDataManager.get().isOpenPKMode() ?
|
||||
R.drawable.ic_room_opt_op_pk :
|
||||
R.drawable.ic_room_opt_in_pk;
|
||||
optAdapter.addData(new OptAction(icon, str, () -> {
|
||||
if (onActionListener != null) {
|
||||
onActionListener.onRoomPKAction();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 相亲 模式
|
||||
*
|
||||
@@ -497,6 +526,8 @@ public class RoomOperationDialog extends BottomSheetDialog {
|
||||
|
||||
void onPKAction();
|
||||
|
||||
void onRoomPKAction();
|
||||
|
||||
void onDatingAction();
|
||||
|
||||
void onRedPackageAction();
|
||||
|
@@ -29,6 +29,7 @@ import androidx.viewpager.widget.ViewPager;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.coorchice.library.SuperTextView;
|
||||
import com.yizhuan.erban.avroom.anotherroompk.RoomPKCreateActivity;
|
||||
import com.yizhuan.erban.avroom.dialog.DatingVipRuleDialog;
|
||||
import com.yizhuan.erban.ui.webview.DatingRuleWebViewActivity;
|
||||
import com.yizhuan.erban.ui.webview.DialogWebViewActivity;
|
||||
@@ -2271,6 +2272,11 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
|
||||
CreatePKActivity.start(getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRoomPKAction() {
|
||||
RoomPKCreateActivity.start(getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDatingAction() {
|
||||
if (AvRoomDataManager.get().isOpenPKMode()) {
|
||||
|
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:color="@color/text_title_white" android:state_enabled="true" />
|
||||
|
||||
<item android:color="#FF7A7CA0" />
|
||||
|
||||
</selector>
|
BIN
app/src/main/res/drawable-xhdpi/bg_room_pk_search_edit.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_room_pk_add.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_room_pk_help.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_room_pk_search.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_room_pk_search_checked.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_room_pk_search_unchecked.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_room_pk_sub.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
6
app/src/main/res/drawable/bg_4c4c6a_r100.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="100dp" />
|
||||
<solid android:color="#4c4c6a" />
|
||||
</shape>
|
10
app/src/main/res/drawable/bg_room_pk_bottom.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="45"
|
||||
android:endColor="#002A2A39"
|
||||
android:startColor="#FF2A2A39"
|
||||
android:type="linear"
|
||||
android:useLevel="true" />
|
||||
|
||||
</shape>
|
6
app/src/main/res/drawable/bg_room_pk_common_btn.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#FF4C4C6A" />
|
||||
<corners android:radius="100dp" />
|
||||
</shape>
|
23
app/src/main/res/drawable/bg_room_pk_rb.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
|
||||
<item android:state_checked="true">
|
||||
<shape android:shape="rectangle">
|
||||
<gradient android:angle="180"
|
||||
android:endColor="#FFFF9813"
|
||||
android:startColor="#FFFFB22B"
|
||||
android:type="linear"
|
||||
android:useLevel="true" />
|
||||
<corners android:radius="100dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_checked="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#FF4C4C6A" />
|
||||
<corners android:radius="100dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
@@ -2,28 +2,27 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<gradient android:angle="180" android:endColor="#FFB22B" android:startColor="#FF9813" android:type="linear" android:useLevel="true" />
|
||||
<corners android:radius="100dp" />
|
||||
<gradient android:angle="180" android:endColor="#FF218EFF" android:startColor="#FF7727E4" android:type="linear" android:useLevel="true" /> <corners android:radius="100dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_focused="true">
|
||||
<shape android:shape="rectangle">
|
||||
<gradient android:angle="180" android:endColor="#FFB22B" android:startColor="#FF9813" android:type="linear" android:useLevel="true" />
|
||||
<gradient android:angle="180" android:endColor="#FF218EFF" android:startColor="#FF7727E4" android:type="linear" android:useLevel="true" />
|
||||
<corners android:radius="100dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_enabled="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#DBDBDB" />
|
||||
<solid android:color="#FF4C4C6A" />
|
||||
<corners android:radius="100dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient android:angle="180" android:endColor="#FFB22B" android:startColor="#FF9813" android:type="linear" android:useLevel="true" />
|
||||
<gradient android:angle="180" android:endColor="#FF218EFF" android:startColor="#FF7727E4" android:type="linear" android:useLevel="true" />
|
||||
<corners android:radius="100dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
255
app/src/main/res/layout/activity_room_pk_create.xml
Normal file
@@ -0,0 +1,255 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/bg_secondary_radius_top_15"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="跨房PK"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_help"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:src="@drawable/ic_room_pk_help"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_pk_object"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:text="选择PK对象"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_add_pk_room"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:src="@drawable/ic_room_pk_add"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_pk_object"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_pk_object"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_pk_object" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_pk_room"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_pk_object"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_pk_object"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_pk_object">
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:src="@drawable/default_avatar" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_room_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="14sp"
|
||||
tools:text="厅的名字000" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_room_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="14sp"
|
||||
tools:text="音游号:1234" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_del_pk_room"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:src="@drawable/ic_room_pk_sub" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_pk_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:text="选择PK时长"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_pk_object" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_pk_time"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_pk_time"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_pk_time">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_min_10"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_room_pk_rb"
|
||||
android:button="@null"
|
||||
android:checked="true"
|
||||
android:gravity="center"
|
||||
android:text="10分钟"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_min_20"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_room_pk_rb"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="20分钟"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_min_30"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_room_pk_rb"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:text="30分钟"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_time"
|
||||
android:layout_width="168dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/bg_room_pk_common_btn"
|
||||
android:hint="自定义(5-180)"
|
||||
android:inputType="number"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="50dp"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textColorHint="@color/white_transparent_50"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintStart_toStartOf="@id/rg"
|
||||
app:layout_constraintTop_toBottomOf="@id/rg" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="分钟"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/edit_time"
|
||||
app:layout_constraintEnd_toEndOf="@id/edit_time"
|
||||
app:layout_constraintTop_toTopOf="@id/edit_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_pk_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:text="PK玩法"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="@id/tv_pk_time"
|
||||
app:layout_constraintTop_toBottomOf="@id/edit_time" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_desc"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:background="@drawable/bg_room_pk_common_btn"
|
||||
android:hint="选填,10个字以内"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="50dp"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textColorHint="@color/white_transparent_50"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_pk_desc"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/edit_time"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_pk_desc" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ok"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginBottom="38dp"
|
||||
android:background="@drawable/common_btn_bg"
|
||||
android:enabled="false"
|
||||
android:gravity="center"
|
||||
android:text="发起挑战"
|
||||
android:textColor="@color/color_selector_white_false_7a7ca0"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_pk_desc" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
91
app/src/main/res/layout/activity_room_pk_search.xml
Normal file
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="405dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/bg_secondary_radius_top_15"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/arrow_left_white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_search"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:background="@drawable/bg_room_pk_search_edit"
|
||||
android:hint="请输入音游号"
|
||||
android:inputType="number"
|
||||
android:maxLength="10"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="50dp"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textColorHint="@color/white_transparent_40"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_back"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_search"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_room_pk_search"
|
||||
app:layout_constraintBottom_toBottomOf="@id/edit_search"
|
||||
app:layout_constraintEnd_toEndOf="@id/edit_search"
|
||||
app:layout_constraintTop_toTopOf="@id/edit_search" />
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="83dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/edit_search" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="83dp"
|
||||
android:background="@drawable/bg_room_pk_bottom"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ok"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginBottom="38dp"
|
||||
android:background="@drawable/common_btn_bg"
|
||||
android:enabled="false"
|
||||
android:gravity="center"
|
||||
android:text="发起挑战"
|
||||
android:textColor="@color/color_selector_white_false_7a7ca0"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
@@ -112,7 +112,7 @@
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:gravity="center_vertical"
|
||||
android:text="总价值xxx钻石"
|
||||
android:text="总价值0钻石"
|
||||
android:textColor="#7A7A7A"
|
||||
android:textSize="@dimen/dp_13"
|
||||
android:visibility="gone" />
|
||||
|
52
app/src/main/res/layout/item_room_pk_search.xml
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:src="@drawable/default_avatar" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_room_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="14sp"
|
||||
tools:text="厅的名字000" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_room_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textSize="14sp"
|
||||
tools:text="音游号:1234" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_box"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:button="@drawable/selector_room_pk_search" />
|
||||
|
||||
</LinearLayout>
|
@@ -393,6 +393,10 @@ public class CustomAttachment implements MsgAttachment {
|
||||
public static final int CUSTOM_MSG_CHAT_HINT = 75;
|
||||
public static final int CUSTOM_MSG_SUB_CHAT_HINT = 751;
|
||||
|
||||
//私聊提示
|
||||
public static final int CUSTOM_MSG_ROOM_PK = 83;
|
||||
public static final int CUSTOM_MSG_SUB_ROOM_PK_INVITE = 831;
|
||||
|
||||
public CustomAttachment() {
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,123 @@
|
||||
package com.yizhuan.xchat_android_core.room.anotherroompk
|
||||
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet
|
||||
import io.reactivex.Single
|
||||
import lombok.Getter
|
||||
import retrofit2.http.*
|
||||
|
||||
object RoomPKModel {
|
||||
private val api: Api
|
||||
|
||||
init {
|
||||
api = RxNet.create(Api::class.java)
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起挑战
|
||||
*
|
||||
* @param acceptUid 必传:接受方房主uid
|
||||
* @param duration 时长:分钟
|
||||
* @param inviteUid 必传:发起方房主uid
|
||||
* @param operateUid 操作人uid
|
||||
* @param playDesc 玩法
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
fun initiateRoomPK(
|
||||
acceptUid: Long,
|
||||
duration: Int,
|
||||
inviteUid: Long,
|
||||
operateUid: Long,
|
||||
playDesc: String?
|
||||
): Single<String> {
|
||||
return api.initiateRoomPK(acceptUid, duration, inviteUid, operateUid, playDesc)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.compose(RxHelper.handleStringData())
|
||||
}
|
||||
|
||||
/**
|
||||
* 接受/拒绝挑战
|
||||
*
|
||||
* @param isAccept true 接受PK
|
||||
* @param roomUid roomUid
|
||||
* @param roundId roundId
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
fun acceptRoomPK(
|
||||
isAccept: Boolean,
|
||||
roomUid: Long,
|
||||
roundId: Long
|
||||
): Single<String> {
|
||||
return api.acceptRoomPK(isAccept, roomUid, roundId)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.compose(RxHelper.handleStringData())
|
||||
}
|
||||
|
||||
/**
|
||||
* 跨房pk/牌照房搜索
|
||||
*
|
||||
* @param erbanNo erbanNo,空则获取全部牌照房
|
||||
* @param pageNum pageNum
|
||||
* @param pageSize pageSize
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
fun searchPermitRoom(
|
||||
erbanNo: String?,
|
||||
pageNum: Int,
|
||||
pageSize: Int
|
||||
): Single<List<SimpleRoomInfo>> {
|
||||
return api.searchPermitRoom(erbanNo, pageNum, pageSize)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
}
|
||||
|
||||
private interface Api {
|
||||
/**
|
||||
* 发起挑战
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/crossroompkround/initiateChallenge")
|
||||
fun initiateRoomPK(
|
||||
@Field("acceptUid") acceptUid: Long,
|
||||
@Field("duration") duration: Int,
|
||||
@Field("inviteUid") inviteUid: Long,
|
||||
@Field("operateUid") operateUid: Long,
|
||||
@Field("playDesc") playDesc: String?
|
||||
): Single<ServiceResult<String>>
|
||||
|
||||
/**
|
||||
* 接受/拒绝挑战
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/crossroompkround/initiateChallenge")
|
||||
fun acceptRoomPK(
|
||||
@Field("isAccept") isAccept: Boolean,
|
||||
@Field("roomUid") roomUid: Long,
|
||||
@Field("roundId") roundId: Long
|
||||
): Single<ServiceResult<String>>
|
||||
|
||||
/**
|
||||
*
|
||||
* 跨房pk/牌照房搜索
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/search/permitRoom")
|
||||
fun searchPermitRoom(
|
||||
@Query("erbanNo") erbanNo: String?,
|
||||
@Query("pageNum") pageNum: Int,
|
||||
@Query("pageSize") pageSize: Int
|
||||
): Single<ServiceResult<List<SimpleRoomInfo>>>
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.yizhuan.xchat_android_core.room.anotherroompk
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
data class SimpleRoomInfo(
|
||||
val title: String? = null,
|
||||
val roomUid :Long = 0L,
|
||||
val erbanNo :Long = 0L,
|
||||
val avatar :String? = null,
|
||||
var checked :Boolean = false
|
||||
) : Serializable
|
@@ -21,4 +21,10 @@ fun String?.toast() {
|
||||
}
|
||||
|
||||
inline fun String?.ifNullOrEmpty(defaultValue: () -> String): String =
|
||||
if (this.isNullOrEmpty()) defaultValue() else this
|
||||
if (this.isNullOrEmpty()) defaultValue() else this
|
||||
|
||||
inline fun String?.ifNotNullOrEmpty(block: (String) -> Unit) {
|
||||
if (!this.isNullOrEmpty()) {
|
||||
block(this)
|
||||
}
|
||||
}
|
||||
|