update
This commit is contained in:
parent
24d93f2604
commit
1424ff61e1
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,70 @@
|
||||
package com.shayu.onetoone.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.shayu.onetoone.R;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BottomListDialogAdapter extends RecyclerView.Adapter<BottomListDialogAdapter.ViewHolder> {
|
||||
private List<String> list;
|
||||
private Context mContext;
|
||||
private OnItemClickListener<String> onItemClickListener;
|
||||
|
||||
public BottomListDialogAdapter(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
public void setList(List<String> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public void setContext(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<String> onItemClickListener) {
|
||||
this.onItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_dialog_bottom, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
holder.setData(list.get(position),position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView textView;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
textView = itemView.findViewById(R.id.item);
|
||||
}
|
||||
|
||||
public void setData(String data, int position) {
|
||||
textView.setText(data);
|
||||
itemView.setOnClickListener(v -> {
|
||||
onItemClickListener.onItemClick(data, position);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.shayu.onetoone.adapter;
|
||||
|
||||
import io.rong.imkit.conversation.MessageListAdapter;
|
||||
import io.rong.imkit.model.UiMessage;
|
||||
import io.rong.imkit.widget.adapter.IViewProviderListener;
|
||||
|
||||
public class MsgChatMessageListAdapter extends MessageListAdapter {
|
||||
public MsgChatMessageListAdapter(IViewProviderListener<UiMessage> listener) {
|
||||
super(listener);
|
||||
}
|
||||
|
||||
public void onLongClick(int messageId) {
|
||||
}
|
||||
|
||||
public int getPosition(int messageId) {
|
||||
for (int i = 0; i < getData().size(); i++) {
|
||||
if (getData().get(i).getMessageId() == messageId){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.shayu.onetoone.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.adapter.BottomListDialogAdapter;
|
||||
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class BottomListDialog extends AbsDialogPopupWindow {
|
||||
List<String> strings;
|
||||
OnItemClickListener<String> select;
|
||||
RecyclerView recyclerView;
|
||||
BottomListDialogAdapter adapter;
|
||||
View cancel;
|
||||
|
||||
public BottomListDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
strings = new ArrayList<>();
|
||||
}
|
||||
|
||||
public BottomListDialog setStrings(List<String> strings) {
|
||||
this.strings = strings;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BottomListDialog setSelect(OnItemClickListener<String> select) {
|
||||
this.select = select;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_bottom_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
cancel = findViewById(R.id.cancel);
|
||||
cancel.setOnClickListener(v -> dismiss());
|
||||
adapter = new BottomListDialogAdapter(getContext());
|
||||
adapter.setList(strings);
|
||||
adapter.setOnItemClickListener(new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
select.onItemClick(bean, position);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
}
|
@ -86,6 +86,7 @@ public class MsgInputPanelForGift extends AbsInputPanel {
|
||||
|
||||
private void sendGift(GiftBean item) {
|
||||
MessageChatGiftContent bean = MessageChatGiftContent.obtain(JSONObject.toJSONString(item), "1", IMLoginManager.get(mContext).getUserInfo().getId() + "");
|
||||
bean.setExtra(JSONObject.toJSONString(item));
|
||||
IMCenter.getInstance().sendMessage(Message.obtain(targetId, Conversation.ConversationType.PRIVATE, bean),
|
||||
null,
|
||||
null,
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="31dp" android:height="14dp">
|
||||
<item android:width="45dp" android:height="25dp">
|
||||
<shape android:shape="rectangle">
|
||||
<stroke android:width="1dp" android:color="#ffff8037" />
|
||||
<corners android:topLeftRadius="7dp" android:topRightRadius="7dp" android:bottomLeftRadius="7dp" android:bottomRightRadius="7dp" />
|
||||
<gradient android:type="linear" android:useLevel="true" android:startColor="#ffffe272" android:endColor="#fff6c974" android:angle="180" />
|
||||
<corners android:topLeftRadius="13dp" android:topRightRadius="13dp" android:bottomLeftRadius="13dp" android:bottomRightRadius="13dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -1,6 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="#F3F4F6"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:spanCount="1"
|
||||
tools:itemCount="1"
|
||||
tools:listitem="@layout/item_dialog_bottom" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cancel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="41dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="@color/white"
|
||||
android:gravity="center"
|
||||
android:textColor="#333333"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/recyclerView"
|
||||
tools:text="取消" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
23
OneToOne/src/main/res/layout/item_dialog_bottom.xml
Normal file
23
OneToOne/src/main/res/layout/item_dialog_bottom.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/white"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="11dp"
|
||||
android:textColor="#333333"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="发起语音通话\n200钻/分钟" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -50,7 +50,7 @@
|
||||
android:layout_width="13dp"
|
||||
android:layout_height="13dp"
|
||||
android:layout_gravity="center"
|
||||
app:srcCompat="@mipmap/home_me_diamonds" />
|
||||
app:srcCompat="@mipmap/ic_drill" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/money"
|
||||
|
@ -42,7 +42,7 @@
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center"
|
||||
app:srcCompat="@mipmap/home_me_diamonds" />
|
||||
app:srcCompat="@mipmap/ic_drill" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/money"
|
||||
@ -55,13 +55,13 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/top_up_btn"
|
||||
android:layout_width="31dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="6dp"
|
||||
android:background="@drawable/bg_gift_top_up"
|
||||
android:text="充值"
|
||||
android:textColor="#FFB554"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="10sp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
BIN
OneToOne/src/main/res/mipmap-xxhdpi/ic_drill.png
Normal file
BIN
OneToOne/src/main/res/mipmap-xxhdpi/ic_drill.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Loading…
x
Reference in New Issue
Block a user