添加特效开关
This commit is contained in:
parent
d3a3569f2b
commit
b52a157ed2
@ -206,6 +206,7 @@ public class IMLoginModel extends BaseModel {
|
||||
private List<List<ListModel>> list;
|
||||
@SerializedName("slide")
|
||||
private List<SlideModel> slide;
|
||||
//礼物特效开关
|
||||
@SerializedName("gift_effect")
|
||||
private boolean giftEffect = false;
|
||||
|
||||
|
@ -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));
|
||||
});
|
||||
}
|
||||
|
41
common/src/main/res/layout/view_effects_settings.xml
Normal file
41
common/src/main/res/layout/view_effects_settings.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_live_tota"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp"
|
||||
android:text="@string/effects_settings"
|
||||
android:textColor="#FFF6F7FB"
|
||||
android:textSize="17sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginBottom="21dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/shield_gift_effect"
|
||||
android:textColor="#FF9A9A9A"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/special_switch"
|
||||
android:layout_width="40.8dp"
|
||||
android:layout_height="24.8dp"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:src="@mipmap/special_icon_off" />
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
@ -186,6 +186,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/effects_settings_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="23dp"
|
||||
|
BIN
common/src/main/res/mipmap-xxhdpi/special_icon_off.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/special_icon_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.0 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/special_icon_on.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/special_icon_on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
@ -878,4 +878,5 @@
|
||||
<string name="activity_center">活動中心</string>
|
||||
<string name="basic_tools">基础工具</string>
|
||||
<string name="effects_settings">特效設置</string>
|
||||
<string name="shield_gift_effect">屏蔽礼物特效</string>
|
||||
</resources>
|
||||
|
@ -50,6 +50,7 @@ import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.custom.CommonRefreshView;
|
||||
import com.yunbao.common.custom.ItemDecoration;
|
||||
import com.yunbao.common.custom.MyViewPager;
|
||||
import com.yunbao.common.dialog.EffectsSettingsDialog;
|
||||
import com.yunbao.common.dialog.LiveChargeDialogFragment;
|
||||
import com.yunbao.common.dialog.LiveTotalDialog;
|
||||
import com.yunbao.common.event.LiveAudienceEvent;
|
||||
@ -1401,11 +1402,11 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
//从右边打开侧边栏
|
||||
drawerLayout.openDrawer(GravityCompat.END);
|
||||
break;
|
||||
case BOTTOMCOLLECTION:
|
||||
case BOTTOM_COLLECTION:
|
||||
LiveTotalDialog liveTotalDialog = new LiveTotalDialog();
|
||||
liveTotalDialog.show(getSupportFragmentManager(), "LiveTotalDialog");
|
||||
break;
|
||||
case GIFTPOPUP:
|
||||
case GIFT_POPUP:
|
||||
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) {
|
||||
return;
|
||||
}
|
||||
@ -1416,7 +1417,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
liveGiftDialogFragment.setArguments(bundle);
|
||||
liveGiftDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
|
||||
break;
|
||||
case CURRENTACTIVITY:
|
||||
case CURRENT_ACTIVITY:
|
||||
|
||||
bundle.putString("url", event.getModel().activityUrl(mContext, liveBean.getUid()));
|
||||
int show = TextUtils.isEmpty(event.getModel().getShowType()) ? 0 : Integer.parseInt(event.getModel().getShowType());
|
||||
@ -1425,7 +1426,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
liveHDDialogFragment.setArguments(bundle);
|
||||
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||
break;
|
||||
case FANCLUB:
|
||||
case FAN_CLUB:
|
||||
|
||||
LiveFansFragment liveFansFragment = new LiveFansFragment();
|
||||
//粉絲團粉絲團
|
||||
@ -1452,7 +1453,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
liveGuardDialogFragment.setArguments(bundle);
|
||||
liveGuardDialogFragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment");
|
||||
break;
|
||||
case LIVEWKS://周星榜
|
||||
case LIVE_WKS://周星榜
|
||||
String weeklyStarUrl = CommonAppConfig.HOST + "/h5/activity/weekStar/index.html?&uid="
|
||||
+ userInfo.getId() +
|
||||
"&token=" + userInfo.getToken() + "&anchorUid=" + mLiveUid;
|
||||
@ -1466,7 +1467,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
+ "&uid=" + userInfo.getId();
|
||||
ZhuangBanActivity.forward(mContext, nobleUrl, false);
|
||||
break;
|
||||
case LIANMAI:
|
||||
case LIAN_MAI:
|
||||
//获取房间连麦状态
|
||||
HttpClient.getInstance().get("live.getDrLm", "live.getDrLm")
|
||||
.params("uid", mLiveUid, true)
|
||||
@ -1488,6 +1489,10 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
}
|
||||
});
|
||||
break;
|
||||
case EFFECTS_SETTINGS:
|
||||
EffectsSettingsDialog effectsSettingsDialog = new EffectsSettingsDialog();
|
||||
effectsSettingsDialog.show(getSupportFragmentManager(), "EffectsSettingsDialog");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.BOTTOMCOLLECTION));
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.BOTTOM_COLLECTION));
|
||||
|
||||
}
|
||||
});
|
||||
@ -311,7 +311,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.GIFTPOPUP));
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user