11111
This commit is contained in:
@@ -27,6 +27,7 @@ import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.SearchUserBean;
|
||||
import com.yunbao.live.dialog.MenuPopuwWindow;
|
||||
import com.yunbao.live.views.InputPanelViewHolder;
|
||||
import com.yunbao.live.views.PDLiveConversationFragment;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@@ -42,7 +43,7 @@ import io.rong.imlib.model.UserInfo;
|
||||
* 聊天会话界面
|
||||
*/
|
||||
public class PDLiveConversationActivity extends AbsActivity implements View.OnClickListener {
|
||||
private ConversationFragment conversationFragment;
|
||||
private PDLiveConversationFragment conversationFragment;
|
||||
private PDLiveConversationActivity mContext;
|
||||
private InputPanelViewHolder inputPanel;
|
||||
private TextView titleView;
|
||||
@@ -83,7 +84,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
||||
if (!TextUtils.isEmpty(userInfo.getExtra())) {
|
||||
SearchUserBean userBean = GsonUtils.fromJson(userInfo.getExtra(), SearchUserBean.class);
|
||||
//新手指导员
|
||||
if (TextUtils.isEmpty(userBean.getIs_admin()) && TextUtils.equals(userBean.getIs_admin(), "1")) {
|
||||
if (!TextUtils.isEmpty(userBean.getIs_admin()) && TextUtils.equals(userBean.getIs_admin(), "1")) {
|
||||
isAdmin = true;
|
||||
imgMore.setVisibility(View.GONE);
|
||||
} else {//非指导员
|
||||
@@ -100,7 +101,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
||||
*/
|
||||
private void initView() {
|
||||
// 添加会话界面
|
||||
conversationFragment = new ConversationFragment();
|
||||
conversationFragment = new PDLiveConversationFragment();
|
||||
FragmentManager manager = getSupportFragmentManager();
|
||||
FragmentTransaction transaction = manager.beginTransaction();
|
||||
transaction.replace(R.id.container, conversationFragment);
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.live.R;
|
||||
|
||||
import io.rong.imkit.conversation.MessageListAdapter;
|
||||
import io.rong.imkit.model.UiMessage;
|
||||
import io.rong.imkit.widget.adapter.IViewProviderListener;
|
||||
import io.rong.imkit.widget.adapter.ViewHolder;
|
||||
import io.rong.imlib.model.Message;
|
||||
|
||||
/**
|
||||
* 会话页面更改已读未读
|
||||
*/
|
||||
public class PDLiveMessageListAdapter extends MessageListAdapter {
|
||||
public PDLiveMessageListAdapter(IViewProviderListener<UiMessage> listener) {
|
||||
super(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
super.onBindViewHolder(holder, position);
|
||||
Message.MessageDirection messageDirection = mDataList.get(position).getMessage().getMessageDirection();
|
||||
Message.SentStatus sentStatus = mDataList.get(position).getMessage().getSentStatus();
|
||||
ImageView readReceipt = holder.getConvertView().findViewById(R.id.rc_read_receipt);
|
||||
ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new);
|
||||
if (readReceipt.getVisibility() == View.VISIBLE) {
|
||||
readReceipt.setVisibility(View.GONE);
|
||||
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_read);
|
||||
} else {
|
||||
if (messageDirection.equals(Message.MessageDirection.SEND)&&sentStatus.equals(Message.SentStatus.SENT))
|
||||
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_unread);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,10 +78,22 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
|
||||
inputPanelView.findViewById(R.id.lt_photo_button).setOnClickListener(this);
|
||||
inputPanelView.findViewById(R.id.lt_choospic_button).setOnClickListener(this);
|
||||
inputPanelView.findViewById(R.id.lt_video_button).setOnClickListener(this);
|
||||
|
||||
|
||||
editBtn.setOnFocusChangeListener(focusChangeListener);
|
||||
}
|
||||
|
||||
//输入框焦点监听事件
|
||||
View.OnFocusChangeListener focusChangeListener = new OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus) {
|
||||
//失去焦点
|
||||
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(editBtn, InputMethodManager.SHOW_FORCED);
|
||||
imm.hideSoftInputFromWindow(editBtn.getWindowToken(), 0); //强制隐藏键盘
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
@@ -188,7 +200,7 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
|
||||
}
|
||||
|
||||
public void afterTextChanged(Editable s) {
|
||||
editBtn.clearFocus();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.yunbao.live.views;
|
||||
|
||||
import com.yunbao.live.dialog.PDLiveMessageListAdapter;
|
||||
|
||||
import io.rong.imkit.conversation.ConversationFragment;
|
||||
import io.rong.imkit.conversation.MessageListAdapter;
|
||||
|
||||
/**
|
||||
* 聊天详情页面
|
||||
*/
|
||||
public class PDLiveConversationFragment extends ConversationFragment {
|
||||
@Override
|
||||
protected MessageListAdapter onResolveAdapter() {
|
||||
return new PDLiveMessageListAdapter(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user