Commit 27acc1f9552e2c7bb28f8680e676aa9f9c3aa108
1 parent
ee009e23
1 修改详情页相关UI,标题栏为渐变特效
Showing
10 changed files
with
430 additions
and
18 deletions
moudle_pedometer/src/main/AndroidManifest.xml
| ... | ... | @@ -135,12 +135,15 @@ |
| 135 | 135 | android:process=":step" /> |
| 136 | 136 | <activity |
| 137 | 137 | android:name="com.cnlive.moudle.pedometer.ui.activity.UploadFailDetailActivity" |
| 138 | - android:launchMode="singleTask" | |
| 139 | - /> | |
| 138 | + android:launchMode="singleTask" /> | |
| 140 | 139 | <!--全部成绩详情页--> |
| 141 | 140 | <activity |
| 142 | 141 | android:name="com.cnlive.moudle.pedometer.ui.activity.ALLScoreDetailActivity" |
| 143 | 142 | android:launchMode="singleTask" /> |
| 143 | + <!--进行中的活动--> | |
| 144 | + <activity | |
| 145 | + android:name="com.cnlive.moudle.pedometer.ui.activity.OnGoingActivity" | |
| 146 | + android:launchMode="singleTask" /> | |
| 144 | 147 | <!--************************************************路径工具**********************************************--> |
| 145 | 148 | <service |
| 146 | 149 | android:name="com.cnlive.moudle.collectionTrace.service.CollKeepLiveService" | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/ALLScoreDetailFragmentPresenter.java
| ... | ... | @@ -19,6 +19,7 @@ import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; |
| 19 | 19 | import com.example.moudle_pedometer.R; |
| 20 | 20 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 21 | 21 | |
| 22 | +import java.util.ArrayList; | |
| 22 | 23 | import java.util.List; |
| 23 | 24 | |
| 24 | 25 | public class ALLScoreDetailFragmentPresenter extends MvpBasePresenter<ALLScoreDetailFragmentView> { |
| ... | ... | @@ -56,6 +57,7 @@ public class ALLScoreDetailFragmentPresenter extends MvpBasePresenter<ALLScoreDe |
| 56 | 57 | if (mClient == null) { |
| 57 | 58 | mClient = new LBSTraceClient(context); |
| 58 | 59 | } |
| 60 | + List<LatLng> allResultList = new ArrayList<>(); | |
| 59 | 61 | MyMapUtil.queryHistoryTrace(context, mClient, entityName, startTime, endTime, new MyMapUtil.CallBack() { |
| 60 | 62 | @Override |
| 61 | 63 | public void success(List<LatLng> resultPoints) { |
| ... | ... | @@ -66,6 +68,7 @@ public class ALLScoreDetailFragmentPresenter extends MvpBasePresenter<ALLScoreDe |
| 66 | 68 | //用户暂停了 |
| 67 | 69 | if (runningFinishBean.isPause()) { |
| 68 | 70 | MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, 0); |
| 71 | + allResultList.addAll(resultPoints); | |
| 69 | 72 | } |
| 70 | 73 | //用户没有暂停 |
| 71 | 74 | else { |
| ... | ... | @@ -82,12 +85,23 @@ public class ALLScoreDetailFragmentPresenter extends MvpBasePresenter<ALLScoreDe |
| 82 | 85 | if (!TextUtils.isEmpty(runningFinishBean.getUserContinueTime())) { |
| 83 | 86 | continueTime = Long.parseLong(runningFinishBean.getUserContinueTime()); |
| 84 | 87 | } |
| 85 | - long userFinishTime=0; | |
| 86 | - if (!TextUtils.isEmpty(runningFinishBean.getUserFinishTime())){ | |
| 88 | + long userFinishTime = 0; | |
| 89 | + if (!TextUtils.isEmpty(runningFinishBean.getUserFinishTime())) { | |
| 87 | 90 | userFinishTime = Long.parseLong(runningFinishBean.getUserFinishTime()); |
| 88 | 91 | } |
| 89 | 92 | //开始进行轨迹查询 |
| 90 | - | |
| 93 | + MyMapUtil.queryHistoryTrace(context, mClient, entityName, continueTime, userFinishTime, new MyMapUtil.CallBack() { | |
| 94 | + @Override | |
| 95 | + public void success(List<LatLng> resultPoints) { | |
| 96 | + if (null != resultPoints && resultPoints.size() > 1) { | |
| 97 | + MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, 0, R.drawable.icon_end); | |
| 98 | + //设置地图自动缩放 | |
| 99 | + allResultList.addAll(resultPoints); | |
| 100 | + MyMapUtil.setMapAutoZoom(getView().baiduMap, allResultList, -2f); | |
| 101 | + } | |
| 102 | + } | |
| 103 | + }); | |
| 104 | +// | |
| 91 | 105 | } |
| 92 | 106 | } |
| 93 | 107 | //查询失败 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/OnGoingFragmentPresenter.java
0 → 100644
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/OnGoingFragmentView.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.frame.view; | |
| 2 | + | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.content.Context; | |
| 5 | +import android.text.TextUtils; | |
| 6 | +import android.util.Log; | |
| 7 | +import android.view.View; | |
| 8 | +import android.widget.LinearLayout; | |
| 9 | + | |
| 10 | +import com.alibaba.android.arouter.launcher.ARouter; | |
| 11 | +import com.baidu.mapapi.map.BaiduMap; | |
| 12 | +import com.baidu.mapapi.map.MapView; | |
| 13 | +import com.baidu.mapapi.map.UiSettings; | |
| 14 | +import com.baidu.mapapi.model.LatLng; | |
| 15 | +import com.baidu.mapapi.utils.DistanceUtil; | |
| 16 | +import com.baidu.trace.LBSTraceClient; | |
| 17 | +import com.baidu.trace.model.SortType; | |
| 18 | +import com.cnlive.libs.base.util.StatusBarUtil2; | |
| 19 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | |
| 20 | +import com.cnlive.moudle.pedometer.model.Constant; | |
| 21 | +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | |
| 22 | +import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity; | |
| 23 | +import com.cnlive.moudle.pedometer.ui.activity.RegistrationInfoActivity; | |
| 24 | +import com.cnlive.moudle.pedometer.ui.activity.TakePartActivity; | |
| 25 | +import com.cnlive.moudle.pedometer.ui.fragment.OnGoingFragment; | |
| 26 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | |
| 27 | +import com.cnlive.moudle.pedometer.ui.widget.TipDialog; | |
| 28 | +import com.cnlive.moudle.pedometer.utils.GsonUtil; | |
| 29 | +import com.cnlive.moudle.pedometer.utils.MyMapUtil; | |
| 30 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | |
| 31 | +import com.cnlive.moudle.pedometer.utils.ScreenUtil; | |
| 32 | +import com.cnlive.moudle.pedometer.utils.StepUtil; | |
| 33 | +import com.cnlive.moudle.pedometer.utils.TimeUtil; | |
| 34 | +import com.cnlive.strike.application.GlideApp; | |
| 35 | +import com.example.moudle_pedometer.R; | |
| 36 | +import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 37 | +import com.qmuiteam.qmui.util.QMUIStatusBarHelper; | |
| 38 | +import com.sothree.slidinguppanel.SlidingUpPanelLayout; | |
| 39 | + | |
| 40 | +import java.util.List; | |
| 41 | + | |
| 42 | +public class OnGoingFragmentView implements MvpView { | |
| 43 | + private OnGoingFragment fragment; | |
| 44 | + private BaiduMap baiduMap; | |
| 45 | + private MapView mMapView; | |
| 46 | + private UiSettings mUiSettings; | |
| 47 | + public RunRaceDetailInfo runRaceDetailInfo; | |
| 48 | + | |
| 49 | + public OnGoingFragmentView(OnGoingFragment fragment) { | |
| 50 | + this.fragment = fragment; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public Activity getContext() { | |
| 54 | + return fragment == null ? null : fragment.getActivity(); | |
| 55 | + } | |
| 56 | + | |
| 57 | + public void initView(RunRaceDetailInfo runRaceDetailInfo) { | |
| 58 | + | |
| 59 | + if (fragment.getActivity() == null) { | |
| 60 | + return; | |
| 61 | + } | |
| 62 | + this.runRaceDetailInfo = runRaceDetailInfo; | |
| 63 | + //轨迹开始时间 | |
| 64 | + long startTime = 0; | |
| 65 | + //轨迹结束时间 | |
| 66 | + long endTime = 0; | |
| 67 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getStartTime()) && !TextUtils.isEmpty(runRaceDetailInfo.getEndTime()) && !TextUtils.isEmpty(runRaceDetailInfo.getEntityName())) { | |
| 68 | + startTime = Long.parseLong(runRaceDetailInfo.getStartTime()); | |
| 69 | + endTime = Long.parseLong(runRaceDetailInfo.getEndTime()); | |
| 70 | + //todo 注意后续查询历史轨迹的时候,必须查数据库中的时间,因为涉及到历史运动恢复,所以不能用这个sp文件中的,这里设置,只是为了在服务启动成功后, | |
| 71 | + | |
| 72 | + //显示地图 | |
| 73 | + fragment.binding.mapView.setVisibility(View.VISIBLE); | |
| 74 | + //显示底部滑动卡片 | |
| 75 | +// fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); | |
| 76 | + //隐藏空视图 | |
| 77 | + fragment.binding.emptyLayout.setVisibility(View.GONE); | |
| 78 | + //显示立即报名按钮 | |
| 79 | +// fragment.binding.includeStreet.rlStartBtn.setVisibility(View.VISIBLE); | |
| 80 | + //设置底部卡片第一次可滑动的位置 | |
| 81 | + fragment.binding.slidingLayout.setAnchorPoint(0.6f); | |
| 82 | + fragment.binding.slidingLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() { | |
| 83 | + @Override | |
| 84 | + public void onPanelSlide(View panel, float slideOffset) { | |
| 85 | + //设置顶层卡片特效 | |
| 86 | +// if (slideOffset > 0.6) { | |
| 87 | +// fragment.binding.llTop.setVisibility(View.VISIBLE); | |
| 88 | +//// ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) fragment.binding.scrollView.getLayoutParams(); | |
| 89 | +//// params.topMargin = ScreenUtil.dip2px(getContext(), 50); | |
| 90 | +//// fragment.binding.scrollView.setLayoutParams(params); | |
| 91 | +// } else { | |
| 92 | +// fragment.binding.llTop.setVisibility(View.GONE); | |
| 93 | +// } | |
| 94 | + if (slideOffset <= 0.6) { | |
| 95 | + if (fragment.binding.flTop.getVisibility() == View.VISIBLE) { | |
| 96 | + QMUIStatusBarHelper.setStatusBarLightMode(fragment.getActivity()); | |
| 97 | + StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.white), 0); | |
| 98 | + fragment.binding.flTop.setVisibility(View.GONE); | |
| 99 | + } | |
| 100 | + } | |
| 101 | + //设置卡片缩放特效 | |
| 102 | + if (slideOffset >= 0 && slideOffset <= 1) { | |
| 103 | + int leakWidth = (int) (ScreenUtil.dip2px(getContext(), 15) / 0.6); | |
| 104 | + LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); | |
| 105 | + int current = (int) (leakWidth * slideOffset); | |
| 106 | +// Log.e(TAG, "current: " + current + ",leakWidth:" + leakWidth + ",ScreenUtil:" + ScreenUtil.dip2px(getContext(), 15)); | |
| 107 | + if (slideOffset == 0) { | |
| 108 | + layoutParams.setMargins(ScreenUtil.dip2px(getContext(), 15), 0, ScreenUtil.dip2px(getContext(), 15), 0); | |
| 109 | + fragment.binding.includeStreet.llFirstPanelRoot.setLayoutParams(layoutParams); | |
| 110 | + fragment.binding.includeStreet.llBottomPanel.setLayoutParams(layoutParams); | |
| 111 | + } | |
| 112 | + if (leakWidth - ScreenUtil.dip2px(getContext(), current) <= ScreenUtil.dip2px(getContext(), 15)) { | |
| 113 | + if (leakWidth - ScreenUtil.dip2px(getContext(), current) >= 0) { | |
| 114 | + layoutParams.setMargins(leakWidth - ScreenUtil.dip2px(getContext(), current), 0, leakWidth - ScreenUtil.dip2px(getContext(), current), 0); | |
| 115 | + } else { | |
| 116 | + layoutParams.setMargins(0, 0, 0, 0); | |
| 117 | + } | |
| 118 | + | |
| 119 | + fragment.binding.includeStreet.llFirstPanelRoot.setLayoutParams(layoutParams); | |
| 120 | + fragment.binding.includeStreet.llBottomPanel.setLayoutParams(layoutParams); | |
| 121 | + } | |
| 122 | + | |
| 123 | + } | |
| 124 | + | |
| 125 | +// if (slideOffset == 0) { | |
| 126 | +// //在初始位置 | |
| 127 | +// if (fragment.binding.includeStreet.rlStartBtn.getVisibility() == View.GONE) { | |
| 128 | +// fragment.binding.includeStreet.rlStartBtn.setVisibility(View.VISIBLE); | |
| 129 | +// } | |
| 130 | +// | |
| 131 | +// } else { | |
| 132 | +// //用户进行滑动 | |
| 133 | +// if (fragment.binding.includeStreet.rlStartBtn.getVisibility() == View.VISIBLE) { | |
| 134 | +// fragment.binding.includeStreet.rlStartBtn.setVisibility(View.GONE); | |
| 135 | +// } | |
| 136 | +// } | |
| 137 | + } | |
| 138 | + | |
| 139 | + @Override | |
| 140 | + public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) { | |
| 141 | +// Log.e(TAG, "previousState: " + previousState + ",newState:" + newState); | |
| 142 | + if (previousState == SlidingUpPanelLayout.PanelState.ANCHORED && newState == SlidingUpPanelLayout.PanelState.DRAGGING) { | |
| 143 | + if (fragment.binding.flTop.getVisibility() != View.VISIBLE) { | |
| 144 | + QMUIStatusBarHelper.setStatusBarDarkMode(fragment.getActivity()); | |
| 145 | + StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.run_main_bg), 0); | |
| 146 | + fragment.binding.flTop.setVisibility(View.VISIBLE); | |
| 147 | + | |
| 148 | + } | |
| 149 | + } else if (previousState == SlidingUpPanelLayout.PanelState.DRAGGING && newState == SlidingUpPanelLayout.PanelState.EXPANDED) { | |
| 150 | + if (fragment.binding.flTop.getVisibility() != View.VISIBLE) { | |
| 151 | + QMUIStatusBarHelper.setStatusBarDarkMode(fragment.getActivity()); | |
| 152 | + StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.run_main_bg), 0); | |
| 153 | + fragment.binding.flTop.setVisibility(View.VISIBLE); | |
| 154 | + | |
| 155 | + } | |
| 156 | + } else if (previousState == SlidingUpPanelLayout.PanelState.EXPANDED && newState == SlidingUpPanelLayout.PanelState.DRAGGING) { | |
| 157 | + QMUIStatusBarHelper.setStatusBarLightMode(fragment.getActivity()); | |
| 158 | + StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.white), 0); | |
| 159 | + | |
| 160 | + if (fragment.binding.flTop.getVisibility() != View.GONE) { | |
| 161 | + fragment.binding.flTop.setVisibility(View.GONE); | |
| 162 | + } | |
| 163 | + } else if (previousState == SlidingUpPanelLayout.PanelState.DRAGGING && newState == SlidingUpPanelLayout.PanelState.ANCHORED) { | |
| 164 | + QMUIStatusBarHelper.setStatusBarLightMode(fragment.getActivity()); | |
| 165 | + StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.white), 0); | |
| 166 | + | |
| 167 | + if (fragment.binding.flTop.getVisibility() != View.GONE) { | |
| 168 | + fragment.binding.flTop.setVisibility(View.GONE); | |
| 169 | + } | |
| 170 | + } | |
| 171 | + | |
| 172 | + } | |
| 173 | + }); | |
| 174 | + //卡片滑动上层标题 | |
| 175 | + fragment.binding.llTopBack.setOnClickListener(new View.OnClickListener() { | |
| 176 | + @Override | |
| 177 | + public void onClick(View view) { | |
| 178 | + if (getContext() == null) { | |
| 179 | + return; | |
| 180 | + } | |
| 181 | + fragment.getActivity().finish(); | |
| 182 | + } | |
| 183 | + }); | |
| 184 | + /*************************设置相关页面数据***************************/ | |
| 185 | + if (runRaceDetailInfo.getFenceId() != null) { | |
| 186 | + //设置围栏ID | |
| 187 | + CommonInfo.setFenceId(getContext(), Integer.parseInt(runRaceDetailInfo.getFenceId())); | |
| 188 | + } | |
| 189 | + //设置标题 | |
| 190 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getTitle())) { | |
| 191 | + fragment.binding.includeStreet.tvRaceTitle.setText(runRaceDetailInfo.getTitle()); | |
| 192 | + //根据标题字数动态设置卡片高度 | |
| 193 | + if (runRaceDetailInfo.getTitle().length() > 19) { | |
| 194 | + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 200)); | |
| 195 | + } else { | |
| 196 | + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 181)); | |
| 197 | + } | |
| 198 | + fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); | |
| 199 | + } | |
| 200 | + //设置活动地点 | |
| 201 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getAddress())) { | |
| 202 | + fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); | |
| 203 | + //设置活动距离 | |
| 204 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) { | |
| 205 | + fragment.binding.includeStreet.tvAddress.append("\t\t" + runRaceDetailInfo.getMileage()); | |
| 206 | + } | |
| 207 | + } | |
| 208 | + | |
| 209 | + //设置起点 | |
| 210 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getStartLocation())) { | |
| 211 | + fragment.binding.includeStreet.tvStartAddr.setText(runRaceDetailInfo.getStartLocation()); | |
| 212 | + } | |
| 213 | + //设置终点 | |
| 214 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getEndLocation())) { | |
| 215 | + fragment.binding.includeStreet.tvEndAddr.setText(runRaceDetailInfo.getEndLocation()); | |
| 216 | + } | |
| 217 | + //设置起始报名时间 | |
| 218 | + if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getSign_up_start_time(), "yyyy.MM.dd"))) { | |
| 219 | + fragment.binding.includeStreet.tvSignUpStartTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getSign_up_start_time(), "yyyy.MM.dd")); | |
| 220 | + | |
| 221 | + } | |
| 222 | + //设置终止报名时间 | |
| 223 | + if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getSign_up_end_time(), "yyyy.MM.dd"))) { | |
| 224 | + fragment.binding.includeStreet.tvSignUpEndTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getSign_up_end_time(), "yyyy.MM.dd")); | |
| 225 | + } | |
| 226 | + //设置活动开始时间 | |
| 227 | + if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getStart_time(), "yyyy.MM.dd"))) { | |
| 228 | + fragment.binding.includeStreet.tvActiveStartTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getStart_time(), "yyyy.MM.dd")); | |
| 229 | + } | |
| 230 | + //设置活动结束时间 | |
| 231 | + if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy.MM.dd"))) { | |
| 232 | + fragment.binding.includeStreet.tvActiveEndTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy.MM.dd")); | |
| 233 | + } | |
| 234 | + //设置活动类型 | |
| 235 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getEventType())) { | |
| 236 | + fragment.binding.includeStreet.tvEventType.setText(runRaceDetailInfo.getEventType()); | |
| 237 | + } | |
| 238 | + //设置参加人数 | |
| 239 | + fragment.binding.includeStreet.tvSignPerson.setText(runRaceDetailInfo.getSignupNum() + ""); | |
| 240 | + //设置报名完成的头像 | |
| 241 | + List<String> joinFaceIcon = runRaceDetailInfo.getFaceUrl(); | |
| 242 | + if (joinFaceIcon != null && joinFaceIcon.size() > 0) { | |
| 243 | + fragment.binding.includeStreet.fiveJoinPerson.setVisibility(View.VISIBLE); | |
| 244 | + //设置头像数据 | |
| 245 | + fragment.binding.includeStreet.fiveJoinPerson.initIconData(joinFaceIcon); | |
| 246 | + } else { | |
| 247 | + fragment.binding.includeStreet.fiveJoinPerson.setVisibility(View.INVISIBLE); | |
| 248 | + } | |
| 249 | + | |
| 250 | + //判断是否显示个人排行榜 | |
| 251 | + if (runRaceDetailInfo.isIndividualAchievement()) { | |
| 252 | + //显示 | |
| 253 | + fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.VISIBLE); | |
| 254 | + //设置完成人数 | |
| 255 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getFinishNum())) { | |
| 256 | + fragment.binding.includeRank.tvFinishPerson.setText(runRaceDetailInfo.getFinishNum()); | |
| 257 | + } | |
| 258 | + //设置个人行走距离 | |
| 259 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getUserMileage())) { | |
| 260 | + fragment.binding.includePersonScore.tvUserDistance.setText(runRaceDetailInfo.getUserMileage()); | |
| 261 | + } | |
| 262 | + //设置行走步数 | |
| 263 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getStep())) { | |
| 264 | + fragment.binding.includePersonScore.tvStep.setText(runRaceDetailInfo.getStep()); | |
| 265 | + } | |
| 266 | + //设置用时 | |
| 267 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getEmployTime())) { | |
| 268 | + fragment.binding.includePersonScore.tvEmployTime.setText(runRaceDetailInfo.getEmployTime()); | |
| 269 | + } | |
| 270 | + //设置配速 | |
| 271 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getPace())) { | |
| 272 | + fragment.binding.includePersonScore.tvSpeed.setText(runRaceDetailInfo.getPace()); | |
| 273 | + } | |
| 274 | + } else { | |
| 275 | + //隐藏 | |
| 276 | + fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.GONE); | |
| 277 | + } | |
| 278 | + //设置是否显示排行榜 | |
| 279 | + if (runRaceDetailInfo.isRanking()) { | |
| 280 | + fragment.binding.includeRank.llRankRoot.setVisibility(View.VISIBLE); | |
| 281 | + //设置第一名头像 | |
| 282 | + GlideApp.with(getContext()).load(runRaceDetailInfo.getFirstFaceUrl()).into(fragment.binding.includeRank.ivFirstPersonUrl); | |
| 283 | + //设置排行榜头像 | |
| 284 | + List<String> finishFaceUrl = runRaceDetailInfo.getFinishFaceUrl(); | |
| 285 | + if (finishFaceUrl != null && finishFaceUrl.size() > 0) { | |
| 286 | + fragment.binding.includeRank.fiveRankPerson.initIconData(finishFaceUrl); | |
| 287 | + } | |
| 288 | + //设置第一名昵称 | |
| 289 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getFirstName())) { | |
| 290 | + fragment.binding.includeRank.tvKingNickName.setText(runRaceDetailInfo.getFirstName()); | |
| 291 | + } | |
| 292 | + } else { | |
| 293 | + fragment.binding.includeRank.llRankRoot.setVisibility(View.GONE); | |
| 294 | + | |
| 295 | + } | |
| 296 | + //设置路线描述 | |
| 297 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getDescription())) { | |
| 298 | + fragment.binding.includeStreetIntroduce.tvStreetIntroduce.setText(runRaceDetailInfo.getDescription()); | |
| 299 | + } | |
| 300 | + //设置路线介绍的图片 | |
| 301 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getRoadmap())) { | |
| 302 | + //设置路线图 | |
| 303 | + GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); | |
| 304 | + | |
| 305 | + } | |
| 306 | + | |
| 307 | + //开始按钮点击事件(用户进行滑动滑动) | |
| 308 | + fragment.binding.rlScrollViewStartBtn.setVisibility(View.GONE); | |
| 309 | + //查看全部成绩点击事件 | |
| 310 | + fragment.binding.includePersonScore.checkAllCord.setOnClickListener(v -> { | |
| 311 | + RaceRecordActivity.newInstance(fragment.getActivity(), runRaceDetailInfo.getTitle()); | |
| 312 | + }); | |
| 313 | + | |
| 314 | + fragment.binding.includeStreet.fiveJoinPerson.setOnClickListener(v -> { | |
| 315 | + TakePartActivity.newInstance(fragment.getActivity()); | |
| 316 | + }); | |
| 317 | + //返回按钮 | |
| 318 | + fragment.binding.ivBack.setOnClickListener(new View.OnClickListener() { | |
| 319 | + @Override | |
| 320 | + public void onClick(View view) { | |
| 321 | + if (fragment.getActivity() == null) { | |
| 322 | + return; | |
| 323 | + } | |
| 324 | + fragment.getActivity().finish(); | |
| 325 | + } | |
| 326 | + }); | |
| 327 | + //todo 查看排行榜点击 | |
| 328 | + fragment.binding.includeRank.tvCatAllRank.setOnClickListener(new View.OnClickListener() { | |
| 329 | + @Override | |
| 330 | + public void onClick(View view) { | |
| 331 | + ARouter.getInstance().build("/web/WebViewColorActivity") | |
| 332 | + .withString("url", "http://wjjh5test.cnlive.com/cnSportList.html" + "?sid=" + CommonInfo.getUserId(fragment.getActivity()) + "&eventId=" + CommonInfo.getStreetId(fragment.getActivity())) | |
| 333 | + .withString("title", "排行榜") | |
| 334 | + .navigation(fragment.getActivity()); | |
| 335 | + } | |
| 336 | + }); | |
| 337 | + } | |
| 338 | + } | |
| 339 | +} | |
| 0 | 340 | \ No newline at end of file | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| ... | ... | @@ -246,15 +246,16 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 246 | 246 | @Override |
| 247 | 247 | public void onPanelSlide(View panel, float slideOffset) { |
| 248 | 248 | //设置顶层卡片特效 |
| 249 | -// if (slideOffset > 0.6) { | |
| 250 | -// fragment.binding.llTop.setVisibility(View.VISIBLE); | |
| 251 | -//// ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) fragment.binding.scrollView.getLayoutParams(); | |
| 252 | -//// params.topMargin = ScreenUtil.dip2px(getContext(), 50); | |
| 253 | -//// fragment.binding.scrollView.setLayoutParams(params); | |
| 254 | -// } else { | |
| 255 | -// fragment.binding.llTop.setVisibility(View.GONE); | |
| 256 | -// } | |
| 257 | - if (slideOffset <= 0.6) { | |
| 249 | + if (slideOffset > 0.7) { | |
| 250 | + double alpha = (255 / (1 - 0.6)) * (slideOffset - 0.6); | |
| 251 | + if (alpha > 60) { | |
| 252 | + fragment.binding.flTop.getBackground().setAlpha((int) alpha); | |
| 253 | + fragment.binding.flTop.setVisibility(View.VISIBLE); | |
| 254 | + QMUIStatusBarHelper.setStatusBarDarkMode(fragment.getActivity()); | |
| 255 | + StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.run_main_bg), 0); | |
| 256 | + | |
| 257 | + } | |
| 258 | + } else { | |
| 258 | 259 | if (fragment.binding.flTop.getVisibility() == View.VISIBLE) { |
| 259 | 260 | QMUIStatusBarHelper.setStatusBarLightMode(fragment.getActivity()); |
| 260 | 261 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.white), 0); |
| ... | ... | @@ -310,6 +311,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 310 | 311 | |
| 311 | 312 | } |
| 312 | 313 | } else if (previousState == SlidingUpPanelLayout.PanelState.DRAGGING && newState == SlidingUpPanelLayout.PanelState.EXPANDED) { |
| 314 | + | |
| 313 | 315 | if (fragment.binding.flTop.getVisibility() != View.VISIBLE) { |
| 314 | 316 | QMUIStatusBarHelper.setStatusBarDarkMode(fragment.getActivity()); |
| 315 | 317 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.run_main_bg), 0); |
| ... | ... | @@ -319,14 +321,12 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 319 | 321 | } else if (previousState == SlidingUpPanelLayout.PanelState.EXPANDED && newState == SlidingUpPanelLayout.PanelState.DRAGGING) { |
| 320 | 322 | QMUIStatusBarHelper.setStatusBarLightMode(fragment.getActivity()); |
| 321 | 323 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.white), 0); |
| 322 | - | |
| 323 | 324 | if (fragment.binding.flTop.getVisibility() != View.GONE) { |
| 324 | 325 | fragment.binding.flTop.setVisibility(View.GONE); |
| 325 | 326 | } |
| 326 | 327 | } else if (previousState == SlidingUpPanelLayout.PanelState.DRAGGING && newState == SlidingUpPanelLayout.PanelState.ANCHORED) { |
| 327 | 328 | QMUIStatusBarHelper.setStatusBarLightMode(fragment.getActivity()); |
| 328 | 329 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.white), 0); |
| 329 | - | |
| 330 | 330 | if (fragment.binding.flTop.getVisibility() != View.GONE) { |
| 331 | 331 | fragment.binding.flTop.setVisibility(View.GONE); |
| 332 | 332 | } |
| ... | ... | @@ -643,7 +643,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 643 | 643 | @Override |
| 644 | 644 | public void onClick(View view) { |
| 645 | 645 | ARouter.getInstance().build("/web/WebViewColorActivity") |
| 646 | - .withString("url", "http://wjjh5test.cnlive.com/cnSportList.html"+"?sid="+CommonInfo.getUserId(fragment.getActivity())+"&eventId="+CommonInfo.getStreetId(fragment.getActivity())) | |
| 646 | + .withString("url", "http://wjjh5test.cnlive.com/cnSportList.html" + "?sid=" + CommonInfo.getUserId(fragment.getActivity()) + "&eventId=" + CommonInfo.getStreetId(fragment.getActivity())) | |
| 647 | 647 | .withString("title", "排行榜") |
| 648 | 648 | .navigation(fragment.getActivity()); |
| 649 | 649 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/OnGoingActivity.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.ui.activity; | |
| 2 | + | |
| 3 | +import com.cnlive.libs.base.ui.QMUIFragmentActivity; | |
| 4 | +import com.example.moudle_pedometer.R; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 进行中的活动点击事件 | |
| 8 | + */ | |
| 9 | +public class OnGoingActivity extends QMUIFragmentActivity { | |
| 10 | + @Override | |
| 11 | + protected int getContextViewId() { | |
| 12 | + return R.id.fragment_ongoing; | |
| 13 | + } | |
| 14 | +} | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/OnGoingFragment.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.ui.fragment; | |
| 2 | + | |
| 3 | +import android.os.Bundle; | |
| 4 | +import android.support.annotation.Nullable; | |
| 5 | +import android.view.View; | |
| 6 | + | |
| 7 | +import com.cnlive.libs.base.ui.QMUIFragment; | |
| 8 | +import com.cnlive.moudle.pedometer.frame.presenter.OnGoingFragmentPresenter; | |
| 9 | +import com.cnlive.moudle.pedometer.frame.view.OnGoingFragmentView; | |
| 10 | +import com.example.moudle_pedometer.databinding.FragmentRunRaceDetailBinding; | |
| 11 | + | |
| 12 | +public class OnGoingFragment extends QMUIFragment<OnGoingFragmentView, OnGoingFragmentPresenter, FragmentRunRaceDetailBinding> { | |
| 13 | + @Override | |
| 14 | + protected int getToolbarId() { | |
| 15 | + return 0; | |
| 16 | + } | |
| 17 | + | |
| 18 | + @Override | |
| 19 | + public String getTitle() { | |
| 20 | + return null; | |
| 21 | + } | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + protected int getLayoutId() { | |
| 25 | + return 0; | |
| 26 | + } | |
| 27 | + | |
| 28 | + @Override | |
| 29 | + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
| 30 | + super.onViewCreated(view, savedInstanceState); | |
| 31 | + } | |
| 32 | +} | ... | ... |
moudle_pedometer/src/main/res/layout/layout_finish_running_route.xml
moudle_pedometer/src/main/res/layout/layout_finish_user_info.xml
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | |
| 9 | 9 | <LinearLayout |
| 10 | 10 | android:layout_width="match_parent" |
| 11 | - android:layout_height="190dp" | |
| 11 | + android:layout_height="195dp" | |
| 12 | 12 | android:layout_marginTop="30dp" |
| 13 | 13 | android:background="@drawable/shape_10dp_white_raduis_bg" |
| 14 | 14 | android:orientation="vertical"> | ... | ... |
moudle_pedometer/src/main/res/values/ids.xml