优化:

修改直播间loading,去除腾讯IM
This commit is contained in:
18401019693 2022-08-24 18:01:32 +08:00
parent cff66d234d
commit 0dd33d9dec
28 changed files with 356 additions and 365 deletions

View File

@ -6,9 +6,6 @@ import android.content.ClipboardManager;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androidx.fragment.app.DialogFragment;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@ -16,9 +13,10 @@ import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.TextView;
import androidx.fragment.app.DialogFragment;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.tencent.imsdk.conversation.ConversationManager;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity;
@ -49,13 +47,12 @@ import com.yunbao.live.bean.LivePKUserListBean;
import com.yunbao.live.bean.LiveReceiveGiftBean;
import com.yunbao.live.bean.LiveUserGiftBean;
import com.yunbao.live.dialog.GiftPrizePoolFragment;
import com.yunbao.live.dialog.LiveChatListDialogFragment;
import com.yunbao.live.dialog.LiveChatRoomDialogFragment;
import com.yunbao.live.dialog.LiveFansFragment;
import com.yunbao.live.dialog.LiveFansMedalOkDialogFragment;
import com.yunbao.live.dialog.LiveGiveHotDialogFragment;
import com.yunbao.live.dialog.LiveGuardBuyDialogFragment;
import com.yunbao.live.dialog.LiveGuardDialogFragment;
import com.yunbao.live.dialog.LiveGiveHotDialogFragment;
import com.yunbao.live.dialog.LiveInputDialogFragment;
import com.yunbao.live.dialog.LiveMoreDialogFragment;
import com.yunbao.live.dialog.LiveRedPackListDialogFragment;
@ -69,7 +66,6 @@ import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
import com.yunbao.live.presenter.LiveLinkMicPkPresenter;
import com.yunbao.live.presenter.LiveLinkMicPresenter;
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import com.yunbao.live.socket.SocketChatUtil;
import com.yunbao.live.socket.SocketClient;
import com.yunbao.live.socket.SocketMessageListener;
import com.yunbao.live.socket.SocketRyChatUtil;
@ -91,8 +87,6 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.HashSet;
import java.util.List;
import io.rong.imkit.utils.RouteUtils;
/**
* Created by cxf on 2018/10/7.
*/
@ -138,7 +132,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
private LiveChatRoomDialogFragment mLiveChatRoomDialogFragment;//私信聊天窗口
protected LiveGuardInfo mLiveGuardInfo;
private HashSet<DialogFragment> mDialogFragmentSet;
public boolean isRy = false;
// public static boolean isRy = true;
@Override
protected void main() {
@ -205,17 +199,17 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
if (!mFirstConnectSocket) {
mFirstConnectSocket = true;
if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) {
if (isRy == false) {
SocketChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
} else {
// if (isRy == false) {
// SocketChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
// } else {
SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
// }
}
}
if (isRy == false) {
SocketChatUtil.getFakeFans(mLiveUid);
} else {
// if (isRy == false) {
// SocketChatUtil.getFakeFans(mLiveUid);
// } else {
SocketRyChatUtil.getFakeFans(mLiveUid);
}
// }
}
}
}
@ -364,15 +358,15 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/
@Override
public void onSendGiftPk(long leftGift, long rightGift, LivePKUserListBean bean) {
if (isRy == false) {
if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
}
} else {
// if (isRy == false) {
// if (mLiveLinkMicPkPresenter != null) {
// mLiveLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
// }
// } else {
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
}
}
// }
}
/**
@ -615,21 +609,21 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/
@Override
public void onLinkMicAnchorClose() {
if (isRy == false) {
if (mLiveLinkMicAnchorPresenter != null) {
mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose();
}
if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onLinkMicPkClose(1);
}
} else {
// if (isRy == false) {
// if (mLiveLinkMicAnchorPresenter != null) {
// mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose();
// }
// if (mLiveLinkMicPkPresenter != null) {
// mLiveLinkMicPkPresenter.onLinkMicPkClose(1);
// }
// } else {
if (mLiveLinkMicAnchorPresenter != null) {
mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose();
}
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(1);
}
}
// }
if (this instanceof LiveAudienceActivity) {
@ -688,23 +682,23 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
@Override
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname) {
Log.e("ry", "pkUid" + pkUid + "pkhead" + pkhead + "pkname" + pkname);
if (isRy == false) {
if (mLiveLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveLinkMicPkPresenter.onLinkMicPkStart(pkUid, pkhead, pkname);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (mLiveRoomViewHolder != null) {
if (mIsAnchor == false) {
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
}
}
}
}, 4000);//3秒后执行Runnable中的run方法
}
} else {
// if (isRy == false) {
// if (mLiveLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
// mLiveLinkMicPkPresenter.onLinkMicPkStart(pkUid, pkhead, pkname);
// Handler handler = new Handler();
// handler.postDelayed(new Runnable() {
// @Override
// public void run() {
// if (mLiveRoomViewHolder != null) {
// if (mIsAnchor == false) {
// mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
// }
// }
// }
// }, 4000);//3秒后执行Runnable中的run方法
//
// }
// } else {
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
Handler handler = new Handler();
@ -721,7 +715,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
}, 4000);//3秒后执行Runnable中的run方法
}
}
// }
}
@ -730,16 +724,16 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/
@Override
public void onLinkMicPkClose(int i) {
if (isRy == false) {
if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onLinkMicPkClose(i);
}
} else {
// if (isRy == false) {
// if (mLiveLinkMicPkPresenter != null) {
// mLiveLinkMicPkPresenter.onLinkMicPkClose(i);
// }
// } else {
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(i);
} else if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onLinkMicPkClose(i);
}
// }
}
}
@ -772,12 +766,12 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/
@Override
public void onLinkMicPkEnd(String winUid) {
if (isRy == false) {
if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid);
mLiveRoomViewHolder.setDelOtherInfo();
}
} else {
// if (isRy == false) {
// if (mLiveLinkMicPkPresenter != null) {
// mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid);
// mLiveRoomViewHolder.setDelOtherInfo();
// }
// } else {
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkEnd(winUid);
mLiveRoomViewHolder.setDelOtherInfo();
@ -785,7 +779,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid);
mLiveRoomViewHolder.setDelOtherInfo();
}
}
// }
}
@ -908,7 +902,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
}
/**
* 弹幕 消息
*/
@ -939,11 +932,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
onCoinChanged(coin);
}
String[] data = new String[]{obj.getString("barragetoken")};
if (isRy == false) {
SocketChatUtil.sendDanmuMessage(mLiveUid, contents);
} else {
// if (isRy == false) {
// SocketChatUtil.sendDanmuMessage(mLiveUid, contents);
// } else {
SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents);
}
// }
} else {
ToastUtil.show(msg);
}
@ -963,11 +956,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
}
}
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
if (isRy == false) {
SocketChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType);
} else {
// if (isRy == false) {
// SocketChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType);
// } else {
SocketRyChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType);
}
// }
}
/**
@ -975,7 +968,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/
public static void sendSystemMessage(String content) {
// if (isRy == false) {
SocketChatUtil.sendSystemMessage(mLiveUid, content);
// SocketChatUtil.sendSystemMessage(mLiveUid, content);
// } else {
SocketRyChatUtil.sendSystemMessage(mLiveUid, content);
// }
@ -988,11 +981,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
public void sendGiftMessage(LiveGiftBean giftBean, String giftToken, String ancherName, String by) {
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
if (isRy == false) {
SocketChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by);
} else {
// if (isRy == false) {
// SocketChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by);
// } else {
SocketRyChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by);
}
// }
}
@ -1000,33 +993,33 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 主播或管理员踢人
*/
public void kickUser(String toUid, String toName) {
if (isRy == false) {
SocketChatUtil.sendKickMessage(mLiveUid, toUid, toName);
} else {
// if (isRy == false) {
// SocketChatUtil.sendKickMessage(mLiveUid, toUid, toName);
// } else {
SocketRyChatUtil.sendKickMessage(mLiveUid, toUid, toName);
}
// }
}
/**
* 禁言
*/
public void setShutUp(String toUid, String toName, int type) {
if (isRy == false) {
SocketChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
} else {
// if (isRy == false) {
// SocketChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
// } else {
SocketRyChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
}
// }
}
/**
* 设置或取消管理员消息
*/
public void sendSetAdminMessage(int action, String toUid, String toName) {
if (isRy == false) {
SocketChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName);
} else {
// if (isRy == false) {
// SocketChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName);
// } else {
SocketRyChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName);
}
// }
}
@ -1034,22 +1027,22 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 超管关闭直播间
*/
public void superCloseRoom() {
if (isRy == false) {
SocketChatUtil.superCloseRoom(mLiveUid);
} else {
// if (isRy == false) {
// SocketChatUtil.superCloseRoom(mLiveUid);
// } else {
SocketRyChatUtil.superCloseRoom(mLiveUid);
}
// }
}
/**
* 更新主播映票数
*/
public void sendUpdateVotesMessage(int deltaVal) {
if (isRy == false) {
SocketChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal);
} else {
// if (isRy == false) {
// SocketChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal);
// } else {
SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal);
}
// }
}
@ -1057,20 +1050,20 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 发送购买守护成功消息
*/
public void sendBuyGuardMessage(String votes, int guardNum, int guardType) {
if (isRy == false) {
SocketChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType);
} else {
// if (isRy == false) {
// SocketChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType);
// } else {
SocketRyChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType);
}
// }
}
public void sendBuyGuardMessage2(String votes, int guardNum, int guardType, String ancherName, String liveId) {
if (guardType != 1) {
if (isRy == false) {
SocketChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId);
} else {
// if (isRy == false) {
// SocketChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId);
// } else {
SocketRyChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId);
}
// }
}
}
@ -1078,11 +1071,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 发送发红包成功消息
*/
public void sendRedPackMessage() {
if (isRy == false) {
SocketChatUtil.sendRedPackMessage(mLiveUid);
} else {
// if (isRy == false) {
// SocketChatUtil.sendRedPackMessage(mLiveUid);
// } else {
SocketRyChatUtil.sendRedPackMessage(mLiveUid);
}
// }
}
@ -1214,7 +1207,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
}
/**
* 监听关注变化事件
*/

View File

@ -4,11 +4,12 @@ import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.DialogFragment;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.DialogFragment;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.lzy.okgo.callback.Callback;
@ -122,7 +123,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
@Override
protected void main() {
super.main();
isRy = false;
// isRy = false;
Intent intent = getIntent();
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
@ -413,7 +414,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
hasGame = mGameList.size() > 0;
}
bundle.putBoolean(Constants.HAS_GAME, hasGame);
bundle.putBoolean("isRy", false);
// bundle.putBoolean("isRy", true);
bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen());
fragment.setArguments(bundle);
fragment.setFunctionClickListener(this);
@ -597,30 +598,30 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
if (isRy == false) {
SocketChatUtil.closeLive(mLiveUid, mSocketClient);
//断开socket
if (mSocketClient != null) {
mSocketClient.disConnect();
}
if (LivePushTxViewHolder.mTRTCCloud != null) {
LivePushTxViewHolder.mTRTCCloud.exitRoom();
}
if (LiveLinkMicPkPresenter.mTRTCCloud1 != null) {
LiveLinkMicPkPresenter.mTRTCCloud1.exitRoom();
LiveLinkMicPkPresenter.mTRTCCloud1.stopLocalPreview();
}
if (LivePushTxViewHolder.mTRTCCloud != null) {
LivePushTxViewHolder.mTRTCCloud.exitRoom();
LivePushTxViewHolder.mTRTCCloud.stopLocalPreview();
}
} else {
// if (isRy == false) {
// SocketChatUtil.closeLive(mLiveUid, mSocketClient);
//
// //断开socket
// if (mSocketClient != null) {
// mSocketClient.disConnect();
// }
//
// if (LivePushTxViewHolder.mTRTCCloud != null) {
//
// LivePushTxViewHolder.mTRTCCloud.exitRoom();
// }
//
// if (LiveLinkMicPkPresenter.mTRTCCloud1 != null) {
// LiveLinkMicPkPresenter.mTRTCCloud1.exitRoom();
// LiveLinkMicPkPresenter.mTRTCCloud1.stopLocalPreview();
// }
// if (LivePushTxViewHolder.mTRTCCloud != null) {
//
// LivePushTxViewHolder.mTRTCCloud.exitRoom();
// LivePushTxViewHolder.mTRTCCloud.stopLocalPreview();
//
// }
// } else {
// SocketRyChatUtil.closeLive(mLiveUid, mSocketRyClient);
//断开socket
if (mSocketRyClient != null) {
@ -644,7 +645,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
}
mLivePushViewHolder = null;
mLiveLinkMicPresenter = null;
}
// }
} else {
ToastUtil.show(msg);
}

View File

@ -149,11 +149,11 @@ public class LiveAudienceActivity extends LiveActivity {
mLiveBean = intent.getParcelableExtra(Constants.LIVE_BEAN);
mLiveUid = mLiveBean.getUid();
mStream = mLiveBean.getStream();
if (getIntent().getIntExtra("isry", 0) == 1) {
isRy = true;
} else {
isRy = false;
}
// if (getIntent().getIntExtra("isry", 0) == 1) {
// isRy = true;
// } else {
// isRy = false;
// }
setVolumeControlStream(AudioManager.STREAM_MUSIC);
manager = new PortraitLiveManager(this, intent);
initView();
@ -809,6 +809,8 @@ public class LiveAudienceActivity extends LiveActivity {
break;
case LIVE_ROOM_EXCEPTION:
//主播未直播时自动下滑至下一个直播间
itemModelList.remove(mCurrentPage);
mPagerAdapter.notifyDataSetChanged();
verticalViewPager.setCurrentItem(mCurrentPage + 1);
break;
@ -834,7 +836,7 @@ public class LiveAudienceActivity extends LiveActivity {
intent.putExtra(Constants.LIVE_SDK, liveSdk);
intent.putExtra(Constants.LIVE_SDK, liveSdk);
intent.putExtra("landscape", liveBean.getLandscape());
intent.putExtra("isry", liveBean.getIs_rong());
// intent.putExtra("isry", true);
context.startActivity(intent);
}

View File

@ -146,7 +146,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
@Override
protected void main() {
super.main();
isRy = true;
// isRy = true;
Intent intent = getIntent();
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
@ -590,7 +590,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
hasGame = mGameList.size() > 0;
}
bundle.putBoolean(Constants.HAS_GAME, hasGame);
bundle.putBoolean("isRy", true);
// bundle.putBoolean("isRy", true);
bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen());
fragment.setArguments(bundle);
fragment.setFunctionClickListener(this);

View File

@ -50,7 +50,7 @@ public class VerticalPagerAdapter extends androidx.viewpager.widget.PagerAdapter
ImageView ivLoading = view.findViewById(R.id.iv_loading);
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
frameAnimation.start();
// ImgLoader.displayGif(mContext, R.drawable.live_loading, ivLoading);
view.setId(position);
container.addView(view);
return view;

View File

@ -24,7 +24,7 @@ import com.yunbao.live.interfaces.LiveFunctionClickListener;
public class LiveFunctionDialogFragment extends AbsDialogFragment implements OnItemClickListener<Integer> {
private LiveFunctionClickListener mFunctionClickListener;
boolean isRy = false;
// boolean isRy = false;
@Override
protected int getLayoutId() {
return R.layout.dialog_live_function;
@ -60,7 +60,7 @@ public class LiveFunctionDialogFragment extends AbsDialogFragment implements OnI
if (bundle != null) {
hasGame = bundle.getBoolean(Constants.HAS_GAME, false);
openFlash = bundle.getBoolean(Constants.OPEN_FLASH, false);
isRy = bundle.getBoolean("isRy", false);
// isRy = bundle.getBoolean("isRy", false);
}
RecyclerView recyclerView = (RecyclerView) mRootView.findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
@ -85,11 +85,11 @@ public class LiveFunctionDialogFragment extends AbsDialogFragment implements OnI
@Override
public void onDestroy() {
mFunctionClickListener = null;
if(isRy == false) {
((LiveAnchorActivity) mContext).setBtnFunctionDark();
}else{
// if(isRy == false) {
// ((LiveAnchorActivity) mContext).setBtnFunctionDark();
// }else{
((LiveRyAnchorActivity) mContext).setBtnFunctionDark();
}
// }
super.onDestroy();
}
}

View File

@ -226,6 +226,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
}
public static void setViewUP(int i) {
if (mVideoView == null) return;
Log.i("", "整理" + i);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
params.height = vHeight;

View File

@ -100,7 +100,6 @@ import java.lang.ref.WeakReference;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import pl.droidsonroids.gif.GifImageView;
@ -230,13 +229,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public static RelativeLayout lt_pk_line;
public WindowManager windowManager;
public boolean isRy = false;
// public boolean isRy = false;
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
super(context, parentView);
Contexts = context;
this.forAct = forActivity;
this.isRy = isRys;
// this.isRy = isRys;
mGifImageView = gifImageView;
mSVGAImageView = svgaImageView;
mLiveGiftPrizePoolContainer = liveGiftPrizePoolContainer;
@ -1175,6 +1174,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
getIsHot();
getGuardInfo();
}
private void getGuardInfo() {
LiveHttpUtil.getUserList(mLiveUid, mStream, "guard", 1, new HttpCallback() {
@Override
@ -1187,6 +1187,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
});
}
private void setGuardIcon(LiveUserGiftBean guard) {
if (guard != null) {
ImgLoader.displayAvatar(mContext, guard.getAvatar(), userGuard);
@ -1346,25 +1347,25 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 退出直播间
*/
private void close() {
if (isRy == false) {
if (forAct == 1) {
//是否关注0==没关注
if (isAttention == 0) {
if (isStayRoomfive) {
showFollowDialog(mNameText, mAvatarUrl, mContext);
} else {
((LiveAudienceActivity) mContext).setBackIndex(1);
((LiveAudienceActivity) mContext).onBackPressed();
}
} else {
((LiveAudienceActivity) mContext).setBackIndex(1);
((LiveAudienceActivity) mContext).onBackPressed();
}
} else {
((LiveAudienceActivity) mContext).setBackIndex(1);
((LiveAnchorActivity) mContext).onBackPressed();
}
} else {
// if (isRy == false) {
// if (forAct == 1) {
// //是否关注0==没关注
// if (isAttention == 0) {
// if (isStayRoomfive) {
// showFollowDialog(mNameText, mAvatarUrl, mContext);
// } else {
// ((LiveAudienceActivity) mContext).setBackIndex(1);
// ((LiveAudienceActivity) mContext).onBackPressed();
// }
// } else {
// ((LiveAudienceActivity) mContext).setBackIndex(1);
// ((LiveAudienceActivity) mContext).onBackPressed();
// }
// } else {
// ((LiveAudienceActivity) mContext).setBackIndex(1);
// ((LiveAnchorActivity) mContext).onBackPressed();
// }
// } else {
if (forAct == 1) {
//是否关注0==没关注
if (isAttention == 0) {
@ -1382,7 +1383,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
LiveRyAnchorActivity.backIndex = 1;
((LiveRyAnchorActivity) mContext).onBackPressed();
}
}
// }
}
/**
@ -1823,6 +1824,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
});
}
public void resetUserListWidth(int width) {
ViewGroup.LayoutParams params = mUserRecyclerView.getLayoutParams();
params.width = width;

View File

@ -36,7 +36,6 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.RandomUtil;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
@ -68,7 +67,6 @@ import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter;
import com.yunbao.live.presenter.LiveLinkMicPkPresenter;
import com.yunbao.live.presenter.LiveLinkMicPresenter;
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import com.yunbao.live.socket.SocketChatUtil;
import com.yunbao.live.socket.SocketClient;
import com.yunbao.live.socket.SocketMessageListener;
import com.yunbao.live.socket.SocketRyChatUtil;
@ -85,7 +83,6 @@ import io.rong.imlib.chatroom.base.RongChatRoomClient;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.live.presenter.LiveLinkMicPresenter.mBannerList2;
import static com.yunbao.live.views.LivePlayKsyViewHolder.setViewUP;
import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive;
/**
@ -202,11 +199,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
.setParametersModel(new OpenParametersModel()
.setmLiveType(mLiveType)
.setmLiveTypeVal(mLiveTypeVal)));
if (mIntent.getIntExtra("isry", 0) == 1) {
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, mIntent.getIntExtra("landscape", 0));
} else {
mLivePlayViewHolder = new LivePlayKsyViewHolder(mContext, playContainer, mIntent.getIntExtra("landscape", 0));
}
mLivePlayViewHolder.addToParent();
mLivePlayViewHolder.subscribeActivityLifeCycle();
mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager());
@ -218,11 +213,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveAudienceViewHolder.subscribeActivityLifeCycle();
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, mLiveAudienceViewHolder.getContentView());
mLiveLinkMicAnchorPresenter = new LiveLinkMicAnchorPresenter(mContext, mLivePlayViewHolder, false, mLiveSDK, null);
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
mLiveLinkMicPkPresenter = new LiveLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
} else {
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
}
//直播间背景
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack);
@ -234,11 +227,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.setName(data.getUserNiceName());
mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip());
mLiveRoomViewHolder.setTitle(data.getTitle());
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
mLiveLinkMicPkPresenter.setLiveUid(data.getUid(), "");
} else {
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");
}
mLiveLinkMicPresenter.setLiveUid(data.getUid());
//心愿单
LiveHttpUtil.getWishList(mLiveBean.getUid(), new HttpCallback() {
@ -264,17 +255,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void onRemove() {
mLiveAudienceViewHolder.removeCallbacks();
//断开socket
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
if (mSocketClient != null) {
mSocketClient.disConnect();
}
mSocketClient = null;
} else {
if (mSocketRyClient != null) {
mSocketRyClient.disConnect();
}
mSocketRyClient = null;
}
//结束播放
if (mLivePlayViewHolder != null) {
@ -387,20 +373,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (!mFirstConnectSocket) {
mFirstConnectSocket = true;
if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) {
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
SocketChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1);
} else {
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal, 1);
}
}
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
SocketChatUtil.getFakeFans(mLiveBean.getUid());
} else {
SocketRyChatUtil.getFakeFans(mLiveBean.getUid());
}
}
}
}
@Override
public void onDisConnect() {
@ -498,14 +478,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override
public void onSendGiftPk(long leftGift, long rightGift, LivePKUserListBean bean) {
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
}
} else {
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onPkProgressChanged(leftGift, rightGift, bean);
}
}
}
@ -813,17 +789,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
private void enterRoom() {
//进入直播间IM
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
mSocketClient = new SocketClient(mLiveBean.getUid(), this);
if (mLiveLinkMicPresenter != null) {
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
}
} else {
mSocketRyClient = new SocketRyClient(mLiveBean.getUid(), this);
if (mLiveLinkMicPresenter != null) {
mLiveLinkMicPresenter.setSocketClient(mSocketClient);
}
}
timeIndex = 0;
LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() {
@Override
@ -970,18 +941,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
if (obj.getString("isconnection") != null && obj.getString("isconnection").equals("1")) {
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
setViewUP();
} else {
LivePlayRyViewHolder.setViewUP(1);
}
}
if (pkInfo.getIntValue("ifpk") == 1 && pkInfo.getString("end_pk_time").equals("0")) {//pk开始了
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
setViewUP();
} else {
LivePlayRyViewHolder.setViewUP(2);
}
//pk排名数据
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
if (mLiveRoomViewHolder != null) {
@ -993,11 +960,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean);
}
} else if (!pkInfo.getString("end_pk_time").equals("0")) {
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
setViewUP();
} else {
LivePlayRyViewHolder.setViewUP(3);
}
//pk排名数据
LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class);
if (mLiveLinkMicPkPresenter != null) {
@ -1009,11 +974,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
//多人PK
} else if (pkInfo != null && pkInfo.getIntValue("drpk_status") == 1) {
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
setViewUP();
} else {
LivePlayRyViewHolder.setViewUP(4);
}
mLiveRoomViewHolder.UpPkBar(pkInfo.getJSONArray("userlist"), mLiveBean.getUid(), pkInfo.getIntValue("drpk_time"));
}
@ -1135,17 +1098,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
mEnd = true;
//断开socket
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
if (mSocketClient != null) {
mSocketClient.disConnect();
}
mSocketClient = null;
} else {
if (mSocketRyClient != null) {
mSocketRyClient.disConnect();
}
mSocketRyClient = null;
}
//结束播放
if (mLivePlayViewHolder != null) {
@ -1265,11 +1223,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
if (!mLighted) {
mLighted = true;
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
SocketChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
} else {
SocketRyChatUtil.sendLightMessage(mLiveBean.getUid(), 1 + RandomUtil.nextInt(6), guardType);
}
}
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.playLightAnim();
@ -1323,10 +1278,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
* 更新主播映票数
*/
public void sendUpdateVotesMessage() {
if (!(mIntent.getIntExtra("isry", 0) == 1)) {
SocketChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
} else {
SocketRyChatUtil.sendUpdateVotesMessage(mLiveBean.getUid(), mLiveTypeVal);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -2,13 +2,53 @@
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/img_loading_01"
android:duration="350" />
android:drawable="@drawable/loading_00000"
android:duration="200" />
<item
android:drawable="@drawable/img_loading_02"
android:duration="350" />
android:drawable="@drawable/loading_00001"
android:duration="200" />
<item
android:drawable="@drawable/img_loading_03"
android:duration="350" />
android:drawable="@drawable/loading_00002"
android:duration="200" />
<item
android:drawable="@drawable/loading_00003"
android:duration="200" />
<item
android:drawable="@drawable/loading_00004"
android:duration="200" />
<item
android:drawable="@drawable/loading_00005"
android:duration="200" />
<item
android:drawable="@drawable/loading_00006"
android:duration="200" />
<item
android:drawable="@drawable/loading_00007"
android:duration="200" />
<item
android:drawable="@drawable/loading_00008"
android:duration="200" />
<item
android:drawable="@drawable/loading_00009"
android:duration="200" />
<item
android:drawable="@drawable/loading_00010"
android:duration="200" />
<item
android:drawable="@drawable/loading_00011"
android:duration="200" />
<item
android:drawable="@drawable/loading_00012"
android:duration="200" />
<item
android:drawable="@drawable/loading_00013"
android:duration="200" />
<item
android:drawable="@drawable/loading_00014"
android:duration="200" />
<item
android:drawable="@drawable/loading_00015"
android:duration="200" />
</animation-list>

View File

@ -12,8 +12,8 @@
<ImageView
android:id="@+id/iv_loading"
android:layout_width="50dp"
android:layout_height="10dp"
android:layout_width="150dp"
android:layout_height="188dp"
android:layout_centerInParent="true"
android:background="@drawable/loading_animation" />