补充信箱角标点亮和防抖

This commit is contained in:
zlzw 2023-07-18 18:09:27 +08:00
parent 4729f93515
commit 1e4b0bb536
2 changed files with 37 additions and 8 deletions

View File

@ -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(
"<font color='#5993FF'>"+mContext.getString(R.string.live_details_sned_gift_text1)+"</font>" +
"<font color='#5993FF'>" + mContext.getString(R.string.live_details_sned_gift_text1) + "</font>" +
"&nbsp<font color='#FFC300'>" + bean.getName() + "</font>&nbsp" +
"<font color='#5993FF'>"+mContext.getString(R.string.live_details_sned_gift_text2)+"</font>" +
"<font color='#5993FF'>" + mContext.getString(R.string.live_details_sned_gift_text2) + "</font>" +
"&nbsp<font color='#FFC300'>" + anchorName + "</font>&nbsp" +
"<font color='#5993FF'>"+mContext.getString(R.string.live_details_sned_gift_text3)+"</font>"
"<font color='#5993FF'>" + mContext.getString(R.string.live_details_sned_gift_text3) + "</font>"
);
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();
}
});
}
}

View File

@ -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();
}