回放问答
获取问答数据
com.talkfun.sdk.module.QuestionEntity
问答信息
@参数说明:
参数 | 类型 | 描述 |
---|---|---|
id | String | 问答ID |
xid | String | 用户唯一ID |
uid | String | 合作方用户ID |
replyId | String | 回复的问题ID |
role | String | 角色 |
content | String | 内容 |
nickname | String | 昵称 |
answerList | List |
回复列表 |
isAnswer | boolean | 是否为回复 |
isHasAnswer | boolean | 是否有回复 |
time | String | 时间戳 |
调用示例:
List<QuestionEntity> list = PlaybackDataManage.getInstance().getRawQuestionList();
设置回放问答获取数据监听
调用示例:
PlaybackDataManage.getInstance().setQuestionListener(new HtDispatchPlaybackMsgListener() {
@Override
public void getPlaybackMsgSuccess(int position) {
//更新数据
setQuestionList(PlaybackDataManage.getInstance().getRawQuestionList());
if (position < questionMsgList.size()) {
questionLv.setSelection(position);
}
else {
questionLv.setSelection(questionMsgList.size() - 1);
}
}
@Override
public void getPlaybackMsgFail(String error) {
//更新数据失败
}
});
上拉加载更多问答数据
调用示例:
PlaybackDataManage.getInstance().loadDownMoreData(PlaybackDataManage.DataType.QUESTION);
下拉加载更多问答数据
调用示例:
PlaybackDataManage.getInstance().loadDownMoreData(PlaybackDataManage.DataType.QUESTION);
自动滚动跟随
调用示例:
AutoScrollListener autoScrollListener = new AutoScrollListener() {
@Override
public void scrollToItem(int pos) {
if (isShow && chatAdapter != null) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() { setQuestionList(PlaybackDataManage.getInstance().getRawQuestionList());
if (pos < questionMsgList.size()) {
questionLv.setSelection(pos);
}
else {
questionLv.setSelection(questionMsgList.size() - 1);
}
}
});
}
}
};
PlaybackDataManage.getInstance().startAutoScroll(autoScrollListener, PlaybackDataManage.DataType.QUESTION);
停止滚动跟随
调用示例:
PlaybackDataManage.getInstance().stopAutoScroll();