fix [上滑无法关闭名片]

fix [聊天界面-聊天内容输入可超过300字符]
This commit is contained in:
zlzw 2024-03-27 15:52:16 +08:00
parent be214df23b
commit e256b61238

View File

@ -5,6 +5,7 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.text.Editable; import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
@ -12,6 +13,7 @@ import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.lifecycle.Observer; import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.event.PDChatInputModeEvent; import com.yunbao.common.event.PDChatInputModeEvent;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
@ -52,6 +54,18 @@ public class PDLiveConversationFragment extends ConversationFragment {
@Override @Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { 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); super.onViewCreated(view, savedInstanceState);
view.setBackgroundColor(Color.parseColor("#00000000")); view.setBackgroundColor(Color.parseColor("#00000000"));
//TODO 下面片段是尝试修复模拟器emoji无法唤起的bug后续版本解决该问题 //TODO 下面片段是尝试修复模拟器emoji无法唤起的bug后续版本解决该问题
@ -84,7 +98,6 @@ public class PDLiveConversationFragment extends ConversationFragment {
} }
}); });
*/ */
mRongExtensionViewModel.getInputModeLiveData().observe(getViewLifecycleOwner(), new Observer<InputMode>() { mRongExtensionViewModel.getInputModeLiveData().observe(getViewLifecycleOwner(), new Observer<InputMode>() {
@Override @Override
public void onChanged(InputMode inputMode) { public void onChanged(InputMode inputMode) {
@ -118,6 +131,9 @@ public class PDLiveConversationFragment extends ConversationFragment {
editString = editable.toString(); editString = editable.toString();
} }
}); });
mRongExtension.getInputPanel().getEditText().setFilters(new InputFilter[]{
new InputFilter.LengthFilter(300)
});
} }
@Override @Override