直播间的滚动

This commit is contained in:
18401019693 2022-08-20 15:33:41 +08:00
parent 3ae14ed506
commit 18d62e5d56
32 changed files with 4663 additions and 1015 deletions

View File

@ -0,0 +1,31 @@
package com.yunbao.common.views.weight;
import android.content.Context;
import android.util.AttributeSet;
import androidx.drawerlayout.widget.DrawerLayout;
//解决直播间冲突
public class MyDrawerLayout extends DrawerLayout {
public MyDrawerLayout(Context context) {
super(context);
}
public MyDrawerLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
widthMeasureSpec = MeasureSpec.makeMeasureSpec(
MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY);
heightMeasureSpec = MeasureSpec.makeMeasureSpec(
MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ ext {
] ]
manifestPlaceholders = [ manifestPlaceholders = [
// //
serverHost : "https://napi.yaoulive.com", serverHost : "https://napi.yaoulive.com",
// //
// serverHost : "https://ceshi.yaoulive.com", // serverHost : "https://ceshi.yaoulive.com",

View File

@ -1109,9 +1109,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
mLiveContributeViewHolder.addToParent(); mLiveContributeViewHolder.addToParent();
} }
mLiveContributeViewHolder.show(); mLiveContributeViewHolder.show();
if (CommonAppConfig.LIVE_ROOM_SCROLL && !mIsAnchor) {
((LiveAudienceActivity) this).setScrollFrozen(true);
}
} }
/** /**
@ -1124,9 +1122,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
mLiveMedalRankViewHolder.addToParent(); mLiveMedalRankViewHolder.addToParent();
} }
mLiveMedalRankViewHolder.show(); mLiveMedalRankViewHolder.show();
if (CommonAppConfig.LIVE_ROOM_SCROLL && !mIsAnchor) {
((LiveAudienceActivity) this).setScrollFrozen(true);
}
} }

View File

@ -0,0 +1,63 @@
package com.yunbao.live.adapter;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.live.R;
import java.util.ArrayList;
import java.util.List;
public class VerticalPagerAdapter extends androidx.viewpager.widget.PagerAdapter {
List<AnchorRecommendItemModel> liveBeans = new ArrayList<>();
private Activity mContext;
private int mPosition;
public VerticalPagerAdapter(List<AnchorRecommendItemModel> liveBeans, Activity mContext) {
this.liveBeans = liveBeans;
this.mContext = mContext;
}
@Override
public int getCount() {
return liveBeans.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
Log.e("LiveAudienceActivity", "VerticalPagerAdapter:" + position);
View view = LayoutInflater.from(container.getContext()).inflate(R.layout.layout_portrait_live_item, null);
// 背景
AnchorRecommendItemModel liveItemBean = liveBeans.get(position);
ImageView ivBg = view.findViewById(R.id.iv_bg);
ImgLoader.displayBlurLive(mContext, liveItemBean.getAvatar(), ivBg);
// 加载动画
ImageView ivLoading = view.findViewById(R.id.iv_loading);
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
frameAnimation.start();
view.setId(position);
container.addView(view);
return view;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView(container.findViewById(position));
}
}

View File

@ -18,11 +18,11 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import static com.yunbao.live.activity.LiveAudienceActivity.countDownTimer;
import static com.yunbao.live.views.LiveRoomViewHolder.follow; import static com.yunbao.live.views.LiveRoomViewHolder.follow;
import static com.yunbao.live.views.LiveRoomViewHolder.mLiveUid; import static com.yunbao.live.views.LiveRoomViewHolder.mLiveUid;
@ -142,7 +142,7 @@ public class BlowkissDialog extends AbsDialogFragment {
ToastUtil.show(msg); ToastUtil.show(msg);
} }
}); });
countDownTimer.cancel(); ((LiveAudienceActivity) mContext).getCountDownTimer().cancel();
dismiss(); dismiss();
} }
}); });

View File

@ -23,7 +23,7 @@ import static com.yunbao.live.activity.LiveActivity.mLiveUid;
*/ */
public class LiveMoreDialogFragment extends AbsDialogFragment { public class LiveMoreDialogFragment extends AbsDialogFragment {
private LinearLayout btn_more,btn_full_screen,btn_jb; private LinearLayout btn_more, btn_full_screen, btn_jb;
private ActionListener mActionListener; private ActionListener mActionListener;
@Override @Override
@ -55,18 +55,18 @@ public class LiveMoreDialogFragment extends AbsDialogFragment {
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
btn_more = (LinearLayout) mRootView.findViewById(R.id.btn_more); btn_more = (LinearLayout) mRootView.findViewById(R.id.btn_more);
btn_full_screen = (LinearLayout)mRootView.findViewById(R.id.btn_full_screen); btn_full_screen = (LinearLayout) mRootView.findViewById(R.id.btn_full_screen);
btn_jb = (LinearLayout)mRootView.findViewById(R.id.btn_jb); btn_jb = (LinearLayout) mRootView.findViewById(R.id.btn_jb);
btn_more.setOnClickListener(new View.OnClickListener() { btn_more.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
dismiss(); dismiss();
if(LivePlayRyViewHolder.landscape != 1){ if (LivePlayRyViewHolder.landscape != 1) {
}else if (((LiveAudienceActivity) mContext).pkInfo != null&&((LiveAudienceActivity) mContext).pkInfo.getIntValue("ifpk")==0 && ((LiveAudienceActivity) mContext).anyway.equals("1") && LiveRoomViewHolder.d_pk_view.getVisibility()!=View.VISIBLE) { } else if (((LiveAudienceActivity) mContext).pkInfo != null && ((LiveAudienceActivity) mContext).pkInfo.getIntValue("ifpk") == 0 && ((LiveAudienceActivity) mContext).anyway.equals("1") && LiveRoomViewHolder.d_pk_view.getVisibility() != View.VISIBLE) {
((LiveAudienceActivity) mContext).btnSmallScreen.setVisibility(View.VISIBLE); ((LiveAudienceActivity) mContext).btnSmallScreen.setVisibility(View.VISIBLE);
((LiveAudienceActivity) mContext).mViewPager.setCurrentItem(0); LiveAudienceActivity.setCurrentItem(0);
((LiveAudienceActivity) mContext).mLivePlayViewHolder.fullScreen(); LiveAudienceActivity.getmLivePlayViewHolder().fullScreen();
} else { } else {
Toast.makeText(mContext, "当前模式不能全屏", Toast.LENGTH_SHORT).show(); Toast.makeText(mContext, "当前模式不能全屏", Toast.LENGTH_SHORT).show();
} }

View File

@ -5,8 +5,6 @@ import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -24,18 +22,14 @@ import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import static com.yunbao.live.activity.LiveAudienceActivity.countDownTimer;
import static com.yunbao.live.views.LiveRoomViewHolder.follow;
import static com.yunbao.live.views.LiveRoomViewHolder.mLiveUid;
public class NewUserDialog extends AbsDialogFragment { public class NewUserDialog extends AbsDialogFragment {
int gif = 0; int gif = 0;
@ -108,7 +102,8 @@ public class NewUserDialog extends AbsDialogFragment {
JSONObject obj = old_obj.getJSONObject("reward_all"); JSONObject obj = old_obj.getJSONObject("reward_all");
gold.setText(obj.getString("gold")); gold.setText(obj.getString("gold"));
exp.setText(obj.getString("experience")); exp.setText(obj.getString("experience"));
}}); }
});
TextView btn_confirm = (TextView) mRootView.findViewById(R.id.btn_confirm); TextView btn_confirm = (TextView) mRootView.findViewById(R.id.btn_confirm);
@ -129,7 +124,7 @@ public class NewUserDialog extends AbsDialogFragment {
EventBus.getDefault().post("showBanner"); EventBus.getDefault().post("showBanner");
EventBus.getDefault().post("svga_new_user_gif"); EventBus.getDefault().post("svga_new_user_gif");
IMLoginManager.get(mContext).setNewUserGif(true); IMLoginManager.get(mContext).setNewUserGif(true);
countDownTimer.cancel(); ((LiveAudienceActivity) mContext).getCountDownTimer().cancel();
dismiss(); dismiss();
} }
}); });

View File

@ -387,7 +387,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
} }
//接受PK回调 //接受PK回调
private void pkAccept(){ private void pkAccept() {
mTRTCCloud1 = LivePushTxViewHolder.mTRTCCloud.createSubCloud(); mTRTCCloud1 = LivePushTxViewHolder.mTRTCCloud.createSubCloud();
mTRTCParams1 = new TRTCCloudDef.TRTCParams(); mTRTCParams1 = new TRTCCloudDef.TRTCParams();
mTRTCParams1.sdkAppId = GenerateTestUserSig.SDKAPPID; mTRTCParams1.sdkAppId = GenerateTestUserSig.SDKAPPID;
@ -406,7 +406,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
/** /**
* 主播与主播PK 主播收到其他主播发过来的PK申请的回调 * 主播与主播PK 主播收到其他主播发过来的PK申请的回调
*/ */
public void onLinkMicPkApply(UserBean u, String stream,int forwhat) { public void onLinkMicPkApply(UserBean u, String stream, int forwhat) {
mApplyUid = u.getId(); mApplyUid = u.getId();
mApplyUrl = u.getAvatar(); mApplyUrl = u.getAvatar();
if (mApplyUrl == null) { if (mApplyUrl == null) {
@ -416,11 +416,11 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
if (mApplyNmae == null) { if (mApplyNmae == null) {
mApplyNmae = ""; mApplyNmae = "";
} }
if(forwhat == 1) { if (forwhat == 1) {
if (mIsApplyDialogShow == false) { if (mIsApplyDialogShow == false) {
showApplyDialog(u); showApplyDialog(u);
} }
}else{ } else {
pkAccept(); pkAccept();
} }
} }
@ -1002,8 +1002,8 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
mLiveLinkMicPkViewHolder = new LiveLinkMicPkViewHolder(mContext, mPkContainer); mLiveLinkMicPkViewHolder = new LiveLinkMicPkViewHolder(mContext, mPkContainer);
mLiveLinkMicPkViewHolder.addToParent(); mLiveLinkMicPkViewHolder.addToParent();
mLiveLinkMicPkViewHolder.setIsAnchor(mIsAnchor); mLiveLinkMicPkViewHolder.setIsAnchor(mIsAnchor);
if (LiveAudienceActivity.mLivePlayViewHolder != null) { if (LiveAudienceActivity.getmLivePlayViewHolder() != null) {
LiveAudienceActivity.mLivePlayViewHolder.setPkview(); LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
} }
} }
@ -1081,8 +1081,8 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
public void run() { public void run() {
try { try {
Thread.sleep(4000); Thread.sleep(4000);
if (LiveAudienceActivity.mLivePlayViewHolder != null) { if ( LiveAudienceActivity.getmLivePlayViewHolder() != null) {
LiveAudienceActivity.mLivePlayViewHolder.setPkEndview(); LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview();
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -32,8 +32,8 @@ import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LivePKUserListBean;
import com.yunbao.live.custom.ProgressTextView; import com.yunbao.live.custom.ProgressTextView;
import com.yunbao.live.interfaces.ILiveLinkMicViewHolder; import com.yunbao.live.interfaces.ILiveLinkMicViewHolder;
@ -53,7 +53,6 @@ import cn.rongcloud.rtc.api.RCRTCRemoteUser;
import cn.rongcloud.rtc.api.callback.IRCRTCOtherRoomEventsListener; import cn.rongcloud.rtc.api.callback.IRCRTCOtherRoomEventsListener;
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback; import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback; import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
import cn.rongcloud.rtc.api.stream.RCRTCAudioInputStream;
import cn.rongcloud.rtc.api.stream.RCRTCInputStream; import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
import cn.rongcloud.rtc.api.stream.RCRTCVideoInputStream; import cn.rongcloud.rtc.api.stream.RCRTCVideoInputStream;
import cn.rongcloud.rtc.api.stream.RCRTCVideoStreamConfig; import cn.rongcloud.rtc.api.stream.RCRTCVideoStreamConfig;
@ -74,10 +73,10 @@ import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK; import static com.yunbao.live.activity.LiveRyAnchorActivity.isDRPK;
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView; import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView;
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView1; import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView1;
import static com.yunbao.live.views.LivePushRyViewHolder.rcrtcLiveInfo;
import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom;
import static com.yunbao.live.views.LivePushRyViewHolder.contexts; import static com.yunbao.live.views.LivePushRyViewHolder.contexts;
import static com.yunbao.live.views.LivePushRyViewHolder.dr_pk_view; import static com.yunbao.live.views.LivePushRyViewHolder.dr_pk_view;
import static com.yunbao.live.views.LivePushRyViewHolder.rcrtcLiveInfo;
import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom;
//import cn.rongcloud.rtc.jni.video.RCRect; //import cn.rongcloud.rtc.jni.video.RCRect;
@ -170,7 +169,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onLeaveRoom(RCRTCOtherRoom room, int reasonCode) { public void onLeaveRoom(RCRTCOtherRoom room, int reasonCode) {
Log.d("RYM_DG","Other onLeaveRoom: room = " + room.getRoomId()); Log.d("RYM_DG", "Other onLeaveRoom: room = " + room.getRoomId());
} }
}; };
@ -218,7 +217,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
} }
public void setLiveUid(String liveUid, String url) { public void setLiveUid(String liveUid, String url) {
Log.e("liveUid",liveUid); Log.e("liveUid", liveUid);
mLiveUid = liveUid; mLiveUid = liveUid;
mUrl = url; mUrl = url;
} }
@ -334,7 +333,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
String pkUid = datas.getString("pkuid"); String pkUid = datas.getString("pkuid");
Log.i("seed", seed_msg.mResult.toString()); Log.i("seed", seed_msg.mResult.toString());
Log.e("ry1",datas.getString("win_uid")+"VVVVVV"+ datas.getString("pkuid")); Log.e("ry1", datas.getString("win_uid") + "VVVVVV" + datas.getString("pkuid"));
HttpClient.getInstance().post("Tx.sendmsgzs2", "Tx.sendmsgzs2") HttpClient.getInstance().post("Tx.sendmsgzs2", "Tx.sendmsgzs2")
.params("GroupId", "g" + pkUid) .params("GroupId", "g" + pkUid)
@ -499,7 +498,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
rtcRoom.getLocalUser().subscribeStreams(inputStreamList1, new IRCRTCResultCallback() { rtcRoom.getLocalUser().subscribeStreams(inputStreamList1, new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
Log.i("ry","订阅资源成功"); Log.i("ry", "订阅资源成功");
if (rtcRoom != null) { if (rtcRoom != null) {
RCRTCMixConfig config = new RCRTCMixConfig(); RCRTCMixConfig config = new RCRTCMixConfig();
@ -529,7 +528,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
rcrtcLiveInfo.setMixConfig(config, new IRCRTCResultCallback() { rcrtcLiveInfo.setMixConfig(config, new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
Log.e("ry", "混成功"+u.getId()); Log.e("ry", "混成功" + u.getId());
} }
@Override @Override
@ -543,7 +542,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onFailed(RTCErrorCode rtcErrorCode) { public void onFailed(RTCErrorCode rtcErrorCode) {
Log.i("ry","订阅资源失败: " + rtcErrorCode.getReason()); Log.i("ry", "订阅资源失败: " + rtcErrorCode.getReason());
} }
}); });
} }
@ -552,7 +551,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onFailed(RTCErrorCode rtcErrorCode) { public void onFailed(RTCErrorCode rtcErrorCode) {
Log.i("ry","加入其他房间失败 " + rtcErrorCode.getReason()); Log.i("ry", "加入其他房间失败 " + rtcErrorCode.getReason());
} }
}); });
@ -561,16 +560,16 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
/** /**
* 主播与主播PK 主播收到其他主播发过来的PK申请的回调 * 主播与主播PK 主播收到其他主播发过来的PK申请的回调
*/ */
public void onLinkMicPkApply(UserBean u, String stream,int by) { public void onLinkMicPkApply(UserBean u, String stream, int by) {
Log.e("ry", u.getUserNiceName()+"单人收到"+u.getAvatar()); Log.e("ry", u.getUserNiceName() + "单人收到" + u.getAvatar());
mApplyUid = u.getId(); mApplyUid = u.getId();
mApplyUrl = u.getAvatar(); mApplyUrl = u.getAvatar();
mApplyNmae = u.getUserNiceName(); mApplyNmae = u.getUserNiceName();
if(by != 1) { if (by != 1) {
if (mIsApplyDialogShow == false) { if (mIsApplyDialogShow == false) {
showApplyDialog(u); showApplyDialog(u);
} }
}else{ } else {
isPK(); isPK();
} }
} }
@ -600,7 +599,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) { for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) {
//遍历远端用户发布的资源列表 //遍历远端用户发布的资源列表
for (RCRTCInputStream stream : rcrtcOtherRoom.getRemoteUsers().get(i).getStreams()) { for (RCRTCInputStream stream : rcrtcOtherRoom.getRemoteUsers().get(i).getStreams()) {
Log.e("ry",stream.getMediaType()+"类型"); Log.e("ry", stream.getMediaType() + "类型");
if (stream.getMediaType() == RCRTCMediaType.VIDEO) { if (stream.getMediaType() == RCRTCMediaType.VIDEO) {
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
RCRTCVideoView remoteView = new RCRTCVideoView(contexts); RCRTCVideoView remoteView = new RCRTCVideoView(contexts);
@ -659,12 +658,12 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
rtcRoom.getLocalUser().subscribeStreams(inputStreamList, new IRCRTCResultCallback() { rtcRoom.getLocalUser().subscribeStreams(inputStreamList, new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
Log.i("ry","订阅资源成功"); Log.i("ry", "订阅资源成功");
} }
@Override @Override
public void onFailed(RTCErrorCode rtcErrorCode) { public void onFailed(RTCErrorCode rtcErrorCode) {
Log.i("ry","订阅资源失败: " + rtcErrorCode.getReason()); Log.i("ry", "订阅资源失败: " + rtcErrorCode.getReason());
} }
}); });
} }
@ -673,7 +672,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onFailed(RTCErrorCode rtcErrorCode) { public void onFailed(RTCErrorCode rtcErrorCode) {
Log.i("ry","11111加入其他房间失败 " + rtcErrorCode.getReason()); Log.i("ry", "11111加入其他房间失败 " + rtcErrorCode.getReason());
} }
}); });
LivePushRyViewHolder.btn_close.setVisibility(View.VISIBLE); LivePushRyViewHolder.btn_close.setVisibility(View.VISIBLE);
@ -721,7 +720,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
} }
private void isPK(){ private void isPK() {
ScreenDimenUtil util = ScreenDimenUtil.getInstance(); ScreenDimenUtil util = ScreenDimenUtil.getInstance();
int mScreenWdith = util.getScreenWdith(); int mScreenWdith = util.getScreenWdith();
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mScreenWdith * 720 / 960);
@ -738,7 +737,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatarThumb()); msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatarThumb());
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()); msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
rtcRoom.getLocalUser().responseJoinOtherRoom(mApplyUid, mApplyUid, true, true,msg1.toString(), new IRCRTCResultCallback() { rtcRoom.getLocalUser().responseJoinOtherRoom(mApplyUid, mApplyUid, true, true, msg1.toString(), new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
RCRTCEngine.getInstance().joinOtherRoom(mApplyUid, new IRCRTCResultDataCallback<RCRTCOtherRoom>() { RCRTCEngine.getInstance().joinOtherRoom(mApplyUid, new IRCRTCResultDataCallback<RCRTCOtherRoom>() {
@ -770,7 +769,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
rtcRoom.getLocalUser().subscribeStreams(inputStreamList, new IRCRTCResultCallback() { rtcRoom.getLocalUser().subscribeStreams(inputStreamList, new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
Log.i("ry","订阅资源成功"); Log.i("ry", "订阅资源成功");
List<RCRTCStream> streams = new ArrayList<>(); List<RCRTCStream> streams = new ArrayList<>();
streams.add(RCRTCEngine.getInstance().getDefaultVideoStream()); streams.add(RCRTCEngine.getInstance().getDefaultVideoStream());
if (rtcRoom != null) { if (rtcRoom != null) {
@ -815,7 +814,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onFailed(RTCErrorCode rtcErrorCode) { public void onFailed(RTCErrorCode rtcErrorCode) {
Log.i("ry","订阅资源失败: " + rtcErrorCode); Log.i("ry", "订阅资源失败: " + rtcErrorCode);
} }
}); });
} }
@ -825,7 +824,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onFailed(RTCErrorCode rtcErrorCode) { public void onFailed(RTCErrorCode rtcErrorCode) {
Log.e("ry", mApplyUid + "加入其他房间失败 " + rtcErrorCode); Log.e("ry", mApplyUid + "加入其他房间失败 " + rtcErrorCode);
Log.i("ry",mApplyUid + "加入其他房间失败 " + rtcErrorCode); Log.i("ry", mApplyUid + "加入其他房间失败 " + rtcErrorCode);
} }
}); });
@ -834,7 +833,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
LiveRyAnchorActivity.isDRPK = 1; LiveRyAnchorActivity.isDRPK = 1;
LivePushRyViewHolder.btn_close.setVisibility(View.VISIBLE); LivePushRyViewHolder.btn_close.setVisibility(View.VISIBLE);
SocketRyLinkMicPkUtil.linkMicPkAccept(mSocketRyClient, mApplyUid, mApplyUrl, mApplyNmae); SocketRyLinkMicPkUtil.linkMicPkAccept(mSocketRyClient, mApplyUid, mApplyUrl, mApplyNmae);
onLinkMicPkStart(mApplyUid,2); onLinkMicPkStart(mApplyUid, 2);
} }
}); });
} }
@ -848,14 +847,14 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
} }
//与用户连麦 //与用户连麦
public void setUserMic(String liveid){ public void setUserMic(String liveid) {
JSONObject msg1 = new JSONObject(); JSONObject msg1 = new JSONObject();
msg1.put("uid", CommonAppConfig.getInstance().getUid()); msg1.put("uid", CommonAppConfig.getInstance().getUid());
msg1.put("pkuid", CommonAppConfig.getInstance().getUid()); msg1.put("pkuid", CommonAppConfig.getInstance().getUid());
msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatarThumb()); msg1.put("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatarThumb());
msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()); msg1.put("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
rtcRoom.getLocalUser().responseJoinOtherRoom(liveid, liveid, true, true,msg1.toString(), new IRCRTCResultCallback() { rtcRoom.getLocalUser().responseJoinOtherRoom(liveid, liveid, true, true, msg1.toString(), new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
RCRTCEngine.getInstance().joinOtherRoom(liveid, new IRCRTCResultDataCallback<RCRTCOtherRoom>() { RCRTCEngine.getInstance().joinOtherRoom(liveid, new IRCRTCResultDataCallback<RCRTCOtherRoom>() {
@ -865,11 +864,11 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
ToastUtil.show("接受成功"); ToastUtil.show("接受成功");
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() { public void run() {
Log.e("ry",liveid+"来了!!!!"+ rcrtcOtherRoom.getRemoteUsers().size()); Log.e("ry", liveid + "来了!!!!" + rcrtcOtherRoom.getRemoteUsers().size());
for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) { for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) {
//遍历远端用户发布的资源列表 //遍历远端用户发布的资源列表
for (RCRTCInputStream stream : rcrtcOtherRoom.getRemoteUsers().get(i).getStreams()) { for (RCRTCInputStream stream : rcrtcOtherRoom.getRemoteUsers().get(i).getStreams()) {
Log.e("ry",stream.getMediaType()+"rcrtcOtherRoom成功 "+rcrtcOtherRoom.getRemoteUsers().size()); Log.e("ry", stream.getMediaType() + "rcrtcOtherRoom成功 " + rcrtcOtherRoom.getRemoteUsers().size());
if (stream.getMediaType() == RCRTCMediaType.AUDIO) { if (stream.getMediaType() == RCRTCMediaType.AUDIO) {
//音频只需要订阅 //音频只需要订阅
inputStreamList.add(stream); inputStreamList.add(stream);
@ -888,7 +887,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onFailed(RTCErrorCode rtcErrorCode) { public void onFailed(RTCErrorCode rtcErrorCode) {
Log.e("ry","订阅资源失败: " + rtcErrorCode); Log.e("ry", "订阅资源失败: " + rtcErrorCode);
} }
}); });
} }
@ -898,7 +897,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onFailed(RTCErrorCode rtcErrorCode) { public void onFailed(RTCErrorCode rtcErrorCode) {
Log.e("ry", liveid + "加入其他房间失败 " + rtcErrorCode); Log.e("ry", liveid + "加入其他房间失败 " + rtcErrorCode);
Log.i("ry",liveid + "加入其他房间失败 " + rtcErrorCode); Log.i("ry", liveid + "加入其他房间失败 " + rtcErrorCode);
} }
}); });
@ -1051,7 +1050,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
* 退出多人PK * 退出多人PK
*/ */
public static void leaveDRRoom() { public static void leaveDRRoom() {
Log.e("ry", "退出多人OKKK"+inputStreamList.size()); Log.e("ry", "退出多人OKKK" + inputStreamList.size());
isDRPK = 0; isDRPK = 0;
for (int i = 0; i < inputStreamList.size(); i++) { for (int i = 0; i < inputStreamList.size(); i++) {
//退出副房间 //退出副房间
@ -1212,7 +1211,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
//添加水印 //添加水印
// RCRTCRect rect = new RCRTCRect(0.5f, 0.5f, 0.2f); // RCRTCRect rect = new RCRTCRect(0.5f, 0.5f, 0.2f);
// RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(fromText(50, mNameText), rect); // RCRTCEngine.getInstance().getDefaultVideoStream().setWatermark(fromText(50, mNameText), rect);
dRjoinOtherRoom(u.getId(),1); dRjoinOtherRoom(u.getId(), 1);
for (int i = 0; i < users.size(); i++) { for (int i = 0; i < users.size(); i++) {
JSONObject user = users.getJSONObject(i); JSONObject user = users.getJSONObject(i);
@ -1357,8 +1356,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
//多人PK接受申请画 加入副房间 //多人PK接受申请画 加入副房间
public void dRjoinOtherRoom(String uid,int i) { public void dRjoinOtherRoom(String uid, int i) {
Log.e("ry",uid+"洒洒"+i+"VVVV"+i); Log.e("ry", uid + "洒洒" + i + "VVVV" + i);
mApplyUid = uid; mApplyUid = uid;
RCRTCEngine.getInstance().joinOtherRoom(mApplyUid, new IRCRTCResultDataCallback<RCRTCOtherRoom>() { RCRTCEngine.getInstance().joinOtherRoom(mApplyUid, new IRCRTCResultDataCallback<RCRTCOtherRoom>() {
@Override @Override
@ -1378,14 +1377,14 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
dr_pk_view.setVisibility(View.VISIBLE); dr_pk_view.setVisibility(View.VISIBLE);
} }
Log.e("ry","多人接受成功"+mApplyUid); Log.e("ry", "多人接受成功" + mApplyUid);
ToastUtil.show("接受成功"); ToastUtil.show("接受成功");
//遍历远端用户列表 //遍历远端用户列表
for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) { for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) {
Log.e("ry", rcrtcOtherRoom.getRemoteUsers().get(i).getUserId()+"收到rcrtcOtherRoom"+rcrtcOtherRoom.getRemoteUsers().size()); Log.e("ry", rcrtcOtherRoom.getRemoteUsers().get(i).getUserId() + "收到rcrtcOtherRoom" + rcrtcOtherRoom.getRemoteUsers().size());
//遍历远端用户发布的资源列表 //遍历远端用户发布的资源列表
for (RCRTCInputStream stream : rcrtcOtherRoom.getRemoteUsers().get(i).getStreams()) { for (RCRTCInputStream stream : rcrtcOtherRoom.getRemoteUsers().get(i).getStreams()) {
Log.e("ry", i+"收到" + stream.getMediaType() + "实打实打算"+rcrtcOtherRoom.getRemoteUsers().get(i).getUserId()); Log.e("ry", i + "收到" + stream.getMediaType() + "实打实打算" + rcrtcOtherRoom.getRemoteUsers().get(i).getUserId());
if (stream.getMediaType() == RCRTCMediaType.VIDEO) { if (stream.getMediaType() == RCRTCMediaType.VIDEO) {
if (inputStreamList.size() == 0) { if (inputStreamList.size() == 0) {
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
@ -1429,12 +1428,12 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
rtcRoom.getLocalUser().subscribeStreams(inputStreamList1, new IRCRTCResultCallback() { rtcRoom.getLocalUser().subscribeStreams(inputStreamList1, new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
Log.i("ry","订阅资源成功"); Log.i("ry", "订阅资源成功");
} }
@Override @Override
public void onFailed(RTCErrorCode rtcErrorCode) { public void onFailed(RTCErrorCode rtcErrorCode) {
Log.i("ry","订阅资源失败: " + rtcErrorCode.getReason()); Log.i("ry", "订阅资源失败: " + rtcErrorCode.getReason());
} }
}); });
//2. 合流画布设置 //2. 合流画布设置
@ -1458,7 +1457,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onFailed(RTCErrorCode rtcErrorCode) { public void onFailed(RTCErrorCode rtcErrorCode) {
Log.e("ry", mApplyUid + "加入其他房间失败 " + rtcErrorCode); Log.e("ry", mApplyUid + "加入其他房间失败 " + rtcErrorCode);
Log.i("ry",mApplyUid + "加入其他房间失败 " + rtcErrorCode); Log.i("ry", mApplyUid + "加入其他房间失败 " + rtcErrorCode);
} }
}); });
} }
@ -1488,7 +1487,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) { for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) {
//遍历远端用户发布的资源列表 //遍历远端用户发布的资源列表
for (RCRTCInputStream stream : rcrtcOtherRoom.getRemoteUsers().get(i).getStreams()) { for (RCRTCInputStream stream : rcrtcOtherRoom.getRemoteUsers().get(i).getStreams()) {
Log.e("ry111",stream.getMediaType()+""); Log.e("ry111", stream.getMediaType() + "");
if (stream.getMediaType() == RCRTCMediaType.VIDEO) { if (stream.getMediaType() == RCRTCMediaType.VIDEO) {
if (inputStreamList.size() == 0) { if (inputStreamList.size() == 0) {
//如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示 //如果远端用户发布的是视频流创建显示视图RCRTCVideoView并添加到布局中显示
@ -1536,12 +1535,12 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
rtcRoom.getLocalUser().subscribeStreams(inputStreamList1, new IRCRTCResultCallback() { rtcRoom.getLocalUser().subscribeStreams(inputStreamList1, new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
Log.i("ry","订阅资源成功"); Log.i("ry", "订阅资源成功");
} }
@Override @Override
public void onFailed(RTCErrorCode rtcErrorCode) { public void onFailed(RTCErrorCode rtcErrorCode) {
Log.i("ry","订阅资源失败: " + rtcErrorCode.getReason()); Log.i("ry", "订阅资源失败: " + rtcErrorCode.getReason());
} }
}); });
@ -1549,7 +1548,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
rcrtcLiveInfo.setMixConfig(create_Custom_MixConfig(false, inputStreamList), new IRCRTCResultCallback() { rcrtcLiveInfo.setMixConfig(create_Custom_MixConfig(false, inputStreamList), new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
Log.e("ry", inputStreamList.size()+"混成功"+u); Log.e("ry", inputStreamList.size() + "混成功" + u);
} }
@Override @Override
@ -1567,7 +1566,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onFailed(RTCErrorCode rtcErrorCode) { public void onFailed(RTCErrorCode rtcErrorCode) {
Log.i("ry","加入其他房间失败 " + rtcErrorCode.getReason()); Log.i("ry", "加入其他房间失败 " + rtcErrorCode.getReason());
} }
}); });
@ -1775,8 +1774,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
/** /**
* 主播与主播PK 所有人收到PK开始的回调 * 主播与主播PK 所有人收到PK开始的回调
*/ */
public void onLinkMicPkStart(String pkUid,int i) { public void onLinkMicPkStart(String pkUid, int i) {
Log.d("tag", i+"mPkTimeCount2"); Log.d("tag", i + "mPkTimeCount2");
mIsPk = true; mIsPk = true;
hideSendPkWait(); hideSendPkWait();
mIsPkEnd = false; mIsPkEnd = false;
@ -1788,8 +1787,8 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
mLiveLinkMicPkViewHolder = new LiveLinkMicPkViewHolder(mContext, mPkContainer); mLiveLinkMicPkViewHolder = new LiveLinkMicPkViewHolder(mContext, mPkContainer);
mLiveLinkMicPkViewHolder.addToParent(); mLiveLinkMicPkViewHolder.addToParent();
mLiveLinkMicPkViewHolder.setIsAnchor(mIsAnchor); mLiveLinkMicPkViewHolder.setIsAnchor(mIsAnchor);
if (LiveAudienceActivity.mLivePlayViewHolder != null) { if (LiveAudienceActivity.getmLivePlayViewHolder() != null) {
LiveAudienceActivity.mLivePlayViewHolder.setPkview(); LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
} }
} }
@ -1840,7 +1839,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
}, 3000); }, 3000);
} }
} else { } else {
Log.e("ry1",winUid+"result"); Log.e("ry1", winUid + "result");
if (winUid.equals(mLiveUid)) { if (winUid.equals(mLiveUid)) {
mLiveLinkMicPkViewHolder.end(1); mLiveLinkMicPkViewHolder.end(1);
} else { } else {
@ -1903,9 +1902,9 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
public void run() { public void run() {
// try { // try {
// Thread.sleep(4000); // Thread.sleep(4000);
if (LiveAudienceActivity.mLivePlayViewHolder != null) { if ( LiveAudienceActivity.getmLivePlayViewHolder() != null) {
LiveAudienceActivity.mLivePlayViewHolder.setPkEndview(); LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview();
} }
// } catch (InterruptedException e) { // } catch (InterruptedException e) {
// e.printStackTrace(); // e.printStackTrace();
// } // }

View File

@ -171,7 +171,7 @@ public class SocketClient {
LiveRoomViewHolder.d_pk_view.setVisibility(View.GONE); LiveRoomViewHolder.d_pk_view.setVisibility(View.GONE);
//創建了多人房間 //創建了多人房間
} else if (action3 == 9) { } else if (action3 == 9) {
LiveAudienceActivity.mLivePlayViewHolder.setPkview(); LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
} }
break; break;
case Constants.SOCKET_ALL_SERVER_NOTIFY://全服通知 case Constants.SOCKET_ALL_SERVER_NOTIFY://全服通知

View File

@ -242,7 +242,7 @@ public class SocketRyClient {
} }
LiveRoomViewHolder.UpPkBar(map.getJSONArray("userlist"), mLiveUid, map.getIntValue("drpk_time")); LiveRoomViewHolder.UpPkBar(map.getJSONArray("userlist"), mLiveUid, map.getIntValue("drpk_time"));
if (LiveRyAnchorActivity.mLivePushViewHolder == null) { if (LiveRyAnchorActivity.mLivePushViewHolder == null) {
LiveAudienceActivity.mLivePlayViewHolder.setPkview(); LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
} }
} else if (action3 == 5) { } else if (action3 == 5) {
@ -256,17 +256,17 @@ public class SocketRyClient {
leaveDRRoom(); leaveDRRoom();
isDRPK = 0; isDRPK = 0;
} else { } else {
LiveAudienceActivity.mLivePlayViewHolder.setPkEndview(); LiveAudienceActivity.getmLivePlayViewHolder().setPkEndview();
} }
//創建了多人房間 //創建了多人房間
} else if (action3 == 3) { } else if (action3 == 3) {
if (LiveAudienceActivity.mLivePlayViewHolder != null) { if ( LiveAudienceActivity.getmLivePlayViewHolder() != null) {
LiveAudienceActivity.mLivePlayViewHolder.setPkview(); LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
} }
isDRPK = 1; isDRPK = 1;
} else if (action3 == 10) { } else if (action3 == 10) {
if (!map.getString("uid").equals(CommonAppConfig.getInstance().getUid())) { if (!map.getString("uid").equals(CommonAppConfig.getInstance().getUid())) {
LiveAudienceActivity.mLivePlayViewHolder.setPkview(); LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
} }
} }

View File

@ -0,0 +1,63 @@
package com.yunbao.live.views;
import android.content.Intent;
import android.content.res.Configuration;
/**
* 该类的方法对应 Activity 的方法
*/
public interface LiveActivityLifeCallback {
/**
* Activity onStart
*/
void onStart();
/**
* Activity onResume
*/
void onResume();
/**
* Activity onPause
*/
void onPause();
/**
* Activity onStop
*/
void onStop();
/**
* Activity onDestroy
*/
void onDestroy();
/**
* Activity onRestart
*/
void onRestart();
/**
* Activity onConfigurationChanged
*/
void onConfigurationChanged(Configuration newConfig);
/**
* Activity onActivityResult
*/
void onActivityResult(int requestCode, int resultCode, Intent data);
/**
* Activity onNewIntent
*/
void onNewIntent(Intent intent);
/**
* Activity onBackPressed
*/
void onBackPressed();
}

View File

@ -116,9 +116,7 @@ public class LiveAddImpressViewHolder extends AbsLivePageViewHolder {
mLinkedList.clear(); mLinkedList.clear();
mGroup.removeAllViews(); mGroup.removeAllViews();
removeFromParent(); removeFromParent();
if (CommonAppConfig.LIVE_ROOM_SCROLL && mContext != null && mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).setScrollFrozen(false);
}
} }
private void initData() { private void initData() {
@ -151,9 +149,7 @@ public class LiveAddImpressViewHolder extends AbsLivePageViewHolder {
line++; line++;
mGroup.addView(linearLayout); mGroup.addView(linearLayout);
} }
if (CommonAppConfig.LIVE_ROOM_SCROLL && mContext != null && mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).setScrollFrozen(true);
}
} }
} }
}); });

View File

@ -109,8 +109,6 @@ public class LiveContributeViewHolder extends AbsLivePageViewHolder implements V
@Override @Override
public void onHide() { public void onHide() {
if (CommonAppConfig.LIVE_ROOM_SCROLL && mContext != null && mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).setScrollFrozen(false);
}
} }
} }

View File

@ -108,8 +108,6 @@ public class LiveMedalRankViewHolder extends AbsLivePageViewHolder implements Vi
@Override @Override
public void onHide() { public void onHide() {
if (CommonAppConfig.LIVE_ROOM_SCROLL && mContext != null && mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).setScrollFrozen(false);
}
} }
} }

View File

@ -0,0 +1,27 @@
package com.yunbao.live.views;
import android.view.ViewGroup;
import com.yunbao.live.bean.LiveBean;
public interface LivePlayListener extends LiveActivityLifeCallback {
/**
* 用户滑动显示该页面
*
* @param data 房间信息
*/
void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk);
/**
* 用户滑动移除该页面
*/
void onRemove();
/**
* @return 页面的根布局 View
*/
ViewGroup getRootView();
}

View File

@ -1,6 +1,5 @@
package com.yunbao.live.views; package com.yunbao.live.views;
import android.Manifest;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.media.AudioManager; import android.media.AudioManager;
@ -14,17 +13,12 @@ import android.view.ViewGroup;
import android.view.ViewParent; import android.view.ViewParent;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.tencent.live2.V2TXLiveDef; import com.tencent.live2.V2TXLiveDef;
import com.tencent.live2.V2TXLivePlayer; import com.tencent.live2.V2TXLivePlayer;
import com.tencent.live2.impl.V2TXLivePlayerImpl; import com.tencent.live2.impl.V2TXLivePlayerImpl;
import com.tencent.rtmp.ui.TXCloudVideoView; import com.tencent.rtmp.ui.TXCloudVideoView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
@ -36,8 +30,6 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@ -47,8 +39,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import cn.rongcloud.rtc.api.RCRTCEngine; import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.RCRTCMixConfig;
import cn.rongcloud.rtc.api.RCRTCOtherRoom;
import cn.rongcloud.rtc.api.RCRTCRemoteUser; import cn.rongcloud.rtc.api.RCRTCRemoteUser;
import cn.rongcloud.rtc.api.RCRTCRoom; import cn.rongcloud.rtc.api.RCRTCRoom;
import cn.rongcloud.rtc.api.RCRTCRoomConfig; import cn.rongcloud.rtc.api.RCRTCRoomConfig;
@ -57,7 +47,6 @@ import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener; import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener;
import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleCallback; import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleCallback;
import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleDataCallback; import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleDataCallback;
import cn.rongcloud.rtc.api.stream.RCRTCCDNInputStream;
import cn.rongcloud.rtc.api.stream.RCRTCInputStream; import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo; import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo;
import cn.rongcloud.rtc.api.stream.RCRTCOutputStream; import cn.rongcloud.rtc.api.stream.RCRTCOutputStream;
@ -69,20 +58,9 @@ import cn.rongcloud.rtc.base.RCRTCMediaType;
import cn.rongcloud.rtc.base.RCRTCParamsType; import cn.rongcloud.rtc.base.RCRTCParamsType;
import cn.rongcloud.rtc.base.RCRTCRoomType; import cn.rongcloud.rtc.base.RCRTCRoomType;
import cn.rongcloud.rtc.base.RTCErrorCode; import cn.rongcloud.rtc.base.RTCErrorCode;
import cn.rongcloud.rtc.core.RendererCommon;
import cn.rongcloud.rtc.plugin.player.IPlayerPrepareListener;
import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL; import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL;
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread; import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
import static com.yunbao.live.activity.LiveActivity.mLiveRyLinkMicPkPresenter;
import static com.yunbao.live.activity.LiveRyAnchorActivity.mLivePushViewHolder;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.leaveDRRoom;
import static com.yunbao.live.views.AbsRyLivePushViewHolder.mPreView;
import static com.yunbao.live.views.LivePushRyViewHolder.contexts;
import static com.yunbao.live.views.LivePushRyViewHolder.dr_pk_view;
import static com.yunbao.live.views.LivePushRyViewHolder.rcrtcLiveInfo;
import static com.yunbao.live.views.LivePushRyViewHolder.rtcRoom;
public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
@ -118,6 +96,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
public static int Micing = 0; public static int Micing = 0;
RCRTCRoom rcrtcRoom; RCRTCRoom rcrtcRoom;
String purl; String purl;
public LivePlayRyViewHolder(Context context, ViewGroup parentView, int landscapes) { public LivePlayRyViewHolder(Context context, ViewGroup parentView, int landscapes) {
super(context, parentView); super(context, parentView);
contexts = context; contexts = context;
@ -223,7 +202,9 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
public void release() { public void release() {
mEnd = true; mEnd = true;
mStarted = false; mStarted = false;
mPlayer.stopPlay(); if (mPlayer != null) {
mPlayer.stopPlay();
}
L.e(TAG, "release------->"); L.e(TAG, "release------->");
} }
@ -440,7 +421,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
UsertoRY(); UsertoRY();
} }
}); });
}else if("inviteMic".equals(str)){ } else if ("inviteMic".equals(str)) {
DialogUitl.showSimpleDialog(mContext, "主播邀請您進行語音連麥", new DialogUitl.SimpleCallback() { DialogUitl.showSimpleDialog(mContext, "主播邀請您進行語音連麥", new DialogUitl.SimpleCallback() {
@Override @Override
public void onConfirmClick(Dialog dialog, String content) { public void onConfirmClick(Dialog dialog, String content) {
@ -448,8 +429,8 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
} }
}); });
}else if("endMic".equals(str)){ } else if ("endMic".equals(str)) {
if(rcrtcRoom!=null){ if (rcrtcRoom != null) {
// 开始切换为观众身份 // 开始切换为观众身份
RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() { RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() {
@ -464,18 +445,18 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
@Override @Override
public void onSuccess() { public void onSuccess() {
Log.e("ry", "下麦成功"); Log.e("ry", "下麦成功");
// 该用户切换为观众成功可以以观众身份进行音视频 // 该用户切换为观众成功可以以观众身份进行音视频
//退出rtc播放 //退出rtc播放
RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() { RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
Log.e("ry", "退出多人房间成功"); Log.e("ry", "退出多人房间成功");
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() { public void run() {
mPlayer.startPlay(purl); mPlayer.startPlay(purl);
Log.e("ry",mPlayer.isPlaying()+"purl"+purl); Log.e("ry", mPlayer.isPlaying() + "purl" + purl);
if(mPlayer.isPlaying()!=1){ if (mPlayer.isPlaying() != 1) {
mPlayer.startPlay(purl); mPlayer.startPlay(purl);
} }
ry_view.removeAllViews(); ry_view.removeAllViews();
@ -483,7 +464,8 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
rcrtcRoom = null; rcrtcRoom = null;
Micing = 0; Micing = 0;
ToastUtil.show("已成功退出語音連麥"); ToastUtil.show("已成功退出語音連麥");
}}); }
});
} }
@Override @Override
@ -501,7 +483,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
*/ */
@Override @Override
public void onFailed(RTCErrorCode errorCode) { public void onFailed(RTCErrorCode errorCode) {
Log.e("ry", "下麦失败"+errorCode); Log.e("ry", "下麦失败" + errorCode);
} }
}); });
@ -564,7 +546,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
// new Handler().postDelayed(new Runnable() { // new Handler().postDelayed(new Runnable() {
// @Override // @Override
// public void run() { // public void run() {
toMic(); toMic();
// } // }
// }, 3000); // }, 3000);

View File

@ -104,7 +104,6 @@ import pl.droidsonroids.gif.GifImageView;
import static com.yunbao.common.CommonAppContext.logger; import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.live.activity.LiveAudienceActivity.countDownTimer;
/** /**
* Created by cxf on 2018/10/9. * Created by cxf on 2018/10/9.
@ -1200,8 +1199,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} else if (i == R.id.btn_follow) { } else if (i == R.id.btn_follow) {
follow(); follow();
if (countDownTimer != null) { if (((LiveAudienceActivity) mContext).getCountDownTimer() != null) {
countDownTimer.cancel(); ((LiveAudienceActivity) mContext).getCountDownTimer().cancel();
} }
} else if (i == R.id.view_medal) { } else if (i == R.id.view_medal) {
//点击粉丝勋章, 弹窗 开通粉丝勋章 //点击粉丝勋章, 弹窗 开通粉丝勋章
@ -1255,8 +1254,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (TextUtils.isEmpty(mLiveUid)) { if (TextUtils.isEmpty(mLiveUid)) {
return; return;
} }
if (countDownTimer != null) { if (((LiveAudienceActivity) Contexts).getCountDownTimer() != null) {
countDownTimer.cancel(); ((LiveAudienceActivity) Contexts).getCountDownTimer().cancel();
} }
CommonHttpUtil.setAttention(mLiveUid, new CommonCallback<Integer>() { CommonHttpUtil.setAttention(mLiveUid, new CommonCallback<Integer>() {
@Override @Override
@ -1292,7 +1291,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
dialog.findViewById(R.id.btn_confirm).setOnClickListener(new View.OnClickListener() { dialog.findViewById(R.id.btn_confirm).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
LiveAudienceActivity.backIndex = 1; ((LiveAudienceActivity) context).setBackIndex(1);
((LiveAudienceActivity) context).onBackPressed(); ((LiveAudienceActivity) context).onBackPressed();
follow(); follow();
} }
@ -1300,7 +1299,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
dialog.findViewById(R.id.btn_cancel).setOnClickListener(new View.OnClickListener() { dialog.findViewById(R.id.btn_cancel).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
LiveAudienceActivity.backIndex = 1; ((LiveAudienceActivity) context).setBackIndex(1);
((LiveAudienceActivity) context).onBackPressed(); ((LiveAudienceActivity) context).onBackPressed();
} }
}); });
@ -1318,15 +1317,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (isStayRoomfive) { if (isStayRoomfive) {
showFollowDialog(mNameText, mAvatarUrl, mContext); showFollowDialog(mNameText, mAvatarUrl, mContext);
} else { } else {
LiveAudienceActivity.backIndex = 1; ((LiveAudienceActivity) mContext).setBackIndex(1);
((LiveAudienceActivity) mContext).onBackPressed(); ((LiveAudienceActivity) mContext).onBackPressed();
} }
} else { } else {
LiveAudienceActivity.backIndex = 1; ((LiveAudienceActivity) mContext).setBackIndex(1);
((LiveAudienceActivity) mContext).onBackPressed(); ((LiveAudienceActivity) mContext).onBackPressed();
} }
} else { } else {
LiveAudienceActivity.backIndex = 1; ((LiveAudienceActivity) mContext).setBackIndex(1);
((LiveAnchorActivity) mContext).onBackPressed(); ((LiveAnchorActivity) mContext).onBackPressed();
} }
} else { } else {

View File

@ -112,8 +112,6 @@ public class LiveWebViewHolder extends AbsLivePageViewHolder implements View.OnC
@Override @Override
public void onHide() { public void onHide() {
if (CommonAppConfig.LIVE_ROOM_SCROLL && mContext != null && mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).setScrollFrozen(false);
}
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -138,8 +138,6 @@ public class TurnTableWebViewHolder extends AbsLivePageViewHolder implements Vie
@Override @Override
public void onHide() { public void onHide() {
if (CommonAppConfig.LIVE_ROOM_SCROLL && mContext != null && mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).setScrollFrozen(false);
}
} }
} }

View File

@ -177,8 +177,6 @@ public class WishlistWebViewHolder extends AbsLivePageViewHolder implements View
@Override @Override
public void onHide() { public void onHide() {
if (CommonAppConfig.LIVE_ROOM_SCROLL && mContext != null && mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).setScrollFrozen(false);
}
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/img_loading_01"
android:duration="350" />
<item
android:drawable="@drawable/img_loading_02"
android:duration="350" />
<item
android:drawable="@drawable/img_loading_03"
android:duration="350" />
</animation-list>

View File

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" <com.yunbao.common.views.weight.MyDrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -79,9 +80,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="8dp" android:paddingStart="8dp"
android:paddingEnd="8dp" android:paddingTop="56dp"
android:paddingTop="56dp" android:paddingEnd="8dp">
>
<com.ms.banner.Banner <com.ms.banner.Banner
android:id="@+id/banner" android:id="@+id/banner"
@ -113,4 +113,4 @@
</FrameLayout> </FrameLayout>
</androidx.drawerlayout.widget.DrawerLayout> </com.yunbao.common.views.weight.MyDrawerLayout>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.yunbao.common.views.weight.VerticalViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never" />
</RelativeLayout>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@mipmap/live_bg" />
<ImageView
android:id="@+id/iv_loading"
android:layout_width="50dp"
android:layout_height="10dp"
android:layout_centerInParent="true"
android:background="@drawable/loading_animation" />
</RelativeLayout>

View File

@ -126,9 +126,10 @@ import cn.rongcloud.rtc.api.RCRTCEngine;
import io.reactivex.Observer; import io.reactivex.Observer;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import io.rong.imlib.RongIMClient; import io.rong.imlib.RongIMClient;
import kotlin.Unit;
import static com.yunbao.common.CommonAppContext.isReady; import static com.yunbao.common.CommonAppContext.isReady;
import kotlin.*;
@Route(path = RouteUtil.PATH_MAIN) @Route(path = RouteUtil.PATH_MAIN)
public class MainActivity extends AbsActivity implements MainAppBarLayoutListener { public class MainActivity extends AbsActivity implements MainAppBarLayoutListener {
@ -273,7 +274,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
Display mDisplay = getWindowManager().getDefaultDisplay(); Display mDisplay = getWindowManager().getDefaultDisplay();
Height = mDisplay.getHeight(); Height = mDisplay.getHeight();
// IMLib 初始化 // IMLib 初始化
RongIMClient.init(this, RongcloudIMManager.RONG_IM_KEY,true); RongIMClient.init(this, RongcloudIMManager.RONG_IM_KEY, true);
// RTCLib 初始化 // RTCLib 初始化
RCRTCConfig.Builder config = RCRTCConfig.Builder.create(); RCRTCConfig.Builder config = RCRTCConfig.Builder.create();
RCRTCEngine.getInstance().init(MainActivity.this, config.build()); RCRTCEngine.getInstance().init(MainActivity.this, config.build());
@ -673,7 +674,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (info.length > 0) { if (info.length > 0) {
Log.e("MainActivity", info[0]);
JSONObject obj = JSON.parseObject(info[0]); JSONObject obj = JSON.parseObject(info[0]);
if (code == 0) { if (code == 0) {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
@ -683,7 +683,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.show(getSupportFragmentManager(), "SigninDialog"); fragment.show(getSupportFragmentManager(), "SigninDialog");
} }
if (obj.containsKey("msg_zdy_send") && obj.containsKey("msg_zdy_send_text")) { if (obj != null && obj.containsKey("msg_zdy_send") && obj.containsKey("msg_zdy_send_text")) {
Log.e("MainActivity333", info[0]); Log.e("MainActivity333", info[0]);
NoviceInstructorManager.get(mContext).getNetNoviceInstructor(info[0]); NoviceInstructorManager.get(mContext).getNetNoviceInstructor(info[0]);
} }