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