Commit ac7a7c286c4cfdb2b717b1d8415f72fa937d0936

Authored by 杨帅
2 parents 447fd430 54e1430c

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RaceRecorFragment.java
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RaceRecorPresenter.java
... ... @@ -38,7 +38,7 @@ public class RaceRecorPresenter extends MvpBasePresenter<RaceRecorView> {
38 38 }).<BaseInfo<RaceRecordInfo>>event().setFailureCallback(new FailureCallback() {
39 39 @Override
40 40 public void onFailure(int code, String message) {
41   - getView().showEmpty();
  41 + getView().showError();
42 42 }
43 43 }).setSuccessCallback(new SuccessCallback<BaseInfo<RaceRecordInfo>>() {
44 44 @Override
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RaceRecorView.java
... ... @@ -26,14 +26,17 @@ public class RaceRecorView implements MvpView {
26 26 this.fragment = fragment;
27 27 }
28 28  
29   - public void setData(BaseInfo<RaceRecordInfo> registerInfo){
30   - List<String> raceRecordModels = new ArrayList<>();
31   - raceRecordModels.add("0");
32   - raceRecordModels.add("0");
33   - raceRecordModels.add("0");
34   - raceRecordModels.add("0");
  29 + public void setData(BaseInfo<RaceRecordInfo> raceRecordInfoBaseInfo){
  30 + if(raceRecordInfoBaseInfo.getData().getBestResult() == null){
  31 + showEmpty();
  32 + return;
  33 + }
  34 + fragment.binding.kilometerNum.setText(raceRecordInfoBaseInfo.getData().getBestResult().getMileage());
  35 + fragment.binding.stepNum.setText(raceRecordInfoBaseInfo.getData().getBestResult().getStep());
  36 + fragment.binding.kilometerTime.setText(raceRecordInfoBaseInfo.getData().getBestResult().getEmployTime());
  37 + fragment.binding.kilometerSpeed.setText(raceRecordInfoBaseInfo.getData().getBestResult().getPace());
35 38 fragment.binding.recordRecy.setLayoutManager(new LinearLayoutManager(fragment.getActivity()));
36   - fragment.binding.recordRecy.setAdapter(new RaceRecordAdapter(raceRecordModels,fragment.getActivity()));
  39 + fragment.binding.recordRecy.setAdapter(new RaceRecordAdapter(raceRecordInfoBaseInfo.getData().getEventRouteRecordBeanVoList(),fragment.getActivity()));
37 40 }
38 41  
39 42 public void initView(){
... ... @@ -51,5 +54,13 @@ public class RaceRecorView implements MvpView {
51 54 public void showEmpty(){
52 55 fragment.binding.recordRecy.setVisibility(View.GONE);
53 56 fragment.binding.empty.setVisibility(View.VISIBLE);
  57 + fragment.binding.kilometerNum.setText("0.00");
  58 + fragment.binding.stepNum.setText("--");
  59 + fragment.binding.kilometerTime.setText("00:00:00");
  60 + fragment.binding.kilometerSpeed.setText("--");
  61 + }
  62 +
  63 + public void showError(){
  64 +
54 65 }
55 66 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/SelfRecordView.java
... ... @@ -32,7 +32,7 @@ public class SelfRecordView implements MvpView{
32 32 raceRecordModels.add("0");
33 33 raceRecordModels.add("0");
34 34 fragment.binding.recordRecy.setLayoutManager(new LinearLayoutManager(fragment.getActivity()));
35   - fragment.binding.recordRecy.setAdapter(new RaceRecordAdapter(raceRecordModels,fragment.getActivity()));
  35 +// fragment.binding.recordRecy.setAdapter(new RaceRecordAdapter(raceRecordModels,fragment.getActivity()));
36 36 }
37 37  
38 38 public void initView(){
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/TakePartView.java
... ... @@ -30,6 +30,10 @@ public class TakePartView implements MvpView {
30 30 fragment.binding.topbar.setTitle("已参与");
31 31 fragment.binding.takePartRecy.setLayoutManager(new LinearLayoutManager(fragment.getActivity()));
32 32  
  33 + fragment.binding.refreshLayout.setOnRefreshListener(v ->{
  34 +
  35 + });
  36 +// fragment.binding.refreshLayout.setOn
33 37 }
34 38  
35 39 public void onSuccess(BaseInfo<TakePartPeopleInfo> partPeopleInfoBaseInfo){
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/RaceRecordAdapter.java
... ... @@ -11,16 +11,18 @@ import android.widget.ImageView;
11 11 import android.widget.TextView;
12 12  
13 13  
  14 +import com.cnlive.moudle.pedometer.utils.TimeUtil;
  15 +import com.cnlive.strike.data.network.model.RaceRecordInfo;
14 16 import com.example.moudle_pedometer.R;
15 17  
16 18 import java.util.List;
17 19  
18 20 public class RaceRecordAdapter extends RecyclerView.Adapter<RaceRecordAdapter.MyHolder> {
19 21  
20   - private List<String> list;
  22 + private List<RaceRecordInfo.EventRouteRecordBeanVoListBean> list;
21 23 private Context context;
22 24  
23   - public RaceRecordAdapter(List<String> list, Context context) {
  25 + public RaceRecordAdapter(List<RaceRecordInfo.EventRouteRecordBeanVoListBean> list, Context context) {
24 26 this.list = list;
25 27 this.context = context;
26 28 }
... ... @@ -34,6 +36,13 @@ public class RaceRecordAdapter extends RecyclerView.Adapter&lt;RaceRecordAdapter.My
34 36  
35 37 @Override
36 38 public void onBindViewHolder(@NonNull MyHolder myHolder, int i) {
  39 + myHolder.record_time_day.setText(TimeUtil.getStampToTime(list.get(i).getCreateTime(),"MM-dd"));
  40 + myHolder.record_time.setText(TimeUtil.getStampToTime(list.get(i).getCreateTime(),"HH:mm"));
  41 + myHolder.item_title.setText(list.get(i).getEventTitle());
  42 + myHolder.record_kli.setText(list.get(i).getMileage());
  43 + myHolder.record_minit.setText(list.get(i).getEmployTime());
  44 + myHolder.record_speed.setText(list.get(i).getPace());
  45 + myHolder.record_step.setText(list.get(i).getStep());
37 46  
38 47 }
39 48  
... ... @@ -44,9 +53,10 @@ public class RaceRecordAdapter extends RecyclerView.Adapter&lt;RaceRecordAdapter.My
44 53  
45 54 class MyHolder extends RecyclerView.ViewHolder{
46 55  
  56 + TextView record_time_day;
47 57 TextView record_time;
48 58 ImageView item_img;
49   - TextView item_time;
  59 + TextView item_title;
50 60 TextView record_kli;
51 61 TextView record_minit;
52 62 TextView record_speed;
... ... @@ -54,9 +64,10 @@ public class RaceRecordAdapter extends RecyclerView.Adapter&lt;RaceRecordAdapter.My
54 64  
55 65 public MyHolder(@NonNull View itemView) {
56 66 super(itemView);
  67 + record_time_day = itemView.findViewById(R.id.record_time_day);
57 68 record_time = itemView.findViewById(R.id.record_time);
58 69 item_img = itemView.findViewById(R.id.item_img);
59   - item_time = itemView.findViewById(R.id.item_time);
  70 + item_title = itemView.findViewById(R.id.item_title);
60 71 record_kli = itemView.findViewById(R.id.kilometer_num);
61 72 record_minit = itemView.findViewById(R.id.record_minit);
62 73 record_speed = itemView.findViewById(R.id.record_speed);
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RaceRecorFragment.java
... ... @@ -14,7 +14,7 @@ import com.example.moudle_pedometer.databinding.FragmentRaceRecorBinding;
14 14 /**
15 15 * Created by hanyayun 019/05/30.
16 16 */
17   -public class RaceRecorFragment extends MvpBindingFragment<RaceRecorView, RaceRecorPresenter, Object, FragmentRaceRecorBinding> {
  17 +public class RaceRecorFragment extends MvpBindingFragment<RaceRecorView, RaceRecorPresenter,Object, FragmentRaceRecorBinding> {
18 18  
19 19  
20 20 public RaceRecorFragment() {
... ... @@ -25,7 +25,8 @@ public class RaceRecorFragment extends MvpBindingFragment&lt;RaceRecorView, RaceRec
25 25 @Override
26 26 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
27 27 super.onViewCreated(view, savedInstanceState);
28   - if (getMvpView() != null) getMvpView().initView();
  28 + if(getMvpView() != null) getMvpView().initView();
  29 + getPresenter().getData(getActivity(),"116","10514343","1","10");
29 30 }
30 31  
31 32 @Override
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/TimeUtil.java
... ... @@ -73,9 +73,9 @@ public class TimeUtil {
73 73 *
74 74 * @return 格式化后的日期
75 75 */
76   - public static String getStampToTime(long time) {
  76 + public static String getStampToTime(long time,String pattern) {
77 77 String res;
78   - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  78 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);//"yyyy-MM-dd HH:mm:ss"
79 79 long lt = new Long(time * 1000);
80 80 Date date = new Date(lt);
81 81 res = simpleDateFormat.format(date);
... ...
moudle_pedometer/src/main/res/layout/fragment_race_recor.xml
... ... @@ -32,9 +32,9 @@
32 32 android:layout_alignParentRight="true">
33 33  
34 34 <TextView
  35 + android:id="@+id/kilometer_num"
35 36 android:layout_width="wrap_content"
36 37 android:layout_height="wrap_content"
37   - android:text="1.53"
38 38 android:textColor="@color/white"
39 39 android:textSize="30sp" />
40 40  
... ... @@ -56,13 +56,11 @@
56 56 android:layout_marginRight="20dp">
57 57  
58 58 <LinearLayout
59   - android:id="@+id/kilometer_ly"
60 59 android:layout_width="wrap_content"
61 60 android:layout_height="wrap_content"
62 61 android:orientation="vertical">
63 62  
64 63 <TextView
65   - android:id="@+id/kilometer"
66 64 android:layout_width="wrap_content"
67 65 android:layout_height="wrap_content"
68 66 android:text="@string/stepnum"
... ... @@ -71,25 +69,22 @@
71 69 android:textColor="@color/white" />
72 70  
73 71 <TextView
  72 + android:id="@+id/step_num"
74 73 android:layout_width="wrap_content"
75 74 android:layout_height="wrap_content"
76   - android:layout_below="@id/kilometer"
77 75 android:layout_marginTop="5dp"
78 76 android:textSize="23sp"
79   - android:text="1234"
80 77 android:textColor="@color/white" />
81 78 </LinearLayout>
82 79  
83 80  
84 81 <LinearLayout
85   - android:id="@+id/foot_ly"
86 82 android:layout_width="wrap_content"
87 83 android:layout_height="wrap_content"
88 84 android:layout_centerInParent="true"
89 85 android:orientation="vertical">
90 86  
91 87 <TextView
92   - android:id="@+id/foot"
93 88 android:layout_width="wrap_content"
94 89 android:layout_height="wrap_content"
95 90 android:textSize="12sp"
... ... @@ -98,12 +93,12 @@
98 93 android:textColor="@color/white" />
99 94  
100 95 <TextView
  96 + android:id="@+id/kilometer_time"
101 97 android:layout_width="wrap_content"
102 98 android:layout_height="wrap_content"
103 99 android:layout_gravity="center"
104 100 android:layout_marginTop="5dp"
105 101 android:textSize="23sp"
106   - android:text="00:27:23"
107 102 android:textColor="@color/white" />
108 103 </LinearLayout>
109 104  
... ... @@ -114,7 +109,6 @@
114 109 android:orientation="vertical">
115 110  
116 111 <TextView
117   - android:id="@+id/kilometer_time"
118 112 android:layout_width="wrap_content"
119 113 android:layout_height="wrap_content"
120 114 android:textSize="12sp"
... ... @@ -123,12 +117,12 @@
123 117 android:textColor="@color/white" />
124 118  
125 119 <TextView
  120 + android:id="@+id/kilometer_speed"
126 121 android:layout_width="wrap_content"
127 122 android:layout_height="wrap_content"
128 123 android:layout_gravity="center"
129 124 android:layout_marginTop="5dp"
130 125 android:textSize="23sp"
131   - android:text="22'22''"
132 126 android:textColor="@color/white" />
133 127 </LinearLayout>
134 128 </RelativeLayout>
... ... @@ -156,7 +150,7 @@
156 150 android:layout_width="match_parent"
157 151 android:layout_height="match_parent"
158 152 android:visibility="gone"
159   - android:background="#F8F8F8">
  153 + android:background="@color/white">
160 154  
161 155 <LinearLayout
162 156 android:layout_width="wrap_content"
... ... @@ -181,6 +175,7 @@
181 175 </LinearLayout>
182 176  
183 177 </RelativeLayout>
  178 +
184 179 </LinearLayout>
185 180 </layout>
186 181  
... ...
moudle_pedometer/src/main/res/layout/fragment_take_part.xml
... ... @@ -11,10 +11,18 @@
11 11 android:layout_width="match_parent"
12 12 android:layout_height="?attr/actionBarSize"/>
13 13  
14   - <android.support.v7.widget.RecyclerView
15   - android:id="@+id/take_part_recy"
  14 +
  15 + <com.scwang.smartrefresh.layout.SmartRefreshLayout
  16 + android:id="@+id/refreshLayout"
16 17 android:layout_width="match_parent"
17   - android:layout_height="match_parent"/>
  18 + android:layout_height="match_parent">
  19 +
  20 + <android.support.v7.widget.RecyclerView
  21 + android:id="@+id/take_part_recy"
  22 + android:layout_width="match_parent"
  23 + android:layout_height="match_parent"/>
  24 + </com.scwang.smartrefresh.layout.SmartRefreshLayout>
  25 +
18 26  
19 27 <com.cnlive.strike.ui.widget.UIEmptyView
20 28 android:id="@+id/empty"
... ...
moudle_pedometer/src/main/res/layout/item_race_record.xml
... ... @@ -47,7 +47,7 @@
47 47 android:layout_marginLeft="15dp">
48 48  
49 49 <TextView
50   - android:id="@+id/item_time"
  50 + android:id="@+id/item_title"
51 51 android:layout_width="wrap_content"
52 52 android:layout_height="wrap_content"
53 53 android:textSize="12sp"
... ...