diff --git a/common/src/main/java/com/yunbao/common/dialog/EffectsSettingsDialog.java b/common/src/main/java/com/yunbao/common/dialog/EffectsSettingsDialog.java index d8436eee9..64db85b8b 100644 --- a/common/src/main/java/com/yunbao/common/dialog/EffectsSettingsDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/EffectsSettingsDialog.java @@ -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); } ); } 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 b4d4c4add..84b5d37dc 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -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); + } + /** * 重新请求管理员身份信息 */ diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java index 46b6a4096..4442d32ba 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveEnterRoomAnimPresenter.java @@ -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); } diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java index dac8c0ccf..9e2dcb816 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -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()) { //同一直播间,玩家自己送礼物,也能看到全服通知 //同一直播间,其他玩家也能看到全服通知