From 1e4b0bb5366596fdadcd8ab2941dfec04dec5f74 Mon Sep 17 00:00:00 2001
From: zlzw <583819556@qq.com>
Date: Tue, 18 Jul 2023 18:09:27 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E4=BF=A1=E7=AE=B1=E8=A7=92?=
=?UTF-8?q?=E6=A0=87=E7=82=B9=E4=BA=AE=E5=92=8C=E9=98=B2=E6=8A=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../LiveContactDetailsSendGiftDialog.java | 39 +++++++++++++++----
.../yunbao/live/views/LiveRoomViewHolder.java | 6 +++
2 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveContactDetailsSendGiftDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveContactDetailsSendGiftDialog.java
index 7290ba84f..1fe3a7cbb 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveContactDetailsSendGiftDialog.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveContactDetailsSendGiftDialog.java
@@ -4,8 +4,10 @@ import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
import android.app.Dialog;
import android.content.Context;
+import android.content.DialogInterface;
import android.text.Html;
import android.text.Spanned;
+import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
@@ -21,6 +23,7 @@ import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.DialogUitl;
+import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.http.LiveHttpUtil;
@@ -32,12 +35,14 @@ public class LiveContactDetailsSendGiftDialog extends AbsDialogPopupWindow {
TextView giftName;
TextView diamond;
ImageView giftIcon;
+ View send;
int giftId;
String anchorName;
private String mLiveUid;
private String mStream;
LiveGiftBean bean;
+ DialogInterface.OnDismissListener onDismissListener;
public LiveContactDetailsSendGiftDialog(@NonNull Context context) {
super(context);
@@ -63,6 +68,11 @@ public class LiveContactDetailsSendGiftDialog extends AbsDialogPopupWindow {
return this;
}
+ public LiveContactDetailsSendGiftDialog setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
+ this.onDismissListener = onDismissListener;
+ return this;
+ }
+
@Override
public void buildDialog(XPopup.Builder builder) {
@@ -77,7 +87,8 @@ public class LiveContactDetailsSendGiftDialog extends AbsDialogPopupWindow {
protected void onCreate() {
super.onCreate();
findViewById(R.id.back).setOnClickListener(v -> dismiss());
- findViewById(R.id.send).setOnClickListener(v -> send());
+ send = findViewById(R.id.send);
+ ViewClicksAntiShake.clicksAntiShake(send, this::send);
title = findViewById(R.id.title);
giftIcon = findViewById(R.id.gift_icon);
@@ -113,18 +124,25 @@ public class LiveContactDetailsSendGiftDialog extends AbsDialogPopupWindow {
}
});
}
+ @Override
+ protected void onDismiss() {
+ super.onDismiss();
+ if (onDismissListener != null) {
+ onDismissListener.onDismiss(null);
+ }
+ }
private void setData(LiveGiftBean bean) {
- this.bean=bean;
- ImgLoader.display(mContext,bean.getIcon(),giftIcon);
+ this.bean = bean;
+ ImgLoader.display(mContext, bean.getIcon(), giftIcon);
diamond.setText(bean.getPrice());
giftName.setText(bean.getName());
Spanned spanned = Html.fromHtml(
- ""+mContext.getString(R.string.live_details_sned_gift_text1)+"" +
+ "" + mContext.getString(R.string.live_details_sned_gift_text1) + "" +
" " + bean.getName() + " " +
- ""+mContext.getString(R.string.live_details_sned_gift_text2)+"" +
+ "" + mContext.getString(R.string.live_details_sned_gift_text2) + "" +
" " + anchorName + " " +
- ""+mContext.getString(R.string.live_details_sned_gift_text3)+""
+ "" + mContext.getString(R.string.live_details_sned_gift_text3) + ""
);
title.setText(spanned);
}
@@ -133,7 +151,7 @@ public class LiveContactDetailsSendGiftDialog extends AbsDialogPopupWindow {
LiveHttpUtil.sendGift("0", mLiveUid, mStream, bean.getId(), "1", 1, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
- if (code == 1001 || code==1005) {
+ if (code == 1001 || code == 1005) {
new DialogUitl.Builder(mContext)
.setView(R.layout.dialog_live_unfollow)
.setConfirmString(mContext.getString(R.string.charge))
@@ -145,10 +163,15 @@ public class LiveContactDetailsSendGiftDialog extends AbsDialogPopupWindow {
ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation();
}
}).build().show();
- }else{
+ } else {
dismiss();
}
}
+
+ @Override
+ public void onError() {
+ super.onError();
+ }
});
}
}
diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
index 7910bc48a..fdb7cf02e 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
@@ -5079,6 +5079,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
.setAnchorName(mAnchorName)
.setStream(mStream)
.setLiveUid(mLiveUid)
+ .setOnDismissListener(dialog1 -> {
+ checkNewLetter();
+ })
.showDialog();
loading.dismiss();
}
@@ -5153,6 +5156,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
.setAnchorName(mAnchorName)
.setStream(mStream)
.setLiveUid(mLiveUid)
+ .setOnDismissListener(dialog1 -> {
+ checkNewLetter();
+ })
.showDialog();
loading.dismiss();
}