新增获取联系方式的弹框新样式
This commit is contained in:
parent
410fcb5895
commit
4729f93515
@ -9,7 +9,7 @@ import com.lxj.xpopup.core.BottomPopupView;
|
|||||||
|
|
||||||
|
|
||||||
public abstract class AbsDialogPopupWindow extends BottomPopupView {
|
public abstract class AbsDialogPopupWindow extends BottomPopupView {
|
||||||
private final Context mContext;
|
public final Context mContext;
|
||||||
|
|
||||||
public AbsDialogPopupWindow(@NonNull Context context) {
|
public AbsDialogPopupWindow(@NonNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
@ -0,0 +1,154 @@
|
|||||||
|
package com.yunbao.live.dialog;
|
||||||
|
|
||||||
|
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.text.Spanned;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.lxj.xpopup.XPopup;
|
||||||
|
import com.yunbao.common.bean.LiveGiftBean;
|
||||||
|
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.live.R;
|
||||||
|
import com.yunbao.live.http.LiveHttpUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class LiveContactDetailsSendGiftDialog extends AbsDialogPopupWindow {
|
||||||
|
TextView title;
|
||||||
|
TextView giftName;
|
||||||
|
TextView diamond;
|
||||||
|
ImageView giftIcon;
|
||||||
|
|
||||||
|
int giftId;
|
||||||
|
String anchorName;
|
||||||
|
private String mLiveUid;
|
||||||
|
private String mStream;
|
||||||
|
LiveGiftBean bean;
|
||||||
|
|
||||||
|
public LiveContactDetailsSendGiftDialog(@NonNull Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveContactDetailsSendGiftDialog setGiftId(int giftId) {
|
||||||
|
this.giftId = giftId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveContactDetailsSendGiftDialog setLiveUid(String mLiveUid) {
|
||||||
|
this.mLiveUid = mLiveUid;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveContactDetailsSendGiftDialog setStream(String mStream) {
|
||||||
|
this.mStream = mStream;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveContactDetailsSendGiftDialog setAnchorName(String anchorName) {
|
||||||
|
this.anchorName = anchorName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildDialog(XPopup.Builder builder) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int bindLayoutId() {
|
||||||
|
return R.layout.dialog_live_contact_details_gift;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
findViewById(R.id.back).setOnClickListener(v -> dismiss());
|
||||||
|
findViewById(R.id.send).setOnClickListener(v -> send());
|
||||||
|
|
||||||
|
title = findViewById(R.id.title);
|
||||||
|
giftIcon = findViewById(R.id.gift_icon);
|
||||||
|
giftName = findViewById(R.id.gift_name);
|
||||||
|
diamond = findViewById(R.id.diamond);
|
||||||
|
|
||||||
|
initData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
LiveHttpUtil.getNewGiftList(new HttpCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
if (code == 0 && info.length > 0) {
|
||||||
|
JSONObject obj = JSON.parseObject(info[0]);
|
||||||
|
JSONArray array = obj.getJSONArray("listarray");
|
||||||
|
List<LiveGiftBean> list = new ArrayList<>();
|
||||||
|
for (int i = 0; i < array.size(); i++) {
|
||||||
|
list.addAll(JSONArray.parseArray(array.getJSONObject(i).getJSONArray("giftlist").toJSONString(), LiveGiftBean.class));
|
||||||
|
}
|
||||||
|
for (LiveGiftBean bean : list) {
|
||||||
|
if (bean.getId() == giftId) {
|
||||||
|
setData(bean);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinish() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setData(LiveGiftBean bean) {
|
||||||
|
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='#FFC300'>" + bean.getName() + "</font> " +
|
||||||
|
"<font color='#5993FF'>"+mContext.getString(R.string.live_details_sned_gift_text2)+"</font>" +
|
||||||
|
" <font color='#FFC300'>" + anchorName + "</font> " +
|
||||||
|
"<font color='#5993FF'>"+mContext.getString(R.string.live_details_sned_gift_text3)+"</font>"
|
||||||
|
);
|
||||||
|
title.setText(spanned);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void send() {
|
||||||
|
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) {
|
||||||
|
new DialogUitl.Builder(mContext)
|
||||||
|
.setView(R.layout.dialog_live_unfollow)
|
||||||
|
.setConfirmString(mContext.getString(R.string.charge))
|
||||||
|
.setContent(mContext.getString(R.string.insufficient_balance))
|
||||||
|
.setClickCallback(new DialogUitl.SimpleCallback() {
|
||||||
|
@Override
|
||||||
|
public void onConfirmClick(Dialog dialog, String content) {
|
||||||
|
LiveContactDetailsSendGiftDialog.this.dismiss();
|
||||||
|
ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation();
|
||||||
|
}
|
||||||
|
}).build().show();
|
||||||
|
}else{
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -147,6 +147,7 @@ import com.yunbao.live.bean.WishlistItemModel;
|
|||||||
import com.yunbao.live.custom.LiveLightView;
|
import com.yunbao.live.custom.LiveLightView;
|
||||||
import com.yunbao.live.custom.RightGradual;
|
import com.yunbao.live.custom.RightGradual;
|
||||||
import com.yunbao.live.custom.TopGradual;
|
import com.yunbao.live.custom.TopGradual;
|
||||||
|
import com.yunbao.live.dialog.LiveContactDetailsSendGiftDialog;
|
||||||
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
|
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
|
||||||
import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
|
import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
|
||||||
import com.yunbao.live.dialog.LiveGameDialogFragment;
|
import com.yunbao.live.dialog.LiveGameDialogFragment;
|
||||||
@ -5073,17 +5074,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
.showDialog();
|
.showDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LiveGiftDialogFragment fragment = new LiveGiftDialogFragment();
|
new LiveContactDetailsSendGiftDialog(mContext)
|
||||||
fragment.setOnDismissListener(dialog -> checkNewLetter()
|
.setGiftId(data.getGiftId())
|
||||||
);
|
.setAnchorName(mAnchorName)
|
||||||
fragment.setOnShowListener(dialog -> mHandler.postDelayed(loading::dismiss, 500));
|
.setStream(mStream)
|
||||||
Bundle bundle = new Bundle();
|
.setLiveUid(mLiveUid)
|
||||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
.showDialog();
|
||||||
bundle.putString(Constants.LIVE_STREAM, mStream);
|
loading.dismiss();
|
||||||
bundle.putString(Constants.LIVE_WISH_GIFTID, data.getGiftId() + "");
|
|
||||||
bundle.putBoolean("isContactGift", true);
|
|
||||||
fragment.setArguments(bundle);
|
|
||||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -5151,17 +5148,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
.showDialog();
|
.showDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LiveGiftDialogFragment fragment = new LiveGiftDialogFragment();
|
new LiveContactDetailsSendGiftDialog(mContext)
|
||||||
fragment.setOnDismissListener(dialog -> checkNewLetter()
|
.setGiftId(data.getGiftId())
|
||||||
);
|
.setAnchorName(mAnchorName)
|
||||||
fragment.setOnShowListener(dialog -> mHandler.postDelayed(loading::dismiss, 500));
|
.setStream(mStream)
|
||||||
Bundle bundle = new Bundle();
|
.setLiveUid(mLiveUid)
|
||||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
.showDialog();
|
||||||
bundle.putString(Constants.LIVE_STREAM, mStream);
|
loading.dismiss();
|
||||||
bundle.putString(Constants.LIVE_WISH_GIFTID, data.getGiftId() + "");
|
|
||||||
bundle.putBoolean("isContactGift", true);
|
|
||||||
fragment.setArguments(bundle);
|
|
||||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
9
live/src/main/res/drawable/background_d6e8fe.xml
Normal file
9
live/src/main/res/drawable/background_d6e8fe.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<corners android:topLeftRadius="30dp" android:topRightRadius="30dp"/>
|
||||||
|
<solid android:color="#D6E8FE" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:width="96dp" android:height="22dp">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<stroke android:width="1dp" android:color="#00000000" />
|
||||||
|
<gradient android:type="linear" android:useLevel="true" android:startColor="#FFA900" android:endColor="#FFC300" android:angle="270" />
|
||||||
|
<corners android:topLeftRadius="22dp" android:topRightRadius="22dp" android:bottomLeftRadius="22dp" android:bottomRightRadius="22dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
144
live/src/main/res/layout/dialog_live_contact_details_gift.xml
Normal file
144
live/src/main/res/layout/dialog_live_contact_details_gift.xml
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/background_d6e8fe">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/back"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginStart="22.5dp"
|
||||||
|
android:layout_marginTop="7dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:srcCompat="@mipmap/ic_contact_details_back" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="235dp"
|
||||||
|
android:layout_marginTop="28dp"
|
||||||
|
android:layout_marginBottom="19dp"
|
||||||
|
android:background="@mipmap/bg_live_user_mailbox"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="#3399FF"
|
||||||
|
android:textSize="18sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="赠送时光怀表会获得到用户_98274的信件与联系方式" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/tip"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="28.5dp"
|
||||||
|
android:layout_marginBottom="6.5dp"
|
||||||
|
android:gravity="start"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp">
|
||||||
|
|
||||||
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@color/white"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:riv_oval="true" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/gift_icon"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/gift_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="3dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="bottom"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="10sp"
|
||||||
|
tools:text="TextView" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="12dp"
|
||||||
|
android:layout_height="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
app:srcCompat="@mipmap/diamond" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/diamond"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="10sp"
|
||||||
|
tools:text="20000" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/send"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="28.5dp"
|
||||||
|
android:layout_marginBottom="13.5dp"
|
||||||
|
android:background="@drawable/bg_item_live_send_details_gift"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingEnd="10dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
android:text="@string/live_details_send_gift_btn"
|
||||||
|
android:textColor="#FFF"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
BIN
live/src/main/res/mipmap-xhdpi/ic_contact_details_back.png
Normal file
BIN
live/src/main/res/mipmap-xhdpi/ic_contact_details_back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
@ -93,4 +93,8 @@
|
|||||||
<string name="minute">Minute</string>
|
<string name="minute">Minute</string>
|
||||||
<string name="live_setting_silence_title">Please select</string>
|
<string name="live_setting_silence_title">Please select</string>
|
||||||
<string name="live_ban_tip">You have been banned</string>
|
<string name="live_ban_tip">You have been banned</string>
|
||||||
|
<string name="live_details_send_gift_btn">Confirm</string>
|
||||||
|
<string name="live_details_sned_gift_text1">Give</string>
|
||||||
|
<string name="live_details_sned_gift_text2">Obtain the</string>
|
||||||
|
<string name="live_details_sned_gift_text3">letter and contact information</string>
|
||||||
</resources>
|
</resources>
|
@ -91,4 +91,8 @@
|
|||||||
<string name="minute">分鐘</string>
|
<string name="minute">分鐘</string>
|
||||||
<string name="live_setting_silence_title">請選擇禁言時間</string>
|
<string name="live_setting_silence_title">請選擇禁言時間</string>
|
||||||
<string name="live_ban_tip">您已被禁言</string>
|
<string name="live_ban_tip">您已被禁言</string>
|
||||||
|
<string name="live_details_send_gift_btn">確認獲取</string>
|
||||||
|
<string name="live_details_sned_gift_text1">贈送</string>
|
||||||
|
<string name="live_details_sned_gift_text2">會獲取到</string>
|
||||||
|
<string name="live_details_sned_gift_text3">的信件與聯繫方式</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user