diff --git a/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java b/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java index 87fccce94..5e7fecaa1 100644 --- a/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java +++ b/app/src/main/java/com/shayu/phonelive/NeverCrashUtils.java @@ -8,6 +8,7 @@ import android.os.Looper; import android.util.Log; import android.widget.Toast; +import com.yunbao.common.BuildConfig; import com.yunbao.common.bean.CrashSaveBean; import com.yunbao.common.utils.FileUtil; import com.yunbao.common.utils.SpUtil; @@ -101,7 +102,9 @@ public class NeverCrashUtils { Log.e(TAG, "未捕获的主线程异常行为", e); } e.printStackTrace(); - //Toast.makeText(application, "发生闪退:"+e.getMessage(), Toast.LENGTH_SHORT).show(); + if(BuildConfig.DEBUG) { + Toast.makeText(application, "发生闪退:"+e.getMessage(), Toast.LENGTH_SHORT).show(); + } FileUtil.saveStringToFile(new File(application.getDir("files", Context.MODE_PRIVATE).getAbsolutePath()), throwableToString(e), "error.log"); getMainCrashHandler().mainException(Looper.getMainLooper().getThread(), e); // return; diff --git a/common/src/main/java/com/yunbao/common/bean/BannerBean.java b/common/src/main/java/com/yunbao/common/bean/BannerBean.java index 37767407e..75a8fc7ea 100644 --- a/common/src/main/java/com/yunbao/common/bean/BannerBean.java +++ b/common/src/main/java/com/yunbao/common/bean/BannerBean.java @@ -16,6 +16,7 @@ public class BannerBean { private int type; private String name; private int activityId=0; + private int mIconRes; private StarChallengeStatusModel model; @@ -100,6 +101,14 @@ public class BannerBean { this.activityId = activityId; } + public int getIconRes() { + return mIconRes; + } + + public void setIconRes(int mIconRes) { + this.mIconRes = mIconRes; + } + @Override public String toString() { return "BannerBean{" + diff --git a/common/src/main/java/com/yunbao/common/bean/HttpCallbackModel.java b/common/src/main/java/com/yunbao/common/bean/HttpCallbackModel.java index da77d56e5..a519e9385 100644 --- a/common/src/main/java/com/yunbao/common/bean/HttpCallbackModel.java +++ b/common/src/main/java/com/yunbao/common/bean/HttpCallbackModel.java @@ -28,4 +28,12 @@ public class HttpCallbackModel extends BaseModel { public void setMsg(String msg) { this.msg = msg; } + + @Override + public String toString() { + return "HttpCallbackModel{" + + "code=" + code + + ", msg='" + msg + '\'' + + '}'; + } } diff --git a/common/src/main/java/com/yunbao/common/bean/LiveAnchorCallMeModel.java b/common/src/main/java/com/yunbao/common/bean/LiveAnchorCallMeModel.java new file mode 100644 index 000000000..1cedccb49 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LiveAnchorCallMeModel.java @@ -0,0 +1,162 @@ +package com.yunbao.common.bean; + +import androidx.annotation.NonNull; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.google.gson.annotations.SerializedName; + +/** + * 联系方式 + */ +public class LiveAnchorCallMeModel extends BaseModel { + @SerializedName("id") + private int id; + @SerializedName("isShow") + private int isShow; + @SerializedName("gift_id") + private int giftId; + @SerializedName("giftImage") + private String giftImage; + @SerializedName("content") + private String content; + @SerializedName("wechat") + private AppBean wechat; + @SerializedName("line") + private AppBean line; + @SerializedName("whatsApp") + private AppBean whatsApp; + + public LiveAnchorCallMeModel() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getGiftImage() { + return giftImage; + } + + public void setGiftImage(String giftImage) { + this.giftImage = giftImage; + } + + public int getIsShow() { + return isShow; + } + + public void setIsShow(int isShow) { + this.isShow = isShow; + } + + public int getGiftId() { + return giftId; + } + + public void setGiftId(int giftId) { + this.giftId = giftId; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public AppBean getWechat() { + if (wechat == null) { + wechat = new AppBean(); + } + return wechat; + } + + public void setWechat(AppBean wechat) { + this.wechat = wechat; + } + + public AppBean getLine() { + if (line == null) { + line = new AppBean(); + } + return line; + } + + public void setLine(AppBean line) { + this.line = line; + } + + public AppBean getWhatsApp() { + if (whatsApp == null) { + whatsApp = new AppBean(); + } + return whatsApp; + } + + public void setWhatsApp(AppBean whatsApp) { + this.whatsApp = whatsApp; + } + + @Override + public String toString() { + return "LiveAnchorCallMeModel{" + + "id=" + id + + ", isShow=" + isShow + + ", giftId=" + giftId + + ", giftImage='" + giftImage + '\'' + + ", content='" + content + '\'' + + ", wechat=" + wechat + + ", line=" + line + + ", whatsApp=" + whatsApp + + '}'; + } + + public static class AppBean { + private String number; + private int isShow; + + public AppBean() { + } + + public AppBean(String number, int isShow) { + this.number = number; + this.isShow = isShow; + } + + public String getNumber() { + return number; + } + + public void setNumber(String number) { + this.number = number; + } + + public int getIsShow() { + return isShow; + } + + public void setIsShow(int isShow) { + this.isShow = isShow; + } + + @NonNull + @Override + public String toString() { + return "AppBean{" + + "number='" + number + '\'' + + ", isShow=" + isShow + + '}'; + } + + public JSONObject toJSONObject() { + return (JSONObject) JSON.toJSON(this); + } + } + +} diff --git a/common/src/main/java/com/yunbao/common/bean/LiveAnchorSayModel.java b/common/src/main/java/com/yunbao/common/bean/LiveAnchorSayModel.java new file mode 100644 index 000000000..ba686fa63 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LiveAnchorSayModel.java @@ -0,0 +1,80 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class LiveAnchorSayModel extends BaseModel{ + @SerializedName("livePreview") + private LivePreview livePreview; + @SerializedName("style") + private List style; + + public LiveAnchorSayModel() { + } + + public LivePreview getLivePreview() { + return livePreview; + } + + public void setLivePreview(LivePreview livePreview) { + this.livePreview = livePreview; + } + + public List getStyle() { + return style; + } + + public void setStyle(List style) { + this.style = style; + } + public class LivePreview{ + private int isShow; + private String content; + private String styleImage; + + public LivePreview() { + } + + public int getIsShow() { + return isShow; + } + + public void setIsShow(int isShow) { + this.isShow = isShow; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getStyleImage() { + return styleImage; + } + + public void setStyleImage(String styleImage) { + this.styleImage = styleImage; + } + + @Override + public String toString() { + return "LivePreview{" + + "isShow=" + isShow + + ", content='" + content + '\'' + + ", styleImage='" + styleImage + '\'' + + '}'; + } + } + + @Override + public String toString() { + return "LiveAnchorSayModel{" + + "livePreview=" + livePreview + + ", style=" + style + + '}'; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/LiveUserMailBoxModel.java b/common/src/main/java/com/yunbao/common/bean/LiveUserMailBoxModel.java new file mode 100644 index 000000000..b68478a05 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LiveUserMailBoxModel.java @@ -0,0 +1,155 @@ +package com.yunbao.common.bean; + +import androidx.annotation.NonNull; + +import com.google.gson.annotations.SerializedName; +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.utils.StringUtil; + +public class LiveUserMailBoxModel extends BaseModel { + @SerializedName("id") + private int id; + @SerializedName("uid") + private int uid; + @SerializedName("liveuid") + private int liveUid; + @SerializedName("is_read") + private int isRead; + @SerializedName("content") + private String content; + @SerializedName("create_time") + private String createTime; + @SerializedName("gift_id") + private int giftId; + @SerializedName("userName") + private String userName; + @SerializedName("anchorName") + private String anchorName; + @SerializedName("url") + private String url; + + public LiveUserMailBoxModel() { + } + + public LiveUserMailBoxModel(int id, int uid, int liveUid, String content, String createTime, int giftId, String userName, String anchorName) { + this.id = id; + this.uid = uid; + this.liveUid = liveUid; + this.content = content; + this.createTime = createTime; + this.giftId = giftId; + this.userName = userName; + this.anchorName = anchorName; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getUid() { + return uid; + } + + public void setUid(int uid) { + this.uid = uid; + } + + public int getLiveUid() { + return liveUid; + } + + public void setLiveUid(int liveUid) { + this.liveUid = liveUid; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public int getGiftId() { + return giftId; + } + + public void setGiftId(int giftId) { + this.giftId = giftId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getAnchorName() { + return anchorName; + } + + public void setAnchorName(String anchorName) { + this.anchorName = anchorName; + } + + public int getIsRead() { + return isRead; + } + + public void setIsRead(int isRead) { + this.isRead = isRead; + } + + public String getUrl() { + if (StringUtil.isEmpty(url)) { + url = "http://www.baidu.com"; + } else { + if (!url.startsWith("http")) { + url = CommonAppConfig.HOST + "/" + url; + } + if (url.contains("?")) { + url += "&"; + } else { + url += "?"; + } + url += "uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + + CommonAppConfig.getInstance().getToken(); + } + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + @NonNull + @Override + public String toString() { + return "LiveUserMailBoxModel{" + + "id=" + id + + ", uid=" + uid + + ", liveUid=" + liveUid + + ", isRead=" + isRead + + ", content='" + content + '\'' + + ", createTime='" + createTime + '\'' + + ", giftId=" + giftId + + ", userName='" + userName + '\'' + + ", anchorName='" + anchorName + '\'' + + ", url='" + url + '\'' + + '}'; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/NewLevelModel.java b/common/src/main/java/com/yunbao/common/bean/NewLevelModel.java index abc884d0d..b68dff545 100644 --- a/common/src/main/java/com/yunbao/common/bean/NewLevelModel.java +++ b/common/src/main/java/com/yunbao/common/bean/NewLevelModel.java @@ -2,6 +2,7 @@ package com.yunbao.common.bean; import android.text.TextUtils; +import com.google.gson.Gson; import com.google.gson.annotations.SerializedName; /** @@ -17,6 +18,17 @@ public class NewLevelModel extends BaseModel { private String levemax; @SerializedName("thumb") private String thumb; + @SerializedName("icon") + private String icon; + @SerializedName("colour") + private String colour; + @SerializedName("live_icon") + private String liveIcon = "https://downs.yaoulive.com/level1/img_1-9.png"; + + public static NewLevelModel objectFromData(String str) { + + return new Gson().fromJson(str, NewLevelModel.class); + } public String getId() { return id; @@ -67,4 +79,28 @@ public class NewLevelModel extends BaseModel { this.thumb = thumb; return this; } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String getColour() { + return colour; + } + + public void setColour(String colour) { + this.colour = colour; + } + + public String getLiveIcon() { + return liveIcon; + } + + public void setLiveIcon(String liveIcon) { + this.liveIcon = liveIcon; + } } diff --git a/common/src/main/java/com/yunbao/common/dialog/AbsDialogPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/AbsDialogPopupWindow.java index 150ca86e7..94503aa4b 100644 --- a/common/src/main/java/com/yunbao/common/dialog/AbsDialogPopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/AbsDialogPopupWindow.java @@ -27,6 +27,7 @@ public abstract class AbsDialogPopupWindow extends BottomPopupView { public void showDialog() { XPopup.Builder builder = new XPopup.Builder(mContext); builder.isDestroyOnDismiss(true); + builder.enableDrag(false); buildDialog(builder); builder.asCustom(this).show(); } diff --git a/common/src/main/java/com/yunbao/common/http/API.java b/common/src/main/java/com/yunbao/common/http/API.java index 02c5c12ba..89c03afcb 100644 --- a/common/src/main/java/com/yunbao/common/http/API.java +++ b/common/src/main/java/com/yunbao/common/http/API.java @@ -44,7 +44,7 @@ public class API extends BaseApi { public PDLiveApi pdLiveApi(Context context) { if (null == pdLiveApi) { //实例化gson - pdLiveApi=createPDLiveApi(true); + pdLiveApi = createPDLiveApi(true, true); } return pdLiveApi; } @@ -52,10 +52,23 @@ public class API extends BaseApi { /** * 创建新的PDLiveApi,兼容部分接口需要控制是否添加UID参数 * 仅有需要不添加uid的接口使用,默认请用pdLiveApi() + * * @param isNeedUid 是否需要用户uid参数 * @return PDLiveApi */ - public PDLiveApi createPDLiveApi(boolean isNeedUid){ + public PDLiveApi createPDLiveApi(boolean isNeedUid) { + return createPDLiveApi(isNeedUid, true); + } + + /** + * 创建新的PDLiveApi,兼容部分接口需要控制是否添加UID参数 + * 仅有需要不添加uid或token的接口使用,默认请用pdLiveApi() + * + * @param isNeedUid 是否需要用户uid参数 + * @param isNeedToken 是否需要用户Token + * @return PDLiveApi + */ + public PDLiveApi createPDLiveApi(boolean isNeedUid, boolean isNeedToken) { Gson gson = new GsonBuilder() .registerTypeAdapter(Date.class, new DateTypeAdapter()) .create(); @@ -64,20 +77,20 @@ public class API extends BaseApi { OkHttpClient.Builder builder = new OkHttpClient() .newBuilder() - .addInterceptor(initQuery(isNeedUid,CommonAppContext.sInstance.getApplicationContext())) + .addInterceptor(initQuery(isNeedUid, isNeedToken, CommonAppContext.sInstance.getApplicationContext())) .addInterceptor(loggingInterceptor); return create(builder.build(), GsonConverterFactory.create(gson), RxJava2CallAdapterFactory.create(), CommonAppConfig.HOST, PDLiveApi.class); } //公共参数 - public Interceptor initQuery(boolean isNeedUid,final Context context) { + public Interceptor initQuery(boolean isNeedUid, boolean isNeedToken, final Context context) { Interceptor addQueryParameterInterceptor = new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { Request request = chain.request(); //配置公共参数 - request = new ParamsContext(request, context).getInRequest(isNeedUid); + request = new ParamsContext(request, context).getInRequest(isNeedUid, isNeedToken); return chain.proceed(request); } }; diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java index 88af69746..b216485f4 100644 --- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java @@ -217,6 +217,8 @@ public class CommonHttpUtil { } if (obj.containsKey("clarity")) { IMLoginManager.get(context).setClarity(obj.getString("clarity")); + } if (obj.containsKey("defaultBubbleUrl")) { + IMLoginManager.get(context).setDefaultBubbleUrl(obj.getString("defaultBubbleUrl")); } } catch (Exception e) { String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage(); 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 5d269d74e..92857c5f6 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -1,5 +1,6 @@ package com.yunbao.common.http; +import com.alibaba.fastjson.JSONObject; import com.yunbao.common.bean.ActiveModel; import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.BaseModel; @@ -14,11 +15,14 @@ import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LinkMicUserBeanV2; import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.LiveAiRobotBean; +import com.yunbao.common.bean.LiveAnchorCallMeModel; +import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.LiveStetUpStatusModel; import com.yunbao.common.bean.LiveTaskModel; +import com.yunbao.common.bean.LiveUserMailBoxModel; import com.yunbao.common.bean.MsgSwitchDetailModel; import com.yunbao.common.bean.NewPeopleInfo; import com.yunbao.common.bean.NobleRankHideUserListModel; @@ -575,4 +579,61 @@ public interface PDLiveApi { Observable>> getAnchorMsg( @Query("liveuid") String liveUid, @Query("page") int page, @Query("limit") int limit ); + /** + * 获取女神说数据 + */ + @GET("/api/public/?service=Live.getLivePreviewInfo") + Observable> getLivePreviewInfo( + @Query("liveuid") String liveUid + ); + + /** + * 设置女神说 + * + * @param isShow 是否显示 + * @param content 内容 + * @param styleImage 女神说底图地址 + * + */ + @GET("/api/public/?service=Live.setLivePreview") + Observable> setLivePreviewInfo( + @Query("liveuid") String liveUid, + @Query("isShow") int isShow, + @Query("content") String content, + @Query("styleImage")String styleImage + ); + + /** + * 设置主播联系方式 + */ + @GET("/api/public/?service=Live.setAnchorContact") + Observable> setAnchorContact( + @Query("liveuid") String liveUid, + @Query("isShow") int show, + @Query("gift_id") int giftId, + @Query("content") String content, + @Query("wechat") JSONObject wechat, + @Query("line") JSONObject line, + @Query("whatsApp") JSONObject whatsApp + ); + + /** + * 获取主播联系方式 + */ + @GET("/api/public/?service=Live.getContactInfo") + Observable> getContactInfo( + @Query("liveuid") String liveUid + ); + /** + * 获取收件箱信息 + */ + @GET("/api/public/?service=Live.getContactMsg") + Observable>> getContactMsg(); + /** + * 删除联系方式信件 + */ + @GET("/api/public/?service=Live.delContactMsg") + Observable> delContactMsg( + @Query("msgId") int msgId + ); } diff --git a/common/src/main/java/com/yunbao/common/http/base/GetRequestParams.java b/common/src/main/java/com/yunbao/common/http/base/GetRequestParams.java index 002936359..aa12e2997 100644 --- a/common/src/main/java/com/yunbao/common/http/base/GetRequestParams.java +++ b/common/src/main/java/com/yunbao/common/http/base/GetRequestParams.java @@ -20,7 +20,7 @@ public class GetRequestParams implements IRequestParam { * @return */ @Override - public Request getRequest(boolean isNeedUid, Request request, Context context) { + public Request getRequest(boolean isNeedUid,boolean isNeedToken, Request request, Context context) { //添加公共参数 if (IMLoginManager.isLogin(context)) { IMLoginModel model = IMLoginManager.get(context).getUserInfo(); @@ -36,7 +36,9 @@ public class GetRequestParams implements IRequestParam { if (isNeedUid) { builder.addQueryParameter("uid", String.valueOf(model.getId())); } - builder.addQueryParameter("token", model.getToken()); + if(isNeedToken) { + builder.addQueryParameter("token", model.getToken()); + } } return request.newBuilder().url(builder.build()).build(); diff --git a/common/src/main/java/com/yunbao/common/http/base/IRequestParam.java b/common/src/main/java/com/yunbao/common/http/base/IRequestParam.java index bf3a7b311..b87402252 100644 --- a/common/src/main/java/com/yunbao/common/http/base/IRequestParam.java +++ b/common/src/main/java/com/yunbao/common/http/base/IRequestParam.java @@ -5,5 +5,5 @@ import android.content.Context; import okhttp3.Request; public interface IRequestParam { - Request getRequest(boolean isNeedUid,Request request, Context context); + Request getRequest(boolean isNeedUid,boolean isNeedToken, Request request, Context context); } diff --git a/common/src/main/java/com/yunbao/common/http/base/ParamsContext.java b/common/src/main/java/com/yunbao/common/http/base/ParamsContext.java index 8eedbed38..ddd159a76 100644 --- a/common/src/main/java/com/yunbao/common/http/base/ParamsContext.java +++ b/common/src/main/java/com/yunbao/common/http/base/ParamsContext.java @@ -14,7 +14,7 @@ public class ParamsContext { this.request = request; } - public Request getInRequest(boolean isNeedUid) { + public Request getInRequest(boolean isNeedUid,boolean isNeedToken) { switch (request.method()) { case "GET": iRequestParam = new GetRequestParams(); @@ -23,6 +23,6 @@ public class ParamsContext { iRequestParam = new PostRequestParams(); break; } - return iRequestParam.getRequest(isNeedUid,request, context); + return iRequestParam.getRequest(isNeedUid,isNeedToken,request, context); } } diff --git a/common/src/main/java/com/yunbao/common/http/base/PostRequestParams.java b/common/src/main/java/com/yunbao/common/http/base/PostRequestParams.java index 7c1cf332c..4e49b9120 100644 --- a/common/src/main/java/com/yunbao/common/http/base/PostRequestParams.java +++ b/common/src/main/java/com/yunbao/common/http/base/PostRequestParams.java @@ -12,7 +12,7 @@ import okhttp3.Request; public class PostRequestParams implements IRequestParam { @Override - public Request getRequest(boolean isNeedUid, Request request, Context context) { + public Request getRequest(boolean isNeedUid,boolean isNeedToken, Request request, Context context) { if (request.body() instanceof FormBody) { FormBody.Builder bodyBuilder = new FormBody.Builder(); @@ -32,7 +32,9 @@ public class PostRequestParams implements IRequestParam { if (isNeedUid) { bodyBuilder.addEncoded("uid", String.valueOf(model.getId())); } - bodyBuilder.addEncoded("token", model.getToken()); + if(isNeedToken) { + bodyBuilder.addEncoded("token", model.getToken()); + } formBody = bodyBuilder.build(); } } 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 89ac477d5..522470167 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 @@ -4,6 +4,7 @@ import android.content.Context; import android.text.TextUtils; import android.util.Log; +import com.alibaba.fastjson.JSONObject; import com.yunbao.common.Constants; import com.yunbao.common.R; import com.yunbao.common.bean.ActiveModel; @@ -16,11 +17,14 @@ import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LinkMicUserBeanV2; import com.yunbao.common.bean.ListInfoMessageModel; import com.yunbao.common.bean.LiveAiRobotBean; +import com.yunbao.common.bean.LiveAnchorCallMeModel; +import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveDataInfoModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.LiveStetUpStatusModel; import com.yunbao.common.bean.LiveTaskModel; +import com.yunbao.common.bean.LiveUserMailBoxModel; import com.yunbao.common.bean.NobleRankHideUserListModel; import com.yunbao.common.bean.NobleTrumpetModel; import com.yunbao.common.bean.PkRankBean; @@ -45,6 +49,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.Disposable; import io.reactivex.functions.Consumer; import io.reactivex.schedulers.Schedulers; +import retrofit2.http.Query; /** @@ -1145,6 +1150,143 @@ public class LiveNetManager { }).isDisposed(); } + /** + * 获取女神说数据 + */ + public void getLivePreviewInfo(String liveUid, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getLivePreviewInfo(liveUid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + callback.onSuccess(listResponseModel.getData().getInfo()); + }, throwable -> { + callback.onError(throwable.getMessage()); + }).isDisposed(); + } + + /** + * 设置女神说 + * + * @param isShow 是否显示 + * @param content 内容 + * @param styleImage 女神说底图地址 + */ + public void setLivePreviewInfo(String liveUid, + int isShow, + String content, + String styleImage, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .setLivePreviewInfo(liveUid, isShow, content, styleImage) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + }, throwable -> { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + }).isDisposed(); + } + + /** + * 设置主播联系方式 + * + * @param liveUid 直播间id + * @param callMe 载体 + * @param callback 回调 + */ + public void setAnchorCallMe(String liveUid, + LiveAnchorCallMeModel callMe, + HttpCallback callback) { + API.get().createPDLiveApi(false, false) + .setAnchorContact(liveUid, + callMe.getIsShow(), + callMe.getGiftId(), + callMe.getContent(), + callMe.getWechat().toJSONObject(), + callMe.getLine().toJSONObject(), + callMe.getWhatsApp().toJSONObject()) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + }, throwable -> { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + }).isDisposed(); + } + + /** + * 获取收件箱信息 + * + * @param callback 回调 + */ + public void getContactMsg(HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .getContactMsg() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + }, throwable -> { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + }).isDisposed(); + } + + /** + * 获取主播联系方式 + * + * @param liveUid 直播间id + * @param callback 回调 + */ + public void getContactInfo(String liveUid, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getContactInfo(liveUid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + }, throwable -> { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + }).isDisposed(); + } + + /** + * 删除联系方式信件 + * + * @param msgId 信息id + * @param callback 回调 + */ + public void delContactInfo(int msgId, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .delContactMsg(msgId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + }, throwable -> { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + }).isDisposed(); + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index bede5737f..305b8108f 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -42,6 +42,19 @@ public class IMLoginManager extends BaseCacheManager { private final String SELECT_CLARITY = "selectClarity"; private final String CLARITY = "clarity"; private final String xiaJBG = "xiaJBG"; + private final String keyDefaultBubbleUrl = "defaultBubbleUrl"; + private final String STATUS_ANCHOR_SAY = "anchorSay"; + private final String STATUS_ANCHOR_CALL = "anchorCallMe"; + + public void setDefaultBubbleUrl(String defaultBubbleUrl) { + put(keyDefaultBubbleUrl, defaultBubbleUrl); + } + + public String getKeyDefaultBubbleUrl() { + return getString(keyDefaultBubbleUrl); + } + + public void setXiaJBG(boolean xjbg) { put(xiaJBG, xjbg); @@ -84,6 +97,34 @@ public class IMLoginManager extends BaseCacheManager { } + /** + * 获取女神说设置状态 + */ + public int getAnchorSayStatus() { + return getInt(STATUS_ANCHOR_SAY, 0); + } + + /** + * 获取联系主播方式设置状态 + */ + public int getAnchorCallStatus() { + return getInt(STATUS_ANCHOR_CALL, 0); + } + + /** + * 设置女神说设置状态 + */ + public void setAnchorSayStatus(int status) { + put(STATUS_ANCHOR_SAY, status); + } + + /** + * 设置联系主播方式设置状态 + */ + public void setAnchorCallMeStatus(int status) { + put(STATUS_ANCHOR_CALL, status); + } + public boolean isHint() { return 1 == getInt(IS_HINT, 0); } diff --git a/common/src/main/java/com/yunbao/common/manager/NewLevelManager.java b/common/src/main/java/com/yunbao/common/manager/NewLevelManager.java index 919da14af..51cb6f70a 100644 --- a/common/src/main/java/com/yunbao/common/manager/NewLevelManager.java +++ b/common/src/main/java/com/yunbao/common/manager/NewLevelManager.java @@ -16,6 +16,8 @@ import java.util.List; public class NewLevelManager extends BaseCacheManager { private final String KEY_USER_LEVEL = "keyUserLevel"; private final String KEY_ANCHOR_LEVEL = "keyAnchorLevel"; + private final String KEY_LIVE_LEVEL = "keyLiveLevel"; + private List newLevelModels = new ArrayList<>(); private List keyAnchorLevel = new ArrayList<>(); diff --git a/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java index b3f6cd9d6..02ea18b27 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java @@ -24,7 +24,9 @@ public class LiveOpenCustomPopup extends CenterPopupView { //房间类型 private LiveRoomTypeBean liveRoomTypeBean; - private TextView textClarity, textLiveRoomType, textLiveClass, textLiveWishlist, textRobot; + private TextView textClarity, textLiveRoomType, textLiveClass, textLiveWishlist, textRobot, textSay, textCall; + + private int status_say, status_call; public LiveOpenCustomPopup setClassBean(LiveClassBean classBean) { this.classBean = classBean; @@ -65,6 +67,8 @@ public class LiveOpenCustomPopup extends CenterPopupView { textLiveClass = findViewById(R.id.text_live_class); textLiveWishlist = findViewById(R.id.text_live_wishlist); textRobot = findViewById(R.id.text_robot); + textSay = findViewById(R.id.text_say); + textCall = findViewById(R.id.text_call); if (classBean != null) { textLiveClass.setText(classBean.getName()); } @@ -114,6 +118,24 @@ public class LiveOpenCustomPopup extends CenterPopupView { } } }); + //设置女神说 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_say), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (callBack != null) { + callBack.openAnchorSay(); + } + } + }); + //设置联系方式 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_call), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (callBack != null) { + callBack.openCallMe(); + } + } + }); } public void setSelectClarity(int selectClarity) { @@ -130,7 +152,27 @@ public class LiveOpenCustomPopup extends CenterPopupView { } } + public void setSayStatus(boolean isShow) { + textSay.setText(isShow ? R.string.do_set : R.string.not_set); + } + + public void setCallMeStatus(boolean isShow) { + textCall.setText(isShow ? R.string.robot_yes : R.string.robot_no); + } + + public LiveOpenCustomPopup setSayStatus(int status) { + this.status_say = status; + return this; + } + + public LiveOpenCustomPopup setCallMeStatus(int status) { + this.status_call = status; + return this; + } + public void initDate() { + textSay.setText(status_say == 1 ? R.string.do_set : R.string.not_set); + textCall.setText(status_call == 1 ? R.string.robot_yes : R.string.robot_no); LiveNetManager.get(getContext()) .getLiveStetUpStatus(String.valueOf(IMLoginManager.get(getContext()).getUserInfo().getId()), new HttpCallback() { @@ -142,7 +184,7 @@ public class LiveOpenCustomPopup extends CenterPopupView { @Override public void onError(String error) { - ToastUtil.show( R.string.net_error); + ToastUtil.show(R.string.net_error); } }); @@ -174,5 +216,11 @@ public class LiveOpenCustomPopup extends CenterPopupView { //打開心願單 void openWishlist(); + + //设置女神说 + void openAnchorSay(); + + //设置联系方式 + void openCallMe(); } } diff --git a/common/src/main/res/drawable/background_e6000.xml b/common/src/main/res/drawable/background_e6000.xml new file mode 100644 index 000000000..564f3e6fc --- /dev/null +++ b/common/src/main/res/drawable/background_e6000.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ 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 431285898..7a444507f 100644 --- a/common/src/main/res/layout/dialog_live_new_function.xml +++ b/common/src/main/res/layout/dialog_live_new_function.xml @@ -335,7 +335,48 @@ android:textColor="#FF9A9A9A" android:textSize="12sp" /> + + + + + + + + + + + diff --git a/common/src/main/res/layout/live_anchor_call_me_edit_title.xml b/common/src/main/res/layout/live_anchor_call_me_edit_title.xml new file mode 100644 index 000000000..964b43618 --- /dev/null +++ b/common/src/main/res/layout/live_anchor_call_me_edit_title.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + diff --git a/common/src/main/res/layout/view_live_open.xml b/common/src/main/res/layout/view_live_open.xml index d40b58280..54aba0a57 100644 --- a/common/src/main/res/layout/view_live_open.xml +++ b/common/src/main/res/layout/view_live_open.xml @@ -2,7 +2,7 @@ @@ -206,6 +206,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/res/layout/view_live_system_message.xml b/common/src/main/res/layout/view_live_system_message.xml index 968f41186..f2e2924b1 100644 --- a/common/src/main/res/layout/view_live_system_message.xml +++ b/common/src/main/res/layout/view_live_system_message.xml @@ -83,7 +83,7 @@ android:layout_gravity="end" android:layout_marginEnd="12dp" android:drawablePadding="4dp" - android:drawableEnd="@mipmap/icon_more" + android:drawableEnd="@mipmap/icon_more_live_menu" android:gravity="center_vertical" android:text="@string/click_to_view" android:textColor="#ff8c8c8c" diff --git a/common/src/main/res/mipmap-xxhdpi/ic_live_fun_anchor_letter.png b/common/src/main/res/mipmap-xxhdpi/ic_live_fun_anchor_letter.png new file mode 100644 index 000000000..7f4ecfb95 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/ic_live_fun_anchor_letter.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/ic_live_fun_anchor_say.png b/common/src/main/res/mipmap-xxhdpi/ic_live_fun_anchor_say.png new file mode 100644 index 000000000..fc7d99691 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/ic_live_fun_anchor_say.png differ diff --git a/common/src/main/res/values-en/strings.xml b/common/src/main/res/values-en/strings.xml index ba779e04e..52ad1db6d 100644 --- a/common/src/main/res/values-en/strings.xml +++ b/common/src/main/res/values-en/strings.xml @@ -735,7 +735,7 @@ Exit User - If you don\'t take the initiative,how can we have a story?\nTell the anchor say hi~ + If you don\'t take the initiative,how can we have a story?Tell the anchor say hi~ + follow Enter activity @@ -1089,4 +1089,5 @@ Limited ride And limited avatar frame Get a fan badge for giving gifts Whether to clear unread messages The application collects location data to support login and registration functions. + 女神說 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 7d686fd4a..6ab009269 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -734,6 +734,8 @@ 語音連麥 周星榜 暫時離開 + 聯繫方式 + 女神說 恢復直播 請輸入數字 您是當前主播的周守護\n守護日期截止到 @@ -780,7 +782,7 @@ 直接退出 用戶 - 你都不主動我們怎麼會有故事,\n跟主播Say Hi吧~ + 你都不主動我們怎麼會有故事,跟主播Say Hi吧~ + 關注 進入活動 @@ -1085,7 +1087,10 @@ 註冊PD LIVE 註冊並登錄 開通貴族,尊享超多特權! + 說點什麽吧... + %s 来了 + 女神說 diff --git a/config.gradle b/config.gradle index f1f6158a2..cb4fb0dff 100644 --- a/config.gradle +++ b/config.gradle @@ -4,7 +4,7 @@ ext { buildToolsVersion: "29.0.2", minSdkVersion : 21, targetSdkVersion : 31, - versionCode : 413, + versionCode : 414, versionName : "6.4.9" ] manifestPlaceholders = [ diff --git a/live/src/main/assets/chat_message_bg.png b/live/src/main/assets/chat_message_bg.png new file mode 100644 index 000000000..4138e7e12 Binary files /dev/null and b/live/src/main/assets/chat_message_bg.png differ diff --git a/live/src/main/assets/ic_live_anchor_call_me.svga b/live/src/main/assets/ic_live_anchor_call_me.svga new file mode 100644 index 000000000..ba388de6d Binary files /dev/null and b/live/src/main/assets/ic_live_anchor_call_me.svga differ diff --git a/live/src/main/assets/rectangle_new.png b/live/src/main/assets/rectangle_new.png new file mode 100644 index 000000000..4909ea802 Binary files /dev/null and b/live/src/main/assets/rectangle_new.png differ 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 cc565e6ec..533e60088 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -68,6 +68,7 @@ import com.yunbao.live.dialog.LiveNewGuardListDialogFragment; import com.yunbao.live.dialog.LiveRedPackListDialogFragment; import com.yunbao.live.dialog.LiveRedPackSendDialogFragment; import com.yunbao.live.dialog.LiveShareDialogFragment; +import com.yunbao.live.dialog.LiveUserAnchorMailBoxPopDialog; import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveUserMoreDialogFragment; import com.yunbao.live.http.LiveHttpConsts; @@ -108,7 +109,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL public String anyway; public ViewGroup mContainer; protected ViewGroup mPageContainer; - protected LiveRoomViewHolder mLiveRoomViewHolder; + public LiveRoomViewHolder mLiveRoomViewHolder; protected AbsLiveViewHolder mLiveBottomViewHolder; protected LiveAddImpressViewHolder mLiveAddImpressViewHolder; protected LiveContributeViewHolder mLiveContributeViewHolder; @@ -895,8 +896,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL * 打开私信列表窗口 */ public void openChatListWindow() { - Intent intent = new Intent(mContext, PDLIiveChatActivity.class); - mContext.startActivity(intent); + // Intent intent = new Intent(mContext, PDLIiveChatActivity.class); + // mContext.startActivity(intent); + new LiveUserAnchorMailBoxPopDialog(mContext).showDialog(); } @@ -1288,7 +1290,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL @Override public void onError(String error) { Log.e("LiveUserMoreDialog", error); - ToastUtil.show( R.string.net_error); + ToastUtil.show(R.string.net_error); } }); } else { 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 92e5187d1..788d257ce 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java @@ -483,6 +483,8 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic } mLiveRoomViewHolder.initHourRankList(); mLiveRoomViewHolder.startAnchorLight(); + //初始化女神说 + mLiveRoomViewHolder.initAnchorSay(); } if (mLiveAnchorViewHolder == null) { mLiveAnchorViewHolder = new LiveAnchorViewHolder(mContext, mContainer); 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 5ead5be28..1cd0b0652 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -1277,6 +1277,9 @@ public class LiveAudienceActivity extends LiveActivity { manager.endDRGif(); } break; + case LIVE_HIDE_MSG_RED: + showMsgRed(-1); + break; } @@ -1412,6 +1415,21 @@ public class LiveAudienceActivity extends LiveActivity { }); } + @SuppressLint("SetTextI18n") + public void showMsgRed(int num) { + if (manager == null) { + return; + } + if (num == -1) { + manager.mLiveAudienceViewHolder.mRedPoint.setVisibility(View.GONE); + return; + } else if (num > 0) { + manager.mLiveAudienceViewHolder.mRedPoint.setText(num + ""); + } + manager.mLiveAudienceViewHolder.mRedPoint.setVisibility(View.VISIBLE); + } + + public void closeRoom() { runOnUiThread(new Runnable() { @Override 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 ae017e117..3d17a4414 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -262,6 +262,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveReadyViewHolder = new LiveNewReadyRyViewHolder(mContext, mContainer, mLiveSDK); mLiveReadyViewHolder.setManager(manager); mLiveReadyViewHolder.addToParent(); + mLiveReadyViewHolder.setLiveUid(mLiveUid); mLiveReadyViewHolder.subscribeActivityLifeCycle(); mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer); mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer); @@ -779,7 +780,8 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveRoomViewHolder.initHourRankList(); } mLiveRoomViewHolder.startAnchorLight(); - + //初始化女神说 + mLiveRoomViewHolder.initAnchorSay(); } if (mLiveAnchorViewHolder == null) { mLiveAnchorViewHolder = new LiveRyAnchorViewHolder(mContext, mContainer); diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveAnchorEditCallMeAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveAnchorEditCallMeAdapter.java new file mode 100644 index 000000000..692b24e30 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/LiveAnchorEditCallMeAdapter.java @@ -0,0 +1,303 @@ +package com.yunbao.live.adapter; + +import android.app.Dialog; +import android.content.Context; +import android.graphics.Color; +import android.util.Log; +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.LiveAnchorCallMeModel; +import com.yunbao.common.bean.PrankGiftBean; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.StringUtil; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.R; +import com.yunbao.live.dialog.GiftPopDialog; +import com.yunbao.live.dialog.LiveAnchorEditCallMeEditAppDialog; + +import java.util.ArrayList; +import java.util.List; + +public class LiveAnchorEditCallMeAdapter extends RecyclerView.Adapter { + public static final int TYPE_GIFT = 0; + public static final int TYPE_LETTER = 1; + public static final int TYPE_APP_WECHAT = 2; + public static final int TYPE_APP_LINE = 3; + public static final int TYPE_APP_WHATSAPP = 4; + private Context mContext; + private OnItemClickListener onItemClickListener; + private List list = new ArrayList<>(); + + public LiveAnchorEditCallMeAdapter(Context mContext) { + this.mContext = mContext; + } + + public void setList(List list) { + this.list = list; + notifyDataSetChanged(); + } + + public void setOnItemClickListener(OnItemClickListener onItemClickListener) { + this.onItemClickListener = onItemClickListener; + } + + @Override + public int getItemViewType(int position) { + return list.get(position).getType(); + } + + @NonNull + @Override + public BaseViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + BaseViewHolder holder; + switch (viewType) { + case TYPE_GIFT: + holder = new GiftViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_anchor_call_me_gift, parent, false)); + break; + case TYPE_LETTER: + holder = new LetterViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_anchor_call_me_letter, parent, false)); + break; + default: + holder = new AppViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_anchor_call_me_app, parent, false)); + } + return holder; + } + + @Override + public void onBindViewHolder(@NonNull BaseViewHolder holder, int position) { + holder.setData(list.get(position), position); + } + + @Override + public int getItemCount() { + return list.size(); + } + + + public static class TmpData { + private String value; + private int status; + private int type; + + public TmpData() { + } + + public TmpData(String value, int status, int type) { + this.value = value; + this.status = status; + this.type = type; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + } + + public class BaseViewHolder extends RecyclerView.ViewHolder { + + public BaseViewHolder(@NonNull View itemView) { + super(itemView); + } + + public void setData(TmpData data, int position) { + + } + } + + public class GiftViewHolder extends BaseViewHolder { + + private View select; + private ImageView giftIcon; + + public GiftViewHolder(@NonNull View itemView) { + super(itemView); + select = itemView.findViewById(R.id.select); + giftIcon = itemView.findViewById(R.id.gift_icon); + select.setOnClickListener(v -> { + initGiftData(); + }); + } + + @Override + public void setData(TmpData data, int position) { + super.setData(data, position); + if (!StringUtil.isEmpty(data.getValue())) { + ImgLoader.display(mContext, data.getValue(), giftIcon); + } + } + + + private void initGiftData() { + new GiftPopDialog(mContext, new GiftPopDialog.ActionListener() { + + @Override + public void onSelectGift(PrankGiftBean bean) { + if (bean != null) { + ImgLoader.display(mContext, bean.getIcon(), giftIcon); + if (onItemClickListener != null) { + onItemClickListener.onItemClick(new TmpData(bean.getGiftId() + "", 1, TYPE_GIFT), getAbsoluteAdapterPosition()); + } + } + } + + @Override + public void onDismiss() { + } + }) + .setShowNumber(false) + .setTitle(WordUtil.getString(R.string.live_anchor_edit_call_me_select_gift)) + .showDialog() + ; + } + } + + + public class LetterViewHolder extends BaseViewHolder { + TextView letter; + View edit; + + public LetterViewHolder(@NonNull View itemView) { + super(itemView); + letter = itemView.findViewById(R.id.letterText); + edit = itemView.findViewById(R.id.edit); + edit.setOnClickListener(v -> { + new LiveAnchorEditCallMeEditAppDialog(mContext, TYPE_LETTER).setDefValue(list.get(1).getValue()).setOnValueListener(new OnItemClickListener() { + @Override + public void onItemClick(String bean, int position) { + if (StringUtil.isEmpty(bean)) { + letter.setText(WordUtil.getString(R.string.live_anchor_edit_call_me_not_filled)); + letter.setTextColor(Color.parseColor("#80FFFFFF")); + } else { + letter.setText(bean); + letter.setTextColor(Color.WHITE); + } + if (onItemClickListener != null) { + onItemClickListener.onItemClick(new TmpData(letter.getText().toString(), 1, TYPE_LETTER), getAbsoluteAdapterPosition()); + } + } + }).showDialog(); + }); + } + + @Override + public void setData(TmpData data, int position) { + super.setData(data, position); + letter.setText(data.getValue()); + } + } + + public class AppViewHolder extends BaseViewHolder { + TextView contact; + View edit; + ImageView status; + ImageView icon; + + public AppViewHolder(@NonNull View itemView) { + super(itemView); + contact = itemView.findViewById(R.id.contact); + edit = itemView.findViewById(R.id.app_edit); + status = itemView.findViewById(R.id.app_switch); + icon = itemView.findViewById(R.id.gift_icon); + } + + @Override + public void setData(TmpData data, int position) { + super.setData(data, position); + if (StringUtil.isEmpty(data.getValue())) { + contact.setTag(null); + contact.setText(WordUtil.getString(R.string.live_anchor_edit_call_me_not_filled)); + contact.setTextColor(Color.parseColor("#80FFFFFF")); + } else { + contact.setTag(data.getValue()); + contact.setText(data.getValue()); + contact.setTextColor(Color.WHITE); + } + if (data.getStatus() == 0) { + status.setImageResource(R.mipmap.special_icon_off); + } else if (data.getStatus() == 1) { + status.setImageResource(R.mipmap.special_icon_on); + } + status.setTag(data.getStatus()); + status.setOnClickListener(v -> { + if (StringUtil.isEmpty((String) contact.getTag())) { + ToastUtil.show(WordUtil.getString(R.string.live_anchor_edit_call_me_not_filled_toash)); + return; + } + int tag = (int) v.getTag(); + if (tag == 0) { + status.setImageResource(R.mipmap.special_icon_on); + status.setTag(1); + } else { + status.setImageResource(R.mipmap.special_icon_off); + status.setTag(0); + } + if (onItemClickListener != null) { + onItemClickListener.onItemClick(new TmpData((String) contact.getTag(), (Integer) status.getTag(), data.getType()), position); + } + }); + edit.setOnClickListener(v -> { + new LiveAnchorEditCallMeEditAppDialog(mContext, data.getType()).setDefValue((String) contact.getTag()).setOnValueListener(new OnItemClickListener() { + @Override + public void onItemClick(String bean, int position) { + if (StringUtil.isEmpty(bean)) { + contact.setTag(null); + contact.setText(WordUtil.getString(R.string.live_anchor_edit_call_me_not_filled)); + contact.setTextColor(Color.parseColor("#80FFFFFF")); + } else { + contact.setTag(bean); + contact.setText(bean); + contact.setTextColor(Color.WHITE); + } + if (onItemClickListener != null) { + onItemClickListener.onItemClick(new TmpData((String) contact.getTag(), (Integer) status.getTag(), data.getType()), position); + } + } + }).showDialog(); + }); + switch (data.getType()) { + case TYPE_APP_WECHAT: + icon.setImageResource(R.mipmap.icon_wechat_x); + break; + case TYPE_APP_LINE: + icon.setImageResource(R.mipmap.icon_line_x); + break; + case TYPE_APP_WHATSAPP: + icon.setImageResource(R.mipmap.icon_whatsapp_x); + break; + } + } + + } +} diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveAnchorSayItemsAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveAnchorSayItemsAdapter.java new file mode 100644 index 000000000..a0a6d8998 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/LiveAnchorSayItemsAdapter.java @@ -0,0 +1,88 @@ +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.glide.ImgLoader; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.live.R; + +import java.util.ArrayList; +import java.util.List; + +public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter { + private Context mContext; + private List list; + private int click = -1; + private OnItemClickListener onItemClickListener; + + public LiveAnchorSayItemsAdapter(Context mContext) { + this.mContext = mContext; + list = new ArrayList<>(); + } + + public void setList(List list) { + this.list = list; + notifyDataSetChanged(); + } + + public void setOnItemClickListener(OnItemClickListener onItemClickListener) { + this.onItemClickListener = onItemClickListener; + } + + @NonNull + @Override + public ItemsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new ItemsViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_anchor_say, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull ItemsViewHolder holder, int position) { + holder.setData(list.get(position), position); + } + + @Override + public int getItemCount() { + return list.size(); + } + + public class ItemsViewHolder extends RecyclerView.ViewHolder { + private TextView textView; + private ImageView icon; + + public ItemsViewHolder(@NonNull View itemView) { + super(itemView); + textView = itemView.findViewById(R.id.anchor_say_text); + icon = itemView.findViewById(R.id.anchor_say_icon); + itemView.setOnClickListener(v -> click()); + textView.setOnClickListener(v -> click()); + icon.setOnClickListener(v -> click()); + + } + + private void click() { + click = getAbsoluteAdapterPosition(); + if (onItemClickListener != null) { + onItemClickListener.onItemClick(list.get(click), click); + } + notifyDataSetChanged(); + } + + public void setData(String text, int position) { + textView.setText("已输入的\n内容已输\n入的内容\n入的内容"); + ImgLoader.display(mContext, text, icon); + if (position == click) { + itemView.setBackgroundResource(R.drawable.bg_anchor_say_select); + } else { + itemView.setBackgroundResource(R.drawable.bg_anchor_say); + } + } + } +} 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 6e5cb5312..2182a1364 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -14,11 +14,13 @@ import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.style.ForegroundColorSpan; import android.util.Log; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; +import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; @@ -37,6 +39,7 @@ import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.views.weight.ClipPathCircleImage; import com.yunbao.live.R; import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.bean.LiveChatBean; @@ -176,12 +179,16 @@ public class LiveChatAdapter extends RecyclerView.Adapter { RoundedImageView avatar; View v_chat_active_close; RecyclerView rv_chat_active; - ImageView img_zg_img; + ImageView img_zg_img, btnAttention; + FrameLayout attentionLayout; + ClipPathCircleImage clipImage2; public Vh(View itemView) { super(itemView); mBg = (LinearLayout) itemView.findViewById(R.id.bg); mTextView = (TextView) itemView.findViewById(R.id.text_txt); + attentionLayout = (FrameLayout) itemView.findViewById(R.id.attention_layout); + clipImage2 = (ClipPathCircleImage) itemView.findViewById(R.id.clip_image2); itemView.setOnClickListener(mOnClickListener); view_follow = (LinearLayout) itemView.findViewById(R.id.view_follow); @@ -196,19 +203,21 @@ public class LiveChatAdapter extends RecyclerView.Adapter { view_zg = (LinearLayout) itemView.findViewById(R.id.view_zg); tv_zg_anchorname = (TextView) itemView.findViewById(R.id.tv_zg_anchorname); img_zg_img = (ImageView) itemView.findViewById(R.id.img_zg_img); + btnAttention = (ImageView) itemView.findViewById(R.id.btn_attention); } void setData(final LiveChatBean bean, int position) { itemView.setTag(bean); - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); - params.setMargins(0, 0, DpUtil.dp2px(95), 12); + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + params.setMargins(0, 0, DpUtil.dp2px(110), 0); + params.gravity = Gravity.CENTER_VERTICAL; mBg.setLayoutParams(params); if (bean.getType() == 6) {//大作战活动 view_action_game.setVisibility(View.VISIBLE); bean.setHeart(position); - params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.setMargins(0, 0, 80, 12); mBg.setLayoutParams(params); @@ -238,9 +247,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } else if (bean.getType() == -3 || bean.getType() == -4 || bean.getType() == -5) {//整蛊 if (bean.getBubble() != null && !bean.getBubble().equals("")) { //加载.9图聊天气泡 - LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1); + new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1); } else { - mBg.setBackgroundResource(R.drawable.bg_live_chat_item); +// mBg.setBackgroundResource(R.drawable.bg_live_chat_item); + new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); } SpannableStringBuilder builder = new SpannableStringBuilder(); if (bean.getType() == -3) { @@ -278,9 +288,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } else if (bean.getType() == -6) { if (bean.getBubble() != null && !bean.getBubble().equals("")) { //加载.9图聊天气泡 - LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1); + new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1); } else { - mBg.setBackgroundResource(R.drawable.bg_live_chat_item); +// mBg.setBackgroundResource(R.drawable.bg_live_chat_item); + new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); } String str1 = "火力四射,魅力無限!感謝"; String str2 = "為本直播間加成熱度"; @@ -297,9 +308,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } else if (bean.getType() == -7) { if (bean.getBubble() != null && !bean.getBubble().equals("")) { //加载.9图聊天气泡 - LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1); + new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1); } else { - mBg.setBackgroundResource(R.drawable.bg_live_chat_item); +// mBg.setBackgroundResource(R.drawable.bg_live_chat_item); + new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); } String str1 = "甜蜜不停,愛意不斷!恭喜"; String str2 = "在甜蜜約會中搶購到了"; @@ -326,73 +338,88 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } if (isContains) { mTextView.setTextColor(0xffffffff); - mBg.setBackground(null); + new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); mTextView.setText(bean.getContent()); } } else if (bean.getType() == LiveChatBean.SYSTEM2) { mTextView.setTextColor(0xffffffff); mBg.setBackground(null); mTextView.setText(bean.getContent()); - } else if (bean.getType() == -1) {//自动消息,关注 - boolean isContains = false; - for (LiveChatBean model : mList) { - if (bean.getType() == -1) { - isContains = true; - } - } - if (isContains) { - mBg.setBackground(null); - mTextView.setVisibility(View.GONE); - view_follow.setVisibility(View.VISIBLE); - ImgLoader.display(mContext, bean.getId(), avatar); - bean.setHeart(position); - } - - } else if (bean.getType() == -2) {//自动消息,点击发言 - - mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item); - mTextView.setText(R.string.automatic_chat); + } +// else if (bean.getType() == -1) {//自动消息,关注 +// boolean isContains = false; +// for (LiveChatBean model : mList) { +// if (bean.getType() == -1) { +// isContains = true; +// } +// } +// if (isContains) { +// mBg.setBackground(null); +// mTextView.setVisibility(View.GONE); +// view_follow.setVisibility(View.VISIBLE); +// ImgLoader.display(mContext, bean.getId(), avatar); +// bean.setHeart(position); +// } +// +// } + else if (bean.getType() == -2) {//自动消息,点击发言 + LinearLayout.LayoutParams params3 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + params3.setMargins(0, 8, DpUtil.dp2px(110), 8); + params3.gravity = Gravity.CENTER_VERTICAL; + mBg.setLayoutParams(params3); + mBg.setBackground(null); + mTextView.setVisibility(View.GONE); bean.setHeart(position); + ImgLoader.display(mContext, bean.getId(), clipImage2); + attentionLayout.setVisibility(View.VISIBLE); + btnAttention.setVisibility(bean.isAttention() ? View.GONE : View.VISIBLE); +// btnAttention.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// LiveRoomViewHolder.follow(); +// btnAttention.setVisibility(View.GONE); +// } +// }); } else if (bean.getType() == MSG_HOUR_RANK_CHANGE) { mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item); mTextView.setText(bean.getContent()); bean.setHeart(position); } else if (bean.getType() == RECOMMEND_CARD_NOTIFY) { //加载.9图聊天气泡 - LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1); + new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1); new LiveTextRender().recommendCardNotify(mContext, mTextView, bean); } else if (bean.getType() == AI_AUTOMATIC_SPEECH) { //加载.9图聊天气泡 - LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getAiAutomaticSpeechModel().getSystemBubble(), 1); + new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getAiAutomaticSpeechModel().getSystemBubble(), 1); new LiveTextRender().aiAutomaticSpeech(mContext, mTextView, bean.getAiAutomaticSpeechModel()); } else if (bean.getType() == STAR_CHALLENGE_UPGRADE_NOTIFY) { //加载.9图聊天气泡 if (!TextUtils.isEmpty(bean.getMsgModel().getSystemBubble())) { - LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystemBubble(), 1); + new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystemBubble(), 1); new LiveTextRender().starChallengeUpgradeNotify(mContext, mTextView, bean.getMsgModel()); } } else if (bean.getType() == LUCKY_ANGEL) { if (!TextUtils.isEmpty(bean.getMsgModel().getSystem_bubble())) { bean.setId(bean.getMsgModel().getUserId()); itemView.setTag(bean); - LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystem_bubble(), 1); + new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystem_bubble(), 1); new LiveTextRender().luckyAngel(mContext, mTextView, bean.getMsgModel()); } - }else if(bean.getType() == LUCKY_100_CHECK){ + } else if (bean.getType() == LUCKY_100_CHECK) { if (!TextUtils.isEmpty(bean.getMsgModel().getSystem_bubble())) { bean.setId(bean.getMsgModel().getUserId()); itemView.setTag(bean); - LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystem_bubble(), 1); + new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystem_bubble(), 1); new LiveTextRender().lucky100(mContext, mTextView, bean.getMsgModel()); } - } - else { + } else { if (bean.getBubble() != null && !bean.getBubble().equals("")) { //加载.9图聊天气泡 - LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1); + new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1); } else { - mBg.setBackgroundResource(R.drawable.bg_live_chat_item); +// mBg.setBackgroundResource(R.drawable.bg_live_chat_item); + new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); } if (bean.getType() == LiveChatBean.ENTER_ROOM || bean.getType() == LiveChatBean.LIGHT) { mTextView.setTextColor(0xffc8c8c8); @@ -402,7 +429,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { new LiveTextRender().render(mContext, mTextView, bean); } - Animation animation = AnimationUtils.loadAnimation(itemView.getContext(),R.anim.live_chat_msg_in); + Animation animation = AnimationUtils.loadAnimation(itemView.getContext(), R.anim.live_chat_msg_in); itemView.startAnimation(animation); } } diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java index 9f269946f..29b6c00d2 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java @@ -89,7 +89,7 @@ public class LiveUserAdapter extends RecyclerView.Adapter { @Override public int getItemCount() { - return Math.min(mList.size(), 5); + return Math.min(mList.size(), 3); } class Vh extends RecyclerView.ViewHolder { diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java new file mode 100644 index 000000000..9503f63fb --- /dev/null +++ b/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java @@ -0,0 +1,136 @@ +package com.yunbao.live.adapter; + +import android.app.Dialog; +import android.content.Context; +import android.os.Build; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.LiveUserMailBoxModel; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.R; +import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog; + +import java.util.ArrayList; +import java.util.List; + +public class LiveUserAnchorMailBoxAdapter extends RecyclerView.Adapter { + private Context mContext; + private List list; + OnItemClickListener onItemClickListener; + + public LiveUserAnchorMailBoxAdapter(Context mContext) { + this.mContext = mContext; + list = new ArrayList<>(); + } + + public void setList(List list) { + this.list = list; + notifyDataSetChanged(); + } + + public List getList() { + return list; + } + + public void setOnItemClickListener(OnItemClickListener onItemClickListener) { + this.onItemClickListener = onItemClickListener; + } + + @NonNull + @Override + public MailBoxViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new MailBoxViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_live_user_mailbox, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull MailBoxViewHolder holder, int position) { + holder.setData(list.get(position), position); + } + + @Override + public int getItemCount() { + return list.size(); + } + + public class MailBoxViewHolder extends RecyclerView.ViewHolder { + TextView topText; + TextView userName; + TextView tipText; + View del; + + public MailBoxViewHolder(@NonNull View itemView) { + super(itemView); + topText = itemView.findViewById(R.id.top_text); + userName = itemView.findViewById(R.id.user_name); + tipText = itemView.findViewById(R.id.tip); + del = itemView.findViewById(R.id.del); + } + + void setData(LiveUserMailBoxModel box, int position) { + userName.setText(box.getUserName()); + topText.setText(String.format(WordUtil.getString(R.string.live_user_mailbox_top_text), box.getAnchorName())); + tipText.setText(String.format(WordUtil.getString(R.string.live_user_mailbox_tip_text), box.getAnchorName())); + del.setOnClickListener(v -> { + new DialogUitl.Builder(mContext) + .setTitle(WordUtil.getString(R.string.live_user_letter_dialog_title)) + .setContent(WordUtil.getString(R.string.live_user_letter_dialog_content)) + .setConfrimString(WordUtil.getString(R.string.live_user_letter_dialog_yes)) + .setCancelString(WordUtil.getString(R.string.live_user_letter_dialog_no)) + .setView(R.layout.dialog_live_random_pk) + .setCancelable(true) + .setClickCallback((dialog, content) -> LiveNetManager.get(mContext).delContactInfo(box.getId(), new HttpCallback() { + @Override + public void onSuccess(String data) { + Log.i("刪除信件", "onSuccess:刪除成功 "); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + list.removeIf(it -> it.getId() == box.getId()); + } + System.err.println("-----> list size = " + list.size()); + notifyDataSetChanged(); + if (onItemClickListener != null) { + onItemClickListener.onItemClick(box, position); + } + } + + @Override + public void onError(String error) { + Log.i("刪除信件", "onError: " + error); + } + })) + .build().show(); + + }); + + itemView.setOnClickListener(new OnClick(box)); + userName.setOnClickListener(new OnClick(box)); + topText.setOnClickListener(new OnClick(box)); + tipText.setOnClickListener(new OnClick(box)); + } + + private class OnClick implements View.OnClickListener { + LiveUserMailBoxModel box; + + public OnClick(LiveUserMailBoxModel box) { + this.box = box; + } + + @Override + public void onClick(View v) { + new LiveUserAnchorMailBoxWebInfoPopDialog(mContext, box.getAnchorName(), box.getUrl()).showDialog(); + } + } + } +} 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 8d876699b..599d74661 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java @@ -83,6 +83,17 @@ public class LiveChatBean { //@ID @SerializedName("atUserID") private String atUserID = ""; + //用户是否关注主播 + private boolean isAttention = false; + + public boolean isAttention() { + return isAttention; + } + + public LiveChatBean setAttention(boolean attention) { + isAttention = attention; + return this; + } public String getAtUserName() { return atUserName; 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 0fcae4596..662e3dcda 100644 --- a/live/src/main/java/com/yunbao/live/dialog/GiftPopDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/GiftPopDialog.java @@ -17,8 +17,10 @@ import android.widget.TextView; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.lxj.xpopup.XPopup; import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.PrankGiftBean; +import com.yunbao.common.dialog.AbsDialogPopupWindow; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.StringUtil; @@ -34,15 +36,14 @@ import com.yunbao.live.http.LiveHttpUtil; import java.util.ArrayList; import java.util.List; +import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager.widget.ViewPager; -public class GiftPopDialog extends PopupWindow implements ActionListener, View.OnClickListener { +public class GiftPopDialog extends AbsDialogPopupWindow implements ActionListener, View.OnClickListener { - private View mParent; private Context mContext; - private View mContentView; private LiveGiftPagerAdapter mLiveGiftPagerAdapter; private GiftPopDialog.ActionListener mActionListener; private View mLoading; @@ -60,16 +61,27 @@ public class GiftPopDialog extends PopupWindow implements ActionListener, View.O private int prangNum; private InputMethodManager imm; private List giftBeans; + private boolean showNumber = true; + private View numberView; + private String title; + private TextView mTitle; - private void initView(View mRootView) { - mLoading = mRootView.findViewById(R.id.loading); - items = (RecyclerView) mRootView.findViewById(R.id.items); - mViewPager = (ViewPager) mRootView.findViewById(R.id.viewPager); - mRadioGroup = (RadioGroup) mRootView.findViewById(R.id.radio_group); - mBtnSend = mRootView.findViewById(R.id.btn_send); - mBtnContext = mRootView.findViewById(R.id.btn_context); - mBtn = mRootView.findViewById(R.id.gift_btn); - mBack = mRootView.findViewById(R.id.gift_back); + + public GiftPopDialog(@NonNull Context context) { + super(context); + } + + private void initView() { + mLoading = findViewById(R.id.loading); + items = (RecyclerView) findViewById(R.id.items); + mViewPager = (ViewPager) findViewById(R.id.viewPager); + mRadioGroup = (RadioGroup) findViewById(R.id.radio_group); + mBtnSend = findViewById(R.id.btn_send); + mBtnContext = findViewById(R.id.btn_context); + mBtn = findViewById(R.id.gift_btn); + mBack = findViewById(R.id.gift_back); + mTitle = findViewById(R.id.title); + numberView = findViewById(R.id.btn_send_group); final LinearLayoutManager manager = new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false); items.setLayoutManager(manager); mViewPager.setOffscreenPageLimit(5); @@ -112,52 +124,41 @@ public class GiftPopDialog extends PopupWindow implements ActionListener, View.O } }); + if (!showNumber) { + numberView.setVisibility(View.GONE); + prangNum = 1; + prangContext = "null"; + } + if (!StringUtil.isEmpty(title)) { + mTitle.setText(title); + } } - public GiftPopDialog(Context mContext, View parent, GiftPopDialog.ActionListener actionListener) { + public GiftPopDialog(Context mContext, GiftPopDialog.ActionListener actionListener) { + super(mContext); this.mContext = mContext; - mParent = parent; mActionListener = actionListener; - mContentView = LayoutInflater.from(mContext).inflate(R.layout.dialog_live_select_gift_wrap, null); - ViewParent viewParent = mContentView.getParent(); - if (viewParent != null) { - ((ViewGroup) viewParent).removeView(mContentView); - } - setContentView(mContentView); - setWidth(ViewGroup.LayoutParams.MATCH_PARENT); - setHeight(ViewGroup.LayoutParams.MATCH_PARENT); - setBackgroundDrawable(new ColorDrawable()); - setOutsideTouchable(true); - setFocusable(true); - setAnimationStyle(R.style.leftToRightAnim); - setOnDismissListener(new OnDismissListener() { - @Override - public void onDismiss() { - if (mActionListener != null) { - if (bean == null || StringUtil.isEmpty(prangContext) || prangNum == 0) { - mActionListener.onDismiss(); - return; - } - PrankGiftBean giftBean = new PrankGiftBean(); - giftBean.setGiftId(bean.getId() + ""); - giftBean.setNum(prangNum); - giftBean.setIcon(bean.getIcon()); - giftBean.setTitle(prangContext); - giftBean.setName(bean.getName()); - mActionListener.onSelectGift(giftBean); - System.out.println("gift.bean = " + bean); - } - ViewParent viewParent = mContentView.getParent(); - if (viewParent != null) { - ((ViewGroup) viewParent).removeView(mContentView); - } - mContentView = null; - } - }); - initView(mContentView); + // setAnimationStyle(R.style.leftToRightAnim); + + } + + @Override + protected void onCreate() { + super.onCreate(); + initView(); initDate(); } + public GiftPopDialog setShowNumber(boolean showNumber) { + this.showNumber = showNumber; + return this; + } + + public GiftPopDialog setTitle(String title) { + this.title = title; + return this; + } + private void initDate() { LiveHttpUtil.getNewGiftList(new HttpCallback() { @Override @@ -214,10 +215,6 @@ public class GiftPopDialog extends PopupWindow implements ActionListener, View.O } } - public void show() { - showAtLocation(mParent, Gravity.CENTER, 0, 0); - } - @Override public void onItemChecked(LiveGiftBean bean) { @@ -233,11 +230,11 @@ public class GiftPopDialog extends PopupWindow implements ActionListener, View.O public void onConfirmClick(Dialog dialog, String content) { try { prangNum = Integer.parseInt(content); - if (prangNum <= 0 ) { + if (prangNum <= 0) { ToastUtil.show("數量不能為0或負數"); return; } - if(prangNum>999){ + if (prangNum > 999) { ToastUtil.show("數量不能大於999"); return; } @@ -298,6 +295,14 @@ public class GiftPopDialog extends PopupWindow implements ActionListener, View.O } } dismiss(); + + PrankGiftBean giftBean = new PrankGiftBean(); + giftBean.setGiftId(bean.getId() + ""); + giftBean.setNum(prangNum); + giftBean.setIcon(bean.getIcon()); + giftBean.setTitle(prangContext); + giftBean.setName(bean.getName()); + mActionListener.onSelectGift(giftBean); } else if (id == R.id.gift_back) { dismiss(); } @@ -307,6 +312,16 @@ public class GiftPopDialog extends PopupWindow implements ActionListener, View.O this.giftBeans = giftBeans; } + @Override + public void buildDialog(XPopup.Builder builder) { + builder.enableDrag(false); + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_live_select_gift_wrap; + } + public interface ActionListener { void onSelectGift(PrankGiftBean bean); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveAnchorEditCallMeDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorEditCallMeDialog.java new file mode 100644 index 000000000..c78ad3c1e --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorEditCallMeDialog.java @@ -0,0 +1,164 @@ +package com.yunbao.live.dialog; + +import android.content.Context; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.bean.LiveAnchorCallMeModel; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.R; +import com.yunbao.live.adapter.LiveAnchorEditCallMeAdapter; + +import java.util.ArrayList; +import java.util.List; + +public class LiveAnchorEditCallMeDialog extends AbsDialogPopupWindow { + String mLiveUid = ""; + RecyclerView list; + LiveAnchorCallMeModel callMeModel; + LiveAnchorEditCallMeAdapter adapter; + ImageView status; + OnItemClickListener onItemClickListener; + + public LiveAnchorEditCallMeDialog(@NonNull Context context) { + super(context); + } + + @Override + public void buildDialog(XPopup.Builder builder) { + builder.enableDrag(false); + builder.autoFocusEditText(false); + } + + public LiveAnchorEditCallMeDialog setOnItemClickListener(OnItemClickListener onItemClickListener) { + this.onItemClickListener = onItemClickListener; + return this; + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_anchor_call_me; + } + + @Override + protected void onCreate() { + super.onCreate(); + initView(); + initData(); + } + + private void initData() { + LiveNetManager.get(getContext()) + .getContactInfo(mLiveUid, new HttpCallback() { + @Override + public void onSuccess(LiveAnchorCallMeModel data) { + setData(data); + } + + @Override + public void onError(String error) { + setData(new LiveAnchorCallMeModel()); + } + + void setData(LiveAnchorCallMeModel data) { + callMeModel = data; + List list = new ArrayList<>(); + list.add(new LiveAnchorEditCallMeAdapter.TmpData(data.getGiftImage(), 1, LiveAnchorEditCallMeAdapter.TYPE_GIFT)); + list.add(new LiveAnchorEditCallMeAdapter.TmpData(data.getContent(), 1, LiveAnchorEditCallMeAdapter.TYPE_LETTER)); + list.add(new LiveAnchorEditCallMeAdapter.TmpData(data.getWechat().getNumber(), data.getWechat().getIsShow(), LiveAnchorEditCallMeAdapter.TYPE_APP_WECHAT)); + list.add(new LiveAnchorEditCallMeAdapter.TmpData(data.getLine().getNumber(), data.getLine().getIsShow(), LiveAnchorEditCallMeAdapter.TYPE_APP_LINE)); + list.add(new LiveAnchorEditCallMeAdapter.TmpData(data.getWhatsApp().getNumber(), data.getWhatsApp().getIsShow(), LiveAnchorEditCallMeAdapter.TYPE_APP_WHATSAPP)); + adapter.setList(list); + if (callMeModel.getIsShow() == 1) { + status.setImageResource(R.mipmap.special_icon_on); + status.setTag(1); + } + } + }); + + } + + private void initView() { + list = findViewById(R.id.anchor_call_list); + status = findViewById(R.id.say_switch); + findViewById(R.id.btn_close).setOnClickListener(v -> dismiss()); + adapter = new LiveAnchorEditCallMeAdapter(getContext()); + adapter.setOnItemClickListener(new OnItemClickListener() { + @Override + public void onItemClick(LiveAnchorEditCallMeAdapter.TmpData bean, int position) { + if (callMeModel == null) { + callMeModel = new LiveAnchorCallMeModel(); + } + if (position == 0) { + callMeModel.setGiftId(Integer.parseInt(bean.getValue())); + } else if (position == 1) { + callMeModel.setContent(bean.getValue()); + } else if (bean.getType() == LiveAnchorEditCallMeAdapter.TYPE_APP_WECHAT) { + callMeModel.setWechat(new LiveAnchorCallMeModel.AppBean(bean.getValue(), bean.getStatus())); + } else if (bean.getType() == LiveAnchorEditCallMeAdapter.TYPE_APP_LINE) { + callMeModel.setLine(new LiveAnchorCallMeModel.AppBean(bean.getValue(), bean.getStatus())); + } else if (bean.getType() == LiveAnchorEditCallMeAdapter.TYPE_APP_WHATSAPP) { + callMeModel.setWhatsApp(new LiveAnchorCallMeModel.AppBean(bean.getValue(), bean.getStatus())); + } + } + }); + status.setTag(0); + status.setOnClickListener(v -> { + if(callMeModel.getGiftId()==0){ + ToastUtil.show(R.string.live_anchor_edit_call_me_not_gift_toash); + return; + } + int tag = (int) v.getTag(); + if (tag == 0) { + status.setImageResource(R.mipmap.special_icon_on); + status.setTag(1); + } else { + status.setImageResource(R.mipmap.special_icon_off); + status.setTag(0); + } + callMeModel.setIsShow((Integer) status.getTag()); + }); + list.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); + list.setAdapter(adapter); + + } + + @Override + protected void onDismiss() { + super.onDismiss(); + if (callMeModel == null) { + return; + } + LiveNetManager.get(getContext()) + .setAnchorCallMe(mLiveUid, callMeModel, new HttpCallback() { + @Override + public void onSuccess(String data) { + ToastUtil.show(WordUtil.isZh() ? "成功" : "success"); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + IMLoginManager.get(getContext()).setAnchorCallMeStatus(callMeModel.getIsShow()); + if (onItemClickListener != null) { + onItemClickListener.onItemClick(callMeModel, 0); + } + } + + public LiveAnchorEditCallMeDialog setLiveUid(String liveUid) { + this.mLiveUid = liveUid; + return this; + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveAnchorEditCallMeEditAppDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorEditCallMeEditAppDialog.java new file mode 100644 index 000000000..bba88abff --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorEditCallMeEditAppDialog.java @@ -0,0 +1,115 @@ +package com.yunbao.live.dialog; + +import static com.yunbao.live.adapter.LiveAnchorEditCallMeAdapter.TYPE_APP_LINE; +import static com.yunbao.live.adapter.LiveAnchorEditCallMeAdapter.TYPE_APP_WECHAT; +import static com.yunbao.live.adapter.LiveAnchorEditCallMeAdapter.TYPE_APP_WHATSAPP; +import static com.yunbao.live.adapter.LiveAnchorEditCallMeAdapter.TYPE_LETTER; + +import android.content.Context; +import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.utils.StringUtil; +import com.yunbao.live.R; + +public class LiveAnchorEditCallMeEditAppDialog extends AbsDialogPopupWindow { + OnItemClickListener clickListener; + private int type; + private String defValue; + + private TextView titleView; + private TextView title; + private EditText edit; + + public LiveAnchorEditCallMeEditAppDialog(@NonNull Context context) { + super(context); + this.type = TYPE_LETTER; + } + + public LiveAnchorEditCallMeEditAppDialog(@NonNull Context context, int type) { + super(context); + this.type = type; + } + + @Override + public void buildDialog(XPopup.Builder builder) { + builder.autoFocusEditText(false); + builder.moveUpToKeyboard(false); + builder.enableDrag(false); + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_anchor_call_edit_app; + } + + public LiveAnchorEditCallMeEditAppDialog setDefValue(String defValue) { + this.defValue = defValue; + return this; + } + + public LiveAnchorEditCallMeEditAppDialog setOnValueListener(OnItemClickListener clickListener) { + this.clickListener = clickListener; + return this; + } + + @Override + protected void onDismiss() { + super.onDismiss(); + ((InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); + } + + + @Override + protected void onCreate() { + super.onCreate(); + initView(); + initData(); + + switch (type) { + case TYPE_LETTER: + titleView.setText("填寫信內容"); + edit.setHint("我能想到最浪漫的事,就是和你一起慢慢變老,一路上收藏點點滴滴的歡笑,留到以後坐著搖椅慢慢聊。"); + title.setText("信內容"); + break; + case TYPE_APP_WECHAT: + titleView.setText("填寫聯系方式"); + edit.setHint("请输入"); + title.setText("Wechat账号"); + break; + case TYPE_APP_LINE: + titleView.setText("填寫聯系方式"); + edit.setHint("请输入"); + title.setText("Line账号"); + break; + case TYPE_APP_WHATSAPP: + titleView.setText("填寫聯系方式"); + edit.setHint("请输入"); + title.setText("WhatsApp账号"); + break; + } + } + + private void initData() { + if (!StringUtil.isEmpty(defValue)) { + edit.setText(defValue); + } + } + + void initView() { + titleView = findViewById(R.id.titleView); + title = findViewById(R.id.title); + edit = findViewById(R.id.edit); + findViewById(R.id.btn_back).setOnClickListener(v -> dismiss()); + findViewById(R.id.submit).setOnClickListener(v -> { + clickListener.onItemClick(edit.getText().toString(), type); + dismiss(); + }); + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java new file mode 100644 index 000000000..67006691c --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java @@ -0,0 +1,207 @@ +package com.yunbao.live.dialog; + +import android.content.Context; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.KeyEvent; +import android.view.View; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.bean.HttpCallbackModel; +import com.yunbao.common.bean.LiveAnchorSayModel; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.R; +import com.yunbao.live.adapter.LiveAnchorSayItemsAdapter; + +import java.util.ArrayList; +import java.util.List; + +public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow { + RecyclerView list; + View anchorDemo; + LiveAnchorSayItemsAdapter adapter; + ImageView saySwitch; + ImageView close; + ImageView sayBg; + TextView sayText; + EditText sayEdit; + String mLiveUid; + String url; + LiveAnchorSayModel sayModel; + OnItemClickListener onItemClickListener; + + public LiveAnchorSayPopDialog(@NonNull Context context) { + super(context); + } + + public LiveAnchorSayPopDialog setLiveUid(String mLiveUid) { + this.mLiveUid = mLiveUid; + return this; + } + + public LiveAnchorSayPopDialog setOnItemClickListener(OnItemClickListener onItemClickListener) { + this.onItemClickListener = onItemClickListener; + return this; + } + + @Override + public void buildDialog(XPopup.Builder builder) { + builder.autoFocusEditText(false); + builder.enableDrag(false); + builder.borderRadius(50); + } + + @Override + protected void onDismiss() { + super.onDismiss(); + setSayData(url, sayEdit.getText().toString()); + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_anchor_say; + } + + @Override + protected void onCreate() { + super.onCreate(); + adapter = new LiveAnchorSayItemsAdapter(getContext()); + anchorDemo = findViewById(R.id.anchor_say); + sayText = anchorDemo.findViewById(R.id.anchor_say_text); + list = findViewById(R.id.anchor_say_list); + saySwitch = findViewById(R.id.say_switch); + sayEdit = findViewById(R.id.anchor_say_edit); + close = findViewById(R.id.close); + sayBg = anchorDemo.findViewById(R.id.anchor_say_icon); + list.setLayoutManager(new GridLayoutManager(getContext(), 3)); + list.setAdapter(adapter); + adapter.setOnItemClickListener(new OnItemClickListener() { + @Override + public void onItemClick(String bean, int position) { + anchorDemo.setVisibility(VISIBLE); + ImgLoader.display(getContext(), bean, sayBg); + url = bean; + } + }); + initData(); + saySwitch.setOnClickListener(v -> { + if (saySwitch.getTag() == null) { + saySwitch.setTag(""); + saySwitch.setImageResource(R.mipmap.special_icon_on); + sayModel.getLivePreview().setIsShow(1); + } else { + saySwitch.setTag(null); + saySwitch.setImageResource(R.mipmap.special_icon_off); + sayModel.getLivePreview().setIsShow(0); + } + }); + + sayEdit.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + sayModel.getLivePreview().setContent(s.toString()); + StringBuilder sb = new StringBuilder(); + int len=6; + int n = (s.length() + 3) / len; + for (int i = 0; i < n; i++) { + if (i < (n - 1)) { + sb.append(s.toString().substring(i * len, (i + 1) * len)).append("\n"); + } else { + sb.append(s.toString().substring(i * len)); + } + } + if (sb.length() == 0) { + sb.append("默认字符\n默认字符\n默认字符"); + } + sayText.setText(sb.toString()); + } + + @Override + public void afterTextChanged(Editable s) { + + } + + }); + close.setOnClickListener(v -> { + dismiss(); + }); + + } + + private void setSayData(String url, String edit) { + LiveNetManager.get(getContext()) + .setLivePreviewInfo( + mLiveUid, + sayModel.getLivePreview().getIsShow(), + edit, + url, + new HttpCallback() { + @Override + public void onSuccess(String data) { + Log.i("女神说", "onSuccess: " + data); + ToastUtil.show(WordUtil.isZh() ? "成功" : "success"); + } + + @Override + public void onError(String error) { + Log.e("女神说", "onError: " + error); + } + } + ); + if (onItemClickListener != null) { + onItemClickListener.onItemClick(sayModel, 0); + } + IMLoginManager.get(getContext()).setAnchorSayStatus(sayModel.getLivePreview().getIsShow()); + } + + private void initData() { + LiveNetManager.get(getContext()) + .getLivePreviewInfo(mLiveUid, new HttpCallback() { + @Override + public void onSuccess(LiveAnchorSayModel data) { + sayModel = data; + List urls = new ArrayList<>(data.getStyle()); + adapter.setList(urls); + LiveAnchorSayModel.LivePreview preview = data.getLivePreview(); + if (preview != null) { + sayText.setText(preview.getContent()); + sayEdit.setText(preview.getContent()); + url = preview.getStyleImage(); + ImgLoader.display(getContext(), preview.getStyleImage(), sayBg); + if (preview.getIsShow() == 1) { + saySwitch.setTag(""); + saySwitch.setImageResource(R.mipmap.special_icon_on); + } + anchorDemo.setVisibility(VISIBLE); + } + + } + + @Override + public void onError(String error) { + + } + }); + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java index 4366e4bd6..336b4d1b5 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java @@ -4,6 +4,7 @@ import static com.yunbao.common.CommonAppConfig.isGetNewWrap; import static com.yunbao.common.utils.RouteUtil.PATH_COIN; import static com.yunbao.live.views.LiveRoomViewHolder.bean1; +import android.content.DialogInterface; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; @@ -25,7 +26,11 @@ import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.core.content.ContextCompat; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager.widget.ViewPager; @@ -124,6 +129,9 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On private TextView mVipGoldDesc; private TextView mGiftPackage; private boolean isPk; + private int isContactGift = 0; + DialogInterface.OnDismissListener onDismissListener; + DialogInterface.OnShowListener onShowListener; @Override @@ -155,6 +163,22 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On mLiveGuardInfo = liveGuardInfo; } + @Override + public void onDismiss(DialogInterface dialog) { + super.onDismiss(dialog); + if (onDismissListener != null) { + onDismissListener.onDismiss(dialog); + } + } + + @Override + public void onStart() { + super.onStart(); + if (onShowListener != null) { + onShowListener.onShow(getDialog()); + } + } + public void setPkStatus(boolean pk) { isPk = pk; } @@ -208,7 +232,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On @Override public void onPageSelected(int position) { - if (mRadioGroup != null && mRadioGroup.getChildAt(position)!=null) { + if (mRadioGroup != null && mRadioGroup.getChildAt(position) != null) { ((RadioButton) mRadioGroup.getChildAt(position)).setChecked(true); } } @@ -278,6 +302,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On mStream = bundle.getString(Constants.LIVE_STREAM); mWishGiftId = bundle.getString(Constants.LIVE_WISH_GIFTID); by = bundle.getString("by"); + isContactGift = bundle.getBoolean("isContactGift", false) ? 1 : 0; } loadGiftListData(); loadUserVip(); @@ -665,9 +690,9 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On } SendGiftCallback callback = new SendGiftCallback(mLiveGiftBean); if (by != null) { - LiveHttpUtil.sendGift("1", mLiveUid, mStream, mLiveGiftBean.getId(), mCount, callback); + LiveHttpUtil.sendGift("1", mLiveUid, mStream, mLiveGiftBean.getId(), mCount, isContactGift, callback); } else { - LiveHttpUtil.sendGift("0", mLiveUid, mStream, mLiveGiftBean.getId(), mCount, callback); + LiveHttpUtil.sendGift("0", mLiveUid, mStream, mLiveGiftBean.getId(), mCount, isContactGift, callback); } } } @@ -722,6 +747,14 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On mLiveGiftPagerAdapter.refreshId(status.getId()); } + public void setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) { + this.onDismissListener = onDismissListener; + } + + public void setOnShowListener(DialogInterface.OnShowListener onShowListener) { + this.onShowListener = onShowListener; + } + private class SendGiftCallback extends HttpCallback { private LiveGiftBean mGiftBean; 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 3fc60e1a5..12a8fd209 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java @@ -25,7 +25,9 @@ import android.widget.TextView; import com.lxj.xpopup.XPopup; import com.yunbao.common.Constants; +import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.dialog.AbsDialogFragment; +import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.LiveAnchorMessageCustomPopup; @@ -116,6 +118,8 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements findViewById(R.id.anchor_task).setOnClickListener(this); findViewById(R.id.live_tool_robot).setOnClickListener(this); + findViewById(R.id.live_tool_call_me).setOnClickListener(this); + findViewById(R.id.live_tool_anchor_say).setOnClickListener(this); if (leave == 0) { ((ImageView) mLeaveView.findViewById(R.id.live_tool_leave_img)).setImageResource(R.mipmap.icon_leave); @@ -190,6 +194,11 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements taskDialog.updateLiveTimer(mAnchorLiveTime); taskDialog.showDialog(); + } else if (id == R.id.live_tool_call_me) { + new LiveAnchorEditCallMeDialog(mContext).setLiveUid(liveUid).showDialog(); + } else if (id == R.id.live_tool_anchor_say) { + new LiveAnchorSayPopDialog(mContext).setLiveUid(liveUid).setOnItemClickListener((bean, position) + -> mLiveRoomHandler.postDelayed(()-> ((LiveRyAnchorActivity)(mContext)).mLiveRoomViewHolder.initAnchorSayData(),1000)).showDialog(); } } 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 110932759..a5e0d1cf2 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java @@ -141,7 +141,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O ToastUtil.show("可添加禮物數量達到上限"); return; } - GiftPopDialog dialog = new GiftPopDialog(mContext, mRootView, new GiftPopDialog.ActionListener() { + GiftPopDialog dialog = new GiftPopDialog(mContext, new GiftPopDialog.ActionListener() { @Override public void onSelectGift(PrankGiftBean bean) { @@ -156,7 +156,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } }); dialog.setList(giftBeans); - dialog.show(); + dialog.showDialog(); } else { setPrankConfig(); } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxPopDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxPopDialog.java new file mode 100644 index 000000000..1b15d422d --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxPopDialog.java @@ -0,0 +1,106 @@ +package com.yunbao.live.dialog; + +import android.content.Context; +import android.util.Log; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.bean.LiveUserMailBoxModel; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.utils.Bus; +import com.yunbao.live.R; +import com.yunbao.live.adapter.LiveUserAnchorMailBoxAdapter; +import com.yunbao.live.event.LiveAudienceEvent; + +import java.util.ArrayList; +import java.util.List; + +/** + * 用户获取主播联系方式信箱弹框 + */ +public class LiveUserAnchorMailBoxPopDialog extends AbsDialogPopupWindow { + private RecyclerView list; + private LiveUserAnchorMailBoxAdapter adapter; + private View empty; + + public LiveUserAnchorMailBoxPopDialog(@NonNull Context context) { + super(context); + } + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_live_user_mailbox; + } + + @Override + protected void onCreate() { + super.onCreate(); + adapter = new LiveUserAnchorMailBoxAdapter(getContext()); + list = findViewById(R.id.mailbox); + empty = findViewById(R.id.ic_empty); + list.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); + list.setAdapter(adapter); + adapter.setOnItemClickListener((bean, position) -> { + if (adapter.getItemCount() == 0) { + empty.setVisibility(VISIBLE); + list.setVisibility(GONE); + } + }); + initData(); + } + + String TAG = "信箱"; + + void initData() { + LiveNetManager.get(getContext()) + .getContactMsg(new HttpCallback>() { + @Override + public void onSuccess(List data) { + Log.i(TAG, "onSuccess: " + data.size()); + for (LiveUserMailBoxModel datum : data) { + Log.i(TAG, "for data : " + datum); + } + setData(data); + } + + @Override + public void onError(String error) { + Log.e(TAG, "onError: " + error); + setData(new ArrayList<>()); + } + + void setData(List data) { + if (data.isEmpty()) { + empty.setVisibility(VISIBLE); + list.setVisibility(GONE); + return; + } + adapter.setList(data); + } + }); + } + + @Override + protected void onDismiss() { + super.onDismiss(); + for (LiveUserMailBoxModel model : adapter.getList()) { + if(model.getIsRead()==0){ + return; + } + } + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LIVE_HIDE_MSG_RED)); + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxWebInfoPopDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxWebInfoPopDialog.java new file mode 100644 index 000000000..143eaed8d --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxWebInfoPopDialog.java @@ -0,0 +1,81 @@ +package com.yunbao.live.dialog; + +import android.content.Context; +import android.os.Build; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.CommonAppContext; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.utils.JavascriptInterfaceUtils; +import com.yunbao.common.utils.L; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.R; + +public class LiveUserAnchorMailBoxWebInfoPopDialog extends AbsDialogPopupWindow { + WebView mWebView; + TextView textView; + + String anchorName; + String url; + + public LiveUserAnchorMailBoxWebInfoPopDialog(@NonNull Context context) { + super(context); + } + + public LiveUserAnchorMailBoxWebInfoPopDialog(@NonNull Context context, String anchorName, String url) { + super(context); + this.anchorName = anchorName; + this.url = url; + } + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_live_user_mailbox_web; + } + + @Override + protected void onCreate() { + super.onCreate(); + mWebView=findViewById(R.id.webView); + textView=findViewById(R.id.title); + textView.setText(String.format(WordUtil.getString(R.string.live_user_mailbox_web_title),anchorName)); + mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(CommonAppContext.getTopActivity(),mWebView),"androidObject"); + mWebView.getSettings().setJavaScriptEnabled(true); + mWebView.getSettings().setDomStorageEnabled(true); + String appCachePath = getContext().getCacheDir().getAbsolutePath(); + mWebView.getSettings().setAppCachePath(appCachePath); + mWebView.getSettings().setAllowFileAccess(true); + mWebView.getSettings().setAppCacheEnabled(true); + mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + } + mWebView.setWebViewClient(new WebViewClient() { + @Override + public boolean shouldOverrideUrlLoading(WebView view, String url) { + L.e("H5-------->" + url); + view.loadUrl(url); + + return true; + } + + @Override + public void onPageFinished(WebView view, String url) { + // view.loadUrl("javascript:window.androidObject.setHeight(document.body.clientHeight,document.body.clientWidth)"); + + } + }); + mWebView.loadUrl(url); + } +} diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 49600b5f1..89aa31a10 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -299,7 +299,8 @@ public class LiveAudienceEvent extends BaseModel { UPDATA_ROBOT(53, "更新机器人消息"), LIVE_VIDEO(54, "画质选择"), LUCKY_100_CHECK(55, "幸运百分百"), - LIVE_END(56, "主播下播"); + LIVE_END(56, "主播下播"), + LIVE_HIDE_MSG_RED(57,"隐藏红点"); private int type; private String name; diff --git a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java index be47f5942..a86c2906d 100644 --- a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java +++ b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java @@ -606,12 +606,22 @@ public class LiveHttpUtil { * 观众给主播送礼物 */ public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, HttpCallback callback) { + sendGift(by, liveUid, stream, giftId, giftCount, 0, callback); + } + + /** + * 观众给主播送礼物 + * @param isContactGift 是否为联系方式礼物 + */ + public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, HttpCallback callback) { HttpClient.getInstance().get("Live.sendGift", LiveHttpConsts.SEND_GIFT) .params("liveuid", liveUid) .params("stream", stream) .params("giftid", giftId) + .params("isContactGift", isContactGift) .params("giftcount", giftCount) .params("isprank", by) + .params("appVersion", CommonAppConfig.getInstance().getVersion()) .execute(callback); } diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java index 61155f065..8612ab8d2 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java @@ -303,7 +303,7 @@ public class LiveEnterRoomAnimPresenter { enter_room_gif_small.setVisibility(View.GONE); tv_enterroom_user.setText(playText); tv_enterroom_user.setTextColor(Color.parseColor(colocNow)); - LoadDian9TuUtil.loadDian9Tu(mContext, tv_enterroom_user, urlNow, 0); + new LoadDian9TuUtil().loadDian9Tu(mContext, tv_enterroom_user, urlNow, 0); playStart(rt_enterroom_svga); if (enter_room_svg_small != null) { @@ -339,7 +339,7 @@ public class LiveEnterRoomAnimPresenter { SVGARect rect = svgaVideoEntity.getVideoSize(); mSVGImageView.setVideoItem(svgaVideoEntity); mSVGImageView.setLoops(1); - SVGAViewUtils.playEndClear(mSVGImageView,true,new SVGACallback() { + SVGAViewUtils.playEndClear(mSVGImageView, true, new SVGACallback() { @Override public void onPause() { @@ -509,7 +509,7 @@ public class LiveEnterRoomAnimPresenter { enter_room_gif_small.setVisibility(View.VISIBLE); tv_enterroom_user.setText(playText); tv_enterroom_user.setTextColor(Color.parseColor(colocNow)); - LoadDian9TuUtil.loadDian9Tu(mContext, tv_enterroom_user, urlNow, 0); + new LoadDian9TuUtil().loadDian9Tu(mContext, tv_enterroom_user, urlNow, 0); playStart(rt_enterroom_svga); mGifDrawable.setLoopCount(3); view = enter_room_gif_small; 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 da83aca91..bf274caca 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java @@ -158,10 +158,11 @@ public class LiveTextRender { builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF86C")), giftIndexOf, giftIndexOf + giftSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); mTextView.setText(builder); } + /** * 幸运100%活动 */ - public void lucky100(Context mContext, TextView mTextView, MsgModel msgModel){ + public void lucky100(Context mContext, TextView mTextView, MsgModel msgModel) { String msg = mContext.getString(R.string.lucky_100); msg = String.format(msg, msgModel.getUserName(), msgModel.getGiftName()); int unameIndexOf = msg.indexOf(msgModel.getUserName()); @@ -199,7 +200,7 @@ public class LiveTextRender { int index = mContext.indexOf(userName); int end = index + userName.length(); int endIndex = startIndex + userName.length(); - spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#fffe9b")), + spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#FBEABF")), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); mContext = mContext.substring(end + 1, mContext.length()); startIndex = startIndex + end + 1; @@ -215,7 +216,7 @@ public class LiveTextRender { int end = index + name.length(); startIndex = index + startIndex; int endIndex = startIndex + name.length(); - spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#fffe9b")), + spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#FBEABF")), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); mContext = mContext.substring(end, mContext.length()); startIndex = endIndex; @@ -248,7 +249,7 @@ public class LiveTextRender { if (levelDrawable != null) { builder.append(" "); - levelDrawable.setBounds(0, 0, DpUtil.dp2px(32), DpUtil.dp2px(14)); + levelDrawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17)); builder.setSpan(new VerticalImageSpan(levelDrawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); index = builder.length(); } @@ -416,7 +417,6 @@ public class LiveTextRender { }); } - private ImgLoader.DrawableCallback mCallback; /** * 等级设置 @@ -424,10 +424,9 @@ public class LiveTextRender { * @return */ public void getLevelImage(Context mContext, int userLevel, ImgLoader.DrawableCallback callback) { - mCallback = callback; - if(mContext instanceof Activity){ - if(((Activity)mContext).isDestroyed()){ - mContext=CommonAppContext.getTopActivity(); + if (mContext instanceof Activity) { + if (((Activity) mContext).isDestroyed()) { + mContext = CommonAppContext.getTopActivity(); } } List models = new NewLevelManager(mContext).getNewLevelModels(); @@ -484,18 +483,76 @@ public class LiveTextRender { }); } + public void getLiveLevelImage(Context mContext, int userLevel, ImgLoader.DrawableCallback callback) { + if (mContext instanceof Activity) { + if (((Activity) mContext).isDestroyed()) { + mContext = CommonAppContext.getTopActivity(); + } + } + List models = new NewLevelManager(mContext).getNewLevelModels(); + String imgUrl = "https://downs.yaoulive.com/level1/img_1-9.png"; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= userLevel && userLevel <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getLiveIcon(); + } + } + + Glide.with(mContext).asBitmap().load(imgUrl).into(new CustomTarget() { + @Override + public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition transition) { + Observable.create(new ObservableOnSubscribe() { + @Override + public void subscribe(ObservableEmitter emitter) throws Exception { + emitter.onNext(AddTimeLiveWatermark(resource, String.valueOf(userLevel)));// + } + }).subscribeOn(Schedulers.newThread()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Observer() { + @Override + public void onSubscribe(Disposable d) { + + } + + @Override + public void onNext(Bitmap bitmap) { + BitmapDrawable drawable = new BitmapDrawable(bitmap); + if (callback != null) { + callback.onLoadSuccess(drawable); + } + } + + @Override + public void onError(Throwable e) { + + } + + @Override + public void onComplete() { + + } + }); + } + + @Override + public void onLoadCleared(@Nullable Drawable placeholder) { + if (callback != null) { + callback.onLoadFailed(); + } + } + }); + } private void renderTMP(Context context, final TextView textView, final LiveChatBean bean) { if (textView != null) { - getLevelImage(context, bean.getLevel(), new ImgLoader.DrawableCallback() { + getLiveLevelImage(context, bean.getLevel(), new ImgLoader.DrawableCallback() { @Override public void onLoadSuccess(Drawable drawable) { SpannableStringBuilder builder = createPrefix(drawable, bean); int color = Color.parseColor("#68F1F4"); if (bean.isAnchor()) { - color = 0xffffdd00; + color =Color.parseColor("#FBEABF"); } else { color = Color.parseColor("#68F1F4"); } @@ -535,6 +592,43 @@ public class LiveTextRender { } + /** + * bitmap添加文字 + * + * @param mBitmap + * @return + */ + private Bitmap AddTimeLiveWatermark(Bitmap mBitmap, String level) { + //获取原始图片与水印图片的宽与高 + int mBitmapWidth = mBitmap.getWidth(); + int mBitmapHeight = mBitmap.getHeight(); + Bitmap mNewBitmap = Bitmap.createBitmap(mBitmapWidth, mBitmapHeight, Bitmap.Config.ARGB_8888); + Canvas mCanvas = new Canvas(mNewBitmap); + //向位图中开始画入MBitmap原始图片 + mCanvas.drawBitmap(mBitmap, 0, 0, null); + //添加文字 + Paint mPaint = new Paint(); + Typeface font = Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD); + mPaint.setColor(Color.WHITE); + if (level.length() == 3) { + mPaint.setTextSize(27); + mPaint.setTypeface(font); + mCanvas.drawText(level, 3, 38, mPaint); + } else if (level.length() == 2) { + mPaint.setTextSize(30 ); + mPaint.setTypeface(font); + mCanvas.drawText(level, 10, 38, mPaint); + }else if (level.length() == 1) { + mPaint.setTextSize(37 ); + mPaint.setTypeface(font); + mCanvas.drawText(level, 16, 38, mPaint); + } + + mCanvas.save(); + mCanvas.restore(); + return mNewBitmap; + } + /** * bitmap添加文字 * diff --git a/live/src/main/java/com/yunbao/live/utils/LoadDian9TuUtil.java b/live/src/main/java/com/yunbao/live/utils/LoadDian9TuUtil.java index 35574c537..634f805c9 100644 --- a/live/src/main/java/com/yunbao/live/utils/LoadDian9TuUtil.java +++ b/live/src/main/java/com/yunbao/live/utils/LoadDian9TuUtil.java @@ -2,30 +2,36 @@ package com.yunbao.live.utils; import android.app.Activity; import android.content.Context; +import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.NinePatch; import android.graphics.drawable.Drawable; import android.graphics.drawable.NinePatchDrawable; import android.os.Build; +import android.text.TextUtils; +import android.view.View; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import android.view.View; import com.bumptech.glide.Glide; import com.bumptech.glide.request.target.CustomTarget; import com.bumptech.glide.request.transition.Transition; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.live.activity.LiveActivity; import java.io.File; import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.List; public class LoadDian9TuUtil { - private static final List BITMAP_CACHE=new ArrayList<>();//.9图Bitmap缓存 + private static final List BITMAP_CACHE = new ArrayList<>();//.9图Bitmap缓存 - public static void loadDian9Tu(Context context, View imageView, String imgUrl, int position) { + public void loadDian9Tu(Context context, View imageView, String imgUrl, int position) { if (context == null) { return; } @@ -43,8 +49,8 @@ public class LoadDian9TuUtil { @Override public void onResourceReady(@NonNull File resource, @Nullable Transition transition) { try { - FileInputStream is=new FileInputStream(resource); - Bitmap bitmap=BitmapFactory.decodeStream(is); + FileInputStream is = new FileInputStream(resource); + Bitmap bitmap = BitmapFactory.decodeStream(is); BITMAP_CACHE.add(bitmap); setNinePathImage(context, imageView, bitmap, position); is.close(); @@ -60,7 +66,44 @@ public class LoadDian9TuUtil { }); } - public static void setNinePathImage(Context context, View imageView, Bitmap bitmap, int position) { + public void loadDian9TuAssets(Context context, View imageView, int position) { + if (TextUtils.isEmpty(IMLoginManager.get(context).getKeyDefaultBubbleUrl())) { + Bitmap bitmap = getImageFromAssetsFile(context, "chat_message_bg.png"); + BITMAP_CACHE.add(bitmap); + setNinePathImage(context, imageView, bitmap, position); + } else { + String url = IMLoginManager.get(context).getKeyDefaultBubbleUrl(); + loadDian9Tu(context, imageView,url, 1); + } + + } + + public void loadDian9TuAssets2(Context context, View imageView, String fileName, int position) { + Bitmap bitmap = getImageFromAssetsFile(context, fileName); + BITMAP_CACHE.add(bitmap); + setNinePathImage(context, imageView, bitmap, position); + } + + /** + * 从Assets中读取图片 + * + * @param fileName + * @return + */ + private Bitmap getImageFromAssetsFile(Context context, String fileName) { + Bitmap image = null; + AssetManager am = context.getResources().getAssets(); + try { + InputStream is = am.open(fileName); + image = BitmapFactory.decodeStream(is); + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return image; + } + + public void setNinePathImage(Context context, View imageView, Bitmap bitmap, int position) { if (bitmap == null) return; byte[] chunk = bitmap.getNinePatchChunk(); @@ -71,11 +114,11 @@ public class LoadDian9TuUtil { } /** - * @see LiveActivity#onDestroy() 结束时,释放掉.9图缓存 + * @see LiveActivity# 结束时,释放掉.9图缓存 */ - public static void clearBitmap(){ + public static void clearBitmap() { for (Bitmap bitmap : BITMAP_CACHE) { - if(bitmap!=null) { + if (bitmap != null) { bitmap.recycle(); } } diff --git a/live/src/main/java/com/yunbao/live/views/AbsLiveViewHolder.java b/live/src/main/java/com/yunbao/live/views/AbsLiveViewHolder.java index b6868174e..4f38c8143 100644 --- a/live/src/main/java/com/yunbao/live/views/AbsLiveViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/AbsLiveViewHolder.java @@ -17,7 +17,7 @@ import org.greenrobot.eventbus.EventBus; public abstract class AbsLiveViewHolder extends AbsViewHolder implements View.OnClickListener { - private TextView mRedPoint; + public TextView mRedPoint; public AbsLiveViewHolder(Context context, ViewGroup parentView) { super(context, parentView); diff --git a/live/src/main/java/com/yunbao/live/views/Banner4CustomViewHolder.java b/live/src/main/java/com/yunbao/live/views/Banner4CustomViewHolder.java index 39954fdf6..9be9377aa 100644 --- a/live/src/main/java/com/yunbao/live/views/Banner4CustomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/Banner4CustomViewHolder.java @@ -12,7 +12,11 @@ public class Banner4CustomViewHolder implements BannerViewHolder { @Override public View createView(Context context, int position, BannerBean data) { ImageView icon=new ImageView(context); - ImgLoader.display(context,data.getImageUrl(),icon); + if(data.getIconRes()!=0){ + ImgLoader.display(context,data.getIconRes(),icon); + }else { + ImgLoader.display(context, data.getImageUrl(), icon); + } return icon; } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index c6ceacd3e..85237fae8 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -289,7 +289,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { } }); - //底部礼物弹窗 +// //底部礼物弹窗 ImgLoader.displayGif(mContext, R.mipmap.live_lw, giftImage); ViewClicksAntiShake.clicksAntiShake(giftImage, new ViewClicksAntiShake.ViewClicksCallBack() { @@ -302,10 +302,10 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { Locale locale = mContext.getResources().getConfiguration().locale; String language = locale.getLanguage(); - ImgLoader.display(mContext, TextUtils.equals(language, "zh") ? R.mipmap.live_icon_new_people_cn : R.mipmap.live_icon_newpeople_en, liveNewPeople); - ImgLoader.display(mContext, TextUtils.equals(language, "zh") ? R.mipmap.live_icon_role : R.mipmap.live_icon_role_en, mRole); - ImgLoader.display(mContext, TextUtils.equals(language, "zh") ? R.mipmap.live_icon_play : R.mipmap.live_icon_play_en, mPlay); - ImgLoader.display(mContext, TextUtils.equals(language, "zh") ? R.mipmap.live_icon_cheat : R.mipmap.live_icon_cheat_en, mCheat); +// ImgLoader.display(mContext, TextUtils.equals(language, "zh") ? R.mipmap.live_icon_new_people_cn : R.mipmap.live_icon_newpeople_en, liveNewPeople); +// ImgLoader.display(mContext, TextUtils.equals(language, "zh") ? R.mipmap.live_icon_role : R.mipmap.live_icon_role_en, mRole); +// ImgLoader.display(mContext, TextUtils.equals(language, "zh") ? R.mipmap.live_icon_play : R.mipmap.live_icon_play_en, mPlay); +// ImgLoader.display(mContext, TextUtils.equals(language, "zh") ? R.mipmap.live_icon_cheat : R.mipmap.live_icon_cheat_en, mCheat); voiceButton.setOnTouchListener((v, event) -> { if (event.getAction() == MotionEvent.ACTION_DOWN) { @@ -448,15 +448,11 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { if (!liveUid.equals(mLiveUid)) { return; } - if (isattention == 0) { - LiveChatBean lvBean = new LiveChatBean(); - lvBean.setType(-1); - lvBean.setId(url); - LiveRoomViewHolder.insertChat(lvBean, 1); - } - LiveChatBean lvBean2 = new LiveChatBean(); - lvBean2.setType(-2); - LiveRoomViewHolder.insertChat(lvBean2, 1); + LiveChatBean lvBean = new LiveChatBean(); + lvBean.setType(-2); + lvBean.setId(url); + lvBean.setAttention(isattention != 0); + LiveRoomViewHolder.insertChat(lvBean, 1); Log.i("chatMgs", liveUid + "|" + mLiveUid); } }, 10000);//3秒后执行Runnable中的run方法 diff --git a/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java index 1411da666..b167214ce 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java @@ -27,6 +27,8 @@ import com.lxj.xpopup.interfaces.XPopupCallback; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.bean.LiveAnchorCallMeModel; +import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveClassBean; import com.yunbao.common.bean.LiveRoomTypeBean; import com.yunbao.common.bean.UserBean; @@ -35,6 +37,7 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.ImageResultCallback; +import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; @@ -53,6 +56,8 @@ import com.yunbao.faceunity.FaceManager; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; +import com.yunbao.live.dialog.LiveAnchorEditCallMeDialog; +import com.yunbao.live.dialog.LiveAnchorSayPopDialog; import com.yunbao.live.dialog.LiveFaceUnityDialogFragment; import com.yunbao.live.dialog.LiveNewRoomClassDialogFragment; import com.yunbao.live.dialog.LiveNewRoomTypeDialogFragment; @@ -96,6 +101,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl private int selectClarity = 1; private LiveOpenCustomPopup liveOpenCustomPopup; private boolean selector = true; + private String mLiveUid; public LiveNewReadyRyViewHolder(Context context, ViewGroup parentView, int liveSdk) { super(context, parentView, liveSdk); @@ -195,6 +201,8 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl findViewById(R.id.btn_wishlist).setOnClickListener(this); findViewById(R.id.btn_horizontally).setOnClickListener(this); findViewById(R.id.anchor_agreement_layout).setOnClickListener(this); + findViewById(R.id.btn_live_anchor_say).setOnClickListener(this); + findViewById(R.id.btn_live_anchor_call_me).setOnClickListener(this); if (manager != null) { manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() { @@ -389,6 +397,8 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl } // startLive(); liveOpenCustomPopup = new LiveOpenCustomPopup(mContext, IMLoginManager.get(mContext).getSelectClarity(), classBean, liveRoomTypeBean) + .setSayStatus(IMLoginManager.get(mContext).getAnchorSayStatus()) + .setCallMeStatus(IMLoginManager.get(mContext).getAnchorCallStatus()) .setCallBack(new LiveOpenCustomPopup.LiveOpenCallBack() { @Override @@ -537,6 +547,16 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl //点击心愿单 openWishListWindow(); } + + @Override + public void openAnchorSay() { + openAnchorSayDialog(); + } + + @Override + public void openCallMe() { + openAnchorCallMeDialog(); + } }); new XPopup.Builder(mContext) .asCustom(liveOpenCustomPopup) @@ -565,6 +585,10 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl .append("&token=") .append(model.getToken()); RouteUtil.forwardLiveZhuangBanActivity(url.toString(), false); + } else if (i == R.id.btn_live_anchor_say) { + openAnchorSayDialog(); + } else if (i == R.id.btn_live_anchor_call_me) { + openAnchorCallMeDialog(); } } @@ -596,6 +620,28 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl } } + public void openAnchorSayDialog() { + new LiveAnchorSayPopDialog(mContext).setLiveUid(mLiveUid).setOnItemClickListener(new OnItemClickListener() { + @Override + public void onItemClick(LiveAnchorSayModel bean, int position) { + if (liveOpenCustomPopup != null) { + liveOpenCustomPopup.setSayStatus(bean.getLivePreview().getIsShow() == 1); + } + } + }).showDialog(); + } + + public void openAnchorCallMeDialog() { + new LiveAnchorEditCallMeDialog(mContext).setLiveUid(mLiveUid).setOnItemClickListener(new OnItemClickListener() { + @Override + public void onItemClick(LiveAnchorCallMeModel bean, int position) { + if (liveOpenCustomPopup != null) { + liveOpenCustomPopup.setCallMeStatus(bean.getIsShow() == 1); + } + } + }).showDialog(); + } + @Subscribe(threadMode = ThreadMode.MAIN) public void updateStart(LiveAudienceEvent event) { if (event.getType() == WISH_LIST_UPDATE) { @@ -893,4 +939,8 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl public void onDestroy() { LiveHttpUtil.cancel(LiveHttpConsts.CREATE_ROOM); } + + public void setLiveUid(String mLiveUid) { + this.mLiveUid = mLiveUid; + } } 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 604304be3..abe3b71b3 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -7,6 +7,7 @@ import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.graphics.Outline; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; @@ -23,7 +24,9 @@ import android.view.ViewOutlineProvider; import android.view.WindowManager; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; +import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; +import android.view.animation.TranslateAnimation; import android.widget.Button; import android.widget.FrameLayout; import android.widget.ImageView; @@ -68,10 +71,13 @@ import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LinkMicUserBean; +import com.yunbao.common.bean.LiveAnchorCallMeModel; +import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.LiveUserGiftBean; +import com.yunbao.common.bean.LiveUserMailBoxModel; import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.NewPeopleTaskModel; import com.yunbao.common.bean.PkRankBean; @@ -106,6 +112,7 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.formatBigNum; import com.yunbao.common.views.AbsViewHolder; +import com.yunbao.common.views.weight.ClipPathCircleImage; import com.yunbao.common.views.weight.FullServiceNotificationView; import com.yunbao.common.views.weight.NobleNoticeView; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -136,6 +143,7 @@ import com.yunbao.live.custom.TopGradual; import com.yunbao.live.dialog.LiveFaceUnityDialogFragment; import com.yunbao.live.dialog.LiveFansMedalDialogFragment; import com.yunbao.live.dialog.LiveGameDialogFragment; +import com.yunbao.live.dialog.LiveGiftDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; @@ -148,6 +156,8 @@ import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter; import com.yunbao.live.presenter.LiveGiftAnimPresenter; import com.yunbao.live.presenter.LiveLightAnimPresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; +import com.yunbao.live.utils.LiveTextRender; +import com.yunbao.live.utils.LoadDian9TuUtil; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -219,7 +229,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public TextView room_hot; public String touid, gotoroom; public static TextView fans; - public LinearLayout fans_btn, wishListLayout; + public LinearLayout fans_btn, wishListLayout, wishListLayout2, liveWksLayout; public static View d_pk_view; public static int isAttention = 0;//是否关注 0=没关注, public static String mNameText; @@ -295,12 +305,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private List mBannerList2 = new ArrayList<>(); private List mBannerList3 = new ArrayList<>(); private List mBannerList4 = new ArrayList<>(); - private LinearLayout btn_event2, btn_event3, btn_event4; + private List mTopBannerList = new ArrayList<>(); + private LinearLayout btn_event2, btn_event3, btn_event4, enterRoomLeave2; private ImageView imgEvent; private View btnEvent; private LinearLayout lt_trickery; private TextView tv_trickery_time; - + private FrameLayout enterRoomLeave, enterRoomBg; private RecyclerView fastMsgRecyclerView; private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter; @@ -309,7 +320,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private List wishlist = new ArrayList<>(); private TextView mHourRank, mHotText; private LinearLayout msg; //默认悬浮窗布局 - private LinearLayout mAnchorLayout; + private LinearLayout mAnchorLayout, hourRankLayout, liveRankPk2; private ImageView mGoodNumberIcon; private View msg2; //悬浮窗来私信的布局 private ConstraintLayout msgLayout; //悬浮窗 @@ -318,7 +329,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private FullServiceNotificationView fullScreen;//全副喇叭 private NobleNoticeView noble;//全副喇叭 private FaceManager manager; - private LinearLayout pkRankLayout; + private FrameLayout pkRankLayout; private ViewFlipper pkRankVf; private ImageView mPkRankIcon; private TextView mPkRankText; @@ -334,6 +345,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis //全服通知 private ImageView customFullServiceNotify; + //----主播说组件---// + private View mAnchorSay; + private ImageView mAnchorSayImage; + private TextView mAnchorSayText; + private ImageView mAnchorSayHide; + //----!主播说组件---// + private Banner topBanner1;//心愿单&联系方式 public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { super(context, parentView); @@ -676,6 +694,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void init() { EventBus.getDefault().register(this); + mAnchorSay = findViewById(R.id.anchor_say_layout); + mAnchorSayImage = (ImageView) findViewById(R.id.anchor_say_icon); + mAnchorSayText = (TextView) findViewById(R.id.anchor_say_text); + mAnchorSayHide = (ImageView) findViewById(R.id.anchor_say_hide); + mAnchorSayHide.setOnClickListener(v -> hideAnchorSay()); + + btnEvent = findViewById(R.id.btn_event); fullScreen = (FullServiceNotificationView) findViewById(R.id.full_screen); noble = (NobleNoticeView) findViewById(R.id.noble); @@ -683,6 +708,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis imgEvent = (ImageView) findViewById(R.id.img_event); btn_event2 = (LinearLayout) findViewById(R.id.btn_event2); btn_event4 = (LinearLayout) findViewById(R.id.btn_event4); + enterRoomLeave = (FrameLayout) findViewById(R.id.enter_room_leave); + enterRoomBg = (FrameLayout) findViewById(R.id.enter_room_bg); + enterRoomLeave2 = (LinearLayout) findViewById(R.id.enter_room_leave2); mBanner1 = (Banner) findViewById(R.id.banner1); time = (TextView) findViewById(R.id.time); mBanner2 = (Banner) findViewById(R.id.banner2); @@ -815,13 +843,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis fans = (TextView) findViewById(R.id.fans); fans_btn = (LinearLayout) findViewById(R.id.fans_btn); wishListLayout = (LinearLayout) findViewById(R.id.wish_list_layout); + wishListLayout2 = (LinearLayout) findViewById(R.id.wish_list_layout2); + liveWksLayout = (LinearLayout) findViewById(R.id.live_wks_layout2); mAnchorLayout = (LinearLayout) findViewById(R.id.group_1); + hourRankLayout = (LinearLayout) findViewById(R.id.hour_rank_layout2); + liveRankPk2 = (LinearLayout) findViewById(R.id.live_rank_pk2); mGoodNumberIcon = (ImageView) findViewById(R.id.good_nub_ico); - pkRankLayout = (LinearLayout) findViewById(R.id.live_rank_pk); + pkRankLayout = (FrameLayout) findViewById(R.id.live_rank_pk); pkRankVf = (ViewFlipper) findViewById(R.id.rank_pk_vf); mPkRankTopIcon = (ImageView) findViewById(R.id.icon_pk_top); mRedVal = (TextView) findViewById(R.id.pk_rank_red_val); mBlueVal = (TextView) findViewById(R.id.pk_rank_blue_val); + topBanner1 = (Banner) findViewById(R.id.top_banner1); if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) { fans_btn.setVisibility(View.GONE); @@ -940,6 +973,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis LiveRoomViewHolder.follow(); mLiveChatAdapter.removetItem(bean); } else if (bean.getType() == -2) { + if (!bean.isAttention()) { + LiveRoomViewHolder.follow(); + } mLiveChatAdapter.removetItem(bean); ((LiveActivity) mContext).sendChatMessage("Hi~", null, null); } else if (bean.getType() == -5) { @@ -1126,6 +1162,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10); } }); + topBanner1.setOutlineProvider(new ViewOutlineProvider() { + @Override + public void getOutline(View view, Outline outline) { + outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10); + } + }); //打招呼消息 fastMsgRecyclerView = (RecyclerView) findViewById(R.id.room_fast_msg); fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false)); @@ -1167,7 +1209,53 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } customFullServiceNotify = (ImageView) findViewById(R.id.custom_full_service_notify); reloadIM(); - initStarChallengeStatus(); +// initStarChallengeStatus(); + + new LoadDian9TuUtil().loadDian9TuAssets2(mContext, liveWksLayout, "rectangle_new.png", 1); + new LoadDian9TuUtil().loadDian9TuAssets2(mContext, wishListLayout2, "rectangle_new.png", 1); + new LoadDian9TuUtil().loadDian9TuAssets2(mContext, liveRankPk2, "rectangle_new.png", 1); + } + + /** + * 隐藏女神说 + */ + private void hideAnchorSay() { + boolean hide = mAnchorSay.getTag() == null || (boolean) mAnchorSay.getTag(); + Animation animation; + if (hide) { + animation = AnimationUtils.loadAnimation(mContext, R.anim.view_live_anchor_say_text_out); + } else { + animation = AnimationUtils.loadAnimation(mContext, R.anim.view_live_anchor_say_text_in); + } + animation.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + if (!hide) { + mAnchorSay.setX((float) mAnchorSayImage.getTag()); + mAnchorSayImage.setVisibility(View.VISIBLE); + mAnchorSayText.setVisibility(View.VISIBLE); + mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_show); + } + } + + @Override + public void onAnimationEnd(Animation animation) { + if (hide) { + mAnchorSayImage.setTag(mAnchorSay.getX()); + mAnchorSay.setX(-DpUtil.dp2px(45)); + mAnchorSayImage.setVisibility(View.INVISIBLE); + mAnchorSayText.setVisibility(View.INVISIBLE); + mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_hide); + } + mAnchorSay.setTag(!hide); + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + mAnchorSay.startAnimation(animation); } /** @@ -1228,7 +1316,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mBannerList3.clear(); mBannerList4.clear(); updataCleanMic(); - initStarChallengeStatus(); +// initStarChallengeStatus(); + enterRoomLeave.setVisibility(View.GONE); } public void clearChat() { @@ -1630,9 +1719,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis if (flipper.getChildCount() > 0) { flipper.removeAllViews(); } - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16)); + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(13), DpUtil.dp2px(13)); + params.leftMargin = DpUtil.dp2px(6); + params.rightMargin = DpUtil.dp2px(2); LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - textParams.leftMargin = DpUtil.dp2px(5); + textParams.leftMargin = DpUtil.dp2px(2); View hotView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); ImageView hotPic = hotView.findViewById(R.id.wish_pic); @@ -1645,8 +1736,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mHotText.setGravity(Gravity.CENTER); mHourRank.setGravity(Gravity.CENTER); setHourRankData(Long.parseLong(model.getRank())); - hotPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hot : R.drawable.live_tags_hot_en); - hourPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hour_list : R.drawable.live_tags_hour_list_en); + hotPic.setImageResource(R.drawable.icon_time_new); + hourPic.setImageResource(R.drawable.icon_heat_new); hotPic.setLayoutParams(params); hourPic.setLayoutParams(params); flipper.addView(hotView); @@ -1669,6 +1760,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis liveHDDialogFragment.setArguments(bundle); liveHDDialogFragment.show(((AbsActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); }); + new LoadDian9TuUtil().loadDian9TuAssets2(mContext, hourRankLayout, "rectangle_new.png", 1); } /** @@ -1700,7 +1792,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mHourRank.setGravity(Gravity.CENTER); setHourRankData(info.get(0).getRank()); hotPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hot : R.drawable.live_tags_hot_en); - hourPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hour_list : R.drawable.live_tags_hour_list_en); + hourPic.setImageResource(R.drawable.icon_heat_new); hotPic.setLayoutParams(params); hourPic.setLayoutParams(params); flipper.addView(hotView); @@ -3420,7 +3512,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 展示新人任务 Banner */ private void showBanner3(LiveGiftBean bean1) { - btn_event3.setVisibility(View.VISIBLE); + btn_event3.setVisibility(View.GONE); if (mBannerList3 == null || mBannerList3.size() == 0 || mBanner3 == null || bean1 == null) { return; } @@ -3449,6 +3541,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis .start(); } + /** + * 新版UI隐藏活动轮播入口 + */ private void showBanner4() { btn_event4.setVisibility(View.VISIBLE); if (mBannerList4 == null || mBannerList4.size() == 0 || mBanner4 == null) { @@ -4188,4 +4283,264 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } + /** + * 横竖屏聊天框的高度 + * + * @param landscape + */ + public void changeMessageLandscape(int landscape) { + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) + mChatRecyclerView.getLayoutParams(); + RelativeLayout.LayoutParams enterRoomParams = (RelativeLayout.LayoutParams) enterRoomLeave.getLayoutParams(); + if (landscape == 2) { + params1.height = DpUtil.dp2px(200); + enterRoomParams.bottomMargin = -DpUtil.dp2px(65); + } else { + params1.height = DpUtil.dp2px(310); + enterRoomParams.bottomMargin = -DpUtil.dp2px(70); + } + mChatRecyclerView.setLayoutParams(params1); + + enterRoomLeave.setLayoutParams(enterRoomParams); + + + } + + + public void showHighGrade(LiveUserGiftBean model) { + ImageView imageView = (ImageView) findViewById(R.id.image_view); + ClipPathCircleImage imageAvatar = (ClipPathCircleImage) findViewById(R.id.image_avatar); + TextView userName = (TextView) findViewById(R.id.user_name); + userName.setText(String.format(mContext.getString(R.string.come_hint), model.getUserNiceName())); + ImgLoader.display(mContext, model.getAvatar(), imageAvatar); + int level = model.getLevel(); + if (level < 50) { + enterRoomLeave.setBackgroundResource(R.drawable.background_30); + enterRoomLeave2.setBackgroundResource(R.drawable.bg_30_leave); + } else if (level > 49 && level < 60) { + enterRoomLeave.setBackgroundResource(R.drawable.background_50); + enterRoomLeave2.setBackgroundResource(R.drawable.bg_50_leave); + } else if (level > 59 && level < 80) { + enterRoomLeave.setBackgroundResource(R.drawable.background_60); + enterRoomLeave2.setBackgroundResource(R.drawable.bg_60_leave); + } else if (level > 79 && level < 90) { + enterRoomLeave.setBackgroundResource(R.drawable.background_80); + enterRoomLeave2.setBackgroundResource(R.drawable.bg_80_leave); + } else if (level > 99) { + enterRoomLeave.setBackgroundResource(R.drawable.background_100); + enterRoomLeave2.setBackgroundResource(R.drawable.bg_100_leave); + } + + new LiveTextRender().getLiveLevelImage(mContext, model.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, imageView); + } + + @Override + public void onLoadFailed() { + + } + }); + enterRoomLeave.post(() -> { + enterRoomLeave.setVisibility(View.VISIBLE); + TranslateAnimation animationTranslate = new TranslateAnimation(enterRoomLeave.getMeasuredWidth(), 0, 0, 0); + AnimationSet animationSet1 = new AnimationSet(true); + animationSet1.addAnimation(animationTranslate); + animationSet1.setFillAfter(true); + animationSet1.setDuration(500); + animationSet1.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + + } + + @Override + public void onAnimationEnd(Animation animation) { + + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + enterRoomLeave.startAnimation(animationSet1); + + }); + + + } + + /** + * 隐藏高等级入场提示 + */ + public void hideHighGrade() { + if (enterRoomLeave.getVisibility() == View.GONE) return; + TranslateAnimation animationTranslate = new TranslateAnimation(0, -(enterRoomLeave.getMeasuredWidth() + DpUtil.dp2px(6)), 0, 0); + AnimationSet animationSet1 = new AnimationSet(true); + animationSet1.addAnimation(animationTranslate); + animationSet1.setFillAfter(true); + animationSet1.setDuration(100); + animationSet1.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + + } + + @Override + public void onAnimationEnd(Animation animation) { + enterRoomLeave.setVisibility(View.GONE); + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + enterRoomLeave.startAnimation(animationSet1); + } + LiveAnchorSayModel sayModel; + + public void initAnchorSayData() { + LiveNetManager.get(mContext) + .getLivePreviewInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(LiveAnchorSayModel data) { + Log.i("女神说", "onSuccess: " + data); + sayModel = data; + LiveAnchorSayModel.LivePreview preview = data.getLivePreview(); + if (preview != null) { + mAnchorSayText.setText(getText(data.getLivePreview().getContent())); + ImgLoader.display(mContext, preview.getStyleImage(), mAnchorSayImage); + if (preview.getIsShow() == 1) { + mAnchorSay.setVisibility(View.VISIBLE); + } + } + + } + + @Override + public void onError(String error) { + + } + + public String getText(String content) { + int t = 6; + float len = (float) content.length() / t; + StringBuilder sb = new StringBuilder(); + sb.append("\n"); + for (int i = 0; i < len; i++) { + if (len - i < 1) { + sb.append(content.substring(i * t)); + } else { + sb.append(content.substring(i * t, i * t + t)).append("\n"); + } + } + return sb.toString(); + } + }); + } + + public void initAnchorSay() { + if (mAnchorSay.getTag() != null) { + mAnchorSay.setX((float) mAnchorSayImage.getTag()); + mAnchorSayImage.setTag(null); + mAnchorSayImage.setVisibility(View.VISIBLE); + mAnchorSayText.setVisibility(View.VISIBLE); + mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_show); + } + mAnchorSay.setTag(null); + initAnchorSayData(); + } + + public void hideAnchorSayAndCallAnchor(){ + mAnchorSay.setX((float) mAnchorSayImage.getTag()); + mAnchorSayImage.setTag(null); + mAnchorSayImage.setVisibility(View.VISIBLE); + mAnchorSayText.setVisibility(View.VISIBLE); + mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_show); + topBanner1.setVisibility(View.GONE); + } + public void showAnchorSayAndCallAnchor(){ + mAnchorSayImage.setTag(mAnchorSay.getX()); + mAnchorSay.setX(-DpUtil.dp2px(45)); + mAnchorSayImage.setVisibility(View.INVISIBLE); + mAnchorSayText.setVisibility(View.INVISIBLE); + mAnchorSayHide.setImageResource(R.mipmap.ic_live_anchor_say_hide); + topBanner1.setVisibility(View.VISIBLE); + } + public void initTopBanner() { + checkNewLetter(); + mTopBannerList = new ArrayList<>(); + topBanner1.setVisibility(View.GONE); + topBanner1.setAutoPlay(true) + .setPages(mTopBannerList, new TopBannerCustomViewHolder()) + .setDelayTime(3000) + .setBannerStyle(BannerConfig.NOT_INDICATOR) + .setOnBannerClickListener(new OnBannerClickListener() { + @Override + public void onBannerClick(List datas, int position) { + if (mTopBannerList.get(position).getType() == TopBannerCustomViewHolder.TYPE_CALL_ANCHOR) { + Dialog loading = DialogUitl.loadingDialog(mContext); + loading.show(); + LiveGiftDialogFragment fragment = new LiveGiftDialogFragment(); + fragment.setOnDismissListener(dialog -> { + checkNewLetter(); + } + ); + fragment.setOnShowListener(dialog -> mHandler.postDelayed(loading::dismiss, 500)); + Bundle bundle = new Bundle(); + bundle.putString(Constants.LIVE_UID, mLiveUid); + bundle.putString(Constants.LIVE_STREAM, mStream); + bundle.putString(Constants.LIVE_WISH_GIFTID, mTopBannerList.get(position).getActivityId() + ""); + bundle.putBoolean("isContactGift", true); + fragment.setArguments(bundle); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment"); + } + } + }) + .start(); + LiveNetManager.get(mContext) + .getContactInfo(mLiveUid, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(LiveAnchorCallMeModel data) { + System.out.println(">>>>> 获取联系方式:" + data); + if (data.getIsShow() == 1) { + topBanner1.setVisibility(View.VISIBLE); + BannerBean call = new BannerBean(); + call.setActivityId(data.getGiftId()); + call.setType(TopBannerCustomViewHolder.TYPE_CALL_ANCHOR); + mTopBannerList.add(0, call); + topBanner1.update(mTopBannerList); + } + + } + + @Override + public void onError(String error) { + System.out.println("!>>>>> 获取联系方式:" + error); + } + }); + } + + private void checkNewLetter() { + LiveNetManager.get(mContext).getContactMsg(new com.yunbao.common.http.base.HttpCallback>() { + @Override + public void onSuccess(List data) { + for (LiveUserMailBoxModel model : data) { + if (model.getIsRead() == 0 && mContext instanceof LiveAudienceActivity) { + ((LiveAudienceActivity) mContext).showMsgRed(0); + return; + } + } + + } + + @Override + public void onError(String error) { + + } + }); + } } 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 5d1c3e7b7..fd0361d52 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -203,6 +203,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe ininView(); } + /** * 初始化布局 */ @@ -249,6 +250,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void run() { loading.setVisibility(View.GONE); + enterRoomLeaveHandler.post(enterRoomLeaveRunnable); } }; @@ -303,6 +305,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveLinkMicPresenter.setLiveSdk(mLiveSDK); mLiveLinkMicAnchorPresenter.setLiveSdk(mLiveSDK); } + if (mLiveRyLinkMicPkPresenter == null) { mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null); } @@ -323,6 +326,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLivePlayViewHolder.removeDetailView(); mLivePlayViewHolder.setCover(mLiveBean.getAvatar()); mLivePlayViewHolder.setLiveBeanLandscape(mLiveBean.getLandscape()); + mLiveRoomViewHolder.changeMessageLandscape(mLiveBean.getLandscape()); //mLivePlayViewHolder.play(mLiveBean.getPull(), LiveRoomPlayViewHolder.PLAY_MODEL_DEF); mLivePlayViewHolder.setOnMicCallback(new LiveRoomPlayViewHolder.OnMicCallback() { @Override @@ -333,7 +337,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } }); mLiveRoomViewHolder.resetView(); - + enterRoomModel.clear(); + enterRoomLeaveHandler.removeCallbacks(enterRoomLeaveRunnable); mLiveRoomViewHolder.setAvatar(data.getAvatar()); mLiveRoomViewHolder.setAnchorLevel(data.getLevelAnchor()); mLiveRoomViewHolder.setName(data.getUserNiceName()); @@ -408,13 +413,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.setAnchorGoodNumber(data.getLiveInfo().getGoodnum()); List bannerBeans = new ArrayList<>(); //心愿单 - if (data.getWishList().getWishList().size() > 0) { - BannerBean bannerModel = new BannerBean(); - bannerModel.setShow_type("2"); - bannerModel.setLink(CommonAppConfig.HOST + "/index.php"); - bannerModel.setImageUrl(data.getWishList().getImg()); - bannerBeans.add(bannerModel); - } +// if (data.getWishList().getWishList().size() > 0) { +// BannerBean bannerModel = new BannerBean(); +// bannerModel.setShow_type("2"); +// bannerModel.setLink(CommonAppConfig.HOST + "/index.php"); +// bannerModel.setImageUrl(data.getWishList().getImg()); +// bannerBeans.add(bannerModel); +// } //活动列表 if (data.getLiveRoomActivityModels().size() > 0) { @@ -466,10 +471,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe //数据设置 if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), Integer.parseInt(data.getEnterRoomInfo().getUserlistTime()) * 4000); - mLiveRoomViewHolder.setFastMessage(greetings); +// mLiveRoomViewHolder.setFastMessage(greetings); mLiveRoomViewHolder.setVotes(data.getEnterRoomInfo().getVotestotal()); //真爱排行 数量 mLiveRoomViewHolder.setMedaRankNum(data.getEnterRoomInfo().getMedalRankNum()); + //初始化女神说 + mLiveRoomViewHolder.initAnchorSay(); + //初始化顶部banner + mLiveRoomViewHolder.initTopBanner(); + isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention()); if (isattention == 0) { if (countDownTimer != null) { @@ -1003,15 +1013,54 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } + //高等级用户进入房间排序列表 + private List enterRoomModel = new ArrayList<>(); + private Handler enterRoomLeaveHandler = new Handler(); + private Runnable enterRoomLeaveRunnable = new Runnable() { + @Override + public void run() { + + if (enterRoomModel.size() > 0) { + if (mLiveRoomViewHolder != null) { + LiveUserGiftBean model = enterRoomModel.get(0); + mLiveRoomViewHolder.showHighGrade(model); + enterRoomModel.remove(0); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + mLiveRoomViewHolder.hideHighGrade(); + enterRoomLeaveHandler.post(enterRoomLeaveRunnable); + } + }, 3000); + } + + } else { + enterRoomLeaveHandler.postDelayed(enterRoomLeaveRunnable, 200); + } + } + }; + @Override public void onEnterRoom(LiveEnterRoomBean bean) { if (mLiveRoomViewHolder != null) { + if (!bean.getUserBean().getCar().getWords().equals("")) { bean.getLiveChatBean().setContent(bean.getUserBean().getCar().getWords()); } - mLiveRoomViewHolder.insertChat(bean.getLiveChatBean(), 1); + mLiveRoomViewHolder.onEnterRoom(bean); + LiveChatBean liveChatBean = bean.getLiveChatBean(); + LiveUserGiftBean liveUserGiftBean = bean.getUserBean(); + int level = liveUserGiftBean.getLevel(); + if (level >= 10) { + //高等级飘屏 + liveUserGiftBean.setUserNiceName(liveChatBean.getUserNiceName()); + enterRoomModel.add(liveUserGiftBean); + } else { + mLiveRoomViewHolder.insertChat(liveChatBean, 1); + } } + // } @Override @@ -1323,6 +1372,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe public void setPkStatus(boolean isPk) { if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.hotAddVisibility(isPk); + if (isPk) { + mLiveRoomViewHolder.hideAnchorSayAndCallAnchor(); + } else { + mLiveRoomViewHolder.showAnchorSayAndCallAnchor(); + } } } diff --git a/live/src/main/java/com/yunbao/live/views/TopBannerCustomViewHolder.java b/live/src/main/java/com/yunbao/live/views/TopBannerCustomViewHolder.java new file mode 100644 index 000000000..a9edba0e6 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/views/TopBannerCustomViewHolder.java @@ -0,0 +1,56 @@ +package com.yunbao.live.views; + +import android.content.Context; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.ImageView; + +import com.ms.banner.holder.BannerViewHolder; +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.BannerBean; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.SVGAViewUtils; +import com.yunbao.live.R; + +public class TopBannerCustomViewHolder implements BannerViewHolder { + public static final int TYPE_CALL_ANCHOR = 0;//联系主播 + public static final int TYPE_IMAGE = 1; + + @Override + public View createView(Context context, int position, BannerBean data) { + View view = null; + if (data.getType() == TYPE_IMAGE) { + ImageView icon = new ImageView(context); + if (data.getIconRes() != 0) { + ImgLoader.display(context, data.getIconRes(), icon); + } else { + ImgLoader.display(context, data.getImageUrl(), icon); + } + view = icon; + } else { + view = LayoutInflater.from(context).inflate(R.layout.view_live_top_banner_call_me, null); + SVGAImageView svga = view.findViewById(R.id.svga); + new SVGAParser(context).decodeFromAssets("ic_live_anchor_call_me.svga", new SVGAParser.ParseCompletion() { + @Override + public void onComplete(SVGAVideoEntity videoItem) { + SVGADrawable drawable = new SVGADrawable(videoItem); + svga.setImageDrawable(drawable); + svga.setTag("svga"); + SVGAViewUtils.playEndClear(svga, false); + svga.setClearsAfterStop(false); + } + + @Override + public void onError() { + Log.e("errqs", "errl"); + } + }, null); + } + + return view; + } +} diff --git a/live/src/main/res/anim/view_live_anchor_say_text_in.xml b/live/src/main/res/anim/view_live_anchor_say_text_in.xml new file mode 100644 index 000000000..b31b61750 --- /dev/null +++ b/live/src/main/res/anim/view_live_anchor_say_text_in.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/live/src/main/res/anim/view_live_anchor_say_text_out.xml b/live/src/main/res/anim/view_live_anchor_say_text_out.xml new file mode 100644 index 000000000..33a223e8b --- /dev/null +++ b/live/src/main/res/anim/view_live_anchor_say_text_out.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/background_100.xml b/live/src/main/res/drawable/background_100.xml new file mode 100644 index 000000000..4487ea7e8 --- /dev/null +++ b/live/src/main/res/drawable/background_100.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/background_30.xml b/live/src/main/res/drawable/background_30.xml new file mode 100644 index 000000000..60d5931c6 --- /dev/null +++ b/live/src/main/res/drawable/background_30.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/drawable/background_33ffffff.xml b/live/src/main/res/drawable/background_33ffffff.xml similarity index 100% rename from main/src/main/res/drawable/background_33ffffff.xml rename to live/src/main/res/drawable/background_33ffffff.xml diff --git a/live/src/main/res/drawable/background_50.xml b/live/src/main/res/drawable/background_50.xml new file mode 100644 index 000000000..8123a9ea2 --- /dev/null +++ b/live/src/main/res/drawable/background_50.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/background_60.xml b/live/src/main/res/drawable/background_60.xml new file mode 100644 index 000000000..c68d95213 --- /dev/null +++ b/live/src/main/res/drawable/background_60.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/background_80.xml b/live/src/main/res/drawable/background_80.xml new file mode 100644 index 000000000..d5cb5217c --- /dev/null +++ b/live/src/main/res/drawable/background_80.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/background_ff5075.xml b/live/src/main/res/drawable/background_ff5075.xml index 80250238c..7f7840437 100644 --- a/live/src/main/res/drawable/background_ff5075.xml +++ b/live/src/main/res/drawable/background_ff5075.xml @@ -3,7 +3,7 @@ - + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_100_leave.xml b/live/src/main/res/drawable/bg_100_leave.xml new file mode 100644 index 000000000..ffeadf36c --- /dev/null +++ b/live/src/main/res/drawable/bg_100_leave.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_30_leave.xml b/live/src/main/res/drawable/bg_30_leave.xml new file mode 100644 index 000000000..e61d5b00e --- /dev/null +++ b/live/src/main/res/drawable/bg_30_leave.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_50_leave.xml b/live/src/main/res/drawable/bg_50_leave.xml new file mode 100644 index 000000000..427d677fa --- /dev/null +++ b/live/src/main/res/drawable/bg_50_leave.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_60_leave.xml b/live/src/main/res/drawable/bg_60_leave.xml new file mode 100644 index 000000000..22ff20029 --- /dev/null +++ b/live/src/main/res/drawable/bg_60_leave.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_80_leave.xml b/live/src/main/res/drawable/bg_80_leave.xml new file mode 100644 index 000000000..3c3fa30ee --- /dev/null +++ b/live/src/main/res/drawable/bg_80_leave.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_anchor_say.xml b/live/src/main/res/drawable/bg_anchor_say.xml new file mode 100644 index 000000000..e698c0765 --- /dev/null +++ b/live/src/main/res/drawable/bg_anchor_say.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_anchor_say_select.xml b/live/src/main/res/drawable/bg_anchor_say_select.xml new file mode 100644 index 000000000..607704adc --- /dev/null +++ b/live/src/main/res/drawable/bg_anchor_say_select.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_item_live_user_mailbox_info_text.xml b/live/src/main/res/drawable/bg_item_live_user_mailbox_info_text.xml new file mode 100644 index 000000000..486ce2347 --- /dev/null +++ b/live/src/main/res/drawable/bg_item_live_user_mailbox_info_text.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_item_live_user_mailbox_top_text.xml b/live/src/main/res/drawable/bg_item_live_user_mailbox_top_text.xml new file mode 100644 index 000000000..4d55b339c --- /dev/null +++ b/live/src/main/res/drawable/bg_item_live_user_mailbox_top_text.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_item_live_user_mailbox_username_text.xml b/live/src/main/res/drawable/bg_item_live_user_mailbox_username_text.xml new file mode 100644 index 000000000..1808b740a --- /dev/null +++ b/live/src/main/res/drawable/bg_item_live_user_mailbox_username_text.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_gift_choose2.xml b/live/src/main/res/drawable/bg_live_gift_choose2.xml new file mode 100644 index 000000000..1d98da0af --- /dev/null +++ b/live/src/main/res/drawable/bg_live_gift_choose2.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_gift_item.xml b/live/src/main/res/drawable/bg_live_gift_item.xml index a2b443d6f..ad1941bd5 100644 --- a/live/src/main/res/drawable/bg_live_gift_item.xml +++ b/live/src/main/res/drawable/bg_live_gift_item.xml @@ -2,9 +2,8 @@ - + - diff --git a/live/src/main/res/drawable/bg_live_gift_items.xml b/live/src/main/res/drawable/bg_live_gift_items.xml index ab8df02fd..e4f8f778c 100644 --- a/live/src/main/res/drawable/bg_live_gift_items.xml +++ b/live/src/main/res/drawable/bg_live_gift_items.xml @@ -3,5 +3,5 @@ + android:color="#10ffffff" /> \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_gift_send.xml b/live/src/main/res/drawable/bg_live_gift_send.xml index c70485a41..25d5bc13b 100644 --- a/live/src/main/res/drawable/bg_live_gift_send.xml +++ b/live/src/main/res/drawable/bg_live_gift_send.xml @@ -3,7 +3,7 @@ - + diff --git a/live/src/main/res/drawable/bg_live_ready_btn2.xml b/live/src/main/res/drawable/bg_live_ready_btn2.xml new file mode 100644 index 000000000..f7cda2e72 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_ready_btn2.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_top_banner.xml b/live/src/main/res/drawable/bg_live_top_banner.xml new file mode 100644 index 000000000..bf21e74a3 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_top_banner.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_top_banner_text.xml b/live/src/main/res/drawable/bg_live_top_banner_text.xml new file mode 100644 index 000000000..1589f8921 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_top_banner_text.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/chat_message_bg.xml b/live/src/main/res/drawable/chat_message_bg.xml new file mode 100644 index 000000000..c63169e27 --- /dev/null +++ b/live/src/main/res/drawable/chat_message_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/icon_heat_new.png b/live/src/main/res/drawable/icon_heat_new.png new file mode 100644 index 000000000..a6f4784c2 Binary files /dev/null and b/live/src/main/res/drawable/icon_heat_new.png differ diff --git a/live/src/main/res/drawable/icon_time_new.png b/live/src/main/res/drawable/icon_time_new.png new file mode 100644 index 000000000..f0d2179ec Binary files /dev/null and b/live/src/main/res/drawable/icon_time_new.png differ diff --git a/live/src/main/res/drawable/rectangle_new.png b/live/src/main/res/drawable/rectangle_new.png new file mode 100644 index 000000000..4909ea802 Binary files /dev/null and b/live/src/main/res/drawable/rectangle_new.png differ diff --git a/live/src/main/res/layout/dialog_anchor_call_edit_app.xml b/live/src/main/res/layout/dialog_anchor_call_edit_app.xml new file mode 100644 index 000000000..a398e27b8 --- /dev/null +++ b/live/src/main/res/layout/dialog_anchor_call_edit_app.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + +