Commit 8c6d07edf896949af0a5d80d3b077e2c545b77d2
1 parent
26d17696
Exists in
yxb_dev
and in
2 other branches
no message
Showing
17 changed files
with
510 additions
and
76 deletions
Show diff stats
app/src/main/AndroidManifest.xml
@@ -64,17 +64,17 @@ | @@ -64,17 +64,17 @@ | ||
64 | android:name="com.amap.api.v2.apikey" | 64 | android:name="com.amap.api.v2.apikey" |
65 | android:value="1d130afb822d8a1019e6592cbaf10bcc" /> | 65 | android:value="1d130afb822d8a1019e6592cbaf10bcc" /> |
66 | 66 | ||
67 | - <activity android:name=".ui.MainActivity"> | 67 | + <activity android:name=".ui.activity.LoginAndRegistActivity"> |
68 | <intent-filter> | 68 | <intent-filter> |
69 | <action android:name="android.intent.action.MAIN" /> | 69 | <action android:name="android.intent.action.MAIN" /> |
70 | 70 | ||
71 | <category android:name="android.intent.category.LAUNCHER" /> | 71 | <category android:name="android.intent.category.LAUNCHER" /> |
72 | </intent-filter> | 72 | </intent-filter> |
73 | </activity> | 73 | </activity> |
74 | - <!--<activity--> | ||
75 | - <!--android:name=".ui.MainActivity"--> | ||
76 | - <!--android:screenOrientation="portrait"--> | ||
77 | - <!--android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />--> | 74 | + <activity |
75 | + android:name=".ui.MainActivity" | ||
76 | + android:screenOrientation="portrait" | ||
77 | + android:windowSoftInputMode="adjustPan|stateAlwaysHidden" /> | ||
78 | <activity | 78 | <activity |
79 | android:name=".ui.activity.MyChildActivity" | 79 | android:name=".ui.activity.MyChildActivity" |
80 | android:screenOrientation="portrait" /> | 80 | android:screenOrientation="portrait" /> |
@@ -94,9 +94,9 @@ | @@ -94,9 +94,9 @@ | ||
94 | android:name=".ui.activity.binding.SelectSchoolActivity" | 94 | android:name=".ui.activity.binding.SelectSchoolActivity" |
95 | android:screenOrientation="portrait" | 95 | android:screenOrientation="portrait" |
96 | android:windowSoftInputMode="adjustPan|stateHidden" /> | 96 | android:windowSoftInputMode="adjustPan|stateHidden" /> |
97 | - <activity android:name=".ui.activity.LoginAndRegistActivity" | ||
98 | - android:screenOrientation="portrait" | ||
99 | - /> | 97 | + <!--<activity android:name=".ui.activity.LoginAndRegistActivity"--> |
98 | + <!--android:screenOrientation="portrait"--> | ||
99 | + <!--/>--> | ||
100 | <activity | 100 | <activity |
101 | android:name=".ui.activity.PersonInfoActivity" | 101 | android:name=".ui.activity.PersonInfoActivity" |
102 | android:screenOrientation="portrait" | 102 | android:screenOrientation="portrait" |
app/src/main/java/com/shunzhi/parent/adapter/ContextAdapter.java
0 → 100644
@@ -0,0 +1,66 @@ | @@ -0,0 +1,66 @@ | ||
1 | +package com.shunzhi.parent.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.ImageView; | ||
8 | +import android.widget.TextView; | ||
9 | + | ||
10 | +import com.bumptech.glide.Glide; | ||
11 | +import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; | ||
12 | +import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; | ||
13 | +import com.shunzhi.parent.R; | ||
14 | +import com.shunzhi.parent.bean.channel.ChannelContextBean; | ||
15 | + | ||
16 | +/** | ||
17 | + * Created by lenovo on 2018/3/18. | ||
18 | + */ | ||
19 | + | ||
20 | +public class ContextAdapter extends BaseRecyclerViewAdapter<ChannelContextBean>{ | ||
21 | + Context context; | ||
22 | + | ||
23 | + public ContextAdapter(Context context) { | ||
24 | + this.context = context; | ||
25 | + } | ||
26 | + | ||
27 | + | ||
28 | + @Override | ||
29 | + public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
30 | + View view = LayoutInflater.from(context).inflate(R.layout.layout_consult_content, null); | ||
31 | + return new MyViewHolder(view); | ||
32 | + } | ||
33 | + | ||
34 | + private class MyViewHolder extends BaseRecyclerViewHolder<ChannelContextBean> { | ||
35 | + TextView tvConsultTitle,tvConsultContent,tvPingLunNums,tvZhuanFaNums; | ||
36 | + ImageView iv_consult; | ||
37 | + | ||
38 | + | ||
39 | + public MyViewHolder(View view) { | ||
40 | + super(view); | ||
41 | + tvConsultContent=view.findViewById(R.id.tvConsultContent); | ||
42 | + tvConsultTitle=view.findViewById(R.id.tvConsultTitle); | ||
43 | + tvPingLunNums=view.findViewById(R.id.tvPingLunNums); | ||
44 | + tvZhuanFaNums=view.findViewById(R.id.tvZhuanFaNums); | ||
45 | + iv_consult=view.findViewById(R.id.iv_consult); | ||
46 | + | ||
47 | + } | ||
48 | + | ||
49 | + @Override | ||
50 | + public void onBindViewHolder(final ChannelContextBean object, int position) { | ||
51 | + tvConsultTitle.setText(object.getTitle()); | ||
52 | + tvConsultContent.setText(object.getContent()); | ||
53 | + Glide.with(context).load(object.getImage()).placeholder(R.color.xueqing_blue) | ||
54 | + .into(iv_consult); | ||
55 | + | ||
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | ||
60 | + } | ||
61 | + | ||
62 | + } | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | +} |
app/src/main/java/com/shunzhi/parent/api/Consult.java
@@ -3,7 +3,10 @@ package com.shunzhi.parent.api; | @@ -3,7 +3,10 @@ package com.shunzhi.parent.api; | ||
3 | import com.google.gson.JsonObject; | 3 | import com.google.gson.JsonObject; |
4 | 4 | ||
5 | import io.reactivex.Observable; | 5 | import io.reactivex.Observable; |
6 | +import retrofit2.http.Field; | ||
7 | +import retrofit2.http.FormUrlEncoded; | ||
6 | import retrofit2.http.GET; | 8 | import retrofit2.http.GET; |
9 | +import retrofit2.http.POST; | ||
7 | import retrofit2.http.Query; | 10 | import retrofit2.http.Query; |
8 | 11 | ||
9 | /** | 12 | /** |
@@ -12,9 +15,13 @@ import retrofit2.http.Query; | @@ -12,9 +15,13 @@ import retrofit2.http.Query; | ||
12 | 15 | ||
13 | public interface Consult { | 16 | public interface Consult { |
14 | 17 | ||
15 | - @GET("api/ParentService/GetAds") | ||
16 | - Observable<JsonObject> getBanners(@Query("position") String position); | 18 | + @GET("/api/ParentService/GetAds") |
19 | + Observable<JsonObject> getBanners(@Query("position") String position, @Query("areaName") String areaName); | ||
17 | 20 | ||
18 | 21 | ||
19 | - Observable<JsonObject> getConsultContent(); | 22 | + @FormUrlEncoded |
23 | + @POST("/api/ParentService/GetChannelInfo") | ||
24 | + Observable<JsonObject> getConsultContent(@Field("areaName") String areaName, @Field("channel") int channel | ||
25 | + , @Field("toFirstPage") int toFirstPage, @Field("pageIndex") int pageIndex); | ||
26 | + | ||
20 | } | 27 | } |
app/src/main/java/com/shunzhi/parent/bean/channel/ChannelBean.java
0 → 100644
@@ -0,0 +1,67 @@ | @@ -0,0 +1,67 @@ | ||
1 | +package com.shunzhi.parent.bean.channel; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | + | ||
5 | +/** | ||
6 | + * Created by lenovo on 2018/3/18. | ||
7 | + */ | ||
8 | + | ||
9 | +public class ChannelBean implements Serializable { | ||
10 | + private int id; | ||
11 | + private String channelName; | ||
12 | + private String channelImage; | ||
13 | + private int orderById; | ||
14 | + private String url; | ||
15 | + | ||
16 | + | ||
17 | + public int getId() { | ||
18 | + return id; | ||
19 | + } | ||
20 | + | ||
21 | + public void setId(int id) { | ||
22 | + this.id = id; | ||
23 | + } | ||
24 | + | ||
25 | + public String getChannelName() { | ||
26 | + return channelName; | ||
27 | + } | ||
28 | + | ||
29 | + public void setChannelName(String channelName) { | ||
30 | + this.channelName = channelName; | ||
31 | + } | ||
32 | + | ||
33 | + public String getChannelImage() { | ||
34 | + return channelImage; | ||
35 | + } | ||
36 | + | ||
37 | + public void setChannelImage(String channelImage) { | ||
38 | + this.channelImage = channelImage; | ||
39 | + } | ||
40 | + | ||
41 | + public int getOrderById() { | ||
42 | + return orderById; | ||
43 | + } | ||
44 | + | ||
45 | + public void setOrderById(int orderById) { | ||
46 | + this.orderById = orderById; | ||
47 | + } | ||
48 | + | ||
49 | + public String getUrl() { | ||
50 | + return url; | ||
51 | + } | ||
52 | + | ||
53 | + public void setUrl(String url) { | ||
54 | + this.url = url; | ||
55 | + } | ||
56 | + | ||
57 | + @Override | ||
58 | + public String toString() { | ||
59 | + return "ChannelContextBean:{" + | ||
60 | + ",id='" + id + '\'' + | ||
61 | + ",channelName='" + channelName + '\'' + | ||
62 | + ",channelImage='" + channelImage + '\'' + | ||
63 | + ",orderById='" + orderById + '\'' + | ||
64 | + ", url=" + url + | ||
65 | + "}"; | ||
66 | + } | ||
67 | +} |
app/src/main/java/com/shunzhi/parent/bean/channel/ChannelContextBean.java
0 → 100644
@@ -0,0 +1,108 @@ | @@ -0,0 +1,108 @@ | ||
1 | +package com.shunzhi.parent.bean.channel; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | + | ||
5 | +/** | ||
6 | + * Created by lenovo on 2018/3/18. | ||
7 | + */ | ||
8 | + | ||
9 | +public class ChannelContextBean implements Serializable{ | ||
10 | + private int id; | ||
11 | + private String image; | ||
12 | + private String title; | ||
13 | + private String url; | ||
14 | + private String content; | ||
15 | + private int forwardingNum; | ||
16 | + private int talkNum; | ||
17 | + private int orderById; | ||
18 | + private int isAds; | ||
19 | + | ||
20 | + | ||
21 | + public int getId() { | ||
22 | + return id; | ||
23 | + } | ||
24 | + | ||
25 | + public void setId(int id) { | ||
26 | + this.id = id; | ||
27 | + } | ||
28 | + | ||
29 | + public String getImage() { | ||
30 | + return image; | ||
31 | + } | ||
32 | + | ||
33 | + public void setImage(String image) { | ||
34 | + this.image = image; | ||
35 | + } | ||
36 | + | ||
37 | + public String getTitle() { | ||
38 | + return title; | ||
39 | + } | ||
40 | + | ||
41 | + public void setTitle(String title) { | ||
42 | + this.title = title; | ||
43 | + } | ||
44 | + | ||
45 | + public String getUrl() { | ||
46 | + return url; | ||
47 | + } | ||
48 | + | ||
49 | + public void setUrl(String url) { | ||
50 | + this.url = url; | ||
51 | + } | ||
52 | + | ||
53 | + public String getContent() { | ||
54 | + return content; | ||
55 | + } | ||
56 | + | ||
57 | + public void setContent(String content) { | ||
58 | + this.content = content; | ||
59 | + } | ||
60 | + | ||
61 | + public int getForwardingNum() { | ||
62 | + return forwardingNum; | ||
63 | + } | ||
64 | + | ||
65 | + public void setForwardingNum(int forwardingNum) { | ||
66 | + this.forwardingNum = forwardingNum; | ||
67 | + } | ||
68 | + | ||
69 | + public int getTalkNum() { | ||
70 | + return talkNum; | ||
71 | + } | ||
72 | + | ||
73 | + public void setTalkNum(int talkNum) { | ||
74 | + this.talkNum = talkNum; | ||
75 | + } | ||
76 | + | ||
77 | + public int getOrderById() { | ||
78 | + return orderById; | ||
79 | + } | ||
80 | + | ||
81 | + public void setOrderById(int orderById) { | ||
82 | + this.orderById = orderById; | ||
83 | + } | ||
84 | + | ||
85 | + public int getIsAds() { | ||
86 | + return isAds; | ||
87 | + } | ||
88 | + | ||
89 | + public void setIsAds(int isAds) { | ||
90 | + this.isAds = isAds; | ||
91 | + } | ||
92 | + | ||
93 | + @Override | ||
94 | + public String toString() { | ||
95 | + return "ChannelContextBean:{" + | ||
96 | + ",id='" + id + '\'' + | ||
97 | + ",image='" + image + '\'' + | ||
98 | + ",title='" + title + '\'' + | ||
99 | + ",url='" + url + '\'' + | ||
100 | + ",content='" + content + '\'' + | ||
101 | + ",forwardingNum='" + forwardingNum + '\'' + | ||
102 | + ",talkNum='" + talkNum + '\'' + | ||
103 | + ",orderById='" + orderById + '\'' + | ||
104 | + ", isAds=" + isAds + | ||
105 | + "}"; | ||
106 | + } | ||
107 | + | ||
108 | +} |
app/src/main/java/com/shunzhi/parent/bean/channel/ChannelInfo.java
0 → 100644
@@ -0,0 +1,42 @@ | @@ -0,0 +1,42 @@ | ||
1 | +package com.shunzhi.parent.bean.channel; | ||
2 | + | ||
3 | +import com.share.mvpsdk.base.BaseModel; | ||
4 | +import com.share.mvpsdk.base.entity.BaseEntity; | ||
5 | +import com.shunzhi.parent.bean.ToolBean; | ||
6 | + | ||
7 | +import java.io.Serializable; | ||
8 | +import java.util.List; | ||
9 | + | ||
10 | +/** | ||
11 | + * Created by lenovo on 2018/3/18. | ||
12 | + */ | ||
13 | + | ||
14 | +public class ChannelInfo implements Serializable { | ||
15 | + private List<ChannelContextBean> channelContent; | ||
16 | + private List<ChannelBean> subchannel; | ||
17 | + | ||
18 | + | ||
19 | + public List<ChannelContextBean> getChannelContent() { | ||
20 | + return channelContent; | ||
21 | + } | ||
22 | + | ||
23 | + public void setChannelContent(List<ChannelContextBean> channelContent) { | ||
24 | + this.channelContent = channelContent; | ||
25 | + } | ||
26 | + | ||
27 | + public List<ChannelBean> getSubchannel() { | ||
28 | + return subchannel; | ||
29 | + } | ||
30 | + | ||
31 | + public void setSubchannel(List<ChannelBean> subchannel) { | ||
32 | + this.subchannel = subchannel; | ||
33 | + } | ||
34 | + | ||
35 | + @Override | ||
36 | + public String toString() { | ||
37 | + return "ChannelInfo{" + | ||
38 | + ",subchannel='" + subchannel + '\'' + | ||
39 | + ", channelContent=" + channelContent + | ||
40 | + "}"; | ||
41 | + } | ||
42 | +} |
app/src/main/java/com/shunzhi/parent/contract/consult/ConsultContract.java
@@ -7,6 +7,8 @@ import com.share.mvpsdk.base.BasePresenter; | @@ -7,6 +7,8 @@ import com.share.mvpsdk.base.BasePresenter; | ||
7 | import com.share.mvpsdk.base.IBaseFragment; | 7 | import com.share.mvpsdk.base.IBaseFragment; |
8 | import com.share.mvpsdk.base.IBaseModel; | 8 | import com.share.mvpsdk.base.IBaseModel; |
9 | import com.shunzhi.parent.bean.GuangGaoBean; | 9 | import com.shunzhi.parent.bean.GuangGaoBean; |
10 | +import com.shunzhi.parent.bean.channel.ChannelBean; | ||
11 | +import com.shunzhi.parent.bean.channel.ChannelContextBean; | ||
10 | 12 | ||
11 | import java.util.List; | 13 | import java.util.List; |
12 | 14 | ||
@@ -18,23 +20,31 @@ import io.reactivex.Observable; | @@ -18,23 +20,31 @@ import io.reactivex.Observable; | ||
18 | 20 | ||
19 | public interface ConsultContract { | 21 | public interface ConsultContract { |
20 | 22 | ||
21 | - abstract class ConsultPresenter extends BasePresenter<IConsultModel,IConsultView>{ | 23 | + abstract class ConsultPresenter extends BasePresenter<IConsultModel, IConsultView> { |
22 | public abstract void getTools(LinearLayout linearLayout); | 24 | public abstract void getTools(LinearLayout linearLayout); |
23 | 25 | ||
24 | - public abstract void getBanners(String position); | 26 | + public abstract void getBanners(String position, String areaName); |
27 | + | ||
28 | + public abstract void getContextChannel(String areaName, int channel, int toFirstPage, int pageIndex); | ||
25 | } | 29 | } |
26 | 30 | ||
27 | 31 | ||
28 | - interface IConsultModel extends IBaseModel{ | 32 | + interface IConsultModel extends IBaseModel { |
29 | Observable<JsonObject> getTools(); | 33 | Observable<JsonObject> getTools(); |
30 | 34 | ||
31 | - Observable<JsonObject> getBanners(String position); | 35 | + Observable<JsonObject> getBanners(String position, String areaName); |
36 | + | ||
37 | + Observable<JsonObject> getContextChannel(String areaName, int channel, int toFirstPage, int pageIndex); | ||
32 | } | 38 | } |
33 | 39 | ||
34 | - interface IConsultView extends IBaseFragment{ | 40 | + interface IConsultView extends IBaseFragment { |
35 | void showTools(); | 41 | void showTools(); |
36 | 42 | ||
37 | void showBanners(List<GuangGaoBean> guangGaoBeanList); | 43 | void showBanners(List<GuangGaoBean> guangGaoBeanList); |
44 | + | ||
45 | + void showChannel(List<ChannelBean> list); | ||
46 | + | ||
47 | + void showContext(List<ChannelContextBean> list); | ||
38 | } | 48 | } |
39 | 49 | ||
40 | } | 50 | } |
app/src/main/java/com/shunzhi/parent/contract/consult/consultone/ConsultOneContract.java
@@ -21,17 +21,17 @@ public interface ConsultOneContract { | @@ -21,17 +21,17 @@ public interface ConsultOneContract { | ||
21 | abstract class ConsultOnePresenter extends BasePresenter<IConsultOneModel,IConsultOneView>{ | 21 | abstract class ConsultOnePresenter extends BasePresenter<IConsultOneModel,IConsultOneView>{ |
22 | public abstract void getTools(LinearLayout linearLayout); | 22 | public abstract void getTools(LinearLayout linearLayout); |
23 | 23 | ||
24 | - public abstract void getBanners(String position); | 24 | + public abstract void getBanners(String position,String areaName); |
25 | 25 | ||
26 | - public abstract void getConsultContent(); | 26 | + public abstract void getConsultContent(String areaName, int channel, int toFirstPage, int pageIndex); |
27 | } | 27 | } |
28 | 28 | ||
29 | interface IConsultOneModel extends IBaseModel{ | 29 | interface IConsultOneModel extends IBaseModel{ |
30 | void getTools(); | 30 | void getTools(); |
31 | 31 | ||
32 | - Observable<JsonObject> getBanners(String position); | 32 | + Observable<JsonObject> getBanners(String position,String areaName); |
33 | 33 | ||
34 | - Observable<JsonObject> getConsultContent(); | 34 | + Observable<JsonObject> getConsultContent(String areaName, int channel, int toFirstPage, int pageIndex); |
35 | } | 35 | } |
36 | 36 | ||
37 | interface IConsultOneView extends IBaseFragment{ | 37 | interface IConsultOneView extends IBaseFragment{ |
app/src/main/java/com/shunzhi/parent/model/consult/ConsultModel.java
@@ -6,6 +6,8 @@ import com.share.mvpsdk.helper.RetrofitCreateHelper; | @@ -6,6 +6,8 @@ import com.share.mvpsdk.helper.RetrofitCreateHelper; | ||
6 | import com.share.mvpsdk.helper.RxHelper; | 6 | import com.share.mvpsdk.helper.RxHelper; |
7 | import com.shunzhi.parent.AppConfig; | 7 | import com.shunzhi.parent.AppConfig; |
8 | import com.shunzhi.parent.api.Consult; | 8 | import com.shunzhi.parent.api.Consult; |
9 | +import com.shunzhi.parent.api.LoginRegisterApi; | ||
10 | +import com.shunzhi.parent.bean.UserInfo; | ||
9 | import com.shunzhi.parent.contract.consult.ConsultContract; | 11 | import com.shunzhi.parent.contract.consult.ConsultContract; |
10 | 12 | ||
11 | import io.reactivex.Observable; | 13 | import io.reactivex.Observable; |
@@ -23,9 +25,17 @@ public class ConsultModel extends BaseModel implements ConsultContract.IConsultM | @@ -23,9 +25,17 @@ public class ConsultModel extends BaseModel implements ConsultContract.IConsultM | ||
23 | } | 25 | } |
24 | 26 | ||
25 | @Override | 27 | @Override |
26 | - public Observable<JsonObject> getBanners(String position) { | 28 | + public Observable<JsonObject> getBanners(String position,String areaName) { |
27 | return RetrofitCreateHelper.getInstance().createApi(Consult.class, AppConfig.BASE_URL) | 29 | return RetrofitCreateHelper.getInstance().createApi(Consult.class, AppConfig.BASE_URL) |
28 | - .getBanners(position).compose(RxHelper.<JsonObject>rxSchedulerHelper()); | 30 | + .getBanners(position,areaName).compose(RxHelper.<JsonObject>rxSchedulerHelper()); |
31 | + } | ||
32 | + | ||
33 | + @Override | ||
34 | + public Observable<JsonObject> getContextChannel(String areaName, int channel, int toFirstPage, int pageIndex) { | ||
35 | +// return RetrofitCreateHelper.getInstance().createApi(Consult.class, AppConfig.BASE_URL) | ||
36 | +// .getConsultContent(areaName,channel,toFirstPage,pageIndex); | ||
37 | + return RetrofitCreateHelper.getInstance().createApi(Consult.class,AppConfig.BASE_URL).getConsultContent(areaName,channel,toFirstPage,pageIndex) | ||
38 | + .compose(RxHelper.<JsonObject>rxSchedulerHelper()); | ||
29 | } | 39 | } |
30 | 40 | ||
31 | public static ConsultContract.IConsultModel newInstance() { | 41 | public static ConsultContract.IConsultModel newInstance() { |
app/src/main/java/com/shunzhi/parent/model/consult/consultone/ConsultOneModel.java
@@ -27,14 +27,14 @@ public class ConsultOneModel extends BaseModel implements ConsultOneContract.ICo | @@ -27,14 +27,14 @@ public class ConsultOneModel extends BaseModel implements ConsultOneContract.ICo | ||
27 | } | 27 | } |
28 | 28 | ||
29 | @Override | 29 | @Override |
30 | - public Observable<JsonObject> getBanners(String position) { | 30 | + public Observable<JsonObject> getBanners(String position,String areaName) { |
31 | return RetrofitCreateHelper.getInstance().createApi(Consult.class, AppConfig.BASE_URL) | 31 | return RetrofitCreateHelper.getInstance().createApi(Consult.class, AppConfig.BASE_URL) |
32 | - .getBanners(position).compose(RxHelper.<JsonObject>rxSchedulerHelper()); | 32 | + .getBanners(position,areaName).compose(RxHelper.<JsonObject>rxSchedulerHelper()); |
33 | } | 33 | } |
34 | 34 | ||
35 | @Override | 35 | @Override |
36 | - public Observable<JsonObject> getConsultContent() { | ||
37 | - return RetrofitCreateHelper.getInstance().createApi(Consult.class,AppConfig.BASE_URL) | ||
38 | - .getConsultContent().compose(RxHelper.<JsonObject>rxSchedulerHelper()); | 36 | + public Observable<JsonObject> getConsultContent(String areaName, int channel, int toFirstPage, int pageIndex) { |
37 | + return RetrofitCreateHelper.getInstance().createApi(Consult.class, AppConfig.BASE_URL) | ||
38 | + .getConsultContent(areaName,channel,toFirstPage,pageIndex); | ||
39 | } | 39 | } |
40 | } | 40 | } |
app/src/main/java/com/shunzhi/parent/presenter/consult/ConsultPresenter.java
@@ -9,20 +9,27 @@ import android.widget.LinearLayout; | @@ -9,20 +9,27 @@ import android.widget.LinearLayout; | ||
9 | import com.google.gson.Gson; | 9 | import com.google.gson.Gson; |
10 | import com.google.gson.JsonArray; | 10 | import com.google.gson.JsonArray; |
11 | import com.google.gson.JsonObject; | 11 | import com.google.gson.JsonObject; |
12 | +import com.share.mvpsdk.utils.OkHttpExceptionUtil; | ||
12 | import com.share.mvpsdk.utils.ToastUtils; | 13 | import com.share.mvpsdk.utils.ToastUtils; |
13 | import com.shunzhi.parent.R; | 14 | import com.shunzhi.parent.R; |
14 | import com.shunzhi.parent.bean.GuangGaoBean; | 15 | import com.shunzhi.parent.bean.GuangGaoBean; |
15 | import com.shunzhi.parent.bean.ToolBean; | 16 | import com.shunzhi.parent.bean.ToolBean; |
17 | +import com.shunzhi.parent.bean.channel.ChannelBean; | ||
18 | +import com.shunzhi.parent.bean.channel.ChannelContextBean; | ||
19 | +import com.shunzhi.parent.bean.channel.ChannelInfo; | ||
16 | import com.shunzhi.parent.contract.consult.ConsultContract; | 20 | import com.shunzhi.parent.contract.consult.ConsultContract; |
17 | import com.shunzhi.parent.model.consult.ConsultModel; | 21 | import com.shunzhi.parent.model.consult.ConsultModel; |
18 | import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; | 22 | import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; |
19 | import com.shunzhi.parent.util.AttrsUtils; | 23 | import com.shunzhi.parent.util.AttrsUtils; |
20 | import com.shunzhi.parent.views.TextAndImgShowView; | 24 | import com.shunzhi.parent.views.TextAndImgShowView; |
21 | 25 | ||
26 | +import org.json.JSONObject; | ||
27 | + | ||
22 | import java.util.ArrayList; | 28 | import java.util.ArrayList; |
23 | import java.util.List; | 29 | import java.util.List; |
24 | 30 | ||
25 | import io.reactivex.functions.Consumer; | 31 | import io.reactivex.functions.Consumer; |
32 | +import retrofit2.HttpException; | ||
26 | 33 | ||
27 | /** | 34 | /** |
28 | * Created by ToaHanDong on 2018/3/14. | 35 | * Created by ToaHanDong on 2018/3/14. |
@@ -31,18 +38,18 @@ import io.reactivex.functions.Consumer; | @@ -31,18 +38,18 @@ import io.reactivex.functions.Consumer; | ||
31 | public class ConsultPresenter extends ConsultContract.ConsultPresenter { | 38 | public class ConsultPresenter extends ConsultContract.ConsultPresenter { |
32 | @Override | 39 | @Override |
33 | public void getTools(LinearLayout layout_control) { | 40 | public void getTools(LinearLayout layout_control) { |
34 | - List<ToolBean> toolBeanList=new ArrayList<>(); | ||
35 | - toolBeanList.add(new ToolBean(R.drawable.xiaoxue+"","小学")); | ||
36 | - toolBeanList.add(new ToolBean(R.drawable.zhongxue+"","中学")); | ||
37 | - toolBeanList.add(new ToolBean(R.drawable.gaozhong+"","高中")); | ||
38 | - toolBeanList.add(new ToolBean(R.drawable.parent+"","家长")); | 41 | + List<ToolBean> toolBeanList = new ArrayList<>(); |
42 | + toolBeanList.add(new ToolBean(R.drawable.xiaoxue + "", "小学")); | ||
43 | + toolBeanList.add(new ToolBean(R.drawable.zhongxue + "", "中学")); | ||
44 | + toolBeanList.add(new ToolBean(R.drawable.gaozhong + "", "高中")); | ||
45 | + toolBeanList.add(new ToolBean(R.drawable.parent + "", "家长")); | ||
39 | for (int i = 0; i < toolBeanList.size(); i++) { | 46 | for (int i = 0; i < toolBeanList.size(); i++) { |
40 | - TextAndImgShowView textAndImgShowView=new TextAndImgShowView(mIView.getBindActivity()); | 47 | + TextAndImgShowView textAndImgShowView = new TextAndImgShowView(mIView.getBindActivity()); |
41 | textAndImgShowView.setTextColor(R.color.textColor); | 48 | textAndImgShowView.setTextColor(R.color.textColor); |
42 | textAndImgShowView.setText(toolBeanList.get(i).toolName); | 49 | textAndImgShowView.setText(toolBeanList.get(i).toolName); |
43 | textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImage)); | 50 | textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImage)); |
44 | textAndImgShowView.setSelect(true); | 51 | textAndImgShowView.setSelect(true); |
45 | - textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control); | 52 | + textAndImgShowView.setWidth(mIView.getBindActivity(), layout_control); |
46 | textAndImgShowView.setBackground(AttrsUtils.getAttrs(mIView.getBindActivity()).getDrawable(0)); | 53 | textAndImgShowView.setBackground(AttrsUtils.getAttrs(mIView.getBindActivity()).getDrawable(0)); |
47 | textAndImgShowView.setOnClickListener(new View.OnClickListener() { | 54 | textAndImgShowView.setOnClickListener(new View.OnClickListener() { |
48 | @Override | 55 | @Override |
@@ -56,29 +63,58 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { | @@ -56,29 +63,58 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { | ||
56 | } | 63 | } |
57 | 64 | ||
58 | @Override | 65 | @Override |
59 | - public void getBanners(String position) { | 66 | + public void getBanners(String position, String areaName) { |
60 | 67 | ||
61 | - mRxManager.register(mIModel.getBanners(position).subscribe(new Consumer<JsonObject>() { | 68 | + mRxManager.register(mIModel.getBanners(position, areaName).subscribe(new Consumer<JsonObject>() { |
62 | @Override | 69 | @Override |
63 | public void accept(JsonObject jsonObject) throws Exception { | 70 | public void accept(JsonObject jsonObject) throws Exception { |
64 | - if (jsonObject.get("status").getAsString().equals("1")){ | ||
65 | - JsonArray jsonArray=jsonObject.getAsJsonArray("data"); | ||
66 | - List<GuangGaoBean> guangGaoBeanList=new ArrayList<>(); | 71 | + if (jsonObject.get("status").getAsString().equals("1")) { |
72 | + JsonArray jsonArray = jsonObject.getAsJsonArray("data"); | ||
73 | + List<GuangGaoBean> guangGaoBeanList = new ArrayList<>(); | ||
67 | for (int i = 0; i < jsonArray.size(); i++) { | 74 | for (int i = 0; i < jsonArray.size(); i++) { |
68 | - GuangGaoBean guangGaoBean=new Gson().fromJson(jsonArray.get(i).getAsJsonObject(),GuangGaoBean.class); | 75 | + GuangGaoBean guangGaoBean = new Gson().fromJson(jsonArray.get(i).getAsJsonObject(), GuangGaoBean.class); |
69 | guangGaoBeanList.add(guangGaoBean); | 76 | guangGaoBeanList.add(guangGaoBean); |
70 | } | 77 | } |
71 | mIView.showBanners(guangGaoBeanList); | 78 | mIView.showBanners(guangGaoBeanList); |
72 | - }else { | 79 | + } else { |
73 | ToastUtils.showToast(jsonObject.get("message").getAsString()); | 80 | ToastUtils.showToast(jsonObject.get("message").getAsString()); |
74 | } | 81 | } |
75 | } | 82 | } |
76 | }, new Consumer<Throwable>() { | 83 | }, new Consumer<Throwable>() { |
77 | @Override | 84 | @Override |
78 | public void accept(Throwable throwable) throws Exception { | 85 | public void accept(Throwable throwable) throws Exception { |
86 | + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | ||
87 | + } | ||
88 | + })); | ||
89 | + } | ||
90 | + | ||
91 | + @Override | ||
92 | + public void getContextChannel(String areaName, int channel, int toFirstPage, int pageIndex) { | ||
93 | + mRxManager.register(mIModel.getContextChannel(areaName, channel, toFirstPage, pageIndex).subscribe(new Consumer<JsonObject>() { | ||
94 | + @Override | ||
95 | + public void accept(JsonObject jsonObject) throws Exception { | ||
96 | + ToastUtils.showToast(jsonObject.toString()); | ||
97 | + JsonObject json=jsonObject.getAsJsonObject("data"); | ||
98 | + Gson g=new Gson(); | ||
99 | + ChannelInfo channelInfo = g.fromJson(json.toString(),ChannelInfo.class); | ||
100 | + List<ChannelContextBean> contextList = channelInfo.getChannelContent(); | ||
101 | + List<ChannelBean> channelList = channelInfo.getSubchannel(); | ||
102 | + mIView.showChannel(channelList); | ||
103 | + mIView.showContext(contextList); | ||
104 | + | ||
105 | + | ||
106 | + | ||
79 | 107 | ||
80 | } | 108 | } |
109 | + }, new Consumer<Throwable>() { | ||
110 | + @Override | ||
111 | + public void accept(Throwable throwable) throws Exception { | ||
112 | + OkHttpExceptionUtil.handOkHttpException((HttpException) throwable); | ||
113 | + } | ||
81 | })); | 114 | })); |
115 | + | ||
116 | + | ||
117 | + | ||
82 | } | 118 | } |
83 | 119 | ||
84 | @Override | 120 | @Override |
app/src/main/java/com/shunzhi/parent/presenter/consult/consultone/ConsultOnePresenter.java
@@ -54,8 +54,8 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ | @@ -54,8 +54,8 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ | ||
54 | } | 54 | } |
55 | 55 | ||
56 | @Override | 56 | @Override |
57 | - public void getBanners(String position) { | ||
58 | - mRxManager.register(mIModel.getBanners(position).subscribe(new Consumer<JsonObject>() { | 57 | + public void getBanners(String position,String areaName) { |
58 | + mRxManager.register(mIModel.getBanners(position,areaName).subscribe(new Consumer<JsonObject>() { | ||
59 | @Override | 59 | @Override |
60 | public void accept(JsonObject jsonObject) throws Exception { | 60 | public void accept(JsonObject jsonObject) throws Exception { |
61 | if (jsonObject.get("status").getAsString().equals("1")){ | 61 | if (jsonObject.get("status").getAsString().equals("1")){ |
@@ -79,10 +79,11 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ | @@ -79,10 +79,11 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ | ||
79 | } | 79 | } |
80 | 80 | ||
81 | @Override | 81 | @Override |
82 | - public void getConsultContent() { | 82 | + public void getConsultContent(String areaName, int channel, int toFirstPage, int pageIndex) { |
83 | 83 | ||
84 | } | 84 | } |
85 | 85 | ||
86 | + | ||
86 | @Override | 87 | @Override |
87 | public ConsultOneContract.IConsultOneModel getModel() { | 88 | public ConsultOneContract.IConsultOneModel getModel() { |
88 | return ConsultOneModel.newInstance(); | 89 | return ConsultOneModel.newInstance(); |
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
@@ -7,6 +7,8 @@ import android.content.IntentFilter; | @@ -7,6 +7,8 @@ import android.content.IntentFilter; | ||
7 | import android.os.Bundle; | 7 | import android.os.Bundle; |
8 | import android.support.annotation.NonNull; | 8 | import android.support.annotation.NonNull; |
9 | import android.support.annotation.Nullable; | 9 | import android.support.annotation.Nullable; |
10 | +import android.support.v7.widget.LinearLayoutManager; | ||
11 | +import android.support.v7.widget.RecyclerView; | ||
10 | import android.view.View; | 12 | import android.view.View; |
11 | import android.widget.ImageView; | 13 | import android.widget.ImageView; |
12 | import android.widget.LinearLayout; | 14 | import android.widget.LinearLayout; |
@@ -18,9 +20,15 @@ import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | @@ -18,9 +20,15 @@ import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | ||
18 | import com.shunzhi.parent.AppConfig; | 20 | import com.shunzhi.parent.AppConfig; |
19 | import com.shunzhi.parent.AppContext; | 21 | import com.shunzhi.parent.AppContext; |
20 | import com.shunzhi.parent.R; | 22 | import com.shunzhi.parent.R; |
23 | +import com.shunzhi.parent.adapter.ContextAdapter; | ||
21 | import com.shunzhi.parent.bean.GuangGaoBean; | 24 | import com.shunzhi.parent.bean.GuangGaoBean; |
25 | +import com.shunzhi.parent.bean.channel.ChannelBean; | ||
26 | +import com.shunzhi.parent.bean.channel.ChannelContextBean; | ||
22 | import com.shunzhi.parent.contract.consult.ConsultContract; | 27 | import com.shunzhi.parent.contract.consult.ConsultContract; |
23 | import com.shunzhi.parent.presenter.consult.ConsultPresenter; | 28 | import com.shunzhi.parent.presenter.consult.ConsultPresenter; |
29 | +import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; | ||
30 | +import com.shunzhi.parent.util.AttrsUtils; | ||
31 | +import com.shunzhi.parent.views.TextAndImgShowView; | ||
24 | import com.stx.xhb.xbanner.XBanner; | 32 | import com.stx.xhb.xbanner.XBanner; |
25 | 33 | ||
26 | import java.io.ByteArrayOutputStream; | 34 | import java.io.ByteArrayOutputStream; |
@@ -33,15 +41,20 @@ import cn.jzvd.JZVideoPlayerStandard; | @@ -33,15 +41,20 @@ import cn.jzvd.JZVideoPlayerStandard; | ||
33 | import me.leefeng.citypicker.CityPicker; | 41 | import me.leefeng.citypicker.CityPicker; |
34 | import me.leefeng.citypicker.CityPickerListener; | 42 | import me.leefeng.citypicker.CityPickerListener; |
35 | 43 | ||
36 | -public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.ConsultPresenter,ConsultContract.IConsultModel> implements View.OnClickListener | ||
37 | -,ConsultContract.IConsultView,CityPickerListener{ | 44 | +public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.ConsultPresenter, ConsultContract.IConsultModel> implements View.OnClickListener |
45 | + , ConsultContract.IConsultView, CityPickerListener { | ||
38 | 46 | ||
39 | ImageView ivSearch; | 47 | ImageView ivSearch; |
40 | 48 | ||
41 | XBanner xBanner; | 49 | XBanner xBanner; |
42 | 50 | ||
51 | + RecyclerView recycler_context; | ||
52 | + | ||
53 | + ContextAdapter contextAdapter; | ||
54 | + | ||
43 | List<String> imgesUrl = new ArrayList<>(); | 55 | List<String> imgesUrl = new ArrayList<>(); |
44 | List<String> describeList = new ArrayList<>(); | 56 | List<String> describeList = new ArrayList<>(); |
57 | + List<ChannelContextBean> contextList = new ArrayList<>(); | ||
45 | 58 | ||
46 | JZVideoPlayerStandard videoplayer; | 59 | JZVideoPlayerStandard videoplayer; |
47 | 60 | ||
@@ -49,8 +62,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | @@ -49,8 +62,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | ||
49 | 62 | ||
50 | LinearLayout layout_control; | 63 | LinearLayout layout_control; |
51 | 64 | ||
52 | - CityPicker cityPicker=null; | ||
53 | - | 65 | + CityPicker cityPicker = null; |
66 | + | ||
54 | @Override | 67 | @Override |
55 | public int getLayoutId() { | 68 | public int getLayoutId() { |
56 | return R.layout.fragment_zi_xun; | 69 | return R.layout.fragment_zi_xun; |
@@ -59,25 +72,36 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | @@ -59,25 +72,36 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | ||
59 | @Override | 72 | @Override |
60 | public void initUI(View view, @Nullable Bundle savedInstanceState) { | 73 | public void initUI(View view, @Nullable Bundle savedInstanceState) { |
61 | 74 | ||
75 | + | ||
76 | + recycler_context = view.findViewById(R.id.recycler_content); | ||
77 | + initRecycler(); | ||
78 | + | ||
62 | ivSearch = view.findViewById(R.id.ivSearch); | 79 | ivSearch = view.findViewById(R.id.ivSearch); |
63 | xBanner = view.findViewById(R.id.xBanner); | 80 | xBanner = view.findViewById(R.id.xBanner); |
64 | videoplayer = view.findViewById(R.id.videoplayer); | 81 | videoplayer = view.findViewById(R.id.videoplayer); |
65 | tvLocalAddress = view.findViewById(R.id.tvLocalAddress); | 82 | tvLocalAddress = view.findViewById(R.id.tvLocalAddress); |
66 | - layout_control=view.findViewById(R.id.layout_control); | 83 | + layout_control = view.findViewById(R.id.layout_control); |
67 | 84 | ||
68 | tvLocalAddress.setText(AppContext.getInstance().cityName); | 85 | tvLocalAddress.setText(AppContext.getInstance().cityName); |
69 | videoplayer.batteryLevel.setVisibility(View.GONE); | 86 | videoplayer.batteryLevel.setVisibility(View.GONE); |
70 | videoplayer.replayTextView.setVisibility(View.GONE); | 87 | videoplayer.replayTextView.setVisibility(View.GONE); |
71 | videoplayer.backButton.setVisibility(View.GONE); | 88 | videoplayer.backButton.setVisibility(View.GONE); |
72 | 89 | ||
73 | - mPresenter.getTools(layout_control); | ||
74 | - mPresenter.getBanners("2"); | 90 | +// mPresenter.getTools(layout_control); |
91 | + mPresenter.getBanners("2", "余杭区"); | ||
92 | + mPresenter.getContextChannel("余杭区", 0, 1, 1); | ||
75 | 93 | ||
76 | initBroadCast(); | 94 | initBroadCast(); |
77 | 95 | ||
78 | initListeners(); | 96 | initListeners(); |
79 | } | 97 | } |
80 | 98 | ||
99 | + private void initRecycler() { | ||
100 | + recycler_context.setLayoutManager(new LinearLayoutManager(getActivity())); | ||
101 | + contextAdapter = new ContextAdapter(getActivity()); | ||
102 | + | ||
103 | + } | ||
104 | + | ||
81 | private void initListeners() { | 105 | private void initListeners() { |
82 | ivSearch.setOnClickListener(this); | 106 | ivSearch.setOnClickListener(this); |
83 | tvLocalAddress.setOnClickListener(this); | 107 | tvLocalAddress.setOnClickListener(this); |
@@ -118,8 +142,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | @@ -118,8 +142,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | ||
118 | switch (view.getId()) { | 142 | switch (view.getId()) { |
119 | case R.id.tvLocalAddress: | 143 | case R.id.tvLocalAddress: |
120 | // AppContext.getInstance().startLocation(); | 144 | // AppContext.getInstance().startLocation(); |
121 | - if (null==cityPicker)cityPicker=new CityPicker(getActivity(),this); | ||
122 | - if (cityPicker.isShow())cityPicker.close(); | 145 | + if (null == cityPicker) cityPicker = new CityPicker(getActivity(), this); |
146 | + if (cityPicker.isShow()) cityPicker.close(); | ||
123 | else cityPicker.show(); | 147 | else cityPicker.show(); |
124 | break; | 148 | break; |
125 | case R.id.ivSearch://搜索按钮 | 149 | case R.id.ivSearch://搜索按钮 |
@@ -149,8 +173,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | @@ -149,8 +173,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | ||
149 | @Override | 173 | @Override |
150 | public void onDestroy() { | 174 | public void onDestroy() { |
151 | super.onDestroy(); | 175 | super.onDestroy(); |
152 | - if (null!=broadcastReceiver)getActivity().unregisterReceiver(broadcastReceiver); | ||
153 | - if (null!=cityPicker)cityPicker.cancle(); | 176 | + if (null != broadcastReceiver) getActivity().unregisterReceiver(broadcastReceiver); |
177 | + if (null != cityPicker) cityPicker.cancle(); | ||
154 | } | 178 | } |
155 | 179 | ||
156 | @Override | 180 | @Override |
@@ -161,13 +185,47 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | @@ -161,13 +185,47 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | ||
161 | @Override | 185 | @Override |
162 | public void showBanners(List<GuangGaoBean> guangGaoBeanList) { | 186 | public void showBanners(List<GuangGaoBean> guangGaoBeanList) { |
163 | for (int i = 0; i < guangGaoBeanList.size(); i++) { | 187 | for (int i = 0; i < guangGaoBeanList.size(); i++) { |
164 | - imgesUrl.add(AppConfig.BASE_URL_IMG+guangGaoBeanList.get(i).fileSrc); | 188 | + imgesUrl.add(AppConfig.BASE_URL_IMG + guangGaoBeanList.get(i).fileSrc); |
165 | describeList.add(guangGaoBeanList.get(i).describe); | 189 | describeList.add(guangGaoBeanList.get(i).describe); |
166 | } | 190 | } |
167 | initBanners(); | 191 | initBanners(); |
168 | } | 192 | } |
169 | 193 | ||
170 | @Override | 194 | @Override |
195 | + public void showChannel(List<ChannelBean> list) { | ||
196 | + for (int i = 0; i < list.size(); i++) { | ||
197 | + TextAndImgShowView textAndImgShowView = new TextAndImgShowView(getActivity()); | ||
198 | + textAndImgShowView.setTextColor(R.color.textColor); | ||
199 | + textAndImgShowView.setText(list.get(i).getChannelName()); | ||
200 | +// textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(list.get(i).getChannelImage())); | ||
201 | + textAndImgShowView.setSelect(true); | ||
202 | + textAndImgShowView.setWidth(getActivity(), layout_control); | ||
203 | + textAndImgShowView.setBackground(AttrsUtils.getAttrs(getActivity()).getDrawable(0)); | ||
204 | + textAndImgShowView.setOnClickListener(new View.OnClickListener() { | ||
205 | + @Override | ||
206 | + public void onClick(View view) { | ||
207 | + ConsultOneLevelActivity.getInstance(getActivity()); | ||
208 | + } | ||
209 | + }); | ||
210 | + layout_control.addView(textAndImgShowView); | ||
211 | + } | ||
212 | + | ||
213 | + | ||
214 | + | ||
215 | + | ||
216 | + } | ||
217 | + | ||
218 | + @Override | ||
219 | + public void showContext(List<ChannelContextBean> list) { | ||
220 | + contextList.clear(); | ||
221 | + contextList.addAll(list); | ||
222 | + contextAdapter.addAll(contextList); | ||
223 | + recycler_context.setAdapter(contextAdapter); | ||
224 | + | ||
225 | + | ||
226 | + } | ||
227 | + | ||
228 | + @Override | ||
171 | public void getCity(String name) { | 229 | public void getCity(String name) { |
172 | tvLocalAddress.setText(name.split(" ")[1]); | 230 | tvLocalAddress.setText(name.split(" ")[1]); |
173 | } | 231 | } |
app/src/main/java/com/shunzhi/parent/ui/fragment/StartFragment.java
@@ -14,6 +14,8 @@ import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | @@ -14,6 +14,8 @@ import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | ||
14 | import com.shunzhi.parent.AppConfig; | 14 | import com.shunzhi.parent.AppConfig; |
15 | import com.shunzhi.parent.R; | 15 | import com.shunzhi.parent.R; |
16 | import com.shunzhi.parent.bean.GuangGaoBean; | 16 | import com.shunzhi.parent.bean.GuangGaoBean; |
17 | +import com.shunzhi.parent.bean.channel.ChannelBean; | ||
18 | +import com.shunzhi.parent.bean.channel.ChannelContextBean; | ||
17 | import com.shunzhi.parent.contract.consult.ConsultContract; | 19 | import com.shunzhi.parent.contract.consult.ConsultContract; |
18 | import com.shunzhi.parent.presenter.consult.ConsultPresenter; | 20 | import com.shunzhi.parent.presenter.consult.ConsultPresenter; |
19 | import com.shunzhi.parent.ui.MainActivity; | 21 | import com.shunzhi.parent.ui.MainActivity; |
@@ -36,9 +38,9 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | @@ -36,9 +38,9 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | ||
36 | public void initUI(View view, @Nullable Bundle savedInstanceState) { | 38 | public void initUI(View view, @Nullable Bundle savedInstanceState) { |
37 | xBanner = view.findViewById(R.id.xBanner); | 39 | xBanner = view.findViewById(R.id.xBanner); |
38 | if (!TextUtils.isEmpty(AppConfig.getAppConfig(getContext()).get(AppConfig.APP_IS_START))) { | 40 | if (!TextUtils.isEmpty(AppConfig.getAppConfig(getContext()).get(AppConfig.APP_IS_START))) { |
39 | - mPresenter.getBanners("0"); | 41 | + mPresenter.getBanners("0","杭州"); |
40 | AppConfig.getAppConfig(getContext()).set(AppConfig.APP_IS_START, "1"); | 42 | AppConfig.getAppConfig(getContext()).set(AppConfig.APP_IS_START, "1"); |
41 | - } else mPresenter.getBanners("1"); | 43 | + } else mPresenter.getBanners("1","杭州"); |
42 | } | 44 | } |
43 | 45 | ||
44 | @NonNull | 46 | @NonNull |
@@ -57,6 +59,16 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | @@ -57,6 +59,16 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | ||
57 | initBannes(guangGaoBeanList); | 59 | initBannes(guangGaoBeanList); |
58 | } | 60 | } |
59 | 61 | ||
62 | + @Override | ||
63 | + public void showChannel(List<ChannelBean> list) { | ||
64 | + | ||
65 | + } | ||
66 | + | ||
67 | + @Override | ||
68 | + public void showContext(List<ChannelContextBean> list) { | ||
69 | + | ||
70 | + } | ||
71 | + | ||
60 | private void initBannes(List<GuangGaoBean> guangGaoBeanList) { | 72 | private void initBannes(List<GuangGaoBean> guangGaoBeanList) { |
61 | final List<String> imgUrl = new ArrayList<>(); | 73 | final List<String> imgUrl = new ArrayList<>(); |
62 | List<String> describeList = new ArrayList<>(); | 74 | List<String> describeList = new ArrayList<>(); |
app/src/main/java/com/shunzhi/parent/ui/fragment/consult/ConsultOneLevelFragment.java
@@ -81,7 +81,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | @@ -81,7 +81,7 @@ public class ConsultOneLevelFragment extends BaseMVPCompatFragment<ConsultOneCon | ||
81 | recyclerViewGrally = view.findViewById(R.id.recyclerViewGrally); | 81 | recyclerViewGrally = view.findViewById(R.id.recyclerViewGrally); |
82 | recyclerViewConsultOne = view.findViewById(R.id.recyclerViewConsultOne); | 82 | recyclerViewConsultOne = view.findViewById(R.id.recyclerViewConsultOne); |
83 | 83 | ||
84 | - mPresenter.getBanners("3"); | 84 | + mPresenter.getBanners("3","杭州"); |
85 | initRecyclerViewConsult(); | 85 | initRecyclerViewConsult(); |
86 | } | 86 | } |
87 | 87 |
app/src/main/res/layout/fragment_zi_xun.xml
@@ -31,14 +31,23 @@ | @@ -31,14 +31,23 @@ | ||
31 | android:orientation="vertical"> | 31 | android:orientation="vertical"> |
32 | 32 | ||
33 | <TextView | 33 | <TextView |
34 | - android:layout_width="wrap_content" | 34 | + android:layout_width="match_parent" |
35 | android:layout_height="wrap_content" | 35 | android:layout_height="wrap_content" |
36 | android:text="@string/consult_huati" | 36 | android:text="@string/consult_huati" |
37 | android:textColor="@color/xueqing_blue" | 37 | android:textColor="@color/xueqing_blue" |
38 | android:textSize="@dimen/textSize16" /> | 38 | android:textSize="@dimen/textSize16" /> |
39 | 39 | ||
40 | - <include layout="@layout/layout_consult_content"/> | 40 | + <!--<include layout="@layout/layout_consult_content"/>--> |
41 | + <LinearLayout | ||
42 | + android:layout_width="match_parent" | ||
43 | + android:layout_height="wrap_content"> | ||
44 | + <android.support.v7.widget.RecyclerView | ||
45 | + android:id="@+id/recycler_content" | ||
46 | + android:layout_width="match_parent" | ||
47 | + android:layout_height="match_parent"> | ||
41 | 48 | ||
49 | + </android.support.v7.widget.RecyclerView> | ||
50 | + </LinearLayout> | ||
42 | </LinearLayout> | 51 | </LinearLayout> |
43 | 52 | ||
44 | 53 |
app/src/main/res/layout/layout_consult_content.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | android:layout_width="match_parent" | 3 | android:layout_width="match_parent" |
4 | - android:layout_marginBottom="@dimen/size_dp_10" | ||
5 | - android:layout_height="wrap_content"> | 4 | + android:layout_height="wrap_content" |
5 | + android:layout_marginBottom="@dimen/size_dp_10"> | ||
6 | + | ||
6 | <LinearLayout | 7 | <LinearLayout |
7 | android:layout_width="match_parent" | 8 | android:layout_width="match_parent" |
8 | android:layout_height="match_parent" | 9 | android:layout_height="match_parent" |
@@ -45,27 +46,34 @@ | @@ -45,27 +46,34 @@ | ||
45 | android:layout_height="wrap_content" | 46 | android:layout_height="wrap_content" |
46 | android:layout_marginTop="@dimen/size_dp_5"> | 47 | android:layout_marginTop="@dimen/size_dp_5"> |
47 | 48 | ||
48 | - <TextView | ||
49 | - android:id="@+id/tvPingLunNums" | ||
50 | - style="@style/TextView_Wrap_16" | ||
51 | - android:layout_gravity="center_vertical" | ||
52 | - android:text="评论:30" | ||
53 | - android:textSize="@dimen/textSize14" /> | 49 | + <RelativeLayout |
50 | + android:layout_width="match_parent" | ||
51 | + android:layout_height="wrap_content"> | ||
52 | + | ||
53 | + <TextView | ||
54 | + android:id="@+id/tvPingLunNums" | ||
55 | + style="@style/TextView_Wrap_16" | ||
56 | + android:layout_gravity="center_vertical" | ||
57 | + android:text="评论:30" | ||
58 | + android:textSize="@dimen/textSize14" /> | ||
54 | 59 | ||
55 | - <TextView | ||
56 | - android:id="@+id/tvZhuanFaNums" | ||
57 | - style="@style/TextView_Wrap_16" | ||
58 | - android:layout_gravity="right|center_vertical" | ||
59 | - android:text="转发:50" | ||
60 | - android:textSize="@dimen/textSize14" /> | 60 | + <TextView |
61 | + android:id="@+id/tvZhuanFaNums" | ||
62 | + style="@style/TextView_Wrap_16" | ||
63 | + android:layout_alignParentRight="true" | ||
64 | + android:layout_centerVertical="true" | ||
65 | + android:text="转发:50" | ||
66 | + android:textSize="@dimen/textSize14" /> | ||
67 | + </RelativeLayout> | ||
61 | </FrameLayout> | 68 | </FrameLayout> |
69 | + | ||
62 | </LinearLayout> | 70 | </LinearLayout> |
63 | 71 | ||
64 | <ImageView | 72 | <ImageView |
65 | - android:layout_margin="@dimen/size_dp_2" | ||
66 | android:id="@+id/iv_consult" | 73 | android:id="@+id/iv_consult" |
67 | android:layout_width="0dp" | 74 | android:layout_width="0dp" |
68 | android:layout_height="match_parent" | 75 | android:layout_height="match_parent" |
76 | + android:layout_margin="@dimen/size_dp_2" | ||
69 | android:layout_weight="2" | 77 | android:layout_weight="2" |
70 | android:src="@color/xueqing_blue" /> | 78 | android:src="@color/xueqing_blue" /> |
71 | </LinearLayout> | 79 | </LinearLayout> |