添加特效开关
This commit is contained in:
@@ -206,8 +206,9 @@ public class IMLoginModel extends BaseModel {
|
||||
private List<List<ListModel>> list;
|
||||
@SerializedName("slide")
|
||||
private List<SlideModel> slide;
|
||||
//礼物特效开关
|
||||
@SerializedName("gift_effect")
|
||||
private boolean giftEffect =false;
|
||||
private boolean giftEffect = false;
|
||||
|
||||
public boolean isGiftEffect() {
|
||||
return giftEffect;
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 特效设置页面
|
||||
*/
|
||||
public class EffectsSettingsDialog extends AbsDialogFragment {
|
||||
private ImageView specialSwitch;
|
||||
private boolean giftEffect;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.view_effects_settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDialogStyle() {
|
||||
return R.style.dialog2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canCancel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
IMLoginModel userInfo = IMLoginManager.get(getContext()).getUserInfo();
|
||||
specialSwitch = (ImageView) findViewById(R.id.special_switch);
|
||||
giftEffect = userInfo.isGiftEffect();
|
||||
if (giftEffect) {
|
||||
ImgLoader.display(getContext(), R.mipmap.special_icon_off, specialSwitch);
|
||||
} else {
|
||||
ImgLoader.display(getContext(), R.mipmap.special_icon_on, specialSwitch);
|
||||
}
|
||||
//礼物特效开关
|
||||
ViewClicksAntiShake.clicksAntiShake(specialSwitch, () -> {
|
||||
giftEffect = !giftEffect;
|
||||
if (giftEffect) {
|
||||
ImgLoader.display(getContext(), R.mipmap.special_icon_off, specialSwitch);
|
||||
} else {
|
||||
ImgLoader.display(getContext(), R.mipmap.special_icon_on, specialSwitch);
|
||||
}
|
||||
//更新特效开关
|
||||
IMLoginManager.get(getContext()).upDataUserInfo(userInfo.setGiftEffect(giftEffect));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setWindowAttributes(Window window) {
|
||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.gravity = Gravity.BOTTOM;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class LiveTotalDialog extends AbsDialogFragment {
|
||||
//粉丝团
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.fan_club), () -> {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.FANCLUB));
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.FAN_CLUB));
|
||||
dismiss();
|
||||
}
|
||||
);
|
||||
@@ -79,7 +79,7 @@ public class LiveTotalDialog extends AbsDialogFragment {
|
||||
//周星榜
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_wks_layout), () -> {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIVEWKS));
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_WKS));
|
||||
dismiss();
|
||||
}
|
||||
);
|
||||
@@ -93,7 +93,14 @@ public class LiveTotalDialog extends AbsDialogFragment {
|
||||
//连麦
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_link_mic), () -> {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIANMAI));
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI));
|
||||
dismiss();
|
||||
}
|
||||
);
|
||||
//特效设置
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.effects_settings_layout), () -> {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.EFFECTS_SETTINGS));
|
||||
dismiss();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -27,14 +27,15 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
|
||||
public enum LiveAudienceType {
|
||||
SIDEBAR(1, "侧边栏"),
|
||||
BOTTOMCOLLECTION(2, "底部合集"),
|
||||
GIFTPOPUP(3, "礼物弹窗"),
|
||||
CURRENTACTIVITY(4, "当前活动"),
|
||||
FANCLUB(5, "粉絲團"),
|
||||
BOTTOM_COLLECTION(2, "底部合集"),
|
||||
GIFT_POPUP(3, "礼物弹窗"),
|
||||
CURRENT_ACTIVITY(4, "当前活动"),
|
||||
FAN_CLUB(5, "粉絲團"),
|
||||
GUARD(6, "守護"),
|
||||
LIVEWKS(7, "周星榜"),
|
||||
LIVE_WKS(7, "周星榜"),
|
||||
NOBLE(8, "贵族"),
|
||||
LIANMAI(9, "连麦");
|
||||
LIAN_MAI(9, "连麦"),
|
||||
EFFECTS_SETTINGS(10, "特效設置");
|
||||
|
||||
|
||||
private int type;
|
||||
|
||||
@@ -18,9 +18,6 @@ import com.yunbao.common.utils.SpUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
|
||||
/**
|
||||
* 登录者信息管理
|
||||
*/
|
||||
@@ -132,6 +129,21 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
SpUtil.getInstance().setStringValue(SpUtil.USER_INFO, new Gson().toJson(userInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用User.getBaseInfos接口时更新用户本地数据
|
||||
*
|
||||
* @param model
|
||||
*/
|
||||
public void upDataUserInfo(@NonNull IMLoginModel model) {
|
||||
userInfo = model;
|
||||
if (!TextUtils.isEmpty(token)) {
|
||||
userInfo.setToken(token);
|
||||
}
|
||||
put(KEY_USER_INFO, new Gson().toJson(userInfo));
|
||||
//兼容老模块(之后要把用户维护的类更换掉)
|
||||
SpUtil.getInstance().setStringValue(SpUtil.USER_INFO, new Gson().toJson(userInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新请求管理员身份信息
|
||||
*/
|
||||
|
||||
@@ -35,7 +35,7 @@ public class FunGamesViewHolder extends RecyclerView.ViewHolder {
|
||||
funGameName.setText(model.getActiveName());
|
||||
ViewClicksAntiShake.clicksAntiShake(itemView, () -> {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.CURRENTACTIVITY)
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.CURRENT_ACTIVITY)
|
||||
.setModel(model));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user