From 80b5127832e625aaa94aeb6c082a4071ddc6f800 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 23 Aug 2022 14:45:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=20=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E6=88=96=E8=80=85=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=BF=9B=E5=85=A5=E5=AF=86=E7=A0=81=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E9=97=B4=E8=A6=81=E8=BE=93=E4=B8=A4=E6=AC=A1=E5=AF=86?= =?UTF-8?q?=E7=A0=81=20=E4=B8=BB=E6=92=AD=E5=90=8D=E7=A7=B0=E7=BC=A9?= =?UTF-8?q?=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/activity/LiveAudienceActivity.java | 1 + .../java/com/yunbao/live/bean/LiveBean.java | 3 +- .../presenter/LiveRoomCheckLivePresenter.java | 39 +++++++++++-------- .../yunbao/live/views/LiveRoomViewHolder.java | 6 ++- .../yunbao/main/activity/SearchActivity.java | 17 ++++---- 5 files changed, 38 insertions(+), 28 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 171199895..c6f57b255 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -298,6 +298,7 @@ public class LiveAudienceActivity extends LiveActivity { mLiveUid = mLiveBean.getUid(); mStream = mLiveBean.getStream(); mAncherName = liveBean.getUserNiceName(); + Log.e("收到socket--->", "mLiveUid--------------------------->" + mLiveUid); //加载当前页面数据 View rootView = manager.getRootView(); diff --git a/live/src/main/java/com/yunbao/live/bean/LiveBean.java b/live/src/main/java/com/yunbao/live/bean/LiveBean.java index cd1df88a8..c47c04d95 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveBean.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveBean.java @@ -5,7 +5,6 @@ import android.os.Parcelable; import android.text.TextUtils; import com.alibaba.fastjson.annotation.JSONField; -import com.google.gson.annotations.SerializedName; import com.yunbao.common.bean.WeekListBean; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; @@ -203,6 +202,7 @@ public class LiveBean implements Parcelable { @JSONField(name = "user_nicename") public String getUserNiceName() { + return userNiceName; } @@ -328,6 +328,7 @@ public class LiveBean implements Parcelable { public String getIslive() { return islive; } + public void setIslive(String islive) { this.islive = islive; } diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java index 0bfe5ac2c..5c816a916 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveRoomCheckLivePresenter.java @@ -31,6 +31,8 @@ public class LiveRoomCheckLivePresenter { private LiveBean mLiveBean; private ActionListener mActionListener; private int mLiveSdk; + //搜索页面不提示密码 + public static boolean isSearch = false; public LiveRoomCheckLivePresenter(Context context, ActionListener actionListener) { mContext = context; @@ -46,7 +48,6 @@ public class LiveRoomCheckLivePresenter { } - private HttpCallback mCheckLiveCallback = new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { @@ -101,22 +102,28 @@ public class LiveRoomCheckLivePresenter { * 前往密码房间 */ private void forwardPwdRoom() { - DialogUitl.showSimpleInputDialog(mContext, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback() { - @Override - public void onConfirmClick(Dialog dialog, String content) { - if (TextUtils.isEmpty(content)) { - ToastUtil.show(WordUtil.getString(R.string.live_input_password)); - return; + if (!isSearch) { + DialogUitl.showSimpleInputDialog(mContext, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + if (TextUtils.isEmpty(content)) { + ToastUtil.show(WordUtil.getString(R.string.live_input_password)); + return; + } + String password = MD5Util.getMD5(content); + if (mLiveTypeMsg.equalsIgnoreCase(password)) { + dialog.dismiss(); + enterLiveRoom(); + } else { + ToastUtil.show(WordUtil.getString(R.string.live_password_error)); + } } - String password = MD5Util.getMD5(content); - if (mLiveTypeMsg.equalsIgnoreCase(password)) { - dialog.dismiss(); - enterLiveRoom(); - } else { - ToastUtil.show(WordUtil.getString(R.string.live_password_error)); - } - } - }); + }); + }else { + enterLiveRoom(); + isSearch = false; + } + } /** 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 b4397e9e2..0e5122ea5 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -45,7 +45,6 @@ import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.UserBean; -import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; @@ -84,6 +83,7 @@ import com.yunbao.live.custom.TopGradual; import com.yunbao.live.dialog.LiveFansMedalDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.dialog.LiveUserDialogFragment; +import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveDanmuPresenter; @@ -1016,7 +1016,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis */ public void setName(String name) { if (mName != null) { + mNameText = name; + if (name.length() > 4) { + name = name.substring(0, 4) + "..."; + } mName.setText(name); EventBus.getDefault().post("name_true"); } diff --git a/main/src/main/java/com/yunbao/main/activity/SearchActivity.java b/main/src/main/java/com/yunbao/main/activity/SearchActivity.java index def94578b..443534e67 100644 --- a/main/src/main/java/com/yunbao/main/activity/SearchActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/SearchActivity.java @@ -18,6 +18,7 @@ import androidx.fragment.app.FragmentTransaction; import com.alibaba.fastjson.JSON; import com.yunbao.common.activity.AbsActivity; +import com.yunbao.common.event.CloseEvent; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.SearchHistoryRecordManager; import com.yunbao.common.utils.Bus; @@ -27,7 +28,6 @@ import com.yunbao.live.bean.LiveBean; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.main.R; -import com.yunbao.common.event.CloseEvent; import com.yunbao.main.event.JumpUserHomeEvent; import com.yunbao.main.fragment.SearchRecommendFragment; import com.yunbao.main.fragment.SearchResultsFragment; @@ -175,16 +175,13 @@ public class SearchActivity extends AbsActivity { if (code == 0 && info.length > 0) { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - - LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); - + LiveRoomCheckLivePresenter.isSearch = true; + LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> { + if (liveBean1 == null) { + return; } + LiveAudienceActivity.forward(mContext, liveBean1, liveType, liveTypeVal, "", 0, liveSdk); + }); mCheckLivePresenter.checkLive(liveBean);