update
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.shayu.onetoone.activity;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
@@ -19,14 +20,19 @@ import com.shayu.onetoone.activity.fragments.FriendsFragment;
|
||||
import com.shayu.onetoone.activity.fragments.MessageFragment;
|
||||
import com.shayu.onetoone.activity.fragments.MyFragment;
|
||||
import com.shayu.onetoone.bean.JoinAnchorBean;
|
||||
import com.shayu.onetoone.bean.MatchingItemSizeBean;
|
||||
import com.shayu.onetoone.bean.OfficialNoticeBean;
|
||||
import com.shayu.onetoone.dialog.FirstTipsDialog;
|
||||
import com.shayu.onetoone.dialog.TipsDialog;
|
||||
import com.shayu.onetoone.event.MessageMsgBusEvent;
|
||||
import com.shayu.onetoone.listener.OnDialogClickListener;
|
||||
import com.shayu.onetoone.manager.CallClientManager;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
@@ -116,6 +122,49 @@ public class MainActivity extends AbsOTOActivity {
|
||||
}
|
||||
});
|
||||
CallClientManager.getManager();
|
||||
//initFirstLoginTips();
|
||||
}
|
||||
|
||||
private void initFirstLoginTips() {
|
||||
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getMatchingNum(new HttpCallback<MatchingItemSizeBean>() {
|
||||
@Override
|
||||
public void onSuccess(MatchingItemSizeBean data) {
|
||||
boolean isHome = false;
|
||||
boolean isMan = false;
|
||||
boolean isShow = true;
|
||||
if (data.getLogin() == 0) {
|
||||
isHome = true;
|
||||
} else if (data.getChat() == 0) {
|
||||
isMan = IMLoginManager.get(mContext).getUserInfo().getSex() == 1;
|
||||
} else {
|
||||
isShow = false;
|
||||
}
|
||||
if (isShow) {
|
||||
new FirstTipsDialog(mContext)
|
||||
.setHome(isMan)
|
||||
.setMan(isHome)
|
||||
.setOnItemClickListener(new OnItemClickListener<FirstTipsDialog>() {
|
||||
@Override
|
||||
public void onItemClick(FirstTipsDialog dialog, int position) {
|
||||
if (position == 0) {
|
||||
ToastUtil.show("灵魂速配");
|
||||
} else {
|
||||
viewPager.setCurrentItem(2);
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
})
|
||||
.showDialog();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
package com.shayu.onetoone.activity;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.message.ChatActivity;
|
||||
import com.shayu.onetoone.bean.MatchingInfoBean;
|
||||
import com.shayu.onetoone.bean.MatchingInfoUserBean;
|
||||
import com.shayu.onetoone.bean.SendConsumeBean;
|
||||
import com.shayu.onetoone.bean.UserBean;
|
||||
import com.shayu.onetoone.dialog.TipsDialog;
|
||||
import com.shayu.onetoone.listener.OnDialogClickListener;
|
||||
import com.shayu.onetoone.listener.OnSendMessageListener;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.shayu.onetoone.manager.SendMessageManager;
|
||||
import com.shayu.onetoone.utils.ConversationUtils;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
@Route(path = RouteManager.ACTIVITY_MATCHING)
|
||||
public class MatchingActivity extends AbsOTOActivity {
|
||||
private Task task;
|
||||
private Handler handler;
|
||||
private RoundedImageView user1, user2, user3, user4, user5;
|
||||
private TextView num;
|
||||
private ImageView back;
|
||||
List<RoundedImageView> imageViewList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_matching;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main(Bundle savedInstanceState) {
|
||||
handler = new Handler(Looper.getMainLooper());
|
||||
if (initView()) {
|
||||
task = new Task();
|
||||
new Timer().schedule(task, 10000, 10000);
|
||||
}
|
||||
initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
}
|
||||
handler = null;
|
||||
}
|
||||
|
||||
private boolean initView() {
|
||||
user1 = findViewById(R.id.user1);
|
||||
user2 = findViewById(R.id.user2);
|
||||
user3 = findViewById(R.id.user3);
|
||||
user4 = findViewById(R.id.user4);
|
||||
user5 = findViewById(R.id.user5);
|
||||
num = findViewById(R.id.num);
|
||||
back = findViewById(R.id.back);
|
||||
imageViewList.add(user1);
|
||||
imageViewList.add(user2);
|
||||
imageViewList.add(user3);
|
||||
imageViewList.add(user4);
|
||||
imageViewList.add(user5);
|
||||
back.setOnClickListener(v -> {
|
||||
new TipsDialog(mContext)
|
||||
.setTitle("確定要退出靈魂速配嗎?")
|
||||
.setApplyText("繼續匹配")
|
||||
.setCancelText("徹底離開")
|
||||
.setOnDialogClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onCancel(Dialog dialog) {
|
||||
super.onCancel(dialog);
|
||||
task.cancel();
|
||||
task = null;
|
||||
MatchingActivity.this.finish();
|
||||
}
|
||||
}).showDialog();
|
||||
});
|
||||
Bundle bundle = getIntent().getBundleExtra("bundle");
|
||||
if (bundle != null) {
|
||||
String data = bundle.getString("data");
|
||||
bundle.putInt("type",ChatActivity.CALL_CHAT_TYPE_MATCH);
|
||||
if (data != null) {
|
||||
SendConsumeBean bean = JSONObject.parseObject(data, SendConsumeBean.class);
|
||||
if (bean != null) {
|
||||
ToastUtil.show("有结果直接进");
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
ConversationUtils.startConversation(mContext, bean.getMateUser().getUser().getId() + "", bundle);
|
||||
MatchingActivity.this.finish();
|
||||
}, 5000);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getMatchingInfo(new HttpCallback<MatchingInfoBean>() {
|
||||
@Override
|
||||
public void onSuccess(MatchingInfoBean data) {
|
||||
List<MatchingInfoUserBean> list = data.getList();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
ImgLoader.display(mContext, list.get(i).getAvatar(), imageViewList.get(i));
|
||||
}
|
||||
num.setText(data.getPeople() + "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void call() {
|
||||
handler.post(() -> ToastUtil.show("匹配"));
|
||||
SendMessageManager.matching(new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
task.cancel();
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("type",ChatActivity.CALL_CHAT_TYPE_MATCH);
|
||||
bundle.putString("data", JSONObject.toJSONString(bean));
|
||||
ConversationUtils.startConversation(mContext, bean.getMateUser().getUser().getId() + "", bundle);
|
||||
MatchingActivity.this.finish();
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int status, String msg, SendConsumeBean bean) {
|
||||
super.onError(status, msg, bean);
|
||||
if (bean.getCode() == 503) {
|
||||
handler.post(() -> ToastUtil.show("没人,继续"));
|
||||
}else if(status==OnSendMessageListener.STATUS_NOT_PRICE){
|
||||
task.cancel();
|
||||
handler.post(() -> ToastUtil.show("价格不足"));
|
||||
MatchingActivity.this.finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private class Task extends TimerTask {
|
||||
final int MAX = 5;
|
||||
int index = MAX;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (index != 0) {
|
||||
call();
|
||||
} else {
|
||||
handler.post(() -> {
|
||||
new TipsDialog(mContext)
|
||||
.setTitle("当前等待时间较长,建议您 先去观看动态哦,稍后再来哦~")
|
||||
.setApplyText("去看动态")
|
||||
.setCancelText("繼續匹配")
|
||||
.setOnDialogClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onCancel(Dialog dialog) {
|
||||
super.onCancel(dialog);
|
||||
index = MAX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApply(Dialog dialog) {
|
||||
super.onApply(dialog);
|
||||
task.cancel();
|
||||
task = null;
|
||||
MatchingActivity.this.finish();
|
||||
}
|
||||
}).showDialog();
|
||||
});
|
||||
|
||||
}
|
||||
index--;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancel() {
|
||||
handler.post(() -> ToastUtil.show("取消"));
|
||||
return super.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,16 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.fragments.BaseFragment;
|
||||
import com.shayu.onetoone.adapter.HomeRecommendListAdapter;
|
||||
import com.shayu.onetoone.bean.HomeItemBean;
|
||||
import com.shayu.onetoone.bean.SendConsumeBean;
|
||||
import com.shayu.onetoone.listener.OnSendMessageListener;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.shayu.onetoone.manager.SendMessageManager;
|
||||
import com.yanzhenjie.recyclerview.SwipeRecyclerView;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
@@ -31,12 +36,14 @@ public class RecommendFragment extends BaseFragment {
|
||||
private int page = 1;
|
||||
private boolean isScreen;
|
||||
Bundle screen;
|
||||
View matching;
|
||||
|
||||
@Override
|
||||
public void initView(View itemView) {
|
||||
recyclerView = itemView.findViewById(R.id.recyclerView);
|
||||
mRefreshLayout = itemView.findViewById(R.id.swipeRefreshLayout);
|
||||
top = itemView.findViewById(R.id.btn_top_list);
|
||||
matching=itemView.findViewById(R.id.matching);
|
||||
adapter = new HomeRecommendListAdapter(getContext());
|
||||
recyclerView.setAdapter(adapter);
|
||||
mRefreshLayout.setNestedScrollingEnabled(false);
|
||||
@@ -57,6 +64,24 @@ public class RecommendFragment extends BaseFragment {
|
||||
top.setOnClickListener(view -> {
|
||||
recyclerView.scrollToPosition(0);
|
||||
});
|
||||
matching.setOnClickListener(v -> {
|
||||
SendMessageManager.matching(new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("data", JSONObject.toJSONString(bean));
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_MATCHING,bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int status, String msg, SendConsumeBean bean) {
|
||||
super.onError(status, msg, bean);
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_MATCHING);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
screen = getActivity().getIntent().getBundleExtra("screen");
|
||||
if (screen != null) {
|
||||
if (!isScreen) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
@@ -22,18 +21,18 @@ 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.FollowBean;
|
||||
import com.shayu.onetoone.bean.MessageChatAuthContent;
|
||||
import com.shayu.onetoone.bean.MessageChatTipsContent;
|
||||
import com.shayu.onetoone.bean.MessageConsumeConfigBean;
|
||||
import com.shayu.onetoone.bean.SendConsumeBean;
|
||||
import com.shayu.onetoone.bean.UserBean;
|
||||
import com.shayu.onetoone.dialog.BottomListDialog;
|
||||
import com.shayu.onetoone.dialog.MsgChatClickDialog;
|
||||
import com.shayu.onetoone.dialog.TipsDialog;
|
||||
import com.shayu.onetoone.listener.OnCallStatusListener;
|
||||
import com.shayu.onetoone.listener.OnDialogClickListener;
|
||||
import com.shayu.onetoone.listener.OnSendMessageListener;
|
||||
import com.shayu.onetoone.manager.CallClientManager;
|
||||
@@ -47,7 +46,6 @@ 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.DpUtil;
|
||||
import com.yunbao.common.utils.ProcessImageUtil;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
@@ -59,18 +57,12 @@ import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import io.rong.calllib.RongCallCommon;
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.config.RongConfigCenter;
|
||||
import io.rong.imkit.conversation.MessageListAdapter;
|
||||
import io.rong.imkit.conversation.extension.component.plugin.IPluginModule;
|
||||
import io.rong.imkit.conversation.extension.component.plugin.ImagePlugin;
|
||||
import io.rong.imkit.manager.SendImageManager;
|
||||
import io.rong.imkit.model.UiMessage;
|
||||
import io.rong.imkit.picture.PictureSelectionModel;
|
||||
import io.rong.imkit.picture.PictureSelector;
|
||||
import io.rong.imkit.picture.config.PictureMimeType;
|
||||
import io.rong.imkit.picture.entity.LocalMedia;
|
||||
@@ -105,6 +97,7 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
|
||||
private String token;
|
||||
private static final String TAG = "聊天界面";
|
||||
private MessageConsumeConfigBean configBean;
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
@@ -112,6 +105,7 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
targetId = getActivity().getIntent().getStringExtra("targetId");
|
||||
initBtn();
|
||||
initChat();
|
||||
initPriceBean();
|
||||
cameraUtil = new ProcessImageUtil(getActivity(), "com.shayu.onetoone.fileprovider");
|
||||
|
||||
mRongExtension.setVisibility(View.VISIBLE);
|
||||
@@ -124,8 +118,8 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
}
|
||||
SendMessageManager.sendMessageForText(targetId, mEditText.getText().toString(), new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token) {
|
||||
super.onSuccess(token);
|
||||
public void onSuccess(String token,SendConsumeBean bean) {
|
||||
super.onSuccess(token,bean);
|
||||
ChatMessageFragment.this.token = token;
|
||||
sendText();
|
||||
|
||||
@@ -214,19 +208,40 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
video.setOnClickListener(v -> {
|
||||
checkAuth(new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token) {
|
||||
super.onSuccess(token);
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token,bean);
|
||||
new BottomListDialog(mContext).setSelect(new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("model", CallClientManager.VIDEO_CALL);
|
||||
bundle.putString("targetId", targetId);
|
||||
bundle.putString("callId", targetId);
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_CALL_VIDEO, bundle);
|
||||
CallClientManager.getManager().checkMoney(targetId, true, new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("model", CallClientManager.VIDEO_CALL);
|
||||
bundle.putString("targetId", targetId);
|
||||
bundle.putString("callId", targetId);
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_CALL_VIDEO, bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int status, String msg) {
|
||||
super.onError(status, msg);
|
||||
new TipsDialog(mContext)
|
||||
.setTitle("餘額不足")
|
||||
.setContent("與TA視頻聊天每分鐘續消耗"+configBean.getVideoPrice()
|
||||
+"鑽石,您可通過充值獲取更多鑽石,以便繼續聊天")
|
||||
.setCancelText("離開")
|
||||
.setApplyText("去充值")
|
||||
.showDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).setStrings(Collections.singletonList("发起视频通话\n100钻/分钟"))
|
||||
}).setStrings(Collections.singletonList("发起视频通话\n"+configBean.getVideoPrice()+"钻/分钟"))
|
||||
.showDialog();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -239,18 +254,37 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
call.setOnClickListener(v -> {
|
||||
checkAuth(new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token) {
|
||||
super.onSuccess(token);
|
||||
public void onSuccess(String token,SendConsumeBean bean) {
|
||||
super.onSuccess(token,bean);
|
||||
new BottomListDialog(mContext).setSelect(new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("model", CallClientManager.AUDIO_CALL);
|
||||
bundle.putString("targetId", targetId);
|
||||
bundle.putString("callId", targetId);
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_CALL_AUDIO, bundle);
|
||||
CallClientManager.getManager().checkMoney(targetId, false, new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token, SendConsumeBean bean) {
|
||||
super.onSuccess(token, bean);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("model", CallClientManager.AUDIO_CALL);
|
||||
bundle.putString("targetId", targetId);
|
||||
bundle.putString("callId", targetId);
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_CALL_AUDIO, bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int status, String msg) {
|
||||
super.onError(status, msg);
|
||||
new TipsDialog(mContext)
|
||||
.setTitle("餘額不足")
|
||||
.setContent("與TA语音聊天每分鐘續消耗"+configBean.getMp3Price()
|
||||
+"鑽石,您可通過充值獲取更多鑽石,以便繼續聊天")
|
||||
.setCancelText("離開")
|
||||
.setApplyText("去充值")
|
||||
.showDialog();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}).setStrings(Collections.singletonList("发起语音通话\n200钻/分钟"))
|
||||
}).setStrings(Collections.singletonList("发起语音通话\n"+configBean.getMp3Price()+"钻/分钟"))
|
||||
.showDialog();
|
||||
}
|
||||
|
||||
@@ -271,8 +305,8 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
|
||||
SendMessageManager.sendMessageForText(targetId, "图片信息", new OnSendMessageListener() {
|
||||
@Override
|
||||
public void onSuccess(String token) {
|
||||
super.onSuccess(token);
|
||||
public void onSuccess(String token,SendConsumeBean bean) {
|
||||
super.onSuccess(token,bean);
|
||||
ChatMessageFragment.this.token = token;
|
||||
if (isCamera) {
|
||||
cameraUtil.getImageByCamera(false);
|
||||
@@ -312,7 +346,7 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
if (data.getInfo().getName_auth() == 1) {
|
||||
listener.onError(0, "");
|
||||
} else {
|
||||
listener.onSuccess("");
|
||||
listener.onSuccess("",null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,8 +401,8 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String token) {
|
||||
super.onSuccess(token);
|
||||
public void onSuccess(String token,SendConsumeBean bean) {
|
||||
super.onSuccess(token,bean);
|
||||
mEditText.setText("");
|
||||
if (!SpUtil.getInstance().isExists("chat_msg_safe_tip_" + targetId)) {
|
||||
SpUtil.getInstance().setBooleanValue("chat_msg_safe_tip_" + targetId, true);
|
||||
@@ -632,4 +666,18 @@ public class ChatMessageFragment extends AbsConversationFragment {
|
||||
}
|
||||
}
|
||||
}
|
||||
private void initPriceBean(){
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getMessageConsumeConfig(targetId, new HttpCallback<MessageConsumeConfigBean>() {
|
||||
@Override
|
||||
public void onSuccess(MessageConsumeConfigBean data) {
|
||||
configBean=data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BasePopupView;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.lzf.easyfloat.enums.ShowPattern;
|
||||
import com.lzf.easyfloat.interfaces.OnFloatCallbacks;
|
||||
@@ -21,6 +23,7 @@ import com.shayu.onetoone.activity.AbsOTOActivity;
|
||||
import com.shayu.onetoone.bean.FollowBean;
|
||||
import com.shayu.onetoone.bean.UserBean;
|
||||
import com.shayu.onetoone.dialog.GiftDialog;
|
||||
import com.shayu.onetoone.dialog.TipsTextDialog;
|
||||
import com.shayu.onetoone.listener.OnCallStatusListener;
|
||||
import com.shayu.onetoone.manager.CallClientManager;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
@@ -28,6 +31,7 @@ import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.shayu.onetoone.utils.ConversationUtils;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
@@ -267,6 +271,42 @@ public class CallAudioActivity extends AbsOTOActivity implements View.OnClickLis
|
||||
super.onTime(time);
|
||||
callTime.setText("通话时长:" + time);
|
||||
}
|
||||
|
||||
|
||||
private BasePopupView tipsView = null;
|
||||
private TipsTextDialog tipsDialog;
|
||||
|
||||
@Override
|
||||
public void onTimeWarning(long msg) {
|
||||
super.onTimeWarning(msg);
|
||||
if (tipsView == null) {
|
||||
createShow(msg);
|
||||
} else {
|
||||
tipsDialog.updateTips("通话将在" + msg + "秒后断\n开,请及时充值");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void createShow(long msg) {
|
||||
tipsDialog = new TipsTextDialog(mContext)
|
||||
.setTips("通话将在" + msg + "秒后断\n开,请及时充值")
|
||||
.setOnItemClickListener(new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
|
||||
}
|
||||
});
|
||||
tipsView = new XPopup.Builder(mContext)
|
||||
.atView(money)
|
||||
.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isTouchThrough(true)
|
||||
.isClickThrough(true)
|
||||
.dismissOnBackPressed(false)
|
||||
.dismissOnTouchOutside(false)
|
||||
.asCustom(tipsDialog)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
private static class WindowCallStatusListener extends OnCallStatusListener {
|
||||
|
||||
@@ -23,6 +23,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BasePopupView;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.lzf.easyfloat.enums.ShowPattern;
|
||||
import com.lzf.easyfloat.interfaces.OnFloatCallbacks;
|
||||
@@ -32,6 +34,8 @@ import com.shayu.onetoone.activity.AbsOTOActivity;
|
||||
import com.shayu.onetoone.bean.FollowBean;
|
||||
import com.shayu.onetoone.bean.UserBean;
|
||||
import com.shayu.onetoone.dialog.GiftDialog;
|
||||
import com.shayu.onetoone.dialog.MsgChatClickDialog;
|
||||
import com.shayu.onetoone.dialog.TipsTextDialog;
|
||||
import com.shayu.onetoone.listener.OnCallStatusListener;
|
||||
import com.shayu.onetoone.manager.CallClientManager;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
@@ -39,11 +43,13 @@ import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.shayu.onetoone.utils.ConversationUtils;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import io.rong.calllib.CallUserProfile;
|
||||
@@ -320,7 +326,8 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
private void follow(){
|
||||
|
||||
private void follow() {
|
||||
OTONetManager.getInstance(mContext)
|
||||
.follow(targetId, new HttpCallback<FollowBean>() {
|
||||
@Override
|
||||
@@ -335,6 +342,7 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private final View.OnClickListener onClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -358,7 +366,7 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
showWindow(false);
|
||||
} else if (id == R.id.message) {
|
||||
showWindow(true);
|
||||
}else if(id == R.id.follow){
|
||||
} else if (id == R.id.follow) {
|
||||
follow();
|
||||
}
|
||||
}
|
||||
@@ -407,10 +415,45 @@ public class CallVideoActivity extends AbsOTOActivity {
|
||||
@Override
|
||||
public void onTime(String time) {
|
||||
super.onTime(time);
|
||||
if(callTime!=null){
|
||||
callTime.setText("通话时长:"+time);
|
||||
if (callTime != null) {
|
||||
callTime.setText("通话时长:" + time);
|
||||
}
|
||||
}
|
||||
|
||||
private BasePopupView tipsView = null;
|
||||
private TipsTextDialog tipsDialog;
|
||||
|
||||
@Override
|
||||
public void onTimeWarning(long msg) {
|
||||
super.onTimeWarning(msg);
|
||||
if (tipsView == null) {
|
||||
createShow(msg);
|
||||
} else {
|
||||
tipsDialog.updateTips("通话将在" + msg + "秒后断\n开,请及时充值");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void createShow(long msg) {
|
||||
tipsDialog = new TipsTextDialog(mContext)
|
||||
.setTips("通话将在" + msg + "秒后断\n开,请及时充值")
|
||||
.setOnItemClickListener(new OnItemClickListener<String>() {
|
||||
@Override
|
||||
public void onItemClick(String bean, int position) {
|
||||
|
||||
}
|
||||
});
|
||||
tipsView = new XPopup.Builder(mContext)
|
||||
.atView(money)
|
||||
.hasShadowBg(false)
|
||||
.isTouchThrough(true)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isClickThrough(true)
|
||||
.dismissOnBackPressed(false)
|
||||
.dismissOnTouchOutside(false)
|
||||
.asCustom(tipsDialog)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
private static class WindowCallStatusListener extends OnCallStatusListener {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.shayu.onetoone.activity.message;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
@@ -18,9 +19,13 @@ import com.shayu.onetoone.activity.fragments.message.ChatMessageFragment;
|
||||
import com.shayu.onetoone.activity.fragments.message.MessageInteractiveFragment;
|
||||
import com.shayu.onetoone.activity.fragments.message.MessageNoticeFragment;
|
||||
import com.shayu.onetoone.activity.fragments.message.SystemMessageFragment;
|
||||
import com.shayu.onetoone.bean.MessageChatTipsContent;
|
||||
import com.shayu.onetoone.bean.OfficialNoticeBean;
|
||||
import com.shayu.onetoone.bean.SendConsumeBean;
|
||||
import com.shayu.onetoone.bean.SystemMessageBean;
|
||||
import com.shayu.onetoone.bean.UserBean;
|
||||
import com.shayu.onetoone.dialog.TipsDialog;
|
||||
import com.shayu.onetoone.listener.OnDialogClickListener;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
@@ -29,14 +34,20 @@ import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import io.rong.imkit.conversation.ConversationFragment;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
|
||||
/**
|
||||
* 聊天界面
|
||||
*/
|
||||
@Route(path = RouteManager.ACTIVITY_MSG_CHAT)
|
||||
public class ChatActivity extends AbsOTOActivity {
|
||||
|
||||
public final static int CALL_CHAT_TYPE_CHAT_UP = 0;//搭讪
|
||||
public final static int CALL_CHAT_TYPE_GIFT = 1;//打开【首次匹配弹窗】
|
||||
public final static int CALL_CHAT_TYPE_MATCH = 2;//匹配
|
||||
String targetId;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -53,18 +64,77 @@ public class ChatActivity extends AbsOTOActivity {
|
||||
} else if (type == 1) {
|
||||
conversationFragment = new MessageNoticeFragment(getIntent().getStringExtra("data"));
|
||||
} else if (type == 2) {
|
||||
conversationFragment=new MessageInteractiveFragment(getIntent().getStringExtra("data"));
|
||||
conversationFragment = new MessageInteractiveFragment(getIntent().getStringExtra("data"));
|
||||
} else {
|
||||
conversationFragment = new ChatMessageFragment();
|
||||
|
||||
targetId = getIntent().getStringExtra("targetId");
|
||||
}
|
||||
FragmentManager manager = getSupportFragmentManager();
|
||||
FragmentTransaction transaction = manager.beginTransaction();
|
||||
transaction.replace(R.id.container, conversationFragment);
|
||||
transaction.commit();
|
||||
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
if (bundle != null) {
|
||||
int bundleInt = bundle.getInt("type", -1);
|
||||
if (bundleInt == CALL_CHAT_TYPE_GIFT) {
|
||||
String data = bundle.getString("data");
|
||||
if (data != null) {
|
||||
SendConsumeBean bean = JSONObject.parseObject(data, SendConsumeBean.class);
|
||||
if (bean.getProp().getId() == 0) {
|
||||
return;
|
||||
}
|
||||
ImageView imageView = new ImageView(this);
|
||||
|
||||
new TipsDialog(mContext)
|
||||
.setTitle("首次匹配成功奖励")
|
||||
.setContent("恭喜获得" + bean.getProp().getCnTitle() + "*" + bean.getProp().getNum())
|
||||
.setContentView(imageView)
|
||||
.setOnDialogClickListener(new OnDialogClickListener() {
|
||||
@Override
|
||||
public void onCreateView(View itemView) {
|
||||
super.onCreateView(itemView);
|
||||
ImgLoader.display(ChatActivity.this, bean.getProp().getIcon(), (ImageView) itemView);
|
||||
}
|
||||
}).showDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
initChatUpData();
|
||||
|
||||
}
|
||||
|
||||
private void initChatUpData() {//反正进来就获取又没有提示信息,有的话就发送,没有就不管,抛异常=发过了
|
||||
OTONetManager.getInstance(mContext)
|
||||
.getChatTips(targetId, new HttpCallback<JSONObject>() {
|
||||
@Override
|
||||
public void onSuccess(JSONObject data) {
|
||||
try {
|
||||
String tips1 = data.getJSONObject("data").getJSONObject("info").getJSONObject("0").getString("cn");
|
||||
String tips2 = data.getJSONObject("data").getJSONObject("info").getJSONObject("1").getString("cn");
|
||||
String tips3 = data.getJSONObject("data").getJSONObject("info").getJSONObject("2").getString("cn");
|
||||
if (!StringUtil.isEmpty(tips1)) {
|
||||
MessageChatTipsContent.sendMessage(Conversation.ConversationType.PRIVATE, targetId, MessageChatTipsContent.obtain(tips1), null);
|
||||
}
|
||||
if (!StringUtil.isEmpty(tips2)) {
|
||||
MessageChatTipsContent.sendMessage(Conversation.ConversationType.PRIVATE, targetId, MessageChatTipsContent.obtain(tips2), null);
|
||||
}
|
||||
if (!StringUtil.isEmpty(tips3)) {
|
||||
MessageChatTipsContent.sendMessage(Conversation.ConversationType.PRIVATE, targetId, MessageChatTipsContent.obtain(tips3), null);
|
||||
}
|
||||
OTONetManager.getInstance(mContext)
|
||||
.updateChatTips(targetId, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//调用过了,不管
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user