Commit 6b9d37b0f58c4953255352aded6180f83b1a99c0

Authored by 韩亚云
1 parent 63a7c081

我的活动页面修改

Showing 22 changed files with 557 additions and 129 deletions
lib_network/src/main/java/com/cnlive/strike/data/network/api/ApiServiceDaren.java
... ... @@ -7,6 +7,7 @@ import com.cnlive.strike.data.network.model.CheckTransferInfo;
7 7 import com.cnlive.strike.data.network.model.DarenApplyModel;
8 8 import com.cnlive.strike.data.network.model.GifEmojiItemData;
9 9 import com.cnlive.strike.data.network.model.GifListData;
  10 +import com.cnlive.strike.data.network.model.MyRecordInfo;
10 11 import com.cnlive.strike.data.network.model.runAbout.RaceRecordInfo;
11 12 import com.cnlive.strike.data.network.model.ShortLinkInfo;
12 13 import com.cnlive.strike.data.network.model.runAbout.RunLineInfo;
... ... @@ -126,5 +127,11 @@ public interface ApiServiceDaren {
126 127 */
127 128 @POST("Daren/event/getEventList.action")
128 129 Observable<Result<BaseInfo<RunLineInfo>>> getRunLineListInfo(@QueryMap() Map<String, String> maps);
  130 +
  131 + /**
  132 + * 约跑线路我的活动
  133 + */
  134 + @POST("Daren/event/getMySportActivity.action")
  135 + Observable<Result<BaseInfo<MyRecordInfo>>> getMyRecordListInfo(@QueryMap() Map<String, String> maps);
129 136 }
130 137  
... ...
lib_network/src/main/java/com/cnlive/strike/data/network/model/MyRecordInfo.java 0 → 100644
  1 +package com.cnlive.strike.data.network.model;
  2 +
  3 +import java.util.List;
  4 +
  5 +/**
  6 + * Created by hanyayun 019/06/17.
  7 + */
  8 +public class MyRecordInfo {
  9 +
  10 + /**
  11 + * hasNext : false
  12 + * list : [{"address":"内蒙古鄂尔多斯市准格尔旗","end_time":1565697600000,"faceUrl":[],"id":117,"mileage":"全长4.43公里","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公里","signupNum":3,"start_time":1522454400000,"title":"2018国际网络徒步大赛黄金海岸站"}]
  13 + * pageNumber : 1
  14 + * pageSize : 10
  15 + * startIndex : 0
  16 + * totalPage : 1
  17 + * totalRecord : 2
  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 : 1565697600000
  88 + * faceUrl : []
  89 + * id : 117
  90 + * mileage : 全长4.43公里
  91 + * signupNum : 0
  92 + * start_time : 1502409600000
  93 + * title : 世界大众体育杯 · 2017准格尔国际徒步大会
  94 + */
  95 +
  96 + private String address;
  97 + private long end_time;
  98 + private int id;
  99 + private String mileage;
  100 + private int signupNum;
  101 + private long start_time;
  102 + private String title;
  103 + private List<String> faceUrl;
  104 +
  105 + public String getAddress() {
  106 + return address;
  107 + }
  108 +
  109 + public void setAddress(String address) {
  110 + this.address = address;
  111 + }
  112 +
  113 + public long getEnd_time() {
  114 + return end_time;
  115 + }
  116 +
  117 + public void setEnd_time(long end_time) {
  118 + this.end_time = end_time;
  119 + }
  120 +
  121 + public int getId() {
  122 + return id;
  123 + }
  124 +
  125 + public void setId(int id) {
  126 + this.id = id;
  127 + }
  128 +
  129 + public String getMileage() {
  130 + return mileage;
  131 + }
  132 +
  133 + public void setMileage(String mileage) {
  134 + this.mileage = mileage;
  135 + }
  136 +
  137 + public int getSignupNum() {
  138 + return signupNum;
  139 + }
  140 +
  141 + public void setSignupNum(int signupNum) {
  142 + this.signupNum = signupNum;
  143 + }
  144 +
  145 + public long getStart_time() {
  146 + return start_time;
  147 + }
  148 +
  149 + public void setStart_time(long start_time) {
  150 + this.start_time = start_time;
  151 + }
  152 +
  153 + public String getTitle() {
  154 + return title;
  155 + }
  156 +
  157 + public void setTitle(String title) {
  158 + this.title = title;
  159 + }
  160 +
  161 + public List<String> getFaceUrl() {
  162 + return faceUrl;
  163 + }
  164 +
  165 + public void setFaceUrl(List<String> faceUrl) {
  166 + this.faceUrl = faceUrl;
  167 + }
  168 + }
  169 +}
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/MyRecordPresenter.java
1 1 package com.cnlive.moudle.pedometer.frame.presenter;
2 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;
3 9 import com.cnlive.moudle.pedometer.frame.view.MyRecordView;
  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.MyRecordInfo;
  14 +import com.cnlive.strike.data.network.model.runAbout.RunLineInfo;
4 15 import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
5 16  
  17 +import java.util.HashMap;
  18 +import java.util.Map;
  19 +
  20 +import io.reactivex.disposables.Disposable;
  21 +
6 22 /**
7 23 * Created by hanyayun 019/05/30.
8 24 */
9 25 public class MyRecordPresenter extends MvpBasePresenter<MyRecordView> {
10 26  
11   - public void getData(){
12   - getView().setData();
  27 + public void setData(Context context, String sid, String state, int pageNo, int pageSize) {
  28 + HashMap<String, String> map = new HashMap<>();
  29 + map.put("sid", sid);
  30 + map.put("pageNo", pageNo + "");
  31 + map.put("state", state);
  32 + map.put("pageSize", pageSize + "");
  33 + getView().showLoading();
  34 + Logic.create(map).action(new Logic.Action<Map<String, String>, BaseInfo<MyRecordInfo>>() {
  35 + @Override
  36 + public Disposable action(Map<String, String> stringStringMap, DataCallback<BaseInfo<MyRecordInfo>> dataCallback) {
  37 + return ApiRequest.observable(ApiServiceDaren.class, api -> api.getMyRecordListInfo(stringStringMap)).subscribe(context,dataCallback);
  38 + }
  39 + }).<BaseInfo<MyRecordInfo>>event().setFailureCallback(new FailureCallback() {
  40 + @Override
  41 + public void onFailure(int code, String message) {
  42 + if (getView() != null) {
  43 + getView().showErr(message);
  44 + getView().hideLoading();
  45 + }
  46 + }
  47 + }).setSuccessCallback(new SuccessCallback<BaseInfo<MyRecordInfo>>() {
  48 + @Override
  49 + public void onSuccess(BaseInfo<MyRecordInfo> registerInfo) {
  50 + if (getView() != null) {
  51 + getView().onSuccess(registerInfo);
  52 + }
  53 + }
  54 + }).start();
13 55 }
14 56 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/MyRecordView.java
... ... @@ -3,8 +3,18 @@ package com.cnlive.moudle.pedometer.frame.view;
3 3 import android.support.v7.widget.LinearLayoutManager;
4 4 import android.view.View;
5 5  
  6 +import com.cnlive.libs.base.util.AlertUtil;
  7 +import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity;
  8 +import com.cnlive.moudle.pedometer.ui.adapter.MyRecordAdapter;
  9 +import com.cnlive.strike.data.network.model.BaseInfo;
  10 +import com.cnlive.strike.data.network.model.MyRecordInfo;
6 11 import com.cnlive.moudle.pedometer.ui.fragment.MyRecordFragment;
  12 +import com.cnlive.strike.data.network.model.runAbout.RunLineInfo;
  13 +import com.example.moudle_pedometer.R;
7 14 import com.hannesdorfmann.mosby3.mvp.MvpView;
  15 +import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
  16 +import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
  17 +import com.scwang.smartrefresh.layout.header.ClassicsHeader;
8 18  
9 19 import java.util.ArrayList;
10 20 import java.util.List;
... ... @@ -15,36 +25,104 @@ import java.util.List;
15 25 public class MyRecordView implements MvpView {
16 26  
17 27 private MyRecordFragment fragment;
18   -
  28 + public QMUITipDialog loadingDiaog;
  29 + private List<MyRecordInfo.ListBean> list = new ArrayList<>();
  30 + private MyRecordAdapter adapter;
19 31 public MyRecordView(MyRecordFragment fragment) {
20 32 this.fragment = fragment;
  33 + loadingDiaog = new QMUITipDialog.Builder(fragment.getActivity())
  34 + .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING)
  35 + .setTipWord("请稍后")
  36 + .create();
21 37 }
22 38  
23 39  
24   - public void setData(){
25   - List<String> list = new ArrayList<>();
26   - list.add("fff");
27   - list.add("fff");
28   - list.add("fff");
29   - list.add("fff");
30   -// MyRecordAdapter myRecordAdapter = new MyRecordAdapter(list,fragment.getActivity(),true);
31   -// fragment.binding.myRecordRecy.setAdapter(myRecordAdapter);
32   -// myRecordAdapter.setClickListener(new MyRecordAdapter.OnClickListener() {
33   -// @Override
34   -// public void onClickListener(String msg, int position) {
35   -// Intent intent = new Intent(fragment.getActivity(), RunRaceDetailActivity.class);
36   -// fragment.getActivity().startActivity(intent);
37   -// }
38   -// });
  40 + public void onSuccess(BaseInfo<MyRecordInfo> myRecordInfoBaseInfo){
  41 + hideLoading();
  42 + if(fragment.currentPage == 1){
  43 + list.clear();
  44 + list.addAll(myRecordInfoBaseInfo.getData().getList());
  45 + if(adapter == null){
  46 + adapter = new MyRecordAdapter(list,fragment.state,fragment.getActivity());
  47 + fragment.binding.myRecordRecy.setAdapter(adapter);
  48 + adapter.setClickListener(new MyRecordAdapter.OnClickListener() {
  49 + @Override
  50 + public void onClickListener(MyRecordInfo.ListBean bean, int position) {
  51 + RunRaceDetailActivity.startActivity(fragment.getActivity(),bean.getId()+"");
  52 + }
  53 + });
  54 + }else {
  55 + adapter.notifyDataSetChanged();
  56 + }
  57 + }
  58 +
  59 + if(list.size() != 0){
  60 + fragment.binding.empty.setVisibility(View.GONE);
  61 + fragment.binding.refreshLayout.setVisibility(View.VISIBLE);
  62 + }else {
  63 + showEmpty();
  64 + }
  65 +
  66 + if(myRecordInfoBaseInfo.getData().getList().size() < fragment.pageSize){
  67 + fragment.binding.refreshLayout.setEnableLoadMore(false);
  68 + }else {
  69 + fragment.binding.refreshLayout.setEnableLoadMore(true);
  70 + }
  71 + if(fragment.currentPage > 1){
  72 + list.addAll(myRecordInfoBaseInfo.getData().getList());
  73 + adapter.notifyDataSetChanged();
  74 + }
  75 + fragment.binding.refreshLayout.finishRefresh();
  76 + fragment.binding.refreshLayout.finishLoadMore();
39 77 }
40 78  
41 79 public void initView(){
  80 + fragment.binding.refreshLayout.setRefreshHeader(new ClassicsHeader(fragment.getActivity()));
  81 + fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity()));
42 82 fragment.binding.myRecordRecy.setLayoutManager(new LinearLayoutManager(fragment.getActivity()));
43   -// fragment.binding.myRecordRecy.setAdapter();
44 83 }
45 84  
46   - private void showEmpty(){
47   - fragment.binding.myRecordRecy.setVisibility(View.GONE);
  85 + public void showErr(String msg){
  86 + fragment.binding.refreshLayout.finishRefresh();
  87 + fragment.binding.refreshLayout.finishLoadMore();
  88 + if (list.size() == 0) {
  89 + fragment.binding.empty.setVisibility(View.VISIBLE);
  90 + fragment.binding.refreshLayout.setVisibility(View.GONE);
  91 + fragment.binding.empty.setDetailText(fragment.getResources().getString(R.string.msg_failed_network_detail));
  92 + fragment.binding.empty.setTitleText(msg);
  93 + fragment.binding.empty.setButton("重试", new View.OnClickListener() {
  94 + @Override
  95 + public void onClick(View v) {
  96 + fragment.currentPage = 1;
  97 + fragment.getPresenter().setData(fragment.getActivity(),"10514343",fragment.state,fragment.currentPage,fragment.pageSize);
  98 + }
  99 + });
  100 + fragment.binding.empty.setLoadingShowing(false);
  101 + fragment.binding.empty.setImage(R.drawable.wufalianjie);
  102 + } else {
  103 + fragment.binding.empty.setVisibility(View.GONE);
  104 + fragment.binding.refreshLayout.setVisibility(View.VISIBLE);
  105 + showToast(msg);
  106 + }
  107 + }
  108 +
  109 +
  110 + public void showToast(String message) {
  111 + AlertUtil.showDeftToast(fragment.getActivity(), message);
  112 + }
  113 +
  114 + public void showEmpty(){
48 115 fragment.binding.empty.setVisibility(View.VISIBLE);
  116 + fragment.binding.refreshLayout.setVisibility(View.GONE);
  117 + fragment.binding.empty.show("没有相关活动", "", R.drawable.bmcg_no);
  118 + }
  119 +
  120 +
  121 + public void showLoading() {
  122 + if (loadingDiaog != null) loadingDiaog.show();
  123 + }
  124 +
  125 + public void hideLoading() {
  126 + if (loadingDiaog != null) loadingDiaog.dismiss();
49 127 }
50 128 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RaceRecorView.java
... ... @@ -82,7 +82,6 @@ public class RaceRecorView implements MvpView {
82 82 }
83 83  
84 84 if(list.size() != 0){
85   - fragment.binding.empty.setVisibility(View.GONE);
86 85 fragment.binding.emptyNet.setVisibility(View.GONE);
87 86 fragment.binding.refreshLayout.setVisibility(View.VISIBLE);
88 87 }else {
... ... @@ -113,19 +112,18 @@ public class RaceRecorView implements MvpView {
113 112  
114 113 public void showEmpty(){
115 114 fragment.binding.refreshLayout.setVisibility(View.GONE);
116   - fragment.binding.emptyNet.setVisibility(View.GONE);
117   - fragment.binding.empty.setVisibility(View.VISIBLE);
  115 + fragment.binding.emptyNet.setVisibility(View.VISIBLE);
118 116 fragment.binding.kilometerNum.setText("0.00");
119 117 fragment.binding.stepNum.setText("--");
120 118 fragment.binding.kilometerTime.setText("00:00:00");
121 119 fragment.binding.kilometerSpeed.setText("--");
  120 + fragment.binding.emptyNet.show("你还没有改线路的成绩", "", R.drawable.bmcg_has);
122 121 }
123 122  
124 123 public void showError(String msg){
125 124 fragment.binding.refreshLayout.finishRefresh();
126 125 fragment.binding.refreshLayout.finishLoadMore();
127 126 if (list.size() == 0) {
128   - fragment.binding.empty.setVisibility(View.GONE);
129 127 fragment.binding.refreshLayout.setVisibility(View.GONE);
130 128 fragment.binding.ryRecord.setVisibility(View.GONE);
131 129 fragment.binding.txAll.setVisibility(View.GONE);
... ... @@ -142,7 +140,6 @@ public class RaceRecorView implements MvpView {
142 140 fragment.binding.emptyNet.setLoadingShowing(false);
143 141 fragment.binding.emptyNet.setImage(R.drawable.wufalianjie);
144 142 } else {
145   - fragment.binding.empty.setVisibility(View.GONE);
146 143 fragment.binding.emptyNet.setVisibility(View.GONE);
147 144 fragment.binding.refreshLayout.setVisibility(View.VISIBLE);
148 145 fragment.binding.ryRecord.setVisibility(View.VISIBLE);
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunLineView.java
... ... @@ -8,6 +8,7 @@ import com.cnlive.libs.base.util.AlertUtil;
8 8 import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity;
9 9 import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity;
10 10 import com.cnlive.moudle.pedometer.ui.adapter.MyRecordAdapter;
  11 +import com.cnlive.moudle.pedometer.ui.adapter.RunLineAdapter;
11 12 import com.cnlive.moudle.pedometer.ui.fragment.RunLineFragment;
12 13 import com.cnlive.strike.data.network.model.BaseInfo;
13 14 import com.cnlive.strike.data.network.model.runAbout.RunLineInfo;
... ... @@ -27,7 +28,7 @@ public class RunLineView implements MvpView {
27 28  
28 29 private RunLineFragment fragment;
29 30 public QMUITipDialog loadingDiaog;
30   - private MyRecordAdapter adapter;
  31 + private RunLineAdapter adapter;
31 32 private List<RunLineInfo.ListBean> list = new ArrayList<>();
32 33  
33 34 public RunLineView(RunLineFragment fragment) {
... ... @@ -53,9 +54,9 @@ public class RunLineView implements MvpView {
53 54 list.clear();
54 55 list.addAll(runLineInfoBaseInfo.getData().getList());
55 56 if(adapter == null){
56   - adapter = new MyRecordAdapter(list,fragment.getActivity(),false);
  57 + adapter = new RunLineAdapter(list,fragment.getActivity());
57 58 fragment.binding.runLineRecy.setAdapter(adapter);
58   - adapter.setClickListener(new MyRecordAdapter.OnClickListener() {
  59 + adapter.setClickListener(new RunLineAdapter.OnClickListener() {
59 60 @Override
60 61 public void onClickListener(RunLineInfo.ListBean bean, int position) {
61 62 RunRaceDetailActivity.startActivity(fragment.getActivity(),bean.getId()+"");
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/MyRecordActivity.java
... ... @@ -57,8 +57,8 @@ public class MyRecordActivity extends AppCompatActivity {
57 57 titleList.add("已结束的活动");
58 58  
59 59 fragmentList = new ArrayList<>();
60   - fragmentList.add(new MyRecordFragment());
61   - fragmentList.add(new MyRecordFragment());
  60 + fragmentList.add(MyRecordFragment.newInstance("0"));
  61 + fragmentList.add(MyRecordFragment.newInstance("1"));
62 62  
63 63 tabs.addTab(tabs.newTab(),0);
64 64 tabs.addTab(tabs.newTab(),1);
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/MyRecordAdapter.java
... ... @@ -13,67 +13,76 @@ import android.widget.RelativeLayout;
13 13 import android.widget.TextView;
14 14  
15 15  
  16 +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
16 17 import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity;
17 18 import com.cnlive.moudle.pedometer.ui.activity.SelfRecordActivity;
18 19 import com.cnlive.moudle.pedometer.ui.fragment.SelfRecordFragment;
19 20 import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView;
  21 +import com.cnlive.moudle.pedometer.utils.CommonUtil;
20 22 import com.cnlive.moudle.pedometer.utils.TimeUtil;
  23 +import com.cnlive.strike.data.network.model.MyRecordInfo;
21 24 import com.cnlive.strike.data.network.model.runAbout.RunLineInfo;
22 25 import com.example.moudle_pedometer.R;
23 26  
24 27 import java.util.ArrayList;
25 28 import java.util.List;
  29 +
26 30 /**
27 31 * Created by hanyayun 019/05/31.
28 32 */
29 33 public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyViewHolder> {
30 34  
31   - private List<RunLineInfo.ListBean> list = new ArrayList<>();
  35 + private List<MyRecordInfo.ListBean> list = new ArrayList<>();
32 36 private Activity context;
33   - private boolean isShow;
34 37 private OnClickListener clickListener;
  38 + private String state;
35 39  
36 40 public void setClickListener(OnClickListener clickListener) {
37 41 this.clickListener = clickListener;
38 42 }
39 43  
40   - public MyRecordAdapter(List<RunLineInfo.ListBean> list, Activity context, boolean isShow) {
  44 + public MyRecordAdapter(List<MyRecordInfo.ListBean> list,String state,Activity context) {
41 45 this.list = list;
  46 + this.state = state;
42 47 this.context = context;
43   - this.isShow = isShow;
44 48 }
45 49  
46 50 @NonNull
47 51 @Override
48 52 public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
49   - View view = LayoutInflater.from(context).inflate(R.layout.item_my_record,viewGroup,false);
  53 + View view = LayoutInflater.from(context).inflate(R.layout.item_my_record, viewGroup, false);
50 54 return new MyViewHolder(view);
51 55 }
52 56  
53 57 @Override
54 58 public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) {
55   - if(isShow){
56   - myViewHolder.my_record_ry.setVisibility(View.VISIBLE);
57   - myViewHolder.has_report.setVisibility(View.GONE);
58   - }else {
59   - myViewHolder.my_record_ry.setVisibility(View.GONE);
60   - if(list.get(i).isSignResult()){
61   - myViewHolder.has_report.setVisibility(View.VISIBLE);
62   - }else {
63   - myViewHolder.has_report.setVisibility(View.GONE);
64   - }
65   - }
66   - myViewHolder.my_record.setOnClickListener(v -> SelfRecordActivity.newInstance(context));
  59 + myViewHolder.my_record_ry.setVisibility(View.VISIBLE);
  60 + myViewHolder.has_report.setVisibility(View.GONE);
  61 + myViewHolder.my_record.setOnClickListener(v -> startAc(list.get(i)));
67 62 // myViewHolder.check_raking.setOnClickListener(v -> );
68   - if(clickListener != null){
69   - myViewHolder.item_ly.setOnClickListener(v -> clickListener.onClickListener(list.get(i),i));
  63 + if (clickListener != null) {
  64 + myViewHolder.item_ly.setOnClickListener(v -> clickListener.onClickListener(list.get(i), i));
70 65 }
71 66  
72 67 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()+"");
  68 + myViewHolder.activity_time.setText(TimeUtil.getStampToTime(list.get(i).getStart_time(), "yyyy.MM.dd") + "——" + TimeUtil.getStampToTime(list.get(i).getEnd_time(), "yyyy.MM.dd"));
  69 + myViewHolder.line_address.setText(list.get(i).getAddress() + " " + list.get(i).getMileage());
  70 + myViewHolder.people_part.setText(list.get(i).getSignupNum() + "");
76 71 myViewHolder.join_person.initIconData(list.get(i).getFaceUrl());
  72 +// myViewHolder.day_num.setText(list.get(i).getSignupNum());
  73 + if(state.equals("0")){
  74 + myViewHolder.day_num.setVisibility(View.VISIBLE);
  75 + myViewHolder.after_finish.setText("天后结束");
  76 + myViewHolder.day_num.setText("2");
  77 + }else {
  78 + myViewHolder.day_num.setVisibility(View.GONE);
  79 + myViewHolder.after_finish.setText("已结束");
  80 + }
  81 + }
  82 +
  83 + private void startAc(MyRecordInfo.ListBean listBean){
  84 + CommonInfo.setStreetId(context,listBean.getId()+"");
  85 + RaceRecordActivity.newInstance(context,listBean.getTitle());
77 86 }
78 87  
79 88  
... ... @@ -82,7 +91,7 @@ public class MyRecordAdapter extends RecyclerView.Adapter&lt;MyRecordAdapter.MyView
82 91 return list.size();
83 92 }
84 93  
85   - class MyViewHolder extends RecyclerView.ViewHolder{
  94 + class MyViewHolder extends RecyclerView.ViewHolder {
86 95  
87 96 TextView check_raking;
88 97 TextView my_record;
... ... @@ -94,6 +103,8 @@ public class MyRecordAdapter extends RecyclerView.Adapter&lt;MyRecordAdapter.MyView
94 103 TextView activity_time;
95 104 TextView line_address;
96 105 TextView people_part;
  106 + TextView day_num;
  107 + TextView after_finish;
97 108  
98 109 public MyViewHolder(@NonNull View itemView) {
99 110 super(itemView);
... ... @@ -107,10 +118,12 @@ public class MyRecordAdapter extends RecyclerView.Adapter&lt;MyRecordAdapter.MyView
107 118 activity_time = itemView.findViewById(R.id.activity_time);
108 119 line_address = itemView.findViewById(R.id.line_address);
109 120 people_part = itemView.findViewById(R.id.people_part);
  121 + day_num = itemView.findViewById(R.id.day_num);
  122 + after_finish = itemView.findViewById(R.id.after_finish);
110 123 }
111 124 }
112 125  
113   - public interface OnClickListener{
114   - void onClickListener(RunLineInfo.ListBean msg,int position);
  126 + public interface OnClickListener {
  127 + void onClickListener(MyRecordInfo.ListBean msg, int position);
115 128 }
116 129 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/RunLineAdapter.java 0 → 100644
  1 +package com.cnlive.moudle.pedometer.ui.adapter;
  2 +
  3 +import android.app.Activity;
  4 +import android.support.annotation.NonNull;
  5 +import android.support.v7.widget.RecyclerView;
  6 +import android.view.LayoutInflater;
  7 +import android.view.View;
  8 +import android.view.ViewGroup;
  9 +import android.widget.ImageView;
  10 +import android.widget.RelativeLayout;
  11 +import android.widget.TextView;
  12 +
  13 +import com.cnlive.moudle.pedometer.ui.activity.SelfRecordActivity;
  14 +import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView;
  15 +import com.cnlive.moudle.pedometer.utils.TimeUtil;
  16 +import com.cnlive.strike.data.network.model.runAbout.RunLineInfo;
  17 +import com.example.moudle_pedometer.R;
  18 +
  19 +import java.util.ArrayList;
  20 +import java.util.List;
  21 +
  22 +/**
  23 + * Created by hanyayun 019/05/31.
  24 + */
  25 +public class RunLineAdapter extends RecyclerView.Adapter<RunLineAdapter.MyViewHolder> {
  26 +
  27 + private List<RunLineInfo.ListBean> list = new ArrayList<>();
  28 + private Activity context;
  29 + private OnClickListener clickListener;
  30 +
  31 + public void setClickListener(OnClickListener clickListener) {
  32 + this.clickListener = clickListener;
  33 + }
  34 +
  35 + public RunLineAdapter(List<RunLineInfo.ListBean> list, Activity context) {
  36 + this.list = list;
  37 + this.context = context;
  38 + }
  39 +
  40 + @NonNull
  41 + @Override
  42 + public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
  43 + View view = LayoutInflater.from(context).inflate(R.layout.item_my_record, viewGroup, false);
  44 + return new MyViewHolder(view);
  45 + }
  46 +
  47 + @Override
  48 + public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) {
  49 +
  50 + myViewHolder.my_record_ry.setVisibility(View.GONE);
  51 + if (list.get(i).isSignResult()) {
  52 + myViewHolder.has_report.setVisibility(View.VISIBLE);
  53 + } else {
  54 + myViewHolder.has_report.setVisibility(View.GONE);
  55 + }
  56 + myViewHolder.my_record.setOnClickListener(v -> SelfRecordActivity.newInstance(context));
  57 +// myViewHolder.check_raking.setOnClickListener(v -> );
  58 + if (clickListener != null) {
  59 + myViewHolder.item_ly.setOnClickListener(v -> clickListener.onClickListener(list.get(i), i));
  60 + }
  61 +
  62 + myViewHolder.line_name.setText(list.get(i).getTitle());
  63 + myViewHolder.activity_time.setText(TimeUtil.getStampToTime(list.get(i).getStart_time(), "yyyy.MM.dd") + "——" + TimeUtil.getStampToTime(list.get(i).getEnd_time(), "yyyy.MM.dd"));
  64 + myViewHolder.line_address.setText(list.get(i).getAddress() + " " + list.get(i).getMileage());
  65 + myViewHolder.people_part.setText(list.get(i).getSignupNum() + "");
  66 + myViewHolder.join_person.initIconData(list.get(i).getFaceUrl());
  67 +
  68 +
  69 + }
  70 +
  71 +
  72 + @Override
  73 + public int getItemCount() {
  74 + return list.size();
  75 + }
  76 +
  77 + class MyViewHolder extends RecyclerView.ViewHolder {
  78 +
  79 + TextView check_raking;
  80 + TextView my_record;
  81 + FivePersonIconView join_person;
  82 + RelativeLayout item_ly;
  83 + RelativeLayout my_record_ry;
  84 + ImageView has_report;
  85 + TextView line_name;
  86 + TextView activity_time;
  87 + TextView line_address;
  88 + TextView people_part;
  89 +
  90 + public MyViewHolder(@NonNull View itemView) {
  91 + super(itemView);
  92 + check_raking = itemView.findViewById(R.id.check_raking);
  93 + my_record = itemView.findViewById(R.id.my_record);
  94 + join_person = itemView.findViewById(R.id.join_person);
  95 + item_ly = itemView.findViewById(R.id.item_ly);
  96 + my_record_ry = itemView.findViewById(R.id.my_record_ry);
  97 + has_report = itemView.findViewById(R.id.has_report);
  98 + line_name = itemView.findViewById(R.id.line_name);
  99 + activity_time = itemView.findViewById(R.id.activity_time);
  100 + line_address = itemView.findViewById(R.id.line_address);
  101 + people_part = itemView.findViewById(R.id.people_part);
  102 + }
  103 + }
  104 +
  105 + public interface OnClickListener {
  106 + void onClickListener(RunLineInfo.ListBean msg, int position);
  107 + }
  108 +}
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/MyRecordFragment.java
... ... @@ -11,6 +11,9 @@ import com.cnlive.moudle.pedometer.frame.presenter.MyRecordPresenter;
11 11 import com.cnlive.moudle.pedometer.frame.view.MyRecordView;
12 12 import com.example.moudle_pedometer.R;
13 13 import com.example.moudle_pedometer.databinding.FragmentMyRecordBinding;
  14 +import com.scwang.smartrefresh.layout.api.RefreshLayout;
  15 +import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
  16 +import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
14 17  
15 18 /**
16 19 * Created by hanyayun 019/05/30.
... ... @@ -18,8 +21,16 @@ import com.example.moudle_pedometer.databinding.FragmentMyRecordBinding;
18 21 public class MyRecordFragment extends MvpBindingFragment<MyRecordView, MyRecordPresenter,Object, FragmentMyRecordBinding> {
19 22  
20 23  
21   - public MyRecordFragment() {
22   - // Required empty public constructor
  24 + public int currentPage = 1;
  25 + public int pageSize = 10;
  26 + public String state = "0";
  27 +
  28 + public static MyRecordFragment newInstance(String state){
  29 + MyRecordFragment fragment = new MyRecordFragment();
  30 + Bundle bundle = new Bundle();
  31 + bundle.putString("state",state);
  32 + fragment.setArguments(bundle);
  33 + return fragment;
23 34 }
24 35  
25 36 @Override
... ... @@ -30,7 +41,22 @@ public class MyRecordFragment extends MvpBindingFragment&lt;MyRecordView, MyRecord
30 41 @Override
31 42 public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
32 43 super.onViewCreated(view, savedInstanceState);
  44 + state = getArguments().getString("state");
33 45 if(getMvpView() != null) getMvpView().initView();
34   - getPresenter().getData();
  46 + getPresenter().setData(getActivity(),"10514343",state,currentPage,pageSize);
  47 + binding.refreshLayout.setOnRefreshListener(new OnRefreshListener() {
  48 + @Override
  49 + public void onRefresh(@NonNull RefreshLayout refreshLayout) {
  50 + currentPage = 1;
  51 + getPresenter().setData(getActivity(),"10514343",state,currentPage,pageSize);
  52 + }
  53 + });
  54 + binding.refreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
  55 + @Override
  56 + public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
  57 + currentPage++;
  58 + getPresenter().setData(getActivity(),"10514343",state,currentPage,pageSize);
  59 + }
  60 + });
35 61 }
36 62 }
... ...
moudle_pedometer/src/main/res/drawable-hdpi/share_background.png

222 KB | W: | H:

208 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
moudle_pedometer/src/main/res/drawable-hdpi/share_logo.png 0 → 100644

8.58 KB

moudle_pedometer/src/main/res/drawable-xhdpi/share_background.png

286 KB | W: | H:

272 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
moudle_pedometer/src/main/res/drawable-xhdpi/share_logo.png 0 → 100644

9.28 KB

moudle_pedometer/src/main/res/drawable-xxhdpi/share_background.png

675 KB | W: | H:

633 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
moudle_pedometer/src/main/res/drawable-xxhdpi/share_logo.png 0 → 100644

23.4 KB

moudle_pedometer/src/main/res/layout/activity_share_record.xml
... ... @@ -49,6 +49,7 @@
49 49 android:background="@drawable/share_background">
50 50  
51 51 <RelativeLayout
  52 + android:id="@+id/share_ry"
52 53 android:layout_width="match_parent"
53 54 android:layout_height="wrap_content"
54 55 android:layout_marginLeft="20dp"
... ... @@ -259,6 +260,15 @@
259 260 android:src="@drawable/erwe" />
260 261 </LinearLayout>
261 262 </RelativeLayout>
  263 +
  264 + <ImageView
  265 + android:layout_width="wrap_content"
  266 + android:layout_height="wrap_content"
  267 + android:src="@drawable/share_logo"
  268 + android:layout_below="@id/share_ry"
  269 + android:layout_marginTop="30dp"
  270 + android:layout_centerHorizontal="true"
  271 + />
262 272 </RelativeLayout>
263 273  
264 274 </RelativeLayout>
... ...
moudle_pedometer/src/main/res/layout/fragment_my_record.xml
1 1 <layout xmlns:android="http://schemas.android.com/apk/res/android">
  2 +
2 3 <RelativeLayout
3 4 android:layout_width="match_parent"
4 5 android:layout_height="match_parent"
5 6 android:orientation="vertical">
6 7  
7   - <android.support.v7.widget.RecyclerView
8   - android:id="@+id/my_record_recy"
  8 + <com.scwang.smartrefresh.layout.SmartRefreshLayout
  9 + android:id="@+id/refreshLayout"
9 10 android:layout_width="match_parent"
10   - android:layout_height="match_parent"/>
  11 + android:layout_height="match_parent">
  12 +
  13 + <android.support.v7.widget.RecyclerView
  14 + android:id="@+id/my_record_recy"
  15 + android:layout_width="match_parent"
  16 + android:layout_height="match_parent" />
  17 + </com.scwang.smartrefresh.layout.SmartRefreshLayout>
11 18  
12   - <RelativeLayout
  19 + <com.cnlive.strike.ui.widget.UIEmptyView
13 20 android:id="@+id/empty"
14 21 android:layout_width="match_parent"
15 22 android:layout_height="match_parent"
16   - android:visibility="gone"
17   - android:background="#F8F8F8">
18   -
19   - <LinearLayout
20   - android:layout_width="wrap_content"
21   - android:layout_height="wrap_content"
22   - android:layout_centerInParent="true"
23   - android:orientation="vertical">
24   - <ImageView
25   - android:layout_width="wrap_content"
26   - android:layout_height="wrap_content"
27   - android:src="@drawable/bmcg_no" />
28   - <TextView
29   - android:layout_width="wrap_content"
30   - android:layout_height="wrap_content"
31   - android:text="没有进行中的活动"
32   - android:textColor="#333333"
33   - android:textSize="15sp"
34   - android:layout_marginTop="15dp"
35   - android:layout_gravity="center"
36   - />
37   - </LinearLayout>
38   -
39   - </RelativeLayout>
  23 + android:visibility="gone" />
40 24 </RelativeLayout>
41 25 </layout>
42 26 \ No newline at end of file
... ...
moudle_pedometer/src/main/res/layout/fragment_race_recor.xml
... ... @@ -154,38 +154,6 @@
154 154 android:background="@color/white" />
155 155 </com.scwang.smartrefresh.layout.SmartRefreshLayout>
156 156  
157   -
158   - <RelativeLayout
159   - android:id="@+id/empty"
160   - android:layout_width="match_parent"
161   - android:layout_height="match_parent"
162   - android:visibility="gone"
163   - android:background="@color/white">
164   -
165   - <LinearLayout
166   - android:layout_width="wrap_content"
167   - android:layout_height="wrap_content"
168   - android:layout_centerInParent="true"
169   - android:orientation="vertical">
170   -
171   - <ImageView
172   - android:layout_width="wrap_content"
173   - android:layout_height="wrap_content"
174   - android:src="@drawable/bmcg_has" />
175   -
176   - <TextView
177   - android:layout_width="wrap_content"
178   - android:layout_height="wrap_content"
179   - android:text="您还没有该线路的成绩"
180   - android:textColor="#333333"
181   - android:textSize="15sp"
182   - android:layout_marginTop="15dp"
183   - android:layout_gravity="center"
184   - />
185   - </LinearLayout>
186   -
187   - </RelativeLayout>
188   -
189 157 <com.cnlive.strike.ui.widget.UIEmptyView
190 158 android:id="@+id/empty_net"
191 159 android:layout_width="match_parent"
... ...
moudle_pedometer/src/main/res/layout/fragment_self_record.xml
... ... @@ -12,6 +12,7 @@
12 12 android:layout_height="?attr/qmui_topbar_height" />
13 13  
14 14 <RelativeLayout
  15 + android:id="@+id/ry_record"
15 16 android:layout_width="match_parent"
16 17 android:layout_height="wrap_content"
17 18 android:layout_marginTop="10dp"
... ... @@ -39,7 +40,7 @@
39 40 android:layout_height="wrap_content"
40 41 android:layout_marginTop="20dp"
41 42 android:layout_centerHorizontal="true"
42   - android:text="20.56"
  43 + android:text="0.0"
43 44 android:textColor="@color/white"
44 45 android:textSize="50sp"
45 46 />
... ... @@ -72,7 +73,7 @@
72 73 android:layout_gravity="center"
73 74 android:layout_marginTop="5dp"
74 75 android:textSize="20sp"
75   - android:text="5"
  76 + android:text="0"
76 77 android:textColor="@color/white" />
77 78 </LinearLayout>
78 79  
... ... @@ -98,7 +99,7 @@
98 99 android:layout_gravity="center"
99 100 android:layout_marginTop="5dp"
100 101 android:textSize="20sp"
101   - android:text="00:27:23"
  102 + android:text="00:00:00"
102 103 android:textColor="@color/white" />
103 104 </LinearLayout>
104 105  
... ... @@ -123,7 +124,7 @@
123 124 android:layout_gravity="center"
124 125 android:layout_marginTop="5dp"
125 126 android:textSize="20sp"
126   - android:text="1234"
  127 + android:text="--"
127 128 android:textColor="@color/white" />
128 129 </LinearLayout>
129 130 </RelativeLayout>
... ... @@ -131,6 +132,7 @@
131 132 </RelativeLayout>
132 133  
133 134 <TextView
  135 + android:id="@+id/tx_all"
134 136 android:layout_width="wrap_content"
135 137 android:layout_height="wrap_content"
136 138 android:layout_marginLeft="10dp"
... ... @@ -139,12 +141,18 @@
139 141 android:textColor="#333333"
140 142 android:text="@string/has_take_part_line" />
141 143  
142   - <android.support.v7.widget.RecyclerView
143   - android:id="@+id/record_recy"
  144 + <com.scwang.smartrefresh.layout.SmartRefreshLayout
  145 + android:id="@+id/refreshLayout"
144 146 android:layout_width="match_parent"
145   - android:layout_height="match_parent"
146   - android:padding="10dp"
147   - android:background="@color/white" />
  147 + android:layout_height="match_parent">
  148 +
  149 + <android.support.v7.widget.RecyclerView
  150 + android:id="@+id/record_recy"
  151 + android:layout_width="match_parent"
  152 + android:layout_height="match_parent"
  153 + android:padding="10dp"
  154 + android:background="@color/white" />
  155 + </com.scwang.smartrefresh.layout.SmartRefreshLayout>
148 156  
149 157 <RelativeLayout
150 158 android:id="@+id/empty"
... ... @@ -192,6 +200,12 @@
192 200 </LinearLayout>
193 201  
194 202 </RelativeLayout>
  203 +
  204 + <com.cnlive.strike.ui.widget.UIEmptyView
  205 + android:id="@+id/empty_net"
  206 + android:layout_width="match_parent"
  207 + android:layout_height="match_parent"
  208 + android:visibility="gone" />
195 209 </LinearLayout>
196 210 </layout>
197 211  
... ...
moudle_pedometer/src/main/res/layout/item_my_record.xml
... ... @@ -107,10 +107,20 @@
107 107 android:layout_marginTop="10dp">
108 108  
109 109 <TextView
  110 + android:id="@+id/day_num"
110 111 android:layout_width="wrap_content"
111 112 android:layout_height="wrap_content"
112 113 android:layout_centerVertical="true"
113   - android:text="3天后结束"
  114 + android:textColor="#36C28D"
  115 + android:textSize="12sp" />
  116 +
  117 + <TextView
  118 + android:id="@+id/after_finish"
  119 + android:layout_width="wrap_content"
  120 + android:layout_height="wrap_content"
  121 + android:layout_centerVertical="true"
  122 + android:layout_toRightOf="@id/day_num"
  123 + android:text="@string/later_finish"
114 124 android:textColor="#333333"
115 125 android:textSize="12sp" />
116 126  
... ...
moudle_pedometer/src/main/res/values/strings.xml
... ... @@ -72,6 +72,7 @@
72 72 <!---->
73 73 <!--网络请求-->
74 74 <string name="retry">重试</string>
  75 + <string name="later_finish">天后结束</string>
75 76  
76 77  
77 78 </resources>
... ...