diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveDialog.java index 7325b31cf..81a005f42 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallAchieveDialog.java @@ -1,6 +1,7 @@ package com.yunbao.common.dialog; import android.content.Context; +import android.content.res.Configuration; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; @@ -85,7 +86,7 @@ public class GiftWallAchieveDialog extends AbsDialogPopupWindow { @Override protected int getPopupHeight() { - if (isFullWindows) { + if (isFullWindows ||getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { return super.getPopupHeight(); } int screenHeight = ScreenDimenUtil.getInstance().getScreenHeight(); diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java index 3b016f84d..3e126ce66 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java @@ -2,6 +2,7 @@ package com.yunbao.common.dialog; import android.app.Activity; import android.content.Context; +import android.content.res.Configuration; import android.graphics.Color; import android.graphics.Typeface; import android.view.View; @@ -80,6 +81,7 @@ public class GiftWallDialog extends AbsDialogPopupWindow { } + @Override public int bindLayoutId() { return R.layout.dialog_gift_wall; @@ -87,13 +89,18 @@ public class GiftWallDialog extends AbsDialogPopupWindow { @Override protected int getPopupHeight() { - if (isFullWindows) { + if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { + if (isFullWindows) { + return super.getPopupHeight() - DpUtil.dp2px(10); + } + int screenHeight = ScreenDimenUtil.getInstance().getScreenHeight(); + return (int) (screenHeight * 0.8); + } else { return super.getPopupHeight() - DpUtil.dp2px(10); } - int screenHeight = ScreenDimenUtil.getInstance().getScreenHeight(); - return (int) (screenHeight * 0.8); } + void initView() { mIvBg = findViewById(R.id.iv_root_bg); mIvTips = findViewById(R.id.v_tips); @@ -196,6 +203,10 @@ public class GiftWallDialog extends AbsDialogPopupWindow { if (isTab2) { mTvTab2.callOnClick(); } + if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { + findViewById(R.id.rootView).setOnClickListener(v -> dismiss()); + mIvBg.setOnClickListener(v -> {}); + } } private void resetWindows() { diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java index 6b554682f..415b130ad 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java @@ -4,6 +4,7 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.content.Context; +import android.content.res.Configuration; import android.graphics.Color; import android.view.View; import android.view.ViewGroup; @@ -117,7 +118,7 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { @Override protected int getPopupHeight() { - if (isFullWindows) { + if (isFullWindows || getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { return super.getPopupHeight(); } int screenHeight = ScreenDimenUtil.getInstance().getScreenHeight(); diff --git a/common/src/main/res/drawable-land/background_gift_money2.xml b/common/src/main/res/drawable-land/background_gift_money2.xml new file mode 100644 index 000000000..e1bc4a429 --- /dev/null +++ b/common/src/main/res/drawable-land/background_gift_money2.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout-land/dialog_gift_wall.xml b/common/src/main/res/layout-land/dialog_gift_wall.xml new file mode 100644 index 000000000..d40d8ec44 --- /dev/null +++ b/common/src/main/res/layout-land/dialog_gift_wall.xml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout-land/dialog_gift_wall_achieve.xml b/common/src/main/res/layout-land/dialog_gift_wall_achieve.xml new file mode 100644 index 000000000..f4404fefc --- /dev/null +++ b/common/src/main/res/layout-land/dialog_gift_wall_achieve.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout-land/dialog_live_gift_popup.xml b/common/src/main/res/layout-land/dialog_live_gift_popup.xml new file mode 100644 index 000000000..269ab17e5 --- /dev/null +++ b/common/src/main/res/layout-land/dialog_live_gift_popup.xml @@ -0,0 +1,450 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/AndroidManifest.xml b/live/src/main/AndroidManifest.xml index 3eb4b9258..f1ebc18ce 100644 --- a/live/src/main/AndroidManifest.xml +++ b/live/src/main/AndroidManifest.xml @@ -25,7 +25,7 @@ android:windowSoftInputMode="adjustPan|stateAlwaysHidden" /> dismiss()); + } + View view1 = findViewById(R.id.bgView); + if (view1 != null) { + view1.setOnClickListener(this); + } + } + mHonorLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -292,7 +315,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On .setVoicePress(isAnchor) .setUname(mToName) .setAvatar(mAvatarUrl));*/ - new com.yunbao.common.dialog.GiftWallDialog(mContext, mToUid + "",mToName,mLiveUid, isAnchor).setFullWindows(false).showDialog(); + new com.yunbao.common.dialog.GiftWallDialog(mContext, mToUid + "", mToName, mLiveUid, isAnchor).setFullWindows(false).showDialog(); dismiss(); } }); @@ -344,7 +367,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } } } - + //是否是主播 boolean isAnchor = false; private void showData(String data) { @@ -544,7 +567,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On public void onComplete(SVGAVideoEntity videoItem) { SVGADrawable drawable = new SVGADrawable(videoItem); gift_svga.setImageDrawable(drawable); - SVGAViewUtils.playEndClear(gift_svga,true,0,null); + SVGAViewUtils.playEndClear(gift_svga, true, 0, null); //SVGAViewUtils.playEndClear(gift_svga); } @@ -653,7 +676,15 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On */ private void report() { if (TextUtils.equals(mLiveUid, "uid")) return; - LiveReportActivity.forward(mContext, mToUid); + if (!isPortrait) { + Log.i("nwq", "先切换成竖屏"); + getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + LiveReportActivity.forward(mContext, mToUid); + dismiss(); + }else { + LiveReportActivity.forward(mContext, mToUid); + } + } @@ -699,6 +730,15 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } + //切换横竖屏 + private void switchPortraitOrientation() { + if (!isPortrait) { + Log.i("nwq", "先切换成竖屏"); + getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + } + } + + @Override public void onClick(View v) { int i = v.getId(); @@ -731,6 +771,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } else if (i == R.id.btn_guard) { if (TextUtils.equals(mLiveUid, "uid")) return; MobclickAgent.onEvent(mContext, "anchor_avatar_guard", "守护按钮"); + switchPortraitOrientation(); ((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveSwAnchorActivity, mToUid); } else if (i == R.id.btn_live) { gotoLive(mToUid); @@ -740,6 +781,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On dismiss(); ((LiveActivity) mContext).openFansWindow(mToUid); } else { + switchPortraitOrientation(); MobclickAgent.onEvent(mContext, "user_avatar_noble", "贵族按钮"); Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.NOBLE)); @@ -766,7 +808,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On return; } boolean isAnchor = CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("C"); - CommonHttpUtil.sayHi(mToUid, isAnchor ? "6" : "7",new HttpCallback() { + CommonHttpUtil.sayHi(mToUid, isAnchor ? "6" : "7", new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { @@ -777,7 +819,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } public void showMsgError() { - ToastUtil.show(WordUtil.isNewZh()?"無法聊天,待開發":"Unable to chat, awaiting development"); + ToastUtil.show(WordUtil.isNewZh() ? "無法聊天,待開發" : "Unable to chat, awaiting development"); } diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 9a1723c46..249206de5 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -4,6 +4,8 @@ import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; +import android.content.pm.ActivityInfo; +import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; @@ -304,21 +306,22 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { pd_pao.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { - IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); - StringBuffer urlString = new StringBuffer(); - urlString.append(CommonAppConfig.HOST) - .append("/h5/exchangeShop/index.html?uid=") - .append(userInfo.getId()) - .append("&token=") - .append(userInfo.getToken()).append("&isZh=") - .append(WordUtil.isNewZh() ? "1" : 0); - Bundle bundle1 = new Bundle(); - bundle1.putString("url", urlString.toString()); - LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); - liveHDDialogFragment.setArguments(bundle1); - liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); - Bus.get().post(new QuickGiftingEvent().setReminder(true)); - MobclickAgent.onEvent(mContext, "small_pd_gifts", "长按"); + switchCurrentOrientation(); +// IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); +// StringBuffer urlString = new StringBuffer(); +// urlString.append(CommonAppConfig.HOST) +// .append("/h5/exchangeShop/index.html?uid=") +// .append(userInfo.getId()) +// .append("&token=") +// .append(userInfo.getToken()).append("&isZh=") +// .append(WordUtil.isNewZh() ? "1" : 0); +// Bundle bundle1 = new Bundle(); +// bundle1.putString("url", urlString.toString()); +// LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment(); +// liveHDDialogFragment.setArguments(bundle1); +// liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); +// Bus.get().post(new QuickGiftingEvent().setReminder(true)); +// MobclickAgent.onEvent(mContext, "small_pd_gifts", "长按"); return true; } }); @@ -396,6 +399,18 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { } + //切换横竖屏 + private void switchCurrentOrientation() { + int currentOrientation = context.getResources().getConfiguration().orientation; + if (currentOrientation == Configuration.ORIENTATION_PORTRAIT) { + // 当前为竖屏,切换到横屏 + context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); + } else { + // 当前为横屏,切换回竖屏 + context. setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + } + } + public void setGiftRemainingQuantity(String giftRemainingQuantity) { mQuickGiftRemainingQuantity = Integer.parseInt(giftRemainingQuantity); if (mQuickGiftRemainingQuantity > 0) { diff --git a/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java index c84a2a2a4..b45b86758 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlaySwViewHolder.java @@ -674,6 +674,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder { /** * 播放开始 + * TODO 横屏 */ public void onPrepared() { if (mEnd) { diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 011890c4f..93a4b95af 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -2127,7 +2127,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } }; - //主播倒计时调用接口 + //主播倒计时调用接口b private Handler anchorTimeHandler = new Handler(); private int mCountdown; private Runnable anchorTimeRunnable = new Runnable() { diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 4f5674902..ff45c40c0 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -396,8 +396,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe liveHandler.removeCallbacks(loadTimeoutRunnableGone); if (mLivePlayViewHolder == null) { if (isSw) { + Log.i("NWQ", "打开播放器源 声网"); mLivePlayViewHolder = new LivePlaySwViewHolder(mContext, playContainer, mLiveBean.getLandscape()); } else { + Log.i("NWQ", "打开播放器源 融云"); mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1); } @@ -730,9 +732,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } isShowPrank = false; - }else{ + } else { //初始化天梯赛数据(不在pk过程中) - mLiveRoomViewHolder.initRankPKInfo(mLiveUid,""); + mLiveRoomViewHolder.initRankPKInfo(mLiveUid, ""); } if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.pkHandler = false; @@ -818,9 +820,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe upDataPkScore(pkInfo.getJSONArray("userlist"), pkInfo.getIntValue("drpk_time")); isShowPrank = false; - }else{ + } else { //初始化天梯赛数据(不在pk过程中) - mLiveRoomViewHolder.initRankPKInfo(mLiveUid,""); + mLiveRoomViewHolder.initRankPKInfo(mLiveUid, ""); } if (data.getEnterRoomInfo().getGuard() != null) { if (mLiveRoomViewHolder != null) { @@ -907,7 +909,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.onSendMoneyLong(); } //初始化整蠱列表 - mLiveRoomViewHolder.initPrankProgress(isShowPrank?1:2); + mLiveRoomViewHolder.initPrankProgress(isShowPrank ? 1 : 2); } @@ -1967,7 +1969,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe //整蛊进度数据更新 @Override public void onUpdatePrankProgress(String prankString) { - if (mLiveRoomViewHolder != null){ + if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.refreshPrank(prankString); } } diff --git a/live/src/main/res/drawable-land/bg_live_user.xml b/live/src/main/res/drawable-land/bg_live_user.xml new file mode 100644 index 000000000..7211d776f --- /dev/null +++ b/live/src/main/res/drawable-land/bg_live_user.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout-land/activity_live_audience.xml b/live/src/main/res/layout-land/activity_live_audience.xml new file mode 100644 index 000000000..b2299eda6 --- /dev/null +++ b/live/src/main/res/layout-land/activity_live_audience.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout-land/dialog_fans.xml b/live/src/main/res/layout-land/dialog_fans.xml new file mode 100644 index 000000000..448fc8778 --- /dev/null +++ b/live/src/main/res/layout-land/dialog_fans.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout-land/dialog_new_live_user.xml b/live/src/main/res/layout-land/dialog_new_live_user.xml new file mode 100644 index 000000000..0252566ec --- /dev/null +++ b/live/src/main/res/layout-land/dialog_new_live_user.xml @@ -0,0 +1,610 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout-land/view_live_audience.xml b/live/src/main/res/layout-land/view_live_audience.xml new file mode 100644 index 000000000..fc5d3c006 --- /dev/null +++ b/live/src/main/res/layout-land/view_live_audience.xml @@ -0,0 +1,520 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout-land/view_live_play_ksy.xml b/live/src/main/res/layout-land/view_live_play_ksy.xml new file mode 100644 index 000000000..91b5d0346 --- /dev/null +++ b/live/src/main/res/layout-land/view_live_play_ksy.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout-land/view_live_play_sw.xml b/live/src/main/res/layout-land/view_live_play_sw.xml new file mode 100644 index 000000000..72c84372f --- /dev/null +++ b/live/src/main/res/layout-land/view_live_play_sw.xml @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout-land/view_live_room.xml b/live/src/main/res/layout-land/view_live_room.xml new file mode 100644 index 000000000..7347669fb --- /dev/null +++ b/live/src/main/res/layout-land/view_live_room.xml @@ -0,0 +1,2827 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml index 4189b37da..fc5d3c006 100644 --- a/live/src/main/res/layout/view_live_audience.xml +++ b/live/src/main/res/layout/view_live_audience.xml @@ -395,7 +395,6 @@ +