From 80f23f4cc3d7c6696f32978bb92ab401c4db4245 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 18 Oct 2022 17:23:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=82=AC=E6=B5=AE=E7=AA=97?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/common/manager/IMLoginManager.java | 18 ++++ .../live/views/PortraitLiveManager.java | 88 ++++++++++++------- 2 files changed, 73 insertions(+), 33 deletions(-) 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 ef6fc179c..995bcc223 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -31,6 +31,24 @@ public class IMLoginManager extends BaseCacheManager { private final static String MountEffect = "mountEffect"; private final static String IS_CHAT = "isChat"; private final static String IS_SLIDE = "isSlide"; + private final static String IS_FLOAT = "is_float"; + + /** + * 存储是否打开悬浮窗权限提示 + * + * @param isFloat + */ + public void initFloat(boolean isFloat) { + put(IS_FLOAT, isFloat); + } + + /** + * + * @return + */ + public boolean isFloat() { + return getBoolean(IS_FLOAT, true); + } /** * @param isChat 是否隐藏聊天列表 is_chat 1:开启 0:关闭 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 168d2e8c4..ce308eed3 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -285,6 +285,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.initHourRankList(); } }); + } @Override @@ -347,6 +348,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRyLinkMicPkPresenter.release(); } if (isQuit) { + if (PermissionUtils.checkPermission(mContext)) { LiveFloatView.getInstance() .cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal) @@ -354,42 +356,62 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mContext.finish(); } else { if (mContext instanceof LiveAudienceActivity) { - DialogUitl.showSimpleDialog(mContext, null, "您未打开悬浮窗权限,是否打开", false, new DialogUitl.SimpleCallback3() { - @Override - public void onConfirmClick(Dialog dialog) { - LiveFloatView.getInstance() - .setCallback(new LiveFloatView.LiveFloatViewCallback() { - @Override - public void invoke(Boolean aBoolean) { - if (aBoolean) { - mContext.finish(); - } else { - EventBus.getDefault() - .post(new LiveFloatEvent() - .setmLiveBean(mLiveBean) - .setmLiveSDK(mLiveSDK) - .setmLiveType(mLiveType) - .setmLiveTypeVal(mLiveTypeVal)); - mContext.finish(); + if (IMLoginManager.get(mContext).isFloat()) { + DialogUitl.showSimpleDialog(mContext, null, "您未打开悬浮窗权限,是否打开", false, new DialogUitl.SimpleCallback3() { + @Override + public void onConfirmClick(Dialog dialog) { + LiveFloatView.getInstance() + .setCallback(new LiveFloatView.LiveFloatViewCallback() { + @Override + public void invoke(Boolean aBoolean) { + if (aBoolean) { + mContext.finish(); + } else { + EventBus.getDefault() + .post(new LiveFloatEvent() + .setmLiveBean(mLiveBean) + .setmLiveSDK(mLiveSDK) + .setmLiveType(mLiveType) + .setmLiveTypeVal(mLiveTypeVal)); + mContext.finish(); + IMLoginManager.get(mContext).initFloat(true); + } } - } - }) - .cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal) - .builderSystemFloat(mContext, mLiveBean.getPull()); - } + }) + .cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal) + .builderSystemFloat(mContext, mLiveBean.getPull()); + + } + + @Override + public void onCancel() { + EventBus.getDefault() + .post(new LiveFloatEvent() + .setmLiveBean(mLiveBean) + .setmLiveSDK(mLiveSDK) + .setmLiveType(mLiveType) + .setmLiveTypeVal(mLiveTypeVal)); + mContext.finish(); + IMLoginManager.get(mContext).initFloat(false); + } + }); + } else { + EventBus.getDefault() + .post(new LiveFloatEvent() + .setmLiveBean(mLiveBean) + .setmLiveSDK(mLiveSDK) + .setmLiveType(mLiveType) + .setmLiveTypeVal(mLiveTypeVal)); + mContext.finish(); + } - @Override - public void onCancel() { - EventBus.getDefault() - .post(new LiveFloatEvent() - .setmLiveBean(mLiveBean) - .setmLiveSDK(mLiveSDK) - .setmLiveType(mLiveType) - .setmLiveTypeVal(mLiveTypeVal)); - mContext.finish(); - } - }); } +// PermissionUtils.requestPermission(mContext, new OnPermissionResult() { +// @Override +// public void permissionResult(boolean b) { +// ToastUtil.show("悬浮窗权限:"+b); +// } +// }); } } }