小時榜進入直播間問題

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="shield_gift_effect">Shield gift 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>

View File

@ -243,7 +243,7 @@
<string name="live_votes">收穫</string>
<string name="live_watch_num">觀看人數</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_tiao"></string>
<string name="live_input_password">請輸入房間密碼</string>
@ -882,4 +882,5 @@
<string name="effects_settings">特效設置</string>
<string name="shield_gift_effect">屏蔽禮物特效</string>
<string name="shield_mount_effect">屏蔽座駕特效</string>
<string name="current_live_room">您已在當前直播間</string>
</resources>

View File

@ -293,7 +293,7 @@ public class LiveAudienceActivity extends LiveActivity {
mStream = liveBean1.getStream();
mAncherName = liveBean1.getUserNiceName();
mAncherIcon = liveBean1.getAvatar();
Log.e("收到socket--->", "mLiveUid--------------------------->" + mLiveUid);
Log.e(TAG, "mLiveUid--------------------------->" + mLiveUid);
//加载当前页面数据
View rootView = manager.getRootView();
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("landscape", liveBean.getLandscape());
// intent.putExtra("isry", true);
context.startActivity(intent);
}
/**

View File

@ -1,9 +1,5 @@
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.graphics.Color;
import android.os.Build;
@ -34,19 +30,27 @@ import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.ZhuangBanActivity;
import com.yunbao.live.bean.LiveBean;
import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpUtil;
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 {
private WebView mWebView;
private int showType = 0;
private boolean isFullWindow=false;
private boolean isFullWindow = false;
private String roomId;
public LiveHDDialogFragment() {
@ -55,6 +59,7 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
/**
* 弹出全屏对话框
*
* @param isFullWindow 是否为全屏模式
*/
public LiveHDDialogFragment(boolean isFullWindow) {
@ -82,48 +87,32 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
window.setWindowAnimations(R.style.bottomToTopAnim);
WindowManager.LayoutParams params = window.getAttributes();
params.width = WindowManager.LayoutParams.MATCH_PARENT;
if(isFullWindow){
Display display=null;
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT);
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.R) {
display= requireContext().getDisplay();
if (isFullWindow) {
Display display = null;
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
display = requireContext().getDisplay();
window.getInsetsController().hide(WindowInsets.Type.statusBars());
window.getInsetsController().hide(WindowInsets.Type.navigationBars());
}else {
display=window.getWindowManager().getDefaultDisplay();
} else {
display = window.getWindowManager().getDefaultDisplay();
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
window.getDecorView().setBackgroundColor(Color.parseColor("#10000000"));
params.height = WindowManager.LayoutParams.MATCH_PARENT;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
window.getDecorView().setMinimumHeight(display.getMode().getPhysicalHeight());
window.getDecorView().setMinimumWidth(display.getMode().getPhysicalWidth());
}
window.getDecorView().setPadding(10,-10,0,0);
}else {
window.getDecorView().setPadding(10, -10, 0, 0);
} else {
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
}
params.gravity = Gravity.BOTTOM;
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
public void onActivityCreated(Bundle savedInstanceState) {
@ -146,19 +135,19 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
if (bundle == null) {
return;
}
roomId=bundle.getString("roomId",null);
roomId = bundle.getString("roomId", null);
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}
showType = bundle.getInt("show_type");
if (showType==0){
if (showType == 0) {
findViewById(R.id.title_laout).setVisibility(View.GONE);
}else {
} else {
findViewById(R.id.title_laout).setVisibility(View.VISIBLE);
}
if(bundle.getInt("height",-1)!=-1) {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, bundle.getInt("height",-1));
if (bundle.getInt("height", -1) != -1) {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, bundle.getInt("height", -1));
mWebView.setLayoutParams(params);
}
mWebView.loadUrl(bundle.getString("url"));
@ -224,19 +213,34 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
dismiss();
((LiveAudienceActivity) mContext).openGiftWindow();
}
@JavascriptInterface
public void androidGoBack(){
public void androidGoBack() {
dismiss();
}
@JavascriptInterface
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);
}
}
});
}
@JavascriptInterface
public void androidClickToNewH5PageView(String url){
public void androidClickToNewH5PageView(String url) {
url = CommonAppConfig.HOST + url;
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken();
@ -248,27 +252,27 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
}
}
private LiveRoomCheckLivePresenter mCheckLivePresenter;
private void gotoLive(final String live_id) {
if(roomId!=null&&roomId.equals(live_id)){
return;
}
if (!TextUtils.equals(roomId, live_id)) {
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter.isRoom = false;
if (mCheckLivePresenter == null) {
LiveRoomCheckLivePresenter.isRoom = false;
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
if (liveBean == null) {
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 List<String> greetings = new ArrayList<>();
private Handler liveHandler = new Handler();
//公共參數
private OpenParametersModel openParametersModel = null;
public PortraitLiveManager(Activity context, Intent intent) {
this.mContext = context;
@ -204,6 +205,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override
public void onAdd(LiveBean data, int liveType, int liveTypeVal, int liveSdk) {
openParametersModel = new OpenParametersModel();
mContext.runOnUiThread(new Runnable() {
@Override
public void run() {
@ -217,7 +219,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
liveID = data.getUid();
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
.setParametersModel(new OpenParametersModel()
.setParametersModel(openParametersModel
.setmLiveType(mLiveType)
.setmLiveTypeVal(mLiveTypeVal)));
@ -1031,7 +1033,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
//回传参数
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
.setParametersModel(new OpenParametersModel().setmDanmuPrice(mDanmuPrice)
.setParametersModel(openParametersModel.setmDanmuPrice(mDanmuPrice)
.setmSocketUserType(mSocketUserType)
.setmChatLevel(mChatLevel)
.setmDanMuLevel(mDanMuLevel)
@ -1209,7 +1211,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.OPEN_PARAMETERS)
.setParametersModel(new OpenParametersModel().setmLiveGuardInfo(mLiveGuardInfo)
.setParametersModel(openParametersModel.setmLiveGuardInfo(mLiveGuardInfo)
.setFansNum(fansNum)
.setIs_fans(is_fans)));
if (mLiveRoomViewHolder != null) {