调整礼物栏触碰事件拦截

This commit is contained in:
zlzw 2023-08-24 10:46:40 +08:00
parent d4ff9c3072
commit bec031688e
2 changed files with 424 additions and 389 deletions

View File

@ -7,6 +7,7 @@
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <FrameLayout
android:id="@+id/overlay"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1"> android:layout_weight="1">

View File

@ -15,6 +15,7 @@ import android.text.TextUtils;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
@ -103,7 +104,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
private TextView diamondText, goldText, liveWrap, vipGoldDesc, vipGoldTitle, giftNumber; private TextView diamondText, goldText, liveWrap, vipGoldDesc, vipGoldTitle, giftNumber;
private RecyclerView giftTitle; private RecyclerView giftTitle;
private GiftTitleAdapter giftTitleAdapter; private GiftTitleAdapter giftTitleAdapter;
private FrameLayout contextLayoutGift; private FrameLayout contextLayoutGift, overlay;
private String mStream, mLiveUid; private String mStream, mLiveUid;
private FrameLayout blindBox, frameBlindTop, noNobility, giftNumberLayout, giftSendLayout, namingLayout; private FrameLayout blindBox, frameBlindTop, noNobility, giftNumberLayout, giftSendLayout, namingLayout;
private ProgressBar progressBlind, progressBlind1, progressBlind2; private ProgressBar progressBlind, progressBlind1, progressBlind2;
@ -182,6 +183,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
leaveHint = mRootView.findViewById(R.id.leave_hint); leaveHint = mRootView.findViewById(R.id.leave_hint);
progressBar = mRootView.findViewById(R.id.progressBar); progressBar = mRootView.findViewById(R.id.progressBar);
levelingLayout = mRootView.findViewById(R.id.leveling_layout); levelingLayout = mRootView.findViewById(R.id.leveling_layout);
overlay = mRootView.findViewById(R.id.overlay);
namingLayout.setVisibility(View.GONE); namingLayout.setVisibility(View.GONE);
//设置礼物弹窗背景 //设置礼物弹窗背景
ImgLoader.displayBlurLive(getContext(), R.drawable.backgroud_custom_gift2, gitBackground); ImgLoader.displayBlurLive(getContext(), R.drawable.backgroud_custom_gift2, gitBackground);
@ -199,6 +201,27 @@ public class LiveGiftPopup extends AbsDialogFragment {
giftDescription.setVisibility(View.GONE); giftDescription.setVisibility(View.GONE);
operateImage.setVisibility(View.GONE); operateImage.setVisibility(View.GONE);
levelingLayout.setVisibility(View.VISIBLE); 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() { ViewClicksAntiShake.clicksAntiShake(liveWrap, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
@ -731,7 +754,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveGiftItemEvent(LiveGiftItemEvent event) { public void onLiveGiftItemEvent(LiveGiftItemEvent event) {
liveGiftModel = event.getLiveGiftModel(); liveGiftModel = event.getLiveGiftModel();
updateOverlayVisibility();
if (!TextUtils.isEmpty(liveGiftModel.getNamingLiveuid()) && if (!TextUtils.isEmpty(liveGiftModel.getNamingLiveuid()) &&
!TextUtils.isEmpty(liveGiftModel.getNamingUid()) && !TextUtils.isEmpty(liveGiftModel.getNamingUid()) &&
!TextUtils.equals(liveGiftModel.getNamingLiveuid(), "0") && !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);
}*/
}
} }