diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 101f0d95b..a5d232ec0 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -30,7 +30,6 @@ import com.tencent.imsdk.v2.V2TIMGroupMemberInfo; import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMSimpleMsgListener; import com.tencent.imsdk.v2.V2TIMUserInfo; -import com.yunbao.common.http.Data; import com.yunbao.common.manager.OpenAdManager; import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.BuildConfig; diff --git a/common/src/main/java/com/yunbao/common/Constants.java b/common/src/main/java/com/yunbao/common/Constants.java index 0893cd5ea..58bbd92e6 100644 --- a/common/src/main/java/com/yunbao/common/Constants.java +++ b/common/src/main/java/com/yunbao/common/Constants.java @@ -202,6 +202,8 @@ public class Constants { public static final String LuckyAngel = "LuckyCheck";//幸运天使 public static final String Lucky100Check = "Lucky100Check";//幸运天使 + public static final String PrankSendData = "PrankSendData";//整蛊进度 + public static final int SOCKET_WHAT_CONN = 0; public static final int SOCKET_WHAT_DISCONN = 2; public static final int SOCKET_WHAT_BROADCAST = 1; diff --git a/common/src/main/java/com/yunbao/common/adapter/BaseAdapter.java b/common/src/main/java/com/yunbao/common/adapter/BaseAdapter.java new file mode 100644 index 000000000..e53971c5b --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/BaseAdapter.java @@ -0,0 +1,79 @@ +package com.yunbao.common.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import androidx.recyclerview.widget.RecyclerView; +import java.util.HashMap; +import java.util.List; + +public abstract class BaseAdapter extends RecyclerView.Adapter { + private Context context; + public List data; + + public BaseAdapter(Context context, List data) { + this.context = context; + this.data = data; + } + + @Override + public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View view = LayoutInflater.from(context).inflate(getItemLayoutId(), parent, false); + return new BaseViewHolder(view); + } + + @Override + public void onBindViewHolder(BaseAdapter.BaseViewHolder holder, int position) { + T t = data.get(position); + convert(holder, t); + } + + @Override + public int getItemCount() { + return data == null ? 0 : data.size(); + } + + public abstract void convert(BaseViewHolder holder, T t); + + public abstract int getItemLayoutId(); + + class BaseViewHolder extends RecyclerView.ViewHolder { + + private HashMap views; + + public BaseViewHolder(View itemView) { + super(itemView); + views = new HashMap<>(); + if (onItemClickListener != null){ + itemView.setOnClickListener(v ->onItemClickListener.onItemClick(getAdapterPosition()) ); + } + } + + public View getView(int id) { + View view = views.get(id); + if (view == null) { + view = itemView.findViewById(id); + views.put(id, view); + if (onItemClickListener != null){ + view.setOnClickListener(v -> { + onItemClickListener.onItemChildClick(v, getAdapterPosition()); + }); + } + } + return view; + } + } + + private OnItemClickListener onItemClickListener; + + private void setOnItemClickListener(OnItemClickListener onItemClickListener){ + this.onItemClickListener = onItemClickListener; + } + + public interface OnItemClickListener{ + default void onItemClick(int position){} + + default void onItemChildClick(View view,int position){} + } +} \ No newline at end of file diff --git a/common/src/main/java/com/yunbao/common/bean/AnchorRecommendModel.java b/common/src/main/java/com/yunbao/common/bean/AnchorRecommendModel.java index 8129692a6..d64458a2b 100644 --- a/common/src/main/java/com/yunbao/common/bean/AnchorRecommendModel.java +++ b/common/src/main/java/com/yunbao/common/bean/AnchorRecommendModel.java @@ -24,6 +24,10 @@ public class AnchorRecommendModel extends BaseModel { @SerializedName("live_battle_pass_show_status") private int showWarOrder = 0;//是否显示首页戰令 + @SerializedName("live_battle_pass_image_cn") + private String battlePassImageCn; + @SerializedName("live_battle_pass_image_en") + private String battlePassImageEn; //是否支持换一批0=不支持 1=支持 @SerializedName("up_show") @@ -58,6 +62,22 @@ public class AnchorRecommendModel extends BaseModel { return listShow; } + public String getBattlePassImageCn() { + return battlePassImageCn; + } + + public void setBattlePassImageCn(String battlePassImageCn) { + this.battlePassImageCn = battlePassImageCn; + } + + public String getBattlePassImageEn() { + return battlePassImageEn; + } + + public void setBattlePassImageEn(String battlePassImageEn) { + this.battlePassImageEn = battlePassImageEn; + } + public AnchorRecommendModel setListShow(int listShow) { this.listShow = listShow; return this; diff --git a/common/src/main/java/com/yunbao/common/bean/PrankGiftBean.java b/common/src/main/java/com/yunbao/common/bean/PrankGiftBean.java index a7e6c95a7..ff79d641e 100644 --- a/common/src/main/java/com/yunbao/common/bean/PrankGiftBean.java +++ b/common/src/main/java/com/yunbao/common/bean/PrankGiftBean.java @@ -56,4 +56,15 @@ public class PrankGiftBean extends BaseModel{ public void setGiftId(String giftId) { this.giftId = giftId; } + + @Override + public String toString() { + return "PrankGiftBean{" + + "title='" + title + '\'' + + ", name='" + name + '\'' + + ", icon='" + icon + '\'' + + ", num=" + num + + ", giftId='" + giftId + '\'' + + '}'; + } } diff --git a/common/src/main/java/com/yunbao/common/bean/PrankGiftResultBean.java b/common/src/main/java/com/yunbao/common/bean/PrankGiftResultBean.java new file mode 100644 index 000000000..3835f31d3 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/PrankGiftResultBean.java @@ -0,0 +1,33 @@ +package com.yunbao.common.bean; + +import java.util.List; + +public class PrankGiftResultBean extends BaseModel{ + private List prank_list; + private String status; + private String prank_type; + + public List getPrank_list() { + return prank_list; + } + + public void setPrank_list(List prank_list) { + this.prank_list = prank_list; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getPrank_type() { + return prank_type; + } + + public void setPrank_type(String prank_type) { + this.prank_type = prank_type; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/PrankProgressBean.java b/common/src/main/java/com/yunbao/common/bean/PrankProgressBean.java new file mode 100644 index 000000000..77790c5bc --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/PrankProgressBean.java @@ -0,0 +1,176 @@ +package com.yunbao.common.bean; + +import com.google.gson.JsonElement; + +import java.util.List; + +public class PrankProgressBean extends BaseModel { + private int status;//整蛊状态 0.关闭 1.开启 + private int prank_turntable_status;// 转盘整蛊状态 0=关闭 1=开启 + private int prank_type;// 整蛊类型 1.礼物整蛊 2.连击整蛊 + private List prank_list;// 整蛊进度 + private List completed_list;// 待完成的整蛊 + + public PrankProgressBean(){ + } + + + + public static class PrankList{ + private int gift_id;// 礼物ID + private int gift_num;// 整蛊需要的礼物数量 + private String prank_content; // 整蛊内容 + private int send_num; // 用户已赠送的礼物数量 + private int completed_num;// 待完成的整蛊次数 + private String gift_name;// 礼物名称 + private String gift_icon; // 礼物图片链接 + + private String gift_name_en; + + private int continuous_click_num; + + public int getContinuous_click_num() { + return continuous_click_num; + } + + public void setContinuous_click_num(int continuous_click_num) { + this.continuous_click_num = continuous_click_num; + } + + public String getGift_name_en() { + return gift_name_en; + } + + public void setGift_name_en(String gift_name_en) { + this.gift_name_en = gift_name_en; + } + + public int getGift_id() { + return gift_id; + } + + public void setGift_id(int gift_id) { + this.gift_id = gift_id; + } + + public int getGift_num() { + return gift_num; + } + + public void setGift_num(int gift_num) { + this.gift_num = gift_num; + } + + public String getPrank_content() { + return prank_content; + } + + public void setPrank_content(String prank_content) { + this.prank_content = prank_content; + } + + public int getSend_num() { + return send_num; + } + + public void setSend_num(int send_num) { + this.send_num = send_num; + } + + public int getCompleted_num() { + return completed_num; + } + + public void setCompleted_num(int completed_num) { + this.completed_num = completed_num; + } + + public String getGift_name() { + return gift_name; + } + + public void setGift_name(String gift_name) { + this.gift_name = gift_name; + } + + public String getGift_icon() { + return gift_icon; + } + + public void setGift_icon(String gift_icon) { + this.gift_icon = gift_icon; + } + + //计算完成度 + public double getCompletionRate() { + if (gift_num == 0) return 0; // Avoid division by zero + return (double) send_num / gift_num; + } + + @Override + public String toString() { + return "PrankList{" + + "gift_id=" + gift_id + + ", gift_num=" + gift_num + + ", prank_content='" + prank_content + '\'' + + ", send_num=" + send_num + + ", completed_num=" + completed_num + + ", gift_name='" + gift_name + '\'' + + ", gift_icon='" + gift_icon + '\'' + + ", gift_name_en='" + gift_name_en + '\'' + + ", continuous_click_num=" + continuous_click_num + + '}'; + } + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getPrank_type() { + return prank_type; + } + + public void setPrank_type(int prank_type) { + this.prank_type = prank_type; + } + + public List getPrank_list() { + return prank_list; + } + + public void setPrank_list(List prank_list) { + this.prank_list = prank_list; + } + + public List getCompleted_list() { + return completed_list; + } + + public void setCompleted_list(List completed_list) { + this.completed_list = completed_list; + } + + public int getPrank_turntable_status() { + return prank_turntable_status; + } + + public void setPrank_turntable_status(int prank_turntable_status) { + this.prank_turntable_status = prank_turntable_status; + } + + @Override + public String toString() { + return "PrankProgressBean{" + + "status=" + status + + ", prank_turntable_status=" + prank_turntable_status + + ", prank_type=" + prank_type + + ", prank_list=" + prank_list + + ", completed_list=" + completed_list + + '}'; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/AllServerNotifyFFGGGDJANEvent.java b/common/src/main/java/com/yunbao/common/event/AllServerNotifyFFGGGDJANEvent.java index 447dfa5ab..0b2de7dc5 100644 --- a/common/src/main/java/com/yunbao/common/event/AllServerNotifyFFGGGDJANEvent.java +++ b/common/src/main/java/com/yunbao/common/event/AllServerNotifyFFGGGDJANEvent.java @@ -37,6 +37,8 @@ public class AllServerNotifyFFGGGDJANEvent extends BaseModel { private List buttonStyle; @SerializedName("h5_type") private String h5Type; + @SerializedName("left_image") + private String leftImage; public String getH5Type() { return h5Type; @@ -47,6 +49,14 @@ public class AllServerNotifyFFGGGDJANEvent extends BaseModel { return this; } + public String getLeftImage() { + return leftImage; + } + + public void setLeftImage(String leftImage) { + this.leftImage = leftImage; + } + public String getMethod() { return method; } diff --git a/common/src/main/java/com/yunbao/common/glide/ImgLoader.java b/common/src/main/java/com/yunbao/common/glide/ImgLoader.java index f13262a34..bfd4b2b68 100644 --- a/common/src/main/java/com/yunbao/common/glide/ImgLoader.java +++ b/common/src/main/java/com/yunbao/common/glide/ImgLoader.java @@ -16,6 +16,7 @@ import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.target.CustomTarget; import com.bumptech.glide.request.transition.Transition; import com.yunbao.common.R; +import com.yunbao.common.interfaces.OnItemClickListener; import java.io.File; @@ -226,14 +227,20 @@ public class ImgLoader { .skipMemoryCache(SKIP_MEMORY_CACHE) .into(imageView); } - public static void displayDrawable(Context context, String url, final DrawableCallback callback) { + displayDrawable(context, url, -1, -1, callback); + } + public static void displayDrawable(Context context, String url, int width, int height, final DrawableCallback callback) { if (TextUtils.isEmpty(url) || !contextIsExist(context)) { if (callback != null) callback.onLoadFailed(); } else { - Glide.with(context).asDrawable().load(url).thumbnail(thumbnail).skipMemoryCache(SKIP_MEMORY_CACHE).into(new CustomTarget() { + RequestBuilder builder = Glide.with(context).asDrawable().load(url); + if (width != -1 && height != -1) { + builder = builder.override(width, height); + } + builder.thumbnail(thumbnail).skipMemoryCache(SKIP_MEMORY_CACHE).into(new CustomTarget() { @Override public void onResourceReady(@NonNull Drawable resource, @Nullable Transition transition) { diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 79932a5a6..e0e42ce10 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -54,7 +54,9 @@ import com.yunbao.common.bean.NobleTrumpetModel; import com.yunbao.common.bean.OpenAdModel; import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.PrankGiftBean; +import com.yunbao.common.bean.PrankGiftResultBean; import com.yunbao.common.bean.PrankHttpTurntableBean; +import com.yunbao.common.bean.PrankProgressBean; import com.yunbao.common.bean.QuickGiftSendGiftModel; import com.yunbao.common.bean.RandomPkUserBean; import com.yunbao.common.bean.RankPkInfoBean; @@ -505,7 +507,16 @@ public interface PDLiveApi { * 获取整蛊列表 */ @GET("/api/public/?service=Prank.prankList") - Observable>> prankList(@Query("anchor_id") String anchor_id); + Observable>prankList( + @Query("anchor_id") String anchor_id, + @Query("prank_type") String prank_type + ); + + /** + * 获取整蛊进度列表 + */ + @GET("/api/public/?service=Prank.prankCompletedList") + Observable> getPrankProgressList(@Query("anchor_id") String anchor_id); /** * 设置礼物整蛊 @@ -513,9 +524,11 @@ public interface PDLiveApi { @GET("/api/public/?service=Prank.setPrank") Observable>> setPrank( @Query("anchor_id") String anchor_id, - @Query("gift_id") String gift_id, - @Query("gift_num") String gift_num, - @Query("prank_content") String prank_content + @Query("status") String status, + @Query("prank_json") String prank_json, + @Query("prank_type") String prank_type, + @Query("is_cleared") String is_cleared + ); /** @@ -1235,4 +1248,17 @@ public interface PDLiveApi { ); @GET("/api/public/?service=Tx.getShengwangToken") Observable> getSwToken(); + + + /** + * + * @param anchor_id + * @param gift_id + * @return + */ + @GET("/api/public/?service=Prank.anchorClickFinish") + Observable>> anchorClickFinish( + @Query("anchor_id")String anchor_id, + @Query("gift_id")String gift_id + ); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 73966ce7c..29fa05c34 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -54,7 +54,9 @@ import com.yunbao.common.bean.NobleTrumpetModel; import com.yunbao.common.bean.OpenAdModel; import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.PrankGiftBean; +import com.yunbao.common.bean.PrankGiftResultBean; import com.yunbao.common.bean.PrankHttpTurntableBean; +import com.yunbao.common.bean.PrankProgressBean; import com.yunbao.common.bean.QuickGiftSendGiftModel; import com.yunbao.common.bean.RandomPkUserBean; import com.yunbao.common.bean.RankPkInfoBean; @@ -880,9 +882,9 @@ public class LiveNetManager { /** * 获取转盘整蛊列表 */ - public void getPrankGiftList(String mLiveUid, HttpCallback> callback) { + public void getPrankGiftList(String mLiveUid, String prank_type,HttpCallback callback) { API.get().pdLiveApi(mContext) - .prankList(mLiveUid) + .prankList(mLiveUid,prank_type) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(responseModel -> { @@ -899,12 +901,31 @@ public class LiveNetManager { }).isDisposed(); } + /** + * 获取整蛊进度列表 + */ + public void getPrankProgressList(String mLiveUid, HttpCallback callback){ + API.get().pdLiveApi(mContext) + .getPrankProgressList(mLiveUid) + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe(responseModel->{ + if (callback != null){ + callback.onSuccess(responseModel.getData().getInfo()); + } + },throwable->{ + if (callback != null){ + callback.onError(throwable.getMessage()); + } + } ).isDisposed(); + } + /** * 设置礼物整蛊 */ - public void setPrankGift(String mLiveUid, String gift_id, String gift_num, String prank_content, HttpCallback callback) { + public void setPrankGift(String mLiveUid, String status, String prank_json,String prank_type,String is_cleared, HttpCallback callback) { API.get().pdLiveApi(mContext) - .setPrank(mLiveUid, gift_id, gift_num, prank_content) + .setPrank(mLiveUid, status, prank_json, prank_type,is_cleared) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(responseModel -> { @@ -3192,6 +3213,31 @@ public class LiveNetManager { } + public void anchorClickFinish(String mLiveId, String giftId, HttpCallback>callback) { + API.get().pdLiveApi(mContext) + .anchorClickFinish(mLiveId, giftId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + + } + + public void updateFile(File file, HttpCallback callback) { MultipartBody.Part uploadFile = createUploadFile(file); API.get().pdLiveApi(mContext) diff --git a/common/src/main/java/com/yunbao/common/utils/ViewUtils.java b/common/src/main/java/com/yunbao/common/utils/ViewUtils.java new file mode 100644 index 000000000..a36d8d4e4 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/utils/ViewUtils.java @@ -0,0 +1,12 @@ +package com.yunbao.common.utils; + +import android.view.View; + +public class ViewUtils { + public static T findViewById(View view,int id,Class clazz){ + return view.findViewById(id); + } + public static T findViewById(View view,int id){ + return view.findViewById(id); + } +} diff --git a/common/src/main/res/drawable/live_room_menu_red.xml b/common/src/main/res/drawable/live_room_menu_red.xml new file mode 100644 index 000000000..b45eac8b0 --- /dev/null +++ b/common/src/main/res/drawable/live_room_menu_red.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_live_new_function.xml b/common/src/main/res/layout/dialog_live_new_function.xml index e9d7d76f0..c3f4f3f5b 100644 --- a/common/src/main/res/layout/dialog_live_new_function.xml +++ b/common/src/main/res/layout/dialog_live_new_function.xml @@ -182,10 +182,34 @@ android:gravity="center" android:orientation="vertical"> - + android:layout_height="40dp"> + + + + + + + Whether to enter the live broadcast room No,only enter the game There are currently no rooms to join - Turntable prank switch - After closing, all users will not be able to see the contents of the turntable - The turntable consumes diamonds every time - Minimum requirement of 1000 diamonds - Fill in the content of the prank,Fill in a minimum of 2 words and a maximum of 10 words + Turntable Trick Switch + After turning it on, all users will not be able to see the content of the carousel. + Each turn of the wheel consumes diamonds + Starting with at least 1000 diamonds + Choose a gift You have not set up the prank content yet Choose a prank gift Enter the prank content... diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 2700ca336..0ca615a3c 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1499,5 +1499,6 @@ 2.用戶關注主播並參與活動,將在倒計時五分鐘結束後瓜分活動金豆; 3.此活動的最終解釋權歸PDLIVE所有。 短劇 + 完成*1 主播正在PK,稍後再試 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 788dd6e47..d2ff10baf 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1498,5 +1498,6 @@ 2.用戶關注主播並參與活動,將在倒計時五分鐘結束後瓜分活動金豆; 3.此活動的最終解釋權歸PDLIVE所有。 短劇 + 完成*1 主播正在PK,稍後再試 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 2a811eb5b..f118df88a 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1495,6 +1495,7 @@ 2.用戶關注主播並參與活動,將在倒計時五分鐘結束後瓜分活動金豆; 3.此活動的最終解釋權歸PDLIVE所有。 短劇 + 完成*1 主播正在PK,稍後再試 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 9523697f8..136420081 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1356,11 +1356,11 @@ Limited ride And limited avatar frame Whether to enter the live broadcast room No,only enter the game There are currently no rooms to join - Turntable prank switch - After closing, all users will not be able to see the contents of the turntable - The turntable consumes diamonds every time - Minimum requirement of 1000 diamonds - Fill in the content of the prank,Fill in a minimum of 2 words and a maximum of 10 words + Turntable Trick Switch + After turning it on, all users will not be able to see the content of the carousel. + Each turn of the wheel consumes diamonds + Starting with at least 1000 diamonds + Choose a gift You have not set up the prank content yet Choose a prank gift Enter the prank content... @@ -1505,4 +1505,5 @@ Limited ride And limited avatar frame 3.The final interpretation of this activity belongs to PDLIVE. Theater The anchor is in PK, please try again later + once diff --git a/common/src/main/res/values/style.xml b/common/src/main/res/values/style.xml index c444de78d..190d8d7e2 100644 --- a/common/src/main/res/values/style.xml +++ b/common/src/main/res/values/style.xml @@ -131,4 +131,10 @@ @anim/out_to_right_abit @anim/out_to_right + + + \ No newline at end of file diff --git a/config.gradle b/config.gradle index b25433db4..8d39b5e05 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,11 @@ ext { ] manifestPlaceholders = [ //正式、 - serverHost : "https://napi.yaoulive.com", +// serverHost : "https://napi.yaoulive.com", // 测试 -// serverHost : "https://ceshi.yaoulive.com", + serverHost : "https://ceshi.yaoulive.com", + + buildTime : new Date().format("MM-dd HH:mm", TimeZone.getTimeZone("GMT+8")), buildTime : new Date().format("MM-dd HH:mm", TimeZone.getTimeZone("GMT+8")), diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java index 93d0aff7a..a5f335d3e 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -771,13 +771,15 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL mLiveSwLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1); pr = new pkRunnable(pkUid, pkhead, pkname, isLadders); mHandler.postDelayed(pr, 4000);//3秒后执行Runnable中的run方法 + mLiveRoomViewHolder.initAnchorSay(); + mLiveRoomViewHolder.closePrankView(); } } else { if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) { mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1); pr = new pkRunnable(pkUid, pkhead, pkname, isLadders); mHandler.postDelayed(pr, 4000);//3秒后执行Runnable中的run方法 - + mLiveRoomViewHolder.closePrankView(); } } } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java index 75e1bbd4b..9085ab432 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java @@ -1057,6 +1057,11 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic } + @Override + public void onUpdatePrankProgress(String prankString) { + + } + /** * 腾讯sdk连麦时候主播混流 */ diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index c985b8ad6..46de579c3 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -618,6 +618,11 @@ public class LiveAudienceActivity extends LiveActivity { manager.prankTurntable(msgtype, time, jsonObject); } + @Override + public void onUpdatePrankProgress(String prankString) { + + } + @Override public void onBackPressed() { if (manager != null && manager.getsudGameMin()) { diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index 7f8f63d23..ee9bcad2a 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -266,7 +266,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mContainerWrap = (ViewGroup) findViewById(R.id.container_wrap); mContainer = (ViewGroup) findViewById(R.id.container); mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePushViewHolder, true, mContainer); - RandomPkManager.getInstance().addOnRandomPkTimer(onRandomPkTimer); //添加开播前设置控件 @@ -298,8 +297,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl ToastUtil.show(mContext.getString(R.string.live_push_failed)); } }); - - } private void initFaceManager() { @@ -378,8 +375,17 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl case Constants.LIVE_FUNC_ZG://zg // ToastUtil.show("開發中,敬請期待"); LivePrankDialogFragment fragment = new LivePrankDialogFragment(); + fragment.setOnPrankResultListener(new LivePrankDialogFragment.onPrankResultListener() { + @Override + public void OpenAndCloseListener() { + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.initPrankProgress(1); + } + } + }); fragment.setmLiveUid(mLiveUid); fragment.show(getSupportFragmentManager(), "LivePrankDialogFragment"); + mLiveAnchorViewHolder.closeMenuRed(); break; case Constants.LIVE_FUNC_MIC://語音 //ToastUtil.show("開發中,敬請期待"); @@ -698,6 +704,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl bundle.putBoolean("isPk", isDRPK == 1 || PKing || mLivePushViewHolder.isPking()); bundle.putLong("liveTime", mLiveAnchorViewHolder.getmAnchorLiveTime()); bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen()); + bundle.putBoolean("isShowZgRed",mLiveAnchorViewHolder.isShowMenuRed()); fragment.setArguments(bundle); fragment.setFunctionClickListener(this); fragment.show(getSupportFragmentManager(), "LiveFunctionDialogFragment"); @@ -806,6 +813,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveRoomViewHolder.initAnchorSay(); mLiveRoomViewHolder.setGiftWall(obj.getString("gift_wall_lighten_number"), obj.getString("gift_wall_lighten_total")); } + mLiveRyLinkMicPkPresenter.setmLiveRoomViewHolder(mLiveRoomViewHolder); if (mLiveAnchorViewHolder == null) { mLiveAnchorViewHolder = new LiveRyAnchorViewHolder(mContext, mContainer); mLiveAnchorViewHolder.setLiveBean(mLiveBean); @@ -871,6 +879,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl getAiRobotStatus(); MicedUserManager.get().removeAllMicUserList(); MicUserManager.get().removeAllMicUserList(); + //加载整蛊 + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.initPrankProgress(2); + mLiveRoomViewHolder.sendMsgPrank(); + } } /** @@ -1455,6 +1468,13 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl } } + @Override + public void onUpdatePrankProgress(String prankString) { + if (mLiveRoomViewHolder != null){ + mLiveRoomViewHolder.refreshPrank(prankString); + } + } + /** * 腾讯sdk连麦时候主播混流 diff --git a/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java index 3a24f262b..e676ccb52 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveSwAnchorActivity.java @@ -25,7 +25,6 @@ import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.DialogFragment; - import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; @@ -246,7 +245,6 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl mContainerWrap = (ViewGroup) findViewById(R.id.container_wrap); mContainer = (ViewGroup) findViewById(R.id.container); mLiveSwLinkMicPkPresenter = new LiveSwLinkMicPkPresenter(mContext, mLivePushViewHolder, true, mContainer); - RandomPkManager.getInstance().addOnRandomPkTimer(onRandomPkTimer); manager.setOnMirrorChanged(new FaceManager.OnMirrorChanged() { @@ -366,8 +364,17 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl case Constants.LIVE_FUNC_ZG://zg // ToastUtil.show("開發中,敬請期待"); LivePrankDialogFragment fragment = new LivePrankDialogFragment(); + fragment.setOnPrankResultListener(new LivePrankDialogFragment.onPrankResultListener() { + @Override + public void OpenAndCloseListener() { + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.initPrankProgress(1); + } + } + }); fragment.setmLiveUid(mLiveUid); fragment.show(getSupportFragmentManager(), "LivePrankDialogFragment"); + mLiveAnchorViewHolder.closeMenuRed(); break; case Constants.LIVE_FUNC_MIC://語音 //ToastUtil.show("開發中,敬請期待"); @@ -692,6 +699,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl bundle.putBoolean("isPk", isDRPK == 1 || PKing || mLivePushViewHolder.isPking()); bundle.putLong("liveTime", mLiveAnchorViewHolder.getmAnchorLiveTime()); bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen()); + bundle.putBoolean("isShowZgRed",mLiveAnchorViewHolder.isShowMenuRed()); fragment.setArguments(bundle); fragment.setFunctionClickListener(this); fragment.show(getSupportFragmentManager(), "LiveFunctionDialogFragment"); @@ -865,6 +873,12 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl getAiRobotStatus(); MicedUserManager.get().removeAllMicUserList(); MicUserManager.get().removeAllMicUserList(); + //加载整蛊 + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.initPrankProgress(2); + mLiveRoomViewHolder.sendMsgPrank(); + } + mLiveSwLinkMicPkPresenter.setmLiveRoomViewHolder(mLiveRoomViewHolder); } /** @@ -1472,6 +1486,13 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl } } + @Override + public void onUpdatePrankProgress(String prankString) { + if (mLiveRoomViewHolder != null){ + mLiveRoomViewHolder.refreshPrank(prankString); + } + } + /** * 腾讯sdk连麦时候主播混流 diff --git a/live/src/main/java/com/yunbao/live/adapter/ComboAdapter.java b/live/src/main/java/com/yunbao/live/adapter/ComboAdapter.java new file mode 100644 index 000000000..3f9b18ba6 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/ComboAdapter.java @@ -0,0 +1,76 @@ +package com.yunbao.live.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.bean.PrankProgressBean; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.live.R; + +import java.util.ArrayList; +import java.util.List; + +public class ComboAdapter extends RecyclerView.Adapter{ + + private List mList = new ArrayList<>(); + private Context mContext; + + public ComboAdapter(Context context){ + mContext = context; + } + + public void setList(List list){ + mList.clear(); + mList.addAll(list); + notifyDataSetChanged(); + } + + @NonNull + @Override + public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new MyViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_combo_vote, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { + PrankProgressBean.PrankList data = mList.get(position); + holder.itemView.setOnClickListener(v-> onItemClickListener.onItemClick(v,data.getGift_id())); + holder.combo_item_prank_name.setText(data.getPrank_content()); + ImgLoader.display(mContext,data.getGift_icon(),holder.combo_item_icon); + holder.combo_item_combo.setText(String.valueOf(data.getSend_num())); + } + + @Override + public int getItemCount() { + return mList.size(); + } + + class MyViewHolder extends RecyclerView.ViewHolder{ + + private TextView combo_item_prank_name,combo_item_combo; + private ImageView combo_item_icon; + + public MyViewHolder(@NonNull View itemView){ + super(itemView); + combo_item_prank_name = itemView.findViewById(R.id.combo_item_prank_name); + combo_item_combo = itemView.findViewById(R.id.combo_item_combo); + combo_item_icon = itemView.findViewById(R.id.combo_item_icon); + } + } + + private OnItemClickListener onItemClickListener; + + public interface OnItemClickListener { + void onItemClick(View view,int giftId); + } + + public void addOnItemClickListener(OnItemClickListener onItemClickListener){ + this.onItemClickListener = onItemClickListener; + } +} diff --git a/live/src/main/java/com/yunbao/live/adapter/FrameGiftAdapter.java b/live/src/main/java/com/yunbao/live/adapter/FrameGiftAdapter.java index 6e5acb0f2..5e2b22877 100644 --- a/live/src/main/java/com/yunbao/live/adapter/FrameGiftAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/FrameGiftAdapter.java @@ -42,6 +42,7 @@ public class FrameGiftAdapter extends RecyclerView.Adapter { if (!TextUtils.isEmpty(wishGiftId) && TextUtils.equals(giftJson.get(position).getId() + "", wishGiftId)) { Bus.get().post(new LiveGiftItemEvent().setLiveGiftModel(giftJson.get(position))); + wishGiftId = null; } FrameGiftViewHolder frameGiftViewHolder = (FrameGiftViewHolder) holder; diff --git a/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java index 6ce23c031..4e255eded 100644 --- a/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/FreePkRecyclerAdapter.java @@ -146,31 +146,13 @@ public class FreePkRecyclerAdapter extends RefreshAdapter { if (code == 0 && info.length > 0) { JSONObject obj = JSON.parseObject(info[0]); if (obj != null) { - if (TextUtils.equals(obj.getString("ispk"), "0")) {//自己不在PK,可以发起邀请 - + if(mDrPkNum!=-1){ LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info)); //非0认为未开通连麦权限 if (code != 0) { - if (mDrPkNum == -1) { - if (WordUtil.isNewZh()) { - ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功"); - } else { - ToastUtil.show("invite " + bean.getUserNiceName() + " successful"); - } - mOnItemClickListener.onItemClick(bean, -1); - if(mContext instanceof LiveSwAnchorActivity){ - ((LiveSwAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(), - false); - }else{ - ((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(), - ((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString() - ); - } - return; - } if (mDrPkNum <= 0) { if (WordUtil.isNewZh()) { ToastUtil.show("多人次數已用完"); @@ -203,10 +185,44 @@ public class FreePkRecyclerAdapter extends RefreshAdapter { } }); }else{ - if (WordUtil.isNewZh()) { - ToastUtil.show("請先關閉PK"); - } else { - ToastUtil.show("Please disable the PK"); + if (TextUtils.equals(obj.getString("ispk"), "0")) {//自己不在PK,可以发起邀请 + LiveHttpUtil.getMicList(liveUid, 0, new com.yunbao.common.http.HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.deepToString(info)); + //非0认为未开通连麦权限 + if (code != 0) { + if (mDrPkNum == -1) { + if (WordUtil.isNewZh()) { + ToastUtil.show("邀请 " + bean.getUserNiceName() + " 发送成功"); + } else { + ToastUtil.show("invite " + bean.getUserNiceName() + " successful"); + } + mOnItemClickListener.onItemClick(bean, -1); + if(mContext instanceof LiveSwAnchorActivity){ + ((LiveSwAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(), + false); + }else{ + ((LiveRyAnchorActivity) mContext).linkMicAnchorApply(bean.getId(), bean.getId(), + ((LiveRyAnchorActivity) mContext).buildLinkMicJSON().toString() + ); + } + } + } else { + if (WordUtil.isNewZh()) { + ToastUtil.show("請先關閉語音連麥"); + } else { + ToastUtil.show("Please disable the voice connection first"); + } + } + } + }); + }else{ + if (WordUtil.isNewZh()) { + ToastUtil.show("請先關閉PK"); + } else { + ToastUtil.show("Please disable the PK"); + } } } } diff --git a/live/src/main/java/com/yunbao/live/adapter/ItemLivePrankGiftNumberAdapter.java b/live/src/main/java/com/yunbao/live/adapter/ItemLivePrankGiftNumberAdapter.java new file mode 100644 index 000000000..38c3b14fc --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/ItemLivePrankGiftNumberAdapter.java @@ -0,0 +1,79 @@ +package com.yunbao.live.adapter; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.live.R; + +import java.util.ArrayList; +import java.util.List; + +public class ItemLivePrankGiftNumberAdapter extends RecyclerView.Adapter { + List list = new ArrayList<>(); + int selectNumber; + OnSelectNumberListener onSelectNumberListener; + + public void setOnSelectNumberListener(OnSelectNumberListener onSelectNumberListener) { + this.onSelectNumberListener = onSelectNumberListener; + } + + public void setSelectNumber(int selectNumber) { + this.selectNumber = selectNumber; + } + + public int getSelectNumber() { + return selectNumber; + } + + public void setList(List list) { + this.list = list; + notifyDataSetChanged(); + } + + @NonNull + @Override + public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_prank_dialog_add_gift_number, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull ViewHolder holder, int position) { + holder.setData(list.get(position), selectNumber); + } + + @Override + public int getItemCount() { + return list.size(); + } + + public interface OnSelectNumberListener { + void onSelectNumber(int number); + } + + public class ViewHolder extends RecyclerView.ViewHolder { + private Button button; + + public ViewHolder(@NonNull View itemView) { + super(itemView); + button = itemView.findViewById(R.id.coin); + } + + public void setData(int number, int selectNumber) { + button.setText(String.valueOf(number)); + if (number == selectNumber) { + button.setBackgroundResource(R.drawable.bg_prank_btn_gift_add_number); + } else { + button.setBackgroundResource(R.drawable.bg_prank_coin); + } + button.setOnClickListener(view -> { + ItemLivePrankGiftNumberAdapter.this.selectNumber = number; + notifyDataSetChanged(); + }); + } + } +} diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java index bac417ed9..3c739cc9f 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -6,6 +6,8 @@ import static com.yunbao.live.bean.LiveChatBean.LUCKY_ANGEL; import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY; import static com.yunbao.live.bean.LiveChatBean.STAR_CHALLENGE_UPGRADE_NOTIFY; import static com.yunbao.live.bean.LiveChatBean.SYSTEM3_COLOR; +import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_ANCHOR_PRANK; +import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_ANCHOR_PRANK_GIFT; import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_USER_MSG; import static com.yunbao.live.bean.LiveChatBean.WISH_LIST_PROGRESS; import static com.yunbao.live.bean.LiveChatBean.XYD_COMPLETE; @@ -219,6 +221,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter { LinearLayoutCompat attentionLayout; ClipPathCircleImage clipImage2; + LinearLayoutCompat prank_open_live_layout; + TextView prank_open_live_msg; + TextView prank_to_setting; + public Vh(View itemView) { super(itemView); mBg = (LinearLayout) itemView.findViewById(R.id.bg); @@ -245,6 +251,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter { btnAttention = (ImageView) itemView.findViewById(R.id.btn_attention); textLeave = (ImageView) itemView.findViewById(R.id.text_leave); + prank_open_live_layout = itemView.findViewById(R.id.prank_open_live_layout); + prank_open_live_msg = itemView.findViewById(R.id.prank_open_live_msg); + prank_to_setting = itemView.findViewById(R.id.prank_to_setting); + } void setData(final LiveChatBean bean, int position) { @@ -255,9 +265,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.INPUT_DIALOG) .setOlineUserlistModel(new OlineUserlistModel().setId(bean.getId()).setUserNicename(bean.getUserNiceName()))); - } - Log.e("eqwewqeweq", bean.toString()); return true; } @@ -521,7 +529,29 @@ public class LiveChatAdapter extends RecyclerView.Adapter { if (!StringUtil.isEmpty(bean.getBubble())) { new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1); } - } else { + } else if(bean.getType() == TYPE_TO_ANCHOR_PRANK){ + /*String str1 = "娛樂整蠱"; + String str2 = "全新升級,快去設置整蠱内容,給直播間增加更多趣味吧!"; + String str3 = ">>立即前往>>"; + mTextView.setText(Html.fromHtml(str1+str2+str3)); + new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);*/ + + LinearLayout.LayoutParams params3 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + params3.setMargins(0, 8, DpUtil.dp2px(80), 8); + params3.gravity = Gravity.CENTER_VERTICAL; + mBg.setLayoutParams(params3); + prank_open_live_layout.setVisibility(View.VISIBLE); + + }else if(bean.getType() == TYPE_TO_ANCHOR_PRANK_GIFT){ + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append(""+(WordUtil.isNewZh()?"整蠱來了!":"Tricky is coming")+""); + stringBuffer.append(" "+bean.getUserNiceName()+""); + stringBuffer.append(""+(WordUtil.isNewZh()?"送出":"send")+"【"+bean.getGiftName()+"*"+bean.getHot_num()+"】"); + stringBuffer.append(","+(WordUtil.isNewZh()?"主播需完成":",and the anchor needs to complete ")+""); + stringBuffer.append( "【"+bean.getContent()+"】"); + mTextView.setText(Html.fromHtml(stringBuffer.toString())); + new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); + }else{ if (bean.getBubble() != null && !bean.getBubble().equals("")) { //加载.9图聊天气泡 new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1); diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveParcelItemAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveParcelItemAdapter.java index dad11e84a..d05fb0dcb 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveParcelItemAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveParcelItemAdapter.java @@ -11,6 +11,7 @@ import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.utils.Bus; import com.yunbao.live.R; import com.yunbao.live.event.LiveGiftItemEvent; +import com.yunbao.live.event.LiveParcelItemRefreshEvent; import com.yunbao.live.views.LiveParcelItemViewHolder; import java.util.ArrayList; @@ -56,9 +57,11 @@ public class LiveParcelItemAdapter extends RecyclerView.Adapter { notifyDataSetChanged(); } - public void refreshWrapListAfterSend(LiveGiftBean model) { + public void refreshWrapListAfterSend(LiveParcelItemRefreshEvent refreshEvent) { + LiveGiftBean liveGiftBean = refreshEvent.getLiveGiftModel(); + int sendCount = refreshEvent.getSendCount();//赠送礼物数量 for (int i = 0; i < giftJson.size(); i++) { - if (giftJson.get(i).getId() == model.getId()) { + if (giftJson.get(i).getId() == liveGiftBean.getId()) { String giftNum = giftJson.get(i).getGiftNum(); @@ -70,10 +73,11 @@ public class LiveParcelItemAdapter extends RecyclerView.Adapter { number = 0; } if (number == 1) { - + //如果礼物只剩一个,直接移除礼物 giftJson.remove(i); } else { - giftJson.get(i).setGiftNum(String.valueOf(number - 1)); + //设置送礼后的礼物数量 + giftJson.get(i).setGiftNum(String.valueOf(number - sendCount)); } } } diff --git a/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java index a00862fad..fada088a7 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java @@ -1,5 +1,6 @@ package com.yunbao.live.adapter; +import android.annotation.SuppressLint; import android.app.Dialog; import android.content.Context; import android.view.LayoutInflater; @@ -17,6 +18,7 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; @@ -107,7 +109,6 @@ public class LivePrankRecyclerAdapter extends RecyclerView.Adapter { PrankGiftBean bean = (PrankGiftBean) v.getTag(); onItemClickListener.onItemClick(bean.getGiftId(), (Integer) itemView.getTag()); }); - } + @SuppressLint("SetTextI18n") public void setDate(PrankGiftBean bean, int position) { ImgLoader.display(mContext, bean.getIcon(), mIcon); itemView.setTag(position); mName.setText(bean.getName()); mTitle.setText(bean.getTitle()); - mNum.setText(bean.getNum() + ""); mRemove.setTag(bean); } @@ -148,11 +147,11 @@ public class LivePrankRecyclerAdapter extends RecyclerView.Adapter { if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - DialogUitl.showSimpleInputDialog(mContext, "填寫整蠱內容", DialogUitl.INPUT_TYPE_TEXT, 10, new DialogUitl.SimpleCallback() { + DialogUitl.showSimpleInputDialog(mContext, WordUtil.isNewZh() ? "填寫整蠱內容" : "prank content", DialogUitl.INPUT_TYPE_TEXT, 10, new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { if (WordUtil.isSpecialChar(content)) { - ToastUtil.show("整蠱內容不能包含特殊字符"); + ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容不能包含特殊字符" : "The prank content must not contain special characters"); return; } if (content.length() >= 2 && content.length() <= 10) { @@ -205,23 +204,67 @@ public class LivePrankRecyclerAdapter extends RecyclerView.Adapter { + + private List mList = new ArrayList<>(); + private Context mContext; + + private boolean isAn; + + public static final int TYPE_GIFT = 1; + public static final int TYPE_COMBO = 2; + private int viewType1 = TYPE_GIFT; + + public PrankAdapter(Context context){ + mContext = context; + } + public void setViewType(int viewType) { + this.viewType1 = viewType; + } + + public void setList(List list){ + mList.clear(); + mList.addAll(list); + notifyDataSetChanged(); + } + + public void showAnView(List list,boolean isAn){ + this.isAn = isAn; + mList.clear(); + mList.addAll(list); + notifyDataSetChanged(); + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + if (viewType1 ==TYPE_GIFT){ + return new MyViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_prank_progress, parent, false)); + }else{ + return new MyComboViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_combo_vote, parent, false)); + } + } + + @SuppressLint("SetTextI18n") + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { + PrankProgressBean.PrankList data = mList.get(position); + if(viewHolder instanceof MyViewHolder){ + MyViewHolder holder = (MyViewHolder) viewHolder; + holder.itemView.setOnClickListener(v-> onItemClickListener.onItemClick(v,data.getGift_id())); + int completedNum = data.getCompleted_num(); + if (completedNum>99){ + holder.prank_item_subscript.setText("99+"); + }else { + holder.prank_item_subscript.setText(String.valueOf(data.getCompleted_num())); + } + holder.prank_item_prank_name.setText(data.getPrank_content()); + holder.prank_item_gift_name.setText(WordUtil.isNewZh() ? data.getGift_name() : data.getGift_name_en()); + holder.prank_item_now_progress.setText(String.valueOf(data.getSend_num())); + holder.prank_item_total_progress.setText("/"+ data.getGift_num()); + ImgLoader.display(mContext,data.getGift_icon(),holder.prank_item_icon); + holder.prank_item_progress.setMax(data.getGift_num()); + holder.prank_item_progress.setProgress(data.getSend_num()); + holder.an_prank_name.setText(data.getPrank_content()); + holder.an_prank_remove.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + onItemClickListener.onItemDel(data.getGift_id()); + } + }); + if(isAn){ + holder.anLayout.setVisibility(View.VISIBLE); + holder.progressLayout.setVisibility(View.GONE); + holder.nameLayout.setVisibility(View.GONE); + }else{ + holder.anLayout.setVisibility(View.GONE); + holder.progressLayout.setVisibility(View.VISIBLE); + holder.nameLayout.setVisibility(View.VISIBLE); + } + }else{ + MyComboViewHolder holder = (MyComboViewHolder) viewHolder; + holder.itemView.setOnClickListener(v-> onItemClickListener.onItemClick(v,data.getGift_id())); + holder.combo_item_prank_name.setText(data.getPrank_content()); + ImgLoader.display(mContext,data.getGift_icon(),holder.combo_item_icon); + holder.combo_item_combo.setText(String.valueOf(data.getSend_num())); + } + } + + @Override + public int getItemCount() { + return mList.size(); + } + + class MyViewHolder extends RecyclerView.ViewHolder{ + private TextView prank_item_subscript,prank_item_prank_name,prank_item_gift_name,prank_item_now_progress,prank_item_total_progress; + private ImageView prank_item_icon; + private ProgressBar prank_item_progress; + private LinearLayout anLayout; + private MarqueeTextView an_prank_name; + private TextView an_prank_remove; + private LinearLayout progressLayout; + private LinearLayout nameLayout; + public MyViewHolder(@NonNull View itemView) { + super(itemView); + prank_item_subscript = itemView.findViewById(R.id.prank_item_subscript); + prank_item_prank_name = itemView.findViewById(R.id.prank_item_prank_name); + prank_item_gift_name = itemView.findViewById(R.id.prank_item_gift_name); + prank_item_now_progress = itemView.findViewById(R.id.prank_item_now_progress); + prank_item_total_progress = itemView.findViewById(R.id.prank_item_total_progress); + prank_item_icon = itemView.findViewById(R.id.prank_item_icon); + prank_item_progress = itemView.findViewById(R.id.prank_item_progress); + + nameLayout = itemView.findViewById(R.id.nameLayout); + progressLayout = itemView.findViewById(R.id.progressLayout); + //主播 + anLayout = itemView.findViewById(R.id.anLayout); + an_prank_name = itemView.findViewById(R.id.an_prank_name); + an_prank_remove = itemView.findViewById(R.id.an_prank_remove); + } + } + + class MyComboViewHolder extends RecyclerView.ViewHolder{ + + private TextView combo_item_prank_name,combo_item_combo; + private ImageView combo_item_icon; + + public MyComboViewHolder(@NonNull View itemView){ + super(itemView); + combo_item_prank_name = itemView.findViewById(R.id.combo_item_prank_name); + combo_item_combo = itemView.findViewById(R.id.combo_item_combo); + combo_item_icon = itemView.findViewById(R.id.combo_item_icon); + } + } + + + private OnItemClickListener onItemClickListener; + + public interface OnItemClickListener { + void onItemClick(View view,int giftId); + + void onItemDel(int giftId); + } + + public void addOnItemClickListener(OnItemClickListener onItemClickListener){ + this.onItemClickListener = onItemClickListener; + } +} diff --git a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java index e074fd2fa..322fff5fe 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java @@ -30,7 +30,8 @@ public class LiveChatBean { public static final int WISH_LIST_PROGRESS = 307;//心愿单进度通知 public static final int BLIND_BOX = 409;//盲盒礼物消息 public static final int TYPE_TO_USER_MSG = 500;//指定信息 - + public static final int TYPE_TO_ANCHOR_PRANK = 501;//整蠱-開播提示語 + public static final int TYPE_TO_ANCHOR_PRANK_GIFT = 502;//整蠱-禮物 private String id; private String userNiceName; @@ -68,6 +69,14 @@ public class LiveChatBean { return WordUtil.isNewZh() ? giftName : giftname_en; } + public String getGiftname_en() { + return giftname_en; + } + + public void setGiftname_en(String giftname_en) { + this.giftname_en = giftname_en; + } + public LiveChatBean setGiftName(String giftName) { this.giftName = giftName; return this; diff --git a/live/src/main/java/com/yunbao/live/dialog/GiftPopDialog.java b/live/src/main/java/com/yunbao/live/dialog/GiftPopDialog.java index ac1340c5d..4694205e4 100644 --- a/live/src/main/java/com/yunbao/live/dialog/GiftPopDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/GiftPopDialog.java @@ -217,7 +217,7 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene for (int i = 0; i < list.size(); i++) { JSONObject data = list.getJSONObject(i); GiftTopBean giftTopBean = new GiftTopBean(); - giftTopBean.setName(WordUtil.isNewZh()?data.getString("name"):data.getString("en_name")); + giftTopBean.setName(WordUtil.isNewZh() ? data.getString("name") : data.getString("en_name")); name.add(giftTopBean); } @@ -265,17 +265,17 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene public void onClick(View view) { int id = view.getId(); if (id == R.id.btn_send) { - DialogUitl.showSimpleInputDialog(mContext, WordUtil.isNewZh() ?"輸入數量":"Input quantity", DialogUitl.INPUT_TYPE_NUMBER, new DialogUitl.SimpleCallback() { + DialogUitl.showSimpleInputDialog(mContext, WordUtil.isNewZh() ? "輸入數量" : "Input quantity", DialogUitl.INPUT_TYPE_NUMBER, new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { try { prangNum = Integer.parseInt(content); if (prangNum <= 0) { - ToastUtil.show(WordUtil.isNewZh() ?"數量不能為0或負數":"The quantity cannot be zero or negative"); + ToastUtil.show(WordUtil.isNewZh() ? "數量不能為0或負數" : "The quantity cannot be zero or negative"); return; } if (prangNum > 999) { - ToastUtil.show(WordUtil.isNewZh() ?"數量不能大於999":"The number cannot be greater than 999"); + ToastUtil.show(WordUtil.isNewZh() ? "數量不能大於999" : "The number cannot be greater than 999"); return; } mBtnSend.setText(content); @@ -285,7 +285,7 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene dialog.dismiss(); } catch (Exception e) { e.printStackTrace(); - ToastUtil.show(WordUtil.isNewZh() ? "輸入錯誤":"Input error"); + ToastUtil.show(WordUtil.isNewZh() ? "輸入錯誤" : "Input error"); } } }); @@ -307,29 +307,29 @@ public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListene }); } else if (id == R.id.gift_btn) { if (bean == null) { - ToastUtil.show(WordUtil.isNewZh() ? "整蠱禮物不能為空":"A trick gift can't be empty"); + ToastUtil.show(WordUtil.isNewZh() ? "整蠱禮物不能為空" : "A trick gift can't be empty"); return; } if (StringUtil.isEmpty(prangContext) || prangNum == 0) { - ToastUtil.show(WordUtil.isNewZh() ?"整蠱內容或數量不能為空":"The content or number of pranks cannot be empty"); + ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容或數量不能為空" : "The content or number of pranks cannot be empty"); return; } if (prangNum >= 999) { - ToastUtil.show(WordUtil.isNewZh() ?"整蠱數量不能過大":"The number of pranks should not be too large"); + ToastUtil.show(WordUtil.isNewZh() ? "整蠱數量不能過大" : "The number of pranks should not be too large"); return; } if (WordUtil.isSpecialChar(prangContext)) { - ToastUtil.show(WordUtil.isNewZh() ?"整蠱內容不能包含特殊字符":"The prank content must not contain special characters"); + ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容不能包含特殊字符" : "The prank content must not contain special characters"); return; } if (prangContext.length() > 6) { - ToastUtil.show(WordUtil.isNewZh() ?"整蠱內容過長":"The prank is too long"); + ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容過長" : "The prank is too long"); return; } if (giftBeans != null) { for (PrankGiftBean giftBean : giftBeans) { if (giftBean.getGiftId().equals(bean.getId() + "")) { - ToastUtil.show(WordUtil.isNewZh() ?"整蠱禮物已存在":"Prank gifts already exist"); + ToastUtil.show(WordUtil.isNewZh() ? "整蠱禮物已存在" : "Prank gifts already exist"); return; } } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java index b6c2c946e..2968d6c60 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftPopup.java @@ -702,7 +702,8 @@ public class LiveGiftPopup extends AbsDialogFragment { } isGetNewWrap = true; if (isWrap) { - Bus.get().post(new LiveParcelItemRefreshEvent().setLiveGiftModel(liveGiftModel)); + //刷新包裹中的礼物数量 + Bus.get().post(new LiveParcelItemRefreshEvent().setLiveGiftModel(liveGiftModel).setSendCount(Integer.parseInt(mCount))); } } } else { @@ -1380,9 +1381,10 @@ public class LiveGiftPopup extends AbsDialogFragment { // //刷新包裹列表wrap_gift_num -1:表示数量没有变化 // mObjGiftSendback = obj; isGetNewWrap = true; - + //是包裹里的礼物 if (isWrap) { - Bus.get().post(new LiveParcelItemRefreshEvent().setLiveGiftModel(liveGiftModel)); + //刷新包裹中礼物的数量 + Bus.get().post(new LiveParcelItemRefreshEvent().setLiveGiftModel(liveGiftModel).setSendCount(Integer.parseInt(mCount))); } } } else if (code == 1007 && mGiftBean.getType() != 0) { diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java index 27bcfbf2b..863c0e2c1 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java @@ -58,7 +58,10 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements private String liveUid; + private TextView red_menu; + // boolean isRy = false; + private boolean isShowRed; @Override protected int getLayoutId() { return R.layout.dialog_live_new_function; @@ -99,6 +102,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements // isRy = bundle.getBoolean("isRy", false); mAnchorLiveTime = bundle.getLong("liveTime"); liveUid = bundle.getString("liveUid"); + isShowRed = bundle.getBoolean("isShowZgRed"); } mWishView = findViewById(R.id.live_tool_wish); mPrankView = findViewById(R.id.live_tool_prank); @@ -111,6 +115,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements mMicView = findViewById(R.id.live_tool_mic); mRandomPk = findViewById(R.id.live_tool_random_pk); mLiveTimeTextView = (TextView) findViewById(R.id.live_time); + red_menu = (TextView) findViewById(R.id.red_menu); mWishView.setOnClickListener(this); mPrankView.setOnClickListener(this); mWksView.setOnClickListener(this); @@ -141,6 +146,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements mLiveRoomHandler = new LiveRoomHandler(); mLiveTimeTextView.setText(StringUtil.getDurationText(mAnchorLiveTime)); startAnchorLiveTime(); + red_menu.setVisibility(isShowRed?View.VISIBLE:View.GONE); } public void setFunctionClickListener(LiveFunctionClickListener functionClickListener) { @@ -169,6 +175,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements mFunctionClickListener.onClick(LIVE_FUNC_WISHLIST); } else if (id == R.id.live_tool_prank) { mFunctionClickListener.onClick(LIVE_FUNC_ZG); + red_menu.setVisibility(View.GONE); } else if (id == R.id.live_tool_wks) { mFunctionClickListener.onClick(LIVE_FUNC_WKS); } else if (id == R.id.live_tool_beauty) { diff --git a/live/src/main/java/com/yunbao/live/dialog/LivePrankAddGiftDialog.java b/live/src/main/java/com/yunbao/live/dialog/LivePrankAddGiftDialog.java new file mode 100644 index 000000000..89d2c82b9 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LivePrankAddGiftDialog.java @@ -0,0 +1,161 @@ +package com.yunbao.live.dialog; + +import android.content.Context; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.bean.PrankGiftBean; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.utils.StringUtil; +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 java.util.ArrayList; +import java.util.List; + +public class LivePrankAddGiftDialog extends AbsDialogPopupWindow { + + private TextView prankBtn; + private ImageView backBtn; + private TextView giftText; + private TextView numberText; + private EditText contentText; + private LinearLayout giftNumberLayout; + private boolean isShowGiftNumber = true; + + private OnItemClickListener onItemClickListener; + + private List giftBeans = new ArrayList<>(); + + + public LivePrankAddGiftDialog(@NonNull Context context) { + super(context); + } + + @Override + public void buildDialog(XPopup.Builder builder) { + builder.autoFocusEditText(false); + } + + public LivePrankAddGiftDialog setGiftBeans(List giftBeans,boolean isShow) { + this.isShowGiftNumber = isShow; + this.giftBeans = giftBeans; + return this; + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_live_prank_add_gift; + } + + @Override + protected void onCreate() { + super.onCreate(); + initView(); + } + + public void setOnItemClickListener(OnItemClickListener onItemClickListener) { + this.onItemClickListener = onItemClickListener; + } + + void initView() { + prankBtn = findViewById(R.id.prank_btn); + backBtn = findViewById(R.id.back); + giftText = findViewById(R.id.gift_text); + numberText = findViewById(R.id.number_text); + contentText = findViewById(R.id.content_text); + giftNumberLayout= findViewById(R.id.giftNumberLayout); + if(isShowGiftNumber){ + giftNumberLayout.setVisibility(VISIBLE); + } + + ViewClicksAntiShake.clicksAntiShake(backBtn, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dismiss(); + } + }); + ViewClicksAntiShake.clicksAntiShake(giftText, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + GiftPopDialog dialog = new GiftPopDialog(mContext, new GiftPopDialog.ActionListener() { + + @Override + public void onSelectGift(PrankGiftBean bean) { + if (bean != null) { + giftText.setText(bean.getName()); + /*ImgLoader.displayDrawable(mContext, bean.getIcon(), DpUtil.dp2px(16), DpUtil.dp2px(16), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + giftText.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); + } + + @Override + public void onLoadFailed() { + } + });*/ + giftText.setTag(bean); + } + } + + @Override + public void onDismiss() { + + } + }); + dialog.setShowNumber(false); + dialog.setList(giftBeans); + dialog.showDialog(); + } + }); + ViewClicksAntiShake.clicksAntiShake(numberText, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + new LivePrankAddGiftNumberDialog(mContext) + .setOnItemClickListener(new OnItemClickListener() { + @Override + public void onItemClick(Integer bean, int position) { + numberText.setText(String.valueOf(bean)); + numberText.setTag(bean); + } + }) + .showDialog(); + } + }); + ViewClicksAntiShake.clicksAntiShake(prankBtn, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + PrankGiftBean bean = (PrankGiftBean) giftText.getTag(); + String prankContent = contentText.getText().toString(); + if (bean == null) { + ToastUtil.show(WordUtil.isNewZh() ? "整蠱禮物不能為空" : "A trick gift can't be empty"); + return; + } + if(isShowGiftNumber){ + if (numberText.getTag()==null||StringUtil.isEmpty(prankContent)){ + ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容或數量不能為空" : "The content or number of pranks cannot be empty"); + return; + } + bean.setNum(Integer.parseInt(numberText.getText().toString())); + }else{ + if (StringUtil.isEmpty(prankContent)){ + ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容或數量不能為空" : "The content or number of pranks cannot be empty"); + return; + } + } + bean.setTitle(prankContent); + onItemClickListener.onItemClick(bean,0); + dismiss(); + + } + }); + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LivePrankAddGiftNumberDialog.java b/live/src/main/java/com/yunbao/live/dialog/LivePrankAddGiftNumberDialog.java new file mode 100644 index 000000000..dd5fc1e16 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LivePrankAddGiftNumberDialog.java @@ -0,0 +1,142 @@ +package com.yunbao.live.dialog; + +import android.app.Dialog; +import android.content.Context; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.bean.PrankGiftBean; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.utils.DialogUitl; +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.ItemLivePrankGiftNumberAdapter; + +import java.util.ArrayList; +import java.util.List; + +public class LivePrankAddGiftNumberDialog extends AbsDialogPopupWindow { + + private TextView prankBtn; + private ImageView backBtn; + private Button mBtnNumber; + private RecyclerView numberRecycler; + private ItemLivePrankGiftNumberAdapter mAdapter; + + private OnItemClickListener onItemClickListener; + private int giftNumber = -1; + + private List giftBeans = new ArrayList<>(); + + + public LivePrankAddGiftNumberDialog(@NonNull Context context) { + super(context); + } + + public LivePrankAddGiftNumberDialog setOnItemClickListener(OnItemClickListener onItemClickListener) { + this.onItemClickListener = onItemClickListener; + return this; + } + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + + @Override + public int bindLayoutId() { + return R.layout.dialog_live_prank_add_gift_number; + } + + @Override + protected void onCreate() { + super.onCreate(); + initView(); + initData(); + } + + @Override + protected void onDismiss() { + super.onDismiss(); + } + + void initView() { + prankBtn = findViewById(R.id.prank_btn); + backBtn = findViewById(R.id.back); + numberRecycler = findViewById(R.id.numberList); + mBtnNumber = findViewById(R.id.btnNumber); + mAdapter = new ItemLivePrankGiftNumberAdapter(); + numberRecycler.setAdapter(mAdapter); + mAdapter.setOnSelectNumberListener(number -> { + if (number > 0) { + giftNumber = number; + mBtnNumber.setText(R.string.live_prank_gift_dialog_number_btn); + } + }); + ViewClicksAntiShake.clicksAntiShake(mBtnNumber, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + DialogUitl.showSimpleInputDialog(mContext, WordUtil.isNewZh() ? "输入数量" : "Input number", DialogUitl.INPUT_TYPE_NUMBER,4, new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + try { + int number = Integer.parseInt(content); + if (number > 0 && number < 10000) { + mBtnNumber.setText(content); + giftNumber = number; + mAdapter.setSelectNumber(-1); + mAdapter.notifyDataSetChanged(); + dialog.dismiss(); + } + } catch (Exception e) { + e.printStackTrace(); + mBtnNumber.setText(R.string.live_prank_gift_dialog_number_btn); + dialog.dismiss(); + } + } + }); + } + }); + ViewClicksAntiShake.clicksAntiShake(prankBtn, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (onItemClickListener != null) { + if(mAdapter.getSelectNumber()==0){ + ToastUtil.show(WordUtil.isNewZh()?"請輸入數量":"Please enter the quantity"); + return; + } + if (mAdapter.getSelectNumber() > 0) { + giftNumber = mAdapter.getSelectNumber(); + } + onItemClickListener.onItemClick(giftNumber, 0); + dismiss(); + } + } + }); + } + + List mList = new ArrayList<>(); + + void initData() { + mList.add(9999); + mList.add(3344); + mList.add(1314); + mList.add(520); + mList.add(88); + mList.add(68); + mList.add(10); + mList.add(8); + mList.add(1); + mAdapter.setList(mList); + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java index 5c4d69ca7..76e2011f8 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java @@ -1,20 +1,30 @@ package com.yunbao.live.dialog; +import static com.yunbao.live.adapter.LivePrankRecyclerAdapter.TYPE_TURNTABLE; + +import android.annotation.SuppressLint; import android.app.Dialog; +import android.graphics.Color; import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.view.Window; import android.view.WindowManager; +import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.alibaba.fastjson.JSONArray; import com.google.android.material.tabs.TabLayout; +import com.google.gson.Gson; +import com.google.gson.JsonObject; import com.yunbao.common.bean.PrankGiftBean; +import com.yunbao.common.bean.PrankGiftResultBean; import com.yunbao.common.bean.PrankHttpTurntableBean; import com.yunbao.common.bean.PrankTurntableBean; import com.yunbao.common.dialog.AbsDialogFragment; @@ -24,11 +34,18 @@ import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.L; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.ViewUtils; import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; import com.yunbao.live.adapter.LivePrankRecyclerAdapter; +import com.yunbao.live.socket.SocketRyChatUtil; + +import org.json.JSONException; +import org.json.JSONObject; import java.util.ArrayList; import java.util.List; @@ -36,7 +53,7 @@ import java.util.Locale; public class LivePrankDialogFragment extends AbsDialogFragment implements View.OnClickListener { private TabLayout mTabLayout; - private View mTurntableConfigLayout; + private View mTurntableConfigLayout, mGiftConfigLayout; private TextView mPrankBtn; private ImageView mTurntableConfigImageView; private TextView mCoinTextView; @@ -45,7 +62,22 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O private LivePrankRecyclerAdapter recyclerAdapter; private String mLiveUid; private PrankHttpTurntableBean bean = new PrankHttpTurntableBean(); - private List giftBeans; + private List giftBeans = new ArrayList<>(); + + private TextView giftSwitch1TitleText; + private TextView giftSwitch1DescText; + private ImageView giftSwitch1Btn; + private TextView giftTypeNowText; + private TextView giftTypeTodoText; + private TextView giftTypeNowSwitchText; + private Button mBtnAddGift; + private ImageView help; + + private onPrankResultListener onPrankResultListener; + + public void setOnPrankResultListener(LivePrankDialogFragment.onPrankResultListener onPrankResultListener) { + this.onPrankResultListener = onPrankResultListener; + } public void setmLiveUid(String mLiveUid) { this.mLiveUid = mLiveUid; @@ -82,11 +114,14 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O initView(); initTab(); initTurntableData(); + initGiftConfigLayoutView(); } private void initView() { + help = (ImageView) findViewById(R.id.help); mTabLayout = (TabLayout) findViewById(R.id.prank_tabLayout); mTurntableConfigLayout = findViewById(R.id.turntable_layout); + mGiftConfigLayout = findViewById(R.id.gift_layout); mTurntableConfigImageView = (ImageView) findViewById(R.id.switch1_btn); mCoinTextView = (TextView) findViewById(R.id.switch2_btn); mPrankRecyclerView = (RecyclerView) findViewById(R.id.prank_config); @@ -97,14 +132,19 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O mPrankRecyclerView.setAdapter(recyclerAdapter); mCoinTextView.setOnClickListener(this); mTurntableConfigImageView.setOnClickListener(this); + help.setOnClickListener(this); if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - mPrankBtn.setText("保存設置"); + mPrankBtn.setText("發送圖標"); } else { - mPrankBtn.setText("Save Settings"); + mPrankBtn.setText("send icon"); } recyclerAdapter.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(String bean, int position) { + if (position == -2) { + showGiftDialog(); + return; + } if (recyclerAdapter.getViewTypeOfList()) { switch (position) { case 1: @@ -127,21 +167,20 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O break; } } else { - LiveNetManager.get(mContext).deletePrankGift(mLiveUid, position + "", new HttpCallback() { - @Override - public void onSuccess(PrankHttpTurntableBean data) { - initGiftData(); - } - - @Override - public void onError(String error) { - initGiftData(); - } - }); + giftBeans.remove(position); + recyclerAdapter.setList(giftBeans); + recyclerAdapter.notifyDataSetChanged(); + if (giftBeans.size() < 6) { + mBtnAddGift.setVisibility(View.VISIBLE); + mGiftNotDate.setVisibility(View.VISIBLE); + } else { + mBtnAddGift.setVisibility(View.GONE); + mGiftNotDate.setVisibility(View.GONE); + } } } }); - mPrankBtn.setOnClickListener(view -> { +/* mPrankBtn.setOnClickListener(view -> { if ((int) view.getTag() == 1) { if (giftBeans != null && giftBeans.size() >= 20) { @@ -173,6 +212,46 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } else { setPrankConfig(); } + });*/ + + ViewClicksAntiShake.clicksAntiShake(mPrankBtn, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (mPrankBtn.getTag() != null && Integer.parseInt(mPrankBtn.getTag().toString()) == 0) { + SocketRyChatUtil.sendPrankIcon(); + } else { + showGiftDialog(); + } + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_save), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if ((int) mPrankBtn.getTag() == 0) { + setPrankConfig(false); + } else { + setGiftBean(recyclerAdapter.getList(),"0"); + } + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_clear), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if ((int) mPrankBtn.getTag() == 0) { + clearPrankConfig(); + setPrankConfig(true); + } else { + giftSwitch1Btn.setTag("false"); + giftSwitch1Btn.setImageResource(R.mipmap.special_icon_off); + giftBeans = new ArrayList<>(); + recyclerAdapter.setList(giftBeans); + recyclerAdapter.notifyDataSetChanged(); + mBtnAddGift.setVisibility(View.VISIBLE); + mGiftNotDate.setVisibility(View.VISIBLE); + setGiftBean(recyclerAdapter.getList(),"1"); + } + ToastUtil.show(WordUtil.isNewZh()?"清空成功!":"Cleared successfully!"); + } }); mPrankBtn.setTag(0); } @@ -183,15 +262,15 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { turntable.setText("轉盤整蠱"); gift.setText("禮物整蠱"); - }else { - turntable.setText("Turntable prank"); - gift.setText("Gift prank"); + } else { + turntable.setText("Turntable"); + gift.setText("Gift"); } - turntable.setTag(0); gift.setTag(1); mTabLayout.addTab(turntable); mTabLayout.addTab(gift); + mPrankBtn.setTag(0); mTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { @@ -200,32 +279,39 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } if ((int) tab.getTag() == 0) { mTurntableConfigLayout.setVisibility(View.VISIBLE); + mGiftConfigLayout.setVisibility(View.GONE); mPrankRecyclerView.setVisibility(View.VISIBLE); + mBtnAddGift.setVisibility(View.GONE); mGiftNotDate.setVisibility(View.GONE); - recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_TURNTABLE); + recyclerAdapter.setViewType(TYPE_TURNTABLE); mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_turntable_save); if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - mPrankBtn.setText("保存設置"); + mPrankBtn.setText("發送圖標"); } else { - mPrankBtn.setText("Save Settings"); + mPrankBtn.setText("send icon"); } mPrankBtn.setTag(0); recyclerAdapter.clearList(); initTurntableData(); + mPrankBtn.setVisibility(View.VISIBLE); } else { mTurntableConfigLayout.setVisibility(View.GONE); - mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_gift_set); + mGiftConfigLayout.setVisibility(View.VISIBLE); + mBtnAddGift.setVisibility(View.VISIBLE); + mGiftNotDate.setVisibility(View.VISIBLE); + recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_GIFT); + mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_turntable_save); - if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + /*if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { mPrankBtn.setText("添加禮物"); } else { mPrankBtn.setText("Add gift"); - } + }*/ mPrankBtn.setTag(1); recyclerAdapter.clearList(); - mGiftNotDate.setVisibility(View.VISIBLE); initGiftData(); + mPrankBtn.setVisibility(View.GONE); } } @@ -241,6 +327,73 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O }); } + private void showGiftDialog() { + LivePrankAddGiftDialog livePrankAddGiftDialog = new LivePrankAddGiftDialog(mContext).setGiftBeans(giftBeans, giftTypeNowText.getTag().equals("1")); + livePrankAddGiftDialog.setOnItemClickListener(new OnItemClickListener() { + @SuppressLint("NotifyDataSetChanged") + @Override + public void onItemClick(PrankGiftBean bean, int position) { + giftBeans.add(bean); + recyclerAdapter.setList(giftBeans); + recyclerAdapter.notifyDataSetChanged(); + if (giftBeans.size() < 6) { + mBtnAddGift.setVisibility(View.VISIBLE); + mGiftNotDate.setVisibility(View.VISIBLE); + } else { + mBtnAddGift.setVisibility(View.GONE); + mGiftNotDate.setVisibility(View.GONE); + } + } + }); + livePrankAddGiftDialog.showDialog(); + } + + private void initGiftConfigLayoutView() { + giftSwitch1TitleText = (TextView) findViewById(R.id.gift_switch1_title_text); + giftSwitch1DescText = (TextView) findViewById(R.id.gift_switch1_desc_text); + giftSwitch1Btn = (ImageView) findViewById(R.id.gift_switch1_btn); + giftTypeNowText = (TextView) findViewById(R.id.gift_type_now_text); + giftTypeTodoText = (TextView) findViewById(R.id.gift_type_todo); + giftTypeNowSwitchText = (TextView) findViewById(R.id.gift_type_now_switch); + giftTypeNowText.setTag("2"); + mBtnAddGift = (Button) findViewById(R.id.gift_add_btn); + mBtnAddGift.setVisibility(View.GONE); + mGiftNotDate.setVisibility(View.GONE); + + ViewClicksAntiShake.clicksAntiShake(giftSwitch1Btn, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (giftSwitch1Btn.getTag().equals("true")) { + giftSwitch1Btn.setTag("false"); + giftSwitch1Btn.setImageResource(R.mipmap.special_icon_off); + } else { + giftSwitch1Btn.setTag("true"); + giftSwitch1Btn.setImageResource(R.mipmap.special_icon_on); + } + } + }); + ViewClicksAntiShake.clicksAntiShake(giftTypeNowSwitchText, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + CharSequence tmp = giftTypeNowText.getText(); + giftTypeNowText.setText(giftTypeNowSwitchText.getText()); + giftTypeNowSwitchText.setText(tmp); + if (giftTypeNowText.getTag().equals("1")) { + giftTypeNowText.setTag("2"); + } else { + giftTypeNowText.setTag("1"); + } + initGiftData(); + } + }); + ViewClicksAntiShake.clicksAntiShake(mBtnAddGift, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + showGiftDialog(); + } + }); + } + private void initTurntableData() { LiveNetManager.get(mContext).getAnchorPrankTurntable(mLiveUid, new HttpCallback() { @Override @@ -256,11 +409,23 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O }); } - private void setGiftBean(PrankGiftBean bean) { - LiveNetManager.get(mContext).setPrankGift(mLiveUid, bean.getGiftId(), bean.getNum() + "", bean.getTitle(), new HttpCallback() { + private void setGiftBean(List prankGiftBeans,String is_cleared) { + JSONArray prankJson = getJsonObjects(prankGiftBeans); + LiveNetManager.get(mContext).setPrankGift(mLiveUid, giftSwitch1Btn.getTag().equals("true") ? "1" : "0", new Gson().toJson(prankJson), giftTypeNowText.getTag().toString(),is_cleared, new HttpCallback() { @Override public void onSuccess(PrankHttpTurntableBean data) { initGiftData(); + if(!is_cleared.equals("1")){ + if (WordUtil.isNewZh()) { + ToastUtil.show("保存成功!"); + } else { + ToastUtil.show("successful"); + } + } + //通知主播刷新整蛊信息、 + if(onPrankResultListener!=null){ + onPrankResultListener.OpenAndCloseListener(); + } } @Override @@ -270,26 +435,58 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O }); } + @NonNull + private static JSONArray getJsonObjects(List prankGiftBeans) { + JSONArray prankJson = new JSONArray(); + for (int i = 0; i < prankGiftBeans.size(); i++) { + JsonObject temp = new JsonObject(); + temp.addProperty("gift_id", prankGiftBeans.get(i).getGiftId()); + temp.addProperty("gift_num", prankGiftBeans.get(i).getNum()); + temp.addProperty("prank_content", prankGiftBeans.get(i).getTitle()); + prankJson.add(temp); + } + return prankJson; + } + private void initGiftData() { - LiveNetManager.get(mContext).getPrankGiftList(mLiveUid, new HttpCallback>() { + LiveNetManager.get(mContext).getPrankGiftList(mLiveUid, giftTypeNowText.getTag().toString(), new HttpCallback() { @Override - public void onSuccess(List data) { - if (!data.isEmpty()) { - mGiftNotDate.setVisibility(View.GONE); - mPrankRecyclerView.setVisibility(View.VISIBLE); - recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_GIFT); - giftBeans = data; - recyclerAdapter.setList(data); - recyclerAdapter.notifyDataSetChanged(); + public void onSuccess(PrankGiftResultBean data) { + if (mPrankBtn.getTag().toString().equals("1")) { + if (data.getPrank_list() != null) { + if (data.getPrank_list().size() < 6) { + mBtnAddGift.setVisibility(View.VISIBLE); + mGiftNotDate.setVisibility(View.VISIBLE); + } else { + mBtnAddGift.setVisibility(View.GONE); + mGiftNotDate.setVisibility(View.GONE); + } + mPrankRecyclerView.setVisibility(View.VISIBLE); + recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_GIFT); + giftBeans = data.getPrank_list(); + recyclerAdapter.setList(giftBeans); + recyclerAdapter.notifyDataSetChanged(); + if (data.getStatus().equals("1")) { + giftSwitch1Btn.setTag("true"); + giftSwitch1Btn.setImageResource(R.mipmap.special_icon_on); + } else { + giftSwitch1Btn.setTag("false"); + giftSwitch1Btn.setImageResource(R.mipmap.special_icon_off); + } + } + } + + /*if (!data.isEmpty()) { + } else { mPrankRecyclerView.setVisibility(View.GONE); mGiftNotDate.setVisibility(View.VISIBLE); - } + }*/ } @Override public void onError(String error) { - ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); + ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred"); } }); } @@ -303,6 +500,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O list.add(buildBean(4, bean.getTurntable4())); list.add(buildBean(5, bean.getTurntable5())); list.add(buildBean(6, bean.getTurntable6())); + recyclerAdapter.setViewType(TYPE_TURNTABLE); recyclerAdapter.setList(list); recyclerAdapter.notifyDataSetChanged(); if (bean.getStatus() == 1) { @@ -324,47 +522,53 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O return bean; } - private void setPrankConfig() { - if (StringUtil.isEmpty(bean.getTurntable1(), bean.getTurntable2(), bean.getTurntable3(), bean.getTurntable4(), bean.getTurntable5(), bean.getTurntable6())) { + private void clearPrankConfig() { + bean = new PrankHttpTurntableBean(); + setCoin(1000); + setDate(bean); + } - if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - ToastUtil.show("保存失败:所有转盘位置必填"); - } else { - ToastUtil.show("Save failed: all turntable positions must be filled in"); + private void setPrankConfig(boolean isClear) { + if(!isClear){ + if (StringUtil.isEmpty(bean.getTurntable1(), bean.getTurntable2(), bean.getTurntable3(), bean.getTurntable4(), bean.getTurntable5(), bean.getTurntable6())) { + + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + ToastUtil.show("保存失败:所有转盘位置必填"); + } else { + ToastUtil.show("Save failed: all turntable positions must be filled in"); + } + return; } - return; } - LiveNetManager.get(mContext).setAnchorPrankTurntable( - mLiveUid, - bean.getCoin() + "", - bean.getTurntable1(), - bean.getTurntable2(), - bean.getTurntable3(), - bean.getTurntable4(), - bean.getTurntable5(), - bean.getTurntable6(), - bean.getStatus() + "", - new HttpCallback() { - @Override - public void onSuccess(Object data) { - - if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - ToastUtil.show("保存成功"); - } else { - ToastUtil.show("Save success"); - } - } - - @Override - public void onError(String error) { - if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - ToastUtil.show("保存失败:" + error); - } else { - ToastUtil.show("Save failed" + error); - } + if(isClear){ + bean.setTurntable1(""); + bean.setTurntable2(""); + bean.setTurntable3(""); + bean.setTurntable4(""); + bean.setTurntable5(""); + bean.setTurntable6(""); + } + LiveNetManager.get(mContext).setAnchorPrankTurntable(mLiveUid, bean.getCoin() + "", bean.getTurntable1(), bean.getTurntable2(), bean.getTurntable3(), bean.getTurntable4(), bean.getTurntable5(), bean.getTurntable6(), bean.getStatus() + "", new HttpCallback() { + @Override + public void onSuccess(Object data) { + if(!isClear){ + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + ToastUtil.show("保存成功"); + } else { + ToastUtil.show("Save success"); } } - ); + } + + @Override + public void onError(String error) { + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + ToastUtil.show("保存失败:" + error); + } else { + ToastUtil.show("Save failed" + error); + } + } + }); } @Override @@ -415,7 +619,13 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } }); } - + } else if (id == R.id.help) { + LivePrankExplainDialog livePrankExplainDialog = new LivePrankExplainDialog(mContext); + livePrankExplainDialog.showDialog(); } } + + public interface onPrankResultListener{ + void OpenAndCloseListener(); + } } diff --git a/live/src/main/java/com/yunbao/live/dialog/LivePrankExplainDialog.java b/live/src/main/java/com/yunbao/live/dialog/LivePrankExplainDialog.java new file mode 100644 index 000000000..1d9001578 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LivePrankExplainDialog.java @@ -0,0 +1,110 @@ +package com.yunbao.live.dialog; + +import android.content.Context; +import android.text.Html; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.R; + +public class LivePrankExplainDialog extends AbsDialogPopupWindow { + TextView content; + public LivePrankExplainDialog(@NonNull Context context) { + super(context); + } + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_live_prank_explain; + } + + @Override + protected void onCreate() { + super.onCreate(); + initView(); + } + + @Override + protected void onDismiss() { + super.onDismiss(); + } + + void initView() { + content = findViewById(R.id.content); + findViewById(R.id.back).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + dialog.dismiss(); + } + }); + StringBuffer stringBuffer = new StringBuffer(); + if(WordUtil.isNewZh()){ + stringBuffer.append(getHtmlContent(true,"1、當前整蠱分類有哪些?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"當前分爲轉盤整蠱和禮物整蠱。可根據實際情況決定,例如都設置或只設置一種。","\"#FFFFFF\"",true)); + + stringBuffer.append(getHtmlContent(true,"2、轉盤整蠱如何填寫?","\"#F9B003\"",false)); + stringBuffer.append(getHtmlContent(false,"打開開關→設置價格→填寫6個整蠱→保存設置。","\"#F9B003\"",true)); + stringBuffer.append(getHtmlContent(false,"注意:若有人發起整蠱,將提示你完成該整蠱,期間若有人花費鑽石拯救你,則不用完成整蠱。","\"#FFFFFF\"",true)); + + stringBuffer.append(getHtmlContent(true,"3、禮物整蠱如何填寫?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"當前分爲禮物數達成整蠱和連擊數最高整蠱。","\"#FFFFFF\"",true)); + stringBuffer.append(getHtmlContent(false,"禮物數達成整蠱:打開開關→選擇禮物→填寫數量→填寫整蠱→保存設置。","\"#F9B003\"",true)); + stringBuffer.append(getHtmlContent(false,"連擊數最高整蠱:打開開關→切換→選擇禮物→填寫整蠱→保存設置。","\"#F9B003\"",true)); + + stringBuffer.append(getHtmlContent(true,"4、整蠱如何填寫?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"根據你的實際情況決定。例如:唱歌、跳舞、情書、下蹲、吃辣或其他任意才藝。","\"#FFFFFF\"",true)); + + stringBuffer.append(getHtmlContent(true,"5、我怎麽知道該做哪些整蠱?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"系統將發送消息至彈幕;","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"你需要做的整蠱會自動挂起。","\"#FFFFFF\"",false)); + }else{ + stringBuffer.append(getHtmlContent(true,"1. What are the current categories of pranks?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"Currently it is divided into turntable tricking and gift tricking. It can be decided according to the actual situation, for example, setting both or only one type.","\"#FFFFFF\"",true)); + + stringBuffer.append(getHtmlContent(true,"2. How to fill in the turntable trick?","\"#F9B003\"",false)); + stringBuffer.append(getHtmlContent(false,"Turn on the switch → set the price → fill in 6 tricks → save the settings.","\"#F9B003\"",true)); + stringBuffer.append(getHtmlContent(false,"Note: If someone initiates a trick, you will be prompted to complete the trick. If someone spends diamonds to save you during this period, you do not need to complete the trick.","\"#FFFFFF\"",true)); + + stringBuffer.append(getHtmlContent(true,"3. How to fill in the gift form?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"Currently, it is divided into the number of gifts to reach Tricky and the number of combos to reach Tricky.","\"#FFFFFF\"",true)); + stringBuffer.append(getHtmlContent(false,"The number of gifts reaches Trick: turn on the switch → select the gift → fill in the quantity → fill in the trick → save the settings.","\"#F9B003\"",true)); + stringBuffer.append(getHtmlContent(false,"The trick with the highest number of combos: turn on the switch → switch → select the gift → fill in the trick → save the settings.","\"#F9B003\"",true)); + + stringBuffer.append(getHtmlContent(true,"4. How to fill in Tricky?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"Decide based on your actual situation. For example: singing, dancing, love letters, squatting, eating spicy food or any other talent.","\"#FFFFFF\"",true)); + + stringBuffer.append(getHtmlContent(true,"5. How do I know which tricks to do?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"The system will send a message to the barrage;","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"The tricks you need to do will automatically hang.","\"#FFFFFF\"",false)); + } + + content.setText(Html.fromHtml(stringBuffer.toString())); + } + public String getHtmlContent(boolean isTitle, String content, String color, boolean linebreak) { + StringBuffer result = new StringBuffer(); + if (isTitle) { + result.append("
"); + result.append(content); + result.append("
"); + } else { + result.append("
"); + result.append(content); + result.append("
"); + } + if (linebreak) { + result.append("

"); + } + return result.toString(); + } + +} diff --git a/live/src/main/java/com/yunbao/live/event/LiveParcelItemRefreshEvent.java b/live/src/main/java/com/yunbao/live/event/LiveParcelItemRefreshEvent.java index db6797e23..552397276 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveParcelItemRefreshEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveParcelItemRefreshEvent.java @@ -6,6 +6,17 @@ import com.yunbao.common.bean.LiveGiftBean; public class LiveParcelItemRefreshEvent extends BaseModel { private LiveGiftBean liveGiftModel; + private int sendCount; + + public int getSendCount() { + return sendCount; + } + + public LiveParcelItemRefreshEvent setSendCount(int sendCount) { + this.sendCount = sendCount; + return this; + } + public LiveGiftBean getLiveGiftModel() { return liveGiftModel; } diff --git a/live/src/main/java/com/yunbao/live/presenter/AbsLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/AbsLinkMicPkPresenter.java index 8b1602252..c99610974 100644 --- a/live/src/main/java/com/yunbao/live/presenter/AbsLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/AbsLinkMicPkPresenter.java @@ -11,6 +11,7 @@ import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.AppManager; +import com.yunbao.live.views.LiveRoomViewHolder; public abstract class AbsLinkMicPkPresenter { private boolean isSw = false; @@ -29,6 +30,7 @@ public abstract class AbsLinkMicPkPresenter { protected String mApplyNmae;//正在申请Pk的主播的名字 protected boolean mIsApplyDialogShow;//是否显示了申请PK的弹窗 + public LiveRoomViewHolder mLiveRoomViewHolder; /** * 主播与主播PK 主播收到其他主播发过来的多人PK申请的回调 @@ -38,6 +40,10 @@ public abstract class AbsLinkMicPkPresenter { showDRApplyDialogTmp(u); } + public void setmLiveRoomViewHolder(LiveRoomViewHolder mLiveRoomViewHolder) { + this.mLiveRoomViewHolder = mLiveRoomViewHolder; + } + /** * 主播与主播PK 主播收到其他主播发过来的PK申请的回调 */ diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java index 1c167b617..2ca16c616 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -64,6 +64,7 @@ import com.yunbao.common.utils.HtmlTagHandler; import com.yunbao.common.utils.L; import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.MicStatusManager; +import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -276,6 +277,7 @@ public class LiveGiftAnimPresenter { mFrameImageView = (FrameImageView) v.findViewById(R.id.all_frame_img); full_service_notice_new = v.findViewById(R.id.full_service_notice_new); full_service_notice_new_bg = v.findViewById(R.id.full_service_notice_new_bg); + full_service_notice_new_icon = v.findViewById(R.id.full_service_notice_new_icon); full_service_notice_new_text = v.findViewById(R.id.full_service_notice_new_text); iv_look_full_service_notice_new = v.findViewById(R.id.iv_look_full_service_notice_new); iv_look_full_service_notice_new3 = v.findViewById(R.id.iv_look_full_service_notice_new3); @@ -1152,6 +1154,7 @@ public class LiveGiftAnimPresenter { View full_service_notice_new; ImageView full_service_notice_new_bg; + ImageView full_service_notice_new_icon; TextView full_service_notice_new_text; TextView iv_look_full_service_notice_new; AllServerNotifyFFGGGDJANEvent notifyFFGGGDJANEvent; @@ -1188,6 +1191,12 @@ public class LiveGiftAnimPresenter { full_service_notice_new.setAlpha(1f); full_service_notice_new.setVisibility(View.VISIBLE); ImgLoader.display(mContext, event.getBackgroundImage(), full_service_notice_new_bg); + if(!StringUtil.isEmpty(event.getLeftImage())){ + full_service_notice_new_icon.setVisibility(View.VISIBLE); + ImgLoader.display(mContext,event.getLeftImage(),full_service_notice_new_icon); + }else{ + full_service_notice_new_icon.setVisibility(View.GONE); + } SpannableStringBuilder builder = new SpannableStringBuilder(); String msgN = WordUtil.isNewZh() ? event.getMsgCn() : event.getMsgEn(); builder.append(msgN); diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java index 191620881..7a70b0f8c 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -72,6 +72,7 @@ import com.yunbao.live.socket.SocketRyLinkMicPkUtil; import com.yunbao.live.socket.SocketSendBean; import com.yunbao.live.views.LiveLinkMicPkViewHolder; import com.yunbao.live.views.LivePushRyViewHolder; +import com.yunbao.live.views.LiveRoomViewHolder; import org.greenrobot.eventbus.EventBus; @@ -247,6 +248,10 @@ public class LiveRyLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V } + + + + public LiveRyLinkMicPkPresenter(Context context, LivePushRyViewHolder linkMicViewHolder, boolean isAnchor, View root) { super(false); mContext = context; @@ -1043,6 +1048,10 @@ public class LiveRyLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V } } } + //收起整蛊列表 + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.closePrankView(); + } } }); } @@ -1826,6 +1835,10 @@ public class LiveRyLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V } }); + //收起整蛊列表 + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.closePrankView(); + } } }); diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java index 26132c1ab..ee7cf0d6e 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveSwLinkMicPkPresenter.java @@ -607,6 +607,10 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V dRjoinOtherRoom(u); //展示结束连麦按钮 mLiveAnchorViewHolder.showEndPkBt(); + //收起整蛊列表 + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.closePrankView(); + } } @@ -685,6 +689,10 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V onLinkMicPkStart(mApplyUid, 2); } }); + //收起整蛊列表 + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.closePrankView(); + } } @Override @@ -831,9 +839,15 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V //设置多人PK 房主ROOM UID mLiveAnchorViewHolder.setDrpkRoomId(mApplyUid); mLiveAnchorViewHolder.showEndPkBt(); + + //收起整蛊列表 + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.closePrankView(); + } } } }); + } }); } @@ -1511,6 +1525,10 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V mPkTimeCount = PK_TIME_MAX; } Log.d("mPkTimeCount2", "" + mPkTimeCount + ";mPkTimeFromServer=" + mPkTimeFromServer); + //收起整蛊列表 + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.closePrankView(); + } } diff --git a/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java b/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java index 98e54cd41..a5442f55f 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketMessageListener.java @@ -346,4 +346,9 @@ public interface SocketMessageListener { * */ void onHourRank(LiveChatBean bean,JSONObject ranks); + + /** + * 整蛊列表数据更新 + */ + void onUpdatePrankProgress(String prankString); } diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java index 43d7438ef..79c8b9310 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java @@ -14,6 +14,7 @@ import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; +import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; @@ -104,7 +105,7 @@ public class SocketRyChatUtil { .param("uid", u.getId()) .param("liangname", u.getGoodName()) .param("vip_type", u.getVip().getType()) - .param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType()) + .param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType()) .param("medal_name", u.getMedalName()) .param("medal_level", model.getMedalLevel()) .param("good_num", u.getGoodnum()) @@ -797,4 +798,64 @@ public class SocketRyChatUtil { }); } + public static void sendPrankIcon() { + + IMLoginModel userInfo = IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo(); + + final SocketSendBean msg = new SocketSendBean() + .param("_method_", Constants.SOCKET_SEND_MSG) + .param("action", 0) + .param("msgtype", 2) + .param("uid", String.valueOf(userInfo.getId())) + .param("uname", userInfo.getUserNicename()) + .param("ugood", String.valueOf(userInfo.getId())) + .param("uname", userInfo.getLevel()) + .param("tougood", "") + .param("touid", "") + .param("touname", "") + .param("liangname", "") + .param("vip_type", userInfo.getVip().getType()) + .param("usertype", Constants.SOCKET_USER_TYPE_ANCHOR) + .param("prankIcon", "https://downs.yaoulive.com/Tricky/prankIcon.png") + .param("ct", "主播发送了转盘整蛊提示,更新到最新版APP后即可查看。" + ); + msg.create(); + String targetId = "g" + userInfo.getId(); + Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; + TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); + Message message = Message.obtain(targetId, conversationType, messageContent); + + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + @Override + public void onAttached(Message message) { + + } + + @Override + public void onSuccess(Message message) { + Log.i("tx", "发送成功"); + if (SocketRyClient.mSocketHandler != null) { + SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); + } + LiveNetManager.get(CommonAppContext.sInstance) + .addChatCount(LiveActivity.mStream, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { + + } + + @Override + public void onError(String error) { + + } + }); + } + + @Override + public void onError(Message message, RongIMClient.ErrorCode errorCode) { + + } + }); + + } } diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index f171b12b0..8be0ec603 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -4,6 +4,7 @@ import static com.blankj.utilcode.util.SnackbarUtils.dismiss; import static com.blankj.utilcode.util.ViewUtils.runOnUiThread; import static com.yunbao.common.Constants.SOCKET_LIVE_MSG_TO_USER; import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK; +import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_ANCHOR_PRANK_GIFT; import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot; import android.app.Activity; @@ -14,11 +15,15 @@ import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.LinearLayout; +import android.widget.Toast; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; @@ -55,6 +60,7 @@ import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.L; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.ToastUtils; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveAudienceActivity; @@ -192,7 +198,7 @@ public class SocketRyClient { SocketReceiveBean received = JSON.parseObject(socketMsg, SocketReceiveBean.class); JSONObject map = received.getMsg().getJSONObject(0); - +// LogUtils.e("yqw=====>收到的socket:"+map.getString("_method_")+","+map.getString("ct")); switch (map.getString("_method_")) { //用户连麦 case Constants.LIAN_MAI: @@ -251,7 +257,7 @@ public class SocketRyClient { // LiveLinkMicPresenter.setHD(map.getString("ct")); break; case Constants.SOCKET_SYSTEM://系统消息 - if (map.getString("ct").contains("甜蜜不停")) { + if (map.getString("ct").contains("甜蜜不停")) { break; } UserBean us = CommonAppConfig.getInstance().getUserBean(); @@ -290,6 +296,45 @@ public class SocketRyClient { } } break; + + case Constants.PrankSendData: + //整蛊礼物刷新 + L.e("整蛊礼物刷新 整蛊礼物刷新 整蛊礼物刷新"); + if (map.getIntValue("action") == 13 && map.getString("msgtype").equals("4")){ + String ctString = map.getString("ct"); + L.e("整蛊礼物刷新 整蛊礼物刷新 整蛊礼物刷新 "+ctString); + JsonElement jsonElement = JsonParser.parseString(ctString); + if (jsonElement == null) break; +// LogUtils.e("yqw=====>整蛊礼物列表:"+ctString); + JsonObject jsonObject = jsonElement.getAsJsonObject(); + String content = WordUtil.isNewZh() ? jsonObject.get("msg").getAsString() : jsonObject.get("msg_en").getAsString(); + if(jsonObject.get("is_complete")!=null){ + String is_complete = jsonObject.get("is_complete").getAsString(); //0.未达成整蛊需要的数量 1.已达成整蛊 + if(is_complete.equals("1")){ + String user_name = jsonObject.get("user_name").getAsString(); //用户昵称 + String prank_content = jsonObject.get("prank_content").getAsString(); //整蛊内容 + String gift_count = jsonObject.get("gift_count").getAsString(); // 礼物数量 + LiveChatBean chatBean = new LiveChatBean(); + chatBean.setUserNiceName(user_name); + chatBean.setGiftName(jsonObject.get("gift_name").getAsString()); + chatBean.setGiftname_en(jsonObject.get("gift_name_en").getAsString()); + chatBean.setHot_num(gift_count); + chatBean.setContent(prank_content); + chatBean.setType(TYPE_TO_ANCHOR_PRANK_GIFT); + mListener.onChat(chatBean, 1); + } + }else{ + if (!TextUtils.isEmpty(content)){ + systemChatMessage2(content); + } + } + if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)&&"完成1次!".equals(jsonObject.get("msg").getAsString())){ + Toast toast = Toast.makeText(mContext,WordUtil.isNewZh()?jsonObject.get("msg").getAsString():jsonObject.get("msg_en").getAsString(),Toast.LENGTH_LONG); + toast.show(); + } + mListener.onUpdatePrankProgress(ctString); + } + break; case Constants.SOCKET_KICK://踢人 systemChatMessage2(map.getString("ct")); mListener.onKick(map.getString("touid")); diff --git a/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java b/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java index 76cd96cf1..69c23c515 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java @@ -4,6 +4,7 @@ import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK; import static com.yunbao.common.Constants.SOCKET_LIVE_MSG_TO_USER; import static com.yunbao.live.activity.LiveSwAnchorActivity.isDRPK; import static com.yunbao.live.activity.LiveSwAnchorActivity.DRPKing; +import static com.yunbao.live.bean.LiveChatBean.TYPE_TO_ANCHOR_PRANK_GIFT; import static com.yunbao.live.views.LiveRoomViewHolder.getIsHot; import android.app.Activity; @@ -14,12 +15,16 @@ import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.LinearLayout; +import android.widget.Toast; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; @@ -280,6 +285,44 @@ public class SocketSwClient { } } break; + case Constants.PrankSendData: + //整蛊礼物刷新 + L.e("整蛊礼物刷新 整蛊礼物刷新 整蛊礼物刷新"); + if (map.getIntValue("action") == 13 && map.getString("msgtype").equals("4")){ + String ctString = map.getString("ct"); + L.e("整蛊礼物刷新 整蛊礼物刷新 整蛊礼物刷新 "+ctString); + JsonElement jsonElement = JsonParser.parseString(ctString); + if (jsonElement == null) break; +// LogUtils.e("yqw=====>整蛊礼物列表:"+ctString); + JsonObject jsonObject = jsonElement.getAsJsonObject(); + String content = WordUtil.isNewZh() ? jsonObject.get("msg").getAsString() : jsonObject.get("msg_en").getAsString(); + if(jsonObject.get("is_complete")!=null){ + String is_complete = jsonObject.get("is_complete").getAsString(); //0.未达成整蛊需要的数量 1.已达成整蛊 + if(is_complete.equals("1")){ + String user_name = jsonObject.get("user_name").getAsString(); //用户昵称 + String prank_content = jsonObject.get("prank_content").getAsString(); //整蛊内容 + String gift_count = jsonObject.get("gift_count").getAsString(); // 礼物数量 + LiveChatBean chatBean = new LiveChatBean(); + chatBean.setUserNiceName(user_name); + chatBean.setGiftName(jsonObject.get("gift_name").getAsString()); + chatBean.setGiftname_en(jsonObject.get("gift_name_en").getAsString()); + chatBean.setHot_num(gift_count); + chatBean.setContent(prank_content); + chatBean.setType(TYPE_TO_ANCHOR_PRANK_GIFT); + mListener.onChat(chatBean, 1); + } + }else{ + if (!TextUtils.isEmpty(content)){ + systemChatMessage2(content); + } + } + if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)&&"完成1次!".equals(jsonObject.get("msg").getAsString())){ + Toast toast = Toast.makeText(mContext,WordUtil.isNewZh()?jsonObject.get("msg").getAsString():jsonObject.get("msg_en").getAsString(),Toast.LENGTH_LONG); + toast.show(); + } + mListener.onUpdatePrankProgress(ctString); + } + break; case Constants.SOCKET_KICK://踢人 systemChatMessage2(map.getString("ct")); mListener.onKick(map.getString("touid")); diff --git a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java index c1014fa45..54b00cb34 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java @@ -365,6 +365,7 @@ public class LiveTextRender { } createPrefixCallback.onPrefixCallback(builder, 0);*/ show(drawable); + //createPrefixCallback.onPrefixCallback(builder, 0); } @Override diff --git a/live/src/main/java/com/yunbao/live/utils/Zeus.kt b/live/src/main/java/com/yunbao/live/utils/Zeus.kt new file mode 100644 index 000000000..4cce351b0 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/utils/Zeus.kt @@ -0,0 +1,90 @@ +package com.yunbao.live.utils + +import android.graphics.Color +import android.graphics.LinearGradient +import android.graphics.Shader +import android.text.Spannable +import android.text.SpannableString +import android.text.style.ForegroundColorSpan +import android.view.View +import android.widget.TextView +import androidx.core.content.ContextCompat +import androidx.core.view.isGone +import androidx.core.view.isInvisible +import androidx.core.view.isVisible +import java.util.regex.Pattern + +//显示控件 +fun View.visible(){ + isVisible = true +} + +//隐藏控件 +fun View.gone(){ + isGone = true +} + +//隐藏控件 +fun View.inVisible(){ + isInvisible = true +} + +//文字颜色渐变 +fun setGradientFont(view: TextView,floatArray: FloatArray,colors : Array) { + view.measure(View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED),0) +// val floats = floatArrayOf(0.5f,1.0f) + val colorsInt = colors.map { Color.parseColor(it) }.toIntArray() + val linearGradient = + LinearGradient(0f, 0f, + view.measuredWidth.toFloat(), + 0f, + colorsInt, + floatArray, + Shader.TileMode.CLAMP) + view.paint.shader = linearGradient + view.invalidate() +} + +/** + *@MethodName: setOnSingleClick + *@Description: 调用控件的点击事件 + *@Author: Yqw + *@Date: 2023/4/21 18:10 + **/ +private var lastClickTime = 0L +private const val internalTime = 500L +interface OnClickListener{ + fun onClick(view : View) +} +fun setOnSingleClick(view: View,onClick : OnClickListener){ + view.setOnClickListener { + if (lastClickTime != 0L && (System.currentTimeMillis()- lastClickTime)< internalTime){ +// lastClickTime = System.currentTimeMillis() +// "Do not click repeatedly!".toastShort + return@setOnClickListener + }else{ + lastClickTime = System.currentTimeMillis() + onClick.onClick(it) + } + } +} + +//设置关键词样式 +fun setSpannable(content: String, keys: Array,color : String): SpannableString { + val msp = SpannableString(content) + for (index in keys.indices){ + val p = Pattern.compile(keys[index]) + val m = p.matcher(msp) + while (m.find()){ + msp.setSpan( + ForegroundColorSpan(Color.parseColor(color)), + m.start(), + m.end(), + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) +// msp.setSpan(StyleSpan(Typeface.BOLD),m.start(),m.end(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) +// msp.setSpan(AbsoluteSizeSpan(25,true),m.start(),m.end(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) +// msp.setSpan(UnderlineSpan(),m.start(),m.end(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) + } + } + return msp +} \ No newline at end of file diff --git a/live/src/main/java/com/yunbao/live/views/LiveGiftItemFragment.java b/live/src/main/java/com/yunbao/live/views/LiveGiftItemFragment.java index ee7c03513..1d151691b 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveGiftItemFragment.java +++ b/live/src/main/java/com/yunbao/live/views/LiveGiftItemFragment.java @@ -56,6 +56,16 @@ public class LiveGiftItemFragment extends BaseFragment { frameGiftList.setLayoutManager(new GridLayoutManager(getActivity(), 4, GridLayoutManager.VERTICAL, false)); frameGiftAdapter = new FrameGiftAdapter(contextLayoutGiftHeight, giftJson, mStream, mLiveUid, wishGiftId); frameGiftList.setAdapter(frameGiftAdapter); + + frameGiftList.post(()->{ + if (!TextUtils.isEmpty(wishGiftId) && !giftJson.isEmpty()){ + for (int i = 0; i < giftJson.size(); i++) { + if (giftJson.get(i).getId()== Integer.parseInt(wishGiftId)){ + frameGiftAdapter.giftSelect(giftJson.get(i)); + } + } + } + }); } @Override diff --git a/live/src/main/java/com/yunbao/live/views/LiveParcelItemFragment.java b/live/src/main/java/com/yunbao/live/views/LiveParcelItemFragment.java index 7127f6753..0a75492bf 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveParcelItemFragment.java +++ b/live/src/main/java/com/yunbao/live/views/LiveParcelItemFragment.java @@ -77,6 +77,6 @@ public class LiveParcelItemFragment extends BaseFragment { @Subscribe(threadMode = ThreadMode.MAIN) public void onLiveParcelItemRefreshEvent(LiveParcelItemRefreshEvent event) { - frameGiftAdapter.refreshWrapListAfterSend(event.getLiveGiftModel()); + frameGiftAdapter.refreshWrapListAfterSend(event); } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 5fc3bc3d7..72dfc078f 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -44,6 +44,9 @@ import androidx.recyclerview.widget.RecyclerView; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.blankj.utilcode.util.GsonUtils; +import com.blankj.utilcode.util.LogUtils; +import com.blankj.utilcode.util.SizeUtils; import com.bumptech.glide.Glide; import com.bumptech.glide.load.DataSource; import com.bumptech.glide.load.engine.GlideException; @@ -51,6 +54,9 @@ import com.bumptech.glide.load.resource.gif.GifDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.target.Target; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.reflect.TypeToken; import com.google.gson.Gson; import com.lxj.xpopup.XPopup; import com.makeramen.roundedimageview.RoundedImageView; @@ -62,6 +68,8 @@ import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; +import com.yunbao.common.bean.PrankProgressBean; +import com.yunbao.common.utils.L; import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; @@ -151,9 +159,11 @@ import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveSwAnchorActivity; import com.yunbao.live.activity.ZhuangBanActivity; +import com.yunbao.live.adapter.ComboAdapter; import com.yunbao.live.adapter.LiveChatAdapter; import com.yunbao.live.adapter.LiveRoomFastMessageRecyclerViewAdapter; import com.yunbao.live.adapter.LiveUserAdapter; +import com.yunbao.live.adapter.PrankAdapter; import com.yunbao.live.bean.DrPkbean; import com.yunbao.live.bean.LiveBuyGuardMsgBean; import com.yunbao.live.bean.LiveChatBean; @@ -175,6 +185,7 @@ import com.yunbao.live.dialog.LiveFaceUnityDialogFragment; import com.yunbao.live.dialog.LiveFansMedalDialogFragment; import com.yunbao.live.dialog.LiveGameDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment; +import com.yunbao.live.dialog.LivePrankDialogFragment; import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog; import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; @@ -190,6 +201,7 @@ import com.yunbao.live.presenter.LiveLightAnimPresenter; import com.yunbao.live.utils.LiveRoomVoteManager; import com.yunbao.live.utils.LiveTextRender; import com.yunbao.live.utils.LoadDian9TuUtil; +import com.yunbao.live.utils.ZeusKt; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -199,6 +211,7 @@ import java.lang.ref.WeakReference; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -210,6 +223,7 @@ import io.rong.imkit.userinfo.RongUserInfoManager; import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Conversation; import io.rong.imlib.model.UserInfo; +import com.bumptech.glide.load.resource.gif.GifDrawable; import pl.droidsonroids.gif.GifImageView; /** @@ -402,6 +416,24 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private View quick_gift_reminder; private int guardType = 0; + //整蛊进度列表功能 + private View prank_group; + public TextView prank_group_title,prank_group_turntable; + private RecyclerView recycler_prank; + private ImageView prank_group_bottom_icon,prank_group_turntable_icon; + private GifImageView prank_small_icon; + private PrankAdapter prankAdapter; + private List prankAndComboList = new ArrayList<>(); + private List completedList = new ArrayList<>(); + private int isPrank; + private boolean prankAnisShow; + private LinearLayout prank_top_layout; + private ImageView prank_group_top_icon; + + private int mPrankType; + + private pl.droidsonroids.gif.GifDrawable mGifDrawable; + private static boolean isSw; public LiveRoomViewHolder setGuardType(int guardType) { @@ -1340,19 +1372,46 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mLiveChatAdapter.removetItem(bean); ((LiveActivity) mContext).sendChatMessage("Hi~", null, null); } else if (bean.getType() == -5) { - String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Turntable&a=tricky"; - url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); + String url = CommonAppConfig.HOST + "/h5/activity/Turntable/index.html"; + url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + + CommonAppConfig.getInstance().getToken() + + "&active_id=6"; Log.i("tag", url); Bundle bundle1 = new Bundle(); bundle1.putString("url", url); LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); liveHDDialogFragment.setArguments(bundle1); - liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + if(mContext instanceof LiveAudienceActivity){ + liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + }else if(mContext instanceof LiveRyAnchorActivity){ + liveHDDialogFragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + }else if(mContext instanceof LiveSwAnchorActivity){ + liveHDDialogFragment.show(((LiveSwAnchorActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); + } } else if (bean.getType() == RECOMMEND_CARD_NOTIFY) { gotoLive(bean.getMsgModel().getAnchorId()); } else if (bean.getType() == bean.STAR_CHALLENGE_UPGRADE_NOTIFY) { gotoLive(bean.getMsgModel().getLiveUid()); - } else { + } else if(bean.getType()==bean.TYPE_TO_ANCHOR_PRANK){ + LivePrankDialogFragment fragment = new LivePrankDialogFragment(); + fragment.setOnPrankResultListener(new LivePrankDialogFragment.onPrankResultListener() { + @Override + public void OpenAndCloseListener() { + initPrankProgress(1); + } + }); + fragment.setmLiveUid(mLiveUid); + if(mContext instanceof LiveRyAnchorActivity){ + fragment.show(((LiveRyAnchorActivity)mContext).getSupportFragmentManager(), "LivePrankDialogFragment"); + }else if(mContext instanceof LiveSwAnchorActivity){ + fragment.show(((LiveSwAnchorActivity)mContext).getSupportFragmentManager(), "LivePrankDialogFragment"); + } + if(mContext instanceof LiveRyAnchorActivity){ + com.yunbao.live.activity.LiveRyAnchorActivity.mLiveAnchorViewHolder.closeMenuRed(); + }else if(mContext instanceof LiveSwAnchorActivity){ + com.yunbao.live.activity.LiveSwAnchorActivity.mLiveAnchorViewHolder.closeMenuRed(); + } + }else{ showUserDialog(bean.getId()); } } @@ -1575,7 +1634,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis findViewById(R.id.btn_follow).setVisibility(View.GONE); findViewById(R.id.live_rank_pk).setVisibility(View.GONE); } - if (mContext instanceof LiveRyAnchorActivity) { + if (mContext instanceof LiveRyAnchorActivity ||mContext instanceof LiveSwAnchorActivity) { findViewById(R.id.open_sidebar).setVisibility(View.GONE); findViewById(R.id.btn_follow).setVisibility(View.GONE); findViewById(R.id.live_rank_pk).setVisibility(View.GONE); @@ -1585,7 +1644,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis reloadIM(); // initStarChallengeStatus(); - new LoadDian9TuUtil().loadDian9TuAssets2(mContext, wishListLayout2, "rectangle_new.png", 1); pa_pao_layout = (FrameLayout) findViewById(R.id.pa_pao_layout); combo_layout = (LinearLayout) findViewById(R.id.combo_layout); @@ -1624,6 +1682,338 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } }); // dragonImmediateParticipation.setVisibility(View.GONE); + + //整蛊转盘优化更新 + prank_top_layout= (LinearLayout) findViewById(R.id.prank_top_layout); + prank_group_top_icon= (ImageView) findViewById(R.id.prank_group_top_icon); + prank_group = findViewById(R.id.prank_group);//浮窗 + prank_group_title = (TextView) findViewById(R.id.prank_group_title);//浮窗标题 + recycler_prank = (RecyclerView) findViewById(R.id.recycler_prank);//列表 + prank_group_turntable = (TextView) findViewById(R.id.prank_group_turntable);//文字转盘整蛊(用户端已删除,主播端为待完成整蛊按钮) + prank_group_bottom_icon = (ImageView) findViewById(R.id.prank_group_bottom_icon);//收起icon + prank_group_turntable_icon = (ImageView) findViewById(R.id.prank_group_turntable_icon);//转盘图标 + prank_small_icon = (GifImageView) findViewById(R.id.prank_small_icon);//收起后图标 + + try { + if (WordUtil.isNewZh()){ + mGifDrawable = new pl.droidsonroids.gif.GifDrawable(mContext.getResources(),R.drawable.pran_zh); + }else { + mGifDrawable = new pl.droidsonroids.gif.GifDrawable(mContext.getResources(),R.drawable.pran_en); + } + prank_small_icon.setImageDrawable(mGifDrawable); + mGifDrawable.stop(); + }catch (Exception e){ + e.printStackTrace(); + } + + + //点击文字转盘整蛊(跳转转盘整蛊) + prank_group_turntable.setOnClickListener(v->{ + prankAnisShow = !prankAnisShow; + if(isPrank==1){ + prankAdapter.setViewType(PrankAdapter.TYPE_GIFT); + }else{ + prankAdapter.setViewType(PrankAdapter.TYPE_COMBO); + } + if(prankAnisShow){ + prankAdapter.showAnView(completedList,prankAnisShow); + prank_group_turntable.setText(R.string.prank_progress); + if (!completedList.isEmpty()){ + limitItem(1,Math.min(completedList.size(), 4)); + }else { + recycler_prank.setVisibility(View.GONE); + } + prank_group_title.setText(WordUtil.isNewZh()?"待完成整蠱":"To do"); + prank_group_turntable.setText(WordUtil.isNewZh()?"整蠱進度":"progress"); + + }else{ + prankAdapter.showAnView(prankAndComboList,prankAnisShow); + prank_group_title.setText(WordUtil.isNewZh()?"整蠱進度":"progress"); + prank_group_turntable.setText(WordUtil.isNewZh()?"待完成整蠱":"To do"); + recycler_prank.setVisibility(View.VISIBLE); + limitItem(1,Math.min(prankAndComboList.size(), 4)); + } + }); + + //点击收起 + prank_group_bottom_icon.setOnClickListener(v->{ + prank_group.setVisibility(View.INVISIBLE); + prank_small_icon.setVisibility(View.VISIBLE); + if (CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + switchGifDrawable(!completedList.isEmpty()); + }else { + switchGifDrawable(false); + } + }); + + //点击收起整蛊icon + prank_small_icon.setOnClickListener(v->{ + prank_group.setVisibility(View.VISIBLE); + prank_small_icon.setVisibility(View.GONE); + }); + + //点击图片转盘整蛊(跳转转盘整蛊) + prank_group_turntable_icon.setOnClickListener(v->{ + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.WE_CHEAT)); + }); + + recycler_prank.setLayoutManager(new LinearLayoutManager(mContext)); + + initPrankAdapter(); + } + + /** + * 收起整蛊列表 + */ + public void closePrankView(){ + if(prank_group.getVisibility()==View.VISIBLE){ + prank_group.setVisibility(View.GONE); + prank_small_icon.setVisibility(View.VISIBLE); + } + } + + + public void sendMsgPrank(){ + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + LiveChatBean bean = new LiveChatBean(); + bean.setContent("开播整蛊通知"); + bean.setType(LiveChatBean.TYPE_TO_ANCHOR_PRANK); + mLiveChatAdapter.insertItem(bean); + } + }, 1000); + } + + + //初始化整蛊列表进度 + public void initPrankProgress(int isShow){ +// LogUtils.e("yqw=====>主播id:"+mLiveUid); + //获取整蛊列表 + LiveNetManager.get(mContext).getPrankProgressList(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(PrankProgressBean data) { +// LogUtils.e("yqw=====>整蛊列表:"+data); + + isPrank = data.getPrank_type(); + prankAndComboList.clear(); + prankAndComboList.addAll(data.getPrank_list()); + completedList.clear(); + completedList.addAll(data.getCompleted_list()); + setPrankList(isShow,data.getStatus(),data.getPrank_type(),data.getPrank_turntable_status()); + } + + @Override + public void onError(String error) { + prank_group.setVisibility(View.GONE); + prank_small_icon.setVisibility(View.GONE); + prank_group_turntable_icon.setVisibility(View.GONE); + ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); + } + }); + } + + //刷新整蛊礼物列表 + public void refreshPrank(String newPrankData){ + try { +// LogUtils.e("yqw=====>整蛊礼物数据1:"+newPrankData); + org.json.JSONObject ctString = new org.json.JSONObject(newPrankData); + if (ctString.getInt("is_update") == 1){ + //列表全部更新 + if (ctString.getInt("status")==1){ + //编辑添加整蛊 + initPrankProgress(1); + }else { + //编辑取消整蛊 + prank_group.setVisibility(View.GONE); + prank_small_icon.setVisibility(View.GONE); + } + if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + return; + } + if (Integer.parseInt(ctString.getString("prank_turntable_status")) == 0){ + prank_group_turntable_icon.setVisibility(View.GONE); + }else { + prank_group_turntable_icon.setVisibility(View.VISIBLE); + //ZeusKt.visible(prank_group_turntable_icon); + } + }else { + //送整蛊礼物更新 + String prankListString = ctString.getString("prank_list"); + List prankList = GsonUtils.fromJson(prankListString,new TypeToken>() {}.getType()); +// LogUtils.e("yqw=====>整蛊礼物数据2:"+prankList.toString()); + prankAndComboList.clear(); + prankAndComboList.addAll(prankList); + + String completedString = ctString.getString("completed_list"); + List completeds = GsonUtils.fromJson(completedString,new TypeToken>() {}.getType()); + completedList.clear(); + completedList.addAll(completeds); + + setPrankList(0,Integer.parseInt(ctString.getString("status")), Integer.parseInt(ctString.getString("prank_type")), Integer.parseInt(ctString.getString("prank_turntable_status"))); + } + }catch (Exception e){ + LogUtils.e("yqw=====>转换错误:"+e.getMessage()); + } + + } + private void initPrankAdapter() { + prankAdapter = new PrankAdapter(mContext); + //整蛊礼物点击 + prankAdapter.addOnItemClickListener(new PrankAdapter.OnItemClickListener() { + @Override + public void onItemClick(View view, int giftId) { + if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + return; + } + openGiftDialog(String.valueOf(giftId)); + } + + @Override + public void onItemDel(int giftId) { + LiveNetManager.get(mContext).anchorClickFinish(mLiveUid, String.valueOf(giftId), new com.yunbao.common.http.base.HttpCallback>() { + @Override + public void onSuccess(List data) { + + } + + @Override + public void onError(String error) { + + } + }); + L.e("onItemDel:"+giftId); + } + }); + + } + //设置整蛊礼物数据 + private void setPrankList(int isShow,int status,int mPrankType,int prankTurntableStatus){ + this.mPrankType =mPrankType; +// LogUtils.e("yqw=====>显示转盘icon:是否显示:"+(prankTurntableStatus == 1)+",是否在倒计时"+(lt_trickery.getVisibility() == View.VISIBLE)); + if (prankTurntableStatus == 1 && lt_trickery.getVisibility() == View.GONE){ + if(!CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + prank_group_turntable_icon.setVisibility(View.VISIBLE); + } + }else { + prank_group_turntable_icon.setVisibility(View.GONE); + } +// LogUtils.e("yqw=====>显示整蛊列表或者投票列表:"+status); + if (status == 1){ + if(isShow==1){ + prank_group.setVisibility(View.VISIBLE); + prank_small_icon.setVisibility(View.GONE); + }else if(isShow==2){ + prank_group.setVisibility(View.GONE); + prank_small_icon.setVisibility(View.VISIBLE); + } + //主播可能打开整蛊功能,但是不设置整蛊礼物,这里会是空列表 + if (!prankAndComboList.isEmpty()){ + initPrankAdapter(); + recycler_prank.setAdapter(prankAdapter); + if (mPrankType == 1){//礼物 +// sortByCompletionRate(prankAndComboList); + prankAdapter.setViewType(PrankAdapter.TYPE_GIFT); + //prankAdapter.setList(prankAndComboList); + if(prankAnisShow){ + prankAdapter.showAnView(completedList,prankAnisShow); + prank_group_title.setText(WordUtil.isNewZh()?"待完成整蠱":"To do"); + prank_group_turntable.setText(WordUtil.isNewZh()?"整蠱進度":"progress"); + if (!completedList.isEmpty()){ + limitItem(1,Math.min(completedList.size(), 4)); + }else { + recycler_prank.setVisibility(View.GONE); + } + + }else{ + prankAdapter.showAnView(prankAndComboList,prankAnisShow); + prank_group_title.setText(WordUtil.isNewZh()?"整蠱進度":"progress"); + prank_group_turntable.setText(WordUtil.isNewZh()?"待完成整蠱":"To do"); + limitItem(1,Math.min(prankAndComboList.size(), 4)); + } + }else { //连击 +// sortBySendNum(prankAndComboList); + prank_group_title.setText(R.string.combo_vote); + prankAdapter.setViewType(PrankAdapter.TYPE_COMBO); + prankAdapter.setList(prankAndComboList); + limitItem(2,Math.min(prankAndComboList.size(), 4)); + } + }else { + prank_group.setVisibility(View.GONE); + prank_small_icon.setVisibility(View.GONE); + } + if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + + prank_top_layout.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + prank_group.setVisibility(View.GONE); + prank_small_icon.setVisibility(View.VISIBLE); + switchGifDrawable(!completedList.isEmpty()); + } + }); + prank_group_top_icon.setVisibility(View.VISIBLE); + if(mPrankType==1){ + prank_group_turntable.setVisibility(View.VISIBLE); + }else{ + prank_group_turntable.setVisibility(View.GONE); + } + prank_group_bottom_icon.setVisibility(View.GONE); + switchGifDrawable(!completedList.isEmpty()); + }else{ + switchGifDrawable(false); + if(mPrankType==1){ + prank_group_title.setText(R.string.prank_progress); + }else{ + prank_group_title.setText(R.string.combo_vote); + } + prank_group_turntable.setVisibility(View.GONE); + prank_group_top_icon.setVisibility(View.GONE); + } + }else { + prank_group.setVisibility(View.GONE); + prank_small_icon.setVisibility(View.GONE); + } + } + + + //根据完成度排序 + private void sortByCompletionRate(List items) { + Collections.sort(items, (item1, item2) -> Double.compare(item2.getCompletionRate(), item1.getCompletionRate())); + } + + //根据连击数排列 + private void sortBySendNum(List items) { + Collections.sort(items, (item1, item2) -> { + return Integer.compare(item2.getSend_num(), item1.getSend_num()); // 从高到低排序 + }); + } + + //设置最多显示4个项目 + private void limitItem(int prankType,int maxItem){ + recycler_prank.post(() -> { + View itemView = recycler_prank.getChildAt(0); + if (itemView != null){ + int gap = prankType == 1 ? SizeUtils.dp2px(3f) : 0; + int height = (itemView.getHeight() + gap)*maxItem; + ViewGroup.LayoutParams layoutParams = recycler_prank.getLayoutParams(); + layoutParams.height = height; + recycler_prank.setLayoutParams(layoutParams); + } + }); + } + + private void switchGifDrawable(boolean start){ +// LogUtils.e("yqw=====>判断闪烁:"+(mGifDrawable != null)+","+start); + if (mGifDrawable != null){ + if (start){ + mGifDrawable.start(); + }else { + mGifDrawable.seekTo(0); + mGifDrawable.stop(); + } + } } int ttttttype = 0; @@ -1721,7 +2111,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis layoutParams.topMargin = DpUtil.dp2px(190); dragonImmediateParticipation.setLayoutParams(layoutParams); } - if (dragonImmediateParticipationTime.getVisibility() == View.VISIBLE && mContext instanceof LiveRyAnchorActivity) { + if (dragonImmediateParticipationTime.getVisibility() == View.VISIBLE && mContext instanceof LiveRyAnchorActivity||mContext instanceof LiveSwAnchorActivity) { RelativeLayout.LayoutParams layoutParamsredPacket = (RelativeLayout.LayoutParams) redPacket.getLayoutParams(); layoutParamsredPacket.topMargin = DpUtil.dp2px(110); redPacket.setLayoutParams(layoutParamsredPacket); @@ -2135,7 +2525,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void setLiveUid(String liveUid) { mLiveUid = liveUid; - LiveHttpUtil.getAnchorActiveImgStatus(mLiveUid, new HttpCallback() { + /*LiveHttpUtil.getAnchorActiveImgStatus(mLiveUid, new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && imgEvent != null) { @@ -2158,7 +2548,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } } - }); + });*/ } //获取心愿单列表 @@ -4600,6 +4990,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis content = jsonObject.getString("content"); name = jsonObject.getString("user_nicename"); lt_trickery.setVisibility(View.VISIBLE); + prank_group_turntable_icon.setVisibility(View.GONE); lt_trickery.setBackground(mContext.getResources().getDrawable(R.mipmap.img_buoy)); isClose = false; starTimeloud(1, time); @@ -4643,6 +5034,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis countDownTimerTrickery.cancel(); countDownTimerTrickery = null; lt_trickery.setVisibility(View.GONE); + if(!CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + prank_group_turntable_icon.setVisibility(View.VISIBLE); + } LiveNetManager.get(mContext).endPrankTurntable(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { @Override public void onSuccess(BaseModel data) { @@ -4677,6 +5071,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis starTimeloud(2, time); } else { lt_trickery.setVisibility(View.GONE); + if(!CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + prank_group_turntable_icon.setVisibility(View.VISIBLE); + } timeOver(); } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java index be6be1142..c40d4f83d 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java @@ -89,6 +89,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { private TextView mLiveTimeTextView;//主播的直播时长 private long mAnchorLiveTime;//主播直播时间 private LiveRoomHandler mLiveRoomHandler; + private TextView menuRed; private static LinearLayout btn_end_pk_dr; private String drpkRoomId; //多人 PK 房主 roomUid private ImageView leaveImg; @@ -237,6 +238,8 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { mLiveTimeTextView = (TextView) findViewById(R.id.live_time); mLiveTimeTextView.setVisibility(View.VISIBLE); mLiveRoomHandler = new LiveRoomHandler(); + + menuRed = (TextView) findViewById(R.id.red_menu); } private Map yaoqing = new HashMap<>(); @@ -719,4 +722,12 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { } return now + time + -now % 1000; } + + public void closeMenuRed(){ + menuRed.setVisibility(View.GONE); + } + + public boolean isShowMenuRed(){ + return menuRed.getVisibility()==View.VISIBLE; + } } diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 100bc738d..8418373ec 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -231,6 +231,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe private static int waitShowTopBannerTime = 6000; private boolean isSw; + private boolean isShowPrank = true; public PortraitLiveManager setQuitF(boolean quitF) { isQuitF = quitF; @@ -337,6 +338,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe loading.setVisibility(View.GONE); enterRoomLeaveHandler.post(enterRoomLeaveRunnable); OpenAdManager.getInstance().show(OpenAdManager.TYPE_LIVE, LiveGuardInfo.isGuard(mLiveGuardInfo)); + } }; final Runnable loadTimeoutRunnableGone = new Runnable() { @@ -406,8 +408,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null); if (isSw) { mLiveSwLinkMicPkPresenter = new LiveSwLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null); + mLiveSwLinkMicPkPresenter.setmLiveRoomViewHolder(mLiveRoomViewHolder); } else { mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null); + mLiveRyLinkMicPkPresenter.setmLiveRoomViewHolder(mLiveRoomViewHolder); } mLivePlayViewHolder.initSwEngine(mLiveBean.getUid()); mLivePlayViewHolder.addToParent(); @@ -432,10 +436,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe if (isSw) { if (mLiveSwLinkMicPkPresenter == null) { mLiveSwLinkMicPkPresenter = new LiveSwLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null); + mLiveSwLinkMicPkPresenter.setmLiveRoomViewHolder(mLiveRoomViewHolder); } } else { if (mLiveRyLinkMicPkPresenter == null) { mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null); + mLiveRyLinkMicPkPresenter.setmLiveRoomViewHolder(mLiveRoomViewHolder); } } @@ -724,6 +730,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLivePlayViewHolder.setPkView(connection_info.getPkuid()); } } + isShowPrank = false; } if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.pkHandler = false; @@ -751,6 +758,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } else { mLiveRyLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean); } + isShowPrank = false; } else if (!pkInfo.getString("end_pk_time").equals("0")) { if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.pkHandler = true; @@ -769,6 +777,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } else { mLiveRyLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean); } + isShowPrank = false; } else { if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.initPkRank(null); @@ -806,6 +815,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } upDataPkScore(pkInfo.getJSONArray("userlist"), pkInfo.getIntValue("drpk_time")); + isShowPrank = false; } if (data.getEnterRoomInfo().getGuard() != null) { if (mLiveRoomViewHolder != null) { @@ -890,7 +900,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe if (!TextUtils.isEmpty(data.getModel().getSendMoneyLongKey())) { mLiveRoomViewHolder.onSendMoneyLong(); } - + //初始化整蠱列表 + mLiveRoomViewHolder.initPrankProgress(isShowPrank?1:2); } @Override @@ -1945,6 +1956,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } + //整蛊进度数据更新 + @Override + public void onUpdatePrankProgress(String prankString) { + if (mLiveRoomViewHolder != null){ + mLiveRoomViewHolder.refreshPrank(prankString); + } + } + private PagerAdapter pagerAdapter = new PagerAdapter() { @Override public int getCount() { diff --git a/live/src/main/res/drawable/bg_live_prank_btn_cancel.xml b/live/src/main/res/drawable/bg_live_prank_btn_cancel.xml new file mode 100644 index 000000000..822b6d96e --- /dev/null +++ b/live/src/main/res/drawable/bg_live_prank_btn_cancel.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_prank_btn_save.xml b/live/src/main/res/drawable/bg_live_prank_btn_save.xml new file mode 100644 index 000000000..df8e924da --- /dev/null +++ b/live/src/main/res/drawable/bg_live_prank_btn_save.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_prank_turntable_save.xml b/live/src/main/res/drawable/bg_live_prank_turntable_save.xml index 212e3cbe0..6e84e1100 100644 --- a/live/src/main/res/drawable/bg_live_prank_turntable_save.xml +++ b/live/src/main/res/drawable/bg_live_prank_turntable_save.xml @@ -2,7 +2,7 @@ - + diff --git a/live/src/main/res/drawable/bg_prank_an_once.xml b/live/src/main/res/drawable/bg_prank_an_once.xml new file mode 100644 index 000000000..0bd004a45 --- /dev/null +++ b/live/src/main/res/drawable/bg_prank_an_once.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_prank_bottom_detail.xml b/live/src/main/res/drawable/bg_prank_bottom_detail.xml new file mode 100644 index 000000000..aa82d3720 --- /dev/null +++ b/live/src/main/res/drawable/bg_prank_bottom_detail.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_prank_btn_gift_add_number.xml b/live/src/main/res/drawable/bg_prank_btn_gift_add_number.xml new file mode 100644 index 000000000..5d55567c7 --- /dev/null +++ b/live/src/main/res/drawable/bg_prank_btn_gift_add_number.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_prank_gift_add_item.xml b/live/src/main/res/drawable/bg_prank_gift_add_item.xml new file mode 100644 index 000000000..abe9f2e32 --- /dev/null +++ b/live/src/main/res/drawable/bg_prank_gift_add_item.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_prank_group.xml b/live/src/main/res/drawable/bg_prank_group.xml new file mode 100644 index 000000000..cae27342f --- /dev/null +++ b/live/src/main/res/drawable/bg_prank_group.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_prank_item.xml b/live/src/main/res/drawable/bg_prank_item.xml new file mode 100644 index 000000000..861ab3d90 --- /dev/null +++ b/live/src/main/res/drawable/bg_prank_item.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_prank_item_subscript.xml b/live/src/main/res/drawable/bg_prank_item_subscript.xml new file mode 100644 index 000000000..eb405431d --- /dev/null +++ b/live/src/main/res/drawable/bg_prank_item_subscript.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/pran_en.gif b/live/src/main/res/drawable/pran_en.gif new file mode 100644 index 000000000..223ca4241 Binary files /dev/null and b/live/src/main/res/drawable/pran_en.gif differ diff --git a/live/src/main/res/drawable/pran_zh.gif b/live/src/main/res/drawable/pran_zh.gif new file mode 100644 index 000000000..27653504a Binary files /dev/null and b/live/src/main/res/drawable/pran_zh.gif differ diff --git a/live/src/main/res/drawable/prank_msg_goto.xml b/live/src/main/res/drawable/prank_msg_goto.xml new file mode 100644 index 000000000..36658498c --- /dev/null +++ b/live/src/main/res/drawable/prank_msg_goto.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/progress_prank_bg.xml b/live/src/main/res/drawable/progress_prank_bg.xml new file mode 100644 index 000000000..520540726 --- /dev/null +++ b/live/src/main/res/drawable/progress_prank_bg.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_prank.xml b/live/src/main/res/layout/dialog_live_prank.xml index f1e719288..274df02ee 100644 --- a/live/src/main/res/layout/dialog_live_prank.xml +++ b/live/src/main/res/layout/dialog_live_prank.xml @@ -1,6 +1,7 @@ @@ -12,9 +13,10 @@ android:layout_marginStart="16dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:tabIndicatorColor="#F6F7FB" app:tabIndicator="@drawable/random_pk_shape_tab_indicator" + app:tabIndicatorColor="#F6F7FB" app:tabIndicatorFullWidth="false" + app:tabTextAppearance="@style/PrankTabLayoutTextStyle" app:tabMaxWidth="100dp" app:tabMode="scrollable" app:tabSelectedTextColor="#F6F7FB" @@ -28,20 +30,67 @@ android:layout_width="67dp" android:layout_height="24dp" android:layout_marginTop="16dp" - android:layout_marginEnd="16dp" + android:layout_marginEnd="15dp" android:background="@drawable/bg_live_prank_turntable_save" android:gravity="center" android:textColor="#FFF" android:textSize="10sp" - app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintEnd_toStartOf="@+id/help" app:layout_constraintTop_toTopOf="parent" /> + + + + + + +