Commit 7b8a1324a006bb169d780cd0c515f47f459409d1
1 parent
54e1430c
约跑线路接口对接,增加下拉刷新,下拉加载更多,增加错误页面
Showing
20 changed files
with
573 additions
and
93 deletions
lib_network/src/main/java/com/cnlive/strike/data/network/api/ApiServiceDaren.java
| @@ -7,9 +7,10 @@ import com.cnlive.strike.data.network.model.CheckTransferInfo; | @@ -7,9 +7,10 @@ import com.cnlive.strike.data.network.model.CheckTransferInfo; | ||
| 7 | import com.cnlive.strike.data.network.model.DarenApplyModel; | 7 | import com.cnlive.strike.data.network.model.DarenApplyModel; |
| 8 | import com.cnlive.strike.data.network.model.GifEmojiItemData; | 8 | import com.cnlive.strike.data.network.model.GifEmojiItemData; |
| 9 | import com.cnlive.strike.data.network.model.GifListData; | 9 | import com.cnlive.strike.data.network.model.GifListData; |
| 10 | -import com.cnlive.strike.data.network.model.RaceRecordInfo; | 10 | +import com.cnlive.strike.data.network.model.runAbout.RaceRecordInfo; |
| 11 | import com.cnlive.strike.data.network.model.ShortLinkInfo; | 11 | import com.cnlive.strike.data.network.model.ShortLinkInfo; |
| 12 | -import com.cnlive.strike.data.network.model.TakePartPeopleInfo; | 12 | +import com.cnlive.strike.data.network.model.runAbout.RunLineInfo; |
| 13 | +import com.cnlive.strike.data.network.model.runAbout.TakePartPeopleInfo; | ||
| 13 | import com.cnlive.strike.data.network.model.runAbout.RunRaceDetailInfo; | 14 | import com.cnlive.strike.data.network.model.runAbout.RunRaceDetailInfo; |
| 14 | 15 | ||
| 15 | import java.util.List; | 16 | import java.util.List; |
| @@ -118,5 +119,12 @@ public interface ApiServiceDaren { | @@ -118,5 +119,12 @@ public interface ApiServiceDaren { | ||
| 118 | */ | 119 | */ |
| 119 | @GET("Daren/event/getEventDetails.action") | 120 | @GET("Daren/event/getEventDetails.action") |
| 120 | Observable<Result<BaseInfo<RunRaceDetailInfo>>> getRunRaceDetail(@QueryMap Map<String, String> map); | 121 | Observable<Result<BaseInfo<RunRaceDetailInfo>>> getRunRaceDetail(@QueryMap Map<String, String> map); |
| 122 | + | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * 约跑线路列表 | ||
| 126 | + */ | ||
| 127 | + @POST("Daren/event/getEventList.action") | ||
| 128 | + Observable<Result<BaseInfo<RunLineInfo>>> getRunLineListInfo(@QueryMap() Map<String, String> maps); | ||
| 121 | } | 129 | } |
| 122 | 130 |
lib_network/src/main/java/com/cnlive/strike/data/network/model/RaceRecordInfo.java renamed to lib_network/src/main/java/com/cnlive/strike/data/network/model/runAbout/RaceRecordInfo.java
lib_network/src/main/java/com/cnlive/strike/data/network/model/runAbout/RunLineInfo.java
0 → 100644
| 1 | +package com.cnlive.strike.data.network.model.runAbout; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Created by hanyayun 019/06/14. | ||
| 7 | + */ | ||
| 8 | +public class RunLineInfo { | ||
| 9 | + | ||
| 10 | + /** | ||
| 11 | + * hasNext : false | ||
| 12 | + * list : [{"address":"巴彦浩特体育场","end_time":1536894000000,"faceUrl":[],"id":134,"signResult":false,"signupNum":0,"start_time":1536966000000,"title":"2018阿拉善旅游文化节·户外徒步大会 \u201c助力冬奥·阿拉善在行动\u201d"},{"address":"内蒙古阿拉善左旗巴彦浩特体育场","end_time":1536980400000,"faceUrl":[],"id":133,"signResult":false,"signupNum":0,"start_time":1536966000000,"title":"2018阿拉善旅游文化节·阿拉善半程马拉松\u201c助力冬奥·阿拉善在行动\u201d"},{"address":"东莞市同沙生态公园","end_time":1524366000000,"faceUrl":[],"id":132,"signResult":false,"signupNum":0,"start_time":1524355200000,"title":"2018东莞市东城旅游节暨世界大众体育杯·粤港澳大湾区(东莞)户外徒步大会"},{"address":"青海湖","end_time":1472632140000,"faceUrl":[],"id":119,"signResult":false,"signupNum":0,"start_time":1472455620000,"title":"2016第三届环青海湖国际电动汽车拉力赛"},{"address":"北京长阳","end_time":1498719300000,"faceUrl":[],"id":118,"signResult":false,"signupNum":0,"start_time":1498546380000,"title":"2017北京长阳全城热跑赛火力全开"},{"address":"内蒙古鄂尔多斯市准格尔旗","end_time":1565697600000,"faceUrl":[],"id":117,"mileage":"全长4.43公里","signResult":false,"signupNum":0,"start_time":1502409600000,"title":"世界大众体育杯 · 2017准格尔国际徒步大会"},{"address":"澳大利亚黄金海岸","end_time":1571140800000,"faceUrl":["http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557039035723_small.jpg","http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557034319038_small.jpg","http://yweb0.cnliveimg.com/images/headImg/2018/0902/1535858459612_small.jpg"],"id":116,"mileage":"全长4.42公里","signResult":true,"signupNum":3,"start_time":1522454400000,"title":"2018国际网络徒步大赛黄金海岸站"},{"address":"内蒙古阿拉善左旗巴彦浩特体育场","end_time":1536894000000,"faceUrl":[],"id":135,"signResult":false,"signupNum":0,"start_time":1536966000000,"title":"2018阿拉善旅游文化节·户外徒步大会 \u201c助力冬奥·阿拉善在行动\u201d"}] | ||
| 13 | + * pageNumber : 1 | ||
| 14 | + * pageSize : 10 | ||
| 15 | + * startIndex : 0 | ||
| 16 | + * totalPage : 1 | ||
| 17 | + * totalRecord : 8 | ||
| 18 | + */ | ||
| 19 | + | ||
| 20 | + private boolean hasNext; | ||
| 21 | + private int pageNumber; | ||
| 22 | + private int pageSize; | ||
| 23 | + private int startIndex; | ||
| 24 | + private int totalPage; | ||
| 25 | + private int totalRecord; | ||
| 26 | + private List<ListBean> list; | ||
| 27 | + | ||
| 28 | + public boolean isHasNext() { | ||
| 29 | + return hasNext; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public void setHasNext(boolean hasNext) { | ||
| 33 | + this.hasNext = hasNext; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public int getPageNumber() { | ||
| 37 | + return pageNumber; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public void setPageNumber(int pageNumber) { | ||
| 41 | + this.pageNumber = pageNumber; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public int getPageSize() { | ||
| 45 | + return pageSize; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public void setPageSize(int pageSize) { | ||
| 49 | + this.pageSize = pageSize; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public int getStartIndex() { | ||
| 53 | + return startIndex; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public void setStartIndex(int startIndex) { | ||
| 57 | + this.startIndex = startIndex; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public int getTotalPage() { | ||
| 61 | + return totalPage; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public void setTotalPage(int totalPage) { | ||
| 65 | + this.totalPage = totalPage; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public int getTotalRecord() { | ||
| 69 | + return totalRecord; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public void setTotalRecord(int totalRecord) { | ||
| 73 | + this.totalRecord = totalRecord; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public List<ListBean> getList() { | ||
| 77 | + return list; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public void setList(List<ListBean> list) { | ||
| 81 | + this.list = list; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public static class ListBean { | ||
| 85 | + /** | ||
| 86 | + * address : 巴彦浩特体育场 | ||
| 87 | + * end_time : 1536894000000 | ||
| 88 | + * faceUrl : [] | ||
| 89 | + * id : 134 | ||
| 90 | + * signResult : false | ||
| 91 | + * signupNum : 0 | ||
| 92 | + * start_time : 1536966000000 | ||
| 93 | + * title : 2018阿拉善旅游文化节·户外徒步大会 “助力冬奥·阿拉善在行动” | ||
| 94 | + * mileage : 全长4.43公里 | ||
| 95 | + */ | ||
| 96 | + | ||
| 97 | + private String address; | ||
| 98 | + private long end_time; | ||
| 99 | + private int id; | ||
| 100 | + private boolean signResult; | ||
| 101 | + private int signupNum; | ||
| 102 | + private long start_time; | ||
| 103 | + private String title; | ||
| 104 | + private String mileage; | ||
| 105 | + private List<String> faceUrl; | ||
| 106 | + | ||
| 107 | + public String getAddress() { | ||
| 108 | + return address; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + public void setAddress(String address) { | ||
| 112 | + this.address = address; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + public long getEnd_time() { | ||
| 116 | + return end_time; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + public void setEnd_time(long end_time) { | ||
| 120 | + this.end_time = end_time; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public int getId() { | ||
| 124 | + return id; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public void setId(int id) { | ||
| 128 | + this.id = id; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public boolean isSignResult() { | ||
| 132 | + return signResult; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public void setSignResult(boolean signResult) { | ||
| 136 | + this.signResult = signResult; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public int getSignupNum() { | ||
| 140 | + return signupNum; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public void setSignupNum(int signupNum) { | ||
| 144 | + this.signupNum = signupNum; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public long getStart_time() { | ||
| 148 | + return start_time; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + public void setStart_time(long start_time) { | ||
| 152 | + this.start_time = start_time; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public String getTitle() { | ||
| 156 | + return title; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public void setTitle(String title) { | ||
| 160 | + this.title = title; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public String getMileage() { | ||
| 164 | + return mileage; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + public void setMileage(String mileage) { | ||
| 168 | + this.mileage = mileage; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public List<String> getFaceUrl() { | ||
| 172 | + return faceUrl; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + public void setFaceUrl(List<String> faceUrl) { | ||
| 176 | + this.faceUrl = faceUrl; | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | +} |
lib_network/src/main/java/com/cnlive/strike/data/network/model/TakePartPeopleInfo.java renamed to lib_network/src/main/java/com/cnlive/strike/data/network/model/runAbout/TakePartPeopleInfo.java
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RaceRecorPresenter.java
| 1 | package com.cnlive.moudle.pedometer.frame.presenter; | 1 | package com.cnlive.moudle.pedometer.frame.presenter; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | -import android.widget.Toast; | ||
| 5 | 4 | ||
| 6 | import com.cnlive.libs.base.logic.Logic; | 5 | import com.cnlive.libs.base.logic.Logic; |
| 7 | import com.cnlive.libs.base.logic.callback.DataCallback; | 6 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| @@ -11,7 +10,7 @@ import com.cnlive.moudle.pedometer.frame.view.RaceRecorView; | @@ -11,7 +10,7 @@ import com.cnlive.moudle.pedometer.frame.view.RaceRecorView; | ||
| 11 | import com.cnlive.strike.data.network.api.ApiRequest; | 10 | import com.cnlive.strike.data.network.api.ApiRequest; |
| 12 | import com.cnlive.strike.data.network.api.ApiServiceDaren; | 11 | import com.cnlive.strike.data.network.api.ApiServiceDaren; |
| 13 | import com.cnlive.strike.data.network.model.BaseInfo; | 12 | import com.cnlive.strike.data.network.model.BaseInfo; |
| 14 | -import com.cnlive.strike.data.network.model.RaceRecordInfo; | 13 | +import com.cnlive.strike.data.network.model.runAbout.RaceRecordInfo; |
| 15 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | 14 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 16 | 15 | ||
| 17 | import java.util.HashMap; | 16 | import java.util.HashMap; |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunLinePresenter.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.frame.presenter; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | + | ||
| 5 | +import com.cnlive.libs.base.logic.Logic; | ||
| 6 | +import com.cnlive.libs.base.logic.callback.DataCallback; | ||
| 7 | +import com.cnlive.libs.base.logic.callback.FailureCallback; | ||
| 8 | +import com.cnlive.libs.base.logic.callback.SuccessCallback; | ||
| 9 | +import com.cnlive.moudle.pedometer.frame.view.RunLineView; | ||
| 10 | +import com.cnlive.strike.data.network.api.ApiRequest; | ||
| 11 | +import com.cnlive.strike.data.network.api.ApiServiceDaren; | ||
| 12 | +import com.cnlive.strike.data.network.model.BaseInfo; | ||
| 13 | +import com.cnlive.strike.data.network.model.runAbout.RaceRecordInfo; | ||
| 14 | +import com.cnlive.strike.data.network.model.runAbout.RunLineInfo; | ||
| 15 | +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | ||
| 16 | + | ||
| 17 | +import java.util.HashMap; | ||
| 18 | +import java.util.Map; | ||
| 19 | + | ||
| 20 | +import io.reactivex.disposables.Disposable; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Created by hanyayun 019/06/14. | ||
| 24 | + */ | ||
| 25 | +public class RunLinePresenter extends MvpBasePresenter<RunLineView> { | ||
| 26 | + | ||
| 27 | + public void setData(Context context,String sid, int pageNo, int pageSize){ | ||
| 28 | + HashMap<String, String> map = new HashMap<>(); | ||
| 29 | + map.put("sid", sid); | ||
| 30 | + map.put("pageNo", pageNo+""); | ||
| 31 | + map.put("pageSize", pageSize+""); | ||
| 32 | + getView().showLoading(); | ||
| 33 | + Logic.create(map).action(new Logic.Action<Map<String, String>, BaseInfo<RunLineInfo>>() { | ||
| 34 | + @Override | ||
| 35 | + public Disposable action(Map<String, String> stringStringMap, DataCallback<BaseInfo<RunLineInfo>> dataCallback) { | ||
| 36 | + return ApiRequest.observable(ApiServiceDaren.class, api -> api.getRunLineListInfo(stringStringMap)).subscribe(context, dataCallback); | ||
| 37 | + } | ||
| 38 | + }).<BaseInfo<RunLineInfo>>event().setFailureCallback(new FailureCallback() { | ||
| 39 | + @Override | ||
| 40 | + public void onFailure(int code, String message) { | ||
| 41 | + if (getView() != null) { | ||
| 42 | + getView().showErr(message); | ||
| 43 | + getView().hideLoading(); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + }).setSuccessCallback(new SuccessCallback<BaseInfo<RunLineInfo>>() { | ||
| 47 | + @Override | ||
| 48 | + public void onSuccess(BaseInfo<RunLineInfo> registerInfo) { | ||
| 49 | + if (getView() != null){ | ||
| 50 | + getView().onSuccess(registerInfo); | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + }).start(); | ||
| 54 | + } | ||
| 55 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/TakePartPresenter.java
| @@ -8,11 +8,9 @@ import com.cnlive.libs.base.logic.callback.FailureCallback; | @@ -8,11 +8,9 @@ import com.cnlive.libs.base.logic.callback.FailureCallback; | ||
| 8 | import com.cnlive.libs.base.logic.callback.SuccessCallback; | 8 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 9 | import com.cnlive.moudle.pedometer.frame.view.TakePartView; | 9 | import com.cnlive.moudle.pedometer.frame.view.TakePartView; |
| 10 | import com.cnlive.strike.data.network.api.ApiRequest; | 10 | import com.cnlive.strike.data.network.api.ApiRequest; |
| 11 | -import com.cnlive.strike.data.network.api.ApiServiceCms; | ||
| 12 | import com.cnlive.strike.data.network.api.ApiServiceDaren; | 11 | import com.cnlive.strike.data.network.api.ApiServiceDaren; |
| 13 | -import com.cnlive.strike.data.network.model.AudioAlbumDetailsInfo; | ||
| 14 | import com.cnlive.strike.data.network.model.BaseInfo; | 12 | import com.cnlive.strike.data.network.model.BaseInfo; |
| 15 | -import com.cnlive.strike.data.network.model.TakePartPeopleInfo; | 13 | +import com.cnlive.strike.data.network.model.runAbout.TakePartPeopleInfo; |
| 16 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | 14 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 17 | 15 | ||
| 18 | import java.util.HashMap; | 16 | import java.util.HashMap; |
| @@ -25,11 +23,12 @@ import io.reactivex.disposables.Disposable; | @@ -25,11 +23,12 @@ import io.reactivex.disposables.Disposable; | ||
| 25 | */ | 23 | */ |
| 26 | public class TakePartPresenter extends MvpBasePresenter<TakePartView> { | 24 | public class TakePartPresenter extends MvpBasePresenter<TakePartView> { |
| 27 | 25 | ||
| 28 | - public void setData(Context context,String eventId, long pageNo, long pageSize){ | 26 | + public void setData(Context context,String eventId, long pageNo,long pageSize){ |
| 29 | HashMap<String, String> map = new HashMap<>(); | 27 | HashMap<String, String> map = new HashMap<>(); |
| 30 | map.put("eventId", eventId); | 28 | map.put("eventId", eventId); |
| 31 | map.put("pageNo", pageNo+""); | 29 | map.put("pageNo", pageNo+""); |
| 32 | map.put("pageSize", pageSize+""); | 30 | map.put("pageSize", pageSize+""); |
| 31 | + if (getView() != null && pageNo ==1) getView().showLoading(); | ||
| 33 | Logic.create(map).action(new Logic.Action<Map<String, String>, BaseInfo<TakePartPeopleInfo>>() { | 32 | Logic.create(map).action(new Logic.Action<Map<String, String>, BaseInfo<TakePartPeopleInfo>>() { |
| 34 | @Override | 33 | @Override |
| 35 | public Disposable action(Map<String, String> stringStringMap, DataCallback<BaseInfo<TakePartPeopleInfo>> dataCallback) { | 34 | public Disposable action(Map<String, String> stringStringMap, DataCallback<BaseInfo<TakePartPeopleInfo>> dataCallback) { |
| @@ -38,7 +37,10 @@ public class TakePartPresenter extends MvpBasePresenter<TakePartView> { | @@ -38,7 +37,10 @@ public class TakePartPresenter extends MvpBasePresenter<TakePartView> { | ||
| 38 | }).<BaseInfo<TakePartPeopleInfo>>event().setFailureCallback(new FailureCallback() { | 37 | }).<BaseInfo<TakePartPeopleInfo>>event().setFailureCallback(new FailureCallback() { |
| 39 | @Override | 38 | @Override |
| 40 | public void onFailure(int code, String message) { | 39 | public void onFailure(int code, String message) { |
| 41 | - if (getView() != null) getView().showErr(message); | 40 | + if (getView() != null) { |
| 41 | + getView().showErr(message); | ||
| 42 | + getView().hideLoading(); | ||
| 43 | + } | ||
| 42 | } | 44 | } |
| 43 | }).setSuccessCallback(new SuccessCallback<BaseInfo<TakePartPeopleInfo>>() { | 45 | }).setSuccessCallback(new SuccessCallback<BaseInfo<TakePartPeopleInfo>>() { |
| 44 | @Override | 46 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/MyRecordView.java
| @@ -31,15 +31,15 @@ public class MyRecordView implements MvpView { | @@ -31,15 +31,15 @@ public class MyRecordView implements MvpView { | ||
| 31 | list.add("fff"); | 31 | list.add("fff"); |
| 32 | list.add("fff"); | 32 | list.add("fff"); |
| 33 | list.add("fff"); | 33 | list.add("fff"); |
| 34 | - MyRecordAdapter myRecordAdapter = new MyRecordAdapter(list,fragment.getActivity(),true); | ||
| 35 | - fragment.binding.myRecordRecy.setAdapter(myRecordAdapter); | ||
| 36 | - myRecordAdapter.setClickListener(new MyRecordAdapter.OnClickListener() { | ||
| 37 | - @Override | ||
| 38 | - public void onClickListener(String msg, int position) { | ||
| 39 | - Intent intent = new Intent(fragment.getActivity(), RunRaceDetailActivity.class); | ||
| 40 | - fragment.getActivity().startActivity(intent); | ||
| 41 | - } | ||
| 42 | - }); | 34 | +// MyRecordAdapter myRecordAdapter = new MyRecordAdapter(list,fragment.getActivity(),true); |
| 35 | +// fragment.binding.myRecordRecy.setAdapter(myRecordAdapter); | ||
| 36 | +// myRecordAdapter.setClickListener(new MyRecordAdapter.OnClickListener() { | ||
| 37 | +// @Override | ||
| 38 | +// public void onClickListener(String msg, int position) { | ||
| 39 | +// Intent intent = new Intent(fragment.getActivity(), RunRaceDetailActivity.class); | ||
| 40 | +// fragment.getActivity().startActivity(intent); | ||
| 41 | +// } | ||
| 42 | +// }); | ||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | public void initView(){ | 45 | public void initView(){ |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RaceRecorView.java
| @@ -3,18 +3,14 @@ package com.cnlive.moudle.pedometer.frame.view; | @@ -3,18 +3,14 @@ package com.cnlive.moudle.pedometer.frame.view; | ||
| 3 | import android.support.v7.widget.LinearLayoutManager; | 3 | import android.support.v7.widget.LinearLayoutManager; |
| 4 | import android.view.View; | 4 | import android.view.View; |
| 5 | 5 | ||
| 6 | -import com.cnlive.libs.base.util.StatusBarUtil; | ||
| 7 | import com.cnlive.moudle.pedometer.ui.activity.ShareRecordActivity; | 6 | import com.cnlive.moudle.pedometer.ui.activity.ShareRecordActivity; |
| 8 | import com.cnlive.moudle.pedometer.ui.adapter.RaceRecordAdapter; | 7 | import com.cnlive.moudle.pedometer.ui.adapter.RaceRecordAdapter; |
| 9 | import com.cnlive.moudle.pedometer.ui.fragment.RaceRecorFragment; | 8 | import com.cnlive.moudle.pedometer.ui.fragment.RaceRecorFragment; |
| 10 | import com.cnlive.strike.data.network.model.BaseInfo; | 9 | import com.cnlive.strike.data.network.model.BaseInfo; |
| 11 | -import com.cnlive.strike.data.network.model.RaceRecordInfo; | 10 | +import com.cnlive.strike.data.network.model.runAbout.RaceRecordInfo; |
| 12 | import com.example.moudle_pedometer.R; | 11 | import com.example.moudle_pedometer.R; |
| 13 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 12 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 14 | 13 | ||
| 15 | -import java.util.ArrayList; | ||
| 16 | -import java.util.List; | ||
| 17 | - | ||
| 18 | /** | 14 | /** |
| 19 | * Created by hanyayun 019/05/30. | 15 | * Created by hanyayun 019/05/30. |
| 20 | */ | 16 | */ |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunLineView.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.frame.view; | ||
| 2 | + | ||
| 3 | +import android.content.Intent; | ||
| 4 | +import android.support.v7.widget.LinearLayoutManager; | ||
| 5 | +import android.view.View; | ||
| 6 | + | ||
| 7 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 8 | +import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity; | ||
| 9 | +import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity; | ||
| 10 | +import com.cnlive.moudle.pedometer.ui.adapter.MyRecordAdapter; | ||
| 11 | +import com.cnlive.moudle.pedometer.ui.fragment.RunLineFragment; | ||
| 12 | +import com.cnlive.strike.data.network.model.BaseInfo; | ||
| 13 | +import com.cnlive.strike.data.network.model.runAbout.RunLineInfo; | ||
| 14 | +import com.example.moudle_pedometer.R; | ||
| 15 | +import com.hannesdorfmann.mosby3.mvp.MvpView; | ||
| 16 | +import com.qmuiteam.qmui.widget.dialog.QMUITipDialog; | ||
| 17 | +import com.scwang.smartrefresh.layout.footer.ClassicsFooter; | ||
| 18 | +import com.scwang.smartrefresh.layout.header.ClassicsHeader; | ||
| 19 | + | ||
| 20 | +import java.util.ArrayList; | ||
| 21 | +import java.util.List; | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * Created by hanyayun 019/06/14. | ||
| 25 | + */ | ||
| 26 | +public class RunLineView implements MvpView { | ||
| 27 | + | ||
| 28 | + private RunLineFragment fragment; | ||
| 29 | + public QMUITipDialog loadingDiaog; | ||
| 30 | + private MyRecordAdapter adapter; | ||
| 31 | + private List<RunLineInfo.ListBean> list = new ArrayList<>(); | ||
| 32 | + | ||
| 33 | + public RunLineView(RunLineFragment fragment) { | ||
| 34 | + this.fragment = fragment; | ||
| 35 | + loadingDiaog = new QMUITipDialog.Builder(fragment.getActivity()) | ||
| 36 | + .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING) | ||
| 37 | + .setTipWord("请稍后") | ||
| 38 | + .create(); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + public void initView(){ | ||
| 42 | + fragment.binding.refreshLayout.setRefreshHeader(new ClassicsHeader(fragment.getActivity())); | ||
| 43 | + fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity())); | ||
| 44 | + fragment.binding.backBtn.setOnClickListener(v -> fragment.getActivity().finish()); | ||
| 45 | + fragment.binding.myActivity.setOnClickListener(v -> MyRecordActivity.newInstance(fragment.getActivity())); | ||
| 46 | + | ||
| 47 | + fragment.binding.runLineRecy.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public void onSuccess(BaseInfo<RunLineInfo> runLineInfoBaseInfo){ | ||
| 51 | + hideLoading(); | ||
| 52 | + if(fragment.currentPage == 1){ | ||
| 53 | + list.clear(); | ||
| 54 | + list.addAll(runLineInfoBaseInfo.getData().getList()); | ||
| 55 | + if(adapter == null){ | ||
| 56 | + adapter = new MyRecordAdapter(list,fragment.getActivity(),false); | ||
| 57 | + fragment.binding.runLineRecy.setAdapter(adapter); | ||
| 58 | + adapter.setClickListener(new MyRecordAdapter.OnClickListener() { | ||
| 59 | + @Override | ||
| 60 | + public void onClickListener(RunLineInfo.ListBean bean, int position) { | ||
| 61 | + RunRaceDetailActivity.startActivity(fragment.getActivity(),bean.getId()+""); | ||
| 62 | + } | ||
| 63 | + }); | ||
| 64 | + }else { | ||
| 65 | + adapter.notifyDataSetChanged(); | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + if(list.size() != 0){ | ||
| 70 | + fragment.binding.empty.setVisibility(View.GONE); | ||
| 71 | + fragment.binding.refreshLayout.setVisibility(View.VISIBLE); | ||
| 72 | + }else { | ||
| 73 | + showEmpty(); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + if(runLineInfoBaseInfo.getData().getList().size() < fragment.pageSize){ | ||
| 77 | + fragment.binding.refreshLayout.setEnableLoadMore(false); | ||
| 78 | + }else { | ||
| 79 | + fragment.binding.refreshLayout.setEnableLoadMore(true); | ||
| 80 | + } | ||
| 81 | + if(fragment.currentPage > 1){ | ||
| 82 | + list.addAll(runLineInfoBaseInfo.getData().getList()); | ||
| 83 | + adapter.notifyDataSetChanged(); | ||
| 84 | + } | ||
| 85 | + fragment.binding.refreshLayout.finishRefresh(); | ||
| 86 | + fragment.binding.refreshLayout.finishLoadMore(); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public void showErr(String msg){ | ||
| 90 | + fragment.binding.refreshLayout.finishRefresh(); | ||
| 91 | + fragment.binding.refreshLayout.finishLoadMore(); | ||
| 92 | + if (list.size() == 0) { | ||
| 93 | + fragment.binding.empty.setVisibility(View.VISIBLE); | ||
| 94 | + fragment.binding.refreshLayout.setVisibility(View.GONE); | ||
| 95 | + fragment.binding.empty.setDetailText(fragment.getResources().getString(R.string.msg_failed_network_detail)); | ||
| 96 | + fragment.binding.empty.setTitleText(msg); | ||
| 97 | + fragment.binding.empty.setButton("重试", new View.OnClickListener() { | ||
| 98 | + @Override | ||
| 99 | + public void onClick(View v) { | ||
| 100 | + fragment.currentPage = 1; | ||
| 101 | + fragment.getPresenter().setData(fragment.getActivity(),"10514343",fragment.currentPage,fragment.pageSize); | ||
| 102 | + } | ||
| 103 | + }); | ||
| 104 | + fragment.binding.empty.setLoadingShowing(false); | ||
| 105 | + fragment.binding.empty.setImage(R.drawable.wufalianjie); | ||
| 106 | + } else { | ||
| 107 | + fragment.binding.empty.setVisibility(View.GONE); | ||
| 108 | + fragment.binding.refreshLayout.setVisibility(View.VISIBLE); | ||
| 109 | + showToast(msg); | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + | ||
| 114 | + public void showToast(String message) { | ||
| 115 | + AlertUtil.showDeftToast(fragment.getActivity(), message); | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + public void showEmpty(){ | ||
| 119 | + fragment.binding.empty.setVisibility(View.VISIBLE); | ||
| 120 | + fragment.binding.refreshLayout.setVisibility(View.GONE); | ||
| 121 | + fragment.binding.empty.show("没有相关数据", "", R.drawable.zhuangtai_kong); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + | ||
| 125 | + public void showLoading() { | ||
| 126 | + if (loadingDiaog != null) loadingDiaog.show(); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + public void hideLoading() { | ||
| 130 | + if (loadingDiaog != null) loadingDiaog.dismiss(); | ||
| 131 | + } | ||
| 132 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/TakePartView.java
| 1 | package com.cnlive.moudle.pedometer.frame.view; | 1 | package com.cnlive.moudle.pedometer.frame.view; |
| 2 | 2 | ||
| 3 | import android.support.v7.widget.LinearLayoutManager; | 3 | import android.support.v7.widget.LinearLayoutManager; |
| 4 | +import android.view.View; | ||
| 4 | 5 | ||
| 6 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 5 | import com.cnlive.moudle.pedometer.ui.adapter.TakePartAdapter; | 7 | import com.cnlive.moudle.pedometer.ui.adapter.TakePartAdapter; |
| 6 | import com.cnlive.moudle.pedometer.ui.fragment.TakePartFragment; | 8 | import com.cnlive.moudle.pedometer.ui.fragment.TakePartFragment; |
| 7 | import com.cnlive.strike.data.network.model.BaseInfo; | 9 | import com.cnlive.strike.data.network.model.BaseInfo; |
| 8 | -import com.cnlive.strike.data.network.model.TakePartPeopleInfo; | 10 | +import com.cnlive.strike.data.network.model.runAbout.TakePartPeopleInfo; |
| 9 | import com.example.moudle_pedometer.R; | 11 | import com.example.moudle_pedometer.R; |
| 10 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 12 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 13 | +import com.qmuiteam.qmui.widget.dialog.QMUITipDialog; | ||
| 14 | +import com.scwang.smartrefresh.layout.footer.ClassicsFooter; | ||
| 15 | +import com.scwang.smartrefresh.layout.header.ClassicsHeader; | ||
| 11 | 16 | ||
| 12 | import java.util.ArrayList; | 17 | import java.util.ArrayList; |
| 13 | import java.util.List; | 18 | import java.util.List; |
| @@ -18,9 +23,16 @@ import java.util.List; | @@ -18,9 +23,16 @@ import java.util.List; | ||
| 18 | public class TakePartView implements MvpView { | 23 | public class TakePartView implements MvpView { |
| 19 | 24 | ||
| 20 | private TakePartFragment fragment; | 25 | private TakePartFragment fragment; |
| 26 | + public QMUITipDialog loadingDiaog; | ||
| 27 | + private TakePartAdapter adapter; | ||
| 28 | + private List<TakePartPeopleInfo.UserMsgsBean> list = new ArrayList<>(); | ||
| 21 | 29 | ||
| 22 | public TakePartView(TakePartFragment fragment) { | 30 | public TakePartView(TakePartFragment fragment) { |
| 23 | this.fragment = fragment; | 31 | this.fragment = fragment; |
| 32 | + loadingDiaog = new QMUITipDialog.Builder(fragment.getActivity()) | ||
| 33 | + .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING) | ||
| 34 | + .setTipWord("请稍后") | ||
| 35 | + .create(); | ||
| 24 | } | 36 | } |
| 25 | 37 | ||
| 26 | public void initView(){ | 38 | public void initView(){ |
| @@ -29,18 +41,85 @@ public class TakePartView implements MvpView { | @@ -29,18 +41,85 @@ public class TakePartView implements MvpView { | ||
| 29 | }); | 41 | }); |
| 30 | fragment.binding.topbar.setTitle("已参与"); | 42 | fragment.binding.topbar.setTitle("已参与"); |
| 31 | fragment.binding.takePartRecy.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); | 43 | fragment.binding.takePartRecy.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); |
| 32 | - | ||
| 33 | - fragment.binding.refreshLayout.setOnRefreshListener(v ->{ | ||
| 34 | - | ||
| 35 | - }); | ||
| 36 | -// fragment.binding.refreshLayout.setOn | 44 | + fragment.binding.refreshLayout.setRefreshHeader(new ClassicsHeader(fragment.getActivity())); |
| 45 | + fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity())); | ||
| 37 | } | 46 | } |
| 38 | 47 | ||
| 39 | public void onSuccess(BaseInfo<TakePartPeopleInfo> partPeopleInfoBaseInfo){ | 48 | public void onSuccess(BaseInfo<TakePartPeopleInfo> partPeopleInfoBaseInfo){ |
| 40 | - fragment.binding.takePartRecy.setAdapter(new TakePartAdapter(partPeopleInfoBaseInfo.getData().getUserMsgs(),fragment.getActivity())); | 49 | + hideLoading(); |
| 50 | + if(fragment.currentPage == 1){ | ||
| 51 | + list.clear(); | ||
| 52 | + list.addAll(partPeopleInfoBaseInfo.getData().getUserMsgs()); | ||
| 53 | + if(adapter == null){ | ||
| 54 | + adapter = new TakePartAdapter(list,fragment.getActivity()); | ||
| 55 | + fragment.binding.takePartRecy.setAdapter(adapter); | ||
| 56 | + }else { | ||
| 57 | + adapter.notifyDataSetChanged(); | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + if(list.size() != 0){ | ||
| 62 | + fragment.binding.empty.setVisibility(View.GONE); | ||
| 63 | + fragment.binding.refreshLayout.setVisibility(View.VISIBLE); | ||
| 64 | + }else { | ||
| 65 | + showEmpty(); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + if(partPeopleInfoBaseInfo.getData().getUserMsgs().size() < fragment.itemNum){ | ||
| 69 | + fragment.binding.refreshLayout.setEnableLoadMore(false); | ||
| 70 | + }else { | ||
| 71 | + fragment.binding.refreshLayout.setEnableLoadMore(true); | ||
| 72 | + } | ||
| 73 | + if(fragment.currentPage > 1){ | ||
| 74 | + list.addAll(partPeopleInfoBaseInfo.getData().getUserMsgs()); | ||
| 75 | + adapter.notifyDataSetChanged(); | ||
| 76 | + } | ||
| 77 | + fragment.binding.refreshLayout.finishRefresh(); | ||
| 78 | + fragment.binding.refreshLayout.finishLoadMore(); | ||
| 41 | } | 79 | } |
| 42 | 80 | ||
| 43 | public void showErr(String msg){ | 81 | public void showErr(String msg){ |
| 82 | + fragment.binding.refreshLayout.finishRefresh(); | ||
| 83 | + fragment.binding.refreshLayout.finishLoadMore(); | ||
| 84 | + if (list.size() == 0) { | ||
| 85 | + fragment.binding.empty.setVisibility(View.VISIBLE); | ||
| 86 | + fragment.binding.refreshLayout.setVisibility(View.GONE); | ||
| 87 | + fragment.binding.empty.setDetailText(fragment.getResources().getString(R.string.msg_failed_network_detail)); | ||
| 88 | + fragment.binding.empty.setTitleText(msg); | ||
| 89 | + fragment.binding.empty.setButton("重试", new View.OnClickListener() { | ||
| 90 | + @Override | ||
| 91 | + public void onClick(View v) { | ||
| 92 | + fragment.currentPage = 1; | ||
| 93 | + fragment.getPresenter().setData(fragment.getActivity(),"116",fragment.currentPage,fragment.itemNum); | ||
| 94 | + } | ||
| 95 | + }); | ||
| 96 | + fragment.binding.empty.setLoadingShowing(false); | ||
| 97 | + fragment.binding.empty.setImage(R.drawable.wufalianjie); | ||
| 98 | + } else { | ||
| 99 | + fragment.binding.empty.setVisibility(View.GONE); | ||
| 100 | + fragment.binding.refreshLayout.setVisibility(View.VISIBLE); | ||
| 101 | + showToast(msg); | ||
| 102 | + } | ||
| 103 | + } | ||
| 44 | 104 | ||
| 105 | + | ||
| 106 | + public void showToast(String message) { | ||
| 107 | + AlertUtil.showDeftToast(fragment.getActivity(), message); | ||
| 45 | } | 108 | } |
| 109 | + | ||
| 110 | + public void showEmpty(){ | ||
| 111 | + fragment.binding.empty.setVisibility(View.VISIBLE); | ||
| 112 | + fragment.binding.refreshLayout.setVisibility(View.GONE); | ||
| 113 | + fragment.binding.empty.show("还没有人参加哦", "", R.drawable.zhuangtai_kong); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + | ||
| 117 | + public void showLoading() { | ||
| 118 | + if (loadingDiaog != null) loadingDiaog.show(); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public void hideLoading() { | ||
| 122 | + if (loadingDiaog != null) loadingDiaog.dismiss(); | ||
| 123 | + } | ||
| 124 | + | ||
| 46 | } | 125 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunRaceDetailActivity.java
| @@ -37,6 +37,12 @@ import java.util.List; | @@ -37,6 +37,12 @@ import java.util.List; | ||
| 37 | public class RunRaceDetailActivity extends QMUIFragmentActivity { | 37 | public class RunRaceDetailActivity extends QMUIFragmentActivity { |
| 38 | private QMUIFragment fragment; | 38 | private QMUIFragment fragment; |
| 39 | 39 | ||
| 40 | + public static void startActivity(Activity activity, String eventId) { | ||
| 41 | + Intent intent = new Intent(activity, RunRaceDetailActivity.class); | ||
| 42 | + intent.putExtra("eventId", eventId); | ||
| 43 | + activity.startActivity(intent); | ||
| 44 | + } | ||
| 45 | + | ||
| 40 | @Override | 46 | @Override |
| 41 | protected int getContextViewId() { | 47 | protected int getContextViewId() { |
| 42 | return R.id.fragment_finish_run_map; | 48 | return R.id.fragment_finish_run_map; |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/MyRecordAdapter.java
| @@ -17,6 +17,8 @@ import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity; | @@ -17,6 +17,8 @@ import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity; | ||
| 17 | import com.cnlive.moudle.pedometer.ui.activity.SelfRecordActivity; | 17 | import com.cnlive.moudle.pedometer.ui.activity.SelfRecordActivity; |
| 18 | import com.cnlive.moudle.pedometer.ui.fragment.SelfRecordFragment; | 18 | import com.cnlive.moudle.pedometer.ui.fragment.SelfRecordFragment; |
| 19 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; | 19 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; |
| 20 | +import com.cnlive.moudle.pedometer.utils.TimeUtil; | ||
| 21 | +import com.cnlive.strike.data.network.model.runAbout.RunLineInfo; | ||
| 20 | import com.example.moudle_pedometer.R; | 22 | import com.example.moudle_pedometer.R; |
| 21 | 23 | ||
| 22 | import java.util.ArrayList; | 24 | import java.util.ArrayList; |
| @@ -26,7 +28,7 @@ import java.util.List; | @@ -26,7 +28,7 @@ import java.util.List; | ||
| 26 | */ | 28 | */ |
| 27 | public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyViewHolder> { | 29 | public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyViewHolder> { |
| 28 | 30 | ||
| 29 | - private List<String> list = new ArrayList<>(); | 31 | + private List<RunLineInfo.ListBean> list = new ArrayList<>(); |
| 30 | private Activity context; | 32 | private Activity context; |
| 31 | private boolean isShow; | 33 | private boolean isShow; |
| 32 | private OnClickListener clickListener; | 34 | private OnClickListener clickListener; |
| @@ -35,7 +37,7 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | @@ -35,7 +37,7 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | ||
| 35 | this.clickListener = clickListener; | 37 | this.clickListener = clickListener; |
| 36 | } | 38 | } |
| 37 | 39 | ||
| 38 | - public MyRecordAdapter(List<String> list, Activity context,boolean isShow) { | 40 | + public MyRecordAdapter(List<RunLineInfo.ListBean> list, Activity context, boolean isShow) { |
| 39 | this.list = list; | 41 | this.list = list; |
| 40 | this.context = context; | 42 | this.context = context; |
| 41 | this.isShow = isShow; | 43 | this.isShow = isShow; |
| @@ -55,13 +57,23 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | @@ -55,13 +57,23 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | ||
| 55 | myViewHolder.has_report.setVisibility(View.GONE); | 57 | myViewHolder.has_report.setVisibility(View.GONE); |
| 56 | }else { | 58 | }else { |
| 57 | myViewHolder.my_record_ry.setVisibility(View.GONE); | 59 | myViewHolder.my_record_ry.setVisibility(View.GONE); |
| 58 | - myViewHolder.has_report.setVisibility(View.VISIBLE); | 60 | + if(list.get(i).isSignResult()){ |
| 61 | + myViewHolder.has_report.setVisibility(View.VISIBLE); | ||
| 62 | + }else { | ||
| 63 | + myViewHolder.has_report.setVisibility(View.GONE); | ||
| 64 | + } | ||
| 59 | } | 65 | } |
| 60 | myViewHolder.my_record.setOnClickListener(v -> SelfRecordActivity.newInstance(context)); | 66 | myViewHolder.my_record.setOnClickListener(v -> SelfRecordActivity.newInstance(context)); |
| 61 | // myViewHolder.check_raking.setOnClickListener(v -> ); | 67 | // myViewHolder.check_raking.setOnClickListener(v -> ); |
| 62 | if(clickListener != null){ | 68 | if(clickListener != null){ |
| 63 | myViewHolder.item_ly.setOnClickListener(v -> clickListener.onClickListener(list.get(i),i)); | 69 | myViewHolder.item_ly.setOnClickListener(v -> clickListener.onClickListener(list.get(i),i)); |
| 64 | } | 70 | } |
| 71 | + | ||
| 72 | + myViewHolder.line_name.setText(list.get(i).getTitle()); | ||
| 73 | + myViewHolder.activity_time.setText(TimeUtil.getStampToTime(list.get(i).getStart_time(),"yyyy.MM.dd")+"——"+TimeUtil.getStampToTime(list.get(i).getEnd_time(),"yyyy.MM.dd")); | ||
| 74 | + myViewHolder.line_address.setText(list.get(i).getAddress()+" "+list.get(i).getMileage()); | ||
| 75 | + myViewHolder.people_part.setText(list.get(i).getSignupNum()+""); | ||
| 76 | + myViewHolder.join_person.initIconData(list.get(i).getFaceUrl()); | ||
| 65 | } | 77 | } |
| 66 | 78 | ||
| 67 | 79 | ||
| @@ -78,6 +90,10 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | @@ -78,6 +90,10 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | ||
| 78 | RelativeLayout item_ly; | 90 | RelativeLayout item_ly; |
| 79 | RelativeLayout my_record_ry; | 91 | RelativeLayout my_record_ry; |
| 80 | ImageView has_report; | 92 | ImageView has_report; |
| 93 | + TextView line_name; | ||
| 94 | + TextView activity_time; | ||
| 95 | + TextView line_address; | ||
| 96 | + TextView people_part; | ||
| 81 | 97 | ||
| 82 | public MyViewHolder(@NonNull View itemView) { | 98 | public MyViewHolder(@NonNull View itemView) { |
| 83 | super(itemView); | 99 | super(itemView); |
| @@ -87,10 +103,14 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | @@ -87,10 +103,14 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | ||
| 87 | item_ly = itemView.findViewById(R.id.item_ly); | 103 | item_ly = itemView.findViewById(R.id.item_ly); |
| 88 | my_record_ry = itemView.findViewById(R.id.my_record_ry); | 104 | my_record_ry = itemView.findViewById(R.id.my_record_ry); |
| 89 | has_report = itemView.findViewById(R.id.has_report); | 105 | has_report = itemView.findViewById(R.id.has_report); |
| 106 | + line_name = itemView.findViewById(R.id.line_name); | ||
| 107 | + activity_time = itemView.findViewById(R.id.activity_time); | ||
| 108 | + line_address = itemView.findViewById(R.id.line_address); | ||
| 109 | + people_part = itemView.findViewById(R.id.people_part); | ||
| 90 | } | 110 | } |
| 91 | } | 111 | } |
| 92 | 112 | ||
| 93 | public interface OnClickListener{ | 113 | public interface OnClickListener{ |
| 94 | - void onClickListener(String msg,int position); | 114 | + void onClickListener(RunLineInfo.ListBean msg,int position); |
| 95 | } | 115 | } |
| 96 | } | 116 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/RaceRecordAdapter.java
| @@ -12,7 +12,7 @@ import android.widget.TextView; | @@ -12,7 +12,7 @@ import android.widget.TextView; | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 14 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 15 | -import com.cnlive.strike.data.network.model.RaceRecordInfo; | 15 | +import com.cnlive.strike.data.network.model.runAbout.RaceRecordInfo; |
| 16 | import com.example.moudle_pedometer.R; | 16 | import com.example.moudle_pedometer.R; |
| 17 | 17 | ||
| 18 | import java.util.List; | 18 | import java.util.List; |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/TakePartAdapter.java
| @@ -9,11 +9,12 @@ import android.view.ViewGroup; | @@ -9,11 +9,12 @@ import android.view.ViewGroup; | ||
| 9 | import android.widget.ImageView; | 9 | import android.widget.ImageView; |
| 10 | import android.widget.TextView; | 10 | import android.widget.TextView; |
| 11 | 11 | ||
| 12 | -import com.cnlive.strike.application.GlideApp; | ||
| 13 | -import com.cnlive.strike.data.network.model.TakePartPeopleInfo; | 12 | +import com.bumptech.glide.Glide; |
| 13 | +import com.bumptech.glide.load.resource.bitmap.CircleCrop; | ||
| 14 | +import com.bumptech.glide.request.RequestOptions; | ||
| 15 | +import com.cnlive.strike.data.network.model.runAbout.TakePartPeopleInfo; | ||
| 14 | import com.example.moudle_pedometer.R; | 16 | import com.example.moudle_pedometer.R; |
| 15 | 17 | ||
| 16 | -import java.time.temporal.Temporal; | ||
| 17 | import java.util.List; | 18 | import java.util.List; |
| 18 | 19 | ||
| 19 | /** | 20 | /** |
| @@ -38,7 +39,8 @@ public class TakePartAdapter extends RecyclerView.Adapter<TakePartAdapter.MyHold | @@ -38,7 +39,8 @@ public class TakePartAdapter extends RecyclerView.Adapter<TakePartAdapter.MyHold | ||
| 38 | 39 | ||
| 39 | @Override | 40 | @Override |
| 40 | public void onBindViewHolder(@NonNull TakePartAdapter.MyHolder myViewHolder, int i) { | 41 | public void onBindViewHolder(@NonNull TakePartAdapter.MyHolder myViewHolder, int i) { |
| 41 | - GlideApp.with(context).load(list.get(i).getImage()).into(myViewHolder.icon_img); | 42 | + Glide.with(context).load(list.get(i).getImage()) |
| 43 | + .apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.drawable.ic_icon)).into(myViewHolder.icon_img); | ||
| 42 | myViewHolder.nickname.setText(list.get(i).getNickName()); | 44 | myViewHolder.nickname.setText(list.get(i).getNickName()); |
| 43 | } | 45 | } |
| 44 | 46 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunLineFragment.java
| @@ -12,11 +12,16 @@ import android.view.LayoutInflater; | @@ -12,11 +12,16 @@ import android.view.LayoutInflater; | ||
| 12 | import android.view.View; | 12 | import android.view.View; |
| 13 | import android.view.ViewGroup; | 13 | import android.view.ViewGroup; |
| 14 | 14 | ||
| 15 | +import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | ||
| 16 | +import com.cnlive.moudle.pedometer.frame.presenter.RunLinePresenter; | ||
| 17 | +import com.cnlive.moudle.pedometer.frame.view.RunLineView; | ||
| 15 | import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity; | 18 | import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity; |
| 16 | import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity; | 19 | import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity; |
| 17 | import com.cnlive.moudle.pedometer.ui.adapter.MyRecordAdapter; | 20 | import com.cnlive.moudle.pedometer.ui.adapter.MyRecordAdapter; |
| 18 | import com.example.moudle_pedometer.R; | 21 | import com.example.moudle_pedometer.R; |
| 19 | import com.example.moudle_pedometer.databinding.FragmentRunLineBinding; | 22 | import com.example.moudle_pedometer.databinding.FragmentRunLineBinding; |
| 23 | +import com.scwang.smartrefresh.layout.footer.ClassicsFooter; | ||
| 24 | +import com.scwang.smartrefresh.layout.header.ClassicsHeader; | ||
| 20 | 25 | ||
| 21 | import java.util.ArrayList; | 26 | import java.util.ArrayList; |
| 22 | import java.util.List; | 27 | import java.util.List; |
| @@ -24,43 +29,33 @@ import java.util.List; | @@ -24,43 +29,33 @@ import java.util.List; | ||
| 24 | /** | 29 | /** |
| 25 | * Created by hanyayun 019/06/03. | 30 | * Created by hanyayun 019/06/03. |
| 26 | */ | 31 | */ |
| 27 | -public class RunLineFragment extends Fragment { | 32 | +public class RunLineFragment extends MvpBindingFragment<RunLineView, RunLinePresenter,Object,FragmentRunLineBinding> { |
| 28 | 33 | ||
| 29 | - private FragmentRunLineBinding binding; | ||
| 30 | 34 | ||
| 35 | + public int currentPage = 1; | ||
| 36 | + public int pageSize = 10; | ||
| 31 | public RunLineFragment() { | 37 | public RunLineFragment() { |
| 32 | // Required empty public constructor | 38 | // Required empty public constructor |
| 33 | } | 39 | } |
| 34 | 40 | ||
| 35 | - | ||
| 36 | @Override | 41 | @Override |
| 37 | - public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
| 38 | - Bundle savedInstanceState) { | ||
| 39 | - // Inflate the layout for this fragment | ||
| 40 | - binding = DataBindingUtil.inflate(inflater,R.layout.fragment_run_line, container, false); | ||
| 41 | - return binding.getRoot(); | 42 | + protected int getLayoutId() { |
| 43 | + return R.layout.fragment_run_line; | ||
| 42 | } | 44 | } |
| 43 | 45 | ||
| 44 | @Override | 46 | @Override |
| 45 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | 47 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
| 46 | super.onViewCreated(view, savedInstanceState); | 48 | super.onViewCreated(view, savedInstanceState); |
| 49 | + if(getMvpView() != null)getMvpView().initView(); | ||
| 50 | + getPresenter().setData(getActivity(),"10514343",currentPage,pageSize); | ||
| 47 | 51 | ||
| 48 | - binding.backBtn.setOnClickListener(v -> getActivity().finish()); | ||
| 49 | - binding.myActivity.setOnClickListener(v -> MyRecordActivity.newInstance(getActivity())); | ||
| 50 | - List<String> list = new ArrayList<>(); | ||
| 51 | - list.add("fff"); | ||
| 52 | - list.add("fff"); | ||
| 53 | - list.add("fff"); | ||
| 54 | - list.add("fff"); | ||
| 55 | - binding.runLineRecy.setLayoutManager(new LinearLayoutManager(getActivity())); | ||
| 56 | - MyRecordAdapter myRecordAdapter = new MyRecordAdapter(list,getActivity(),false); | ||
| 57 | - binding.runLineRecy.setAdapter(myRecordAdapter); | ||
| 58 | - myRecordAdapter.setClickListener(new MyRecordAdapter.OnClickListener() { | ||
| 59 | - @Override | ||
| 60 | - public void onClickListener(String msg, int position) { | ||
| 61 | - Intent intent = new Intent(getActivity(), RunRaceDetailActivity.class); | ||
| 62 | - getActivity().startActivity(intent); | ||
| 63 | - } | 52 | + binding.refreshLayout.setOnRefreshListener(v ->{ |
| 53 | + currentPage = 1; | ||
| 54 | + getPresenter().setData(getActivity(),"10514343",currentPage,pageSize); | ||
| 55 | + }); | ||
| 56 | + binding.refreshLayout.setOnLoadMoreListener(v ->{ | ||
| 57 | + currentPage++; | ||
| 58 | + getPresenter().setData(getActivity(),"10514343",currentPage,pageSize); | ||
| 64 | }); | 59 | }); |
| 65 | } | 60 | } |
| 66 | } | 61 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/TakePartFragment.java
| @@ -3,10 +3,7 @@ package com.cnlive.moudle.pedometer.ui.fragment; | @@ -3,10 +3,7 @@ package com.cnlive.moudle.pedometer.ui.fragment; | ||
| 3 | 3 | ||
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.support.annotation.Nullable; | 5 | import android.support.annotation.Nullable; |
| 6 | -import android.support.v4.app.Fragment; | ||
| 7 | -import android.view.LayoutInflater; | ||
| 8 | import android.view.View; | 6 | import android.view.View; |
| 9 | -import android.view.ViewGroup; | ||
| 10 | 7 | ||
| 11 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | 8 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| 12 | import com.cnlive.moudle.pedometer.frame.presenter.TakePartPresenter; | 9 | import com.cnlive.moudle.pedometer.frame.presenter.TakePartPresenter; |
| @@ -19,6 +16,8 @@ import com.example.moudle_pedometer.databinding.FragmentTakePartBinding; | @@ -19,6 +16,8 @@ import com.example.moudle_pedometer.databinding.FragmentTakePartBinding; | ||
| 19 | */ | 16 | */ |
| 20 | public class TakePartFragment extends MvpBindingFragment<TakePartView, TakePartPresenter,Object, FragmentTakePartBinding> { | 17 | public class TakePartFragment extends MvpBindingFragment<TakePartView, TakePartPresenter,Object, FragmentTakePartBinding> { |
| 21 | 18 | ||
| 19 | + public int currentPage = 1; | ||
| 20 | + public int itemNum = 10; | ||
| 22 | 21 | ||
| 23 | public TakePartFragment() { | 22 | public TakePartFragment() { |
| 24 | // Required empty public constructor | 23 | // Required empty public constructor |
| @@ -32,7 +31,15 @@ public class TakePartFragment extends MvpBindingFragment<TakePartView, TakePartP | @@ -32,7 +31,15 @@ public class TakePartFragment extends MvpBindingFragment<TakePartView, TakePartP | ||
| 32 | @Override | 31 | @Override |
| 33 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 32 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 34 | super.onViewCreated(view, savedInstanceState); | 33 | super.onViewCreated(view, savedInstanceState); |
| 35 | - getPresenter().setData(getActivity(),"116",0,10); | 34 | + getPresenter().setData(getActivity(),"116",currentPage,itemNum); |
| 36 | if(getMvpView() != null)getMvpView().initView(); | 35 | if(getMvpView() != null)getMvpView().initView(); |
| 36 | + binding.refreshLayout.setOnRefreshListener(v ->{ | ||
| 37 | + currentPage = 1; | ||
| 38 | + getPresenter().setData(getActivity(),"116",currentPage,itemNum); | ||
| 39 | + }); | ||
| 40 | + binding.refreshLayout.setOnLoadMoreListener(v ->{ | ||
| 41 | + currentPage++; | ||
| 42 | + getPresenter().setData(getActivity(),"116",currentPage,itemNum); | ||
| 43 | + }); | ||
| 37 | } | 44 | } |
| 38 | } | 45 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/TimeUtil.java
| @@ -73,12 +73,9 @@ public class TimeUtil { | @@ -73,12 +73,9 @@ public class TimeUtil { | ||
| 73 | * @return 格式化后的日期 | 73 | * @return 格式化后的日期 |
| 74 | */ | 74 | */ |
| 75 | public static String getStampToTime(long time,String pattern) { | 75 | public static String getStampToTime(long time,String pattern) { |
| 76 | - String res; | ||
| 77 | - SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);//"yyyy-MM-dd HH:mm:ss" | ||
| 78 | - long lt = new Long(time * 1000); | ||
| 79 | - Date date = new Date(lt); | ||
| 80 | - res = simpleDateFormat.format(date); | ||
| 81 | - return res; | 76 | + SimpleDateFormat sdf = new SimpleDateFormat(pattern); |
| 77 | + Date date = new Date(time); | ||
| 78 | + return sdf.format(date); | ||
| 82 | } | 79 | } |
| 83 | 80 | ||
| 84 | /** | 81 | /** |
moudle_pedometer/src/main/res/layout/fragment_run_line.xml
| @@ -14,51 +14,54 @@ | @@ -14,51 +14,54 @@ | ||
| 14 | android:id="@+id/back_btn" | 14 | android:id="@+id/back_btn" |
| 15 | android:layout_width="wrap_content" | 15 | android:layout_width="wrap_content" |
| 16 | android:layout_height="wrap_content" | 16 | android:layout_height="wrap_content" |
| 17 | - android:src="@drawable/top_back_black" | ||
| 18 | android:layout_centerVertical="true" | 17 | android:layout_centerVertical="true" |
| 19 | android:padding="10dp" | 18 | android:padding="10dp" |
| 20 | - /> | 19 | + android:src="@drawable/top_back_black" /> |
| 21 | 20 | ||
| 22 | <TextView | 21 | <TextView |
| 23 | android:id="@+id/beijing" | 22 | android:id="@+id/beijing" |
| 24 | android:layout_width="wrap_content" | 23 | android:layout_width="wrap_content" |
| 25 | android:layout_height="wrap_content" | 24 | android:layout_height="wrap_content" |
| 26 | - android:layout_toRightOf="@id/back_btn" | ||
| 27 | - android:text="@string/beijing" | ||
| 28 | - android:layout_marginLeft="10dp" | ||
| 29 | android:layout_centerVertical="true" | 25 | android:layout_centerVertical="true" |
| 26 | + android:layout_marginLeft="10dp" | ||
| 27 | + android:layout_toRightOf="@id/back_btn" | ||
| 30 | android:drawableRight="@drawable/sport_dropdown" | 28 | android:drawableRight="@drawable/sport_dropdown" |
| 31 | android:drawablePadding="7dp" | 29 | android:drawablePadding="7dp" |
| 32 | - android:textSize="15sp" | 30 | + android:text="@string/beijing" |
| 33 | android:textColor="#333333" | 31 | android:textColor="#333333" |
| 34 | - /> | 32 | + android:textSize="15sp" /> |
| 35 | 33 | ||
| 36 | <TextView | 34 | <TextView |
| 37 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
| 38 | android:layout_height="wrap_content" | 36 | android:layout_height="wrap_content" |
| 37 | + android:layout_centerInParent="true" | ||
| 39 | android:text="@string/goline" | 38 | android:text="@string/goline" |
| 40 | - android:textSize="18sp" | ||
| 41 | android:textColor="#333333" | 39 | android:textColor="#333333" |
| 42 | - android:layout_centerInParent="true" | ||
| 43 | - /> | 40 | + android:textSize="18sp" /> |
| 44 | 41 | ||
| 45 | <TextView | 42 | <TextView |
| 46 | android:id="@+id/my_activity" | 43 | android:id="@+id/my_activity" |
| 47 | android:layout_width="wrap_content" | 44 | android:layout_width="wrap_content" |
| 48 | android:layout_height="wrap_content" | 45 | android:layout_height="wrap_content" |
| 49 | - android:layout_centerVertical="true" | ||
| 50 | android:layout_alignParentRight="true" | 46 | android:layout_alignParentRight="true" |
| 47 | + android:layout_centerVertical="true" | ||
| 51 | android:padding="10dp" | 48 | android:padding="10dp" |
| 52 | android:text="@string/myactivity" | 49 | android:text="@string/myactivity" |
| 53 | - android:textSize="15sp" | ||
| 54 | android:textColor="#333333" | 50 | android:textColor="#333333" |
| 55 | - /> | 51 | + android:textSize="15sp" /> |
| 56 | </RelativeLayout> | 52 | </RelativeLayout> |
| 57 | 53 | ||
| 58 | - <android.support.v7.widget.RecyclerView | ||
| 59 | - android:id="@+id/run_line_recy" | 54 | + <com.scwang.smartrefresh.layout.SmartRefreshLayout |
| 55 | + android:id="@+id/refreshLayout" | ||
| 60 | android:layout_width="match_parent" | 56 | android:layout_width="match_parent" |
| 61 | - android:layout_height="match_parent" /> | 57 | + android:layout_height="match_parent"> |
| 58 | + | ||
| 59 | + <android.support.v7.widget.RecyclerView | ||
| 60 | + android:id="@+id/run_line_recy" | ||
| 61 | + android:layout_width="match_parent" | ||
| 62 | + android:layout_height="match_parent" /> | ||
| 63 | + </com.scwang.smartrefresh.layout.SmartRefreshLayout> | ||
| 64 | + | ||
| 62 | 65 | ||
| 63 | <com.cnlive.strike.ui.widget.UIEmptyView | 66 | <com.cnlive.strike.ui.widget.UIEmptyView |
| 64 | android:id="@+id/empty" | 67 | android:id="@+id/empty" |
moudle_pedometer/src/main/res/layout/item_my_record.xml
| @@ -19,7 +19,6 @@ | @@ -19,7 +19,6 @@ | ||
| 19 | android:id="@+id/line_name" | 19 | android:id="@+id/line_name" |
| 20 | android:layout_width="wrap_content" | 20 | android:layout_width="wrap_content" |
| 21 | android:layout_height="wrap_content" | 21 | android:layout_height="wrap_content" |
| 22 | - android:text="首都师范大学田径场" | ||
| 23 | android:textColor="#333333" | 22 | android:textColor="#333333" |
| 24 | android:textSize="18sp" /> | 23 | android:textSize="18sp" /> |
| 25 | 24 | ||
| @@ -38,6 +37,7 @@ | @@ -38,6 +37,7 @@ | ||
| 38 | android:textSize="12sp" /> | 37 | android:textSize="12sp" /> |
| 39 | 38 | ||
| 40 | <TextView | 39 | <TextView |
| 40 | + android:id="@+id/activity_time" | ||
| 41 | android:layout_width="wrap_content" | 41 | android:layout_width="wrap_content" |
| 42 | android:layout_height="wrap_content" | 42 | android:layout_height="wrap_content" |
| 43 | android:layout_marginLeft="10dp" | 43 | android:layout_marginLeft="10dp" |
| @@ -61,6 +61,7 @@ | @@ -61,6 +61,7 @@ | ||
| 61 | android:textSize="12sp" /> | 61 | android:textSize="12sp" /> |
| 62 | 62 | ||
| 63 | <TextView | 63 | <TextView |
| 64 | + android:id="@+id/line_address" | ||
| 64 | android:layout_width="wrap_content" | 65 | android:layout_width="wrap_content" |
| 65 | android:layout_height="wrap_content" | 66 | android:layout_height="wrap_content" |
| 66 | android:layout_marginLeft="10dp" | 67 | android:layout_marginLeft="10dp" |
| @@ -88,7 +89,6 @@ | @@ -88,7 +89,6 @@ | ||
| 88 | android:layout_height="wrap_content" | 89 | android:layout_height="wrap_content" |
| 89 | android:layout_gravity="center" | 90 | android:layout_gravity="center" |
| 90 | android:layout_marginLeft="10dp" | 91 | android:layout_marginLeft="10dp" |
| 91 | - android:text="@string/_123" | ||
| 92 | android:textColor="#333333" | 92 | android:textColor="#333333" |
| 93 | android:textSize="15sp" /> | 93 | android:textSize="15sp" /> |
| 94 | 94 |