修改悬浮窗样式

This commit is contained in:
18401019693 2022-10-18 17:23:13 +08:00
parent 234756149c
commit 80f23f4cc3
2 changed files with 73 additions and 33 deletions

View File

@ -31,6 +31,24 @@ public class IMLoginManager extends BaseCacheManager {
private final static String MountEffect = "mountEffect"; private final static String MountEffect = "mountEffect";
private final static String IS_CHAT = "isChat"; private final static String IS_CHAT = "isChat";
private final static String IS_SLIDE = "isSlide"; 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关闭 * @param isChat 是否隐藏聊天列表 is_chat 1开启 0关闭

View File

@ -285,6 +285,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.initHourRankList(); mLiveRoomViewHolder.initHourRankList();
} }
}); });
} }
@Override @Override
@ -347,6 +348,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter.release(); mLiveRyLinkMicPkPresenter.release();
} }
if (isQuit) { if (isQuit) {
if (PermissionUtils.checkPermission(mContext)) { if (PermissionUtils.checkPermission(mContext)) {
LiveFloatView.getInstance() LiveFloatView.getInstance()
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal) .cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)
@ -354,42 +356,62 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mContext.finish(); mContext.finish();
} else { } else {
if (mContext instanceof LiveAudienceActivity) { if (mContext instanceof LiveAudienceActivity) {
DialogUitl.showSimpleDialog(mContext, null, "您未打开悬浮窗权限,是否打开", false, new DialogUitl.SimpleCallback3() { if (IMLoginManager.get(mContext).isFloat()) {
@Override DialogUitl.showSimpleDialog(mContext, null, "您未打开悬浮窗权限,是否打开", false, new DialogUitl.SimpleCallback3() {
public void onConfirmClick(Dialog dialog) { @Override
LiveFloatView.getInstance() public void onConfirmClick(Dialog dialog) {
.setCallback(new LiveFloatView.LiveFloatViewCallback() { LiveFloatView.getInstance()
@Override .setCallback(new LiveFloatView.LiveFloatViewCallback() {
public void invoke(Boolean aBoolean) { @Override
if (aBoolean) { public void invoke(Boolean aBoolean) {
mContext.finish(); if (aBoolean) {
} else { mContext.finish();
EventBus.getDefault() } else {
.post(new LiveFloatEvent() EventBus.getDefault()
.setmLiveBean(mLiveBean) .post(new LiveFloatEvent()
.setmLiveSDK(mLiveSDK) .setmLiveBean(mLiveBean)
.setmLiveType(mLiveType) .setmLiveSDK(mLiveSDK)
.setmLiveTypeVal(mLiveTypeVal)); .setmLiveType(mLiveType)
mContext.finish(); .setmLiveTypeVal(mLiveTypeVal));
mContext.finish();
IMLoginManager.get(mContext).initFloat(true);
}
} }
} })
}) .cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal) .builderSystemFloat(mContext, mLiveBean.getPull());
.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);
// }
// });
} }
} }
} }