|
@@ -2,15 +2,22 @@ package com.ynstkz.shitu.android.activity;
|
|
|
|
|
|
import android.os.Bundle;
|
|
|
import android.support.annotation.Nullable;
|
|
|
+import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
+import com.common.library.okhttp.callback.Callback;
|
|
|
import com.common.library.pulltorefresh.PullToRefreshListView;
|
|
|
+import com.google.gson.Gson;
|
|
|
import com.ynstkz.shitu.android.R;
|
|
|
import com.ynstkz.shitu.android.base.TitleBarActivity;
|
|
|
+import com.ynstkz.shitu.android.bean.MessageListBean;
|
|
|
+import com.ynstkz.shitu.android.data.RequestGroup;
|
|
|
|
|
|
import butterknife.Bind;
|
|
|
+import okhttp3.Call;
|
|
|
+import okhttp3.Response;
|
|
|
|
|
|
/**
|
|
|
* 作者:fuchangle on 2018/2/23 10:41
|
|
@@ -24,6 +31,12 @@ public class MessageListActivity extends TitleBarActivity {
|
|
|
RelativeLayout viewTitle;
|
|
|
@Bind(R.id.pullToRefresh)
|
|
|
PullToRefreshListView pullToRefresh;
|
|
|
+ @Bind(R.id.iv_nodata_icon)
|
|
|
+ ImageView ivNodataIcon;
|
|
|
+ @Bind(R.id.tv_nodata_lab)
|
|
|
+ TextView tvNodataLab;
|
|
|
+ @Bind(R.id.rl_nodata)
|
|
|
+ RelativeLayout rlNodata;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
@@ -38,15 +51,53 @@ public class MessageListActivity extends TitleBarActivity {
|
|
|
return R.layout.activity_message_list;
|
|
|
}
|
|
|
|
|
|
- private void initView(){
|
|
|
+ private void initView() {
|
|
|
tvTitle.setText("系统通知");
|
|
|
}
|
|
|
|
|
|
- private void initData(){
|
|
|
+ private void initData() {
|
|
|
+ getMessageList();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setListener() {
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void setListener(){
|
|
|
+ /**
|
|
|
+ * 获取通知列表
|
|
|
+ */
|
|
|
+ private void getMessageList() {
|
|
|
+
|
|
|
+ RequestGroup.getMessageList(new Callback() {
|
|
|
+ @Override
|
|
|
+ public Object parseNetworkResponse(Response response, int id) throws Exception {
|
|
|
+ return new Gson().fromJson(response.body().string(), MessageListBean.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(Call call, Exception e, int id) {
|
|
|
+ showNoData();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object response, int id) {
|
|
|
+ MessageListBean bean = (MessageListBean)response;
|
|
|
+ if(bean != null){
|
|
|
+
|
|
|
+ } else {
|
|
|
+ showNoData();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 显示无数据
|
|
|
+ */
|
|
|
+ private void showNoData(){
|
|
|
+ pullToRefresh.setVisibility(View.GONE);
|
|
|
+ rlNodata.setVisibility(View.VISIBLE);
|
|
|
+ ivNodataIcon.setImageResource(R.drawable.nodata_msg);
|
|
|
+ tvNodataLab.setText(getString(R.string.nodata_msg));
|
|
|
}
|
|
|
}
|