diff --git a/common/src/main/java/com/yunbao/common/event/HideShowEvent.java b/common/src/main/java/com/yunbao/common/event/HideShowEvent.java new file mode 100644 index 000000000..d4cc47921 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/HideShowEvent.java @@ -0,0 +1,16 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +public class HideShowEvent extends BaseModel { +private boolean isClose = false; + + public boolean isClose() { + return isClose; + } + + public HideShowEvent setClose(boolean close) { + isClose = close; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/ShowHideEvent.java b/common/src/main/java/com/yunbao/common/event/ShowHideEvent.java new file mode 100644 index 000000000..ce281c008 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/ShowHideEvent.java @@ -0,0 +1,7 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +public class ShowHideEvent extends BaseModel { + +} 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 430117466..6de7f1981 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -61,6 +61,14 @@ public class IMLoginManager extends BaseCacheManager { return !TextUtils.isEmpty(getString("RedPoint")) && !TextUtils.equals(getString("RedPoint"), "1"); } + public void setSudGameMin() { + put("SudGameMin", "1"); + } + + public boolean getSudGameMin() { + return !TextUtils.isEmpty(getString("SudGameMin")) && !TextUtils.equals(getString("SudGameMin"), "1"); + } + public void setSudGame(String sudGameJson) { put(KEY_GAME, sudGameJson); } diff --git a/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java index c71307dca..e3663c012 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java @@ -9,12 +9,15 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.lifecycle.Observer; +import com.lxj.xpopup.XPopup; import com.lxj.xpopup.core.BottomPopupView; import com.makeramen.roundedimageview.RoundedImageView; import com.yunbao.common.R; import com.yunbao.common.bean.CheckRemainingBalance; import com.yunbao.common.bean.CreateSudRoomModel; import com.yunbao.common.event.CheckRemainingBalanceEvent; +import com.yunbao.common.event.HideShowEvent; +import com.yunbao.common.event.ShowHideEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; @@ -92,6 +95,38 @@ public class LiveSudGamePopup extends BottomPopupView { dialog.dismiss(); } }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.min_game), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (IMLoginManager.get(getContext()).getSudGameMin()) { + dialog.hide(); + Bus.get().post(new ShowHideEvent()); + } else { + new XPopup.Builder(getContext()) + .asCustom(new HintCustomPopup(getContext(), + getContext().getString(R.string.dialog_tip), + getContext().getString(R.string.currently_in_the_game)) + .setLiveOpenOk(getContext().getString(R.string.sud_in_game_minimize)) + .setLiveOpenCancel(getContext().getString(R.string.cancel)) + .setCallBack(new HintCustomPopup.HintCustomCallBack() { + @Override + public void onSure() { + IMLoginManager.get(getContext()).setSudGameMin(); + dialog.hide(); + Bus.get().post(new ShowHideEvent()); + } + + @Override + public void onCancel() { + + + } + })).show(); + } + + + } + }); gameViewModel.gameViewLiveData.observe(this, new Observer() { @Override public void onChanged(View view) { @@ -126,6 +161,16 @@ public class LiveSudGamePopup extends BottomPopupView { super.onDismiss(); } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onHideShow(HideShowEvent event) { + if (event.isClose()){ + dialog.dismiss(); + }else { + dialog.show(); + } + + } + @Subscribe(threadMode = ThreadMode.MAIN) public void onCheckRemainingBalanceEvent(CheckRemainingBalanceEvent event) { if (event.getResults().size() > 0) { diff --git a/common/src/main/res/layout/dialog_live_sud_game.xml b/common/src/main/res/layout/dialog_live_sud_game.xml index 8db6f7ac0..15e79b6aa 100644 --- a/common/src/main/res/layout/dialog_live_sud_game.xml +++ b/common/src/main/res/layout/dialog_live_sud_game.xml @@ -28,11 +28,12 @@ android:layout_weight="1" /> + android:src="@mipmap/icon_min_game" + android:visibility="visible" /> Choose a prank gift Enter the prank content... Input quantity + IN GAME + You are currently in the game, please return in a timely manner.\\nFailure to return for a long time will be considered a surrender. + Exiting the live room will synchronize with exiting the game room.\\nDo you want to continue + minimize diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index a186192f5..9174341da 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1360,4 +1360,8 @@ 選擇整蠱禮物 輸入整蠱內容... 输入数量 + 遊戲中 + 您正在遊戲中,請及時返回 長時間未返回將會視爲認輸哦 + 退出直播間將會同步退出遊戲房間 是否继续 + 最小化 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 88080a047..1e0f295ea 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1359,4 +1359,8 @@ 選擇整蠱禮物 輸入整蠱內容... 输入数量 + 遊戲中 + 您正在遊戲中,請及時返回 長時間未返回將會視爲認輸哦 + 退出直播間將會同步退出遊戲房間 是否继续 + 最小化 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index a8195214d..4aba76458 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1359,5 +1359,9 @@ 選擇整蠱禮物 輸入整蠱內容... 输入数量 + 遊戲中 + 您正在遊戲中,請及時返回\n長時間未返回將會視爲認輸哦 + 退出直播間將會同步退出遊戲房間\n是否继续 + 最小化 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 1529f8164..21e449365 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1366,4 +1366,8 @@ Limited ride And limited avatar frame Choose a prank gift Enter the prank content... Input quantity + You are currently in the game, please return in a timely manner.\\nFailure to return for a long time will be considered a surrender. + Exiting the live room will synchronize with exiting the game room.\\nDo you want to continue + IN GAME + minimize diff --git a/config.gradle b/config.gradle index b236d3a94..a4c1d2a21 100644 --- a/config.gradle +++ b/config.gradle @@ -4,8 +4,8 @@ ext { buildToolsVersion: "29.0.2", minSdkVersion : 21, targetSdkVersion : 33, - versionCode : 451, - versionName : "6.6.0" + versionCode : 453, + versionName : "6.6.6" ] manifestPlaceholders = [ //正式、 @@ -22,10 +22,10 @@ ext { baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", // true表示谷歌支付 false - isGooglePlay : false, + isGooglePlay : true, //是否上报异常日志 isUploadLog : true, //是否打包成插件包模式 - isPluginModel : true, + isPluginModel : false, ] } 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 8182d4448..ba2bc9010 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -64,11 +64,13 @@ import com.yunbao.common.dialog.YoursystemisolderDialog; import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.event.FollowEvent; import com.yunbao.common.event.GiftWallIlluminateEvent; +import com.yunbao.common.event.HideShowEvent; import com.yunbao.common.event.JavascriptInterfaceEvent; import com.yunbao.common.event.LiveErrorEvent; import com.yunbao.common.event.LiveOpenSudRoomEvent; import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent; +import com.yunbao.common.event.ShowHideEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; @@ -95,6 +97,7 @@ import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.CustomDrawerPopupView; +import com.yunbao.common.views.HintCustomPopup; import com.yunbao.common.views.floatingview.APPEasyFloat; import com.yunbao.common.views.weight.VerticalViewPager; import com.yunbao.live.R; @@ -562,22 +565,59 @@ public class LiveAudienceActivity extends LiveActivity { @Override public void onBackPressed() { - MobclickAgent.onEvent(mContext, "live_room_close", "退出直播间"); - OpenAdManager.getInstance().dismiss(); - try { - manager.onBackPressed(); - if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) { - manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal); - } else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) { - manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal); - } else { - manager.onRemove(true); + if (manager != null && manager.getsudGameMin()) { + new XPopup.Builder(mContext) + .asCustom(new HintCustomPopup(mContext, + mContext.getString(com.yunbao.common.R.string.dialog_tip), + mContext.getString(com.yunbao.common.R.string.the_live_room)) + .setLiveOpenOk(mContext.getString(com.yunbao.common.R.string.confirm)) + .setLiveOpenCancel(mContext.getString(com.yunbao.common.R.string.cancel)) + .setCallBack(new HintCustomPopup.HintCustomCallBack() { + @Override + public void onSure() { + MobclickAgent.onEvent(mContext, "live_room_close", "退出直播间"); + OpenAdManager.getInstance().dismiss(); + try { + manager.onBackPressed(); + if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) { + manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal); + } else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) { + manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal); + } else { + manager.onRemove(true); + } + Bus.get().post(new HideShowEvent().setClose(true)); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void onCancel() { + + + } + })).show(); + } else { + MobclickAgent.onEvent(mContext, "live_room_close", "退出直播间"); + OpenAdManager.getInstance().dismiss(); + try { + manager.onBackPressed(); + if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) { + manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal); + } else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) { + manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal); + } else { + manager.onRemove(true); + + } + } catch (Exception e) { + e.printStackTrace(); } - } catch (Exception e) { - e.printStackTrace(); } + } public void end() { @@ -737,33 +777,38 @@ public class LiveAudienceActivity extends LiveActivity { @Subscribe(threadMode = ThreadMode.MAIN) public void onLiveRoomChangeEvent(LiveRoomChangeEvent e) { - LiveBean liveBean = e.getLiveBean(); - if (TextUtils.equals(mLiveUid, liveBean.getUid())) { - ToastUtil.show(mContext.getString(R.string.current_live_room)); - } else { - if (e.isLiveEnd()) { - manager.removeLiveEnd(); - } - if (LiveRoomViewHolder.mHandler != null) { - LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); - } - if (liveBean != null) { - LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE); - LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM); - LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE); - manager.onRemove(false); - mLiveType = e.getLiveType(); - mLiveTypeVal = e.getLiveTypeVal(); - mLiveBean = liveBean; - mLiveUid = liveBean.getUid(); - mStream = liveBean.getStream(); - mAncherName = liveBean.getUserNiceName(); - mAncherIcon = liveBean.getAvatar(); - manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK); + if (manager!=null&&manager.getsudGameMin()){ + ToastUtil.show(WordUtil.isNewZh()?"小遊戲進行中,無法切換直播間":"Game in progress, unable to switch to live room"); + }else { + LiveBean liveBean = e.getLiveBean(); + if (TextUtils.equals(mLiveUid, liveBean.getUid())) { + ToastUtil.show(mContext.getString(R.string.current_live_room)); + } else { + if (e.isLiveEnd()) { + manager.removeLiveEnd(); + } + if (LiveRoomViewHolder.mHandler != null) { + LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); + } + if (liveBean != null) { + LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE); + LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM); + LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE); + manager.onRemove(false); + mLiveType = e.getLiveType(); + mLiveTypeVal = e.getLiveTypeVal(); + mLiveBean = liveBean; + mLiveUid = liveBean.getUid(); + mStream = liveBean.getStream(); + mAncherName = liveBean.getUserNiceName(); + mAncherIcon = liveBean.getAvatar(); + manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK); + } } } + } @Override @@ -1124,7 +1169,8 @@ public class LiveAudienceActivity extends LiveActivity { break; case GUARD: if (event.getObject() == null) { - openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity); } else { + openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity); + } else { openNewBuyGuardWindow(true); } break; @@ -1593,7 +1639,7 @@ public class LiveAudienceActivity extends LiveActivity { @Override public void onError(String error) { - ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); + ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred"); } }); @@ -1647,6 +1693,19 @@ public class LiveAudienceActivity extends LiveActivity { }); } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onShowHideEvent(ShowHideEvent event) { + if (manager != null) { + manager.onShowHideEvent(); + verticalViewPager.setEnableScroll(false); + } + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onHideShow(HideShowEvent event) { + verticalViewPager.setEnableScroll(true); + } + @Subscribe(threadMode = ThreadMode.MAIN) public void onLiveOpenSudRoomEvent(LiveOpenSudRoomEvent liveOpenSudRoomEvent) { if (manager != null) { @@ -1734,7 +1793,7 @@ public class LiveAudienceActivity extends LiveActivity { } else { if (IMLoginManager.get(mContext).getRedPoint()) { manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.VISIBLE); - }else { + } else { manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.GONE); } 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 c2d80a7b2..569ca21f7 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -97,6 +97,7 @@ import com.yunbao.common.bean.XydCompleteModel; import com.yunbao.common.event.AllServerNotifyEvent; import com.yunbao.common.event.AnchorInfoEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent; +import com.yunbao.common.event.HideShowEvent; import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.API; @@ -666,6 +667,19 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis return R.layout.view_live_room; } + private View sudGameMin; + + public void onShowHideEvent() { + sudGameMin = findViewById(R.id.sud_game_min); + sudGameMin.setVisibility(View.VISIBLE); + ViewClicksAntiShake.clicksAntiShake(sudGameMin, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + Bus.get().post(new HideShowEvent().setClose(false)); + sudGameMin.setVisibility(View.GONE); + } + }); + } /** * 获取下一秒钟的时间 @@ -3050,7 +3064,29 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis MobclickAgent.onEvent(mContext, "live_room_noble", "贵族按钮"); ((LiveActivity) mContext).openUserMoreListWindow(1, false, true, mContext instanceof LiveRyAnchorActivity); } else if (i == R.id.btn_close) { +// if (sudGameMin!=null&&sudGameMin.getVisibility()==View.VISIBLE) { +// new XPopup.Builder(mContext) +// .asCustom(new HintCustomPopup(mContext, +// mContext.getString(com.yunbao.common.R.string.dialog_tip), +// mContext.getString(com.yunbao.common.R.string.the_live_room)) +// .setLiveOpenOk( mContext.getString(com.yunbao.common.R.string.confirm)) +// .setLiveOpenCancel( mContext.getString(com.yunbao.common.R.string.cancel)) +// .setCallBack(new HintCustomPopup.HintCustomCallBack() { +// @Override +// public void onSure() { +// close(); +// } +// +// @Override +// public void onCancel() { +// +// +// } +// })).show(); +// } else { close(); +// } + //小屏 } else if (i == R.id.btn_noble) { ((LiveActivity) mContext).openLuckGiftTip(); @@ -3067,6 +3103,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } + public boolean getsudGameMin() { + return sudGameMin != null && sudGameMin.getVisibility() == View.VISIBLE; + } + /** * 私信的切换动画 * diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index fd1d2677e..67d42ffbf 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -216,6 +216,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe this.createSudRoomModel = createSudRoomModel; } + public void onShowHideEvent() { + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.onShowHideEvent(); + } + } + public PortraitLiveManager(Activity context, Intent intent) { this.mContext = context; this.mIntent = intent; @@ -1630,6 +1636,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } + public boolean getsudGameMin() { + return mLiveRoomViewHolder != null && mLiveRoomViewHolder.getsudGameMin(); + } + @Override public void onHourRank(LiveChatBean bean, JSONObject ranks) { if (mLiveRoomViewHolder != null && !TextUtils.isEmpty(liveID) && ranks != null) { diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index bc52b669c..2995e1eb0 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -1059,11 +1059,11 @@ android:id="@+id/iv_look" android:layout_width="52dp" android:layout_height="24dp" - android:singleLine="true" - android:ellipsize="end" android:layout_marginRight="12dp" android:background="@drawable/bg_all_server_icon" + android:ellipsize="end" android:gravity="center" + android:singleLine="true" android:text="@string/live_onlookers" android:textColor="@color/white" android:textSize="12sp" /> @@ -2239,6 +2239,33 @@ android:gravity="bottom" android:orientation="vertical"> + + + + + + + + android:textSize="14sp" + android:visibility="gone" />