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 | 64 | android:name="com.amap.api.v2.apikey" | 
| 65 | 65 | android:value="1d130afb822d8a1019e6592cbaf10bcc" /> | 
| 66 | 66 | |
| 67 | - <activity android:name=".ui.MainActivity"> | |
| 67 | + <activity android:name=".ui.activity.LoginAndRegistActivity"> | |
| 68 | 68 | <intent-filter> | 
| 69 | 69 | <action android:name="android.intent.action.MAIN" /> | 
| 70 | 70 | |
| 71 | 71 | <category android:name="android.intent.category.LAUNCHER" /> | 
| 72 | 72 | </intent-filter> | 
| 73 | 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 | 78 | <activity | 
| 79 | 79 | android:name=".ui.activity.MyChildActivity" | 
| 80 | 80 | android:screenOrientation="portrait" /> | 
| ... | ... | @@ -94,9 +94,9 @@ | 
| 94 | 94 | android:name=".ui.activity.binding.SelectSchoolActivity" | 
| 95 | 95 | android:screenOrientation="portrait" | 
| 96 | 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 | 100 | <activity | 
| 101 | 101 | android:name=".ui.activity.PersonInfoActivity" | 
| 102 | 102 | android:screenOrientation="portrait" | ... | ... | 
app/src/main/java/com/shunzhi/parent/adapter/ContextAdapter.java
0 → 100644
| ... | ... | @@ -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 | 3 | import com.google.gson.JsonObject; | 
| 4 | 4 | |
| 5 | 5 | import io.reactivex.Observable; | 
| 6 | +import retrofit2.http.Field; | |
| 7 | +import retrofit2.http.FormUrlEncoded; | |
| 6 | 8 | import retrofit2.http.GET; | 
| 9 | +import retrofit2.http.POST; | |
| 7 | 10 | import retrofit2.http.Query; | 
| 8 | 11 | |
| 9 | 12 | /** | 
| ... | ... | @@ -12,9 +15,13 @@ import retrofit2.http.Query; | 
| 12 | 15 | |
| 13 | 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 @@ | 
| 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 @@ | 
| 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 @@ | 
| 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 | 7 | import com.share.mvpsdk.base.IBaseFragment; | 
| 8 | 8 | import com.share.mvpsdk.base.IBaseModel; | 
| 9 | 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 | 13 | import java.util.List; | 
| 12 | 14 | |
| ... | ... | @@ -18,23 +20,31 @@ import io.reactivex.Observable; | 
| 18 | 20 | |
| 19 | 21 | public interface ConsultContract { | 
| 20 | 22 | |
| 21 | - abstract class ConsultPresenter extends BasePresenter<IConsultModel,IConsultView>{ | |
| 23 | + abstract class ConsultPresenter extends BasePresenter<IConsultModel, IConsultView> { | |
| 22 | 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 | 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 | 41 | void showTools(); | 
| 36 | 42 | |
| 37 | 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 | 21 | abstract class ConsultOnePresenter extends BasePresenter<IConsultOneModel,IConsultOneView>{ | 
| 22 | 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 | 29 | interface IConsultOneModel extends IBaseModel{ | 
| 30 | 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 | 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 | import com.share.mvpsdk.helper.RxHelper; | 
| 7 | 7 | import com.shunzhi.parent.AppConfig; | 
| 8 | 8 | import com.shunzhi.parent.api.Consult; | 
| 9 | +import com.shunzhi.parent.api.LoginRegisterApi; | |
| 10 | +import com.shunzhi.parent.bean.UserInfo; | |
| 9 | 11 | import com.shunzhi.parent.contract.consult.ConsultContract; | 
| 10 | 12 | |
| 11 | 13 | import io.reactivex.Observable; | 
| ... | ... | @@ -23,9 +25,17 @@ public class ConsultModel extends BaseModel implements ConsultContract.IConsultM | 
| 23 | 25 | } | 
| 24 | 26 | |
| 25 | 27 | @Override | 
| 26 | - public Observable<JsonObject> getBanners(String position) { | |
| 28 | + public Observable<JsonObject> getBanners(String position,String areaName) { | |
| 27 | 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 | 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 | 27 | } | 
| 28 | 28 | |
| 29 | 29 | @Override | 
| 30 | - public Observable<JsonObject> getBanners(String position) { | |
| 30 | + public Observable<JsonObject> getBanners(String position,String areaName) { | |
| 31 | 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 | 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 | 9 | import com.google.gson.Gson; | 
| 10 | 10 | import com.google.gson.JsonArray; | 
| 11 | 11 | import com.google.gson.JsonObject; | 
| 12 | +import com.share.mvpsdk.utils.OkHttpExceptionUtil; | |
| 12 | 13 | import com.share.mvpsdk.utils.ToastUtils; | 
| 13 | 14 | import com.shunzhi.parent.R; | 
| 14 | 15 | import com.shunzhi.parent.bean.GuangGaoBean; | 
| 15 | 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 | 20 | import com.shunzhi.parent.contract.consult.ConsultContract; | 
| 17 | 21 | import com.shunzhi.parent.model.consult.ConsultModel; | 
| 18 | 22 | import com.shunzhi.parent.ui.activity.consult.ConsultOneLevelActivity; | 
| 19 | 23 | import com.shunzhi.parent.util.AttrsUtils; | 
| 20 | 24 | import com.shunzhi.parent.views.TextAndImgShowView; | 
| 21 | 25 | |
| 26 | +import org.json.JSONObject; | |
| 27 | + | |
| 22 | 28 | import java.util.ArrayList; | 
| 23 | 29 | import java.util.List; | 
| 24 | 30 | |
| 25 | 31 | import io.reactivex.functions.Consumer; | 
| 32 | +import retrofit2.HttpException; | |
| 26 | 33 | |
| 27 | 34 | /** | 
| 28 | 35 | * Created by ToaHanDong on 2018/3/14. | 
| ... | ... | @@ -31,18 +38,18 @@ import io.reactivex.functions.Consumer; | 
| 31 | 38 | public class ConsultPresenter extends ConsultContract.ConsultPresenter { | 
| 32 | 39 | @Override | 
| 33 | 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 | 46 | for (int i = 0; i < toolBeanList.size(); i++) { | 
| 40 | - TextAndImgShowView textAndImgShowView=new TextAndImgShowView(mIView.getBindActivity()); | |
| 47 | + TextAndImgShowView textAndImgShowView = new TextAndImgShowView(mIView.getBindActivity()); | |
| 41 | 48 | textAndImgShowView.setTextColor(R.color.textColor); | 
| 42 | 49 | textAndImgShowView.setText(toolBeanList.get(i).toolName); | 
| 43 | 50 | textAndImgShowView.setImgs(R.drawable.play, Integer.parseInt(toolBeanList.get(i).toolImage)); | 
| 44 | 51 | textAndImgShowView.setSelect(true); | 
| 45 | - textAndImgShowView.setWidth(mIView.getBindActivity(),layout_control); | |
| 52 | + textAndImgShowView.setWidth(mIView.getBindActivity(), layout_control); | |
| 46 | 53 | textAndImgShowView.setBackground(AttrsUtils.getAttrs(mIView.getBindActivity()).getDrawable(0)); | 
| 47 | 54 | textAndImgShowView.setOnClickListener(new View.OnClickListener() { | 
| 48 | 55 | @Override | 
| ... | ... | @@ -56,29 +63,58 @@ public class ConsultPresenter extends ConsultContract.ConsultPresenter { | 
| 56 | 63 | } | 
| 57 | 64 | |
| 58 | 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 | 69 | @Override | 
| 63 | 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 | 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 | 76 | guangGaoBeanList.add(guangGaoBean); | 
| 70 | 77 | } | 
| 71 | 78 | mIView.showBanners(guangGaoBeanList); | 
| 72 | - }else { | |
| 79 | + } else { | |
| 73 | 80 | ToastUtils.showToast(jsonObject.get("message").getAsString()); | 
| 74 | 81 | } | 
| 75 | 82 | } | 
| 76 | 83 | }, new Consumer<Throwable>() { | 
| 77 | 84 | @Override | 
| 78 | 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 | 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 | 54 | } | 
| 55 | 55 | |
| 56 | 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 | 59 | @Override | 
| 60 | 60 | public void accept(JsonObject jsonObject) throws Exception { | 
| 61 | 61 | if (jsonObject.get("status").getAsString().equals("1")){ | 
| ... | ... | @@ -79,10 +79,11 @@ public class ConsultOnePresenter extends ConsultOneContract.ConsultOnePresenter{ | 
| 79 | 79 | } | 
| 80 | 80 | |
| 81 | 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 | 87 | @Override | 
| 87 | 88 | public ConsultOneContract.IConsultOneModel getModel() { | 
| 88 | 89 | return ConsultOneModel.newInstance(); | ... | ... | 
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
| ... | ... | @@ -7,6 +7,8 @@ import android.content.IntentFilter; | 
| 7 | 7 | import android.os.Bundle; | 
| 8 | 8 | import android.support.annotation.NonNull; | 
| 9 | 9 | import android.support.annotation.Nullable; | 
| 10 | +import android.support.v7.widget.LinearLayoutManager; | |
| 11 | +import android.support.v7.widget.RecyclerView; | |
| 10 | 12 | import android.view.View; | 
| 11 | 13 | import android.widget.ImageView; | 
| 12 | 14 | import android.widget.LinearLayout; | 
| ... | ... | @@ -18,9 +20,15 @@ import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | 
| 18 | 20 | import com.shunzhi.parent.AppConfig; | 
| 19 | 21 | import com.shunzhi.parent.AppContext; | 
| 20 | 22 | import com.shunzhi.parent.R; | 
| 23 | +import com.shunzhi.parent.adapter.ContextAdapter; | |
| 21 | 24 | import com.shunzhi.parent.bean.GuangGaoBean; | 
| 25 | +import com.shunzhi.parent.bean.channel.ChannelBean; | |
| 26 | +import com.shunzhi.parent.bean.channel.ChannelContextBean; | |
| 22 | 27 | import com.shunzhi.parent.contract.consult.ConsultContract; | 
| 23 | 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 | 32 | import com.stx.xhb.xbanner.XBanner; | 
| 25 | 33 | |
| 26 | 34 | import java.io.ByteArrayOutputStream; | 
| ... | ... | @@ -33,15 +41,20 @@ import cn.jzvd.JZVideoPlayerStandard; | 
| 33 | 41 | import me.leefeng.citypicker.CityPicker; | 
| 34 | 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 | 47 | ImageView ivSearch; | 
| 40 | 48 | |
| 41 | 49 | XBanner xBanner; | 
| 42 | 50 | |
| 51 | + RecyclerView recycler_context; | |
| 52 | + | |
| 53 | + ContextAdapter contextAdapter; | |
| 54 | + | |
| 43 | 55 | List<String> imgesUrl = new ArrayList<>(); | 
| 44 | 56 | List<String> describeList = new ArrayList<>(); | 
| 57 | + List<ChannelContextBean> contextList = new ArrayList<>(); | |
| 45 | 58 | |
| 46 | 59 | JZVideoPlayerStandard videoplayer; | 
| 47 | 60 | |
| ... | ... | @@ -49,8 +62,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | 
| 49 | 62 | |
| 50 | 63 | LinearLayout layout_control; | 
| 51 | 64 | |
| 52 | - CityPicker cityPicker=null; | |
| 53 | - | |
| 65 | + CityPicker cityPicker = null; | |
| 66 | + | |
| 54 | 67 | @Override | 
| 55 | 68 | public int getLayoutId() { | 
| 56 | 69 | return R.layout.fragment_zi_xun; | 
| ... | ... | @@ -59,25 +72,36 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | 
| 59 | 72 | @Override | 
| 60 | 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 | 79 | ivSearch = view.findViewById(R.id.ivSearch); | 
| 63 | 80 | xBanner = view.findViewById(R.id.xBanner); | 
| 64 | 81 | videoplayer = view.findViewById(R.id.videoplayer); | 
| 65 | 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 | 85 | tvLocalAddress.setText(AppContext.getInstance().cityName); | 
| 69 | 86 | videoplayer.batteryLevel.setVisibility(View.GONE); | 
| 70 | 87 | videoplayer.replayTextView.setVisibility(View.GONE); | 
| 71 | 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 | 94 | initBroadCast(); | 
| 77 | 95 | |
| 78 | 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 | 105 | private void initListeners() { | 
| 82 | 106 | ivSearch.setOnClickListener(this); | 
| 83 | 107 | tvLocalAddress.setOnClickListener(this); | 
| ... | ... | @@ -118,8 +142,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | 
| 118 | 142 | switch (view.getId()) { | 
| 119 | 143 | case R.id.tvLocalAddress: | 
| 120 | 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 | 147 | else cityPicker.show(); | 
| 124 | 148 | break; | 
| 125 | 149 | case R.id.ivSearch://搜索按钮 | 
| ... | ... | @@ -149,8 +173,8 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | 
| 149 | 173 | @Override | 
| 150 | 174 | public void onDestroy() { | 
| 151 | 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 | 180 | @Override | 
| ... | ... | @@ -161,13 +185,47 @@ public class ConsultFragment extends BaseMVPCompatFragment<ConsultContract.Consu | 
| 161 | 185 | @Override | 
| 162 | 186 | public void showBanners(List<GuangGaoBean> guangGaoBeanList) { | 
| 163 | 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 | 189 | describeList.add(guangGaoBeanList.get(i).describe); | 
| 166 | 190 | } | 
| 167 | 191 | initBanners(); | 
| 168 | 192 | } | 
| 169 | 193 | |
| 170 | 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 | 229 | public void getCity(String name) { | 
| 172 | 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 | 14 | import com.shunzhi.parent.AppConfig; | 
| 15 | 15 | import com.shunzhi.parent.R; | 
| 16 | 16 | import com.shunzhi.parent.bean.GuangGaoBean; | 
| 17 | +import com.shunzhi.parent.bean.channel.ChannelBean; | |
| 18 | +import com.shunzhi.parent.bean.channel.ChannelContextBean; | |
| 17 | 19 | import com.shunzhi.parent.contract.consult.ConsultContract; | 
| 18 | 20 | import com.shunzhi.parent.presenter.consult.ConsultPresenter; | 
| 19 | 21 | import com.shunzhi.parent.ui.MainActivity; | 
| ... | ... | @@ -36,9 +38,9 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | 
| 36 | 38 | public void initUI(View view, @Nullable Bundle savedInstanceState) { | 
| 37 | 39 | xBanner = view.findViewById(R.id.xBanner); | 
| 38 | 40 | if (!TextUtils.isEmpty(AppConfig.getAppConfig(getContext()).get(AppConfig.APP_IS_START))) { | 
| 39 | - mPresenter.getBanners("0"); | |
| 41 | + mPresenter.getBanners("0","杭州"); | |
| 40 | 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 | 46 | @NonNull | 
| ... | ... | @@ -57,6 +59,16 @@ public class StartFragment extends BaseMVPCompatFragment<ConsultContract.Consult | 
| 57 | 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 | 72 | private void initBannes(List<GuangGaoBean> guangGaoBeanList) { | 
| 61 | 73 | final List<String> imgUrl = new ArrayList<>(); | 
| 62 | 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 | 81 | recyclerViewGrally = view.findViewById(R.id.recyclerViewGrally); | 
| 82 | 82 | recyclerViewConsultOne = view.findViewById(R.id.recyclerViewConsultOne); | 
| 83 | 83 | |
| 84 | - mPresenter.getBanners("3"); | |
| 84 | + mPresenter.getBanners("3","杭州"); | |
| 85 | 85 | initRecyclerViewConsult(); | 
| 86 | 86 | } | 
| 87 | 87 | ... | ... | 
app/src/main/res/layout/fragment_zi_xun.xml
| ... | ... | @@ -31,14 +31,23 @@ | 
| 31 | 31 | android:orientation="vertical"> | 
| 32 | 32 | |
| 33 | 33 | <TextView | 
| 34 | - android:layout_width="wrap_content" | |
| 34 | + android:layout_width="match_parent" | |
| 35 | 35 | android:layout_height="wrap_content" | 
| 36 | 36 | android:text="@string/consult_huati" | 
| 37 | 37 | android:textColor="@color/xueqing_blue" | 
| 38 | 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 | 51 | </LinearLayout> | 
| 43 | 52 | |
| 44 | 53 | ... | ... | 
app/src/main/res/layout/layout_consult_content.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> | 
| 2 | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 
| 3 | 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 | 7 | <LinearLayout | 
| 7 | 8 | android:layout_width="match_parent" | 
| 8 | 9 | android:layout_height="match_parent" | 
| ... | ... | @@ -45,27 +46,34 @@ | 
| 45 | 46 | android:layout_height="wrap_content" | 
| 46 | 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 | 68 | </FrameLayout> | 
| 69 | + | |
| 62 | 70 | </LinearLayout> | 
| 63 | 71 | |
| 64 | 72 | <ImageView | 
| 65 | - android:layout_margin="@dimen/size_dp_2" | |
| 66 | 73 | android:id="@+id/iv_consult" | 
| 67 | 74 | android:layout_width="0dp" | 
| 68 | 75 | android:layout_height="match_parent" | 
| 76 | + android:layout_margin="@dimen/size_dp_2" | |
| 69 | 77 | android:layout_weight="2" | 
| 70 | 78 | android:src="@color/xueqing_blue" /> | 
| 71 | 79 | </LinearLayout> | ... | ... |