cp空间刷新加载,roomA删除无用代码。
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
package com.xscm.modulemain
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
|
||||
class TransparentActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
@@ -233,9 +233,6 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
private var circularProgress: CircularProgressView? = null
|
||||
private var publicScreenFragment: ChatRoomFragment? = null // 添加成员变量
|
||||
|
||||
// 添加成员变量
|
||||
private var isLayoutAdjusted = false
|
||||
|
||||
// 存储当前显示的弹框引用
|
||||
private val activeDialogs: MutableList<DialogInterface> = ArrayList()
|
||||
private val activeDialogFragments: MutableList<Fragment> = ArrayList()
|
||||
@@ -244,6 +241,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
private var appStateListener: AppStateListener? = null
|
||||
|
||||
private var qxRedPacketManager: QXRedPacketManager? = null
|
||||
//用户列表用
|
||||
private var mOnlineBean: RoomOnline? = null
|
||||
|
||||
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_DOWN) {
|
||||
@@ -788,7 +787,10 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
// 调用退出房间方法
|
||||
MessageListenerSingleton.quitGroup(roomId);
|
||||
quit();
|
||||
if (mRoomInfoResp?.room_info?.label_id != null && mRoomInfoResp?.room_info?.label_id.equals("5")) {
|
||||
if (mRoomInfoResp?.room_info?.label_id != null && mRoomInfoResp?.room_info?.label_id.equals(
|
||||
"5"
|
||||
)
|
||||
) {
|
||||
jiaR()
|
||||
return
|
||||
} else {
|
||||
@@ -3820,85 +3822,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
super.onWindowFocusChanged(hasFocus)
|
||||
LogUtils.e("RoomActivity", "onWindowFocusChanged")
|
||||
if (hasFocus && !isLayoutAdjusted) {
|
||||
// adjustLayoutHeights()
|
||||
isLayoutAdjusted = true
|
||||
}
|
||||
}
|
||||
|
||||
var maxHeightDp: Int = 333
|
||||
|
||||
/**
|
||||
* 动态调整布局高度以适配不同设备
|
||||
*/
|
||||
private fun adjustLayoutHeights() {
|
||||
if (mBinding == null) return
|
||||
|
||||
try {
|
||||
// 获取主容器
|
||||
val mainContainer = mBinding!!.mainContentContainer
|
||||
val pager: View = mBinding!!.vpRoomPager
|
||||
val easeContainer: View = mBinding!!.easeContainer
|
||||
|
||||
if (mainContainer != null && pager != null && easeContainer != null) {
|
||||
// 强制测量主容器
|
||||
val widthSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
|
||||
val heightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
|
||||
mainContainer.measure(widthSpec, heightSpec)
|
||||
|
||||
var containerHeight = mainContainer.measuredHeight
|
||||
if (containerHeight <= 0) {
|
||||
// 如果测量不到高度,使用布局参数中的高度
|
||||
val containerParams =
|
||||
mainContainer.layoutParams as ConstraintLayout.LayoutParams
|
||||
containerHeight = (resources.displayMetrics.heightPixels
|
||||
- statusBarHeight
|
||||
- resources.getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_50) // room_top 高度
|
||||
- resources.getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15) * 3) // 底部控件高度
|
||||
}
|
||||
|
||||
// 确保最小高度
|
||||
if (containerHeight > 0) {
|
||||
// 设置 vp_room_pager 占用 70% 空间
|
||||
val pagerParams = pager.layoutParams as ConstraintLayout.LayoutParams
|
||||
pagerParams.height = SystemUtils.getWidth(maxHeightDp)
|
||||
pager.layoutParams = pagerParams
|
||||
|
||||
// 设置 ease_container 占用 30% 空间
|
||||
val easeParams = easeContainer.layoutParams as ConstraintLayout.LayoutParams
|
||||
easeParams.height = 0
|
||||
easeContainer.layoutParams = easeParams
|
||||
|
||||
// 请求重新布局
|
||||
mainContainer.requestLayout()
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
LogUtils.e("adjustLayoutHeights error: " + e.message)
|
||||
}
|
||||
}
|
||||
|
||||
private val statusBarHeight: Int
|
||||
/**
|
||||
* 获取状态栏高度
|
||||
*/
|
||||
get() {
|
||||
var result = 0
|
||||
val resourceId =
|
||||
resources.getIdentifier("status_bar_height", "dimen", "android")
|
||||
if (resourceId > 0) {
|
||||
result = resources.getDimensionPixelSize(resourceId)
|
||||
}
|
||||
return result
|
||||
}
|
||||
var mOnlineBean: RoomOnline? = null
|
||||
// TODO: 根据返回的在线列表获取对应的值,查看是否有在线用户
|
||||
// TODO: 根据返回的在线列表获取对应的值,查看是否有在线用户
|
||||
override fun getRoomOnline(onlineBean: RoomOnline?) {
|
||||
if (onlineBean != null) {
|
||||
mOnlineBean = onlineBean
|
||||
mOnlineBean = onlineBean
|
||||
val onlineBeans: MutableList<RoomOnlineBean> = ArrayList()
|
||||
if (onlineBean.on_pit.size > 0) {
|
||||
onlineBeans.addAll(onlineBean.on_pit)
|
||||
@@ -3924,7 +3853,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
supportFragmentManager: FragmentManager
|
||||
) {
|
||||
val fragment = RoomOnlineDialogFragment.show(
|
||||
roomId, pitNumber,mOnlineBean, mRoomUserBean, mRoomInfoResp,
|
||||
roomId, pitNumber, mOnlineBean, mRoomUserBean, mRoomInfoResp,
|
||||
supportFragmentManager
|
||||
)
|
||||
|
||||
|
||||
@@ -224,6 +224,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_experience_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:srlEnableLoadMore="true"
|
||||
app:srlEnableRefresh="true">
|
||||
|
||||
@@ -235,7 +236,6 @@
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:paddingHorizontal="@dimen/dp_16"
|
||||
android:paddingBottom="@dimen/dp_100"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:spanCount="1"
|
||||
tools:listitem="@layout/item_heart_cp_layout" />
|
||||
|
||||
Reference in New Issue
Block a user