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); +// } +// }); } } }