小時榜進入直播間問題

This commit is contained in:
18401019693 2022-09-01 17:56:40 +08:00
parent bb81bd380d
commit c25de1d25e
5 changed files with 85 additions and 75 deletions

View File

@ -869,4 +869,5 @@ Limited ride And limited avatar frame</string>
<string name="effects_settings">Effect settings</string> <string name="effects_settings">Effect settings</string>
<string name="shield_gift_effect">Shield gift effect</string> <string name="shield_gift_effect">Shield gift effect</string>
<string name="shield_mount_effect">Shield car effect</string> <string name="shield_mount_effect">Shield car effect</string>
<string name="current_live_room">You are in the current live room</string>
</resources> </resources>

View File

@ -243,7 +243,7 @@
<string name="live_votes">收穫</string> <string name="live_votes">收穫</string>
<string name="live_watch_num">觀看人數</string> <string name="live_watch_num">觀看人數</string>
<string name="live_end_ing">關播中</string> <string name="live_end_ing">關播中</string>
<string name="live_say_something">一起聊聊天吧~</string> <string name="live_say_something">一起聊聊天吧~</string>
<string name="live_open_alba">開啟彈幕,</string> <string name="live_open_alba">開啟彈幕,</string>
<string name="live_tiao"></string> <string name="live_tiao"></string>
<string name="live_input_password">請輸入房間密碼</string> <string name="live_input_password">請輸入房間密碼</string>
@ -882,4 +882,5 @@
<string name="effects_settings">特效設置</string> <string name="effects_settings">特效設置</string>
<string name="shield_gift_effect">屏蔽禮物特效</string> <string name="shield_gift_effect">屏蔽禮物特效</string>
<string name="shield_mount_effect">屏蔽座駕特效</string> <string name="shield_mount_effect">屏蔽座駕特效</string>
<string name="current_live_room">您已在當前直播間</string>
</resources> </resources>

View File

@ -293,7 +293,7 @@ public class LiveAudienceActivity extends LiveActivity {
mStream = liveBean1.getStream(); mStream = liveBean1.getStream();
mAncherName = liveBean1.getUserNiceName(); mAncherName = liveBean1.getUserNiceName();
mAncherIcon = liveBean1.getAvatar(); mAncherIcon = liveBean1.getAvatar();
Log.e("收到socket--->", "mLiveUid--------------------------->" + mLiveUid); Log.e(TAG, "mLiveUid--------------------------->" + mLiveUid);
//加载当前页面数据 //加载当前页面数据
View rootView = manager.getRootView(); View rootView = manager.getRootView();
if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) { if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
@ -796,8 +796,8 @@ public class LiveAudienceActivity extends LiveActivity {
intent.putExtra(Constants.LIVE_SDK, liveSdk); intent.putExtra(Constants.LIVE_SDK, liveSdk);
intent.putExtra(Constants.LIVE_SDK, liveSdk); intent.putExtra(Constants.LIVE_SDK, liveSdk);
intent.putExtra("landscape", liveBean.getLandscape()); intent.putExtra("landscape", liveBean.getLandscape());
// intent.putExtra("isry", true);
context.startActivity(intent); context.startActivity(intent);
} }
/** /**

View File

@ -1,9 +1,5 @@
package com.yunbao.live.dialog; package com.yunbao.live.dialog;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build; import android.os.Build;
@ -34,14 +30,22 @@ import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
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.activity.LiveAudienceActivity;
import com.yunbao.live.activity.ZhuangBanActivity; import com.yunbao.live.activity.ZhuangBanActivity;
import com.yunbao.live.bean.LiveBean; import com.yunbao.live.bean.LiveBean;
import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import org.greenrobot.eventbus.EventBus;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
public class LiveHDDialogFragment extends AbsDialogFragment { public class LiveHDDialogFragment extends AbsDialogFragment {
private WebView mWebView; private WebView mWebView;
@ -55,6 +59,7 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
/** /**
* 弹出全屏对话框 * 弹出全屏对话框
*
* @param isFullWindow 是否为全屏模式 * @param isFullWindow 是否为全屏模式
*/ */
public LiveHDDialogFragment(boolean isFullWindow) { public LiveHDDialogFragment(boolean isFullWindow) {
@ -108,22 +113,6 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
window.setAttributes(params); window.setAttributes(params);
} }
// @Override
// public void onStart() {
// super.onStart();
//// Window window = getDialog().getWindow();
//// window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
//// WindowManager.LayoutParams windowParams = window.getAttributes();
//// windowParams.dimAmount = 0.0f;
//// windowParams.y = 100;
//// window.setAttributes(windowParams);
//// Dialog dialog = getDialog();
//// if (dialog != null) {
//// DisplayMetrics dm = new DisplayMetrics();
//// getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
//// dialog.getWindow().setLayout((int) (dm.widthPixels), (int) (dm.heightPixels * (showType == 0 ? 0.5 : 1)));
//// }
// }
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
@ -224,6 +213,7 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
dismiss(); dismiss();
((LiveAudienceActivity) mContext).openGiftWindow(); ((LiveAudienceActivity) mContext).openGiftWindow();
} }
@JavascriptInterface @JavascriptInterface
public void androidGoBack() { public void androidGoBack() {
dismiss(); dismiss();
@ -232,9 +222,23 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
@JavascriptInterface @JavascriptInterface
public void androidMethodLookToLive(String liveId) { public void androidMethodLookToLive(String liveId) {
mWebView.post(new Runnable() {
@Override
public void run() {
if (TextUtils.equals(roomId, liveId)) {
ToastUtil.show(R.string.current_live_room);
dismiss();
} else {
//看直播 //看直播
gotoLive(liveId); gotoLive(liveId);
} }
}
});
}
@JavascriptInterface @JavascriptInterface
public void androidClickToNewH5PageView(String url) { public void androidClickToNewH5PageView(String url) {
url = CommonAppConfig.HOST + url; url = CommonAppConfig.HOST + url;
@ -248,27 +252,27 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
} }
} }
private LiveRoomCheckLivePresenter mCheckLivePresenter; private LiveRoomCheckLivePresenter mCheckLivePresenter;
private void gotoLive(final String live_id) { private void gotoLive(final String live_id) {
if(roomId!=null&&roomId.equals(live_id)){ if (!TextUtils.equals(roomId, live_id)) {
return;
}
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter.isRoom = false;
if (mCheckLivePresenter == null) { if (mCheckLivePresenter == null) {
LiveRoomCheckLivePresenter.isRoom = false;
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override @Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
if (liveBean == null) { if (liveBean == null) {
return; return;
} }
dismiss();
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
((LiveAudienceActivity) mContext).finish();
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
} }
}); });
} }
@ -280,6 +284,8 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
}); });
} }
}
/** /**
* 显示个人资料弹窗 * 显示个人资料弹窗
*/ */

View File

@ -166,7 +166,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
private LiveImDeletUtil liveImDeletUtil; private LiveImDeletUtil liveImDeletUtil;
private List<String> greetings = new ArrayList<>(); private List<String> greetings = new ArrayList<>();
private Handler liveHandler = new Handler(); private Handler liveHandler = new Handler();
//公共參數
private OpenParametersModel openParametersModel = null;
public PortraitLiveManager(Activity context, Intent intent) { public PortraitLiveManager(Activity context, Intent intent) {
this.mContext = context; this.mContext = context;
@ -204,6 +205,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override @Override
public void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) { public void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) {
openParametersModel = new OpenParametersModel();
mContext.runOnUiThread(new Runnable() { mContext.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -217,7 +219,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
liveID = data.getUid(); liveID = data.getUid();
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
.setParametersModel(new OpenParametersModel() .setParametersModel(openParametersModel
.setmLiveType(mLiveType) .setmLiveType(mLiveType)
.setmLiveTypeVal(mLiveTypeVal))); .setmLiveTypeVal(mLiveTypeVal)));
@ -1031,7 +1033,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
//回传参数 //回传参数
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
.setParametersModel(new OpenParametersModel().setmDanmuPrice(mDanmuPrice) .setParametersModel(openParametersModel.setmDanmuPrice(mDanmuPrice)
.setmSocketUserType(mSocketUserType) .setmSocketUserType(mSocketUserType)
.setmChatLevel(mChatLevel) .setmChatLevel(mChatLevel)
.setmDanMuLevel(mDanMuLevel) .setmDanMuLevel(mDanMuLevel)
@ -1209,7 +1211,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS) .setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
.setParametersModel(new OpenParametersModel().setmLiveGuardInfo(mLiveGuardInfo) .setParametersModel(openParametersModel.setmLiveGuardInfo(mLiveGuardInfo)
.setFansNum(fansNum) .setFansNum(fansNum)
.setIs_fans(is_fans))); .setIs_fans(is_fans)));
if (mLiveRoomViewHolder != null) { if (mLiveRoomViewHolder != null) {