11111
This commit is contained in:
@@ -40,8 +40,13 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.model.ResultCallback;
|
||||
import io.rong.imkit.userinfo.RongUserInfoManager;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.UserInfo;
|
||||
import okhttp3.internal.http2.ErrorCode;
|
||||
|
||||
/**
|
||||
* 聊天会话界面
|
||||
@@ -109,7 +114,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
||||
titleView.setText("系統消息");
|
||||
inputPanel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
getDraft();
|
||||
|
||||
}
|
||||
|
||||
@@ -183,6 +188,23 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取草稿箱信息系
|
||||
*/
|
||||
private void getDraft() {
|
||||
RongIMClient.getInstance().getTextMessageDraft(Conversation.ConversationType.PRIVATE, targetId, new RongIMClient.ResultCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
inputPanel.setPresetInformation(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
@@ -205,6 +227,12 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
//获取输入框信息存进输入框
|
||||
String content = inputPanel.getPresetInformation();
|
||||
if (!TextUtils.isEmpty(content)){
|
||||
IMCenter.getInstance().saveTextMessageDraft(Conversation.ConversationType.PRIVATE, targetId, content, null);
|
||||
}
|
||||
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,13 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取输入框信息
|
||||
*/
|
||||
public String getPresetInformation() {
|
||||
return editBtn.getText().toString().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 必传字段
|
||||
*
|
||||
@@ -157,7 +164,7 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
|
||||
|
||||
@Override
|
||||
public void onSuccess(Message message) {
|
||||
|
||||
IMCenter.getInstance().clearTextMessageDraft(Conversation.ConversationType.PRIVATE, targetId, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,7 +192,6 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
|
||||
inputPanelSendBtn.setBackground(getResources().getDrawable(R.mipmap.btn_sand1));
|
||||
} else {
|
||||
isSend = false;
|
||||
IMCenter.getInstance().saveTextMessageDraft(types, targetId, editBtn.getText().toString(), null);
|
||||
inputPanelSendBtn.setBackground(getResources().getDrawable(R.mipmap.btn_sand));
|
||||
}
|
||||
int offset;
|
||||
|
||||
Reference in New Issue
Block a user