Merge remote-tracking branch 'origin/master'

This commit is contained in:
zlzw 2022-10-06 13:28:27 +08:00
commit 5c349902dd
10 changed files with 219 additions and 36 deletions

View File

@ -0,0 +1,83 @@
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.glide.ImgLoader;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
/**
* 滑动设置
*/
public class SlideSettingsDialog extends AbsDialogFragment {
private ImageView slideSwitch;
private boolean slide;
@Override
protected int getLayoutId() {
return R.layout.view_slide_settings;
}
@Override
protected int getDialogStyle() {
return R.style.dialog2;
}
@Override
protected boolean canCancel() {
return true;
}
@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);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
slideSwitch = (ImageView) findViewById(R.id.slide_switch);
slide = IMLoginManager.get(getActivity()).isSlide();
if (slide) {
ImgLoader.display(getContext(), R.mipmap.special_icon_on, slideSwitch);
} else {
ImgLoader.display(getContext(), R.mipmap.special_icon_off, slideSwitch);
}
//滑动设置
ViewClicksAntiShake.clicksAntiShake(slideSwitch, () -> {
slide = !slide;
if (slide) {
ImgLoader.display(getContext(), R.mipmap.special_icon_on, slideSwitch);
} else {
ImgLoader.display(getContext(), R.mipmap.special_icon_off, slideSwitch);
}
//滑动设置
IMLoginManager.get(getContext()).initSlide(slide);
if (callBack != null) {
callBack.initSlide(slide);
}
});
}
private SlideSettingsCallBack callBack;
public SlideSettingsDialog setCallBack(SlideSettingsCallBack callBack) {
this.callBack = callBack;
return this;
}
public interface SlideSettingsCallBack {
void initSlide(boolean slide);
}
}

View File

@ -30,6 +30,7 @@ public class IMLoginManager extends BaseCacheManager {
private final static String GiftEffect = "giftEffect";
private final static String MountEffect = "mountEffect";
private final static String IS_CHAT = "isChat";
private final static String IS_SLIDE = "isSlide";
/**
* @param isChat 是否隐藏聊天列表 is_chat 1开启 0关闭
@ -38,6 +39,24 @@ public class IMLoginManager extends BaseCacheManager {
put(IS_CHAT, isChat);
}
/**
* 设置直播间是否滚动
*
* @param isSlide 滚动
*/
public void initSlide(boolean isSlide) {
put(IS_SLIDE, isSlide);
}
/**
* 获取之比肩是否滚动
*
* @return
*/
public boolean isSlide() {
return getBoolean(IS_SLIDE, true);
}
/**
* 是否隐藏聊天列表
*

View File

@ -245,6 +245,28 @@
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/slide_settings_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@mipmap/live_more_icon_sliding" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/slide_settings"
android:textColor="#FF9A9A9A"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/system_notice"
android:layout_width="wrap_content"

View File

@ -0,0 +1,42 @@
<?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/slide_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/up_slide_settings"
android:textColor="#FF9A9A9A"
android:textSize="15sp" />
<ImageView
android:id="@+id/slide_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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -912,6 +912,8 @@
<string name="order_query">订单查询中</string>
<string name="order_query_success">订单无异常</string>
<string name="login_invalid">登錄失效,請重新登錄</string>
<string name="slide_settings">滑動設置</string>
<string name="up_slide_settings">上下滑動切換直播間</string>
</resources>

View File

@ -153,7 +153,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
mCoinName = CommonAppConfig.getInstance().getCoinName();
mIsAnchor = this instanceof LiveAnchorActivity;
mPageContainer = (ViewGroup) findViewById(R.id.page_container);
mPageContainer = findViewById(R.id.page_container);
EventBus.getDefault().register(this);
mDialogFragmentSet = new HashSet<>();
//解压 美颜模型
@ -271,7 +271,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
@Override
public void onEnterRoom(LiveEnterRoomBean bean) {
if (mLiveRoomViewHolder != null) {
LiveUserGiftBean u = bean.getUserBean();
if (!bean.getUserBean().getCar().getWords().equals("")) {
bean.getLiveChatBean().setContent(bean.getUserBean().getCar().getWords());
}
@ -286,9 +285,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/
@Override
public void onLeaveRoom(UserBean bean) {
if (mLiveRoomViewHolder != null) {
// mLiveRoomViewHolder.removeUser(bean.getId());
}
if (mLiveLinkMicPresenter != null) {
mLiveLinkMicPresenter.onAudienceLeaveRoom(bean);
}

View File

@ -1,5 +1,7 @@
package com.yunbao.live.activity;
import static com.yunbao.live.views.LivePlayRyViewHolder.Micing;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
@ -35,6 +37,7 @@ import com.yunbao.common.bean.SlideInfoModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.EffectsSettingsDialog;
import com.yunbao.common.dialog.LiveChargeDialogFragment;
import com.yunbao.common.dialog.SlideSettingsDialog;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts;
@ -80,8 +83,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.yunbao.live.views.LivePlayRyViewHolder.Micing;
/**
* Created by cxf on 2018/10/10.
* 看直播
@ -160,6 +161,9 @@ public class LiveAudienceActivity extends LiveActivity {
private void initView() {
// 竖直滑动 ViewPager
verticalViewPager = findViewById(R.id.view_pager);
verticalViewPager.setEnableScroll(IMLoginManager.get(mContext).isSlide());
}
public void setBackIndex(int backIndex) {
@ -197,7 +201,9 @@ public class LiveAudienceActivity extends LiveActivity {
manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal);
} else {
if (IMLoginManager.get(mContext).isSlide()){
verticalViewPager.setEnableScroll(true);
}
mCurrentItem = position;
Log.e(TAG, "mCurrentItem:" + mCurrentItem);
if (mCurrentItem == itemModelList.size() - 1) {
@ -331,8 +337,7 @@ public class LiveAudienceActivity extends LiveActivity {
* 打开礼物窗口
*/
public void openGiftWindow() {
new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() {
new Handler(Looper.getMainLooper()).post(() -> {
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) {
return;
}
@ -343,7 +348,6 @@ public class LiveAudienceActivity extends LiveActivity {
bundle.putString(Constants.LIVE_STREAM, mStream);
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
}
});
}
@ -365,8 +369,7 @@ public class LiveAudienceActivity extends LiveActivity {
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream)) {
return;
}
new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() {
new Handler(Looper.getMainLooper()).post(() -> {
LiveGiftDialogFragment fragment = new LiveGiftDialogFragment();
fragment.setLiveGuardInfo(mLiveGuardInfo);
Bundle bundle = new Bundle();
@ -378,7 +381,6 @@ public class LiveAudienceActivity extends LiveActivity {
}
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveGiftDialogFragment");
}
});
}
@ -485,6 +487,7 @@ public class LiveAudienceActivity extends LiveActivity {
super.onPause();
manager.onPause();
}
/**
* 点亮
*/
@ -815,6 +818,16 @@ public class LiveAudienceActivity extends LiveActivity {
manager.onChat(chatBean, 1);
break;
case SLIDE_SETTINGS:
SlideSettingsDialog slideSettingsDialog = new SlideSettingsDialog();
slideSettingsDialog.show(getSupportFragmentManager(), "SlideSettingsDialog");
slideSettingsDialog.setCallBack(new SlideSettingsDialog.SlideSettingsCallBack() {
@Override
public void initSlide(boolean slide) {
verticalViewPager.setEnableScroll(slide);
}
});
break;
}
@ -890,7 +903,6 @@ public class LiveAudienceActivity extends LiveActivity {
}
/**
* 获取侧边栏数据
*/

View File

@ -9,13 +9,13 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.R;
import com.yunbao.live.adapter.FunGamesAdapter;
import com.yunbao.common.bean.ActiveModel;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.adapter.FunGamesAdapter;
import com.yunbao.live.bean.LiveBean;
import com.yunbao.live.event.LiveAudienceEvent;
@ -144,6 +144,11 @@ public class LiveTotalDialog extends AbsDialogFragment {
.setType(LiveAudienceEvent.LiveAudienceType.ONLINE));
dismiss();
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.slide_settings_layout), () -> {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.SLIDE_SETTINGS));
dismiss();
});
}
@Override

View File

@ -130,7 +130,9 @@ public class LiveAudienceEvent extends BaseModel {
NOTICE(18, "系统通知"),
ONLINE(19, "在线客服"),
TRUMPET_NOTIFY(20, "全服喇叭"),
RECOMMEND_CARD_NOTIFY(21, "贵族推荐通知");
RECOMMEND_CARD_NOTIFY(21, "贵族推荐通知"),
SLIDE_SETTINGS(22, "滑動設置")
;
private int type;
private String name;