修改悬浮窗样式

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 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关闭

View File

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