diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index 695b8c42e..6dea8b7ed 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -19,6 +19,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.alibaba.android.arouter.launcher.ARouter; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.Utils; import com.facebook.appevents.AppEventsLogger; import com.fm.openinstall.OpenInstall; @@ -34,6 +36,7 @@ import com.yunbao.common.BuildConfig; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; +import com.yunbao.common.bean.AnchorStartLiveBean; import com.yunbao.common.bean.CrashSaveBean; import com.yunbao.common.manager.imrongcloud.InstructorSendReward; import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider; @@ -44,6 +47,7 @@ import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.L; import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.live.socket.SocketReceiveBean; import com.yunbao.live.socket.SocketRyClient; import com.yunbao.live.utils.LiveImDeletUtil; import com.yunbao.live.views.PortraitLiveManager; @@ -201,11 +205,16 @@ public class AppContext extends CommonAppContext { && (TextUtils.equals("__system__", message.getTargetId()) || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) { SocketRyClient.mSocketHandler.sendMessage(msg); + } else if (content.getContent().contains("LivePK_anchorStartLiveNotify")) {//开播通知 + SocketReceiveBean received = JSON.parseObject(content.getContent(), SocketReceiveBean.class); + JSONObject map = received.getMsg().getJSONObject(0); + sendStartAnchorLive(map); } //主播页面 if (TextUtils.isEmpty(PortraitLiveManager.liveID) && SocketRyClient.mSocketHandler != null) { SocketRyClient.mSocketHandler.sendMessage(msg); } + } else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息 EventBus.getDefault().post(message); } @@ -215,6 +224,14 @@ public class AppContext extends CommonAppContext { } return false; } + + private void sendStartAnchorLive(JSONObject map) { + AnchorStartLiveBean bean = new AnchorStartLiveBean(); + bean.setAnchorName(map.getString("anchorName")); + bean.setRoomId(map.getString("roomid")); + bean.setAvatar(map.getString("avatar")); + EventBus.getDefault().post(bean); + } }); diff --git a/common/src/main/java/com/yunbao/common/bean/AnchorStartLiveBean.java b/common/src/main/java/com/yunbao/common/bean/AnchorStartLiveBean.java new file mode 100644 index 000000000..ab3160f99 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/AnchorStartLiveBean.java @@ -0,0 +1,31 @@ +package com.yunbao.common.bean; + +public class AnchorStartLiveBean extends BaseModel{ + private String anchorName; + private String avatar; + private String roomId; + + public String getAnchorName() { + return anchorName; + } + + public void setAnchorName(String anchorName) { + this.anchorName = anchorName; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public String getRoomId() { + return roomId; + } + + public void setRoomId(String roomId) { + this.roomId = roomId; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/UserBean.java b/common/src/main/java/com/yunbao/common/bean/UserBean.java index 0577d6263..29d3101d0 100644 --- a/common/src/main/java/com/yunbao/common/bean/UserBean.java +++ b/common/src/main/java/com/yunbao/common/bean/UserBean.java @@ -68,6 +68,8 @@ public class UserBean implements Parcelable { private String mRankPkImgUrl; //是否填写完整资料 private int user_info_complete; + //粉丝团等级 + private int fansLevel; public int getUserInfoComplete() { return user_info_complete; @@ -78,6 +80,14 @@ public class UserBean implements Parcelable { return this; } + public int getFansLevel() { + return fansLevel; + } + + public void setFansLevel(int fansLevel) { + this.fansLevel = fansLevel; + } + public boolean isRandomPk() { return randomPk; } 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 6c3775ea9..be1adad33 100644 --- a/common/src/main/java/com/yunbao/common/dialog/AbsDialogPopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/AbsDialogPopupWindow.java @@ -7,7 +7,9 @@ import androidx.annotation.NonNull; import com.lxj.xpopup.XPopup; import com.lxj.xpopup.core.BottomPopupView; - +/** + * 底部弹窗 + */ public abstract class AbsDialogPopupWindow extends BottomPopupView { public final Context mContext; diff --git a/common/src/main/java/com/yunbao/common/dialog/AbsDialogPositionPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/AbsDialogPositionPopupWindow.java new file mode 100644 index 000000000..ad87d8f7a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/AbsDialogPositionPopupWindow.java @@ -0,0 +1,39 @@ +package com.yunbao.common.dialog; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.lxj.xpopup.core.PositionPopupView; + +/** + * 自定义位置弹窗 + */ +public abstract class AbsDialogPositionPopupWindow extends PositionPopupView { + public final Context mContext; + + public AbsDialogPositionPopupWindow(@NonNull Context context) { + super(context); + this.mContext = context; + } + + /** + * 参考配置 + */ + public abstract void buildDialog(XPopup.Builder builder); + public abstract int bindLayoutId(); + + @Override + protected int getImplLayoutId() { + return bindLayoutId(); + } + + public void showDialog() { + XPopup.Builder builder = new XPopup.Builder(mContext); + builder.isDestroyOnDismiss(true); + builder.enableDrag(false); + buildDialog(builder); + builder.asCustom(this).show(); + } +} 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 0b00dabcf..73ea85e0c 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -47,6 +47,7 @@ public class IMLoginManager extends BaseCacheManager { private final String keyDefaultBubbleUrl = "defaultBubbleUrl"; private final String STATUS_ANCHOR_SAY = "anchorSay"; private final String STATUS_ANCHOR_CALL = "anchorCallMe"; + private final String LIVE_NOTIFY_SETTINGS = "liveNotifySettings";//开播通知 private final String KEY_LANGUAGE = "language"; @@ -354,6 +355,14 @@ public class IMLoginManager extends BaseCacheManager { return getBoolean(GiftEffect, !(Build.VERSION.SDK_INT < Build.VERSION_CODES.O)); } + public void setLiveNotifySettings(boolean isTrue) { + put(LIVE_NOTIFY_SETTINGS, isTrue); + } + + public boolean isLiveNotifySettings() { + return getBoolean(LIVE_NOTIFY_SETTINGS, true); + } + /** * 重新请求管理员身份信息 */ diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index 47e3da0db..658147b03 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1251,6 +1251,8 @@ Limited ride And limited avatar frame Red successfully Select System Avatar This function needs to be used to use it after lv.5, please work hard to upgrade ~ - + No matter where you are, I am waiting for you in the live broadcast room ~ + Watch + LiveNotify diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 514eb9059..87da15df1 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1246,4 +1246,8 @@ 红包发布成功 選擇系統頭像 該功能需升至Lv.5后使用,請努力升級吧~ + 無論你在哪裏,我都在直播間等你~ + 围观 + 開播通知 + diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 059b2de87..82149ed26 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1245,4 +1245,8 @@ 红包发布成功 選擇系統頭像 該功能需升至Lv.5后使用,請努力升級吧~ + 無論你在哪裏,我都在直播間等你~ + 围观 + 開播通知 + diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index e72161809..7aaa0dd99 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1246,6 +1246,8 @@ 红包发布成功 選擇系統頭像 該功能需升至Lv.5后使用,請努力升級吧~ - + 無論你在哪裏,我都在直播間等你~ + 围观 + 開播通知 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 95597dd4e..42713da40 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1252,4 +1252,7 @@ Limited ride And limited avatar frame >Red successfully Select System Avatar This function needs to be used to use it after lv.5, please work hard to upgrade ~ + No matter where you are, I am waiting for you in the live broadcast room ~ + Watch + LiveNotify diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveFansFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveFansFragment.java index 413d80a7e..0a1d21c8f 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveFansFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveFansFragment.java @@ -126,6 +126,7 @@ public class LiveFansFragment extends AbsDialogFragment { } else if (TextUtils.equals(event.getMethod(), "sendFansCard")) { if (LiveRoomViewHolder.mBtnFollow != null && LiveRoomViewHolder.mBtnFollow.getVisibility() == View.VISIBLE) { LiveRoomViewHolder.follow(); + ToastUtil.show(R.string.live_fans_follow_toast); } //点击 开通粉丝勋章,打开礼物列表送礼物 ((LiveAudienceActivity) mContext).openGiftWindow(event.getLiveId(), "0"); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveFansGroupBuyDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveFansGroupBuyDialog.java new file mode 100644 index 000000000..64097a08f --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveFansGroupBuyDialog.java @@ -0,0 +1,25 @@ +package com.yunbao.live.dialog; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.live.R; + +public class LiveFansGroupBuyDialog extends AbsDialogPopupWindow { + public LiveFansGroupBuyDialog(@NonNull Context context) { + super(context); + } + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_fans_group_buy; + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveFansGroupInfoDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveFansGroupInfoDialog.java new file mode 100644 index 000000000..ce6a67981 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveFansGroupInfoDialog.java @@ -0,0 +1,25 @@ +package com.yunbao.live.dialog; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.live.R; + +public class LiveFansGroupInfoDialog extends AbsDialogPopupWindow { + public LiveFansGroupInfoDialog(@NonNull Context context) { + super(context); + } + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_fans_group_info; + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveFansGroupSendGiftDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveFansGroupSendGiftDialog.java new file mode 100644 index 000000000..f156cd57c --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveFansGroupSendGiftDialog.java @@ -0,0 +1,25 @@ +package com.yunbao.live.dialog; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.live.R; + +public class LiveFansGroupSendGiftDialog extends AbsDialogPopupWindow { + public LiveFansGroupSendGiftDialog(@NonNull Context context) { + super(context); + } + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_fans_group_send; + } +} 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 15b0e9a59..704d65622 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -13,6 +13,7 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.SystemClock; +import android.text.Html; import android.text.TextUtils; import android.util.Log; import android.view.Gravity; @@ -151,7 +152,6 @@ import com.yunbao.live.dialog.LiveContactDetailsSendGiftDialog; 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.LiveUserAnchorMailBoxWebInfoPopDialog; import com.yunbao.live.dialog.LiveUserDialogFragment; @@ -324,7 +324,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private View btnEvent; private LinearLayout lt_trickery; private TextView tv_trickery_time; - private FrameLayout enterRoomLeave, enterRoomBg; + private FrameLayout enterRoomLeave, enterRoomBg, fans_enter_room_leave; private RecyclerView fastMsgRecyclerView; private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter; @@ -907,6 +907,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis btn_event2 = (LinearLayout) findViewById(R.id.btn_event2); btn_event4 = (LinearLayout) findViewById(R.id.btn_event4); enterRoomLeave = (FrameLayout) findViewById(R.id.enter_room_leave); + fans_enter_room_leave = (FrameLayout) findViewById(R.id.fans_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); @@ -1653,6 +1654,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis updataCleanMic(); // initStarChallengeStatus(); enterRoomLeave.setVisibility(View.GONE); + fans_enter_room_leave.setVisibility(View.GONE); topBanner1.setVisibility(View.GONE); topBanner2.setVisibility(View.GONE); topBanner1.update(mTopBannerList); @@ -4829,6 +4831,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mChatRecyclerView.setLayoutParams(params1); enterRoomLeave.setLayoutParams(enterRoomParams); + fans_enter_room_leave.setLayoutParams(enterRoomParams); } @@ -4841,6 +4844,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis userName.setText(String.format(mContext.getString(R.string.come_hint), model.getUserNiceName())); ImgLoader.display(mContext, model.getAvatar(), imageAvatar); int level = model.getLevel(); + model.setFansLevel(11); + if (model.getFansLevel() > 10) { + showFansGroupEnterRoom(); + return; + } if (level < 50) { enterRoomLeave.setBackgroundResource(R.drawable.background_30); enterRoomLeave2.setBackgroundResource(R.drawable.bg_30_leave); @@ -4899,6 +4907,69 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } + private void showFansGroupEnterRoom() { + fans_enter_room_leave.post(() -> { + TextView userName = fans_enter_room_leave.findViewById(R.id.user_name); + userName.setText(Html.fromHtml(String.format("@%s 粉絲團成員歡迎進房", "测试"))); + new LoadDian9TuUtil().loadDian9Tu(mContext, fans_enter_room_leave, + "https://downs.yaoulive.com/20230322/g5_.9.png" + , 1); + fans_enter_room_leave.setVisibility(View.VISIBLE); + TranslateAnimation animationTranslate = new TranslateAnimation(DeviceUtils.getScreenWidth((Activity) mContext), 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) { + mLiveRoomHandler.postDelayed(() -> hideFansGroupEnter(), 3000); + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + fans_enter_room_leave.startAnimation(animationSet1); + }); + + } + + /** + * 隐藏粉丝团入场提示 + */ + public void hideFansGroupEnter() { + if (fans_enter_room_leave.getVisibility() == View.GONE) return; + TranslateAnimation animationTranslate = new TranslateAnimation(0, -(fans_enter_room_leave.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) { + fans_enter_room_leave.setVisibility(View.GONE); + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + fans_enter_room_leave.startAnimation(animationSet1); + } + /** * 隐藏高等级入场提示 */ @@ -5278,11 +5349,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mLiveGiftAnimPresenter.showSendGiftAnimAllServer2(receiveGiftBean); mLiveGiftAnimPresenter.setLiveUidStream(mLiveUid, mStream); } - public void sendWelcomeFans(){ + + public void sendWelcomeFans() { LiveChatBean chatBean = new LiveChatBean(); chatBean.setContent("123123test1243"); chatBean.setType(LiveChatBean.SYSTEM3_COLOR); chatBean.setBubble("https://downs.yaoulive.com/20230322/g2_.9.png"); - insertChat(chatBean,1); + insertChat(chatBean, 1); } } diff --git a/live/src/main/res/layout/dialog_fens_group_buy.xml b/live/src/main/res/layout/dialog_fans_group_buy.xml similarity index 97% rename from live/src/main/res/layout/dialog_fens_group_buy.xml rename to live/src/main/res/layout/dialog_fans_group_buy.xml index 0b77223d5..5ac4251f7 100644 --- a/live/src/main/res/layout/dialog_fens_group_buy.xml +++ b/live/src/main/res/layout/dialog_fans_group_buy.xml @@ -72,7 +72,7 @@ app:layout_constraintTop_toBottomOf="@+id/giftInfo" tools:itemCount="3" - tools:listitem="@layout/item_fens_group_buy_list" /> + tools:listitem="@layout/item_fans_group_buy_list" /> + tools:listitem="@layout/item_fans_group_package_list" /> \ No newline at end of file diff --git a/live/src/main/res/layout/item_fens_group_buy_list.xml b/live/src/main/res/layout/item_fans_group_buy_list.xml similarity index 100% rename from live/src/main/res/layout/item_fens_group_buy_list.xml rename to live/src/main/res/layout/item_fans_group_buy_list.xml diff --git a/live/src/main/res/layout/item_fens_group_package_list.xml b/live/src/main/res/layout/item_fans_group_package_list.xml similarity index 100% rename from live/src/main/res/layout/item_fens_group_package_list.xml rename to live/src/main/res/layout/item_fans_group_package_list.xml diff --git a/live/src/main/res/layout/view_fans_group_enter_room_leave.xml b/live/src/main/res/layout/view_fans_group_enter_room_leave.xml new file mode 100644 index 000000000..38421e1d8 --- /dev/null +++ b/live/src/main/res/layout/view_fans_group_enter_room_leave.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_funs_live_anchor_start_notify.xml b/live/src/main/res/layout/view_funs_live_anchor_start_notify.xml index c2fab6eb5..43c6443be 100644 --- a/live/src/main/res/layout/view_funs_live_anchor_start_notify.xml +++ b/live/src/main/res/layout/view_funs_live_anchor_start_notify.xml @@ -37,7 +37,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:text="TextView" + android:text="@string/main_anchor_live_notify_info" android:textSize="13sp" android:textColor="#CCFFFFFF" app:layout_constraintStart_toStartOf="@+id/anchorName" @@ -52,10 +52,11 @@ android:gravity="center" android:textColor="#FFFEF3" android:textSize="12sp" + android:text="@string/main_anchor_live_notify_live" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" - tools:text="圍觀" /> + /> \ 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 7e621c3d3..06675532d 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -223,6 +223,15 @@ android:layout_marginStart="3dp" android:layout_marginBottom="-350dp" android:visibility="gone" /> + 2. The final interpretation rights of this gift package belong to PD Live Introduction Rules + Join the fan group and unlock exclusive gifts \ 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 867471569..ddecb9f51 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -105,4 +105,5 @@ 2. 该禮包最終解釋權歸 PD Live 所有 禮包介紹 購買規則 + 加入粉絲團,解鎖專屬禮物 diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index ede574312..85982f259 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -58,6 +58,7 @@ import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.adapter.ViewPagerAdapter; import com.yunbao.common.bean.AnchorRecommendModel; +import com.yunbao.common.bean.AnchorStartLiveBean; import com.yunbao.common.bean.ChatRemarksBean; import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.bean.IMLoginModel; @@ -107,6 +108,7 @@ import com.yunbao.live.utils.LiveStorge; import com.yunbao.live.views.ChatListViewHolder; import com.yunbao.main.R; import com.yunbao.main.adapter.FullAdToBannerTransition; +import com.yunbao.main.dialog.AnchorStartLiveNotifyDialog; import com.yunbao.main.dialog.MainStartDialogFragment; import com.yunbao.main.dialog.ReturnUserDialog; import com.yunbao.main.dialog.SigninDialog; @@ -194,6 +196,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene private boolean isfloatBannernet = true, isFirst = true; private View floatRedPacket; + private List startListNotifyList = new ArrayList<>(); @Override @@ -1019,6 +1022,18 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onNotifyAnchorLive(AnchorStartLiveBean bean) { + if (!IMLoginManager.get(mContext).isLiveNotifySettings()) return; + + if (startListNotifyList.isEmpty()) { + startListNotifyList.add(bean); + notifyLiveFlot(); + } else { + startListNotifyList.add(bean); + } + } + @Override public void onBackPressed() { if (isTabClose && isWebClose) { @@ -1039,6 +1054,20 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } } + private void notifyLiveFlot() { + if (startListNotifyList.iterator().hasNext()) { + AnchorStartLiveBean bean = startListNotifyList.iterator().next(); + new AnchorStartLiveNotifyDialog(mContext, bean) + .setOnDismissListener(dialog -> { + startListNotifyList.remove(bean); + if (startListNotifyList.iterator().hasNext()) { + notifyLiveFlot(); + } + }) + .showDialog(); + } + } + private void loadPageData(int position, boolean needlLoadData) { if (mViewHolders == null) { diff --git a/main/src/main/java/com/yunbao/main/activity/SettingActivity.java b/main/src/main/java/com/yunbao/main/activity/SettingActivity.java index 547a8334b..d55dcefda 100644 --- a/main/src/main/java/com/yunbao/main/activity/SettingActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/SettingActivity.java @@ -66,6 +66,7 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener< private Handler mHandler; private SettingAdapter mAdapter; private ImageView studioGiftEffects, studioRideEffects, upSlideSettings, appWindow, systemWindow; + private ImageView liveNotifySettings; private boolean giftEffect, mountEffect, slide, isFloat; private TextView systemHit, reward; @@ -81,6 +82,7 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener< studioGiftEffects = findViewById(R.id.studio_gift_effects); studioRideEffects = findViewById(R.id.studio_ride_effects); upSlideSettings = findViewById(R.id.up_slide_settings); + liveNotifySettings = findViewById(R.id.live_notify_settings); appWindow = findViewById(R.id.app_window); reward = findViewById(R.id.reward); systemHit = findViewById(R.id.system_hit); @@ -237,6 +239,15 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener< }); } ); + ViewClicksAntiShake.clicksAntiShake(liveNotifySettings, () -> { + boolean isTrue = IMLoginManager.get(mContext).isLiveNotifySettings(); + if (isTrue) { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, liveNotifySettings); + } else { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, liveNotifySettings); + } + IMLoginManager.get(mContext).setLiveNotifySettings(!isTrue); + }); SpannableStringBuilder builder = new SpannableStringBuilder(getString(com.yunbao.common.R.string.system_window_hint)); String goTo = getString(com.yunbao.common.R.string.to_open_the); int star = builder.length(); @@ -274,6 +285,11 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener< } else { ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, studioRideEffects); } + if(IMLoginManager.get(mContext).isLiveNotifySettings()){ + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, liveNotifySettings); + }else{ + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, liveNotifySettings); + } } diff --git a/main/src/main/java/com/yunbao/main/dialog/AnchorStartLiveNotifyDialog.java b/main/src/main/java/com/yunbao/main/dialog/AnchorStartLiveNotifyDialog.java new file mode 100644 index 000000000..51eafe958 --- /dev/null +++ b/main/src/main/java/com/yunbao/main/dialog/AnchorStartLiveNotifyDialog.java @@ -0,0 +1,107 @@ +package com.yunbao.main.dialog; + +import android.content.Context; +import android.content.DialogInterface; +import android.os.Handler; +import android.os.Looper; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.alibaba.fastjson.JSON; +import com.lxj.xpopup.XPopup; +import com.lxj.xpopup.enums.PopupAnimation; +import com.yunbao.common.bean.AnchorStartLiveBean; +import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.custom.RatioRoundImageView; +import com.yunbao.common.dialog.AbsDialogPositionPopupWindow; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.RouteUtil; +import com.yunbao.live.http.LiveHttpUtil; +import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; +import com.yunbao.main.R; + +public class AnchorStartLiveNotifyDialog extends AbsDialogPositionPopupWindow { + private AnchorStartLiveBean liveBean; + private DialogInterface.OnDismissListener onDismissListener; + + private TextView anchorName; + private RatioRoundImageView avatar; + + + public AnchorStartLiveNotifyDialog(@NonNull Context context) { + super(context); + } + + public AnchorStartLiveNotifyDialog(@NonNull Context context, AnchorStartLiveBean bean) { + super(context); + this.liveBean = bean; + } + + public AnchorStartLiveNotifyDialog setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) { + this.onDismissListener = onDismissListener; + return this; + } + + @Override + public void buildDialog(XPopup.Builder builder) { + builder.positionByWindowCenter(true); + builder.moveUpToKeyboard(false); + builder.dismissOnTouchOutside(false); + builder.dismissOnBackPressed(false); + builder.isTouchThrough(true); + builder.isClickThrough(true); + builder.isCenterHorizontal(true); + builder.hasShadowBg(false); + builder.animationDuration(500); + builder.popupAnimation(PopupAnimation.ScaleAlphaFromCenter); + builder.offsetY(DpUtil.dp2px(60)); + } + + @Override + public int bindLayoutId() { + return R.layout.view_funs_live_anchor_start_notify; + } + + @Override + protected void onCreate() { + super.onCreate(); + findViewById(R.id.liveGo).setOnClickListener(v -> { + LiveHttpUtil.getLiveInfo(liveBean.getRoomId(), new HttpCallback() { + + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + } + } + }); + }); + avatar = findViewById(R.id.avatar); + anchorName = findViewById(R.id.anchorName); + ImgLoader.display(mContext, liveBean.getAvatar(), avatar); + anchorName.setText(liveBean.getAnchorName()); + + + new Handler(Looper.getMainLooper()).postDelayed(() -> { + dismiss(); + if (onDismissListener != null) { + onDismissListener.onDismiss(null); + } + }, 5000); + } + +} diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java index 7b559dec5..551d97f44 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java @@ -1,16 +1,12 @@ package com.yunbao.main.views; import android.content.Context; -import android.content.Intent; -import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; import com.yunbao.common.glide.ImgLoader; -import com.yunbao.common.utils.RouteUtil; import com.yunbao.main.R; -import com.yunbao.main.activity.RedPacketListActivity; /** * Created by cxf on 2018/9/22. diff --git a/main/src/main/res/layout/activity_setting.xml b/main/src/main/res/layout/activity_setting.xml index 4017b0080..def612d3b 100644 --- a/main/src/main/res/layout/activity_setting.xml +++ b/main/src/main/res/layout/activity_setting.xml @@ -368,6 +368,35 @@ android:layout_marginEnd="26.33dp" android:src="@mipmap/special_icon_off" /> + + + + + + + + + +