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/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/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/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 6c3f99b6d..92857c5f6 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -22,6 +22,7 @@ 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; @@ -595,7 +596,7 @@ public interface PDLiveApi { * */ @GET("/api/public/?service=Live.setLivePreview") - Observable> setLivePreviewInfo( + Observable> setLivePreviewInfo( @Query("liveuid") String liveUid, @Query("isShow") int isShow, @Query("content") String content, @@ -623,5 +624,16 @@ public interface PDLiveApi { 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/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index a70d6349e..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 @@ -24,6 +24,7 @@ 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; @@ -1167,14 +1168,14 @@ public class LiveNetManager { /** * 设置女神说 * - * @param isShow 是否显示 - * @param content 内容 + * @param isShow 是否显示 + * @param content 内容 * @param styleImage 女神说底图地址 */ public void setLivePreviewInfo(String liveUid, - int isShow, - String content, - String styleImage, HttpCallback callback) { + int isShow, + String content, + String styleImage, HttpCallback callback) { API.get().pdLiveApi(mContext) .setLivePreviewInfo(liveUid, isShow, content, styleImage) .subscribeOn(Schedulers.io()) @@ -1192,8 +1193,9 @@ public class LiveNetManager { /** * 设置主播联系方式 - * @param liveUid 直播间id - * @param callMe 载体 + * + * @param liveUid 直播间id + * @param callMe 载体 * @param callback 回调 */ public void setAnchorCallMe(String liveUid, @@ -1219,6 +1221,28 @@ public class LiveNetManager { } }).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(); + } + /** * 获取主播联系方式 * @@ -1240,6 +1264,29 @@ public class LiveNetManager { } }).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..bae066a52 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,9 @@ public class IMLoginManager extends BaseCacheManager { private final String SELECT_CLARITY = "selectClarity"; private final String CLARITY = "clarity"; private final String xiaJBG = "xiaJBG"; + private final String STATUS_ANCHOR_SAY = "anchorSay"; + private final String STATUS_ANCHOR_CALL = "anchorCallMe"; + public void setXiaJBG(boolean xjbg) { put(xiaJBG, xjbg); @@ -84,6 +87,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/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/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/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/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/strings.xml b/common/src/main/res/values/strings.xml index 0d9896c02..c0e7312b1 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -734,6 +734,8 @@ 語音連麥 周星榜 暫時離開 + 聯繫方式 + 女神說 恢復直播 請輸入數字 您是當前主播的周守護\n守護日期截止到 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..1361344f5 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; @@ -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/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/adapter/LiveAnchorEditCallMeAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveAnchorEditCallMeAdapter.java index 60790aba4..692b24e30 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveAnchorEditCallMeAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveAnchorEditCallMeAdapter.java @@ -22,6 +22,7 @@ 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; @@ -38,12 +39,9 @@ public class LiveAnchorEditCallMeAdapter extends RecyclerView.Adapter onItemClickListener; private List list = new ArrayList<>(); - private String mLiveUid = "98275"; - private View mParent; - public LiveAnchorEditCallMeAdapter(Context mContext, View parent) { + public LiveAnchorEditCallMeAdapter(Context mContext) { this.mContext = mContext; - this.mParent = parent; } public void setList(List list) { @@ -179,7 +177,7 @@ public class LiveAnchorEditCallMeAdapter extends RecyclerView.Adapter { if (StringUtil.isEmpty((String) contact.getTag())) { - ToastUtil.show("请填写联系方式后再启用"); + ToastUtil.show(WordUtil.getString(R.string.live_anchor_edit_call_me_not_filled_toash)); return; } int tag = (int) v.getTag(); @@ -275,7 +273,7 @@ public class LiveAnchorEditCallMeAdapter 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/dialog/LiveAnchorEditCallMeDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorEditCallMeDialog.java index 7be1009f9..01ed583ec 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveAnchorEditCallMeDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorEditCallMeDialog.java @@ -8,13 +8,14 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.lxj.xpopup.XPopup; -import com.yunbao.common.bean.BaseModel; 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; @@ -22,11 +23,12 @@ import java.util.ArrayList; import java.util.List; public class LiveAnchorEditCallMeDialog extends AbsDialogPopupWindow { - String mLiveUid = "98275"; + String mLiveUid = ""; RecyclerView list; LiveAnchorCallMeModel callMeModel; LiveAnchorEditCallMeAdapter adapter; ImageView status; + OnItemClickListener onItemClickListener; public LiveAnchorEditCallMeDialog(@NonNull Context context) { super(context); @@ -38,6 +40,11 @@ public class LiveAnchorEditCallMeDialog extends AbsDialogPopupWindow { builder.autoFocusEditText(false); } + public LiveAnchorEditCallMeDialog setOnItemClickListener(OnItemClickListener onItemClickListener) { + this.onItemClickListener = onItemClickListener; + return this; + } + @Override public int bindLayoutId() { return R.layout.dialog_anchor_call_me; @@ -55,6 +62,15 @@ public class LiveAnchorEditCallMeDialog extends AbsDialogPopupWindow { .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)); @@ -63,11 +79,10 @@ public class LiveAnchorEditCallMeDialog extends AbsDialogPopupWindow { 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); - } - - @Override - public void onError(String error) { - + if (callMeModel.getIsShow() == 1) { + status.setImageResource(R.mipmap.special_icon_on); + status.setTag(1); + } } }); @@ -77,7 +92,7 @@ public class LiveAnchorEditCallMeDialog extends AbsDialogPopupWindow { 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(), getRootView()); + adapter = new LiveAnchorEditCallMeAdapter(getContext()); adapter.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(LiveAnchorEditCallMeAdapter.TmpData bean, int position) { @@ -124,7 +139,7 @@ public class LiveAnchorEditCallMeDialog extends AbsDialogPopupWindow { .setAnchorCallMe(mLiveUid, callMeModel, new HttpCallback() { @Override public void onSuccess(String data) { - ToastUtil.show("成功"); + ToastUtil.show(WordUtil.isZh() ? "成功" : "success"); } @Override @@ -132,5 +147,14 @@ public class LiveAnchorEditCallMeDialog extends AbsDialogPopupWindow { 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/LiveAnchorSayPopDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java index db856e5ec..7ee0fe1b9 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveAnchorSayPopDialog.java @@ -23,7 +23,9 @@ 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; @@ -41,6 +43,8 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow { EditText sayEdit; String mLiveUid; String url; + LiveAnchorSayModel sayModel; + OnItemClickListener onItemClickListener; public LiveAnchorSayPopDialog(@NonNull Context context) { super(context); @@ -51,6 +55,11 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow { return this; } + public LiveAnchorSayPopDialog setOnItemClickListener(OnItemClickListener onItemClickListener) { + this.onItemClickListener = onItemClickListener; + return this; + } + @Override public void buildDialog(XPopup.Builder builder) { builder.autoFocusEditText(false); @@ -95,10 +104,11 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow { 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); } }); @@ -110,7 +120,7 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { - + sayModel.getLivePreview().setContent(s.toString()); StringBuilder sb = new StringBuilder(); int n = (s.length() + 3) / 4; for (int i = 0; i < n; i++) { @@ -142,13 +152,14 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow { LiveNetManager.get(getContext()) .setLivePreviewInfo( mLiveUid, - saySwitch.getTag() == null ? 0 : 1, + sayModel.getLivePreview().getIsShow(), edit, url, - new HttpCallback() { + new HttpCallback() { @Override - public void onSuccess(HttpCallbackModel data) { + public void onSuccess(String data) { Log.i("女神说", "onSuccess: " + data); + ToastUtil.show(WordUtil.isZh() ? "成功" : "success"); } @Override @@ -157,7 +168,10 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow { } } ); - + if (onItemClickListener != null) { + onItemClickListener.onItemClick(sayModel, 0); + } + IMLoginManager.get(getContext()).setAnchorSayStatus(sayModel.getLivePreview().getIsShow()); } private void initData() { @@ -165,6 +179,7 @@ public class LiveAnchorSayPopDialog extends AbsDialogPopupWindow { .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(); 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..f655da606 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java @@ -116,6 +116,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 +192,10 @@ 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).showDialog(); } } 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/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/LiveNewReadyRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveNewReadyRyViewHolder.java index 51ce764c1..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,7 @@ 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; @@ -198,6 +202,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl 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() { @@ -392,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 @@ -540,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) @@ -569,7 +586,9 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl .append(model.getToken()); RouteUtil.forwardLiveZhuangBanActivity(url.toString(), false); } else if (i == R.id.btn_live_anchor_say) { - new LiveAnchorSayPopDialog(mContext).setLiveUid(mLiveUid).showDialog(); + openAnchorSayDialog(); + } else if (i == R.id.btn_live_anchor_call_me) { + openAnchorCallMeDialog(); } } @@ -601,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) { 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 ce67758e7..537be4780 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -6,6 +6,7 @@ import static com.yunbao.live.views.LivePushRyViewHolder.btn_close; import android.app.Activity; import android.app.Dialog; import android.content.Context; +import android.content.DialogInterface; import android.graphics.Outline; import android.os.Bundle; import android.os.CountDownTimer; @@ -68,11 +69,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; @@ -137,6 +140,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; @@ -296,6 +300,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private List mBannerList2 = new ArrayList<>(); private List mBannerList3 = new ArrayList<>(); private List mBannerList4 = new ArrayList<>(); + private List mTopBannerList = new ArrayList<>(); private LinearLayout btn_event2, btn_event3, btn_event4; private ImageView imgEvent; private View btnEvent; @@ -341,6 +346,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis 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); @@ -836,6 +842,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis 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); @@ -1140,6 +1147,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)); @@ -4293,4 +4306,77 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } }); } + + private static final int TOP_BANNER_TYPE_CALL_ME = 100;//联系方式 + + public void initTopBanner() { + checkNewLetter(); + mTopBannerList = new ArrayList<>(); + topBanner1.setAutoPlay(true) + .setPages(mTopBannerList, new Banner4CustomViewHolder()) + .setDelayTime(3000) + .setBannerStyle(BannerConfig.NOT_INDICATOR) + .setOnBannerClickListener(new OnBannerClickListener() { + @Override + public void onBannerClick(List datas, int position) { + if (mTopBannerList.get(position).getType() == TOP_BANNER_TYPE_CALL_ME) { + 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); + BannerBean call = new BannerBean(); + call.setIconRes(R.mipmap.ic_live_float_call_me); + call.setActivityId(data.getGiftId()); + call.setType(TOP_BANNER_TYPE_CALL_ME); + 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 54fc2e672..23c6dc4fe 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -472,6 +472,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.setMedaRankNum(data.getEnterRoomInfo().getMedalRankNum()); //初始化女神说 mLiveRoomViewHolder.initAnchorSay(); + //初始化顶部banner + mLiveRoomViewHolder.initTopBanner(); isattention = Integer.parseInt(data.getEnterRoomInfo().getIsattention()); if (isattention == 0) { 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/layout/dialog_anchor_call_me.xml b/live/src/main/res/layout/dialog_anchor_call_me.xml index d9fc14f5f..096e3639f 100644 --- a/live/src/main/res/layout/dialog_anchor_call_me.xml +++ b/live/src/main/res/layout/dialog_anchor_call_me.xml @@ -32,7 +32,7 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_weight="1" - android:text="編輯聯系方式" + android:text="@string/live_anchor_edit_call_me_title" android:textColor="#FFFFFF" android:textSize="16sp" /> @@ -86,7 +86,7 @@ android:layout_marginStart="16dp" android:layout_weight="1" android:gravity="center|start" - android:text="聯系方式開關" + android:text="@string/live_anchor_edit_call_me_switch" android:textColor="#FFFFFF" android:textSize="16sp" /> diff --git a/live/src/main/res/layout/dialog_anchor_say.xml b/live/src/main/res/layout/dialog_anchor_say.xml index 1b6d25537..94ebe87a1 100644 --- a/live/src/main/res/layout/dialog_anchor_say.xml +++ b/live/src/main/res/layout/dialog_anchor_say.xml @@ -42,7 +42,7 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_weight="1" - android:text="編輯女神說" + android:text="@string/live_anchor_say_title" android:textColor="#FFFFFF" android:textSize="16sp" /> @@ -75,7 +75,7 @@ android:autofillHints="" android:background="@drawable/bg_item_random_pk_type_1" android:ems="10" - android:hint="请輸入女神想說的話,限16個字哦。" + android:hint="@string/live_anchor_say_edit_hint" android:inputType="textPersonName" android:maxLength="16" android:paddingStart="16dp" @@ -93,7 +93,7 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginTop="16dp" - android:text="选择样式" + android:text="@string/live_anchor_say_select_style" android:textColor="#FFFFFF" android:textSize="12sp" app:layout_constraintStart_toStartOf="parent" @@ -130,7 +130,7 @@ android:layout_marginStart="16dp" android:layout_weight="1" android:gravity="center|start" - android:text="女神說開關" + android:text="@string/live_anchor_say_switch" android:textColor="#FFFFFF" android:textSize="16sp" /> diff --git a/live/src/main/res/layout/dialog_live_gift_wrap.xml b/live/src/main/res/layout/dialog_live_gift_wrap.xml index bfb498451..39a19a1fa 100644 --- a/live/src/main/res/layout/dialog_live_gift_wrap.xml +++ b/live/src/main/res/layout/dialog_live_gift_wrap.xml @@ -20,9 +20,10 @@ android:background="@drawable/bg_live_gift_download_all" android:gravity="center" android:orientation="horizontal" - android:visibility="invisible"> + android:visibility="gone"> diff --git a/live/src/main/res/layout/dialog_live_user_mailbox.xml b/live/src/main/res/layout/dialog_live_user_mailbox.xml new file mode 100644 index 000000000..219556f99 --- /dev/null +++ b/live/src/main/res/layout/dialog_live_user_mailbox.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_user_mailbox_web.xml b/live/src/main/res/layout/dialog_live_user_mailbox_web.xml new file mode 100644 index 000000000..e430fd78d --- /dev/null +++ b/live/src/main/res/layout/dialog_live_user_mailbox_web.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/item_anchor_call_me_app.xml b/live/src/main/res/layout/item_anchor_call_me_app.xml index 792fdf20f..1e9fa4167 100644 --- a/live/src/main/res/layout/item_anchor_call_me_app.xml +++ b/live/src/main/res/layout/item_anchor_call_me_app.xml @@ -28,7 +28,7 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginTop="24dp" - android:text="未填写" + android:text="@string/live_anchor_edit_call_me_not_filled" android:textSize="16sp" android:textColor="#80FFFFFF" app:layout_constraintStart_toEndOf="@+id/gift_icon" diff --git a/live/src/main/res/layout/item_anchor_call_me_gift.xml b/live/src/main/res/layout/item_anchor_call_me_gift.xml index 8c095df32..fbb80c360 100644 --- a/live/src/main/res/layout/item_anchor_call_me_gift.xml +++ b/live/src/main/res/layout/item_anchor_call_me_gift.xml @@ -41,7 +41,7 @@ android:layout_marginStart="12dp" android:layout_marginTop="6dp" android:layout_marginBottom="6dp" - android:text="選擇禮物" + android:text="@string/live_anchor_edit_call_me_select_gift" android:textColor="@color/white" android:textSize="12sp" app:layout_constraintBottom_toBottomOf="parent" diff --git a/live/src/main/res/layout/item_anchor_call_me_letter.xml b/live/src/main/res/layout/item_anchor_call_me_letter.xml index c853b288f..850ee1aaf 100644 --- a/live/src/main/res/layout/item_anchor_call_me_letter.xml +++ b/live/src/main/res/layout/item_anchor_call_me_letter.xml @@ -16,7 +16,7 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginTop="14dp" - android:text="信內容" + android:text="@string/live_anchor_edit_call_me_letter_title" android:textColor="@color/white" android:textSize="12sp" app:layout_constraintStart_toStartOf="parent" @@ -39,7 +39,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="16dp" android:ellipsize="none" - android:text="我能想到最浪漫的事,就是和你一起慢慢變老,一路上收藏點點滴滴的歡笑,留到以後坐著搖椅慢慢聊。" + android:text="@string/live_anchor_edit_call_me_letter_content" android:textColor="@color/white" android:textSize="16sp" app:layout_constraintEnd_toEndOf="parent" diff --git a/live/src/main/res/layout/item_live_user_mailbox.xml b/live/src/main/res/layout/item_live_user_mailbox.xml new file mode 100644 index 000000000..214b7025d --- /dev/null +++ b/live/src/main/res/layout/item_live_user_mailbox.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index ed31db548..e55a28040 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -673,7 +673,18 @@ - + + + + app:srcCompat="@mipmap/ic_live_ready_say" /> + + + + + + + + Please enter the anchor nickname or id you want to pk The other team is engaged in a PK The PK number is used up + 来自%s的信 + 「%s」有更多話對你說 \ No newline at end of file diff --git a/live/src/main/res/values/strings.xml b/live/src/main/res/values/strings.xml index cef5b3236..d8b84b36b 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -65,4 +65,25 @@ 本場直播數據統計 歷史數據可在主播中心查看 * 人數及新增相關數據非实时计算 + 来自%s的信 + 「%s」有更多話對你說 + 查看詳情 + 來自「%s」的信 + 編輯聯系方式 + 聯系方式開關 + 選擇禮物 + 未填寫 + 请填写联系方式后再启用 + 信內容 + 我能想到最浪漫的事,就是和你一起慢慢變老,一路上收藏點點滴滴的歡笑,留到以後坐著搖椅慢慢聊。 + 聯繫方式 + 編輯女神說 + 请輸入女神想說的話,限16個字哦。 + 选择样式 + 女神說開關 + 刪除郵件 + 是否確認刪除此郵件 + 刪除 + 再想想 +