update
This commit is contained in:
@@ -15,11 +15,15 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.interfaces.OnSelectListener;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.adapter.MsgChatMessageListAdapter;
|
||||
import com.shayu.onetoone.bean.MessageChatAuthContent;
|
||||
import com.shayu.onetoone.bean.MessageChatTipsContent;
|
||||
import com.shayu.onetoone.bean.UserBean;
|
||||
import com.shayu.onetoone.dialog.BottomListDialog;
|
||||
import com.shayu.onetoone.dialog.TipsDialog;
|
||||
import com.shayu.onetoone.listener.OnCallStatusListener;
|
||||
import com.shayu.onetoone.listener.OnDialogClickListener;
|
||||
@@ -32,15 +36,20 @@ import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.interfaces.ImageResultCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.ProcessImageUtil;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.conversation.MessageListAdapter;
|
||||
import io.rong.imkit.model.UiMessage;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
@@ -70,6 +79,8 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
ImageView status;
|
||||
Button follow;
|
||||
|
||||
MsgChatMessageListAdapter mAdapter;
|
||||
|
||||
private String token;
|
||||
private static final String TAG = "聊天界面";
|
||||
|
||||
@@ -86,6 +97,9 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
initCamera();
|
||||
|
||||
mSendBtn.setOnClickListener(v -> {
|
||||
if (StringUtil.isEmpty(mEditText.getText().toString())) {
|
||||
return;
|
||||
}
|
||||
SendMessageManager.sendMessageForText(targetId, mEditText.getText().toString(), new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token) {
|
||||
@@ -180,7 +194,14 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
@Override
|
||||
public void onSuccess(String token) {
|
||||
super.onSuccess(token);
|
||||
ToastUtil.show("弹视频聊天");
|
||||
//ToastUtil.show("弹视频聊天");
|
||||
new BottomListDialog(mContext).setSelect(new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
ToastUtil.show(bean + "|" + position);
|
||||
}
|
||||
}).setStrings(Arrays.asList("发起语音通话\n200钻/分钟", "发起视频通话\n100钻/分钟"))
|
||||
.showDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -212,6 +233,10 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
}
|
||||
|
||||
private void checkAuth(OnSendMessageListener listener) {
|
||||
if (true) {
|
||||
listener.onSuccess("");
|
||||
return;
|
||||
}
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getTargetUserInfo(Integer.parseInt(targetId), new HttpCallback<UserBean>() {
|
||||
@Override
|
||||
@@ -276,8 +301,22 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
@Override
|
||||
public void onSuccess(String token) {
|
||||
super.onSuccess(token);
|
||||
ToastUtil.show(token);
|
||||
mEditText.setText("");
|
||||
if (!SpUtil.getInstance().isExists("chat_msg_safe_tip_" + targetId)) {
|
||||
SpUtil.getInstance().setBooleanValue("chat_msg_safe_tip_" + targetId, true);
|
||||
MessageChatTipsContent content = MessageChatTipsContent.obtain(WordUtil.getNewString(R.string.message_chat_tip1));
|
||||
IMCenter.getInstance().insertOutgoingMessage(conversationType, targetId, Message.SentStatus.SENT, content, System.currentTimeMillis(), new RongIMClient.ResultCallback<Message>() {
|
||||
@Override
|
||||
public void onSuccess(Message message) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode e) {
|
||||
System.out.println("失败:" + e.getMessage());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -394,6 +433,23 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
|
||||
@Override
|
||||
public boolean onViewLongClick(int clickType, UiMessage data) {
|
||||
View position = mList.getLayoutManager().findViewByPosition(mAdapter.getPosition(data.getMessageId()));
|
||||
new XPopup.Builder(getContext())
|
||||
.atView(position) // 依附于所点击的View,内部会自动判断在上方或者下方显示
|
||||
.asAttachList(new String[]{"分享", "编辑", "不带icon"},
|
||||
new int[]{R.mipmap.ic_launcher, R.mipmap.ic_launcher},
|
||||
new OnSelectListener() {
|
||||
@Override
|
||||
public void onSelect(int position, String text) {
|
||||
ToastUtil.show("click " + text);
|
||||
}
|
||||
})
|
||||
.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MessageListAdapter onResolveAdapter() {
|
||||
return new MsgChatMessageListAdapter(this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user