修复:
直播间滑动导致画面卡顿问题
This commit is contained in:
parent
11854ba95a
commit
afc60eddfc
@ -109,6 +109,8 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
|
|
||||||
private ViewGroup mViewGroup;
|
private ViewGroup mViewGroup;
|
||||||
private int liveBg = 0;
|
private int liveBg = 0;
|
||||||
|
//直播间进入房间队列
|
||||||
|
private Handler liveHandler = new Handler();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -246,13 +248,27 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
|
|
||||||
private void loadData(ViewGroup viewGroup, int currentItem) {
|
private void loadData(ViewGroup viewGroup, int currentItem) {
|
||||||
mViewGroup = viewGroup;
|
mViewGroup = viewGroup;
|
||||||
|
mLastPosition = currentItem;
|
||||||
|
liveHandler.removeCallbacks(liveRunnable);
|
||||||
|
if (mCurrentPage > 0) {
|
||||||
|
liveHandler.postDelayed(liveRunnable, 800);
|
||||||
|
} else {
|
||||||
|
liveHandler.post(liveRunnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Runnable liveRunnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
AnchorRecommendItemModel data = itemModelList.get(mCurrentPage);
|
AnchorRecommendItemModel data = itemModelList.get(mCurrentPage);
|
||||||
|
|
||||||
//获取直播间状态
|
//获取直播间状态
|
||||||
LiveHttpUtil.getLiveInfo(data.getUid(), liveInfo);
|
LiveHttpUtil.getLiveInfo(data.getUid(), liveInfo);
|
||||||
mLastPosition = currentItem;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取直播间状态
|
* 获取直播间状态
|
||||||
|
@ -61,6 +61,7 @@ import com.yunbao.common.http.HttpCallback;
|
|||||||
import com.yunbao.common.interfaces.CommonCallback;
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||||
import com.yunbao.common.utils.Bus;
|
import com.yunbao.common.utils.Bus;
|
||||||
|
import com.yunbao.common.utils.DeviceUtils;
|
||||||
import com.yunbao.common.utils.DialogUitl;
|
import com.yunbao.common.utils.DialogUitl;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
@ -2355,7 +2356,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
if (fastMsgRecyclerView == null) return;
|
if (fastMsgRecyclerView == null) return;
|
||||||
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)
|
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)
|
||||||
fastMsgRecyclerView.getLayoutParams();
|
fastMsgRecyclerView.getLayoutParams();
|
||||||
params1.rightMargin = 400;
|
params1.rightMargin = DeviceUtils.getScreenWidth((Activity) mContext) / 3;
|
||||||
fastMsgRecyclerView.setLayoutParams(params1);
|
fastMsgRecyclerView.setLayoutParams(params1);
|
||||||
} else if ("stop_svga_new_user_gif".equals(str)) {
|
} else if ("stop_svga_new_user_gif".equals(str)) {
|
||||||
if (fastMsgRecyclerView == null) return;
|
if (fastMsgRecyclerView == null) return;
|
||||||
|
@ -83,6 +83,7 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||||
@ -166,6 +167,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
private LiveImDeletUtil liveImDeletUtil;
|
private LiveImDeletUtil liveImDeletUtil;
|
||||||
private List<String> greetings = new ArrayList<>();
|
private List<String> greetings = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
public PortraitLiveManager(Activity context, Intent intent) {
|
public PortraitLiveManager(Activity context, Intent intent) {
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
this.mIntent = intent;
|
this.mIntent = intent;
|
||||||
@ -273,7 +275,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemove() {
|
public void onRemove() {
|
||||||
end();
|
endPlay();
|
||||||
|
Executors.newCachedThreadPool().execute(() -> end());
|
||||||
if (mLiveAudienceViewHolder != null) {
|
if (mLiveAudienceViewHolder != null) {
|
||||||
mLiveAudienceViewHolder.removeFromParent();
|
mLiveAudienceViewHolder.removeFromParent();
|
||||||
mLiveAudienceViewHolder.countDownTimerTrickery = null;
|
mLiveAudienceViewHolder.countDownTimerTrickery = null;
|
||||||
@ -545,6 +548,11 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChat(LiveChatBean bean, int index) {
|
public void onChat(LiveChatBean bean, int index) {
|
||||||
|
if (bean.getType() == 1) {
|
||||||
|
if (!bean.getContent().contains(mLiveBean.getUserNiceName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (mLiveRoomViewHolder != null) {
|
if (mLiveRoomViewHolder != null) {
|
||||||
mLiveRoomViewHolder.insertChat(bean, index);
|
mLiveRoomViewHolder.insertChat(bean, index);
|
||||||
}
|
}
|
||||||
@ -1355,7 +1363,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
Log.i("tx", "退出失败");
|
Log.i("tx", "退出失败");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
endPlay();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -1457,4 +1465,5 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user