修复:

修改特效的设置
This commit is contained in:
18401019693 2022-08-24 13:25:44 +08:00
parent 14581ffebc
commit c1ee03ccbd
4 changed files with 16 additions and 19 deletions

View File

@ -7,7 +7,6 @@ import android.view.WindowManager;
import android.widget.ImageView;
import com.yunbao.common.R;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -37,11 +36,10 @@ public class EffectsSettingsDialog extends AbsDialogFragment {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
IMLoginModel userInfo = IMLoginManager.get(getContext()).getUserInfo();
specialSwitch = (ImageView) findViewById(R.id.special_switch);
specialMountSwitch = (ImageView) findViewById(R.id.special_mount_switch);
giftEffect = userInfo.isGiftEffect();
mountEffect = userInfo.isMountEffect();
giftEffect = IMLoginManager.get(getActivity()).isGiftEffect();
mountEffect = IMLoginManager.get(getActivity()).isMountEffect();
if (giftEffect) {
ImgLoader.display(getContext(), R.mipmap.special_icon_off, specialSwitch);
} else {
@ -61,8 +59,8 @@ public class EffectsSettingsDialog extends AbsDialogFragment {
ImgLoader.display(getContext(), R.mipmap.special_icon_on, specialSwitch);
}
//更新特效开关
IMLoginManager.get(getContext()).setGiftEffect(giftEffect);
IMLoginManager.get(getContext()).upDataUserInfo(userInfo.setGiftEffect(giftEffect));
IMLoginManager.get(getContext()).setGiftEffect(giftEffect);
}
);
//坐骑特效开关
@ -74,8 +72,7 @@ public class EffectsSettingsDialog extends AbsDialogFragment {
ImgLoader.display(getContext(), R.mipmap.special_icon_on, specialMountSwitch);
}
//更新特效开关
IMLoginManager.get(getContext()).setMountEffect(mountEffect);
IMLoginManager.get(getContext()).upDataUserInfo(userInfo.setMountEffect(mountEffect));
IMLoginManager.get(getContext()).setMountEffect(mountEffect);
}
);
}

View File

@ -84,10 +84,8 @@ public class IMLoginManager extends BaseCacheManager {
if (null == userInfo) {
userInfo = new Gson().fromJson(
getString(KEY_USER_INFO), IMLoginModel.class);
if (userInfo != null){
if (userInfo != null) {
token = userInfo.getToken();
userInfo.setGiftEffect(getBoolean(GiftEffect, false));
userInfo.setMountEffect(getBoolean(MountEffect, false));
}
}
@ -115,8 +113,6 @@ public class IMLoginManager extends BaseCacheManager {
if (userInfo != null && !TextUtils.isEmpty(userInfo.getToken())) {
token = userInfo.getToken();
}
userInfo.setGiftEffect(getBoolean(GiftEffect, false));
userInfo.setMountEffect(getBoolean(MountEffect, false));
if (netHandler == null) {
netHandler = new Handler();
}
@ -133,8 +129,6 @@ public class IMLoginManager extends BaseCacheManager {
if (!TextUtils.isEmpty(token)) {
userInfo.setToken(token);
}
userInfo.setGiftEffect(getBoolean(GiftEffect, false));
userInfo.setMountEffect(getBoolean(MountEffect, false));
put(KEY_USER_INFO, new Gson().toJson(userInfo));
//兼容老模块(之后要把用户维护的类更换掉
SpUtil.getInstance().setStringValue(SpUtil.USER_INFO, new Gson().toJson(userInfo));
@ -150,8 +144,6 @@ public class IMLoginManager extends BaseCacheManager {
if (!TextUtils.isEmpty(token)) {
userInfo.setToken(token);
}
userInfo.setGiftEffect(getBoolean(GiftEffect, false));
userInfo.setMountEffect(getBoolean(MountEffect, false));
put(KEY_USER_INFO, new Gson().toJson(userInfo));
//兼容老模块(之后要把用户维护的类更换掉
SpUtil.getInstance().setStringValue(SpUtil.USER_INFO, new Gson().toJson(userInfo));
@ -166,6 +158,14 @@ public class IMLoginManager extends BaseCacheManager {
put(MountEffect, mountEffect);
}
public boolean isMountEffect() {
return getBoolean(MountEffect, false);
}
public boolean isGiftEffect() {
return getBoolean(GiftEffect, false);
}
/**
* 重新请求管理员身份信息
*/

View File

@ -414,7 +414,7 @@ public class LiveEnterRoomAnimPresenter {
colocNow = "#" + car.getCar_colour();
playText = car.getUser_nicename() + mContext.getResources().getString(R.string.enter_room);
}
if (IMLoginManager.get(mContext).getUserInfo().isMountEffect()){
if (IMLoginManager.get(mContext).isMountEffect()){
GifCacheUtil.getFile(Constants.GIF_CAR_PREFIX + id, url1, "0", mDownloadGifCallback);
}

View File

@ -796,7 +796,7 @@ public class LiveGiftAnimPresenter {
}
} else {
if ((bean.getGifUrl().contains("svga") || bean.getGifUrl().contains("gif")) &&
IMLoginManager.get(mContext).getUserInfo().isGiftEffect()) {
IMLoginManager.get(mContext).isGiftEffect()) {
//同一直播间玩家自己送礼物也能看到全服通知
//同一直播间其他玩家也能看到全服通知