From c185808d6009df8ad39f07d41cb83c458bec453f Mon Sep 17 00:00:00 2001 From: eggmanQQQ <3671373519@qq.com> Date: Mon, 30 Dec 2024 11:52:27 +0800 Subject: [PATCH] =?UTF-8?q?feat=20:=20=20=E6=88=BF=E9=97=B4=E5=8F=B3?= =?UTF-8?q?=E4=B8=8B=E8=A7=92=20=E6=82=AC=E6=B5=AE=E6=8C=89=E9=92=AE=20?= =?UTF-8?q?=E6=8A=98=E5=8F=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/avroom/fragment/BaseRoomFragment.kt | 101 ++++++++++++--- .../avroom/fragment/HomePartyFragment.java | 2 +- .../fragment/HomePartyRoomFragment.java | 25 ++-- .../main/res/layout/fragment_av_room_game.xml | 99 --------------- .../layout/fragment_chatroom_game_main.xml | 116 +++++++++++++++++- .../main/res/layout/fragment_single_room.xml | 72 ----------- .../chwl/core/manager/AvRoomDataManager.java | 3 + 7 files changed, 212 insertions(+), 206 deletions(-) diff --git a/app/src/main/java/com/chwl/app/avroom/fragment/BaseRoomFragment.kt b/app/src/main/java/com/chwl/app/avroom/fragment/BaseRoomFragment.kt index 8d1bf54e1..ff8f7e397 100644 --- a/app/src/main/java/com/chwl/app/avroom/fragment/BaseRoomFragment.kt +++ b/app/src/main/java/com/chwl/app/avroom/fragment/BaseRoomFragment.kt @@ -19,10 +19,12 @@ import android.view.ViewStub import android.widget.EditText import android.widget.FrameLayout import android.widget.ImageView +import android.widget.LinearLayout import android.widget.RelativeLayout import android.widget.TextView import androidx.annotation.CallSuper import androidx.core.content.ContextCompat +import androidx.core.view.isVisible import androidx.fragment.app.FragmentManager import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.LiveData @@ -135,9 +137,11 @@ import com.chwl.core.user.bean.BaseInfo import com.chwl.core.user.bean.UserInfo import com.chwl.core.utils.LogUtils import com.chwl.core.utils.net.VipLevelNotEnoughException +import com.chwl.library.common.util.ClickUtils.click import com.chwl.library.common.util.LimitClickUtils import com.chwl.library.common.util.doLog import com.chwl.library.common.util.isVerify +import com.chwl.library.common.util.setMargin import com.chwl.library.common.util.setViewWH import com.chwl.library.common.util.setVis import com.chwl.library.net.rxnet.utils.RxNetWorkUtils @@ -186,19 +190,23 @@ open class BaseRoomFragment?> : protected lateinit var microView: MicroView protected var mMusicPlayIconView: ImageView? = null - protected lateinit var btnIvConfigEntrance: ImageView - protected lateinit var btnIvgame: ImageView + protected lateinit var floatBtnLayout: LinearLayout + protected lateinit var floatBtnLayoutFold: LinearLayout + protected lateinit var btnFold: ImageView protected lateinit var boomLayout: FrameLayout protected lateinit var boomIcon: ImageView protected lateinit var boomProMax: ImageView protected lateinit var boomPro: ImageView + protected lateinit var ivTeamPk: ImageView + protected lateinit var btnIvConfigEntrance: ImageView + protected lateinit var btnIvgame: ImageView + protected lateinit var mIvQueuingMicro: ImageView + //---连击时间 需要透明化的view protected var mPlayTogether:View? = null protected var mLayoutDragon:View? = null - protected var mIvQueuingMicro:View? = null - protected var mivTeamPk:View? = null private var musicPlayerView: MusicPlayerView? = null private var mVsMusicPlayer: ViewStub? = null @@ -278,25 +286,16 @@ open class BaseRoomFragment?> : } }) - btnIvConfigEntrance = mView.findViewById(R.id.iv_config_entrance) - btnIvgame = mView.findViewById(R.id.iv_game) - boomLayout = mView.findViewById(R.id.boomLayout) - boomIcon = mView.findViewById(R.id.boomIcon) - boomProMax = mView.findViewById(R.id.boomProMax) - boomPro = mView.findViewById(R.id.boomPro) - boomIcon.post { - boomIcon.rotation = -30f + initFloatBtnLayout() + + + bottomView.post { + floatBtnLayout.setMargin(bottom = bottomView.height, isDP = false) } - boomLayout.setOnClickListener { - showBoomInfoDialog() - } - - mivTeamPk = mView.findViewById(R.id.iv_team_pk) - mIvQueuingMicro = mView.findViewById(R.id.iv_queuing_micro) mLayoutDragon = mView.findViewById(R.id.layout_dragon) mPlayTogether = mView.findViewById(R.id.play_together) @@ -1420,22 +1419,24 @@ open class BaseRoomFragment?> : } private fun setComboViewVis(vis: Boolean) { + floatBtnLayout.alpha = if (vis) 1f else 0f //bottom_view bottomView.alpha = if (vis) 1f else 0f //bottom_view boomLayout.alpha = if (vis) 1f else 0f //boomLayout inputLayout.alpha = if (vis) 1f else 0f //input_layout btnIvConfigEntrance.alpha = if (vis) 1f else 0f //iv_config_entrance btnIvgame.alpha = if (vis) 1f else 0f //iv_game - mivTeamPk?.alpha = if (vis) 1f else 0f //iv_team_pk + ivTeamPk?.alpha = if (vis) 1f else 0f //iv_team_pk mIvQueuingMicro?.alpha = if (vis) 1f else 0f //iv_queuing_micro mLayoutDragon?.alpha = if (vis) 1f else 0f //layout_dragon mPlayTogether?.alpha = if (vis) 1f else 0f //play_together + floatBtnLayout.isEnabled = vis //bottom_view bottomView.isEnabled = vis //bottom_view boomLayout.isEnabled = vis //boomLayout inputLayout.isEnabled = vis //input_layout btnIvConfigEntrance.isEnabled = vis //iv_config_entrance btnIvgame.isEnabled = vis //iv_game - mivTeamPk?.isEnabled = vis //iv_team_pk + ivTeamPk?.isEnabled = vis //iv_team_pk mIvQueuingMicro?.isEnabled = vis //iv_queuing_micro mLayoutDragon?.isEnabled = vis //layout_dragon mPlayTogether?.isEnabled = vis //play_together @@ -1938,5 +1939,65 @@ open class BaseRoomFragment?> : .compose(bindToLifecycle()) .subscribe() } + + public fun initFloatBtnLayout(layout: LinearLayout?=null) { + + val parentFragment = parentFragment + if (parentFragment != null && parentFragment is HomePartyFragment) { + floatBtnLayout = parentFragment.gameMainBinding.floatBtnLayout + + floatBtnLayoutFold = floatBtnLayout.findViewById(R.id.floatBtnLayoutFold) + btnFold = floatBtnLayout.findViewById(R.id.btnFold) + + boomLayout = floatBtnLayout.findViewById(R.id.boomLayout) + boomIcon = floatBtnLayout.findViewById(R.id.boomIcon) + boomProMax = floatBtnLayout.findViewById(R.id.boomProMax) + boomPro = floatBtnLayout.findViewById(R.id.boomPro) + + ivTeamPk = floatBtnLayout.findViewById(R.id.iv_team_pk) + + btnIvConfigEntrance = floatBtnLayout.findViewById(R.id.iv_config_entrance) + + btnIvgame = floatBtnLayout.findViewById(R.id.iv_game) + + mIvQueuingMicro = floatBtnLayout.findViewById(R.id.iv_queuing_micro) + + boomIcon.post { + boomIcon.rotation = -30f + } + + boomLayout.setOnClickListener { + showBoomInfoDialog() + } + + + if (AvRoomDataManager.get().isGameRoom) { + btnIvgame.setVis(false) + mIvQueuingMicro?.setVis(false) + }else if (AvRoomDataManager.get().isSingleRoom) { + ivTeamPk?.setVis(false) + mIvQueuingMicro?.setVis(false) + } + + btnFold.setVis((AvRoomDataManager.get().is19Room || AvRoomDataManager.get().is20Room)) + floatBtnLayoutFold.setViewWH(height = if (btnFold.isVisible) 1 else ViewGroup.LayoutParams.WRAP_CONTENT, isDP = false) + btnFold.tag = btnFold.isVisible + btnFold.click { + val tag = btnFold.tag + if (tag is Boolean){ + if ( tag) { + btnFold.tag = false + btnFold.setImageResource(R.drawable.ic_eyes_close) + floatBtnLayoutFold.setViewWH(height = ViewGroup.LayoutParams.WRAP_CONTENT, isDP = false) + } else { + btnFold.tag = true + btnFold.setImageResource(R.drawable.ic_eyes_open) + floatBtnLayoutFold.setViewWH(height = 1, isDP = false) + } + } + } + } + + } } \ No newline at end of file diff --git a/app/src/main/java/com/chwl/app/avroom/fragment/HomePartyFragment.java b/app/src/main/java/com/chwl/app/avroom/fragment/HomePartyFragment.java index e5344c95c..f01367c9e 100644 --- a/app/src/main/java/com/chwl/app/avroom/fragment/HomePartyFragment.java +++ b/app/src/main/java/com/chwl/app/avroom/fragment/HomePartyFragment.java @@ -122,7 +122,7 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe private String[] bgPicture = new String[]{""}; private UserInfo mUserInfo; - private FragmentChatroomGameMainBinding gameMainBinding; + public FragmentChatroomGameMainBinding gameMainBinding; //收藏房间 private String FOLLOW_ROOM_TYPE = ""; diff --git a/app/src/main/java/com/chwl/app/avroom/fragment/HomePartyRoomFragment.java b/app/src/main/java/com/chwl/app/avroom/fragment/HomePartyRoomFragment.java index 099342403..fb98345d4 100644 --- a/app/src/main/java/com/chwl/app/avroom/fragment/HomePartyRoomFragment.java +++ b/app/src/main/java/com/chwl/app/avroom/fragment/HomePartyRoomFragment.java @@ -120,7 +120,6 @@ public class HomePartyRoomFragment extends BaseRoomFragment - - - - - - - - - - - - - - - - - - - - + + + @@ -34,6 +39,112 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_single_room.xml b/app/src/main/res/layout/fragment_single_room.xml index 9506dfff8..f965602bf 100644 --- a/app/src/main/res/layout/fragment_single_room.xml +++ b/app/src/main/res/layout/fragment_single_room.xml @@ -169,78 +169,6 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> - - - - - - - - - - - - - - - - - -