修改BUG,修改页面适配问题
This commit is contained in:
@@ -20,6 +20,7 @@ import android.os.CountDownTimer;
|
||||
import android.os.Looper;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.Gravity;
|
||||
@@ -40,6 +41,7 @@ import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
@@ -186,7 +188,8 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
private SilentCountDownTimer silentCountDownTimer;
|
||||
private CircularProgressView circularProgress;
|
||||
private PublicScreenEaseChatFragment publicScreenFragment; // 添加成员变量
|
||||
|
||||
// 添加成员变量
|
||||
private boolean isLayoutAdjusted = false;
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
password = intent.getStringExtra("password");
|
||||
@@ -1735,9 +1738,82 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
super.onResume();
|
||||
CommonAppContext.getInstance().isShow = true;
|
||||
CommonAppContext.getInstance().isPlaying = true;
|
||||
// 延迟调整布局,确保视图已经完全加载
|
||||
mBinding.mainContentContainer.post(this::adjustLayoutHeights);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
if (hasFocus && !isLayoutAdjusted) {
|
||||
adjustLayoutHeights();
|
||||
isLayoutAdjusted = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态调整布局高度以适配不同设备
|
||||
*/
|
||||
private void adjustLayoutHeights() {
|
||||
if (mBinding == null) return;
|
||||
|
||||
try {
|
||||
// 获取主容器
|
||||
ConstraintLayout mainContainer = mBinding.mainContentContainer;
|
||||
View pager = mBinding.vpRoomPager;
|
||||
View easeContainer = mBinding.easeContainer;
|
||||
|
||||
if (mainContainer != null && pager != null && easeContainer != null) {
|
||||
// 强制测量主容器
|
||||
int widthSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||
int heightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||
mainContainer.measure(widthSpec, heightSpec);
|
||||
|
||||
int containerHeight = mainContainer.getMeasuredHeight();
|
||||
if (containerHeight <= 0) {
|
||||
// 如果测量不到高度,使用布局参数中的高度
|
||||
ConstraintLayout.LayoutParams containerParams = (ConstraintLayout.LayoutParams) mainContainer.getLayoutParams();
|
||||
containerHeight = getResources().getDisplayMetrics().heightPixels
|
||||
- getStatusBarHeight()
|
||||
- getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_50) // room_top 高度
|
||||
- getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15) * 3; // 底部控件高度
|
||||
}
|
||||
|
||||
// 确保最小高度
|
||||
if (containerHeight > 0) {
|
||||
// 设置 vp_room_pager 占用 70% 空间
|
||||
ConstraintLayout.LayoutParams pagerParams = (ConstraintLayout.LayoutParams) pager.getLayoutParams();
|
||||
pagerParams.height = 0;
|
||||
pager.setLayoutParams(pagerParams);
|
||||
|
||||
// 设置 ease_container 占用 30% 空间
|
||||
ConstraintLayout.LayoutParams easeParams = (ConstraintLayout.LayoutParams) easeContainer.getLayoutParams();
|
||||
easeParams.height = 0;
|
||||
easeContainer.setLayoutParams(easeParams);
|
||||
|
||||
// 请求重新布局
|
||||
mainContainer.requestLayout();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtils.e("adjustLayoutHeights error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态栏高度
|
||||
*/
|
||||
private int getStatusBarHeight() {
|
||||
int result = 0;
|
||||
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (resourceId > 0) {
|
||||
result = getResources().getDimensionPixelSize(resourceId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getRoomOnline(RoomOnline onlineBean) {
|
||||
if (onlineBean != null) {
|
||||
|
||||
@@ -456,17 +456,21 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
||||
@Override
|
||||
public void addData(@NonNull EMMessageInfo data) {
|
||||
// super.addData(data);
|
||||
allMsgList.add(data);
|
||||
if (data.getItemType() == 2) {
|
||||
if (data.getItemType()==1) {
|
||||
allMsgList.add(data);
|
||||
}else if (data.getItemType() == 2) {
|
||||
userMsgList.add(data);
|
||||
allMsgList.add(data);
|
||||
} else if (data.getItemType() == 3) {
|
||||
systemMsgList.add(data);
|
||||
}
|
||||
|
||||
if (listShowType == SHOW_TYPE_ALL
|
||||
|| ((data.getItemType() == 2) && listShowType == SHOW_TYPE_USER)
|
||||
|| ((data.getItemType() == 3) && listShowType == SHOW_TYPE_SYSTEM)
|
||||
) {
|
||||
// 根据当前显示类型决定是否添加到适配器中
|
||||
boolean shouldAdd = (listShowType == SHOW_TYPE_ALL && (data.getItemType() == 1 || data.getItemType() == 2)) ||
|
||||
(listShowType == SHOW_TYPE_USER && data.getItemType() == 2) ||
|
||||
(listShowType == SHOW_TYPE_SYSTEM && data.getItemType() == 3);
|
||||
|
||||
if (shouldAdd) {
|
||||
super.addData(data);
|
||||
}
|
||||
}
|
||||
@@ -483,6 +487,4 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
||||
addData(list.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -465,6 +465,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit,"");
|
||||
} else {
|
||||
MvpPre.roomAuctionJoin(userInfo.getAuction_id(), userInfo.getUser_id() + "", roonGiftModel.getGift_id(), num, "1");
|
||||
dismiss();
|
||||
}
|
||||
}else {
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit,heart_id);
|
||||
|
||||
@@ -393,6 +393,7 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
|
||||
setTextViewStyle(mBinding.textView2, false);
|
||||
setTextViewStyle(mBinding.textView1, true);
|
||||
if (userInfo.getQinmi() != null && !userInfo.getQinmi().equals("")) {
|
||||
mBinding.ll.setVisibility(VISIBLE);
|
||||
mBinding.ll.setBackgroundResource(com.xscm.moduleutil.R.mipmap.guxi_k);
|
||||
// mBinding.rlReqit.setBackgroundResource(com.qxcm.moduleutil.R.mipmap.regit_t);
|
||||
ImageUtils.loadHeadCC(userInfo.getQinmi().getAvatar1(), mBinding.userNav1);
|
||||
@@ -409,6 +410,7 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
|
||||
setTextViewStyle(mBinding.textView2, true);
|
||||
setTextViewStyle(mBinding.textView1, false);
|
||||
if (userInfo.getZhenai() != null && !userInfo.getZhenai().equals("")) {
|
||||
mBinding.ll.setVisibility(VISIBLE);
|
||||
mBinding.ll.setBackgroundResource(com.xscm.moduleutil.R.mipmap.guxi_w);
|
||||
// mBinding.rlReqit.setBackgroundResource(com.qxcm.moduleutil.R.mipmap.guanxiw_z);
|
||||
ImageUtils.loadHeadCC(userInfo.getZhenai().getAvatar1(), mBinding.userNav1);
|
||||
|
||||
@@ -272,12 +272,23 @@ public class WheatFeedingDialogFragment extends BaseMvpDialogFragment<WheatPrese
|
||||
|
||||
@Override
|
||||
public void agreePit() {
|
||||
MvpPre.roomApplyListBean(roomId);
|
||||
// MvpPre.roomApplyListBean(roomId);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyPit() {
|
||||
MvpPre.roomApplyListBean(roomId);
|
||||
//
|
||||
// if (roomApplyListBeans!=null){
|
||||
// if ((roomApplyListBeans.getSpecial() != null && !roomApplyListBeans.getSpecial().isEmpty())
|
||||
// ||(roomApplyListBeans.getRegular() != null && !roomApplyListBeans.getRegular().isEmpty())){
|
||||
// MvpPre.roomApplyListBean(roomId);
|
||||
// }else {
|
||||
// dismiss();
|
||||
// }
|
||||
// }else {
|
||||
dismiss();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,56 +50,90 @@
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<!-- <com.qxcm.moduleutil.widget.ScrollViewPager-->
|
||||
<!-- android:id="@+id/vp_room_pager"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- android:clipChildren="false"-->
|
||||
<!-- android:clipToPadding="false"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/room_top" />-->
|
||||
|
||||
<!-- <ScrollView-->
|
||||
<!-- android:id="@+id/scrollView"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/room_top"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent">-->
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/vp_room_pager"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/main_content_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_15"
|
||||
app:layout_constraintBottom_toTopOf="@+id/ll_bottom"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_percent="0.55"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/room_top"
|
||||
app:layout_constraintTop_toBottomOf="@id/room_top">
|
||||
|
||||
/>
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.7" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/ease_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
app:layout_constraintBottom_toTopOf="@id/ll_bottom"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_percent="0.3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/vp_room_pager">
|
||||
|
||||
<com.xscm.moduleutil.widget.AvatarFrameView
|
||||
android:id="@+id/svga_ride"
|
||||
<FrameLayout
|
||||
android:id="@+id/vp_room_pager"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp" />
|
||||
</FrameLayout>
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginBottom="@dimen/dp_5"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/ease_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/guideline_horizontal">
|
||||
|
||||
<com.xscm.moduleutil.widget.AvatarFrameView
|
||||
android:id="@+id/svga_ride"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:minHeight="@dimen/dp_80" />
|
||||
</FrameLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_10"-->
|
||||
<!-- android:layout_marginBottom="@dimen/dp_15"-->
|
||||
<!-- android:orientation="vertical"-->
|
||||
<!-- app:layout_constraintBottom_toTopOf="@+id/ll_bottom"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/room_top">-->
|
||||
|
||||
<!-- <FrameLayout-->
|
||||
<!-- android:id="@+id/vp_room_pager"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- android:layout_weight="2"-->
|
||||
<!-- android:layout_marginBottom="@dimen/dp_5"-->
|
||||
<!-- android:clipChildren="false"-->
|
||||
<!-- android:clipToPadding="false" />-->
|
||||
|
||||
<!-- <FrameLayout-->
|
||||
<!-- android:id="@+id/ease_container"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- android:layout_weight="1"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_5"-->
|
||||
<!-- android:minHeight="@dimen/dp_80">-->
|
||||
|
||||
<!-- <com.xscm.moduleutil.widget.AvatarFrameView-->
|
||||
<!-- android:id="@+id/svga_ride"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:minHeight="@dimen/dp_80" />-->
|
||||
<!-- </FrameLayout>-->
|
||||
<!-- </LinearLayout>-->
|
||||
|
||||
<com.xscm.moduleutil.widget.RoomMessageInputMenu
|
||||
android:id="@+id/input_menu1"
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
android:layout_height="@dimen/dp_42"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:background="@drawable/bg_r53_0dffb9"
|
||||
android:text="同意"
|
||||
android:textSize="@dimen/sp_14"
|
||||
@@ -138,7 +138,8 @@
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginBottom="@dimen/dp_44"
|
||||
android:layout_marginEnd="@dimen/dp_16"/>
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ljsq"
|
||||
|
||||
Reference in New Issue
Block a user