【0148】【項目實戰】-【百思不得姐】-【5】基於MVP實現登陸、推薦標籤、關注

1.登錄頁面的佈局的分析

2.搭建登陸UI界面

【說明】增長了權重,等比例劃分;php

【源碼】layout/activity_login.xmljava

  1 <?xml version="1.0" encoding="utf-8"?>
  2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3     android:id="@+id/ll_login"
  4     android:orientation="vertical"
  5     android:layout_width="match_parent"
  6     android:layout_height="match_parent"
  7     android:background="@drawable/login_register_bg">
  8 
  9     <LinearLayout
 10         android:layout_width="match_parent"
 11         android:layout_height="0dp"
 12         android:layout_weight="1"
 13         android:orientation="vertical"
 14         android:paddingTop="50dp"
 15         android:paddingLeft="25dp"
 16         android:paddingRight="25dp">
 17 
 18         <EditText
 19             android:id="@+id/et_phone"
 20             android:layout_width="match_parent"
 21             android:layout_height="45dp"
 22             android:gravity="center_vertical"
 23             android:hint="@string/login_phone_text"
 24             android:textSize="@dimen/text_size_16_sp"
 25             android:textColor="@color/login_text_color"
 26             android:textColorHint="@color/login_text_color"
 27             android:background="@drawable/login_register_edit_bg"
 28             android:paddingLeft="@dimen/margin_left_10_dp"
 29             android:paddingRight="@dimen/margin_left_10_dp"
 30             android:text="Grace"/>
 31 
 32 
 33         <EditText
 34             android:id="@+id/et_password"
 35             android:layout_width="match_parent"
 36             android:layout_height="45dp"
 37             android:gravity="center_vertical"
 38             android:hint="@string/login_password_text"
 39             android:textSize="@dimen/text_size_16_sp"
 40             android:textColor="@color/login_text_color"
 41             android:textColorHint="@color/login_text_color"
 42             android:background="@drawable/login_register_psw_edit_bg"
 43             android:paddingLeft="@dimen/margin_left_10_dp"
 44             android:paddingRight="@dimen/margin_left_10_dp"
 45             android:text="1163595644"/>
 46 
 47 
 48         <Button
 49             android:id="@+id/bt_login"
 50             android:layout_width="match_parent"
 51             android:layout_height="45dp"
 52             android:background="@drawable/item_login_button_selector"
 53             android:text="@string/login_login_text"
 54             android:textSize="@dimen/text_size_16_sp"
 55             android:textColor="@android:color/white"
 56             android:layout_marginTop="@dimen/margin_left_15_dp"/>
 57 
 58         <TextView
 59             android:layout_width="match_parent"
 60             android:layout_height="wrap_content"
 61             android:text="@string/login_forget_password_text"
 62             android:textColor="@android:color/white"
 63             android:textSize="14sp"
 64             android:gravity="right"
 65             android:layout_marginTop="@dimen/margin_left_10_dp"/>
 66 
 67     </LinearLayout>
 68 
 69     <LinearLayout
 70         android:layout_width="match_parent"
 71         android:layout_height="0dp"
 72         android:layout_weight="1"
 73         android:orientation="vertical"
 74         android:gravity="bottom|center_horizontal">
 75 
 76         <LinearLayout
 77             android:layout_width="wrap_content"
 78             android:layout_height="wrap_content"
 79             android:orientation="horizontal"
 80             android:gravity="center">
 81             <ImageView
 82                 android:layout_width="0dp"
 83                 android:layout_weight="1"
 84                 android:layout_height="wrap_content"
 85                 android:background="@drawable/login_line_left"
 86                 android:layout_marginLeft="@dimen/margin_left_30_dp"/>
 87 
 88             <TextView
 89                 android:layout_width="wrap_content"
 90                 android:layout_height="wrap_content"
 91                 android:text="@string/login_quick_text"
 92                 android:textColor="@android:color/white"
 93                 android:textSize="14sp"
 94                 android:gravity="right"
 95                 android:layout_marginLeft="@dimen/margin_left_5_dp"
 96                 android:layout_marginRight="@dimen/margin_left_5_dp"/>
 97 
 98             <ImageView
 99                 android:layout_width="0dp"
100                 android:layout_weight="1"
101                 android:layout_height="wrap_content"
102                 android:background="@drawable/login_line_right"
103                 android:layout_marginRight="@dimen/margin_left_30_dp"/>
104         </LinearLayout>
105 
106         <LinearLayout
107             android:layout_width="match_parent"
108             android:layout_height="wrap_content"
109             android:layout_marginBottom="@dimen/margin_left_30_dp"
110             android:layout_marginTop="@dimen/margin_left_10_dp"
111             android:orientation="horizontal">
112 
113             <LinearLayout
114                 android:layout_width="0dp"
115                 android:layout_height="wrap_content"
116                 android:layout_weight="1"
117                 android:orientation="vertical"
118                 android:gravity="center">
119                 <Button
120                     android:id="@+id/bt_login_qq"
121                     android:layout_width="@dimen/login_register_button_size"
122                     android:layout_height="@dimen/login_register_button_size"
123                     android:background="@drawable/login_register_qq_selector"
124                     android:layout_alignParentLeft="true"
125                     />
126 
127                 <TextView
128                     android:layout_width="wrap_content"
129                     android:layout_height="wrap_content"
130                     android:textColor="@android:color/white"
131                     android:textSize="@dimen/text_size_12_sp"
132                     android:text="@string/login_qq_text"
133                     android:layout_marginTop="@dimen/margin_left_5_dp"/>
134 
135             </LinearLayout>
136 
137             <LinearLayout
138                 android:layout_width="0dp"
139                 android:layout_height="wrap_content"
140                 android:layout_weight="1"
141                 android:orientation="vertical"
142                 android:gravity="center">
143                 <Button
144                     android:id="@+id/bt_login_sina"
145                     android:layout_width="@dimen/login_register_button_size"
146                     android:layout_height="@dimen/login_register_button_size"
147                     android:background="@drawable/login_register_sina_selector"
148                     android:layout_centerHorizontal="true"/>
149 
150                 <TextView
151                     android:layout_width="wrap_content"
152                     android:layout_height="wrap_content"
153                     android:textColor="@android:color/white"
154                     android:textSize="@dimen/text_size_12_sp"
155                     android:text="@string/login_sina_text"
156                     android:layout_marginTop="@dimen/margin_left_5_dp"/>
157 
158             </LinearLayout>
159 
160 
161             <LinearLayout
162                 android:layout_width="0dp"
163                 android:layout_height="wrap_content"
164                 android:layout_weight="1"
165                 android:orientation="vertical"
166                 android:gravity="center">
167                 <Button
168                     android:id="@+id/bt_login_tencent"
169                     android:layout_width="@dimen/login_register_button_size"
170                     android:layout_height="@dimen/login_register_button_size"
171                     android:background="@drawable/login_register_tencent_selector"
172                     android:layout_alignParentRight="true"/>
173 
174                 <TextView
175                     android:layout_width="wrap_content"
176                     android:layout_height="wrap_content"
177                     android:textColor="@android:color/white"
178                     android:textSize="@dimen/text_size_12_sp"
179                     android:text="@string/login_tencent_text"
180                     android:layout_marginTop="@dimen/margin_left_5_dp"/>
181 
182             </LinearLayout>
183 
184 
185 
186         </LinearLayout>
187 
188     </LinearLayout>
189 
190 </LinearLayout>

 

 【ToolBar源碼】android

 

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="50dp"
 5     android:orientation="horizontal">
 6 
 7     <LinearLayout
 8         android:layout_width="0dp"
 9         android:layout_weight="1"
10         android:layout_height="match_parent"
11         android:orientation="horizontal"
12         android:gravity="center_vertical">
13         <ImageView
14             android:id="@+id/iv_left"
15             android:layout_width="20dp"
16             android:layout_height="20dp"
17             android:layout_marginLeft="@dimen/margin_left_12_dp"/>
18     </LinearLayout>
19 
20     <LinearLayout
21         android:layout_width="0dp"
22         android:layout_weight="2"
23         android:layout_height="match_parent"
24         android:orientation="horizontal"
25         android:gravity="center">
26 
27     </LinearLayout>
28 
29     <LinearLayout
30         android:layout_width="0dp"
31         android:layout_weight="1"
32         android:layout_height="match_parent"
33         android:orientation="horizontal"
34         android:gravity="center_vertical|right">
35 
36         <TextView
37             android:id="@+id/tv_title"
38             android:layout_width="wrap_content"
39             android:layout_height="wrap_content"
40             android:textSize="@dimen/text_size_16_sp"
41             android:textColor="@android:color/white"
42             android:layout_marginRight="@dimen/margin_left_12_dp"/>
43 
44     </LinearLayout>
45 
46 </LinearLayout>

3.登陸功能實現

3.1 登錄界面的MVP框架的搭建

【View】json

【Presenter】api

【model】數組

 

3.2 綁定代理

3.3 初始化佈局

 

【傳遞一個model】網絡

 

【登陸功能的實現】app

 

【代理對數據的解析】框架

 

 【爲mine界面增長條目】ide

【說明】使用建造者模式

【mineFragment中添加item】

 

 【測試】當前能夠進行測試,可是缺乏了ToolBar關閉界面;

【增長ToolBar】

 

4. 實現關注中的登錄頁

4.1 框架的搭建 

 

【效果】

4.2 關注功能的實現

 【佈局】

 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 2     xmlns:app="http://schemas.android.com/apk/res-auto"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     android:background="@android:color/white"
 6     android:clickable="true">
 7 
 8 
 9 
10     
11     <ImageView
12         android:id="@+id/iv_album"
13         android:layout_width="wrap_content"
14         android:layout_height="wrap_content"
15         android:src="@drawable/attention_album"
16         android:layout_centerInParent="true"/>
17 
18 
19     <ImageView
20         android:id="@+id/iv_post_copyright"
21         android:layout_width="240dp"
22         android:layout_height="24dp"
23         android:src="@drawable/attention_post_copyright"
24         android:layout_marginTop="@dimen/margin_left_30_dp"
25         android:layout_above="@+id/iv_album"
26         android:layout_centerHorizontal="true"
27         android:layout_marginBottom="@dimen/margin_left_30_dp"/>
28 
29     <LinearLayout
30         android:layout_width="wrap_content"
31         android:layout_height="wrap_content"
32         android:orientation="horizontal"
33         android:layout_centerHorizontal="true"
34         android:layout_below="@+id/iv_album"
35         android:layout_marginTop="@dimen/margin_left_30_dp">
36         <Button
37             android:id="@+id/bt_login"
38             android:layout_width="125dp"
39             android:layout_height="45dp"
40             android:background="@drawable/item_login_button_selector"
41             android:text="@string/login_login_text"
42             android:textSize="@dimen/text_size_16_sp"
43             android:textColor="@android:color/white"
44             android:layout_marginTop="@dimen/margin_left_15_dp"/>
45 
46         <Button
47             android:id="@+id/bt_register"
48             android:layout_width="125dp"
49             android:layout_height="45dp"
50             android:background="@drawable/item_login_button_selector"
51             android:text="@string/login_attention_register_text"
52             android:textSize="@dimen/text_size_16_sp"
53             android:textColor="@android:color/white"
54             android:layout_marginTop="@dimen/margin_left_15_dp"
55             android:layout_marginLeft="@dimen/margin_left_15_dp"/>
56 
57 
58     </LinearLayout>
59 
60 
61 </RelativeLayout>

 【bug】關注的頁面直接覆蓋了全屏,存在bug,Viewpager的佈局須要改成Frame佈局;

 

 5.實現訂閱列表

 

5.1 item的佈局實現

【源碼】layout/item_attention_layout.xml

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     xmlns:circle="http://schemas.android.com/apk/res/com.tz.dream.budejie"
 4     android:orientation="horizontal"
 5     android:layout_width="match_parent"
 6     android:layout_height="55dp"
 7     android:gravity="center_vertical"
 8     android:paddingLeft="@dimen/margin_left_12_dp"
 9     android:paddingRight="@dimen/margin_left_12_dp">
10 
11     <com.tz.dream.budejie.pro.essence.view.views.CircleNetworkImageImage
12         android:id="@+id/iv_header"
13         android:layout_width="40dp"
14         android:layout_height="40dp"
15         android:layout_marginLeft="@dimen/margin_left_12_dp"
16         circle:civ_border_width="1dp"
17         circle:civ_border_color="@android:color/transparent"
18         circle:civ_border_overlay="true"
19         circle:civ_fill_color="@android:color/transparent"
20         android:src="@drawable/item_essence_header_default"/>
21 
22     <LinearLayout
23         android:layout_width="0dip"
24         android:layout_height="wrap_content"
25         android:layout_weight="1"
26         android:orientation="vertical"
27         android:layout_marginLeft="@dimen/margin_left_10_dp">
28         <TextView
29             android:id="@+id/tv_name"
30             android:layout_width="wrap_content"
31             android:layout_height="wrap_content"
32             android:text="自拍"
33             android:textSize="@dimen/text_size_16_sp"/>
34 
35         <TextView
36             android:id="@+id/tv_attention_count"
37             android:layout_width="wrap_content"
38             android:layout_height="wrap_content"
39             android:textSize="@dimen/text_size_14_sp"
40             android:text="2.0萬訂閱量"
41             android:layout_marginTop="@dimen/margin_left_2_dp"/>
42     </LinearLayout>
43 
44     <Button
45         android:id="@+id/bt_attention"
46         android:layout_width="65dp"
47         android:layout_height="30dp"
48         android:text="+ 訂閱"
49         android:textColor="@color/essence_tab_text_color_press"
50         android:background="@drawable/attention_list_normal"/>
51 
52 </LinearLayout>

 【適配器的書寫】com.tz.dream.budejie.pro.attention.view.adapter.AttentionSubscriptionAdapter

 1 package com.tz.dream.budejie.pro.attention.view.adapter;
 2 
 3 import android.content.Context;
 4 import android.view.LayoutInflater;
 5 import android.view.View;
 6 import android.view.ViewGroup;
 7 import android.widget.BaseAdapter;
 8 import android.widget.Button;
 9 import android.widget.TextView;
10 
11 import com.tz.dream.budejie.R;
12 import com.tz.dream.budejie.bean.AttentionSubscriptionBean;
13 import com.tz.dream.budejie.pro.essence.view.views.CircleNetworkImageImage;
14 import com.tz.dream.budejie.utils.VolleyUtils;
15 
16 import java.util.List;
17 
18 
19 public class AttentionSubscriptionAdapter extends BaseAdapter {
20 
21     private Context context;
22     private List<AttentionSubscriptionBean> subscriptionList;
23 
24     public AttentionSubscriptionAdapter(Context context,List<AttentionSubscriptionBean> subscriptionList){
25         this.context = context;
26         this.subscriptionList = subscriptionList;
27     }
28 
29     @Override
30     public int getCount() {
31         return subscriptionList.size();
32     }
33 
34     @Override
35     public Object getItem(int position) {
36         return subscriptionList.get(position);
37     }
38 
39     @Override
40     public long getItemId(int position) {
41         return position;
42     }
43 
44     @Override
45     public View getView(int position, View convertView, ViewGroup parent) {
46         ViewHolder viewHolder = null;
47         if (convertView == null){
48             convertView = LayoutInflater.from(context).inflate(R.layout.item_attention_layout,parent,false);
49             viewHolder = new ViewHolder();
50             viewHolder.iv_header = (CircleNetworkImageImage)convertView.findViewById(R.id.iv_header);
51             viewHolder.tv_name = (TextView) convertView.findViewById(R.id.tv_name);
52             viewHolder.tv_attention_count = (TextView) convertView.findViewById(R.id.tv_attention_count);
53             viewHolder.bt_attention = (Button) convertView.findViewById(R.id.bt_attention);
54             convertView.setTag(viewHolder);
55         }else {
56             viewHolder = (ViewHolder) convertView.getTag();
57         }
58         AttentionSubscriptionBean bean = subscriptionList.get(position);
59         VolleyUtils.loadImage(context,viewHolder.iv_header,bean.getImage_list());
60 
61         viewHolder.tv_name.setText(bean.getTheme_name());
62         viewHolder.tv_attention_count.setText(bean.getSub_number());
63         return convertView;
64     }
65 
66     class ViewHolder{
67         public CircleNetworkImageImage iv_header;
68         public TextView tv_name;
69         public TextView tv_attention_count;
70         public Button bt_attention;
71     }
72 
73 }

 【源碼】主佈局中放的是幀佈局

 1 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
 2     xmlns:app="http://schemas.android.com/apk/res-auto"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     android:background="@android:color/white"
 6     android:clickable="true">
 7 
 8     <ListView
 9         android:id="@+id/lv_attention"
10         android:layout_width="match_parent"
11         android:layout_height="match_parent"
12         android:cacheColorHint="@android:color/transparent"/>
13 
14 </FrameLayout>

【對訂閱列表中的數據的填充和功能的實現】

 1 package com.tz.dream.budejie.pro.attention.view;
 2 
 3 import android.view.View;
 4 import android.widget.ListView;
 5 
 6 import com.tz.dream.budejie.R;
 7 import com.tz.dream.budejie.bean.AttentionSubscriptionBean;
 8 import com.tz.dream.budejie.pro.attention.presenter.AttentionSubscriptionPresenter;
 9 import com.tz.dream.budejie.pro.attention.view.adapter.AttentionSubscriptionAdapter;
10 import com.tz.dream.budejie.pro.base.presenter.BasePresenter;
11 import com.tz.dream.budejie.pro.base.view.BaseFragment;
12 
13 import java.util.ArrayList;
14 import java.util.List;
15 
16 
17 /**
18  * 訂閱列表
19  * Created by Dream on 16/5/29.
20  */
21 public class AttentionSubscriptionFragment extends BaseFragment<AttentionSubscriptionPresenter>{
22 
23     private int mType = 0;
24     private String mTitle;
25 
26     private AttentionSubscriptionAdapter subscriptionAdapter;
27     private List<AttentionSubscriptionBean> subscriptionBeanList = new ArrayList<>();
28 
29     @Override
30     public AttentionSubscriptionPresenter bindPresenter() {
31         return new AttentionSubscriptionPresenter(getContext());
32     }
33 
34     public void setType(int mType) {
35         this.mType = mType;
36     }
37 
38     public void setTitle(String mTitle) {
39         this.mTitle = mTitle;
40     }
41 
42     @Override
43     public int getContentView() {
44         return R.layout.fragment_attention_subscription;
45     }
46 
47     @Override
48     public void initContentView(View contentView) {
49         ListView lv_attention = (ListView) contentView.findViewById(R.id.lv_attention);
50         subscriptionAdapter = new AttentionSubscriptionAdapter(getContext(),subscriptionBeanList);
51         lv_attention.setAdapter(subscriptionAdapter);
52     }
53 
54     @Override
55     public void initData() {
56         loadData(1);
57     }
58 
59     private void loadData(int mType){
60         getPresenter().getAttentionSubscriptionList(mType, new BasePresenter.OnUIThreadListener<List<AttentionSubscriptionBean>>() {
61             @Override
62             public void onResult(List<AttentionSubscriptionBean> result) {
63                 if (result != null){
64                     //刷新適配器
65                     subscriptionBeanList.addAll(result);
66                     subscriptionAdapter.notifyDataSetChanged();
67                 }
68             }
69         });
70     }
71 
72 }

5.2 對數據的處理model

【使用json對數組的處理】

 1 package com.tz.dream.budejie.utils;
 2 
 3 import com.google.gson.Gson;
 4 import com.google.gson.JsonElement;
 5 import com.google.gson.JsonParser;
 6 
 7 import java.util.ArrayList;
 8 import java.util.Iterator;
 9 import java.util.List;
10 
11 public class GsonUtils<T> {
12 
13     //兩種方案
14     //第一種:方法泛型
15     //第二種:類泛型
16 
17     //方法泛型使用補充
18     public ArrayList<T> parseArray(String result,Class<?> clazz){
19         ArrayList<T> list = new ArrayList<T>();
20 
21         return null;
22     }
23 
24     public static  <T> List<T> getList(String result, Class<T> clazz){
25         List<T> list = new ArrayList<T>();
26         Gson gson = new Gson();
27         JsonParser parser = new JsonParser();
28         JsonElement el = parser.parse(result);
29         Iterator it = el.getAsJsonArray().iterator();
30         while(it.hasNext()){
31             JsonElement e = (JsonElement)it.next();
32             T model = gson.fromJson(e, clazz);
33             list.add(model);
34         }
35         return list;
36     }
37 
38 }

 

【對數據的解析】

【bean數據的封裝】

 1 package com.tz.dream.budejie.bean;
 2 
 3 import com.google.gson.Gson;
 4 import com.google.gson.JsonArray;
 5 
 6 import org.json.JSONArray;
 7 import org.json.JSONException;
 8 
 9 import java.util.List;
10 
11 /**
12  * Created by Dream on 16/5/29.
13  */
14 public class AttentionSubscriptionBean {
15 
16     private String theme_id;
17     private String theme_name;
18     private String image_list;
19     private String sub_number;
20     private int is_sub;
21     private int is_default;
22 
23     public String getTheme_id() {
24         return theme_id;
25     }
26 
27     public void setTheme_id(String theme_id) {
28         this.theme_id = theme_id;
29     }
30 
31     public String getTheme_name() {
32         return theme_name;
33     }
34 
35     public void setTheme_name(String theme_name) {
36         this.theme_name = theme_name;
37     }
38 
39     public String getImage_list() {
40         return image_list;
41     }
42 
43     public void setImage_list(String image_list) {
44         this.image_list = image_list;
45     }
46 
47     public String getSub_number() {
48         return sub_number;
49     }
50 
51     public void setSub_number(String sub_number) {
52         this.sub_number = sub_number;
53     }
54 
55     public int getIs_sub() {
56         return is_sub;
57     }
58 
59     public void setIs_sub(int is_sub) {
60         this.is_sub = is_sub;
61     }
62 
63     public int getIs_default() {
64         return is_default;
65     }
66 
67     public void setIs_default(int is_default) {
68         this.is_default = is_default;
69     }
70 
71 }

 

【數據的處理】網絡請求

 1 package com.tz.dream.budejie.pro.attention.model;
 2 
 3 import android.content.Context;
 4 
 5 import com.tz.dream.budejie.http.impl.RequestParam;
 6 import com.tz.dream.budejie.http.impl.SystemHttpCommand;
 7 import com.tz.dream.budejie.http.utils.HttpTask;
 8 import com.tz.dream.budejie.http.utils.HttpUtils;
 9 import com.tz.dream.budejie.pro.base.model.BaseModel;
10 
11 public class AttentionSubscriptionModel extends BaseModel{
12 
13     private static final String URL_STR = "/api/api_open.php";
14 
15     public AttentionSubscriptionModel(Context context) {
16         super(context);
17     }
18 
19     public void getAttentionSubscriptionList(int type, HttpUtils.OnHttpResultListener onHttpResultListener){
20         RequestParam requestParam = new RequestParam();
21         requestParam.put("a","tag_recommend");
22         requestParam.put("action","sub");
23         requestParam.put("c","topic");
24         requestParam.put("type",type);
25 
26         HttpTask httpTask = new HttpTask(getServerUrl().concat(URL_STR),requestParam,new SystemHttpCommand(),onHttpResultListener);
27         httpTask.execute();
28 
29     }
30 
31 }

 

5.3 代理 

 1 package com.tz.dream.budejie.pro.attention.presenter;
 2 
 3 import android.content.Context;
 4 import android.text.TextUtils;
 5 
 6 import com.tz.dream.budejie.bean.AttentionSubscriptionBean;
 7 import com.tz.dream.budejie.http.utils.HttpUtils;
 8 import com.tz.dream.budejie.pro.attention.model.AttentionSubscriptionModel;
 9 import com.tz.dream.budejie.pro.base.presenter.BasePresenter;
10 import com.tz.dream.budejie.utils.GsonUtils;
11 
12 import java.util.List;
13 
14 
15 public class AttentionSubscriptionPresenter extends BasePresenter<AttentionSubscriptionModel>{
16 
17     public AttentionSubscriptionPresenter(Context context) {
18         super(context);
19     }
20 
21     @Override
22     public AttentionSubscriptionModel bindModel() {
23         return new AttentionSubscriptionModel(getContext());
24     }
25 
26     public void getAttentionSubscriptionList(int type, final OnUIThreadListener<List<AttentionSubscriptionBean>> onUIThreadListener){
27         getModel().getAttentionSubscriptionList(type, new HttpUtils.OnHttpResultListener() {
28             @Override
29             public void onResult(String result) {
30                 if (TextUtils.isEmpty(result)){
31                     onUIThreadListener.onResult(null);
32                 }else {
33                     List<AttentionSubscriptionBean> list = GsonUtils.getList(result,AttentionSubscriptionBean.class);
34                     onUIThreadListener.onResult(list);
35                 }
36             }
37         });
38     }
39 
40 }
相關文章
相關標籤/搜索