新版守护,空页面,列表页面。守护类型开通页面。开通时间页面

This commit is contained in:
18401019693 2024-03-06 14:24:04 +08:00
parent 8af7f907eb
commit 6870037683
64 changed files with 2484 additions and 74 deletions

View File

@ -223,6 +223,8 @@ dependencies {
// //
api 'com.github.FlyJingFish:GradientTextView:1.2.4' api 'com.github.FlyJingFish:GradientTextView:1.2.4'
//
api 'com.github.xiaohaibin:XBanner:androidx_v1.2.6'
} }

View File

@ -0,0 +1,46 @@
package com.yunbao.common.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.views.LiveBuyGuardPrivilegeViewHolder;
import java.util.ArrayList;
import java.util.List;
public class LiveBuyGuardPrivilegeAdapter extends RecyclerView.Adapter {
List<String> guardPrivilege = new ArrayList<>();
public void setGuardPrivilege(List<String> privilege) {
guardPrivilege.clear();
guardPrivilege.addAll(privilege);
notifyDataSetChanged();
}
public LiveBuyGuardPrivilegeAdapter(List<String> guardPrivilege) {
this.guardPrivilege = guardPrivilege;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_buy_guard_privilege_item, parent, false);
return new LiveBuyGuardPrivilegeViewHolder(herdView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
LiveBuyGuardPrivilegeViewHolder buyGuardSelectViewHolder = (LiveBuyGuardPrivilegeViewHolder) holder;
buyGuardSelectViewHolder.setData(guardPrivilege.get(position));
}
@Override
public int getItemCount() {
return guardPrivilege.size();
}
}

View File

@ -0,0 +1,48 @@
package com.yunbao.common.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.GuardPriceModel;
import com.yunbao.common.views.LiveBuyGuardSelectViewHolder;
import java.util.ArrayList;
import java.util.List;
public class LiveBuyGuardSelectAdapter extends RecyclerView.Adapter {
List<GuardPriceModel> price = new ArrayList<>();
public LiveBuyGuardSelectAdapter(List<GuardPriceModel> price) {
this.price = price;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View herdView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_buy_guard_slelect_item, parent, false);
return new LiveBuyGuardSelectViewHolder(herdView);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
LiveBuyGuardSelectViewHolder buyGuardSelectViewHolder = (LiveBuyGuardSelectViewHolder) holder;
buyGuardSelectViewHolder.setData(price.get(position), liveBuyGuardSelectClickListener);
}
@Override
public int getItemCount() {
return price.size();
}
private LiveBuyGuardSelectViewHolder.LiveBuyGuardSelectClickListener liveBuyGuardSelectClickListener;
public LiveBuyGuardSelectAdapter setLiveBuyGuardSelectClickListener(LiveBuyGuardSelectViewHolder.LiveBuyGuardSelectClickListener liveBuyGuardSelectClickListener) {
this.liveBuyGuardSelectClickListener = liveBuyGuardSelectClickListener;
return this;
}
}

View File

@ -0,0 +1,136 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class GuardDataTipModel extends BaseModel {
/**
* {
* "guard_name": "星之守護", // 守护名称
* "guard_type": 1, // 守护类型
* "close_img": "https://ceshi.yaoulive.com/data/upload/20240304/guard_xing_close.png", // 未开通图标
* "open_img": "https://ceshi.yaoulive.com/data/upload/20240304/guard_xing_open.png", // 已开通图标
* "is_open": true, // 是否开通 .true .false
* "price": { // 价格
* {
* "opening_time": "1個月", // 开通时长
* "original_price": "188000", // 原价
* "discount_price": "", // 折扣价
* "discount": "", // 折扣
* "price_key": 1
* },
* {
* "opening_time": "3個月",
* "original_price": "564000",
* "discount_price": "398000",
* "discount": "7.1折",
* "price_key": 3
* },
* {
* "opening_time": "6個月",
* "original_price": "1128000",
* "discount_price": "738000",
* "discount": "6.5折",
* "price_key": 6
* },
* {
* "opening_time": "12個月",
* "original_price": "2256000",
* "discount_price": "1314000",
* "discount": "5.8折",
* "price_key": 12
* }
* ],
* "guard_privilege": [
* "https://ceshi.yaoulive.com/data/upload/20240304/tequan_1.png",
* "https://ceshi.yaoulive.com/data/upload/20240304/tequan_2.png",
* "https://ceshi.yaoulive.com/data/upload/20240304/tequan_3.png",
* "https://ceshi.yaoulive.com/data/upload/20240304/tequan_1.png",
* "https://ceshi.yaoulive.com/data/upload/20240304/tequan_2.png",
* "https://ceshi.yaoulive.com/data/upload/20240304/tequan_3.png",
* "https://ceshi.yaoulive.com/data/upload/20240304/tequan_1.png",
* "https://ceshi.yaoulive.com/data/upload/20240304/tequan_1.png",
* "https://ceshi.yaoulive.com/data/upload/20240304/tequan_2.png",
* "https://ceshi.yaoulive.com/data/upload/20240304/tequan_3.png"
* ]
* }
*/
@SerializedName("guard_name")
private String guardName;
@SerializedName("guard_type")
private int guardType;
@SerializedName("close_img")
private String closeImg;
@SerializedName("open_img")
private String openImg;
@SerializedName("is_open")
private boolean isOpen;
@SerializedName("price")
private List<GuardPriceModel> price;
@SerializedName("guard_privilege")
private List<String> guardPrivilege;
public String getGuardName() {
return guardName;
}
public GuardDataTipModel setGuardName(String guardName) {
this.guardName = guardName;
return this;
}
public int getGuardType() {
return guardType;
}
public GuardDataTipModel setGuardType(int guardType) {
this.guardType = guardType;
return this;
}
public String getCloseImg() {
return closeImg;
}
public GuardDataTipModel setCloseImg(String closeImg) {
this.closeImg = closeImg;
return this;
}
public String getOpenImg() {
return openImg;
}
public GuardDataTipModel setOpenImg(String openImg) {
this.openImg = openImg;
return this;
}
public boolean isOpen() {
return isOpen;
}
public GuardDataTipModel setOpen(boolean open) {
isOpen = open;
return this;
}
public List<GuardPriceModel> getPrice() {
return price;
}
public GuardDataTipModel setPrice(List<GuardPriceModel> price) {
this.price = price;
return this;
}
public List<String> getGuardPrivilege() {
return guardPrivilege;
}
public GuardDataTipModel setGuardPrivilege(List<String> guardPrivilege) {
this.guardPrivilege = guardPrivilege;
return this;
}
}

View File

@ -0,0 +1,31 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class GuardGetGuardOpenInfoModel extends BaseModel {
@SerializedName("user_info")
private GuardUserInfoModel userInfo;
@SerializedName("guard_data")
private List<GuardDataTipModel> guardData;
public GuardUserInfoModel getUserInfo() {
return userInfo;
}
public GuardGetGuardOpenInfoModel setUserInfo(GuardUserInfoModel userInfo) {
this.userInfo = userInfo;
return this;
}
public List<GuardDataTipModel> getGuardData() {
return guardData;
}
public GuardGetGuardOpenInfoModel setGuardData(List<GuardDataTipModel> guardData) {
this.guardData = guardData;
return this;
}
}

View File

@ -0,0 +1,131 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
public class GuardGetGuardUserInfoModel extends BaseModel {
/**
* "info": {
* "uid": "98923", // 用户ID
* "user_avatar": "https://downs.yaoulive.com/20230706/0572c0f694601f4d2695cd210effbe93.jpeg?imageView2/2/w/600/h/600", // 用户头像链接
* "liveuid": "98889", // 主播ID
* "live_avatar": "https://ceshi.yaoulive.com/data/upload/20230522/20230526102906.png", // 主播头像链接
* "guard_type": 0, // 守护类型 0.未开通 1.星之守护 2.王之守护 3.神之守护
* "exp": 0, // 守护经验值
* "level": 0, // 守护等级
* "endtime": 0, // 到期时间
* "user_language": "chinese",
* "live_language": "chinese"
* }
* }
*/
@SerializedName("uid")
private String uid;
@SerializedName("user_avatar")
private String userAvatar;
@SerializedName("liveuid")
private String liveuid;
@SerializedName("live_avatar")
private String liveAvatar;
@SerializedName("guard_type")
private int guardType;
@SerializedName("exp")
private int exp;
@SerializedName("level")
private int level;
@SerializedName("endtime")
private int endtime;
@SerializedName("user_language")
private String userLanguage;
@SerializedName("live_language")
private String liveLanguage;
public String getUid() {
return uid;
}
public GuardGetGuardUserInfoModel setUid(String uid) {
this.uid = uid;
return this;
}
public String getUserAvatar() {
return userAvatar;
}
public GuardGetGuardUserInfoModel setUserAvatar(String userAvatar) {
this.userAvatar = userAvatar;
return this;
}
public String getLiveuid() {
return liveuid;
}
public GuardGetGuardUserInfoModel setLiveuid(String liveuid) {
this.liveuid = liveuid;
return this;
}
public String getLiveAvatar() {
return liveAvatar;
}
public GuardGetGuardUserInfoModel setLiveAvatar(String liveAvatar) {
this.liveAvatar = liveAvatar;
return this;
}
public int getGuardType() {
return guardType;
}
public GuardGetGuardUserInfoModel setGuardType(int guardType) {
this.guardType = guardType;
return this;
}
public int getExp() {
return exp;
}
public GuardGetGuardUserInfoModel setExp(int exp) {
this.exp = exp;
return this;
}
public int getLevel() {
return level;
}
public GuardGetGuardUserInfoModel setLevel(int level) {
this.level = level;
return this;
}
public int getEndtime() {
return endtime;
}
public GuardGetGuardUserInfoModel setEndtime(int endtime) {
this.endtime = endtime;
return this;
}
public String getUserLanguage() {
return userLanguage;
}
public GuardGetGuardUserInfoModel setUserLanguage(String userLanguage) {
this.userLanguage = userLanguage;
return this;
}
public String getLiveLanguage() {
return liveLanguage;
}
public GuardGetGuardUserInfoModel setLiveLanguage(String liveLanguage) {
this.liveLanguage = liveLanguage;
return this;
}
}

View File

@ -0,0 +1,70 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
public class GuardPriceModel extends BaseModel {
/**
* {
* "opening_time": "1個月", // 开通时长
* "original_price": "188000", // 原价
* "discount_price": "", // 折扣价
* "discount": "", // 折扣
* "price_key": 1
* }
*/
@SerializedName("opening_time")
private String openingTime;
@SerializedName("original_price")
private String originalPrice;
@SerializedName("discount_price")
private String discountPrice;
@SerializedName("discount")
private String discount;
@SerializedName("price_key")
private int priceKey;
public String getOpeningTime() {
return openingTime;
}
public GuardPriceModel setOpeningTime(String openingTime) {
this.openingTime = openingTime;
return this;
}
public String getOriginalPrice() {
return originalPrice;
}
public GuardPriceModel setOriginalPrice(String originalPrice) {
this.originalPrice = originalPrice;
return this;
}
public String getDiscountPrice() {
return discountPrice;
}
public GuardPriceModel setDiscountPrice(String discountPrice) {
this.discountPrice = discountPrice;
return this;
}
public String getDiscount() {
return discount;
}
public GuardPriceModel setDiscount(String discount) {
this.discount = discount;
return this;
}
public int getPriceKey() {
return priceKey;
}
public GuardPriceModel setPriceKey(int priceKey) {
this.priceKey = priceKey;
return this;
}
}

View File

@ -0,0 +1,131 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
public class GuardUserInfoModel extends BaseModel {
/**
* {
* "user_info": { // 用户开通信息
* "uid": "98888", // 用户ID
* "user_avatar": "https://downs.yaoulive.com/mannine.png", // 用户头像链接
* "liveuid": "98889", // 主播ID
* "live_avatar": "https://ceshi.yaoulive.com/data/upload/20230522/20230526102906.png", // 主播头像链接
* "guard_type": 1, // 守护类型
* "exp": 0, // 经验值
* "level": 1, // 等级
* "endtime": 1710145929, // 到期时间
* "user_language": "chinese", // 用户语言
* "live_language": "chinese" // 主播语言
* }
*/
@SerializedName("uid")
private String uid;
@SerializedName("user_avatar")
private String userAvatar;
@SerializedName("liveuid")
private String liveuid;
@SerializedName("live_avatar")
private String liveAvatar;
@SerializedName("guard_type")
private int guardType;
@SerializedName("exp")
private int exp;
@SerializedName("level")
private int level;
@SerializedName("endtime")
private int endtime;
@SerializedName("user_language")
private String userLanguage;
@SerializedName("live_language")
private String liveLanguage;
public String getUid() {
return uid;
}
public GuardUserInfoModel setUid(String uid) {
this.uid = uid;
return this;
}
public String getUserAvatar() {
return userAvatar;
}
public GuardUserInfoModel setUserAvatar(String userAvatar) {
this.userAvatar = userAvatar;
return this;
}
public String getLiveuid() {
return liveuid;
}
public GuardUserInfoModel setLiveuid(String liveuid) {
this.liveuid = liveuid;
return this;
}
public String getLiveAvatar() {
return liveAvatar;
}
public GuardUserInfoModel setLiveAvatar(String liveAvatar) {
this.liveAvatar = liveAvatar;
return this;
}
public int getGuardType() {
return guardType;
}
public GuardUserInfoModel setGuardType(int guardType) {
this.guardType = guardType;
return this;
}
public int getExp() {
return exp;
}
public GuardUserInfoModel setExp(int exp) {
this.exp = exp;
return this;
}
public int getLevel() {
return level;
}
public GuardUserInfoModel setLevel(int level) {
this.level = level;
return this;
}
public int getEndtime() {
return endtime;
}
public GuardUserInfoModel setEndtime(int endtime) {
this.endtime = endtime;
return this;
}
public String getUserLanguage() {
return userLanguage;
}
public GuardUserInfoModel setUserLanguage(String userLanguage) {
this.userLanguage = userLanguage;
return this;
}
public String getLiveLanguage() {
return liveLanguage;
}
public GuardUserInfoModel setLiveLanguage(String liveLanguage) {
this.liveLanguage = liveLanguage;
return this;
}
}

View File

@ -0,0 +1,127 @@
package com.yunbao.common.dialog;
import android.content.Context;
import android.content.DialogInterface;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.core.AttachPopupView;
import com.yunbao.common.R;
import com.yunbao.common.adapter.LiveBuyGuardSelectAdapter;
import com.yunbao.common.bean.GuardPriceModel;
import com.yunbao.common.views.LiveBuyGuardSelectViewHolder;
import java.util.ArrayList;
import java.util.List;
public class LiveBuyGuardSelectPopup extends AttachPopupView {
private int mType;
private DialogInterface.OnDismissListener onDismissListener;
private LiveBuyGuardSelectListener buyGuardSelectListener;
List<GuardPriceModel> price = new ArrayList<>();
LiveBuyGuardSelectAdapter liveBuyGuardSelectAdapter;
RecyclerView live_buy_guard_list;
public LiveBuyGuardSelectPopup(@NonNull Context context, List<GuardPriceModel> mPrice) {
super(context);
price = mPrice;
}
protected int getImplLayoutId() {
return R.layout.view_live_buy_guard_slelect;
}
@Override
protected void onCreate() {
live_buy_guard_list = findViewById(R.id.live_buy_guard_list);
liveBuyGuardSelectAdapter = new LiveBuyGuardSelectAdapter(price);
live_buy_guard_list.setAdapter(liveBuyGuardSelectAdapter);
live_buy_guard_list.setLayoutManager(new LinearLayoutManager(getContext()));
liveBuyGuardSelectAdapter.setLiveBuyGuardSelectClickListener(new LiveBuyGuardSelectViewHolder.LiveBuyGuardSelectClickListener() {
@Override
public void onClickListener(GuardPriceModel guardPriceModel) {
dialog.dismiss();
if (onDismissListener != null) {
onDismissListener.onDismiss(null);
}
if (buyGuardSelectListener != null) {
buyGuardSelectListener.onLiveBuyGuardSelectListener(guardPriceModel);
}
}
});
// ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.one_month), new ViewClicksAntiShake.ViewClicksCallBack() {
// @Override
// public void onViewClicks() {
// dialog.dismiss();
// if (onDismissListener != null) {
// onDismissListener.onDismiss(null);
// }
// if (buyGuardSelectListener != null) {
// buyGuardSelectListener.onLiveBuyGuardSelectListener(0);
// }
// }
// });
// ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.tree_month), new ViewClicksAntiShake.ViewClicksCallBack() {
// @Override
// public void onViewClicks() {
// dialog.dismiss();
// if (onDismissListener != null) {
// onDismissListener.onDismiss(null);
// }
// if (buyGuardSelectListener != null) {
// buyGuardSelectListener.onLiveBuyGuardSelectListener(1);
// }
// }
// });
// ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.six_month), new ViewClicksAntiShake.ViewClicksCallBack() {
// @Override
// public void onViewClicks() {
// dialog.dismiss();
// if (onDismissListener != null) {
// onDismissListener.onDismiss(null);
// }
// if (buyGuardSelectListener != null) {
// buyGuardSelectListener.onLiveBuyGuardSelectListener(2);
// }
// }
// });
// ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.one_two_month), new ViewClicksAntiShake.ViewClicksCallBack() {
// @Override
// public void onViewClicks() {
// dialog.dismiss();
// if (onDismissListener != null) {
// onDismissListener.onDismiss(null);
// }
// if (buyGuardSelectListener != null) {
// buyGuardSelectListener.onLiveBuyGuardSelectListener(3);
// }
// }
// });
}
public LiveBuyGuardSelectPopup setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
this.onDismissListener = onDismissListener;
return this;
}
public LiveBuyGuardSelectPopup setBuyGuardSelectListener(LiveBuyGuardSelectListener buyGuardSelectListener) {
this.buyGuardSelectListener = buyGuardSelectListener;
return this;
}
@Override
protected void onDismiss() {
super.onDismiss();
if (onDismissListener != null) {
onDismissListener.onDismiss(null);
}
}
public interface LiveBuyGuardSelectListener {
void onLiveBuyGuardSelectListener(GuardPriceModel guardPriceModel);
}
}

View File

@ -26,6 +26,8 @@ import com.yunbao.common.bean.GiftGuideModel;
import com.yunbao.common.bean.GiftNamingInfoModel; import com.yunbao.common.bean.GiftNamingInfoModel;
import com.yunbao.common.bean.GiftWallGiftDetail; import com.yunbao.common.bean.GiftWallGiftDetail;
import com.yunbao.common.bean.GiftWallModel; import com.yunbao.common.bean.GiftWallModel;
import com.yunbao.common.bean.GuardGetGuardOpenInfoModel;
import com.yunbao.common.bean.GuardGetGuardUserInfoModel;
import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.HourRank;
import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
@ -1162,4 +1164,9 @@ public interface PDLiveApi {
@GET("/api/public/?service=Sudgameserver.getRoomMicStatus") @GET("/api/public/?service=Sudgameserver.getRoomMicStatus")
Observable<ResponseModel<RoomMicStatusModel>> getRoomMicStatus(); Observable<ResponseModel<RoomMicStatusModel>> getRoomMicStatus();
@GET("/api/public/?service=Guard.getGuardUserInfo")
Observable<ResponseModel<GuardGetGuardUserInfoModel>> getGuardUserInfo(@Query("liveuid") String liveUid);
@GET("/api/public/?service=Guard.getGuardOpenInfo")
Observable<ResponseModel<GuardGetGuardOpenInfoModel>> getGuardOpenInfo(@Query("liveuid") String liveUid);
} }

View File

@ -27,6 +27,8 @@ import com.yunbao.common.bean.GiftGuideModel;
import com.yunbao.common.bean.GiftNamingInfoModel; import com.yunbao.common.bean.GiftNamingInfoModel;
import com.yunbao.common.bean.GiftWallGiftDetail; import com.yunbao.common.bean.GiftWallGiftDetail;
import com.yunbao.common.bean.GiftWallModel; import com.yunbao.common.bean.GiftWallModel;
import com.yunbao.common.bean.GuardGetGuardOpenInfoModel;
import com.yunbao.common.bean.GuardGetGuardUserInfoModel;
import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.bean.HttpCallbackModel;
import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LinkMicUserBean;
import com.yunbao.common.bean.LinkMicUserBeanV2; import com.yunbao.common.bean.LinkMicUserBeanV2;
@ -2770,7 +2772,7 @@ public class LiveNetManager {
}).isDisposed(); }).isDisposed();
} }
public void addChatCount(String stream,HttpCallback<HttpCallbackModel> callback) { public void addChatCount(String stream, HttpCallback<HttpCallbackModel> callback) {
API.get().pdLiveApi(mContext) API.get().pdLiveApi(mContext)
.addChatCount(stream) .addChatCount(stream)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
@ -2931,6 +2933,54 @@ public class LiveNetManager {
} }
public void getGuardUserInfo(String liveUid, HttpCallback<GuardGetGuardUserInfoModel> callback) {
API.get().pdLiveApi(mContext)
.getGuardUserInfo(liveUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<GuardGetGuardUserInfoModel>>() {
@Override
public void accept(ResponseModel<GuardGetGuardUserInfoModel> guardGetGuardUserInfoModelResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(guardGetGuardUserInfoModelResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
throwable.printStackTrace();
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
public void getGuardOpenInfo(String liveUid, HttpCallback<GuardGetGuardOpenInfoModel> callback) {
API.get().pdLiveApi(mContext)
.getGuardOpenInfo(liveUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<GuardGetGuardOpenInfoModel>>() {
@Override
public void accept(ResponseModel<GuardGetGuardOpenInfoModel> guardGetGuardOpenInfoModelResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(guardGetGuardOpenInfoModelResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
throwable.printStackTrace();
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
/** /**
* 直播间取消网络请求 * 直播间取消网络请求
*/ */

View File

@ -0,0 +1,25 @@
package com.yunbao.common.views;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.glide.ImgLoader;
public class LiveBuyGuardPrivilegeViewHolder extends RecyclerView.ViewHolder {
ImageView guard_privilege;
public LiveBuyGuardPrivilegeViewHolder(@NonNull View itemView) {
super(itemView);
guard_privilege = itemView.findViewById(R.id.guard_privilege);
}
public void setData(String url) {
Log.e("LiveBuyGuardPrivilege", url);
ImgLoader.display(itemView.getContext(), url, guard_privilege);
}
}

View File

@ -0,0 +1,37 @@
package com.yunbao.common.views;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.common.bean.GuardPriceModel;
public class LiveBuyGuardSelectViewHolder extends RecyclerView.ViewHolder {
TextView opening_time, discount;
public LiveBuyGuardSelectViewHolder(@NonNull View itemView) {
super(itemView);
opening_time = itemView.findViewById(R.id.opening_time);
discount = itemView.findViewById(R.id.discount);
}
public void setData(GuardPriceModel guardPriceModel,LiveBuyGuardSelectClickListener liveBuyGuardSelectClickListener) {
opening_time.setText(String.valueOf(guardPriceModel.getOpeningTime()));
discount.setText(String.valueOf(guardPriceModel.getDiscount()));
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (liveBuyGuardSelectClickListener!=null){
liveBuyGuardSelectClickListener.onClickListener(guardPriceModel);
}
}
});
}
public interface LiveBuyGuardSelectClickListener{
void onClickListener(GuardPriceModel guardPriceModel);
}
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:endColor="#120C07"
android:startColor="#3F2D05"
android:type="linear" />
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
</shape>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:endColor="#09050F"
android:startColor="#3F3B34"
android:type="linear" />
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="6dp" />
<stroke
android:width="0.5dp"
android:color="#D9D9D9" />
<solid android:color="#CC0C0D1A" />
</shape>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:endColor="#110F22"
android:startColor="#37398E"
android:type="linear" />
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
</shape>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/guard_privilege"
android:layout_marginTop="10dp"
android:src="@mipmap/tequan_1"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_marginStart="9dp"
android:layout_height="83dp" />
</LinearLayout>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="120dp"
android:background="@drawable/bg_live_buy_guard_select"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/live_buy_guard_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:itemCount="4"
tools:listitem="@layout/view_live_buy_guard_slelect_item" />
</LinearLayout>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/opening_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="19dp"
android:layout_weight="1"
android:gravity="center"
android:text="@string/one_month"
android:textColor="@color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/discount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="19dp"
android:layout_weight="1"
android:gravity="center"
android:text="7.1折"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -1459,4 +1459,26 @@ Limited ride And limited avatar frame</string>
<string name="guard_buy_type_1">【星之守护】</string> <string name="guard_buy_type_1">【星之守护】</string>
<string name="guardian_privilege">守護團特權</string>
<string name="be_their_exclusive_guardian">成爲TA的專屬守護 為TA保駕護航</string>
<string name="not_yet_open">暫未開通</string>
<string name="tas_guardian_group">TA的守護團 ></string>
<string name="open_the_kings_guard">開通王之守護</string>
<string name="renew_the_kings_guard">續費王之守護</string>
<string name="open_the_start_guard">開通星之守護</string>
<string name="renew_the_start_guard">續費星之守護</string>
<string name="open_the_god_guard">開通神之守護</string>
<string name="renew_the_god_guard">續費神之守護</string>
<string name="one_month">1個月</string>
<string name="tree_month">3個月</string>
<string name="six_month">6個月</string>
<string name="one_two_month">12個月</string>
<string name="guardian_for_your_favorite_anchor">快爲您喜歡的主播開通守護吧!</string>
<string name="guardian_task">守護任務</string>
<string name="my_graud_grade">我的等級 ></string>
<string name="no_one_guarding_the_anchor_yet">還沒人守護主播快來守護TA吧~</string>
<string name="this_week_contribution">本周貢獻值</string>
<string name="contribution">貢獻度</string>
<string name="have_opened">已開通</string>
</resources> </resources>

View File

@ -5,13 +5,13 @@ ext {
minSdkVersion : 21, minSdkVersion : 21,
targetSdkVersion : 33, targetSdkVersion : 33,
versionCode : 464, versionCode : 464,
versionName : "6.6.5" versionName : "6.6.6"
] ]
manifestPlaceholders = [ manifestPlaceholders = [
// //
serverHost : "https://napi.yaoulive.com", // serverHost : "https://napi.yaoulive.com",
// //
//serverHost : "https://ceshi.yaoulive.com", serverHost : "https://ceshi.yaoulive.com",
// //

View File

@ -23,6 +23,6 @@ android.enableJetifier=true
systemProp.http.proxyHost=127.0.0.1 systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1 systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=7980 systemProp.https.proxyPort=7890
systemProp.http.proxyPort=7890 systemProp.http.proxyPort=7890
#android.enableR8.fullMode=true #android.enableR8.fullMode=true

View File

@ -36,6 +36,8 @@ import com.yunbao.common.event.CoinChangeEvent;
import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.event.SendBlindGiftEvent; import com.yunbao.common.event.SendBlindGiftEvent;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpConsts;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.KeyBoardHeightChangeListener; import com.yunbao.common.interfaces.KeyBoardHeightChangeListener;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
@ -48,7 +50,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.utils.formatBigNum; import com.yunbao.common.utils.formatBigNum;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.bean.GuardUserBean; import com.yunbao.live.bean.GuardUserModel;
import com.yunbao.live.bean.LiveBuyGuardMsgBean; import com.yunbao.live.bean.LiveBuyGuardMsgBean;
import com.yunbao.live.bean.LiveChatBean; import com.yunbao.live.bean.LiveChatBean;
import com.yunbao.live.bean.LiveDanMuBean; import com.yunbao.live.bean.LiveDanMuBean;
@ -64,21 +66,18 @@ import com.yunbao.live.dialog.LiveFansFragment;
import com.yunbao.live.dialog.LiveFansMedalOkDialogFragment; import com.yunbao.live.dialog.LiveFansMedalOkDialogFragment;
import com.yunbao.live.dialog.LiveGiveHotDialogFragment; import com.yunbao.live.dialog.LiveGiveHotDialogFragment;
import com.yunbao.live.dialog.LiveGuardBuyDialogFragment; import com.yunbao.live.dialog.LiveGuardBuyDialogFragment;
import com.yunbao.live.dialog.LiveGuardDialog;
import com.yunbao.live.dialog.LiveGuardDialogFragment; import com.yunbao.live.dialog.LiveGuardDialogFragment;
import com.yunbao.live.dialog.LiveInputDialogFragment; import com.yunbao.live.dialog.LiveInputDialogFragment;
import com.yunbao.live.dialog.LiveMicAnchorDialogFragment; import com.yunbao.live.dialog.LiveMicAnchorDialogFragment;
import com.yunbao.live.dialog.LiveMoreDialogFragment; import com.yunbao.live.dialog.LiveMoreDialogFragment;
import com.yunbao.live.dialog.LiveNewGuardBuyDialogFragment; import com.yunbao.live.dialog.LiveNewGuardBuyDialogFragment;
import com.yunbao.live.dialog.LiveNewGuardDialogFragment;
import com.yunbao.live.dialog.LiveNewGuardListDialogFragment;
import com.yunbao.live.dialog.LiveRedPackListDialogFragment; import com.yunbao.live.dialog.LiveRedPackListDialogFragment;
import com.yunbao.live.dialog.LiveRedPackSendDialogFragment; import com.yunbao.live.dialog.LiveRedPackSendDialogFragment;
import com.yunbao.live.dialog.LiveShareDialogFragment; import com.yunbao.live.dialog.LiveShareDialogFragment;
import com.yunbao.live.dialog.LiveUserAnchorMailBoxPopDialog; import com.yunbao.live.dialog.LiveUserAnchorMailBoxPopDialog;
import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.dialog.LiveUserMoreDialogFragment; import com.yunbao.live.dialog.LiveUserMoreDialogFragment;
import com.yunbao.common.http.LiveHttpConsts;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter; import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
import com.yunbao.live.presenter.LiveLinkMicPkPresenter; import com.yunbao.live.presenter.LiveLinkMicPkPresenter;
import com.yunbao.live.presenter.LiveLinkMicPresenter; import com.yunbao.live.presenter.LiveLinkMicPresenter;
@ -735,7 +734,8 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
} }
} }
public Handler mHandler = new Handler();
public Handler mHandler = new Handler();
public pkRunnable pr; public pkRunnable pr;
public class pkRunnable implements Runnable { public class pkRunnable implements Runnable {
@ -1269,19 +1269,22 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
LiveHttpUtil.getGuardList(uid, 1, new HttpCallback() { LiveHttpUtil.getGuardList(uid, 1, new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
List<GuardUserBean> list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class); List<GuardUserModel> list = JSON.parseArray(Arrays.toString(info), GuardUserModel.class);
Log.e("getGuardList", list.toString());
if (list.isEmpty()) { if (list.isEmpty()) {
openNewBuyGuardWindow(true); // openNewBuyGuardWindow(true);
new LiveGuardDialog(mContext, true,mLiveUid).showDialog();
} else { } else {
LiveNewGuardDialogFragment fragment = new LiveNewGuardDialogFragment(); // LiveNewGuardDialogFragment fragment = new LiveNewGuardDialogFragment();
fragment.setList(list); // fragment.setList(list);
fragment.setLiveGuardInfo(mLiveGuardInfo); // fragment.setLiveGuardInfo(mLiveGuardInfo);
Bundle bundle = new Bundle(); // Bundle bundle = new Bundle();
bundle.putString(Constants.LIVE_UID, mLiveUid); // bundle.putString(Constants.LIVE_UID, mLiveUid);
bundle.putBoolean(Constants.ANCHOR, mIsAnchor); // bundle.putBoolean(Constants.ANCHOR, mIsAnchor);
bundle.putBoolean("showBuyView", !showBuyView); // bundle.putBoolean("showBuyView", !showBuyView);
fragment.setArguments(bundle); // fragment.setArguments(bundle);
fragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment"); // fragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment");
new LiveGuardDialog(mContext, false,mLiveUid).showDialog();
} }
} }
}); });

View File

@ -0,0 +1,35 @@
package com.yunbao.live.adapter;
import android.content.Context;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.live.R;
import com.yunbao.live.bean.GuardUserModel;
import com.yunbao.live.views.NewGuardViewHolder;
public class NewGuardAdapter extends RefreshAdapter<GuardUserModel> {
public NewGuardAdapter(Context context) {
super(context);
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new NewGuardViewHolder(mInflater.inflate(R.layout.view_new_guard_item, parent, false));
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
NewGuardViewHolder newGuardViewHolder = (NewGuardViewHolder) holder;
newGuardViewHolder.setData(mList.get(position), position);
}
@Override
public int getItemCount() {
return mList.size();
}
}

View File

@ -0,0 +1,98 @@
package com.yunbao.live.bean;
import com.stx.xhb.androidx.entity.BaseBannerInfo;
public class BuyGuardBannerModel implements BaseBannerInfo {
private int guardImage;
private String name;
private String guardianMedal;
private int guardOpen;
private int[] gradientColors;
private String userAvatar;
private String liveAvatar;
private boolean isOpen;
public boolean isOpen() {
return isOpen;
}
public BuyGuardBannerModel setOpen(boolean open) {
isOpen = open;
return this;
}
public String getUserAvatar() {
return userAvatar;
}
public BuyGuardBannerModel setUserAvatar(String userAvatar) {
this.userAvatar = userAvatar;
return this;
}
public String getLiveAvatar() {
return liveAvatar;
}
public BuyGuardBannerModel setLiveAvatar(String liveAvatar) {
this.liveAvatar = liveAvatar;
return this;
}
public int[] getGradientColors() {
return gradientColors;
}
public BuyGuardBannerModel setGradientColors(int[] gradientColors) {
this.gradientColors = gradientColors;
return this;
}
public int getGuardOpen() {
return guardOpen;
}
public BuyGuardBannerModel setGuardOpen(int guardOpen) {
this.guardOpen = guardOpen;
return this;
}
public String getGuardianMedal() {
return guardianMedal;
}
public BuyGuardBannerModel setGuardImage(int guardImage) {
this.guardImage = guardImage;
return this;
}
public BuyGuardBannerModel setGuardianMedal(String guardianMedal) {
this.guardianMedal = guardianMedal;
return this;
}
public String getName() {
return name;
}
public BuyGuardBannerModel setName(String name) {
this.name = name;
return this;
}
public int getGuardImage() {
return guardImage;
}
@Override
public Object getXBannerUrl() {
return null;
}
@Override
public String getXBannerTitle() {
return null;
}
}

View File

@ -0,0 +1,199 @@
package com.yunbao.live.bean;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.bean.BaseModel;
public class GuardUserModel extends BaseModel {
/**
* {
* "id": 98888,
* "user_nicename": "周末暴打小朋友",
* "avatar": "https://downs.yaoulive.com/mannine.png",
* "sex": 1,
* "type": 1,
* "level": "33",
* "dress_img": "https://downs.yaoulive.com/dress/effect/huangdi-touxiang.svga",
* "contribute": "40680",
* "level_thumb": "https://downs.yaoulive.com/level/user_lv30_bg.png",
* "guard_type": 1,
* "guard_exp": 0,
* "guard_level": 1,
* "guard_name": "星之守護",
* "guard_img": "https://ceshi.yaoulive.com/data/upload/20240304/guard_xing_open.png"
* }
*/
@SerializedName("id")
private int id;
@SerializedName("user_nicename")
private String userNicename;
@SerializedName("avatar")
private String avatar;
@SerializedName("sex")
private int sex;
@SerializedName("type")
private int type;
@SerializedName("level")
private String level;
@SerializedName("dress_img")
private String dressImg;
@SerializedName("contribute")
private String contribute;
@SerializedName("level_thumb")
private String levelThumb;
@SerializedName("guard_type")
private int guardType;
@SerializedName("guard_exp")
private int guardExp;
@SerializedName("guard_level")
private int guardLevel;
@SerializedName("guard_name")
private String guardName;
@SerializedName("guard_img")
private String guardImg;
public int getId() {
return id;
}
public GuardUserModel setId(int id) {
this.id = id;
return this;
}
public String getUserNicename() {
return userNicename;
}
public GuardUserModel setUserNicename(String userNicename) {
this.userNicename = userNicename;
return this;
}
public String getAvatar() {
return avatar;
}
public GuardUserModel setAvatar(String avatar) {
this.avatar = avatar;
return this;
}
public int getSex() {
return sex;
}
public GuardUserModel setSex(int sex) {
this.sex = sex;
return this;
}
public int getType() {
return type;
}
public GuardUserModel setType(int type) {
this.type = type;
return this;
}
public String getLevel() {
return level;
}
public GuardUserModel setLevel(String level) {
this.level = level;
return this;
}
public String getDressImg() {
return dressImg;
}
public GuardUserModel setDressImg(String dressImg) {
this.dressImg = dressImg;
return this;
}
public String getContribute() {
return contribute;
}
public GuardUserModel setContribute(String contribute) {
this.contribute = contribute;
return this;
}
public String getLevelThumb() {
return levelThumb;
}
public GuardUserModel setLevelThumb(String levelThumb) {
this.levelThumb = levelThumb;
return this;
}
public int getGuardType() {
return guardType;
}
public GuardUserModel setGuardType(int guardType) {
this.guardType = guardType;
return this;
}
public int getGuardExp() {
return guardExp;
}
public GuardUserModel setGuardExp(int guardExp) {
this.guardExp = guardExp;
return this;
}
public int getGuardLevel() {
return guardLevel;
}
public GuardUserModel setGuardLevel(int guardLevel) {
this.guardLevel = guardLevel;
return this;
}
public String getGuardName() {
return guardName;
}
public GuardUserModel setGuardName(String guardName) {
this.guardName = guardName;
return this;
}
public String getGuardImg() {
return guardImg;
}
public GuardUserModel setGuardImg(String guardImg) {
this.guardImg = guardImg;
return this;
}
@Override
public String toString() {
return "GuardUserModel{" +
"id=" + id +
", userNicename='" + userNicename + '\'' +
", avatar='" + avatar + '\'' +
", sex=" + sex +
", type=" + type +
", level='" + level + '\'' +
", dressImg='" + dressImg + '\'' +
", contribute='" + contribute + '\'' +
", levelThumb='" + levelThumb + '\'' +
", guardType=" + guardType +
", guardExp=" + guardExp +
", guardLevel=" + guardLevel +
", guardName='" + guardName + '\'' +
", guardImg='" + guardImg + '\'' +
'}';
}
}

View File

@ -1,22 +1,44 @@
package com.yunbao.live.dialog; package com.yunbao.live.dialog;
import android.animation.ObjectAnimator;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager.widget.ViewPager;
import androidx.viewpager2.widget.ViewPager2;
import com.flyjingfish.gradienttextviewlib.GradientTextView;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.yunbao.common.custom.ItemDecoration; import com.lxj.xpopup.enums.PopupPosition;
import com.makeramen.roundedimageview.RoundedImageView;
import com.stx.xhb.androidx.XBanner;
import com.yunbao.common.adapter.LiveBuyGuardPrivilegeAdapter;
import com.yunbao.common.bean.GuardDataTipModel;
import com.yunbao.common.bean.GuardGetGuardOpenInfoModel;
import com.yunbao.common.bean.GuardPriceModel;
import com.yunbao.common.dialog.AbsDialogPopupWindow; import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.dialog.LiveBuyGuardSelectPopup;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.adapter.LiveBuyGuardTopListAdapter; import com.yunbao.live.bean.BuyGuardBannerModel;
import com.yunbao.live.custom.LiveBuyGuardLinearLayoutManager;
import com.yunbao.live.fragments.LiveBuyGuardVPFragment; import com.yunbao.live.fragments.LiveBuyGuardVPFragment;
import java.util.ArrayList; import java.util.ArrayList;
@ -24,11 +46,31 @@ import java.util.List;
public class LiveBuyGuardDialog extends AbsDialogPopupWindow { public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
FragmentActivity activity; FragmentActivity activity;
RecyclerView recyclerView;
List<Fragment> fragments=new ArrayList<>(); List<Fragment> fragments = new ArrayList<>();
public LiveBuyGuardDialog(@NonNull Context context) { XBanner buyGuardBanner;
List<BuyGuardBannerModel> buyGuardBannerModels = new ArrayList<>();
FrameLayout bottomPanel;
ImageView btnGuard;
TextView openTheGuard;
TextView originalPrice;
long animDuration = 500;
ImageView guardArrow;
TextView guardMonth;
String mLiveUid;
List<GuardDataTipModel> guardDataTipModels;
List<GuardPriceModel> price = new ArrayList<>();
TextView discountPrice, discount;
GuardPriceModel guardPriceModel;
RecyclerView guardPrivilege;
LiveBuyGuardPrivilegeAdapter buyGuardPrivilegeAdapter;
List<String> guardPrivilegeStrings = new ArrayList<>();
public LiveBuyGuardDialog(@NonNull Context context, String liveUid) {
super(context); super(context);
activity=(FragmentActivity) context; activity = (FragmentActivity) context;
mLiveUid = liveUid;
} }
@Override @Override
@ -41,26 +83,197 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
return R.layout.dialog_live_buy_guard; return R.layout.dialog_live_buy_guard;
} }
//底部栏
@Override @Override
protected void onCreate() { protected void onCreate() {
super.onCreate(); super.onCreate();
recyclerView=findViewById(R.id.recycler_view); buyGuardBanner = findViewById(R.id.buy_guard_banner);
recyclerView.setAdapter(new LiveBuyGuardTopListAdapter(mContext)); bottomPanel = findViewById(R.id.bottom_panel);
LiveBuyGuardLinearLayoutManager layoutManager=new LiveBuyGuardLinearLayoutManager(mContext,RecyclerView.HORIZONTAL,false); btnGuard = findViewById(R.id.btn_guard);
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener(){ openTheGuard = findViewById(R.id.open_the_guard);
originalPrice = findViewById(R.id.original_price);
guardArrow = findViewById(R.id.guard_arrow);
guardMonth = findViewById(R.id.guard_month);
discountPrice = findViewById(R.id.discount_price);
discount = findViewById(R.id.discount);
guardPrivilege = findViewById(R.id.guard_privilege);
originalPrice.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);
guardPrivilege.setLayoutManager(new GridLayoutManager(getContext(), 4));
buyGuardPrivilegeAdapter = new LiveBuyGuardPrivilegeAdapter(guardPrivilegeStrings);
guardPrivilege.setAdapter(buyGuardPrivilegeAdapter);
int[] gradientColorsStart = {Color.parseColor("#68B4F9"), Color.parseColor("#DCE3F9")};
int[] gradientColorsKing = {Color.parseColor("#F5DBD5"), Color.parseColor("#FFF8F1")};
int[] gradientColorsGod = {Color.parseColor("#FFC179"), Color.parseColor("#FFF2D7")};
int[] openColorsGod = {Color.parseColor("#FFFFFF"), Color.parseColor("#FFFFFF")};
LiveNetManager.get(mContext).getGuardOpenInfo(mLiveUid, new HttpCallback<GuardGetGuardOpenInfoModel>() {
@Override @Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { public void onSuccess(GuardGetGuardOpenInfoModel data) {
super.onScrollStateChanged(recyclerView, newState); guardDataTipModels = data.getGuardData();
guardDataTipModels.get(0).setOpen(true);
for (GuardDataTipModel guardDataTipModel : guardDataTipModels) {
BuyGuardBannerModel guardBannerModel = new BuyGuardBannerModel();
guardBannerModel.setGuardianMedal(guardDataTipModel.isOpen() ? guardDataTipModel.getOpenImg() : guardDataTipModel.getCloseImg())
.setName(guardDataTipModel.getGuardName())
.setLiveAvatar(data.getUserInfo().getLiveAvatar())
.setUserAvatar(data.getUserInfo().getUserAvatar())
.setOpen(guardDataTipModel.isOpen());
if (guardDataTipModel.getGuardType() == 1) {
guardBannerModel.setGradientColors(gradientColorsStart)
.setGuardOpen(R.mipmap.icon_bg_star_guard_open)
.setGuardImage(R.mipmap.bg_star_guard);
} else if (guardDataTipModel.getGuardType() == 2) {
guardBannerModel.setGuardOpen(R.mipmap.icon_bg_king_guard_open)
.setGradientColors(gradientColorsKing)
.setGuardImage(R.mipmap.bg_king_guard);
} else {
guardBannerModel.setGuardOpen(R.mipmap.icon_god_guard_open)
.setGradientColors(gradientColorsGod)
.setGuardImage(R.mipmap.bg_god_guard);
}
buyGuardBannerModels.add(guardBannerModel);
}
buyGuardBanner.setBannerData(R.layout.banner_item_buy_guard, buyGuardBannerModels);
buyGuardBanner.setIsClipChildrenMode(true);
guardPrivilegeStrings = data.getGuardData().get(0).getGuardPrivilege();
}
@Override
public void onError(String error) {
ToastUtil.show(error);
} }
}); });
ItemDecoration decoration = new ItemDecoration(mContext, 0x00000000, 25, 0);
decoration.setOnlySetItemOffsetsButNoDraw(true); buyGuardBanner.loadImage(new XBanner.XBannerAdapter() {
//recyclerView.addItemDecoration(decoration); @Override
recyclerView.setLayoutManager(layoutManager); public void loadBanner(XBanner banner, Object model, View view, int position) {
PagerSnapHelper snapHelper=new PagerSnapHelper();
snapHelper.attachToRecyclerView(recyclerView); BuyGuardBannerModel guardBannerModel = ((BuyGuardBannerModel) model);
ImageView bg = view.findViewById(R.id.bg);
ImageView guardianMedal = view.findViewById(R.id.guardian_medal);
ImageView guardOpen = view.findViewById(R.id.guard_open);
GradientTextView godGuard = view.findViewById(R.id.god_guard);
RoundedImageView userAvatar = view.findViewById(R.id.user_avatar);
RoundedImageView liveAvatar = view.findViewById(R.id.live_avatar);
godGuard.setGradientColors(guardBannerModel.isOpen() ? openColorsGod : guardBannerModel.getGradientColors());
godGuard.setText(guardBannerModel.isOpen() ? WordUtil.getNewString(R.string.have_opened) : WordUtil.getNewString(R.string.not_yet_open));
ImgLoader.display(getContext(), guardBannerModel.getGuardImage(), bg);
ImgLoader.display(getContext(), guardBannerModel.getGuardianMedal(), guardianMedal);
ImgLoader.display(getContext(), guardBannerModel.getGuardOpen(), guardOpen);
ImgLoader.display(getContext(), guardBannerModel.getUserAvatar(), userAvatar);
ImgLoader.display(getContext(), guardBannerModel.getLiveAvatar(), liveAvatar);
}
});
buyGuardBanner.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int i, float v, int i1) {
}
@Override
public void onPageSelected(int position) {
BuyGuardBannerModel guardBannerModel = buyGuardBannerModels.get(position);
GuardDataTipModel dataTipModel = guardDataTipModels.get(position);
price = dataTipModel.getPrice();
Log.e("LiveBuyGuardDialog", "name = " + guardBannerModel.getName() + " position=" + position);
if (position == 0) {
bottomPanel.setBackgroundResource(R.drawable.bg_star_guard_bottom_panel);
ImgLoader.display(getContext(), R.mipmap.btn_star_guard, btnGuard);
openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.getNewString(R.string.renew_the_start_guard)
: WordUtil.getNewString(R.string.open_the_start_guard));
} else if (position == 1) {
bottomPanel.setBackgroundResource(R.drawable.bg_king_guard_bottom_panel);
ImgLoader.display(getContext(), R.mipmap.btn_king_guard, btnGuard);
openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.getNewString(R.string.renew_the_kings_guard)
: WordUtil.getNewString(R.string.open_the_kings_guard));
} else if (position == 2) {
bottomPanel.setBackgroundResource(R.drawable.bg_god_guard_bottom_panel);
ImgLoader.display(getContext(), R.mipmap.btn_god_guard, btnGuard);
openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.getNewString(R.string.renew_the_god_guard)
: WordUtil.getNewString(R.string.open_the_god_guard));
}
guardPriceModel = price.get(0);
if (TextUtils.isEmpty(guardPriceModel.getDiscountPrice())) {
discountPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice()));
originalPrice.setVisibility(GONE);
discount.setVisibility(GONE);
} else {
originalPrice.setVisibility(VISIBLE);
discount.setVisibility(VISIBLE);
discountPrice.setText(String.valueOf(guardPriceModel.getDiscountPrice()));
originalPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice()));
discount.setText(String.valueOf(guardPriceModel.getDiscount()));
}
guardMonth.setText(guardPriceModel.getOpeningTime());
guardPrivilegeStrings = dataTipModel.getGuardPrivilege();
if (buyGuardPrivilegeAdapter != null){
buyGuardPrivilegeAdapter.setGuardPrivilege(guardPrivilegeStrings);
}
}
@Override
public void onPageScrollStateChanged(int i) {
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.guard_month_linear), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
ObjectAnimator animator = ObjectAnimator.ofFloat(guardArrow, "rotation", 0f, -90f);
animator.setDuration(500);
animator.setInterpolator(new LinearInterpolator());
animator.start();
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.guard_month_linear));
builder.hasShadowBg(false)
.isDestroyOnDismiss(true)
.isLightStatusBar(false)
.popupPosition(PopupPosition.Top)
.asCustom(new LiveBuyGuardSelectPopup(getContext(), price)
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
closeAnimSudGameListEvent(guardArrow);
}
}).setBuyGuardSelectListener(new LiveBuyGuardSelectPopup.LiveBuyGuardSelectListener() {
@Override
public void onLiveBuyGuardSelectListener(GuardPriceModel model) {
guardPriceModel = model;
if (TextUtils.isEmpty(guardPriceModel.getDiscountPrice())) {
discountPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice()));
originalPrice.setVisibility(GONE);
discount.setVisibility(GONE);
} else {
originalPrice.setVisibility(VISIBLE);
discount.setVisibility(VISIBLE);
discountPrice.setText(String.valueOf(guardPriceModel.getDiscountPrice()));
originalPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice()));
discount.setText(String.valueOf(guardPriceModel.getDiscount()));
}
guardMonth.setText(guardPriceModel.getOpeningTime());
}
})
)
.show();
}
});
} }
private void initViewPage(){
private void closeAnimSudGameListEvent(View view) {
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotation", -90f, 0f);
animator.setDuration(animDuration);
animator.setInterpolator(new LinearInterpolator());
animator.start();
}
private void initViewPage() {
fragments.add(LiveBuyGuardVPFragment.newInstance(0)); fragments.add(LiveBuyGuardVPFragment.newInstance(0));
fragments.add(LiveBuyGuardVPFragment.newInstance(1)); fragments.add(LiveBuyGuardVPFragment.newInstance(1));
} }

View File

@ -0,0 +1,206 @@
package com.yunbao.live.dialog;
import android.content.Context;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.alibaba.fastjson.JSON;
import com.lxj.xpopup.XPopup;
import com.makeramen.roundedimageview.RoundedImageView;
import com.opensource.svgaplayer.SVGAImageView;
import com.yunbao.common.adapter.RefreshAdapter;
import com.yunbao.common.bean.GuardGetGuardUserInfoModel;
import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.LiveHttpUtil;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.adapter.NewGuardAdapter;
import com.yunbao.live.bean.GuardUserModel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class LiveGuardDialog extends AbsDialogPopupWindow {
FragmentActivity activity;
boolean isEmpty = true;
FrameLayout guardianTask;
FrameLayout myGraudGrade, guardingTheAnchor;
NewGuardAdapter newGuardAdapter;
CommonRefreshView mRefreshView;
String mLiveUid;
List<GuardUserModel> guardUserModels = new ArrayList<>();
TextView userNickname, weekContribution, guardLevel;
ImageView userSex, tagKing;
RoundedImageView guardIcon;
SVGAImageView giftSvga;
ImageView btnGuardOpen;
public LiveGuardDialog(@NonNull Context context, boolean isEmpty, String liveUid) {
super(context);
activity = (FragmentActivity) context;
this.isEmpty = isEmpty;
mLiveUid = liveUid;
}
@Override
public void buildDialog(XPopup.Builder builder) {
}
@Override
public int bindLayoutId() {
return R.layout.dialog_live_guard;
}
//底部栏
@Override
protected void onCreate() {
super.onCreate();
guardianTask = findViewById(R.id.guardian_task);
myGraudGrade = findViewById(R.id.my_graud_grade);
guardingTheAnchor = findViewById(R.id.guarding_the_anchor);
mRefreshView = findViewById(R.id.refreshView);
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
newGuardAdapter = new NewGuardAdapter(mContext);
mRefreshView.setRecyclerViewAdapter(newGuardAdapter);
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_admin_room);
userNickname = findViewById(R.id.user_nickname);
weekContribution = findViewById(R.id.week_contribution);
guardLevel = findViewById(R.id.guard_level);
userSex = findViewById(R.id.sex);
tagKing = findViewById(R.id.tag_king);
guardIcon = findViewById(R.id.guard_imageView);
giftSvga = findViewById(R.id.gift_svga);
btnGuardOpen = findViewById(R.id.btn_guard_open);
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<GuardUserModel>() {
@Override
public RefreshAdapter<GuardUserModel> getAdapter() {
return null;
}
@Override
public void loadData(int p, HttpCallback callback) {
LiveHttpUtil.getGuardList(mLiveUid, p, callback);
}
@Override
public List<GuardUserModel> processData(String[] info) {
List<GuardUserModel> guardUserModelList = JSON.parseArray(Arrays.toString(info), GuardUserModel.class);
if (guardUserModels.isEmpty() && !guardUserModelList.isEmpty()) {
guardUserModels = guardUserModelList;
setAdapterData();
}
return guardUserModelList;
}
@Override
public void onRefreshSuccess(List<GuardUserModel> list, int listCount) {
}
@Override
public void onRefreshFailure() {
}
@Override
public void onLoadMoreSuccess(List<GuardUserModel> loadItemList, int loadItemCount) {
if (loadItemList.size() > 0)
newGuardAdapter.insertList(loadItemList);
}
@Override
public void onLoadMoreFailure() {
}
});
mRefreshView.initData();
if (isEmpty) {
guardingTheAnchor.setVisibility(VISIBLE);
} else {
guardingTheAnchor.setVisibility(GONE);
}
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_guard_open), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
new LiveBuyGuardDialog(mContext, mLiveUid).showDialog();
}
});
userNickname.setVisibility(GONE);
weekContribution.setVisibility(GONE);
userSex.setVisibility(GONE);
tagKing.setVisibility(GONE);
guardLevel.setVisibility(GONE);
guardIcon.setVisibility(GONE);
giftSvga.setImageResource(R.mipmap.guardian_img_wings);
LiveNetManager.get(mContext).getGuardUserInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback<GuardGetGuardUserInfoModel>() {
@Override
public void onSuccess(GuardGetGuardUserInfoModel data) {
if (data.getGuardType() == 0) {
guardianTask.setVisibility(GONE);
myGraudGrade.setVisibility(GONE);
ImgLoader.display(mContext,R.mipmap.btn_guard_open,btnGuardOpen);
} else {
guardianTask.setVisibility(VISIBLE);
myGraudGrade.setVisibility(VISIBLE);
ImgLoader.display(mContext,R.mipmap.btn_renewal_guard,btnGuardOpen);//续费守护
}
}
@Override
public void onError(String error) {
ToastUtil.show(error);
guardianTask.setVisibility(GONE);
myGraudGrade.setVisibility(GONE);
ImgLoader.display(mContext,R.mipmap.btn_guard_open,btnGuardOpen);
}
});
}
private void setAdapterData() {
if (guardUserModels.isEmpty()) return;
GuardUserModel guardUserModel = guardUserModels.get(0);
userNickname.setVisibility(VISIBLE);
weekContribution.setVisibility(VISIBLE);
userSex.setVisibility(VISIBLE);
tagKing.setVisibility(VISIBLE);
guardLevel.setVisibility(VISIBLE);
guardIcon.setVisibility(View.VISIBLE);
userNickname.setText(guardUserModel.getUserNicename());
weekContribution.setText(WordUtil.getNewString(R.string.this_week_contribution) + " " + guardUserModel.getContribute());
userSex.setImageResource(CommonIconUtil.getSexIcon(guardUserModel.getSex()));
ImgLoader.display(mContext, guardUserModel.getGuardImg(), tagKing);
guardLevel.setText(String.valueOf(guardUserModel.getGuardLevel()));
ImgLoader.display(mContext, guardUserModel.getAvatar(), guardIcon);
giftSvga.setImageResource(R.mipmap.guardian_img_wings_p);
}
}

View File

@ -0,0 +1,58 @@
package com.yunbao.live.views;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.live.R;
import com.yunbao.live.bean.GuardUserModel;
public class NewGuardViewHolder extends RecyclerView.ViewHolder {
ImageView guard_number_img, userSex, tagKing;
TextView guard_number_text, user_nicename, guardLevel, contribution;
RoundedImageView avatar;
public NewGuardViewHolder(@NonNull View itemView) {
super(itemView);
guard_number_img = itemView.findViewById(R.id.guard_number_img);
guard_number_text = itemView.findViewById(R.id.guard_number_text);
avatar = itemView.findViewById(R.id.avatar);
user_nicename = itemView.findViewById(R.id.user_nicename);
userSex = itemView.findViewById(R.id.sex);
guardLevel = itemView.findViewById(R.id.guard_level);
tagKing = itemView.findViewById(R.id.tag_king);
contribution = itemView.findViewById(R.id.contribution);
}
public void setData(GuardUserModel guardUserModel, int position) {
if (position == 0) {
guard_number_img.setVisibility(View.VISIBLE);
guard_number_text.setVisibility(View.GONE);
ImgLoader.display(itemView.getContext(), R.mipmap.icon_one_guard, guard_number_img);
} else if (position == 1) {
guard_number_img.setVisibility(View.VISIBLE);
guard_number_text.setVisibility(View.GONE);
ImgLoader.display(itemView.getContext(), R.mipmap.icon_two_guard, guard_number_img);
} else if (position == 2) {
guard_number_img.setVisibility(View.VISIBLE);
guard_number_text.setVisibility(View.GONE);
ImgLoader.display(itemView.getContext(), R.mipmap.icon_three_guard, guard_number_img);
} else {
guard_number_img.setVisibility(View.GONE);
guard_number_text.setVisibility(View.VISIBLE);
guard_number_text.setText(String.valueOf(position + 1));
}
ImgLoader.display(itemView.getContext(), guardUserModel.getAvatar(), avatar);
user_nicename.setText(guardUserModel.getUserNicename());
userSex.setImageResource(CommonIconUtil.getSexIcon(guardUserModel.getSex()));
guardLevel.setText(String.valueOf(guardUserModel.getGuardLevel()));
ImgLoader.display(itemView.getContext(), guardUserModel.getGuardImg(), tagKing);
contribution.setText(guardUserModel.getContribute());
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#100C4C"
android:startColor="#0F043D" />
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
</shape>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#1D174A"
android:startColor="#160C43" />
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:startColor="#181F3B"
android:endColor="#2B1477" />
</shape>

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/bg"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_marginTop="6dp"
android:scaleType="fitXY"
android:src="@mipmap/bg_star_guard" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="11dp"
android:layout_marginTop="60dp"
android:text="@string/be_their_exclusive_guardian"
android:textColor="#FAE3B9"
android:textSize="12sp" />
<ImageView
android:id="@+id/guardian_medal"
android:layout_width="120dp"
android:layout_height="90dp"
android:layout_gravity="end"
android:layout_marginEnd="3dp"
android:src="@mipmap/icon_king_guardian_medal_grey" />
<FrameLayout
android:layout_width="93dp"
android:layout_height="28dp"
android:layout_gravity="bottom|end"
android:layout_marginEnd="8dp"
android:layout_marginBottom="48dp">
<ImageView
android:id="@+id/guard_open"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@mipmap/icon_bg_star_guard_open" />
<com.flyjingfish.gradienttextviewlib.GradientTextView
android:id="@+id/god_guard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:letterSpacing="0.1"
android:text="@string/not_yet_open"
android:textSize="16sp"
android:visibility="visible"
app:gradient_angle="45"
app:gradient_endColor="#FFF2D7"
app:gradient_startColor="#FFC179" />
</FrameLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="16dp"
android:layout_marginBottom="38dp"
android:gravity="center_vertical">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/user_avatar"
android:layout_width="51dp"
android:layout_height="51dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="35dp"
android:scaleType="centerCrop"
android:src="@mipmap/icon_male_default"
app:riv_oval="true" />
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/live_avatar"
android:layout_width="51dp"
android:layout_height="51dp"
android:layout_gravity="center_vertical"
android:scaleType="centerCrop"
android:src="@mipmap/icon_male_default"
app:riv_oval="true" />
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="@string/tas_guardian_group"
android:textColor="#FDECCB"
android:textSize="12sp" />
</LinearLayout>
</FrameLayout>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -7,24 +7,188 @@
<ImageView <ImageView
android:id="@+id/bg" android:id="@+id/bg"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="match_parent"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@mipmap/dialog_live_buy_guard_bg" android:src="@mipmap/dialog_live_buy_guard_bg" />
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView <LinearLayout
android:id="@+id/recycler_view" android:layout_width="match_parent"
android:layout_width="0dp" android:layout_height="match_parent"
android:layout_height="170dp" android:orientation="vertical">
android:layout_marginTop="70dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" <com.stx.xhb.androidx.XBanner
app:layout_constraintEnd_toEndOf="parent" android:id="@+id/buy_guard_banner"
app:layout_constraintStart_toStartOf="parent" android:layout_width="match_parent"
app:layout_constraintTop_toTopOf="parent" android:layout_height="200dp"
tools:itemCount="3" android:layout_marginTop="40dp"
tools:listitem="@layout/view_vp_live_buy_guard" /> app:isAutoPlay="false"
</androidx.constraintlayout.widget.ConstraintLayout> app:isClipChildrenMode="true"
app:isClipChildrenModeLessThree="true"
app:isHandLoop="true"
app:isShowIndicatorOnlyOne="true"
app:isShowNumberIndicator="false"
app:showIndicatorInCenter="false" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="21dp"
android:text="@string/guardian_privilege"
android:textColor="#FAE3B9"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:layout_width="19dp"
android:layout_height="19dp"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="18dp"
android:src="@mipmap/icon_guard_rule" />
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/guard_privilege"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="9dp"
android:layout_marginBottom="73dp"
android:paddingEnd="9dp"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="4"
tools:itemCount="10"
tools:listitem="@layout/view_live_buy_guard_privilege_item" />
</LinearLayout>
<FrameLayout
android:id="@+id/bottom_panel"
android:layout_width="match_parent"
android:layout_height="73dp"
android:layout_gravity="bottom"
android:background="@drawable/bg_star_guard_bottom_panel"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="21dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/discount_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="520000"
android:textColor="#FDECCB"
android:textSize="24sp"
android:textStyle="bold" />
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="6dp"
android:src="@mipmap/icon_diamond2" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/original_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="564000"
android:textColor="@color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/discount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:text="7.1折"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<FrameLayout
android:layout_width="195dp"
android:layout_height="44dp"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="6dp">
<ImageView
android:id="@+id/btn_guard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/btn_star_guard" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/guard_month_linear"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.9"
android:gravity="center">
<TextView
android:id="@+id/guard_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/one_month"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
android:id="@+id/guard_arrow"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginStart="5dp"
android:layout_marginTop="1dp"
android:src="@mipmap/icon_right" />
</LinearLayout>
<TextView
android:id="@+id/open_the_guard"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@string/open_the_start_guard"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
</FrameLayout>
</FrameLayout>
</FrameLayout>

View File

@ -0,0 +1,213 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="508dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="59dp"
android:layout_marginBottom="71dp"
android:background="@drawable/background_live_guard">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="50dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="2dp"
android:gravity="center_vertical">
<TextView
android:id="@+id/user_nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用戶昵稱"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
android:id="@+id/sex"
android:layout_width="18dp"
android:layout_height="15dp"
android:layout_marginStart="5dp"
android:src="@mipmap/icon_sex_male_1" />
<FrameLayout
android:layout_width="42dp"
android:layout_height="15dp"
android:layout_marginStart="5dp">
<ImageView
android:id="@+id/tag_king"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/icon_tag_king" />
<TextView
android:id="@+id/guard_level"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:layout_marginEnd="2dp"
android:gravity="center"
android:text="100"
android:textColor="@color/white"
android:textSize="10sp" />
</FrameLayout>
</LinearLayout>
<TextView
android:id="@+id/week_contribution"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="本周貢獻值"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
<FrameLayout
android:id="@+id/guardian_task"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_marginTop="21dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/guardian_task"
android:textColor="#E8C7F9"
android:textSize="12sp" />
<View
android:layout_width="48dp"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="#E8C7F9" />
</FrameLayout>
<FrameLayout
android:id="@+id/my_graud_grade"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="21dp"
android:layout_marginEnd="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/my_graud_grade"
android:textColor="@color/white"
android:textSize="12sp" />
<View
android:layout_width="60dp"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="@color/white" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="7dp"
android:layout_marginTop="96dp"
android:layout_marginEnd="7dp"
android:background="@drawable/background_live_guard2">
<com.yunbao.common.custom.CommonRefreshView
android:id="@+id/refreshView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/guarding_the_anchor"
android:layout_width="240dp"
android:layout_height="141dp"
android:layout_gravity="center_horizontal|center_vertical"
android:background="@mipmap/background_guarding_the_anchor">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="7dp"
android:text="@string/no_one_guarding_the_anchor_yet"
android:textColor="@color/white"
android:textSize="12sp" />
</FrameLayout>
</FrameLayout>
</FrameLayout>
<RelativeLayout
android:layout_width="236dp"
android:layout_height="110dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="-102dp"
android:scaleType="centerCrop">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/guard_imageView"
android:layout_width="58dp"
android:layout_height="58dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:scaleType="centerCrop"
android:src="@mipmap/guardian_img_wings"
android:visibility="visible"
app:riv_oval="true" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/gift_svga"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/guardian_img_wings"
android:visibility="visible"
app:autoPlay="true" />
</RelativeLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="71dp"
android:layout_gravity="bottom"
android:background="@drawable/background_live_guard3">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="18dp"
android:layout_marginEnd="16dp"
android:text="@string/guardian_for_your_favorite_anchor"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
android:id="@+id/btn_guard_open"
android:layout_width="124dp"
android:layout_height="42dp"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="16dp"
android:background="@mipmap/btn_guard_open" />
</FrameLayout>
</FrameLayout>

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="42dp"
android:layout_marginTop="15dp">
<FrameLayout
android:layout_width="44dp"
android:layout_height="match_parent">
<ImageView
android:id="@+id/guard_number_img"
android:layout_width="19dp"
android:layout_height="19dp"
android:layout_gravity="center"
android:src="@mipmap/icon_one_guard"
android:visibility="gone" />
<TextView
android:id="@+id/guard_number_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="4"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold" />
</FrameLayout>
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:scaleType="centerCrop"
android:src="@mipmap/icon_male_default"
app:riv_oval="true" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="6dp">
<TextView
android:id="@+id/user_nicename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用戶昵稱"
android:textColor="@color/white"
android:textSize="14sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="2dp">
<ImageView
android:id="@+id/sex"
android:layout_width="18dp"
android:layout_height="15dp"
android:layout_marginTop="5dp"
android:src="@mipmap/icon_sex_male_1" />
<FrameLayout
android:layout_width="42dp"
android:layout_height="15dp"
android:layout_gravity="bottom"
android:layout_marginStart="6dp">
<ImageView
android:id="@+id/tag_king"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/icon_tag_king" />
<TextView
android:id="@+id/guard_level"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:layout_marginEnd="2dp"
android:gravity="center"
android:text="100"
android:textColor="@color/white"
android:textSize="10sp" />
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="25dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/contribution"
android:textColor="@color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/contribution"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="contribution"
android:textColor="@color/white"
android:textSize="14sp" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 385 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -11,6 +11,7 @@ import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.event.FloatWarOrderEvent; import com.yunbao.common.event.FloatWarOrderEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.live.dialog.LiveBuyGuardDialog; import com.yunbao.live.dialog.LiveBuyGuardDialog;
import com.yunbao.live.dialog.LiveGuardDialog;
import com.yunbao.main.R; import com.yunbao.main.R;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@ -50,13 +51,13 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
ImgLoader.display(mContext, "https://downs.yaoulive.com/gif_trophy.gif", img_trophy); ImgLoader.display(mContext, "https://downs.yaoulive.com/gif_trophy.gif", img_trophy);
img_trophy.setOnLongClickListener(new View.OnLongClickListener() { // img_trophy.setOnLongClickListener(new View.OnLongClickListener() {
@Override // @Override
public boolean onLongClick(View view) { // public boolean onLongClick(View view) {
new LiveBuyGuardDialog(mContext).showDialog(); //
return true; // return true;
} // }
}); // });
} }