Conflicts:
	app/src/main/java/com/gh/common/util/LibaoUtils.java
This commit is contained in:
huangzhuanghua
2016-12-30 09:24:11 +08:00
29 changed files with 956 additions and 84 deletions

View File

@ -35,6 +35,7 @@ import com.gh.gamecenter.adapter.MessageDetailAdapter;
import com.gh.gamecenter.db.CommentDao;
import com.gh.gamecenter.db.info.CommentInfo;
import com.gh.gamecenter.entity.CommentEntity;
import com.gh.gamecenter.entity.CommentnumEntity;
import com.gh.gamecenter.entity.ConcernEntity;
import com.gh.gamecenter.entity.ViewsEntity;
import com.gh.gamecenter.manager.CommentManager;
@ -199,6 +200,30 @@ public class MessageDetailActivity extends BaseActivity implements MessageDetail
}
}
public void getCommentNum() {
RetrofitManager.getComment()
.getNewsCommentnum(newsId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new com.gh.gamecenter.retrofit.Response<List<CommentnumEntity>>(){
@Override
public void onNext(List<CommentnumEntity> response) {
super.onNext(response);
if (response.size() > 0) {
if (!TextUtils.isEmpty(mConcernEntity.getId())){
commentNum = response.get(0).getNum();
mConcernEntity.setCommentnum(commentNum);
adapter.notifyItemChanged(0);
if (commentNum == 0) {
setSoftInput(true);
}
}
}
}
});
}
private void getConcernDigest() {
RetrofitManager.getApi().getNewsRichDigest(newsId)
.subscribeOn(Schedulers.io())
@ -207,7 +232,11 @@ public class MessageDetailActivity extends BaseActivity implements MessageDetail
@Override
public void onResponse(ConcernEntity response) {
mConcernEntity = response;
mConcernEntity.setCommentnum(commentNum);
if (commentNum == -1) {
getCommentNum();
} else {
mConcernEntity.setCommentnum(commentNum);
}
adapter.addConcernEntity(mConcernEntity);
adapter.notifyDataSetChanged();