From bec031688e69e38ec65a5d258669646a6da272e3 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 24 Aug 2023 10:46:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A4=BC=E7=89=A9=E6=A0=8F?= =?UTF-8?q?=E8=A7=A6=E7=A2=B0=E4=BA=8B=E4=BB=B6=E6=8B=A6=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../res/layout/dialog_live_gift_popup.xml | 773 +++++++++--------- .../com/yunbao/live/dialog/LiveGiftPopup.java | 40 +- 2 files changed, 424 insertions(+), 389 deletions(-) diff --git a/common/src/main/res/layout/dialog_live_gift_popup.xml b/common/src/main/res/layout/dialog_live_gift_popup.xml index 05b18ba17..6f8b320be 100644 --- a/common/src/main/res/layout/dialog_live_gift_popup.xml +++ b/common/src/main/res/layout/dialog_live_gift_popup.xml @@ -6,77 +6,194 @@ android:layout_gravity="bottom" android:orientation="vertical"> - - - - - - - - - - - + android:layout_height="0dp" + android:layout_weight="1"> + + + + + + + + + + + + + + + + + + + + + + + + + + + android:src="@drawable/backgroud_custom_gift2" + app:riv_corner_radius_bottom_left="0dp" + app:riv_corner_radius_bottom_right="0dp" + app:riv_corner_radius_top_left="10dp" + app:riv_corner_radius_top_right="10dp" /> + + android:layout_height="wrap_content" + android:layout_marginTop="5dp" + android:animateLayoutChanges="true"> - + - + + + + + + + + + + + + + + + - - - - - - - - - - - - + android:id="@+id/btn_luck_gift_tip" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="5dp"> + + - + + + + android:id="@+id/diamond_linear" + android:layout_width="wrap_content" + android:layout_height="32dp" + android:background="@drawable/background_gift_money" + android:gravity="center_vertical" + android:paddingStart="4dp" + android:paddingTop="7dp" + android:paddingBottom="7dp"> - + - + + + + + + + + + + + + + + + + + + + + + + android:text="@string/live_gift_send" + android:textColor="@color/white" + android:textSize="14sp" /> + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="196dp" + android:layout_marginTop="12dp" /> - + + - + - - - - - - - + diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java index f8623d2d3..824d58677 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java @@ -15,6 +15,7 @@ import android.text.TextUtils; import android.text.style.ForegroundColorSpan; import android.util.Log; import android.view.Gravity; +import android.view.MotionEvent; import android.view.View; import android.view.Window; import android.view.WindowManager; @@ -103,7 +104,7 @@ public class LiveGiftPopup extends AbsDialogFragment { private TextView diamondText, goldText, liveWrap, vipGoldDesc, vipGoldTitle, giftNumber; private RecyclerView giftTitle; private GiftTitleAdapter giftTitleAdapter; - private FrameLayout contextLayoutGift; + private FrameLayout contextLayoutGift, overlay; private String mStream, mLiveUid; private FrameLayout blindBox, frameBlindTop, noNobility, giftNumberLayout, giftSendLayout, namingLayout; private ProgressBar progressBlind, progressBlind1, progressBlind2; @@ -182,6 +183,7 @@ public class LiveGiftPopup extends AbsDialogFragment { leaveHint = mRootView.findViewById(R.id.leave_hint); progressBar = mRootView.findViewById(R.id.progressBar); levelingLayout = mRootView.findViewById(R.id.leveling_layout); + overlay = mRootView.findViewById(R.id.overlay); namingLayout.setVisibility(View.GONE); //设置礼物弹窗背景 ImgLoader.displayBlurLive(getContext(), R.drawable.backgroud_custom_gift2, gitBackground); @@ -199,6 +201,27 @@ public class LiveGiftPopup extends AbsDialogFragment { giftDescription.setVisibility(View.GONE); operateImage.setVisibility(View.GONE); levelingLayout.setVisibility(View.VISIBLE); + updateOverlayVisibility(); + blindBox.setOnTouchListener((v, event) -> { + if(event.getAction()==MotionEvent.ACTION_UP) { + v.performClick(); + } + return true; + }); + namingLayout.setOnTouchListener((v, event) -> { + if(event.getAction()==MotionEvent.ACTION_UP) { + v.performClick(); + } + return true; + }); + operateImage.setOnTouchListener((v, event) -> { + if(event.getAction()==MotionEvent.ACTION_UP) { + v.performClick(); + } + return true; + }); + + overlay.setOnClickListener(v -> dismiss()); //点击包裹 ViewClicksAntiShake.clicksAntiShake(liveWrap, new ViewClicksAntiShake.ViewClicksCallBack() { @Override @@ -460,7 +483,7 @@ public class LiveGiftPopup extends AbsDialogFragment { int nextLeve = Integer.parseInt(coinModel.getUserNextLevelRewards()); - BigDecimal maxLeve = new BigDecimal(coinModel.getUserLevelUpgrades()).add( new BigDecimal(coinModel.getUserLevelCurrentConsumption())); + BigDecimal maxLeve = new BigDecimal(coinModel.getUserLevelUpgrades()).add(new BigDecimal(coinModel.getUserLevelCurrentConsumption())); try { String leveNext = String.valueOf(nextLeve); String userNextLevel = coinModel.getUserLevelUpgrades(); @@ -731,7 +754,7 @@ public class LiveGiftPopup extends AbsDialogFragment { @Subscribe(threadMode = ThreadMode.MAIN) public void onLiveGiftItemEvent(LiveGiftItemEvent event) { liveGiftModel = event.getLiveGiftModel(); - + updateOverlayVisibility(); if (!TextUtils.isEmpty(liveGiftModel.getNamingLiveuid()) && !TextUtils.isEmpty(liveGiftModel.getNamingUid()) && !TextUtils.equals(liveGiftModel.getNamingLiveuid(), "0") && @@ -1240,4 +1263,15 @@ public class LiveGiftPopup extends AbsDialogFragment { } } + private void updateOverlayVisibility() { + /* if ( + blindBox.getVisibility() == View.VISIBLE || + operateImage.getVisibility() == View.VISIBLE || + namingLayout.getVisibility() == View.VISIBLE + ) { + overlay.setVisibility(View.VISIBLE); + } else { + overlay.setVisibility(View.GONE); + }*/ + } }