|
@@ -2,19 +2,49 @@ 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.MyCollectBean;
|
|
|
+import com.ynstkz.shitu.android.data.RequestGroup;
|
|
|
+
|
|
|
+import butterknife.Bind;
|
|
|
+import okhttp3.Call;
|
|
|
+import okhttp3.Response;
|
|
|
|
|
|
/**
|
|
|
+ * 我的收藏
|
|
|
* 作者:fuchangle on 2018/2/11 15:36
|
|
|
*/
|
|
|
|
|
|
-public class MineCollectActivity extends TitleBarActivity{
|
|
|
+public class MineCollectActivity extends TitleBarActivity {
|
|
|
+
|
|
|
+ @Bind(R.id.tv_all)
|
|
|
+ TextView tvAll;
|
|
|
+ @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;
|
|
|
+ @Bind(R.id.tv_title)
|
|
|
+ TextView tvTitle;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
+ initView();
|
|
|
+ initData();
|
|
|
+ setListener();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -23,4 +53,55 @@ public class MineCollectActivity extends TitleBarActivity{
|
|
|
}
|
|
|
|
|
|
|
|
|
+ private void initView() {
|
|
|
+ tvTitle.setText("我的收藏");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initData() {
|
|
|
+
|
|
|
+ getMyCollectList();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setListener() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取我的收藏列表
|
|
|
+ */
|
|
|
+ private void getMyCollectList() {
|
|
|
+
|
|
|
+ RequestGroup.getMyCollectList(new Callback() {
|
|
|
+ @Override
|
|
|
+ public Object parseNetworkResponse(Response response, int id) throws Exception {
|
|
|
+ return new Gson().fromJson(response.body().string(), MyCollectBean.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(Call call, Exception e, int id) {
|
|
|
+ showToast(getString(R.string.error_msg));
|
|
|
+ showNoData();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object response, int id) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onResume() {
|
|
|
+ super.onResume();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 显示无数据
|
|
|
+ */
|
|
|
+ private void showNoData() {
|
|
|
+ pullToRefresh.setVisibility(View.GONE);
|
|
|
+ rlNodata.setVisibility(View.VISIBLE);
|
|
|
+ ivNodataIcon.setImageResource(R.drawable.nodata_collect);
|
|
|
+ tvNodataLab.setText(getString(R.string.nodata_collect));
|
|
|
+ }
|
|
|
}
|