d
This commit is contained in:
@@ -18,8 +18,8 @@ public class ConversationActivity extends BaseActivity {
|
||||
setContentView(R.layout.activity_conversation);
|
||||
mTitleBar = findViewById(R.id.title_bar);
|
||||
initNormalBack();
|
||||
String num = getIntent().getStringExtra("num");
|
||||
String private_id = getIntent().getStringExtra("private_id");
|
||||
mTitleBar.setTitle("抖音昵称"+"**");
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.container,new QuestionsFragment()).commit();
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.container,new QuestionsFragment(private_id)).commit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,18 +19,17 @@ import com.fenghoo.seven.base.BaseTreeFragment;
|
||||
import com.fenghoo.seven.main.find.adapter.QuestionsAdapter;
|
||||
import com.fenghoo.seven.main.find.entity.QuestionsEntity;
|
||||
import com.fenghoo.seven.main.find.entity.commonWordsBean;
|
||||
import com.fenghoo.seven.main.find.entity.privateListBean;
|
||||
import com.fenghoo.seven.main.find.entity.privateChatBean;
|
||||
import com.fenghoo.seven.main.find.mvp.contract.QuestionsContract;
|
||||
import com.fenghoo.seven.main.find.mvp.presenter.QuestionsPresenterImpl;
|
||||
import com.fenghoo.seven.main.kehu.Bean.CustomerListBean;
|
||||
import com.fenghoo.seven.main.kehu.activity.ShowAty;
|
||||
import com.fenghoo.seven.okgonet.HttpConstants;
|
||||
import com.fenghoo.seven.okgonet.NetApi;
|
||||
import com.fenghoo.seven.okgonet.Observer;
|
||||
import com.fenghoo.seven.utils.ToastUtils;
|
||||
import com.fenghoo.seven.utils.WidgetTools;
|
||||
import com.fenghoo.seven.utils.checkVersionsUtils.ProfileSpUtils;
|
||||
import com.fenghoo.seven.widget.PastEditText;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Response;
|
||||
|
||||
@@ -61,6 +60,11 @@ public class QuestionsFragment extends BaseTreeFragment<QuestionsContract.View,
|
||||
private RecyclerView reply_rcey;
|
||||
private boolean flag=false;
|
||||
private List<commonWordsBean.ResultBean.DataBean> data;
|
||||
private String private_id;
|
||||
|
||||
public QuestionsFragment(String private_id){
|
||||
this.private_id=private_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetClick(View v) {
|
||||
@@ -153,14 +157,44 @@ public class QuestionsFragment extends BaseTreeFragment<QuestionsContract.View,
|
||||
@Override
|
||||
protected void initData() {
|
||||
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
final HttpParams paramsPost = new HttpParams();
|
||||
paramsPost.put("uid", ProfileSpUtils.getInstance().getUserProfie().getData().getUuid());
|
||||
paramsPost.put("private_id", private_id);
|
||||
new NetApi().getPostData(paramsPost, HttpConstants.URi_device_AppDouyin_privateChat).subscribe(new Observer<Response>() {
|
||||
@Override
|
||||
public void onNext(Response response) {
|
||||
String body = (String) response.body();
|
||||
privateChatBean.ResultBean result = JsonUtils.fromJson(body, privateChatBean.class).getResult();
|
||||
if(result.getSuccess()==0){
|
||||
List<QuestionsEntity> question = new ArrayList<>();
|
||||
List<privateChatBean.ResultBean.DataBean> data = result.getData();
|
||||
for(int i=0;i<data.size();i++){
|
||||
QuestionsEntity questionsEntity = new QuestionsEntity();
|
||||
questionsEntity.setIs_self(data.get(i).getIs_self());//表明是自己发送的
|
||||
questionsEntity.setMsg(data.get(i).getContent());//设置问题内容
|
||||
question.add(questionsEntity);
|
||||
}
|
||||
mAdapter.upDate(question);
|
||||
mLayoutManager.scrollToPosition(mAdapter.getEList().size() - 1);
|
||||
}else {
|
||||
ToastUtils.showToast(getActivity(),result.getMsg());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onError(Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//初始化
|
||||
List<QuestionsEntity> question = new ArrayList<>();
|
||||
QuestionsEntity questionsEntity = new QuestionsEntity();
|
||||
questionsEntity.setIs_self(0);//表明是自己发送的
|
||||
questionsEntity.setMsg("您好,很高兴为您服务。");//设置问题内容
|
||||
question.add(questionsEntity);
|
||||
mAdapter.upDate(question);
|
||||
// List<QuestionsEntity> question = new ArrayList<>();
|
||||
// QuestionsEntity questionsEntity = new QuestionsEntity();
|
||||
// questionsEntity.setIs_self(0+"");//表明是自己发送的
|
||||
// questionsEntity.setMsg("您好,很高兴为您服务。");//设置问题内容
|
||||
// question.add(questionsEntity);
|
||||
// mAdapter.upDate(question);
|
||||
}
|
||||
|
||||
|
||||
@@ -186,10 +220,55 @@ public class QuestionsFragment extends BaseTreeFragment<QuestionsContract.View,
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//发送消息
|
||||
getPresenter().sendMsg();
|
||||
// getPresenter().sendMsg();
|
||||
//获取输入
|
||||
String input = getInput();
|
||||
List<QuestionsEntity> question = new ArrayList<>();
|
||||
QuestionsEntity questionsEntity = new QuestionsEntity();
|
||||
questionsEntity.setIs_self("0");//表明是自己发送的
|
||||
questionsEntity.setMsg(input);//设置问题内容
|
||||
question.add(questionsEntity);
|
||||
upDataAdd(question);
|
||||
final HttpParams paramsPost = new HttpParams();
|
||||
paramsPost.put("uid", ProfileSpUtils.getInstance().getUserProfie().getData().getUuid());
|
||||
paramsPost.put("private_id", private_id);
|
||||
paramsPost.put("content", input);
|
||||
new NetApi().getPostData(paramsPost, HttpConstants.URi_device_AppDouyin_replyChat).subscribe(new Observer<Response>() {
|
||||
@Override
|
||||
public void onNext(Response response) {
|
||||
String body = (String) response.body();
|
||||
privateChatBean.ResultBean result = JsonUtils.fromJson(body, privateChatBean.class).getResult();
|
||||
if(result.getSuccess()==0){
|
||||
List<QuestionsEntity> question = new ArrayList<>();
|
||||
List<privateChatBean.ResultBean.DataBean> data = result.getData();
|
||||
|
||||
// for(int i=0;i<data.size();i++){
|
||||
// QuestionsEntity questionsEntity = new QuestionsEntity();
|
||||
// questionsEntity.setIs_self(data.get(i).getIs_self());//表明是自己发送的
|
||||
// questionsEntity.setMsg(data.get(i).getContent());//设置问题内容
|
||||
// question.add(questionsEntity);
|
||||
// }
|
||||
// privateChatBean.ResultBean.DataBean dataBean = data.get(data.size() - 1);
|
||||
// QuestionsEntity questionsEntity = new QuestionsEntity();
|
||||
// questionsEntity.setIs_self(dataBean.getIs_self());//表明是自己发送的
|
||||
// questionsEntity.setMsg(dataBean.getContent());//设置问题内容
|
||||
// question.add(questionsEntity);
|
||||
// upDataAdd(question);
|
||||
mLayoutManager.scrollToPosition(mAdapter.getEList().size() - 1);
|
||||
|
||||
}else {
|
||||
ToastUtils.showToast(getActivity(),result.getMsg());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onError(Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -65,7 +65,7 @@ public class QuestionsAdapter extends BaseRecycleAdapter<QuestionsEntity, Questi
|
||||
|
||||
@Override
|
||||
protected int getCustomItemViewType(int position) {
|
||||
return 1 == mEList.get(position).getIs_self() ? ITEM_TYPE_RIGHT : ITEM_TYPE_LEFT;
|
||||
return 0 == Integer.parseInt(mEList.get(position).getIs_self()) ? ITEM_TYPE_RIGHT : ITEM_TYPE_LEFT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,11 +19,41 @@ public class QuestionsEntity {
|
||||
*/
|
||||
|
||||
private String msg;
|
||||
private int is_self;
|
||||
private String is_self;
|
||||
private int reply_type;
|
||||
private List<DataEntity> data;
|
||||
private String question;
|
||||
|
||||
public String getMessage_type() {
|
||||
return message_type;
|
||||
}
|
||||
|
||||
public void setMessage_type(String message_type) {
|
||||
this.message_type = message_type;
|
||||
}
|
||||
|
||||
private String message_type;//1:系统消息,5:图片表情包,7:文字消息及自带表情,27:相册图片
|
||||
|
||||
public String getUser_head() {
|
||||
return user_head;
|
||||
}
|
||||
|
||||
public void setUser_head(String user_head) {
|
||||
this.user_head = user_head;
|
||||
}
|
||||
|
||||
private String user_head;//店员头像
|
||||
|
||||
public String getNick_img() {
|
||||
return nick_img;
|
||||
}
|
||||
|
||||
public void setNick_img(String nick_img) {
|
||||
this.nick_img = nick_img;
|
||||
}
|
||||
|
||||
private String nick_img;//抖音用户头像
|
||||
|
||||
public String getQuestion() {
|
||||
return question;
|
||||
}
|
||||
@@ -40,11 +70,11 @@ public class QuestionsEntity {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getIs_self() {
|
||||
public String getIs_self() {
|
||||
return is_self;
|
||||
}
|
||||
|
||||
public void setIs_self(int is_self) {
|
||||
public void setIs_self(String is_self) {
|
||||
this.is_self = is_self;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.fenghoo.seven.main.find.entity;
|
||||
|
||||
/**
|
||||
* Time: 2020/9/1
|
||||
* Author: jianbo
|
||||
* Description:
|
||||
*/
|
||||
public class askBean {
|
||||
|
||||
/**
|
||||
* msg : 绑定微信成功!
|
||||
* success : 0
|
||||
*/
|
||||
|
||||
private String msg;
|
||||
private int success;
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(int success) {
|
||||
this.success = success;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package com.fenghoo.seven.main.find.entity;
|
||||
|
||||
import com.fenghoo.seven.test.BaseModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Time: 2020/9/1
|
||||
* Author: jianbo
|
||||
* Description:
|
||||
*/
|
||||
public class privateChatBean extends BaseModel {
|
||||
|
||||
/**
|
||||
* result : {"msg":"获取成功","data":[{"use_dy_uid":"93021087403","from_id":"109408381544","user_head":"","if_read":"1","nick_img":"","to_id":"93021087403","message_type":"1","id":"6844003801914000000","time":"2020-06-30 13:10:10","dy_uid":"109408381544","is_self":"1","content":"你们已成为好友"}],"success":0}
|
||||
* status : 0
|
||||
*/
|
||||
|
||||
private ResultBean result;
|
||||
private int status;
|
||||
|
||||
public ResultBean getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ResultBean result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public static class ResultBean {
|
||||
/**
|
||||
* msg : 获取成功
|
||||
* data : [{"use_dy_uid":"93021087403","from_id":"109408381544","user_head":"","if_read":"1","nick_img":"","to_id":"93021087403","message_type":"1","id":"6844003801914000000","time":"2020-06-30 13:10:10","dy_uid":"109408381544","is_self":"1","content":"你们已成为好友"}]
|
||||
* success : 0
|
||||
*/
|
||||
|
||||
private String msg;
|
||||
private int success;
|
||||
private List<DataBean> data;
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(int success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public List<DataBean> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<DataBean> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataBean {
|
||||
/**
|
||||
* use_dy_uid : 93021087403
|
||||
* from_id : 109408381544
|
||||
* user_head :
|
||||
* if_read : 1
|
||||
* nick_img :
|
||||
* to_id : 93021087403
|
||||
* message_type : 1
|
||||
* id : 6844003801914000000
|
||||
* time : 2020-06-30 13:10:10
|
||||
* dy_uid : 109408381544
|
||||
* is_self : 1
|
||||
* content : 你们已成为好友
|
||||
*/
|
||||
|
||||
private String use_dy_uid;
|
||||
private String from_id;
|
||||
private String user_head;
|
||||
private String if_read;
|
||||
private String nick_img;
|
||||
private String to_id;
|
||||
private String message_type;
|
||||
private String id;
|
||||
private String time;
|
||||
private String dy_uid;
|
||||
private String is_self;
|
||||
private String content;
|
||||
|
||||
public String getUse_dy_uid() {
|
||||
return use_dy_uid;
|
||||
}
|
||||
|
||||
public void setUse_dy_uid(String use_dy_uid) {
|
||||
this.use_dy_uid = use_dy_uid;
|
||||
}
|
||||
|
||||
public String getFrom_id() {
|
||||
return from_id;
|
||||
}
|
||||
|
||||
public void setFrom_id(String from_id) {
|
||||
this.from_id = from_id;
|
||||
}
|
||||
|
||||
public String getUser_head() {
|
||||
return user_head;
|
||||
}
|
||||
|
||||
public void setUser_head(String user_head) {
|
||||
this.user_head = user_head;
|
||||
}
|
||||
|
||||
public String getIf_read() {
|
||||
return if_read;
|
||||
}
|
||||
|
||||
public void setIf_read(String if_read) {
|
||||
this.if_read = if_read;
|
||||
}
|
||||
|
||||
public String getNick_img() {
|
||||
return nick_img;
|
||||
}
|
||||
|
||||
public void setNick_img(String nick_img) {
|
||||
this.nick_img = nick_img;
|
||||
}
|
||||
|
||||
public String getTo_id() {
|
||||
return to_id;
|
||||
}
|
||||
|
||||
public void setTo_id(String to_id) {
|
||||
this.to_id = to_id;
|
||||
}
|
||||
|
||||
public String getMessage_type() {
|
||||
return message_type;
|
||||
}
|
||||
|
||||
public void setMessage_type(String message_type) {
|
||||
this.message_type = message_type;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getDy_uid() {
|
||||
return dy_uid;
|
||||
}
|
||||
|
||||
public void setDy_uid(String dy_uid) {
|
||||
this.dy_uid = dy_uid;
|
||||
}
|
||||
|
||||
public String getIs_self() {
|
||||
return is_self;
|
||||
}
|
||||
|
||||
public void setIs_self(String is_self) {
|
||||
this.is_self = is_self;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class QuestionsPresenterImpl extends MvpBasePresenter<QuestionsContract.V
|
||||
String input = getView().getInput();
|
||||
List<QuestionsEntity> question = new ArrayList<>();
|
||||
QuestionsEntity questionsEntity = new QuestionsEntity();
|
||||
questionsEntity.setIs_self(1);//表明是自己发送的
|
||||
questionsEntity.setIs_self("1");//表明是自己发送的
|
||||
questionsEntity.setMsg(input);//设置问题内容
|
||||
question.add(questionsEntity);
|
||||
getView().upDataAdd(question);
|
||||
|
||||
@@ -38,7 +38,8 @@ public class FindFragmenttwo extends MobanFragment {
|
||||
@Override
|
||||
public void enterCusDetail(privateListBean.ResultBean.DataBean item) {
|
||||
//进入会话页
|
||||
ShowAty.ConversationActivity(getActivity());
|
||||
ShowAty.ConversationActivity(getActivity(),item.getPrivate_id());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -69,8 +69,9 @@ public class ShowAty {
|
||||
}
|
||||
|
||||
|
||||
public static void ConversationActivity(Context ctx) {
|
||||
public static void ConversationActivity(Context ctx,String private_id) {
|
||||
Intent i = new Intent(ctx, ConversationActivity.class);
|
||||
i.putExtra("private_id",private_id);
|
||||
ctx.startActivity(i);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,17 @@ public class HttpConstants {
|
||||
* 回复评论
|
||||
*/
|
||||
public static String URi_device_AppDouyin_replyComment = URiBase + "/device/AppDouyin/replyComment";
|
||||
|
||||
/**
|
||||
* 私聊页面
|
||||
*/
|
||||
public static String URi_device_AppDouyin_privateChat = URiBase + "/device/AppDouyin/privateChat";
|
||||
|
||||
/**
|
||||
* 私聊回复
|
||||
*/
|
||||
public static String URi_device_AppDouyin_replyChat = URiBase + "/device/AppDouyin/replyChat";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user