修改房间布局,根据宽度计算高度
This commit is contained in:
@@ -79,10 +79,14 @@ import com.example.moduleroom.dialog.RoomOnlineDialogFragment;
|
||||
import com.example.moduleroom.dialog.RoomPkDialogFragment;
|
||||
import com.example.moduleroom.dialog.RoomSettingFragment;
|
||||
import com.example.moduleroom.dialog.SoundEffectsDialogFragment;
|
||||
import com.example.moduleroom.fragment.FriendshipRoomFragment;
|
||||
import com.example.moduleroom.fragment.PublicScreenEaseChatFragment;
|
||||
import com.example.moduleroom.fragment.RoomAuctionFragment;
|
||||
import com.example.moduleroom.fragment.RoomCabinFragment;
|
||||
import com.example.moduleroom.fragment.RoomChartsFragment;
|
||||
import com.example.moduleroom.fragment.RoomKtvFragment;
|
||||
import com.example.moduleroom.fragment.RoomNoticeDialogFragment;
|
||||
import com.example.moduleroom.fragment.SingSongFragment;
|
||||
import com.petterp.floatingx.assist.helper.FxScopeHelper;
|
||||
import com.petterp.floatingx.listener.control.IFxControl;
|
||||
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||
@@ -139,6 +143,7 @@ import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.SystemUtils;
|
||||
import com.xscm.moduleutil.widget.CircularProgressView;
|
||||
import com.xscm.moduleutil.widget.CustomMusicFloatingView;
|
||||
import com.xscm.moduleutil.widget.SilentCountDownTimer;
|
||||
@@ -462,6 +467,16 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
return false; // 返回 false,表示不拦截事件
|
||||
}
|
||||
});
|
||||
|
||||
ViewGroup.LayoutParams layoutParams = mBinding.roomTop.getRoot().getLayoutParams();
|
||||
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; // 使用你定义的getWidth方法
|
||||
layoutParams.height = SystemUtils.getWidth(74); // 示例高度
|
||||
mBinding.roomTop.getRoot().setLayoutParams(layoutParams);
|
||||
|
||||
ViewGroup.LayoutParams layoutParams2 = mBinding.vpRoomPager.getLayoutParams();
|
||||
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; // 使用你定义的getWidth方法
|
||||
layoutParams.height = SystemUtils.getWidth(74); // 示例高度
|
||||
mBinding.roomTop.getRoot().setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
private void onGiftGiveProgressClcik() {
|
||||
@@ -2167,7 +2182,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
this.mPitList = mRoomBean.getPit_list();
|
||||
this.roomId = roomBean.getRoom_id();
|
||||
|
||||
|
||||
upHeight();
|
||||
ImageUtils.loadHeadCC(resp.getRoom_info().getRoom_cover(), mBinding.roomTop.avatar);
|
||||
mBinding.roomTop.name.setText(roomBean.getRoom_name());
|
||||
mBinding.roomTop.idVal.setText("ID:" + roomBean.getRoom_number());
|
||||
@@ -2558,7 +2573,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
isLayoutAdjusted = true;
|
||||
}
|
||||
}
|
||||
|
||||
int maxHeightDp=333;
|
||||
/**
|
||||
* 动态调整布局高度以适配不同设备
|
||||
*/
|
||||
@@ -2591,7 +2606,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
if (containerHeight > 0) {
|
||||
// 设置 vp_room_pager 占用 70% 空间
|
||||
ConstraintLayout.LayoutParams pagerParams = (ConstraintLayout.LayoutParams) pager.getLayoutParams();
|
||||
pagerParams.height = 0;
|
||||
pagerParams.height = SystemUtils.getWidth(maxHeightDp);
|
||||
pager.setLayoutParams(pagerParams);
|
||||
|
||||
// 设置 ease_container 占用 30% 空间
|
||||
@@ -2697,6 +2712,8 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
mBinding.roomTop.btnFollow.setText("");
|
||||
}
|
||||
}
|
||||
upHeight();
|
||||
|
||||
if (!isFinishing() && !isDestroyed()) {
|
||||
|
||||
|
||||
@@ -2731,6 +2748,27 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
initializeAudio();
|
||||
}
|
||||
|
||||
|
||||
public void upHeight() {
|
||||
if (mRoomInfoResp.getRoom_info().getType_id().equals("1")){
|
||||
if (mRoomInfoResp.getRoom_info().getLabel_id().equals("1")){
|
||||
maxHeightDp=333;
|
||||
}else {
|
||||
maxHeightDp=287;
|
||||
}
|
||||
|
||||
}else if (mRoomInfoResp.getRoom_info().getType_id().equals("2")){
|
||||
maxHeightDp=287;
|
||||
} if (mRoomInfoResp.getRoom_info().getType_id().equals("6")){
|
||||
maxHeightDp=333;
|
||||
}else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")){
|
||||
maxHeightDp=333;
|
||||
|
||||
}
|
||||
adjustLayoutHeights();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getCharmRank(List<RoomCharmRankBean> list) {
|
||||
|
||||
|
||||
@@ -65,12 +65,12 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
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.66" />
|
||||
<!-- <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.66" />-->
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/vp_room_pager"
|
||||
@@ -79,7 +79,6 @@
|
||||
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" />
|
||||
@@ -92,7 +91,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/guideline_horizontal">
|
||||
app:layout_constraintTop_toBottomOf="@+id/vp_room_pager">
|
||||
|
||||
<com.xscm.moduleutil.widget.AvatarFrameView
|
||||
android:id="@+id/svga_ride"
|
||||
|
||||
Reference in New Issue
Block a user