From 3150489384058ef1313e1cf5341d6bbb833a9dcb Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Wed, 20 Sep 2023 18:26:59 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=B8=AD=E8=8B=B1=E6=96=87=20fix=20?= =?UTF-8?q?=E6=92=AD=E6=94=BE=E5=99=A8=E7=9B=91=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fragment/LiveNewWishListFragment.java | 7 +- .../yunbao/common/manager/IMRTCManager.java | 13 +- .../com/yunbao/common/utils/NobleUtil.java | 18 +-- .../com/yunbao/common/utils/ToastUtil.java | 2 +- .../yunbao/common/views/InputCustomPopup.java | 3 +- .../common/views/LiveNewWishListPopup.java | 3 +- common/src/main/res/values-en-rUS/string.xml | 4 +- common/src/main/res/values-zh-rHK/strings.xml | 2 + common/src/main/res/values-zh-rTW/strings.xml | 2 + common/src/main/res/values-zh/strings.xml | 2 + common/src/main/res/values/strings.xml | 4 +- .../live/activity/LiveRyAnchorActivity.java | 13 +- .../adapter/AnchorUserMicInfoAdapter.java | 6 + .../live/dialog/FreePkDialogFragment.java | 4 +- .../dialog/LiveNewWishListDialogFragment.java | 3 +- .../dialog/LiveWishListDialogFragment.java | 3 +- .../presenter/LiveRyLinkMicPkPresenter.java | 7 +- .../live/utils/LiveExoPlayerManager.java | 138 ++++++++++++++++++ .../live/views/LiveLinkMicPkViewHolder.java | 2 +- .../live/views/LivePlayRyViewHolder.java | 1 + .../live/views/LivePushRyViewHolder.java | 2 +- .../live/views/LivePushTxViewHolder.java | 3 +- .../live/views/PortraitLiveManager.java | 2 +- .../main/res/layout/dialog_fans_group_buy.xml | 8 +- .../layout/dialog_live_select_gift_wrap.xml | 2 +- .../main/res/layout/dialog_new_live_user.xml | 4 +- .../src/main/res/layout/view_live_push_ry.xml | 2 +- .../src/main/res/layout/view_live_push_tx.xml | 2 +- .../layout/view_live_search_list_empty.xml | 2 +- .../main/dialog/MainStartDialogFragment.java | 2 +- 30 files changed, 225 insertions(+), 41 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java b/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java index bb7a963c1..590a95912 100644 --- a/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java +++ b/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java @@ -21,6 +21,7 @@ import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.HintCustomPopup; import com.yunbao.common.views.LiveNewWishGiftPopup; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -149,7 +150,7 @@ public class LiveNewWishListFragment extends BaseFragment { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback() { @Override public void onSuccess(String data) { - ToastUtil.show("修改成功"); + ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success"); } @Override @@ -181,7 +182,7 @@ public class LiveNewWishListFragment extends BaseFragment { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback() { @Override public void onSuccess(String data) { - ToastUtil.show("修改成功"); + ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success"); } @Override @@ -200,7 +201,7 @@ public class LiveNewWishListFragment extends BaseFragment { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback() { @Override public void onSuccess(String data) { - ToastUtil.show("修改成功"); + ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success"); } @Override diff --git a/common/src/main/java/com/yunbao/common/manager/IMRTCManager.java b/common/src/main/java/com/yunbao/common/manager/IMRTCManager.java index 4c3fc88ef..c1b85d3ab 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMRTCManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMRTCManager.java @@ -6,6 +6,7 @@ import android.os.Handler; import android.os.Looper; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import java.util.ArrayList; import java.util.List; @@ -100,7 +101,11 @@ public class IMRTCManager { public void onSuccess() { callback.onSuccess(); if (!RandomPkManager.getInstance().isRandomModel()) { - ToastUtil.show("发起邀请成功"); + if(WordUtil.isNewZh()) { + ToastUtil.show("发起邀请成功"); + }else{ + ToastUtil.show("successful"); + } } requestUid.add(liveUid); startRequestTimeoutTask(liveUid); @@ -109,7 +114,11 @@ public class IMRTCManager { @Override public void onFailed(RTCErrorCode errorCode) { if (!RandomPkManager.getInstance().isRandomModel()) { - ToastUtil.show("邀请失败 " + errorCode.getValue()); + if(WordUtil.isNewZh()) { + ToastUtil.show("邀请失败 " + errorCode.getValue()); + }else{ + ToastUtil.show("invite failed:" +errorCode.getValue()); + } } if (RandomPkManager.getInstance().isRequestPk()) { RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE); diff --git a/common/src/main/java/com/yunbao/common/utils/NobleUtil.java b/common/src/main/java/com/yunbao/common/utils/NobleUtil.java index afe0208c3..a1ec0f2c7 100644 --- a/common/src/main/java/com/yunbao/common/utils/NobleUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/NobleUtil.java @@ -30,7 +30,7 @@ public class NobleUtil { case 1:return "男爵"; case 2:return "子爵"; case 3:return "侯爵"; - case 4:return "公爵"; + case 4:return "公爵"; case 5:return "国王"; case 6:return "皇帝"; case 7:return "超皇"; @@ -39,15 +39,15 @@ public class NobleUtil { } public static String nobleIdToStringNameForEn(int id){ switch (id){ - case 1:return "baron"; - case 2:return "viscount"; - case 3:return "marquis"; - case 4:return "duke"; - case 5:return "king"; - case 6:return "emperor"; - case 7:return "SuperEmperor"; + case 1:return "Baron"; + case 2:return "Viscount"; + case 3:return "Marquis"; + case 4:return "Duke"; + case 5:return "King"; + case 6:return "Emperor"; + case 7:return "SuperKing"; } - return "Not Opened"; + return "Not opened"; } public static int getNobleBackgroundId(int id){ switch (id){ diff --git a/common/src/main/java/com/yunbao/common/utils/ToastUtil.java b/common/src/main/java/com/yunbao/common/utils/ToastUtil.java index 3aa789611..764297b5a 100644 --- a/common/src/main/java/com/yunbao/common/utils/ToastUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/ToastUtil.java @@ -43,7 +43,7 @@ public class ToastUtil { public static void show(int res) { - show(WordUtil.getString(res)); + show(WordUtil.getNewString(res)); } /** diff --git a/common/src/main/java/com/yunbao/common/views/InputCustomPopup.java b/common/src/main/java/com/yunbao/common/views/InputCustomPopup.java index 80b31e916..4aa99edb4 100644 --- a/common/src/main/java/com/yunbao/common/views/InputCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/InputCustomPopup.java @@ -14,6 +14,7 @@ import com.lxj.xpopup.animator.PopupAnimator; import com.lxj.xpopup.core.CenterPopupView; import com.yunbao.common.R; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; /** @@ -85,7 +86,7 @@ public class InputCustomPopup extends CenterPopupView { public void onViewClicks() { String textContent = content.getText().toString(); if (TextUtils.isEmpty(textContent)) { - ToastUtil.show("输入内容不可为空"); + ToastUtil.show(WordUtil.isNewZh()?"输入内容不可为空":"The input cannot be empty"); return; } if (listener != null) { diff --git a/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java b/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java index 4ca74750f..a4af32be8 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java @@ -32,6 +32,7 @@ import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import org.greenrobot.eventbus.Subscribe; @@ -332,7 +333,7 @@ public class LiveNewWishListPopup extends BottomPopupView { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback() { @Override public void onSuccess(String data) { - ToastUtil.show("修改成功"); + ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success"); } @Override diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index d2c6e9562..a0b0d26c1 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1084,7 +1084,7 @@ Limited ride And limited avatar frame One-time gift ≥2000 diamonds), can obtain fan privilege yo Top up User level - aristocracy + Noble\nLevel Fan club Voice connection is not enabled Wall of honor @@ -1320,4 +1320,6 @@ Limited ride And limited avatar frame Join a fans club Sorry, your network failed to pull the other party. say something + No match was found + Add diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 6667a300c..af444497c 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1317,4 +1317,6 @@ 抱歉,您的網絡不佳拉取對方畫面失敗 這家夥很懶,什麽都沒留下 + 沒有找到匹配結果~ + 確定添加 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index b38df1870..352fdec89 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1316,4 +1316,6 @@ 抱歉,您的網絡不佳拉取對方畫面失敗 這家夥很懶,什麽都沒留下 + 沒有找到匹配結果~ + 確定添加 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index e1c3c7772..fd5574955 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1316,4 +1316,6 @@ 加入粉絲團 抱歉,您的網絡不佳拉取對方畫面失敗 這家夥很懶,什麽都沒留下 + 沒有找到匹配結果~ + 確定添加 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index db6cee635..480f62744 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1084,7 +1084,7 @@ Limited ride And limited avatar frame One-time gift ≥2000 diamonds), can obtain fan privilege yo Top up User level - aristocracy + Noble\nLevel Fan club Voice connection is not enabled Wall of honor @@ -1323,4 +1323,6 @@ Limited ride And limited avatar frame Sorry, your network failed to pull the other party. say something + No match was found + Add diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index 72f87232f..4bf42650e 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -70,6 +70,7 @@ import com.yunbao.common.utils.LogUtil; import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.LiveNewWishListPopup; import com.yunbao.common.views.LiveRobotSettingCustomPopup; import com.yunbao.faceunity.FaceManager; @@ -1244,7 +1245,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl }); //todo 安卓端状态码说明文档:https://docs.rongcloud.cn/v4/views/rtc/call/code/android.html Log.e("ry", rtcErrorCode + "aaaaaa" + CommonAppConfig.getInstance().getUid() + "VDSSSS" + pkUid); - ToastUtil.show("邀请 " + pkUid + " 发送失败 :" + rtcErrorCode); + if(WordUtil.isNewZh()) { + ToastUtil.show("邀请 " + pkUid + " 发送失败 :" + rtcErrorCode); + }else{ + ToastUtil.show("invite " + pkUid + " failed:"+rtcErrorCode); + } } }); @@ -1293,7 +1298,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl @Override public void onSuccess() { if (!extra.equals(SOCKET_LIVE_DRPK_RANDOM)) { - ToastUtil.show("邀请 " + pkUid + " 发送成功"); + if(WordUtil.isNewZh()) { + ToastUtil.show("邀请 " + pkUid + " 发送成功"); + }else{ + ToastUtil.show("invite " + pkUid + " successful"); + } } runOnUiThread(new Runnable() { @Override diff --git a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java index c45181bbb..7202da106 100644 --- a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java @@ -221,9 +221,15 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter { } if (bean.getType() == TYPE_MIC_REQUEST) { mBtn.setText("同意"); + if(!WordUtil.isNewZh()){ + mBtn.setText("agree"); + } mBtn.setBackgroundResource(R.drawable.bg_anchor_mic_info_btn_ok); } else if (bean.getType() == TYPE_MIC_INVITE) { mBtn.setText("邀请"); + if (!WordUtil.isNewZh()) { + mBtn.setText("invite"); + } mBtn.setBackgroundResource(R.drawable.bg_anchor_mic_info_btn_invite); } ImgLoader.display(mContext, bean.getAvatar(), mAvatar); diff --git a/live/src/main/java/com/yunbao/live/dialog/FreePkDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/FreePkDialogFragment.java index b1395ffc9..ef52c9a21 100644 --- a/live/src/main/java/com/yunbao/live/dialog/FreePkDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/FreePkDialogFragment.java @@ -130,13 +130,13 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl } }); if(!WordUtil.isNewZh()){ - mPkNumText.setText("Free PK remaining number"); + mPkNumText.setText("Free PK number"); ((TextView)findViewById(R.id.tmp_text2)).setText("Updated daily at 6am"); } if (mDrPkNum != -1) { mPkNumText.setText("多人PK剩余次數"); if(!WordUtil.isNewZh()){ - mPkNumText.setText("multi-user PK remaining number"); + mPkNumText.setText("multi-user PK number"); } } initRecycler(); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewWishListDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewWishListDialogFragment.java index f30c46085..b1a7905d0 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewWishListDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewWishListDialogFragment.java @@ -22,6 +22,7 @@ import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; @@ -118,7 +119,7 @@ public class LiveNewWishListDialogFragment extends AbsDialogFragment implements @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { - ToastUtil.show("修改成功"); + ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success"); dismiss(); } else { ToastUtil.show("修改失败" + (msg.isEmpty() ? "" : msg)); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveWishListDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveWishListDialogFragment.java index ca7bd3ae8..12eb62dd7 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveWishListDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveWishListDialogFragment.java @@ -18,6 +18,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; @@ -117,7 +118,7 @@ public class LiveWishListDialogFragment extends AbsDialogFragment implements OnI @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0 && info.length > 0) { - ToastUtil.show("修改成功"); + ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success"); dismiss(); } else { ToastUtil.show("修改失败" + (msg.isEmpty() ? "" : msg)); diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java index 071ac25ba..223419aa9 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRyLinkMicPkPresenter.java @@ -57,6 +57,7 @@ import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; @@ -857,7 +858,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onSuccess(RCRTCOtherRoom rcrtcOtherRoom) { rcrtcOtherRoom.registerOtherRoomEventsListener(otherRoomEventsListener); - ToastUtil.show("接受成功"); + ToastUtil.show(WordUtil.isNewZh()?"接受成功":"Success"); new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) { @@ -976,7 +977,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { @Override public void onSuccess(RCRTCOtherRoom rcrtcOtherRoom) { rcrtcOtherRoom.registerOtherRoomEventsListener(otherRoomEventsListener); - ToastUtil.show("接受成功"); + ToastUtil.show(WordUtil.isNewZh()?"接受成功":"Success"); new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { Log.e("ry", liveid + "来了!!!!" + rcrtcOtherRoom.getRemoteUsers().size()); @@ -1659,7 +1660,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener { } Log.e("ry", "多人接受成功" + mApplyUid); - ToastUtil.show("接受成功"); + ToastUtil.show(WordUtil.isNewZh()?"接受成功":"Success"); //遍历远端用户列表 for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) { Log.e("ry", rcrtcOtherRoom.getRemoteUsers().get(i).getUserId() + "收到rcrtcOtherRoom" + rcrtcOtherRoom.getRemoteUsers().size()); diff --git a/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java b/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java index b497b30d3..e3236c88a 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java @@ -1,10 +1,12 @@ package com.yunbao.live.utils; import android.content.Context; +import android.graphics.Color; import android.os.Handler; import android.os.Looper; import android.util.Log; import android.widget.RelativeLayout; +import android.widget.TextView; import androidx.annotation.NonNull; @@ -18,9 +20,13 @@ import com.google.android.exoplayer2.analytics.AnalyticsListener; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; import com.google.android.exoplayer2.ui.StyledPlayerView; import com.google.android.exoplayer2.video.VideoSize; +import com.lzf.easyfloat.EasyFloat; import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.R; +import java.util.Timer; +import java.util.TimerTask; + /** * 直播间播放器管理器 * 通过预加载子播放器来实现无缝切换分辨率功能 @@ -40,6 +46,9 @@ public class LiveExoPlayerManager { private static double log_buffer_time = 0, log_buffer_max_time; private String url = ""; private Context mContext; + private TimerTask task; + + TextView debugText; public LiveExoPlayerManager(Context mContext) { this.mContext = mContext; @@ -59,6 +68,109 @@ public class LiveExoPlayerManager { handler = new Handler(Looper.getMainLooper()); setListener(); setAnalyticsListener(); + //createDeBugDialog(); + + } + + int index = 0; + + private void createTask() { + if (task != null) { + return; + } + task = new TimerTask() { + + + @Override + public void run() { + handler.post(new Runnable() { + @Override + public void run() { + try { + if (index > 5 && !player1.isPlaying() && !player2.isPlaying()) { + index = 0; + Log.i(TAG, "5秒内播放器没有播放,重新播放"); + ToastUtil.showDebug("强制重播"); + handler.removeCallbacks(buffRunnable); + replay(); + cancel(); + } else if (player1.isPlaying() || player2.isPlaying()) { + index = 0; + } else { + index++; + } + } catch (Exception e) { + e.printStackTrace(); + cancel(); + task = null; + } + + } + }); + + } + }; + new Timer().schedule(task, 0, 1000); + } + + private TimerTask debugTask; + + private void createDeBugDialog() { + debugText = new TextView(mContext); + debugText.setText(getDebugText()); + debugText.setBackgroundColor(Color.WHITE); + debugText.setTextColor(Color.BLACK); + EasyFloat.with(mContext) + .setTag("debug") + .setLayout(debugText) + .show(); + debugTask = new TimerTask() { + @Override + public void run() { + updateDebug(); + } + }; + new Timer().schedule(debugTask, 0, 500); + } + + private String getDebugText() { + StringBuilder sb = new StringBuilder(); + try { + sb.append("player1: ").append(getPlayStateText(player1)).append("|").append(player1.isPlaying()).append("\n"); + sb.append("player2: ").append(getPlayStateText(player2)).append("|").append(player2.isPlaying()).append("\n"); + sb.append("卡顿计数器:").append(playBufferIndex).append("\n"); + sb.append("强制播放计时器:").append(index).append("\n"); + } catch (Exception e) { + e.printStackTrace(); + EasyFloat.dismiss("debug"); + debugTask.cancel(); + } + + return sb.toString(); + } + + private void updateDebug() { + handler.post(new Runnable() { + @Override + public void run() { + debugText.setText(getDebugText()); + } + }); + } + + private String getPlayStateText(ExoPlayer player) { + switch (player.getPlaybackState()) { + case Player.STATE_READY: + return "STATE_READY"; + case Player.STATE_BUFFERING: + return "STATE_BUFFERING"; + case Player.STATE_ENDED: + return "STATE_ENDED"; + case Player.STATE_IDLE: + return "STATE_IDLE"; + default: + return player.getPlaybackState() + ""; + } } @@ -171,6 +283,7 @@ public class LiveExoPlayerManager { if (listener != null) { listener.onIsPlayingChanged(true); } + createTask(); } } @@ -245,6 +358,7 @@ public class LiveExoPlayerManager { if (listener != null) { listener.onIsPlayingChanged(true); } + createTask(); } } @@ -280,6 +394,11 @@ public class LiveExoPlayerManager { */ public void startUrl(String url) { if (url != null && url.equals(this.url)) return; + if (task != null) { + task.cancel(); + task = null; + } + Log.i(TAG, "startUrl: " + url + " > " + mainView.getResizeMode()); handler.removeCallbacks(buffRunnable); this.url = url; @@ -303,6 +422,10 @@ public class LiveExoPlayerManager { */ public void switchUrl(String url) { if (url != null && url.equals(this.url)) return; + if (task != null) { + task.cancel(); + task = null; + } Log.i(TAG, "switchUrl: " + url + " src : " + this.url); this.url = url; playBufferIndex = 0; @@ -369,6 +492,14 @@ public class LiveExoPlayerManager { if (getNextPlayer() != null) { getNextPlayer().stop(); } + if (listener != null) { + listener.onPlaybackStateChanged(Player.STATE_IDLE); + } + handler.removeCallbacks(buffRunnable); + if (task != null) { + task.cancel(); + task = null; + } String tmp = url; url = null; startUrl(tmp); @@ -394,6 +525,13 @@ public class LiveExoPlayerManager { player2.clearVideoSurface(); player2.release(); } + if (task != null) { + task.cancel(); + task = null; + } + if (debugTask != null) { + debugTask.cancel(); + } player1 = null; player2 = null; mainView.setKeepContentOnPlayerReset(false); diff --git a/live/src/main/java/com/yunbao/live/views/LiveLinkMicPkViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveLinkMicPkViewHolder.java index 94487fe74..4be20f372 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveLinkMicPkViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveLinkMicPkViewHolder.java @@ -218,7 +218,7 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder { if (mTime != null) { Log.i("vvvs", content); if (content.trim().equals("00:00")) { - mTime.setText("結算中"); + mTime.setText(WordUtil.isNewZh()?"結算中":"waiting"); } else { mTime.setText(content); } diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java index dd25ac6dd..0fab5e098 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -1287,6 +1287,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { Player.Listener.super.onIsPlayingChanged(isPlaying); if (isPlaying) { hideCover(); + mLoading.setVisibility(View.INVISIBLE); Log.i(TAG, "onIsPlayingChanged: 开始播放 | waitNextUrl = " + waitNextUrl); OkDownload.getInstance().startAll(); if (loadingListener != null) { diff --git a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java index d8eb63a61..0551f721f 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java @@ -495,7 +495,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX btn_close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - DialogUitl.showSimpleDialog(mContext, "是否要斷開連麥?", new DialogUitl.SimpleCallback() { + DialogUitl.showSimpleDialog(mContext,WordUtil.isNewZh()? "是否要斷開連麥?":"Do you want to disconnect Link?", new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { aheadOfScheduleEndPK(mPkUid, CommonAppConfig.getInstance().getUserBean().getUserNiceName(), (String) tv_avatarOther_name.getTag()); diff --git a/live/src/main/java/com/yunbao/live/views/LivePushTxViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushTxViewHolder.java index 8cd662aef..e4213577c 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushTxViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushTxViewHolder.java @@ -36,6 +36,7 @@ import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.L; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.common.http.LiveHttpConsts; @@ -103,7 +104,7 @@ public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLi btn_close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - DialogUitl.showSimpleDialog(mContext, "是否要斷開連麥?", new DialogUitl.SimpleCallback() { + DialogUitl.showSimpleDialog(mContext, WordUtil.isNewZh()?"是否要斷開連麥?":"Do you want to disconnect Link?", new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { //断开连麦 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 0df33d47d..46b3479d5 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -681,7 +681,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } } AppManager.runDebugCode(() -> { - liveHandler.postDelayed(loadTimeoutRunnableGone, 1_000); + // liveHandler.postDelayed(loadTimeoutRunnableGone, 1_000); }); liveHandler.postDelayed(loadTimeoutRunnableGone, 15_000); if (TextUtils.equals(data.getEnterRoomInfo().getIsconnection(), "1")) { diff --git a/live/src/main/res/layout/dialog_fans_group_buy.xml b/live/src/main/res/layout/dialog_fans_group_buy.xml index 88dde5508..6c933439d 100644 --- a/live/src/main/res/layout/dialog_fans_group_buy.xml +++ b/live/src/main/res/layout/dialog_fans_group_buy.xml @@ -48,15 +48,17 @@ + app:layout_constraintTop_toBottomOf="@+id/giftName" /> diff --git a/live/src/main/res/layout/view_live_push_tx.xml b/live/src/main/res/layout/view_live_push_tx.xml index 7d844dd5b..c4cf37ed2 100644 --- a/live/src/main/res/layout/view_live_push_tx.xml +++ b/live/src/main/res/layout/view_live_push_tx.xml @@ -135,7 +135,7 @@ android:paddingTop="5dp" android:paddingRight="8dp" android:paddingBottom="5dp" - android:text="結束連麥" + android:text="@string/live_link_mic_3" android:textColor="@color/color_white" android:textSize="13sp" android:visibility="gone" /> diff --git a/live/src/main/res/layout/view_live_search_list_empty.xml b/live/src/main/res/layout/view_live_search_list_empty.xml index 6c4319be8..f0119cbb7 100644 --- a/live/src/main/res/layout/view_live_search_list_empty.xml +++ b/live/src/main/res/layout/view_live_search_list_empty.xml @@ -19,7 +19,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="25dp" - android:text="沒有找到匹配結果~" + android:text="@string/live_free_pk_empty_tips" android:textColor="#C4C4C4" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java b/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java index a1d00bb64..be982713c 100644 --- a/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java +++ b/main/src/main/java/com/yunbao/main/dialog/MainStartDialogFragment.java @@ -244,7 +244,7 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O LiveHttpUtil.getLiveSdk(mGetLiveSdkCallback); }); } else { - String tips="需要下载开播插件,是否下载"; + String tips="需要下載開播插件,是否下載"; if(!WordUtil.isNewZh()){ tips="You need to download the plug-in, whether to download"; }