update 粉丝团

This commit is contained in:
zlzw 2023-08-05 16:52:48 +08:00
parent c8f443c105
commit d912ad6119
20 changed files with 644 additions and 62 deletions

View File

@ -111,7 +111,7 @@ android {
applicationVariants.all { variant ->
println "清空build文件夹";
for (final def project in rootProject.getAllprojects()) {
delete project.buildDir
// delete project.buildDir
println project.buildDir
}
String variantName = variant.name.capitalize()

View File

@ -0,0 +1,81 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
public class FansGroupGiftPack extends BaseModel{
@SerializedName("id")
private int id;
@SerializedName("quantity")
private int quantity;
@SerializedName("end_time")
private String endTime;
@SerializedName("giftname")
private String giftName;
@SerializedName("needcoin")
private String needCoin;
@SerializedName("gifticon")
private String icon;
public FansGroupGiftPack() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getGiftName() {
return giftName;
}
public void setGiftName(String giftName) {
this.giftName = giftName;
}
public String getNeedCoin() {
return needCoin;
}
public void setNeedCoin(String needCoin) {
this.needCoin = needCoin;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
@Override
public String toString() {
return "FansGroupGiftPack{" +
"id=" + id +
", quantity=" + quantity +
", endTime='" + endTime + '\'' +
", giftName='" + giftName + '\'' +
", needCoin='" + needCoin + '\'' +
", icon='" + icon + '\'' +
'}';
}
}

View File

@ -0,0 +1,150 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class FansGroupGiftPackInfo extends BaseModel {
@SerializedName("id")
private int id;
@SerializedName("description")
private String description;
@SerializedName("coin")
private String coin;
@SerializedName("data")
private List<Gift> data;
public FansGroupGiftPackInfo() {
}
public int getId() {
return id;
}
public String getCoin() {
return coin;
}
public void setCoin(String coin) {
this.coin = coin;
}
public void setId(int id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<Gift> getData() {
return data;
}
public void setData(List<Gift> data) {
this.data = data;
}
@Override
public String toString() {
return "FansGroupGiftPack{" +
"id=" + id +
", description='" + description + '\'' +
", coin='" + coin + '\'' +
", data=" + data +
'}';
}
public static class Gift {
@SerializedName("id")
private int id;
@SerializedName("name")
private String giftName;
@SerializedName("needcoin")
private String needCoin;
@SerializedName("src")
private String giftIcon;
@SerializedName("quantity")
private String quantity;
@SerializedName("restrict")
private int restrict;
@SerializedName("type")
private int type;
public Gift() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getGiftName() {
return giftName;
}
public void setGiftName(String giftName) {
this.giftName = giftName;
}
public String getNeedCoin() {
return needCoin;
}
public void setNeedCoin(String needCoin) {
this.needCoin = needCoin;
}
public String getGiftIcon() {
return giftIcon;
}
public void setGiftIcon(String giftIcon) {
this.giftIcon = giftIcon;
}
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
public int getRestrict() {
return restrict;
}
public void setRestrict(int restrict) {
this.restrict = restrict;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
@Override
public String toString() {
return "Gift{" +
"id=" + id +
", giftName='" + giftName + '\'' +
", needCoin='" + needCoin + '\'' +
", giftIcon='" + giftIcon + '\'' +
", quantity='" + quantity + '\'' +
", restrict='" + restrict + '\'' +
", type=" + type +
'}';
}
}
}

View File

@ -0,0 +1,39 @@
package com.yunbao.common.dialog;
import android.content.Context;
import androidx.annotation.NonNull;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.CenterPopupView;
/**
* 居中弹窗
*/
public abstract class AbsDialogCenterPopupWindow extends CenterPopupView {
public final Context mContext;
public AbsDialogCenterPopupWindow(@NonNull Context context) {
super(context);
this.mContext = context;
}
/**
* <a href="https://github.com/li-xiaojun/XPopup/wiki/5.-%E5%B8%B8%E7%94%A8%E8%AE%BE%E7%BD%AE">参考配置</a>
*/
public abstract void buildDialog(XPopup.Builder builder);
public abstract int bindLayoutId();
@Override
protected int getImplLayoutId() {
return bindLayoutId();
}
public void showDialog() {
XPopup.Builder builder = new XPopup.Builder(mContext);
builder.isDestroyOnDismiss(true);
builder.enableDrag(false);
buildDialog(builder);
builder.asCustom(this).show();
}
}

View File

@ -12,6 +12,8 @@ import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.DiscountsModel;
import com.yunbao.common.bean.EnterRoomNewModel;
import com.yunbao.common.bean.FaceBookUpModel;
import com.yunbao.common.bean.FansGroupGiftPack;
import com.yunbao.common.bean.FansGroupGiftPackInfo;
import com.yunbao.common.bean.GiftAlreadyWallModel;
import com.yunbao.common.bean.GiftGuideModel;
import com.yunbao.common.bean.GiftWallGiftDetail;
@ -844,6 +846,7 @@ public interface PDLiveApi {
/**
* 设置系统默认头像
*
* @param id 头像id
*/
@GET("/api/public/?service=Userhome.setAvatar")
@ -915,4 +918,30 @@ public interface PDLiveApi {
@GET("/api/public/?service=Gift.getLiveMedalList")
Observable<ResponseModel<MedalAchievementModel>> getLiveMedalList(@Query("liveuid") String liveUid);
/**
* 获取粉丝团礼物信息
* @param packId 礼包id
*/
@GET("/api/public/?service=Fans.getFansExclusivePack")
Observable<ResponseModel<FansGroupGiftPackInfo>> getFansExclusivePack(@Query("liveuid") String liveUid,
@Query("pack_id") String packId
);
/**
* 购买粉丝团礼包
* @param packId 礼包id
*/
@GET("/api/public/?service=Fans.buyFansExclusivePack")
Observable<ResponseModel<HttpCallbackModel>> buyFansExclusivePack(@Query("liveuid") String liveUid,
@Query("pack_id") String packId,
@Query("stream") String stream
);
/**
* 获取粉丝团礼物包裹
*/
@GET("/api/public/?service=Fans.userFansExclusivePackList")
Observable<ResponseModel<List<FansGroupGiftPack>>> userFansExclusivePackList(@Query("liveuid") String liveUid);
}

View File

@ -13,6 +13,8 @@ import com.yunbao.common.bean.CheckLiveModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.DiscountsModel;
import com.yunbao.common.bean.EnterRoomNewModel;
import com.yunbao.common.bean.FansGroupGiftPack;
import com.yunbao.common.bean.FansGroupGiftPackInfo;
import com.yunbao.common.bean.GiftAlreadyWallModel;
import com.yunbao.common.bean.GiftGuideModel;
import com.yunbao.common.bean.GiftWallGiftDetail;
@ -64,7 +66,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import retrofit2.http.Query;
/**
@ -1802,6 +1803,7 @@ public class LiveNetManager {
}
}).isDisposed();
}
public void getSystemUserAvatar(HttpCallback<List<UserAvatarSelectBean>> callback) {
API.get().pdLiveApi(mContext)
.getSystemUserAvatar()
@ -1825,6 +1827,7 @@ public class LiveNetManager {
}
}).isDisposed();
}
public void setSystemUserAvatar(int id, HttpCallback<String> callback) {
API.get().pdLiveApi(mContext)
.setSystemUserAvatar(id)
@ -2047,6 +2050,72 @@ public class LiveNetManager {
}).isDisposed();
}
public void getFansExclusivePack(String liveUid, String packId, HttpCallback<FansGroupGiftPackInfo> callback) {
API.get().pdLiveApi(mContext)
.getFansExclusivePack(liveUid, packId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<FansGroupGiftPackInfo>>() {
@Override
public void accept(ResponseModel<FansGroupGiftPackInfo> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(listResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
public void buyFansExclusivePack(String liveUid, String packId,String stream, HttpCallback<HttpCallbackModel> callback) {
API.get().pdLiveApi(mContext)
.buyFansExclusivePack(liveUid, packId,stream)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<HttpCallbackModel>>() {
@Override
public void accept(ResponseModel<HttpCallbackModel> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(listResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
public void userFansExclusivePackList(String liveUid, HttpCallback<List<FansGroupGiftPack>> callback) {
API.get().pdLiveApi(mContext)
.userFansExclusivePackList(liveUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<FansGroupGiftPack>>>() {
@Override
public void accept(ResponseModel<List<FansGroupGiftPack>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(listResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
/**
* 直播间取消网络请求
*/

View File

@ -963,7 +963,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
if (!mIsAnchor) {
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u != null && u.getLevel() < mChatLevel) {
ToastUtil.show(String.format(mContext.getString(R.string.live_level_chat_limit), mChatLevel));
ToastUtil.show(String.format(mContext.getString(R.string.live_level_chat_limit), mChatLevel+""));
return;
}
}
@ -1277,6 +1277,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
} else {
bundle.putString(Constants.URL, CommonAppConfig.HOST + "/h5/live/fansClub.html" + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + uid);
}
bundle.putString("liveUid",mLiveUid);
bundle.putString("anchorName",mAncherName);
bundle.putString("mStream",mStream);
fragment.setArguments(bundle);
fragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment");
}

View File

@ -1068,6 +1068,9 @@ public class LiveAudienceActivity extends LiveActivity {
"?uid=" + userInfo.getId() +
"&token=" + userInfo.getToken() + "&anchorUid=" + mLiveUid);
}
bundle.putString("liveUid",mLiveUid);
bundle.putString("anchorName",mAncherName);
bundle.putString("mStream",mStream);
liveFansFragment.setArguments(bundle);
liveFansFragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment");
break;

View File

@ -10,6 +10,8 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.FansGroupGiftPackInfo;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.live.R;
import java.util.ArrayList;
@ -17,14 +19,16 @@ import java.util.List;
public class LiveFansGroupBuyAdapter extends RecyclerView.Adapter<LiveFansGroupBuyAdapter.ViewHolder> {
Context mContext;
List<?> list=new ArrayList<>();
List<FansGroupGiftPackInfo.Gift> list = new ArrayList<>();
public LiveFansGroupBuyAdapter(Context mContext) {
this.mContext = mContext;
}
public void setList(List<?> list) {
public void setList(List<FansGroupGiftPackInfo.Gift> list) {
this.list.clear();
this.list = list;
notifyDataSetChanged();
}
@NonNull
@ -35,7 +39,7 @@ public class LiveFansGroupBuyAdapter extends RecyclerView.Adapter<LiveFansGroupB
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.setData(list.get(position));
}
@Override
@ -58,5 +62,24 @@ public class LiveFansGroupBuyAdapter extends RecyclerView.Adapter<LiveFansGroupB
introduce = itemView.findViewById(R.id.introduce);
diamondIcon = itemView.findViewById(R.id.diamondIcon);
}
public void setData(FansGroupGiftPackInfo.Gift gift) {
title.setText(gift.getGiftName());
introduce.setText(gift.getNeedCoin());
if (gift.getRestrict() > 0) {
day.setText(gift.getRestrict() + mContext.getString(R.string.bonus_day));
day.setVisibility(View.VISIBLE);
}else{
day.setVisibility(View.GONE);
}
try {
int i = Integer.parseInt(gift.getNeedCoin());
diamondIcon.setVisibility(View.VISIBLE);
} catch (Exception e) {
diamondIcon.setVisibility(View.GONE);
}
ImgLoader.display(mContext, gift.getGiftIcon(), giftIcon);
}
}
}

View File

@ -10,21 +10,34 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.FansGroupGiftPack;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.http.LiveHttpUtil;
import java.util.ArrayList;
import java.util.List;
public class LiveFansGroupSendGiftAdapter extends RecyclerView.Adapter<LiveFansGroupSendGiftAdapter.ViewHolder> {
Context mContext;
List<?> list=new ArrayList<>();
List<FansGroupGiftPack> list = new ArrayList<>();
private OnItemClickListener<FansGroupGiftPack> onItemClickListener;
public LiveFansGroupSendGiftAdapter(Context mContext) {
this.mContext = mContext;
}
public void setList(List<?> list) {
public void setList(List<FansGroupGiftPack> list) {
this.list.clear();
this.list = list;
notifyDataSetChanged();
}
public void setOnItemClickListener(OnItemClickListener<FansGroupGiftPack> onItemClickListener) {
this.onItemClickListener = onItemClickListener;
}
@NonNull
@ -35,7 +48,7 @@ public class LiveFansGroupSendGiftAdapter extends RecyclerView.Adapter<LiveFansG
@Override
public void onBindViewHolder(@NonNull LiveFansGroupSendGiftAdapter.ViewHolder holder, int position) {
holder.setData(list.get(position));
}
@Override
@ -43,6 +56,7 @@ public class LiveFansGroupSendGiftAdapter extends RecyclerView.Adapter<LiveFansG
return list.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
private ImageView giftIcon;
private TextView day;
@ -56,5 +70,19 @@ public class LiveFansGroupSendGiftAdapter extends RecyclerView.Adapter<LiveFansG
title = itemView.findViewById(R.id.title);
send = itemView.findViewById(R.id.send);
}
public void setData(FansGroupGiftPack pack) {
if (pack.getQuantity() > 0) {
title.setText(pack.getGiftName()+" *"+pack.getQuantity());
} else {
title.setText(pack.getGiftName());
}
ImgLoader.display(mContext, pack.getIcon(), giftIcon);
ViewClicksAntiShake.clicksAntiShake(send, () -> {
if (onItemClickListener != null) {
onItemClickListener.onItemClick(pack, 0);
}
});
}
}
}

View File

@ -34,6 +34,9 @@ public class LiveFansFragment extends AbsDialogFragment {
private WebView mWebView;
private Activity mContext;
private String anchorName;
private String liveUid;
private String mStream;
public LiveFansFragment(Activity mContext) {
this.mContext = mContext;
@ -103,6 +106,9 @@ public class LiveFansFragment extends AbsDialogFragment {
if (bundle == null) {
return;
}
anchorName = bundle.getString("anchorName");
liveUid = bundle.getString("liveUid");
mStream = bundle.getString("mStream");
Log.e("tag", bundle.getString(Constants.URL));
mWebView.loadUrl(bundle.getString(Constants.URL));
}
@ -133,9 +139,19 @@ public class LiveFansFragment extends AbsDialogFragment {
dismiss();
} else if (TextUtils.equals(event.getMethod(), "androidFansGroupBuy")) {
String id = event.getUserId();
new LiveFansGroupBuyDialog(mContext).setGiftId(id).showDialog();
new LiveFansGroupBuyDialog(mContext)
.setGiftId(id)
.setAnchorName(anchorName)
.setLiveUid(liveUid)
.setSteam(mStream)
.showDialog();
dismiss();
} else if (TextUtils.equals(event.getMethod(), "androidFansGroupPack")) {
new LiveFansGroupSendGiftDialog(mContext).showDialog();
new LiveFansGroupSendGiftDialog(mContext)
.setLiveUid(liveUid)
.setStream(mStream)
.showDialog();
dismiss();
} else if (TextUtils.equals(event.getMethod(), "androidFansGroupInfo")) {
new LiveFansGroupInfoDialog(mContext).showDialog();
}

View File

@ -4,19 +4,30 @@ import android.content.Context;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.bean.FansGroupGiftPackInfo;
import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.dialog.AbsDialogCenterPopupWindow;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.adapter.LiveFansGroupBuyAdapter;
public class LiveFansGroupBuyDialog extends AbsDialogPopupWindow {
public class LiveFansGroupBuyDialog extends AbsDialogCenterPopupWindow {
private TextView anchorName;
private TextView buy;
private TextView giftInfo;
private RecyclerView recyclerView;
private LiveFansGroupBuyAdapter adapter;
private String id;
private String name;
private String liveUid;
private String mSteam;
public LiveFansGroupBuyDialog(@NonNull Context context) {
super(context);
@ -27,9 +38,25 @@ public class LiveFansGroupBuyDialog extends AbsDialogPopupWindow {
return this;
}
public LiveFansGroupBuyDialog setAnchorName(String anchorName) {
this.name = anchorName;
return this;
}
public LiveFansGroupBuyDialog setLiveUid(String liveUid) {
this.liveUid = liveUid;
return this;
}
public LiveFansGroupBuyDialog setSteam(String mSteam) {
this.mSteam = mSteam;
return this;
}
@Override
public void buildDialog(XPopup.Builder builder) {
builder.popupWidth(DpUtil.dp2px(370));
builder.maxWidth(DpUtil.dp2px(370));
}
@Override
@ -41,15 +68,51 @@ public class LiveFansGroupBuyDialog extends AbsDialogPopupWindow {
protected void onCreate() {
super.onCreate();
anchorName = findViewById(R.id.anchorName);
giftInfo = findViewById(R.id.giftInfo);
buy = findViewById(R.id.buy);
recyclerView = findViewById(R.id.giftList);
recyclerView.setLayoutManager(new LinearLayoutManager(mContext,LinearLayoutManager.HORIZONTAL,false){
@Override
public boolean canScrollHorizontally() {
return false;
}
});
adapter = new LiveFansGroupBuyAdapter(mContext);
recyclerView.setAdapter(adapter);
anchorName.setText(name);
buy.setOnClickListener(v -> {
LiveNetManager.get(mContext)
.buyFansExclusivePack(liveUid, id,mSteam, new HttpCallback<HttpCallbackModel>() {
@Override
public void onSuccess(HttpCallbackModel data) {
ToastUtil.show(data.getMsg());
dismiss();
}
@Override
public void onError(String error) {
}
});
});
initData();
}
private void initData() {
LiveNetManager.get(mContext)
.getFansExclusivePack(liveUid, id, new HttpCallback<FansGroupGiftPackInfo>() {
@Override
public void onSuccess(FansGroupGiftPackInfo data) {
adapter.setList(data.getData());
giftInfo.setText(data.getDescription());
buy.setText(String.format(mContext.getString(R.string.live_fans_group_buy_buy), data.getCoin()));
}
@Override
public void onError(String error) {
}
});
}
}

View File

@ -5,17 +5,20 @@ import android.content.Context;
import androidx.annotation.NonNull;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.dialog.AbsDialogCenterPopupWindow;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.live.R;
public class LiveFansGroupInfoDialog extends AbsDialogPopupWindow {
public class LiveFansGroupInfoDialog extends AbsDialogCenterPopupWindow {
public LiveFansGroupInfoDialog(@NonNull Context context) {
super(context);
}
@Override
public void buildDialog(XPopup.Builder builder) {
builder.popupWidth(DpUtil.dp2px(370));
builder.maxWidth(DpUtil.dp2px(370));
builder.dismissOnTouchOutside(false);
}
@Override

View File

@ -6,21 +6,43 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.bean.FansGroupGiftPack;
import com.yunbao.common.dialog.AbsDialogCenterPopupWindow;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.adapter.LiveFansGroupSendGiftAdapter;
import com.yunbao.live.http.LiveHttpUtil;
public class LiveFansGroupSendGiftDialog extends AbsDialogPopupWindow {
import java.util.List;
public class LiveFansGroupSendGiftDialog extends AbsDialogCenterPopupWindow {
private RecyclerView recyclerView;
private LiveFansGroupSendGiftAdapter adapter;
private String liveUid;
private String mStream;
public LiveFansGroupSendGiftDialog(@NonNull Context context) {
super(context);
}
public LiveFansGroupSendGiftDialog setLiveUid(String liveUid) {
this.liveUid = liveUid;
return this;
}
public LiveFansGroupSendGiftDialog setStream(String mStream) {
this.mStream = mStream;
return this;
}
@Override
public void buildDialog(XPopup.Builder builder) {
builder.popupWidth(DpUtil.dp2px(370));
builder.maxWidth(DpUtil.dp2px(370));
}
@Override
@ -33,6 +55,45 @@ public class LiveFansGroupSendGiftDialog extends AbsDialogPopupWindow {
super.onCreate();
recyclerView = findViewById(R.id.giftList);
adapter = new LiveFansGroupSendGiftAdapter(mContext);
adapter.setOnItemClickListener((bean, position) -> {
LiveHttpUtil.sendGift("0",
liveUid,
mStream,
bean.getId(),
"1",
0,
true,
new com.yunbao.common.http.HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
ToastUtil.show(msg);
System.err.println(">>>>>>>>>>>>>>>>>> code = " + code + "|msg = " + msg + "");
if (code == 0) {
// dismiss();
initData();
}
}
});
});
recyclerView.setAdapter(adapter);
initData();
}
private void initData() {
LiveNetManager.get(mContext)
.userFansExclusivePackList(liveUid, new HttpCallback<List<FansGroupGiftPack>>() {
@Override
public void onSuccess(List<FansGroupGiftPack> data) {
adapter.setList(data);
if (data.size() == 0) {
dismiss();
}
}
@Override
public void onError(String error) {
}
});
}
}

View File

@ -132,6 +132,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
EventBus.getDefault().post("checkNewLetter");
Bus.getOff(this);
}

View File

@ -619,15 +619,17 @@ public class LiveHttpUtil {
* 观众给主播送礼物
*/
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, HttpCallback callback) {
sendGift(by, liveUid, stream, giftId, giftCount, 0, callback);
sendGift(by, liveUid, stream, giftId, giftCount, 0, false,callback);
}
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, HttpCallback callback) {
sendGift(by, liveUid, stream, giftId, giftCount, isContactGift, false,callback);
}
/**
* 观众给主播送礼物
*
* @param isContactGift 是否为联系方式礼物
*/
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, HttpCallback callback) {
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, boolean isFansGroupGift,HttpCallback callback) {
HttpClient.getInstance().get("Live.sendGift", LiveHttpConsts.SEND_GIFT)
.params("liveuid", liveUid)
.params("stream", stream)
@ -635,6 +637,7 @@ public class LiveHttpUtil {
.params("isContactGift", isContactGift)
.params("giftcount", giftCount)
.params("isprank", by)
.params("fans_exclusive_pack",isFansGroupGift?"1":"0")
.params("appVersion", CommonAppConfig.getInstance().getVersion())
.execute(callback);
}

View File

@ -453,6 +453,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
}
}
}else if("checkNewLetter".equals(str)){
checkNewLetter();
}
}
@ -5226,12 +5228,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
.showDialog();
return;
}
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
.setmLiveUid(mLiveUid)
.setmStream(mStream)
.setmWishGiftId(data.getGiftId() + "")
.setIsContactGift(true));
new LiveContactDetailsSendGiftDialog(mContext)
.setGiftId(data.getGiftId())
.setAnchorName(mAnchorName)
.setStream(mStream)
.setLiveUid(mLiveUid)
.setOnDismissListener(dialog1 -> {
checkNewLetter();
})
.showDialog();
loading.dismiss();
}
@ -5303,12 +5308,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
.showDialog();
return;
}
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)
.setmLiveUid(mLiveUid)
.setmStream(mStream)
.setmWishGiftId(data.getGiftId() + "")
.setIsContactGift(true));
new LiveContactDetailsSendGiftDialog(mContext)
.setGiftId(data.getGiftId())
.setAnchorName(mAnchorName)
.setStream(mStream)
.setLiveUid(mLiveUid)
.setOnDismissListener(dialog1 -> {
checkNewLetter();
})
.showDialog();
loading.dismiss();
}

View File

@ -60,7 +60,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/giftList"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="130dp"
android:layout_marginStart="25dp"
android:layout_marginTop="19dp"
@ -70,8 +70,8 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/giftInfo"
app:layout_constraintWidth_max="310dp"
tools:itemCount="3"
tools:listitem="@layout/item_fans_group_buy_list" />
<TextView

View File

@ -3,10 +3,10 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="94dp"
android:background="@mipmap/icon_fans_group_buy_dialog_item"
android:layout_marginEnd="30dp"
android:layout_height="125dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="3dp"
android:layout_height="125dp">
android:background="@mipmap/icon_fans_group_buy_dialog_item">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/iconLayout"
@ -38,14 +38,16 @@
android:layout_width="27dp"
android:layout_height="12dp"
android:layout_marginTop="3dp"
android:textSize="8sp"
android:textColor="#7059BB"
tools:text="1天"
android:gravity="center"
android:layout_marginEnd="4dp"
android:background="@mipmap/icon_fans_group_buy_dialog_day"
android:gravity="center"
android:textColor="#7059BB"
android:textSize="8sp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
tools:text="1天"
tools:visibility="visible" />
<TextView
android:id="@+id/title"
@ -62,13 +64,13 @@
android:id="@+id/introduce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:layout_marginBottom="6dp"
tools:text="5200"
android:textColor="#FFFFFF"
android:textSize="11sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
tools:text="5200" />
<ImageView
android:id="@+id/diamondIcon"

View File

@ -112,7 +112,7 @@
<string name="live_fans_group_send_title">Currently Available To Send</string>
<string name="live_fans_group_buy_title">The Perfect GiftPack</string>
<string name="live_fans_group_buy_info">Purchase a %s Diamond Specific Gift And Receive ALimited Resource</string>
<string name="live_fans_group_buy_buy">Diamond Purchase</string>
<string name="live_fans_group_buy_buy">%s Diamond</string>
<string name="live_fans_group_enter_room">Welcome fan group to enter the room</string>
<string name="live_fans_group_send_gift_tips">Fan group level Of Lv%s Can send this gift</string>
</resources>