|
@@ -2,6 +2,8 @@ package com.ynstkz.shitu.android.activity;
|
|
|
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.support.annotation.Nullable;
|
|
import android.support.annotation.Nullable;
|
|
|
|
+import android.view.View;
|
|
|
|
+import android.widget.ImageView;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
@@ -9,10 +11,14 @@ import com.common.library.okhttp.callback.Callback;
|
|
import com.common.library.pulltorefresh.PullToRefreshListView;
|
|
import com.common.library.pulltorefresh.PullToRefreshListView;
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
import com.ynstkz.shitu.android.R;
|
|
import com.ynstkz.shitu.android.R;
|
|
|
|
+import com.ynstkz.shitu.android.adapter.MineCommentItemAdapter;
|
|
import com.ynstkz.shitu.android.base.TitleBarActivity;
|
|
import com.ynstkz.shitu.android.base.TitleBarActivity;
|
|
import com.ynstkz.shitu.android.bean.MyCommnetBean;
|
|
import com.ynstkz.shitu.android.bean.MyCommnetBean;
|
|
import com.ynstkz.shitu.android.data.RequestGroup;
|
|
import com.ynstkz.shitu.android.data.RequestGroup;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
import butterknife.Bind;
|
|
import butterknife.Bind;
|
|
import okhttp3.Call;
|
|
import okhttp3.Call;
|
|
import okhttp3.Response;
|
|
import okhttp3.Response;
|
|
@@ -29,6 +35,18 @@ public class MineCommentActivity extends TitleBarActivity {
|
|
RelativeLayout viewTitle;
|
|
RelativeLayout viewTitle;
|
|
@Bind(R.id.pullToRefresh)
|
|
@Bind(R.id.pullToRefresh)
|
|
PullToRefreshListView pullToRefresh;
|
|
PullToRefreshListView pullToRefresh;
|
|
|
|
+ @Bind(R.id.rl_nodata)
|
|
|
|
+ RelativeLayout rlNodata;
|
|
|
|
+ @Bind(R.id.iv_back)
|
|
|
|
+ ImageView ivBack;
|
|
|
|
+ @Bind(R.id.iv_nodata_icon)
|
|
|
|
+ ImageView ivNodataIcon;
|
|
|
|
+ @Bind(R.id.tv_nodata_lab)
|
|
|
|
+ TextView tvNodataLab;
|
|
|
|
+
|
|
|
|
+ private int pageNumber;
|
|
|
|
+ private List<OrgCommentItemBean> listOrgComments;
|
|
|
|
+ private MineCommentItemAdapter mineCommentItemAdapter;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
@@ -50,6 +68,7 @@ public class MineCommentActivity extends TitleBarActivity {
|
|
|
|
|
|
private void initData() {
|
|
private void initData() {
|
|
|
|
|
|
|
|
+ pageNumber = 1;
|
|
getMyCommnet();
|
|
getMyCommnet();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -62,7 +81,7 @@ public class MineCommentActivity extends TitleBarActivity {
|
|
*/
|
|
*/
|
|
private void getMyCommnet() {
|
|
private void getMyCommnet() {
|
|
|
|
|
|
- RequestGroup.getMyCommentList(new Callback() {
|
|
+ RequestGroup.getMyCommentList(pageNumber + "", new Callback() {
|
|
@Override
|
|
@Override
|
|
public Object parseNetworkResponse(Response response, int id) throws Exception {
|
|
public Object parseNetworkResponse(Response response, int id) throws Exception {
|
|
return new Gson().fromJson(response.body().string(), MyCommnetBean.class);
|
|
return new Gson().fromJson(response.body().string(), MyCommnetBean.class);
|
|
@@ -75,10 +94,30 @@ public class MineCommentActivity extends TitleBarActivity {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onResponse(Object response, int id) {
|
|
public void onResponse(Object response, int id) {
|
|
- MyCommnetBean myCommnetBean = (MyCommnetBean)response;
|
|
+ MyCommnetBean myCommnetBean = (MyCommnetBean) response;
|
|
- if(myCommnetBean != null){
|
|
+ if (myCommnetBean != null) {
|
|
- if("200".equals(myCommnetBean.getCode())){
|
|
+ if ("200".equals(myCommnetBean.getCode())) {
|
|
-
|
|
+ if (myCommnetBean.getData() != null) {
|
|
|
|
+ if (myCommnetBean.getData().getEvaluateList() != null && myCommnetBean.getData().getEvaluateList().size() > 0) {
|
|
|
|
+ if (pageNumber == 1) {
|
|
|
|
+ if (listOrgComments == null) {
|
|
|
|
+ listOrgComments = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ listOrgComments.clear();
|
|
|
|
+ listOrgComments.addAll(myCommnetBean.getData().getEvaluateList());
|
|
|
|
+ mineCommentItemAdapter = new MineCommentItemAdapter(MineCommentActivity.this, listOrgComments);
|
|
|
|
+ pullToRefresh.setAdapter(mineCommentItemAdapter);
|
|
|
|
+ mineCommentItemAdapter.notifyDataSetChanged();
|
|
|
|
+ } else {
|
|
|
|
+ listOrgComments.addAll(myCommnetBean.getData().getEvaluateList());
|
|
|
|
+ mineCommentItemAdapter.notifyDataSetChanged();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ showNoData();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ showNoData();
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
showToast(myCommnetBean.getMsg());
|
|
showToast(myCommnetBean.getMsg());
|
|
}
|
|
}
|
|
@@ -86,4 +125,14 @@ public class MineCommentActivity extends TitleBarActivity {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ * 显示无数据
|
|
|
|
+ */
|
|
|
|
+ private void showNoData() {
|
|
|
|
+ pullToRefresh.setVisibility(View.GONE);
|
|
|
|
+ rlNodata.setVisibility(View.VISIBLE);
|
|
|
|
+ ivNodataIcon.setImageResource(R.drawable.nodata_common);
|
|
|
|
+ tvNodataLab.setText(getString(R.string.nodata_comment));
|
|
|
|
+ }
|
|
}
|
|
}
|