From e256b612383634f822e5a8f3f117e9f8c61373ce Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Wed, 27 Mar 2024 15:52:16 +0800 Subject: [PATCH] =?UTF-8?q?fix=20[=E4=B8=8A=E6=BB=91=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=90=8D=E7=89=87]=20fix=20[=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E7=95=8C=E9=9D=A2-=E8=81=8A=E5=A4=A9=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E8=BE=93=E5=85=A5=E5=8F=AF=E8=B6=85=E8=BF=87300?= =?UTF-8?q?=E5=AD=97=E7=AC=A6]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/views/PDLiveConversationFragment.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/live/src/main/java/com/yunbao/live/views/PDLiveConversationFragment.java b/live/src/main/java/com/yunbao/live/views/PDLiveConversationFragment.java index f83e318f4..3ad61d8b1 100644 --- a/live/src/main/java/com/yunbao/live/views/PDLiveConversationFragment.java +++ b/live/src/main/java/com/yunbao/live/views/PDLiveConversationFragment.java @@ -5,6 +5,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.text.Editable; +import android.text.InputFilter; import android.text.TextWatcher; import android.view.MotionEvent; import android.view.View; @@ -12,6 +13,7 @@ import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.lifecycle.Observer; +import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.event.PDChatInputModeEvent; import com.yunbao.common.http.base.HttpCallback; @@ -52,6 +54,18 @@ public class PDLiveConversationFragment extends ConversationFragment { @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + mList.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + } + + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + super.onScrolled(recyclerView, dx, dy); + EventBus.getDefault().post(new PDChatInputModeEvent(InputMode.TextInput)); + } + }); super.onViewCreated(view, savedInstanceState); view.setBackgroundColor(Color.parseColor("#00000000")); //TODO 下面片段是尝试修复模拟器emoji无法唤起的bug。后续版本解决该问题: @@ -84,7 +98,6 @@ public class PDLiveConversationFragment extends ConversationFragment { } }); */ - mRongExtensionViewModel.getInputModeLiveData().observe(getViewLifecycleOwner(), new Observer() { @Override public void onChanged(InputMode inputMode) { @@ -118,6 +131,9 @@ public class PDLiveConversationFragment extends ConversationFragment { editString = editable.toString(); } }); + mRongExtension.getInputPanel().getEditText().setFilters(new InputFilter[]{ + new InputFilter.LengthFilter(300) + }); } @Override