Commit 4614a35985bf98a2a0f7d47b40c52468cdf8f2dd
代码合并
Showing
24 changed files
with
652 additions
and
283 deletions
.idea/gradle.xml
| @@ -3,9 +3,6 @@ | @@ -3,9 +3,6 @@ | ||
| 3 | <component name="GradleSettings"> | 3 | <component name="GradleSettings"> |
| 4 | <option name="linkedExternalProjectsSettings"> | 4 | <option name="linkedExternalProjectsSettings"> |
| 5 | <GradleProjectSettings> | 5 | <GradleProjectSettings> |
| 6 | - <compositeConfiguration> | ||
| 7 | - <compositeBuild compositeDefinitionSource="SCRIPT" /> | ||
| 8 | - </compositeConfiguration> | ||
| 9 | <option name="distributionType" value="DEFAULT_WRAPPED" /> | 6 | <option name="distributionType" value="DEFAULT_WRAPPED" /> |
| 10 | <option name="externalProjectPath" value="$PROJECT_DIR$" /> | 7 | <option name="externalProjectPath" value="$PROJECT_DIR$" /> |
| 11 | <option name="modules"> | 8 | <option name="modules"> |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/service/CollStepService.java
| @@ -348,9 +348,9 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -348,9 +348,9 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 348 | //开启轨迹服务 | 348 | //开启轨迹服务 |
| 349 | if (mClient != null) { | 349 | if (mClient != null) { |
| 350 | mClient.startTrace(mTrace, traceListener); | 350 | mClient.startTrace(mTrace, traceListener); |
| 351 | - long stepStartTime = CommonInfo.getStepStartTime(getApplicationContext()); | 351 | + long stepStartTime = CollCommonInfo.getStepStartTime(getApplicationContext()); |
| 352 | if (stepStartTime == 0) { | 352 | if (stepStartTime == 0) { |
| 353 | - CommonInfo.setStepStartTime(getApplicationContext(), TimeUtil.getCurrentTime()); | 353 | + CollCommonInfo.setStepStartTime(getApplicationContext(), TimeUtil.getNowTimeStamp()); |
| 354 | } | 354 | } |
| 355 | } | 355 | } |
| 356 | 356 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunningMapFragment.java
| @@ -15,6 +15,7 @@ import com.cnlive.libs.base.ui.QMUIFragment; | @@ -15,6 +15,7 @@ import com.cnlive.libs.base.ui.QMUIFragment; | ||
| 15 | import com.cnlive.libs.base.util.StatusBarUtil2; | 15 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 16 | import com.cnlive.moudle.collectionTrace.frame.presenter.CollRunningMapFragmentPresenter; | 16 | import com.cnlive.moudle.collectionTrace.frame.presenter.CollRunningMapFragmentPresenter; |
| 17 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunningMapFragmentView; | 17 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunningMapFragmentView; |
| 18 | +import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; | ||
| 18 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 19 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 19 | import com.cnlive.moudle.pedometer.model.Constant; | 20 | import com.cnlive.moudle.pedometer.model.Constant; |
| 20 | import com.cnlive.moudle.pedometer.model.MessageEvent; | 21 | import com.cnlive.moudle.pedometer.model.MessageEvent; |
| @@ -104,7 +105,7 @@ public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentV | @@ -104,7 +105,7 @@ public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentV | ||
| 104 | } | 105 | } |
| 105 | //开始进行历史轨迹查询 | 106 | //开始进行历史轨迹查询 |
| 106 | if (getPresenter() != null && !TextUtils.isEmpty(StepService.entityName)) { | 107 | if (getPresenter() != null && !TextUtils.isEmpty(StepService.entityName)) { |
| 107 | - long stepStartTime = CommonInfo.getStepStartTime(getActivity()); | 108 | + long stepStartTime = CollCommonInfo.getStepStartTime(getActivity()); |
| 108 | Log.e(TAG, "onViewCreated: 时间"+stepStartTime ); | 109 | Log.e(TAG, "onViewCreated: 时间"+stepStartTime ); |
| 109 | long startTime = 0; | 110 | long startTime = 0; |
| 110 | if (stepStartTime != 0) { | 111 | if (stepStartTime != 0) { |
| @@ -112,7 +113,7 @@ public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentV | @@ -112,7 +113,7 @@ public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentV | ||
| 112 | } else { | 113 | } else { |
| 113 | startTime = (int) (System.currentTimeMillis() / 1000 -12 * 60 * 60); | 114 | startTime = (int) (System.currentTimeMillis() / 1000 -12 * 60 * 60); |
| 114 | } | 115 | } |
| 115 | - long current = TimeUtil.getCurrentTime(); | 116 | + long current = TimeUtil.getNowTimeStamp(); |
| 116 | // long startTime = current - hour * 3600 * 1000 - minute * 60 * 1000 - second * 1000; | 117 | // long startTime = current - hour * 3600 * 1000 - minute * 60 * 1000 - second * 1000; |
| 117 | long endTime = current; | 118 | long endTime = current; |
| 118 | // Log.e(TAG, "onViewCreated: " + "hour:" + hour + ",minute" + minute + ",second:" + second); | 119 | // Log.e(TAG, "onViewCreated: " + "hour:" + hour + ",minute" + minute + ",second:" + second); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/commonInfo/CommonInfo.java
| @@ -7,23 +7,23 @@ import com.cnlive.moudle.pedometer.utils.TimeUtil; | @@ -7,23 +7,23 @@ import com.cnlive.moudle.pedometer.utils.TimeUtil; | ||
| 7 | 7 | ||
| 8 | public class CommonInfo { | 8 | public class CommonInfo { |
| 9 | 9 | ||
| 10 | - /** | ||
| 11 | - * 设置计步时间 | ||
| 12 | - * | ||
| 13 | - * @param context | ||
| 14 | - */ | ||
| 15 | - public static void setStepStartTime(Context context, long currentTime) { | ||
| 16 | - MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putLong("stepStartTime", currentTime); | ||
| 17 | - } | ||
| 18 | - | ||
| 19 | - /** | ||
| 20 | - * 获取计步时间 | ||
| 21 | - * | ||
| 22 | - * @param context | ||
| 23 | - */ | ||
| 24 | - public static long getStepStartTime(Context context) { | ||
| 25 | - return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getLong("stepStartTime", 0); | ||
| 26 | - } | 10 | +// /** |
| 11 | +// * 设置计步时间 | ||
| 12 | +// * | ||
| 13 | +// * @param context | ||
| 14 | +// */ | ||
| 15 | +// public static void setStepStartTime(Context context, long currentTime) { | ||
| 16 | +// MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putLong("stepStartTime", currentTime); | ||
| 17 | +// } | ||
| 18 | +// | ||
| 19 | +// /** | ||
| 20 | +// * 获取计步时间 | ||
| 21 | +// * | ||
| 22 | +// * @param context | ||
| 23 | +// */ | ||
| 24 | +// public static long getStepStartTime(Context context) { | ||
| 25 | +// return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getLong("stepStartTime", 0); | ||
| 26 | +// } | ||
| 27 | 27 | ||
| 28 | /** | 28 | /** |
| 29 | * 设置计步完成时间 | 29 | * 设置计步完成时间 |
| @@ -232,8 +232,8 @@ public class CommonInfo { | @@ -232,8 +232,8 @@ public class CommonInfo { | ||
| 232 | */ | 232 | */ |
| 233 | public static String getUserIcon(Context context) { | 233 | public static String getUserIcon(Context context) { |
| 234 | return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getString("RunUserNickIcon", ""); | 234 | return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getString("RunUserNickIcon", ""); |
| 235 | - } | ||
| 236 | 235 | ||
| 236 | + } | ||
| 237 | 237 | ||
| 238 | /** | 238 | /** |
| 239 | * 设置用户号码 | 239 | * 设置用户号码 |
| @@ -256,23 +256,50 @@ public class CommonInfo { | @@ -256,23 +256,50 @@ public class CommonInfo { | ||
| 256 | 256 | ||
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | + | ||
| 260 | + /** | ||
| 261 | + * 是否第一次显示倒计时动画 | ||
| 262 | + * | ||
| 263 | + * @param context | ||
| 264 | + * @param isAllow | ||
| 265 | + */ | ||
| 266 | + public static void setIsFirstShowTimeTip(Context context, boolean isAllow) { | ||
| 267 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putBoolean("IsFirstShowTimeTip", isAllow); | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + /** | ||
| 271 | + * 是否第一次显示倒计时动画 | ||
| 272 | + * | ||
| 273 | + * @param context | ||
| 274 | + */ | ||
| 275 | + public static boolean getIsFirstShowTimeTip(Context context) { | ||
| 276 | + return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("IsFirstShowTimeTip", true); | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + | ||
| 259 | /*重置 | 280 | /*重置 |
| 260 | * @param context | 281 | * @param context |
| 261 | */ | 282 | */ |
| 262 | public static void reset(Context context) { | 283 | public static void reset(Context context) { |
| 263 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("writeUserStep"); | 284 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("writeUserStep"); |
| 264 | - MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("stepStartTime"); | ||
| 265 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("runStepService"); | 285 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("runStepService"); |
| 266 | - MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("stepStartTime"); | ||
| 267 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("KeepAliveService"); | 286 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("KeepAliveService"); |
| 268 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("RunBaiduTraceService"); | 287 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("RunBaiduTraceService"); |
| 269 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("streetId"); | 288 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("streetId"); |
| 270 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FirstStepSendTraceTip"); | 289 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FirstStepSendTraceTip"); |
| 271 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FenceId"); | 290 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FenceId"); |
| 272 | - MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("stepEndTime"); | ||
| 273 | - | ||
| 274 | - | 291 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("IsFirstShowTimeTip"); |
| 275 | } | 292 | } |
| 276 | 293 | ||
| 277 | - | 294 | + /*重置赛事 |
| 295 | + * @param context | ||
| 296 | + */ | ||
| 297 | + public static void resetRace(Context context) { | ||
| 298 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("writeUserStep"); | ||
| 299 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("runStepService"); | ||
| 300 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("KeepAliveService"); | ||
| 301 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("RunBaiduTraceService"); | ||
| 302 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FirstStepSendTraceTip"); | ||
| 303 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("IsFirstShowTimeTip"); | ||
| 304 | + } | ||
| 278 | } | 305 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunMainFragmentView.java
| @@ -33,6 +33,7 @@ import com.cnlive.moudle.pedometer.ui.activity.RunningFinishActivity; | @@ -33,6 +33,7 @@ import com.cnlive.moudle.pedometer.ui.activity.RunningFinishActivity; | ||
| 33 | import com.cnlive.moudle.pedometer.ui.activity.RunningMapActivity; | 33 | import com.cnlive.moudle.pedometer.ui.activity.RunningMapActivity; |
| 34 | import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; | 34 | import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; |
| 35 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | 35 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 36 | +import com.cnlive.moudle.pedometer.ui.widget.TipDialog; | ||
| 36 | import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil; | 37 | import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil; |
| 37 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 38 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 38 | import com.cnlive.moudle.pedometer.utils.MySpHelper; | 39 | import com.cnlive.moudle.pedometer.utils.MySpHelper; |
| @@ -115,11 +116,7 @@ public class RunMainFragmentView implements MvpView { | @@ -115,11 +116,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 115 | * 初始化相关视图 | 116 | * 初始化相关视图 |
| 116 | */ | 117 | */ |
| 117 | public void initView() { | 118 | public void initView() { |
| 118 | - | ||
| 119 | - UserStepEntity userStepEntity = StepUtil.getUserStepData(getContext(), uid); | ||
| 120 | - if (userStepEntity != null) { | ||
| 121 | - StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); | ||
| 122 | - } | 119 | + uid = CommonInfo.getUserId(getContext()); |
| 123 | initLocationClient(); | 120 | initLocationClient(); |
| 124 | fragment.binding.llRunMainRoot.setVisibility(View.GONE); | 121 | fragment.binding.llRunMainRoot.setVisibility(View.GONE); |
| 125 | ButtonAnimUtil.startAnimation(fragment.binding.llStartTimeTip, false); | 122 | ButtonAnimUtil.startAnimation(fragment.binding.llStartTimeTip, false); |
| @@ -179,41 +176,41 @@ public class RunMainFragmentView implements MvpView { | @@ -179,41 +176,41 @@ public class RunMainFragmentView implements MvpView { | ||
| 179 | 176 | ||
| 180 | } | 177 | } |
| 181 | }); | 178 | }); |
| 182 | - | ||
| 183 | -// boolean isRunStep = CommonInfo.getIsRunStepService(getContext()); | 179 | + boolean isFirstShowTime = CommonInfo.getIsFirstShowTimeTip(getContext()); |
| 184 | //当前用户已经在运动 | 180 | //当前用户已经在运动 |
| 185 | -// if (!isRunStep) { | ||
| 186 | - //依次倒计时 | ||
| 187 | - handler.postDelayed(runnable, 1000); | ||
| 188 | -// } else { | ||
| 189 | -// //隐藏计时界面 | ||
| 190 | -// fragment.binding.llStartTimeTip.setVisibility(View.GONE); | ||
| 191 | -// fragment.binding.llRunMainRoot.setVisibility(View.VISIBLE); | ||
| 192 | -// new Handler().postDelayed(new Runnable() { | ||
| 193 | -// @Override | ||
| 194 | -// public void run() { | ||
| 195 | -// //开始计时 | ||
| 196 | -// if (firstTimeFlag) { | ||
| 197 | -// firstTimeFlag = false; | ||
| 198 | -// if (userStepEntity != null) { | ||
| 199 | -// if ((userStepEntity.getPauseTimeStamp() != 0) && (userStepEntity.getRecordTime() != 0)) { | ||
| 200 | -// fragment.binding.chronometer.setBase(userStepEntity.getPauseTimeStamp() + (SystemClock.elapsedRealtime() - userStepEntity.getRecordTime())); | ||
| 201 | -// } else { | ||
| 202 | -// fragment.binding.chronometer.setFormat("00:00:01"); | ||
| 203 | -// fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime()); | ||
| 204 | -// } | ||
| 205 | -// //设置步数 | ||
| 206 | -// if (!TextUtils.isEmpty(userStepEntity.getStepCount())) { | ||
| 207 | -// fragment.binding.tvStepCount.setText(userStepEntity.getStepCount()); | ||
| 208 | -// } | ||
| 209 | -// } | ||
| 210 | -// fragment.binding.chronometer.start(); | ||
| 211 | -// } | ||
| 212 | -// } | ||
| 213 | -// }, 10); | ||
| 214 | -// //开启计步服务 | ||
| 215 | -// startStepService(getContext(), uid); | ||
| 216 | -// } | 181 | + if (isFirstShowTime) { |
| 182 | + //依次倒计时 | ||
| 183 | + handler.postDelayed(runnable, 1000); | ||
| 184 | + CommonInfo.setIsFirstShowTimeTip(getContext(), false); | ||
| 185 | + } else { | ||
| 186 | + UserStepEntity userStepEntity = StepUtil.getUserStepData(getContext(), uid); | ||
| 187 | + //隐藏计时界面 | ||
| 188 | + fragment.binding.llStartTimeTip.setVisibility(View.GONE); | ||
| 189 | + fragment.binding.llRunMainRoot.setVisibility(View.VISIBLE); | ||
| 190 | + new Handler().postDelayed(new Runnable() { | ||
| 191 | + @Override | ||
| 192 | + public void run() { | ||
| 193 | + //开始计时 | ||
| 194 | + if (firstTimeFlag) { | ||
| 195 | + firstTimeFlag = false; | ||
| 196 | + if (userStepEntity != null) { | ||
| 197 | + if ((userStepEntity.getPauseTimeStamp() != 0) && (userStepEntity.getRecordTime() != 0)) { | ||
| 198 | + fragment.binding.chronometer.setBase(userStepEntity.getPauseTimeStamp() + (SystemClock.elapsedRealtime() - userStepEntity.getRecordTime())); | ||
| 199 | + } else { | ||
| 200 | + fragment.binding.chronometer.setFormat("00:00:01"); | ||
| 201 | + fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime()); | ||
| 202 | + } | ||
| 203 | + //设置步数 | ||
| 204 | + if (!TextUtils.isEmpty(userStepEntity.getStepCount())) { | ||
| 205 | + fragment.binding.tvStepCount.setText(userStepEntity.getStepCount()); | ||
| 206 | + } | ||
| 207 | + } | ||
| 208 | + fragment.binding.chronometer.start(); | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | + }, 10); | ||
| 212 | + | ||
| 213 | + } | ||
| 217 | 214 | ||
| 218 | //设置继续按钮,缩放效果 | 215 | //设置继续按钮,缩放效果 |
| 219 | fragment.binding.flContinue.setOnTouchListener(new View.OnTouchListener() { | 216 | fragment.binding.flContinue.setOnTouchListener(new View.OnTouchListener() { |
| @@ -246,20 +243,19 @@ public class RunMainFragmentView implements MvpView { | @@ -246,20 +243,19 @@ public class RunMainFragmentView implements MvpView { | ||
| 246 | StepService.mClient.startTrace(StepService.mTrace, StepService.traceListener); | 243 | StepService.mClient.startTrace(StepService.mTrace, StepService.traceListener); |
| 247 | } | 244 | } |
| 248 | needWriteDataFlag = true; | 245 | needWriteDataFlag = true; |
| 246 | + //todo 第二阶段使用 | ||
| 249 | //将当前计时器时间戳写入数据库 | 247 | //将当前计时器时间戳写入数据库 |
| 250 | - setSQLPauseTime(uid); | 248 | + // setSQLPauseTime(uid); |
| 251 | //为了点击时可以显示缩放动画,这里延迟一个动画时间进行(包括放大和缩小) | 249 | //为了点击时可以显示缩放动画,这里延迟一个动画时间进行(包括放大和缩小) |
| 252 | handler.postDelayed(new Runnable() { | 250 | handler.postDelayed(new Runnable() { |
| 253 | @Override | 251 | @Override |
| 254 | public void run() { | 252 | public void run() { |
| 255 | - // | ||
| 256 | //隐藏两个按钮 | 253 | //隐藏两个按钮 |
| 257 | fragment.binding.flStopTip.setVisibility(View.INVISIBLE); | 254 | fragment.binding.flStopTip.setVisibility(View.INVISIBLE); |
| 258 | fragment.binding.llTwoBottomButton.setVisibility(View.GONE); | 255 | fragment.binding.llTwoBottomButton.setVisibility(View.GONE); |
| 259 | ButtonAnimUtil.setViewShowZoomIn(fragment.binding.llPause); | 256 | ButtonAnimUtil.setViewShowZoomIn(fragment.binding.llPause); |
| 260 | //显示暂停按钮 | 257 | //显示暂停按钮 |
| 261 | fragment.binding.llPause.setVisibility(View.VISIBLE); | 258 | fragment.binding.llPause.setVisibility(View.VISIBLE); |
| 262 | - // | ||
| 263 | } | 259 | } |
| 264 | }, ButtonAnimUtil.DEFAULT_ZOOM_DURATION * 2); | 260 | }, ButtonAnimUtil.DEFAULT_ZOOM_DURATION * 2); |
| 265 | //继续计步 | 261 | //继续计步 |
| @@ -269,8 +265,6 @@ public class RunMainFragmentView implements MvpView { | @@ -269,8 +265,6 @@ public class RunMainFragmentView implements MvpView { | ||
| 269 | fragment.binding.chronometer.setBase(fragment.binding.chronometer.getBase() + (SystemClock.elapsedRealtime() - mRecordTime)); | 265 | fragment.binding.chronometer.setBase(fragment.binding.chronometer.getBase() + (SystemClock.elapsedRealtime() - mRecordTime)); |
| 270 | } | 266 | } |
| 271 | fragment.binding.chronometer.start(); | 267 | fragment.binding.chronometer.start(); |
| 272 | - | ||
| 273 | - | ||
| 274 | } | 268 | } |
| 275 | }); | 269 | }); |
| 276 | //设置停止按钮缩放特效 | 270 | //设置停止按钮缩放特效 |
| @@ -308,17 +302,14 @@ public class RunMainFragmentView implements MvpView { | @@ -308,17 +302,14 @@ public class RunMainFragmentView implements MvpView { | ||
| 308 | SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定结束运动吗?", "确定", new SelectDialog.DialogInterface() { | 302 | SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定结束运动吗?", "确定", new SelectDialog.DialogInterface() { |
| 309 | @Override | 303 | @Override |
| 310 | public void onClick(SelectDialog dialog) { | 304 | public void onClick(SelectDialog dialog) { |
| 311 | - CommonInfo.setIsRunKeepAliveService(getContext(), false); | ||
| 312 | - CommonInfo.setIsWriteUserStep(getContext(), false); | ||
| 313 | - //设置运动结束时间 | 305 | + //设置状态标志位 |
| 306 | + setStopStartFlag(); | ||
| 307 | + //设置运动结束时间戳 | ||
| 308 | + StepUtil.setUserFinishTimeStamp(getContext(), uid); | ||
| 314 | CommonInfo.setStepEndTime(getContext(), TimeUtil.getNowTimeStamp()); | 309 | CommonInfo.setStepEndTime(getContext(), TimeUtil.getNowTimeStamp()); |
| 315 | fragment.binding.cpCurrent.setVisibility(View.GONE); | 310 | fragment.binding.cpCurrent.setVisibility(View.GONE); |
| 316 | ButtonAnimUtil.setViewDefault(fragment.binding.flStop); | 311 | ButtonAnimUtil.setViewDefault(fragment.binding.flStop); |
| 317 | dialog.dismiss(); | 312 | dialog.dismiss(); |
| 318 | - if (StepService.mClient != null) { | ||
| 319 | - StepService.mClient.stopGather(StepService.traceListener); | ||
| 320 | - } | ||
| 321 | - fragment.getActivity().stopService(new Intent(fragment.getActivity(), StepService.class)); | ||
| 322 | RunningFinishBean runningFinishBean = new RunningFinishBean(); | 313 | RunningFinishBean runningFinishBean = new RunningFinishBean(); |
| 323 | runningFinishBean.setStartPoint("开始地点"); | 314 | runningFinishBean.setStartPoint("开始地点"); |
| 324 | runningFinishBean.setEndPoint("结束地点"); | 315 | runningFinishBean.setEndPoint("结束地点"); |
| @@ -396,17 +387,43 @@ public class RunMainFragmentView implements MvpView { | @@ -396,17 +387,43 @@ public class RunMainFragmentView implements MvpView { | ||
| 396 | fragment.binding.llPause.setVisibility(View.GONE); | 387 | fragment.binding.llPause.setVisibility(View.GONE); |
| 397 | } | 388 | } |
| 398 | }, ButtonAnimUtil.HIDE_VIEW_ZOOM_DURATION); | 389 | }, ButtonAnimUtil.HIDE_VIEW_ZOOM_DURATION); |
| 399 | - //显示继续按钮 | ||
| 400 | - fragment.binding.llTwoBottomButton.setVisibility(View.VISIBLE); | ||
| 401 | - ButtonAnimUtil.setViewShowZoomIn(fragment.binding.flContinue); | ||
| 402 | - ButtonAnimUtil.setViewShowZoomIn(fragment.binding.flStop); | ||
| 403 | - //停止计时 | ||
| 404 | - fragment.binding.chronometer.stop(); | ||
| 405 | - mRecordTime = SystemClock.elapsedRealtime(); | ||
| 406 | - //暂停计步 | ||
| 407 | - EventBus.getDefault().post(new MessageEvent(Constant.SERVICE_STEP_COUNT_PAUSE, "")); | ||
| 408 | - //重置速度 | ||
| 409 | -// resetSpeed(); | 390 | + |
| 391 | + //获取当前用户暂停次数 | ||
| 392 | + int userPauseCount = StepUtil.getUserPauseCount(getContext(), uid); | ||
| 393 | + if (userPauseCount != -1) { | ||
| 394 | + if (userPauseCount > 1) { | ||
| 395 | + //设置停止标志位,关闭相关服务 | ||
| 396 | + setStopStartFlag(); | ||
| 397 | + //清除数据库 | ||
| 398 | + StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); | ||
| 399 | + //进行提示 | ||
| 400 | + TipDialog tipDialog = new TipDialog(getContext(), getContext().getString(R.string.more_than_pause_count_tip), "我知道了", R.color.green_round, new TipDialog.DialogInterface() { | ||
| 401 | + @Override | ||
| 402 | + public void onClick(TipDialog dialog) { | ||
| 403 | + //关闭当前对话框 | ||
| 404 | + dialog.dismiss(); | ||
| 405 | + //关闭当前页面 | ||
| 406 | + if (getContext() == null) { | ||
| 407 | + return; | ||
| 408 | + } | ||
| 409 | + fragment.getActivity().finish(); | ||
| 410 | + } | ||
| 411 | + }); | ||
| 412 | + tipDialog.setCanceledOnTouchOutside(false); | ||
| 413 | + tipDialog.setCancelable(false); | ||
| 414 | + tipDialog.show(); | ||
| 415 | + | ||
| 416 | + } | ||
| 417 | + //显示继续按钮 | ||
| 418 | + fragment.binding.llTwoBottomButton.setVisibility(View.VISIBLE); | ||
| 419 | + ButtonAnimUtil.setViewShowZoomIn(fragment.binding.flContinue); | ||
| 420 | + ButtonAnimUtil.setViewShowZoomIn(fragment.binding.flStop); | ||
| 421 | + //停止计时 | ||
| 422 | + fragment.binding.chronometer.stop(); | ||
| 423 | + mRecordTime = SystemClock.elapsedRealtime(); | ||
| 424 | + //暂停计步 | ||
| 425 | + EventBus.getDefault().post(new MessageEvent(Constant.SERVICE_STEP_COUNT_PAUSE, "")); | ||
| 426 | + } | ||
| 410 | } | 427 | } |
| 411 | }); | 428 | }); |
| 412 | //gps点击事件 | 429 | //gps点击事件 |
| @@ -431,6 +448,16 @@ public class RunMainFragmentView implements MvpView { | @@ -431,6 +448,16 @@ public class RunMainFragmentView implements MvpView { | ||
| 431 | RunningMapActivity.startActivity(fragment.getActivity(), runningMapBean); | 448 | RunningMapActivity.startActivity(fragment.getActivity(), runningMapBean); |
| 432 | } | 449 | } |
| 433 | }); | 450 | }); |
| 451 | + //返回按钮点击事件 | ||
| 452 | + fragment.binding.ivBack.setOnClickListener(new View.OnClickListener() { | ||
| 453 | + @Override | ||
| 454 | + public void onClick(View view) { | ||
| 455 | + if (getContext() == null) { | ||
| 456 | + return; | ||
| 457 | + } | ||
| 458 | + fragment.getActivity().finish(); | ||
| 459 | + } | ||
| 460 | + }); | ||
| 434 | 461 | ||
| 435 | fragment.binding.rlClose.setOnClickListener(new View.OnClickListener() { | 462 | fragment.binding.rlClose.setOnClickListener(new View.OnClickListener() { |
| 436 | @Override | 463 | @Override |
| @@ -450,6 +477,8 @@ public class RunMainFragmentView implements MvpView { | @@ -450,6 +477,8 @@ public class RunMainFragmentView implements MvpView { | ||
| 450 | userStepEntity.setPauseTimeStamp(fragment.binding.chronometer.getBase()); | 477 | userStepEntity.setPauseTimeStamp(fragment.binding.chronometer.getBase()); |
| 451 | //设置当前暂停的时间戳 | 478 | //设置当前暂停的时间戳 |
| 452 | userStepEntity.setRecordTime(SystemClock.elapsedRealtime()); | 479 | userStepEntity.setRecordTime(SystemClock.elapsedRealtime()); |
| 480 | + //设置暂停次数 | ||
| 481 | + userStepEntity.setPauseCount(userStepEntity.getPauseCount() + 1); | ||
| 453 | //更新数据 | 482 | //更新数据 |
| 454 | StepUtil.updateStepData(fragment.getActivity(), userStepEntity); | 483 | StepUtil.updateStepData(fragment.getActivity(), userStepEntity); |
| 455 | } | 484 | } |
| @@ -457,6 +486,20 @@ public class RunMainFragmentView implements MvpView { | @@ -457,6 +486,20 @@ public class RunMainFragmentView implements MvpView { | ||
| 457 | } | 486 | } |
| 458 | } | 487 | } |
| 459 | 488 | ||
| 489 | + public void setFragmentPauseTime(String id) { | ||
| 490 | + if (!TextUtils.isEmpty(id)) { | ||
| 491 | + UserStepEntity userStepEntity = StepUtil.getUserStepData(fragment.getActivity(), uid); | ||
| 492 | + if (userStepEntity != null) { | ||
| 493 | + userStepEntity.setPauseTimeStamp(fragment.binding.chronometer.getBase()); | ||
| 494 | + userStepEntity.setRecordTime(SystemClock.elapsedRealtime()); | ||
| 495 | + //设置当前暂停的时间戳 | ||
| 496 | + userStepEntity.setUserPauseTimeStamp(TimeUtil.getNowTimeStamp()); | ||
| 497 | + //更新数据 | ||
| 498 | + StepUtil.updateStepData(fragment.getActivity(), userStepEntity); | ||
| 499 | + } | ||
| 500 | + } | ||
| 501 | + } | ||
| 502 | + | ||
| 460 | 503 | ||
| 461 | /** | 504 | /** |
| 462 | * 更新行走距离 | 505 | * 更新行走距离 |
| @@ -551,6 +594,20 @@ public class RunMainFragmentView implements MvpView { | @@ -551,6 +594,20 @@ public class RunMainFragmentView implements MvpView { | ||
| 551 | } | 594 | } |
| 552 | } | 595 | } |
| 553 | } | 596 | } |
| 597 | + | ||
| 598 | + } | ||
| 599 | + | ||
| 600 | + /** | ||
| 601 | + * 设置停止状态标志位 | ||
| 602 | + */ | ||
| 603 | + private void setStopStartFlag() { | ||
| 604 | + CommonInfo.setTsRunBaiduTraceService(getContext(), false); | ||
| 605 | + CommonInfo.setIsRunKeepAliveService(getContext(), false); | ||
| 606 | + CommonInfo.setIsWriteUserStep(getContext(), false); | ||
| 607 | + if (StepService.mClient != null) { | ||
| 608 | + StepService.mClient.stopGather(StepService.traceListener); | ||
| 609 | + } | ||
| 610 | + fragment.getActivity().stopService(new Intent(fragment.getActivity(), StepService.class)); | ||
| 554 | } | 611 | } |
| 555 | 612 | ||
| 556 | public void onDestroy() { | 613 | public void onDestroy() { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| @@ -51,17 +51,22 @@ import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; | @@ -51,17 +51,22 @@ import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; | ||
| 51 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 51 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 52 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | 52 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 53 | import com.cnlive.moudle.pedometer.service.KeepLiveService; | 53 | import com.cnlive.moudle.pedometer.service.KeepLiveService; |
| 54 | +import com.cnlive.moudle.pedometer.service.StepService; | ||
| 55 | +import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | ||
| 54 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; | 56 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; |
| 55 | import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity; | 57 | import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity; |
| 56 | import com.cnlive.moudle.pedometer.ui.activity.RegistrationInfoActivity; | 58 | import com.cnlive.moudle.pedometer.ui.activity.RegistrationInfoActivity; |
| 57 | import com.cnlive.moudle.pedometer.ui.activity.TakePartActivity; | 59 | import com.cnlive.moudle.pedometer.ui.activity.TakePartActivity; |
| 58 | import com.cnlive.moudle.pedometer.ui.fragment.RunRaceDetailFragment; | 60 | import com.cnlive.moudle.pedometer.ui.fragment.RunRaceDetailFragment; |
| 61 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | ||
| 59 | import com.cnlive.moudle.pedometer.ui.widget.TipDialog; | 62 | import com.cnlive.moudle.pedometer.ui.widget.TipDialog; |
| 60 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; | 63 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; |
| 61 | import com.cnlive.moudle.pedometer.utils.GsonUtil; | 64 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 62 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 65 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 63 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | 66 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; |
| 64 | import com.cnlive.moudle.pedometer.utils.ScreenUtil; | 67 | import com.cnlive.moudle.pedometer.utils.ScreenUtil; |
| 68 | +import com.cnlive.moudle.pedometer.utils.ServiceUtils; | ||
| 69 | +import com.cnlive.moudle.pedometer.utils.StepUtil; | ||
| 65 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 70 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 66 | import com.cnlive.strike.application.GlideApp; | 71 | import com.cnlive.strike.application.GlideApp; |
| 67 | import com.example.moudle_pedometer.R; | 72 | import com.example.moudle_pedometer.R; |
| @@ -112,6 +117,8 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -112,6 +117,8 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 112 | private LatLng startLatLng = new LatLng(39.934733, 116.308646);//起始点 | 117 | private LatLng startLatLng = new LatLng(39.934733, 116.308646);//起始点 |
| 113 | private List<LatLng> trackPoints; | 118 | private List<LatLng> trackPoints; |
| 114 | private RunRaceDetailInfo runRaceDetailInfo; | 119 | private RunRaceDetailInfo runRaceDetailInfo; |
| 120 | + private UserStepEntity userStepEntity; | ||
| 121 | + private boolean isDifferentStreet = false; | ||
| 115 | 122 | ||
| 116 | public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) { | 123 | public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) { |
| 117 | this.fragment = fragment; | 124 | this.fragment = fragment; |
| @@ -314,6 +321,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -314,6 +321,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 314 | fragment.binding.rlScrollViewStartBtn.setTag("1"); | 321 | fragment.binding.rlScrollViewStartBtn.setTag("1"); |
| 315 | fragment.binding.tvRunNow.setText("现在开始"); | 322 | fragment.binding.tvRunNow.setText("现在开始"); |
| 316 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | 323 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); |
| 324 | + checkStartBtnState(); | ||
| 317 | } else { | 325 | } else { |
| 318 | fragment.binding.rlScrollViewStartBtn.setTag("0"); | 326 | fragment.binding.rlScrollViewStartBtn.setTag("0"); |
| 319 | fragment.binding.tvRunNow.setText("立即报名"); | 327 | fragment.binding.tvRunNow.setText("立即报名"); |
| @@ -374,9 +382,46 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -374,9 +382,46 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 374 | //立即报名 | 382 | //立即报名 |
| 375 | if ("0".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | 383 | if ("0".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { |
| 376 | RegistrationInfoActivity.newInstance(fragment.getActivity()); | 384 | RegistrationInfoActivity.newInstance(fragment.getActivity()); |
| 377 | - } else { | 385 | + } |
| 386 | + //现在开始 | ||
| 387 | + else if ("1".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | ||
| 378 | startStepService(getContext()); | 388 | startStepService(getContext()); |
| 379 | } | 389 | } |
| 390 | + //继续运动 | ||
| 391 | + else if ("2".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | ||
| 392 | + if (!isDifferentStreet) { | ||
| 393 | + checkBaiduServiceState(); | ||
| 394 | + } | ||
| 395 | + | ||
| 396 | + //赛事id不同 | ||
| 397 | + else { | ||
| 398 | + SelectDialog selectDialog = new SelectDialog(getContext(), "您正在进行另一赛事,是否回到当前进行赛事?", "否", new SelectDialog.DialogInterface() { | ||
| 399 | + @Override | ||
| 400 | + public void onClick(SelectDialog dialog) { | ||
| 401 | + dialog.dismiss(); | ||
| 402 | + //清空上次保存数据 | ||
| 403 | + StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); | ||
| 404 | + //停止服务 | ||
| 405 | + stopStepService(); | ||
| 406 | + //清除数据 | ||
| 407 | + CommonInfo.resetRace(getContext()); | ||
| 408 | + //更改当前按钮 | ||
| 409 | + fragment.binding.tvRunNow.setText("立即开始"); | ||
| 410 | + fragment.binding.rlScrollViewStartBtn.setTag("1"); | ||
| 411 | + | ||
| 412 | + } | ||
| 413 | + }, "是", new SelectDialog.DialogInterface() { | ||
| 414 | + @Override | ||
| 415 | + public void onClick(SelectDialog dialog) { | ||
| 416 | + dialog.dismiss(); | ||
| 417 | + checkBaiduServiceState(); | ||
| 418 | + } | ||
| 419 | + }); | ||
| 420 | + selectDialog.setCanceledOnTouchOutside(false); | ||
| 421 | + selectDialog.setCancelable(false); | ||
| 422 | + selectDialog.show(); | ||
| 423 | + } | ||
| 424 | + } | ||
| 380 | } | 425 | } |
| 381 | }); | 426 | }); |
| 382 | //查看全部成绩点击事件 | 427 | //查看全部成绩点击事件 |
| @@ -409,6 +454,32 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -409,6 +454,32 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 409 | }); | 454 | }); |
| 410 | } | 455 | } |
| 411 | 456 | ||
| 457 | + private void checkBaiduServiceState() { | ||
| 458 | + boolean isRunBaidu = CommonInfo.getIsRunBaiduTraceService(getContext()); | ||
| 459 | + if (isRunBaidu) { | ||
| 460 | + //判断百度服务是否运行 | ||
| 461 | + if (!ServiceUtils.isServiceRunning(getContext(), "com.baidu.trace.LBSTraceService")) { | ||
| 462 | + stopStepService(); | ||
| 463 | + startStepService(getContext()); | ||
| 464 | + } else { | ||
| 465 | + PedometerMainActivity.startActivity(fragment.getActivity()); | ||
| 466 | + } | ||
| 467 | + } else { | ||
| 468 | + PedometerMainActivity.startActivity(fragment.getActivity()); | ||
| 469 | + } | ||
| 470 | + } | ||
| 471 | + | ||
| 472 | + private void stopStepService() { | ||
| 473 | + CommonInfo.setTsRunBaiduTraceService(getContext(), false); | ||
| 474 | + CommonInfo.setIsRunKeepAliveService(getContext(), false); | ||
| 475 | + CommonInfo.setIsWriteUserStep(getContext(), false); | ||
| 476 | + CommonInfo.setIsFirstStepSendTraceTip(getContext(), true); | ||
| 477 | + if (StepService.mClient != null) { | ||
| 478 | + StepService.mClient.stopGather(StepService.traceListener); | ||
| 479 | + } | ||
| 480 | + fragment.getActivity().stopService(new Intent(fragment.getActivity(), StepService.class)); | ||
| 481 | + } | ||
| 482 | + | ||
| 412 | public void initMap() { | 483 | public void initMap() { |
| 413 | //隐藏底部滑动卡片 | 484 | //隐藏底部滑动卡片 |
| 414 | fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); | 485 | fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); |
| @@ -721,9 +792,50 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -721,9 +792,50 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 721 | } | 792 | } |
| 722 | 793 | ||
| 723 | public void onResume() { | 794 | public void onResume() { |
| 795 | + if (getContext() == null) { | ||
| 796 | + return; | ||
| 797 | + } | ||
| 724 | if (mMapView != null) { | 798 | if (mMapView != null) { |
| 725 | mMapView.onResume(); | 799 | mMapView.onResume(); |
| 726 | } | 800 | } |
| 801 | + | ||
| 802 | + } | ||
| 803 | + | ||
| 804 | + public void checkStartBtnState() { | ||
| 805 | + //判断是否有进行中的赛事 | ||
| 806 | + userStepEntity = StepUtil.getUserStepData(getContext(), CommonInfo.getUserId(getContext())); | ||
| 807 | + Log.e(TAG, "checkStartBtnState: " + userStepEntity); | ||
| 808 | + if (userStepEntity != null) { | ||
| 809 | + //判断赛事id是否一致 | ||
| 810 | + String currentStreetId = CommonInfo.getStreetId(getContext()); | ||
| 811 | + //数据库保存的id | ||
| 812 | + String dbStreetId = userStepEntity.getStreetId(); | ||
| 813 | + //获取当前时间戳 | ||
| 814 | + long currnetTime = TimeUtil.getNowTimeStamp(); | ||
| 815 | + //获取用户暂停的时间戳 | ||
| 816 | + long userPauseTime = userStepEntity.getUserPauseTimeStamp(); | ||
| 817 | + //判断时间是否小于9小时 | ||
| 818 | + if ((currnetTime - userPauseTime) <= (9 * 60 * 60 * 1000)) { | ||
| 819 | + fragment.binding.tvRunNow.setText("继续运动"); | ||
| 820 | + fragment.binding.rlScrollViewStartBtn.setTag("2"); | ||
| 821 | + } else { | ||
| 822 | + fragment.binding.tvRunNow.setText("立即开始"); | ||
| 823 | + fragment.binding.rlScrollViewStartBtn.setTag("1"); | ||
| 824 | + } | ||
| 825 | + | ||
| 826 | + if (currentStreetId.equals(dbStreetId)) { | ||
| 827 | + isDifferentStreet = false; | ||
| 828 | + } | ||
| 829 | + //当前id与赛事id不一样 | ||
| 830 | + else { | ||
| 831 | + isDifferentStreet = true; | ||
| 832 | + } | ||
| 833 | + | ||
| 834 | + } else { | ||
| 835 | + fragment.binding.tvRunNow.setText("立即开始"); | ||
| 836 | + fragment.binding.rlScrollViewStartBtn.setTag("1"); | ||
| 837 | + } | ||
| 838 | + | ||
| 727 | } | 839 | } |
| 728 | 840 | ||
| 729 | public void onPause() { | 841 | public void onPause() { |
| @@ -866,9 +978,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -866,9 +978,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 866 | public void startStepService(Context context) { | 978 | public void startStepService(Context context) { |
| 867 | CommonInfo.setIsFirstStepSendTraceTip(getContext(), true); | 979 | CommonInfo.setIsFirstStepSendTraceTip(getContext(), true); |
| 868 | QMUITipDialogUtil.loadingDialog(getContext(), "请稍后", false); | 980 | QMUITipDialogUtil.loadingDialog(getContext(), "请稍后", false); |
| 869 | - if (CommonInfo.getStepStartTime(context) == 0) { | ||
| 870 | - CommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); | ||
| 871 | - } | ||
| 872 | CommonInfo.setIsRunKeepAliveService(context, true); | 981 | CommonInfo.setIsRunKeepAliveService(context, true); |
| 873 | CommonInfo.setIsRunStepService(context, true); | 982 | CommonInfo.setIsRunStepService(context, true); |
| 874 | CommonInfo.setTsRunBaiduTraceService(context, true); | 983 | CommonInfo.setTsRunBaiduTraceService(context, true); |
| @@ -887,4 +996,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -887,4 +996,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 887 | fragment.binding.tvRunNow.setText("现在开始"); | 996 | fragment.binding.tvRunNow.setText("现在开始"); |
| 888 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | 997 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); |
| 889 | } | 998 | } |
| 999 | + | ||
| 1000 | + | ||
| 890 | } | 1001 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunningFinishFragmentView.java
| 1 | package com.cnlive.moudle.pedometer.frame.view; | 1 | package com.cnlive.moudle.pedometer.frame.view; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | +import android.text.TextUtils; | ||
| 5 | +import android.util.Log; | ||
| 4 | import android.view.View; | 6 | import android.view.View; |
| 5 | 7 | ||
| 8 | +import com.bumptech.glide.Glide; | ||
| 9 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 6 | import com.cnlive.moudle.pedometer.model.RunningFinishBean; | 10 | import com.cnlive.moudle.pedometer.model.RunningFinishBean; |
| 7 | import com.cnlive.moudle.pedometer.ui.fragment.RunningFinishFragment; | 11 | import com.cnlive.moudle.pedometer.ui.fragment.RunningFinishFragment; |
| 8 | import com.cnlive.moudle.pedometer.ui.fragment.RunningMapFragment; | 12 | import com.cnlive.moudle.pedometer.ui.fragment.RunningMapFragment; |
| 9 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 13 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 10 | 14 | ||
| 15 | + | ||
| 11 | public class RunningFinishFragmentView implements MvpView { | 16 | public class RunningFinishFragmentView implements MvpView { |
| 17 | + private final String TAG = "RunningFinishView"; | ||
| 12 | private RunningFinishFragment fragment; | 18 | private RunningFinishFragment fragment; |
| 13 | 19 | ||
| 14 | public RunningFinishFragmentView(RunningFinishFragment fragment) { | 20 | public RunningFinishFragmentView(RunningFinishFragment fragment) { |
| @@ -20,16 +26,34 @@ public class RunningFinishFragmentView implements MvpView { | @@ -20,16 +26,34 @@ public class RunningFinishFragmentView implements MvpView { | ||
| 20 | } | 26 | } |
| 21 | 27 | ||
| 22 | public void initView(RunningFinishBean runningFinishBean) { | 28 | public void initView(RunningFinishBean runningFinishBean) { |
| 29 | + //设置用户头像 | ||
| 30 | + String faceUrl = CommonInfo.getUserIcon(getContext()); | ||
| 31 | + if (!TextUtils.isEmpty(faceUrl)) { | ||
| 32 | + Glide.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | ||
| 33 | + } | ||
| 34 | + //设置用户昵称 | ||
| 35 | + String nickName = CommonInfo.getUserNickName(getContext()); | ||
| 36 | + if (!TextUtils.isEmpty(nickName)) { | ||
| 37 | + fragment.binding.includeFinishUserInfo.tvUserNickName.setText(nickName); | ||
| 38 | + } | ||
| 23 | //设置距离 | 39 | //设置距离 |
| 24 | fragment.binding.includeFinishUserInfo.tvDistance.setText(runningFinishBean.getRunDistance()); | 40 | fragment.binding.includeFinishUserInfo.tvDistance.setText(runningFinishBean.getRunDistance()); |
| 25 | //设置配速 | 41 | //设置配速 |
| 26 | - fragment.binding.includeFinishUserInfo.tvSpeed.setText(runningFinishBean.getSpeed()); | 42 | + if ("--".equals(runningFinishBean.getSpeed())) { |
| 43 | + fragment.binding.includeFinishUserInfo.tvSpeed.setText("0"); | ||
| 44 | + } else { | ||
| 45 | + fragment.binding.includeFinishUserInfo.tvSpeed.setText(runningFinishBean.getSpeed()); | ||
| 46 | + } | ||
| 27 | //设置用时 | 47 | //设置用时 |
| 28 | fragment.binding.includeFinishUserInfo.tvTimer.setText(runningFinishBean.getTime()); | 48 | fragment.binding.includeFinishUserInfo.tvTimer.setText(runningFinishBean.getTime()); |
| 29 | //设置日期 | 49 | //设置日期 |
| 30 | fragment.binding.includeFinishUserInfo.tvDate.setText(runningFinishBean.getDate()); | 50 | fragment.binding.includeFinishUserInfo.tvDate.setText(runningFinishBean.getDate()); |
| 31 | //设置步数 | 51 | //设置步数 |
| 32 | - fragment.binding.includeFinishStep.tvStep.setText(runningFinishBean.getStep()); | 52 | + if ("--".equals(runningFinishBean.getStep())) { |
| 53 | + fragment.binding.includeFinishStep.tvStep.setText("0"); | ||
| 54 | + } else { | ||
| 55 | + fragment.binding.includeFinishStep.tvStep.setText(runningFinishBean.getStep()); | ||
| 56 | + } | ||
| 33 | //设置起点位置 | 57 | //设置起点位置 |
| 34 | fragment.binding.includeFinishRunRoute.tvStartPoint.setText(runningFinishBean.getStartPoint()); | 58 | fragment.binding.includeFinishRunRoute.tvStartPoint.setText(runningFinishBean.getStartPoint()); |
| 35 | //设置终点位置 | 59 | //设置终点位置 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunningMapFragmentView.java
| @@ -48,7 +48,7 @@ import java.util.HashMap; | @@ -48,7 +48,7 @@ import java.util.HashMap; | ||
| 48 | import java.util.List; | 48 | import java.util.List; |
| 49 | 49 | ||
| 50 | public class RunningMapFragmentView implements MvpView, SensorEventListener { | 50 | public class RunningMapFragmentView implements MvpView, SensorEventListener { |
| 51 | - private static final String TAG = "CollRunningMapFragmentView"; | 51 | + private static final String TAG = "RunningMapFragmentView"; |
| 52 | private RunningMapFragment fragment; | 52 | private RunningMapFragment fragment; |
| 53 | public BaiduMap baiduMap; | 53 | public BaiduMap baiduMap; |
| 54 | private MapView mMapView; | 54 | private MapView mMapView; |
| @@ -180,7 +180,6 @@ public class RunningMapFragmentView implements MvpView, SensorEventListener { | @@ -180,7 +180,6 @@ public class RunningMapFragmentView implements MvpView, SensorEventListener { | ||
| 180 | fragment.binding.flBack.setOnTouchListener(new View.OnTouchListener() { | 180 | fragment.binding.flBack.setOnTouchListener(new View.OnTouchListener() { |
| 181 | @Override | 181 | @Override |
| 182 | public boolean onTouch(View view, MotionEvent motionEvent) { | 182 | public boolean onTouch(View view, MotionEvent motionEvent) { |
| 183 | - Log.e(TAG, "onTouch: " + motionEvent.getAction()); | ||
| 184 | if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { | 183 | if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { |
| 185 | ButtonAnimUtil.setViewZoomIn(fragment.binding.flBack); | 184 | ButtonAnimUtil.setViewZoomIn(fragment.binding.flBack); |
| 186 | } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) { | 185 | } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/KeepLiveService.java
| @@ -44,7 +44,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -44,7 +44,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 44 | public static boolean isKeepService = true; | 44 | public static boolean isKeepService = true; |
| 45 | public static KeepLiveService instance; | 45 | public static KeepLiveService instance; |
| 46 | private int startId; | 46 | private int startId; |
| 47 | - private final String TAG = "CollKeepLiveService"; | 47 | + private final String TAG = "KeepLiveService"; |
| 48 | private Handler handler; | 48 | private Handler handler; |
| 49 | private Runnable runnable; | 49 | private Runnable runnable; |
| 50 | 50 | ||
| @@ -108,7 +108,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -108,7 +108,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 108 | // intentFilter.addAction(Intent.ACTION_TIME_CHANGED); | 108 | // intentFilter.addAction(Intent.ACTION_TIME_CHANGED); |
| 109 | // intentFilter.addAction(Intent.ACTION_POWER_CONNECTED); | 109 | // intentFilter.addAction(Intent.ACTION_POWER_CONNECTED); |
| 110 | // intentFilter.addAction(Intent.ACTION_POWER_DISCONNECTED); | 110 | // intentFilter.addAction(Intent.ACTION_POWER_DISCONNECTED); |
| 111 | - intentFilter.addAction("com.cnlive.strike.receiver.CollServiceReceiver"); | 111 | + intentFilter.addAction("com.cnlive.strike.receiver.ServiceReceiver"); |
| 112 | intentFilter.addAction("close.KeepService"); | 112 | intentFilter.addAction("close.KeepService"); |
| 113 | registerReceiver(myReceiver, intentFilter); | 113 | registerReceiver(myReceiver, intentFilter); |
| 114 | } | 114 | } |
| @@ -136,7 +136,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -136,7 +136,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 136 | //判断是否运行计步服务 | 136 | //判断是否运行计步服务 |
| 137 | boolean isRunStepService = CommonInfo.getIsRunStepService(getApplicationContext()); | 137 | boolean isRunStepService = CommonInfo.getIsRunStepService(getApplicationContext()); |
| 138 | if (isRunStepService) { | 138 | if (isRunStepService) { |
| 139 | - if (!ServiceUtils.isServiceRunning(getApplicationContext(), "com.cnlive.moudle.pedometer.service.CollStepService")) { | 139 | + if (!ServiceUtils.isServiceRunning(getApplicationContext(), "com.cnlive.moudle.pedometer.service.StepService")) { |
| 140 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | 140 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
| 141 | startForegroundService(new Intent(getApplicationContext(), StepService.class)); | 141 | startForegroundService(new Intent(getApplicationContext(), StepService.class)); |
| 142 | } else { | 142 | } else { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/StepService.java
| @@ -37,18 +37,16 @@ import com.baidu.trace.model.LocationMode; | @@ -37,18 +37,16 @@ import com.baidu.trace.model.LocationMode; | ||
| 37 | import com.baidu.trace.model.OnTraceListener; | 37 | import com.baidu.trace.model.OnTraceListener; |
| 38 | import com.baidu.trace.model.PushMessage; | 38 | import com.baidu.trace.model.PushMessage; |
| 39 | import com.baidu.trace.model.StatusCodes; | 39 | import com.baidu.trace.model.StatusCodes; |
| 40 | -import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; | ||
| 41 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 40 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 42 | import com.cnlive.moudle.pedometer.model.Constant; | 41 | import com.cnlive.moudle.pedometer.model.Constant; |
| 43 | import com.cnlive.moudle.pedometer.model.MessageEvent; | 42 | import com.cnlive.moudle.pedometer.model.MessageEvent; |
| 44 | import com.cnlive.moudle.pedometer.model.step.StepCount; | 43 | import com.cnlive.moudle.pedometer.model.step.StepCount; |
| 45 | import com.cnlive.moudle.pedometer.model.step.StepValuePassListener; | 44 | import com.cnlive.moudle.pedometer.model.step.StepValuePassListener; |
| 46 | -import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; | ||
| 47 | import com.cnlive.moudle.pedometer.sql.db.DbCore; | 45 | import com.cnlive.moudle.pedometer.sql.db.DbCore; |
| 48 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | 46 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; |
| 49 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; | 47 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; |
| 50 | -import com.cnlive.moudle.pedometer.utils.MySpHelper; | ||
| 51 | import com.cnlive.moudle.pedometer.utils.ServiceUtils; | 48 | import com.cnlive.moudle.pedometer.utils.ServiceUtils; |
| 49 | +import com.cnlive.moudle.pedometer.utils.StepUtil; | ||
| 52 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 50 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 53 | import com.example.moudle_pedometer.R; | 51 | import com.example.moudle_pedometer.R; |
| 54 | 52 | ||
| @@ -58,15 +56,11 @@ import org.greenrobot.eventbus.ThreadMode; | @@ -58,15 +56,11 @@ import org.greenrobot.eventbus.ThreadMode; | ||
| 58 | 56 | ||
| 59 | import java.text.SimpleDateFormat; | 57 | import java.text.SimpleDateFormat; |
| 60 | import java.util.Date; | 58 | import java.util.Date; |
| 61 | -import java.util.List; | ||
| 62 | -import java.util.UUID; | ||
| 63 | 59 | ||
| 64 | 60 | ||
| 65 | public class StepService extends Service implements SensorEventListener { | 61 | public class StepService extends Service implements SensorEventListener { |
| 66 | 62 | ||
| 67 | - private String TAG = "CollStepService"; | ||
| 68 | - public static boolean isKeep = true; | ||
| 69 | - | 63 | + private String TAG = "StepService"; |
| 70 | /** | 64 | /** |
| 71 | * 通知栏相关 | 65 | * 通知栏相关 |
| 72 | */ | 66 | */ |
| @@ -353,9 +347,10 @@ public class StepService extends Service implements SensorEventListener { | @@ -353,9 +347,10 @@ public class StepService extends Service implements SensorEventListener { | ||
| 353 | //开启轨迹服务 | 347 | //开启轨迹服务 |
| 354 | if (mClient != null) { | 348 | if (mClient != null) { |
| 355 | mClient.startTrace(mTrace, traceListener); | 349 | mClient.startTrace(mTrace, traceListener); |
| 356 | - long stepStartTime = CommonInfo.getStepStartTime(getApplicationContext()); | ||
| 357 | - if (stepStartTime == 0) { | ||
| 358 | - CommonInfo.setStepStartTime(getApplicationContext(), TimeUtil.getCurrentTime()); | 350 | + //设置用户开始时间以及赛事ID |
| 351 | + UserStepEntity userStepEntity = StepUtil.getUserStepData(getApplicationContext(), CommonInfo.getUserId(getApplicationContext())); | ||
| 352 | + if (userStepEntity == null) { | ||
| 353 | + StepUtil.setStepStartData(getApplicationContext(), userId, TimeUtil.getNowTimeStamp(), CommonInfo.getStreetId(getApplicationContext())); | ||
| 359 | } | 354 | } |
| 360 | } | 355 | } |
| 361 | 356 | ||
| @@ -548,17 +543,13 @@ public class StepService extends Service implements SensorEventListener { | @@ -548,17 +543,13 @@ public class StepService extends Service implements SensorEventListener { | ||
| 548 | return; | 543 | return; |
| 549 | } | 544 | } |
| 550 | //获取当天的数据,用于展示 CURRENT_DATE | 545 | //获取当天的数据,用于展示 CURRENT_DATE |
| 551 | - List<UserStepEntity> list = DbCore.getDaoSession().getUserStepEntityDao().queryBuilder().where(UserStepEntityDao.Properties.UserId.eq(userId), UserStepEntityDao.Properties.Date.eq(CURRENT_DATE)).list(); | ||
| 552 | - if (list == null) { | ||
| 553 | - return; | ||
| 554 | - } | ||
| 555 | - if (list.size() == 0 || list.isEmpty()) { | 546 | + UserStepEntity userStepEntity = StepUtil.getUserStepData(getApplicationContext(), CommonInfo.getUserId(getApplicationContext())); |
| 547 | + if (userStepEntity == null) { | ||
| 556 | CURRENT_STEP = 0; | 548 | CURRENT_STEP = 0; |
| 557 | - } else if (list.size() == 1) { | ||
| 558 | - Log.e(TAG, "StepData=" + list.get(0).toString()); | ||
| 559 | - CURRENT_STEP = Integer.parseInt(list.get(0).getStepCount()); | ||
| 560 | } else { | 549 | } else { |
| 561 | - Log.e(TAG, "出错了!"); | 550 | + if (userStepEntity.getStepCount() != null) { |
| 551 | + CURRENT_STEP = Integer.parseInt(userStepEntity.getStepCount()); | ||
| 552 | + } | ||
| 562 | } | 553 | } |
| 563 | if (mStepCount != null) { | 554 | if (mStepCount != null) { |
| 564 | mStepCount.setSteps(CURRENT_STEP); | 555 | mStepCount.setSteps(CURRENT_STEP); |
| @@ -915,19 +906,16 @@ public class StepService extends Service implements SensorEventListener { | @@ -915,19 +906,16 @@ public class StepService extends Service implements SensorEventListener { | ||
| 915 | return; | 906 | return; |
| 916 | } | 907 | } |
| 917 | int tempStep = CURRENT_STEP; | 908 | int tempStep = CURRENT_STEP; |
| 918 | - List<UserStepEntity> list = DbCore.getDaoSession().getUserStepEntityDao().queryBuilder().where(UserStepEntityDao.Properties.UserId.eq(userId), UserStepEntityDao.Properties.Date.eq(CURRENT_DATE)).list(); | ||
| 919 | - if (list.size() == 0 || list.isEmpty()) { | 909 | + UserStepEntity userStepEntity = StepUtil.getUserStepData(getApplicationContext(), CommonInfo.getUserId(getApplicationContext())); |
| 910 | + if (userStepEntity == null) { | ||
| 920 | UserStepEntity data = new UserStepEntity(); | 911 | UserStepEntity data = new UserStepEntity(); |
| 921 | - data.setUuid(UUID.randomUUID().toString()); | ||
| 922 | data.setUserId(userId); | 912 | data.setUserId(userId); |
| 923 | data.setDate(CURRENT_DATE); | 913 | data.setDate(CURRENT_DATE); |
| 924 | data.setStepCount(tempStep + ""); | 914 | data.setStepCount(tempStep + ""); |
| 925 | - DbCore.getDaoSession().getUserStepEntityDao().insert(data); | ||
| 926 | - } else if (list.size() == 1) { | ||
| 927 | - UserStepEntity data = list.get(0); | ||
| 928 | - data.setStepCount(tempStep + ""); | ||
| 929 | - DbCore.getDaoSession().getUserStepEntityDao().update(data); | 915 | + StepUtil.insertStepData(getApplicationContext(), data); |
| 930 | } else { | 916 | } else { |
| 917 | + userStepEntity.setStepCount(tempStep + ""); | ||
| 918 | + StepUtil.updateStepData(getApplicationContext(), userStepEntity); | ||
| 931 | } | 919 | } |
| 932 | } | 920 | } |
| 933 | 921 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoMaster.java
| @@ -21,14 +21,14 @@ public class DaoMaster extends AbstractDaoMaster { | @@ -21,14 +21,14 @@ public class DaoMaster extends AbstractDaoMaster { | ||
| 21 | 21 | ||
| 22 | /** Creates underlying database table using DAOs. */ | 22 | /** Creates underlying database table using DAOs. */ |
| 23 | public static void createAllTables(Database db, boolean ifNotExists) { | 23 | public static void createAllTables(Database db, boolean ifNotExists) { |
| 24 | - UserStepEntityDao.createTable(db, ifNotExists); | ||
| 25 | CollUserStepEntityDao.createTable(db, ifNotExists); | 24 | CollUserStepEntityDao.createTable(db, ifNotExists); |
| 25 | + UserStepEntityDao.createTable(db, ifNotExists); | ||
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | /** Drops underlying database table using DAOs. */ | 28 | /** Drops underlying database table using DAOs. */ |
| 29 | public static void dropAllTables(Database db, boolean ifExists) { | 29 | public static void dropAllTables(Database db, boolean ifExists) { |
| 30 | - UserStepEntityDao.dropTable(db, ifExists); | ||
| 31 | CollUserStepEntityDao.dropTable(db, ifExists); | 30 | CollUserStepEntityDao.dropTable(db, ifExists); |
| 31 | + UserStepEntityDao.dropTable(db, ifExists); | ||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | /** | 34 | /** |
| @@ -47,8 +47,8 @@ public class DaoMaster extends AbstractDaoMaster { | @@ -47,8 +47,8 @@ public class DaoMaster extends AbstractDaoMaster { | ||
| 47 | 47 | ||
| 48 | public DaoMaster(Database db) { | 48 | public DaoMaster(Database db) { |
| 49 | super(db, SCHEMA_VERSION); | 49 | super(db, SCHEMA_VERSION); |
| 50 | - registerDaoClass(UserStepEntityDao.class); | ||
| 51 | registerDaoClass(CollUserStepEntityDao.class); | 50 | registerDaoClass(CollUserStepEntityDao.class); |
| 51 | + registerDaoClass(UserStepEntityDao.class); | ||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | public DaoSession newSession() { | 54 | public DaoSession newSession() { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoSession.java
| @@ -8,11 +8,11 @@ import org.greenrobot.greendao.database.Database; | @@ -8,11 +8,11 @@ import org.greenrobot.greendao.database.Database; | ||
| 8 | import org.greenrobot.greendao.identityscope.IdentityScopeType; | 8 | import org.greenrobot.greendao.identityscope.IdentityScopeType; |
| 9 | import org.greenrobot.greendao.internal.DaoConfig; | 9 | import org.greenrobot.greendao.internal.DaoConfig; |
| 10 | 10 | ||
| 11 | -import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | ||
| 12 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | 11 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; |
| 12 | +import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | ||
| 13 | 13 | ||
| 14 | -import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; | ||
| 15 | import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; | 14 | import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; |
| 15 | +import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; | ||
| 16 | 16 | ||
| 17 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. | 17 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. |
| 18 | 18 | ||
| @@ -23,40 +23,40 @@ import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; | @@ -23,40 +23,40 @@ import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; | ||
| 23 | */ | 23 | */ |
| 24 | public class DaoSession extends AbstractDaoSession { | 24 | public class DaoSession extends AbstractDaoSession { |
| 25 | 25 | ||
| 26 | - private final DaoConfig userStepEntityDaoConfig; | ||
| 27 | private final DaoConfig collUserStepEntityDaoConfig; | 26 | private final DaoConfig collUserStepEntityDaoConfig; |
| 27 | + private final DaoConfig userStepEntityDaoConfig; | ||
| 28 | 28 | ||
| 29 | - private final UserStepEntityDao userStepEntityDao; | ||
| 30 | private final CollUserStepEntityDao collUserStepEntityDao; | 29 | private final CollUserStepEntityDao collUserStepEntityDao; |
| 30 | + private final UserStepEntityDao userStepEntityDao; | ||
| 31 | 31 | ||
| 32 | public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> | 32 | public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> |
| 33 | daoConfigMap) { | 33 | daoConfigMap) { |
| 34 | super(db); | 34 | super(db); |
| 35 | 35 | ||
| 36 | - userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone(); | ||
| 37 | - userStepEntityDaoConfig.initIdentityScope(type); | ||
| 38 | - | ||
| 39 | collUserStepEntityDaoConfig = daoConfigMap.get(CollUserStepEntityDao.class).clone(); | 36 | collUserStepEntityDaoConfig = daoConfigMap.get(CollUserStepEntityDao.class).clone(); |
| 40 | collUserStepEntityDaoConfig.initIdentityScope(type); | 37 | collUserStepEntityDaoConfig.initIdentityScope(type); |
| 41 | 38 | ||
| 42 | - userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this); | 39 | + userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone(); |
| 40 | + userStepEntityDaoConfig.initIdentityScope(type); | ||
| 41 | + | ||
| 43 | collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this); | 42 | collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this); |
| 43 | + userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this); | ||
| 44 | 44 | ||
| 45 | - registerDao(UserStepEntity.class, userStepEntityDao); | ||
| 46 | registerDao(CollUserStepEntity.class, collUserStepEntityDao); | 45 | registerDao(CollUserStepEntity.class, collUserStepEntityDao); |
| 46 | + registerDao(UserStepEntity.class, userStepEntityDao); | ||
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | public void clear() { | 49 | public void clear() { |
| 50 | - userStepEntityDaoConfig.clearIdentityScope(); | ||
| 51 | collUserStepEntityDaoConfig.clearIdentityScope(); | 50 | collUserStepEntityDaoConfig.clearIdentityScope(); |
| 52 | - } | ||
| 53 | - | ||
| 54 | - public UserStepEntityDao getUserStepEntityDao() { | ||
| 55 | - return userStepEntityDao; | 51 | + userStepEntityDaoConfig.clearIdentityScope(); |
| 56 | } | 52 | } |
| 57 | 53 | ||
| 58 | public CollUserStepEntityDao getCollUserStepEntityDao() { | 54 | public CollUserStepEntityDao getCollUserStepEntityDao() { |
| 59 | return collUserStepEntityDao; | 55 | return collUserStepEntityDao; |
| 60 | } | 56 | } |
| 61 | 57 | ||
| 58 | + public UserStepEntityDao getUserStepEntityDao() { | ||
| 59 | + return userStepEntityDao; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | } | 62 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/UserStepEntityDao.java
| @@ -24,14 +24,20 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | @@ -24,14 +24,20 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | ||
| 24 | * Can be used for QueryBuilder and for referencing column names. | 24 | * Can be used for QueryBuilder and for referencing column names. |
| 25 | */ | 25 | */ |
| 26 | public static class Properties { | 26 | public static class Properties { |
| 27 | - public final static Property Uuid = new Property(0, String.class, "uuid", true, "UUID"); | ||
| 28 | - public final static Property UserId = new Property(1, String.class, "userId", false, "USER_ID"); | ||
| 29 | - public final static Property Date = new Property(2, String.class, "date", false, "DATE"); | ||
| 30 | - public final static Property StepCount = new Property(3, String.class, "stepCount", false, "STEP_COUNT"); | ||
| 31 | - public final static Property PauseTimeStamp = new Property(4, long.class, "pauseTimeStamp", false, "PAUSE_TIME_STAMP"); | ||
| 32 | - public final static Property RecordTime = new Property(5, long.class, "recordTime", false, "RECORD_TIME"); | ||
| 33 | - public final static Property CaloriesCount = new Property(6, double.class, "caloriesCount", false, "CALORIES_COUNT"); | ||
| 34 | - public final static Property ServerTraceData = new Property(7, String.class, "serverTraceData", false, "SERVER_TRACE_DATA"); | 27 | + public final static Property UserId = new Property(0, String.class, "userId", true, "USER_ID"); |
| 28 | + public final static Property Date = new Property(1, String.class, "date", false, "DATE"); | ||
| 29 | + public final static Property StepCount = new Property(2, String.class, "stepCount", false, "STEP_COUNT"); | ||
| 30 | + public final static Property PauseTimeStamp = new Property(3, long.class, "pauseTimeStamp", false, "PAUSE_TIME_STAMP"); | ||
| 31 | + public final static Property RecordTime = new Property(4, long.class, "recordTime", false, "RECORD_TIME"); | ||
| 32 | + public final static Property CaloriesCount = new Property(5, double.class, "caloriesCount", false, "CALORIES_COUNT"); | ||
| 33 | + public final static Property ServerTraceData = new Property(6, String.class, "serverTraceData", false, "SERVER_TRACE_DATA"); | ||
| 34 | + public final static Property StartPoint = new Property(7, String.class, "startPoint", false, "START_POINT"); | ||
| 35 | + public final static Property EndPoint = new Property(8, String.class, "endPoint", false, "END_POINT"); | ||
| 36 | + public final static Property StartTimeStamp = new Property(9, long.class, "startTimeStamp", false, "START_TIME_STAMP"); | ||
| 37 | + public final static Property FinishTimeStamp = new Property(10, long.class, "finishTimeStamp", false, "FINISH_TIME_STAMP"); | ||
| 38 | + public final static Property StreetId = new Property(11, String.class, "streetId", false, "STREET_ID"); | ||
| 39 | + public final static Property PauseCount = new Property(12, int.class, "pauseCount", false, "PAUSE_COUNT"); | ||
| 40 | + public final static Property UserPauseTimeStamp = new Property(13, long.class, "userPauseTimeStamp", false, "USER_PAUSE_TIME_STAMP"); | ||
| 35 | } | 41 | } |
| 36 | 42 | ||
| 37 | 43 | ||
| @@ -47,14 +53,20 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | @@ -47,14 +53,20 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | ||
| 47 | public static void createTable(Database db, boolean ifNotExists) { | 53 | public static void createTable(Database db, boolean ifNotExists) { |
| 48 | String constraint = ifNotExists? "IF NOT EXISTS ": ""; | 54 | String constraint = ifNotExists? "IF NOT EXISTS ": ""; |
| 49 | db.execSQL("CREATE TABLE " + constraint + "\"USER_STEP_ENTITY\" (" + // | 55 | db.execSQL("CREATE TABLE " + constraint + "\"USER_STEP_ENTITY\" (" + // |
| 50 | - "\"UUID\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid | ||
| 51 | - "\"USER_ID\" TEXT," + // 1: userId | ||
| 52 | - "\"DATE\" TEXT," + // 2: date | ||
| 53 | - "\"STEP_COUNT\" TEXT," + // 3: stepCount | ||
| 54 | - "\"PAUSE_TIME_STAMP\" INTEGER NOT NULL ," + // 4: pauseTimeStamp | ||
| 55 | - "\"RECORD_TIME\" INTEGER NOT NULL ," + // 5: recordTime | ||
| 56 | - "\"CALORIES_COUNT\" REAL NOT NULL ," + // 6: caloriesCount | ||
| 57 | - "\"SERVER_TRACE_DATA\" TEXT);"); // 7: serverTraceData | 56 | + "\"USER_ID\" TEXT PRIMARY KEY NOT NULL ," + // 0: userId |
| 57 | + "\"DATE\" TEXT," + // 1: date | ||
| 58 | + "\"STEP_COUNT\" TEXT," + // 2: stepCount | ||
| 59 | + "\"PAUSE_TIME_STAMP\" INTEGER NOT NULL ," + // 3: pauseTimeStamp | ||
| 60 | + "\"RECORD_TIME\" INTEGER NOT NULL ," + // 4: recordTime | ||
| 61 | + "\"CALORIES_COUNT\" REAL NOT NULL ," + // 5: caloriesCount | ||
| 62 | + "\"SERVER_TRACE_DATA\" TEXT," + // 6: serverTraceData | ||
| 63 | + "\"START_POINT\" TEXT," + // 7: startPoint | ||
| 64 | + "\"END_POINT\" TEXT," + // 8: endPoint | ||
| 65 | + "\"START_TIME_STAMP\" INTEGER NOT NULL ," + // 9: startTimeStamp | ||
| 66 | + "\"FINISH_TIME_STAMP\" INTEGER NOT NULL ," + // 10: finishTimeStamp | ||
| 67 | + "\"STREET_ID\" TEXT," + // 11: streetId | ||
| 68 | + "\"PAUSE_COUNT\" INTEGER NOT NULL ," + // 12: pauseCount | ||
| 69 | + "\"USER_PAUSE_TIME_STAMP\" INTEGER NOT NULL );"); // 13: userPauseTimeStamp | ||
| 58 | } | 70 | } |
| 59 | 71 | ||
| 60 | /** Drops the underlying database table. */ | 72 | /** Drops the underlying database table. */ |
| @@ -67,66 +79,94 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | @@ -67,66 +79,94 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | ||
| 67 | protected final void bindValues(DatabaseStatement stmt, UserStepEntity entity) { | 79 | protected final void bindValues(DatabaseStatement stmt, UserStepEntity entity) { |
| 68 | stmt.clearBindings(); | 80 | stmt.clearBindings(); |
| 69 | 81 | ||
| 70 | - String uuid = entity.getUuid(); | ||
| 71 | - if (uuid != null) { | ||
| 72 | - stmt.bindString(1, uuid); | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | String userId = entity.getUserId(); | 82 | String userId = entity.getUserId(); |
| 76 | if (userId != null) { | 83 | if (userId != null) { |
| 77 | - stmt.bindString(2, userId); | 84 | + stmt.bindString(1, userId); |
| 78 | } | 85 | } |
| 79 | 86 | ||
| 80 | String date = entity.getDate(); | 87 | String date = entity.getDate(); |
| 81 | if (date != null) { | 88 | if (date != null) { |
| 82 | - stmt.bindString(3, date); | 89 | + stmt.bindString(2, date); |
| 83 | } | 90 | } |
| 84 | 91 | ||
| 85 | String stepCount = entity.getStepCount(); | 92 | String stepCount = entity.getStepCount(); |
| 86 | if (stepCount != null) { | 93 | if (stepCount != null) { |
| 87 | - stmt.bindString(4, stepCount); | 94 | + stmt.bindString(3, stepCount); |
| 88 | } | 95 | } |
| 89 | - stmt.bindLong(5, entity.getPauseTimeStamp()); | ||
| 90 | - stmt.bindLong(6, entity.getRecordTime()); | ||
| 91 | - stmt.bindDouble(7, entity.getCaloriesCount()); | 96 | + stmt.bindLong(4, entity.getPauseTimeStamp()); |
| 97 | + stmt.bindLong(5, entity.getRecordTime()); | ||
| 98 | + stmt.bindDouble(6, entity.getCaloriesCount()); | ||
| 92 | 99 | ||
| 93 | String serverTraceData = entity.getServerTraceData(); | 100 | String serverTraceData = entity.getServerTraceData(); |
| 94 | if (serverTraceData != null) { | 101 | if (serverTraceData != null) { |
| 95 | - stmt.bindString(8, serverTraceData); | 102 | + stmt.bindString(7, serverTraceData); |
| 103 | + } | ||
| 104 | + | ||
| 105 | + String startPoint = entity.getStartPoint(); | ||
| 106 | + if (startPoint != null) { | ||
| 107 | + stmt.bindString(8, startPoint); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + String endPoint = entity.getEndPoint(); | ||
| 111 | + if (endPoint != null) { | ||
| 112 | + stmt.bindString(9, endPoint); | ||
| 113 | + } | ||
| 114 | + stmt.bindLong(10, entity.getStartTimeStamp()); | ||
| 115 | + stmt.bindLong(11, entity.getFinishTimeStamp()); | ||
| 116 | + | ||
| 117 | + String streetId = entity.getStreetId(); | ||
| 118 | + if (streetId != null) { | ||
| 119 | + stmt.bindString(12, streetId); | ||
| 96 | } | 120 | } |
| 121 | + stmt.bindLong(13, entity.getPauseCount()); | ||
| 122 | + stmt.bindLong(14, entity.getUserPauseTimeStamp()); | ||
| 97 | } | 123 | } |
| 98 | 124 | ||
| 99 | @Override | 125 | @Override |
| 100 | protected final void bindValues(SQLiteStatement stmt, UserStepEntity entity) { | 126 | protected final void bindValues(SQLiteStatement stmt, UserStepEntity entity) { |
| 101 | stmt.clearBindings(); | 127 | stmt.clearBindings(); |
| 102 | 128 | ||
| 103 | - String uuid = entity.getUuid(); | ||
| 104 | - if (uuid != null) { | ||
| 105 | - stmt.bindString(1, uuid); | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | String userId = entity.getUserId(); | 129 | String userId = entity.getUserId(); |
| 109 | if (userId != null) { | 130 | if (userId != null) { |
| 110 | - stmt.bindString(2, userId); | 131 | + stmt.bindString(1, userId); |
| 111 | } | 132 | } |
| 112 | 133 | ||
| 113 | String date = entity.getDate(); | 134 | String date = entity.getDate(); |
| 114 | if (date != null) { | 135 | if (date != null) { |
| 115 | - stmt.bindString(3, date); | 136 | + stmt.bindString(2, date); |
| 116 | } | 137 | } |
| 117 | 138 | ||
| 118 | String stepCount = entity.getStepCount(); | 139 | String stepCount = entity.getStepCount(); |
| 119 | if (stepCount != null) { | 140 | if (stepCount != null) { |
| 120 | - stmt.bindString(4, stepCount); | 141 | + stmt.bindString(3, stepCount); |
| 121 | } | 142 | } |
| 122 | - stmt.bindLong(5, entity.getPauseTimeStamp()); | ||
| 123 | - stmt.bindLong(6, entity.getRecordTime()); | ||
| 124 | - stmt.bindDouble(7, entity.getCaloriesCount()); | 143 | + stmt.bindLong(4, entity.getPauseTimeStamp()); |
| 144 | + stmt.bindLong(5, entity.getRecordTime()); | ||
| 145 | + stmt.bindDouble(6, entity.getCaloriesCount()); | ||
| 125 | 146 | ||
| 126 | String serverTraceData = entity.getServerTraceData(); | 147 | String serverTraceData = entity.getServerTraceData(); |
| 127 | if (serverTraceData != null) { | 148 | if (serverTraceData != null) { |
| 128 | - stmt.bindString(8, serverTraceData); | 149 | + stmt.bindString(7, serverTraceData); |
| 150 | + } | ||
| 151 | + | ||
| 152 | + String startPoint = entity.getStartPoint(); | ||
| 153 | + if (startPoint != null) { | ||
| 154 | + stmt.bindString(8, startPoint); | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + String endPoint = entity.getEndPoint(); | ||
| 158 | + if (endPoint != null) { | ||
| 159 | + stmt.bindString(9, endPoint); | ||
| 160 | + } | ||
| 161 | + stmt.bindLong(10, entity.getStartTimeStamp()); | ||
| 162 | + stmt.bindLong(11, entity.getFinishTimeStamp()); | ||
| 163 | + | ||
| 164 | + String streetId = entity.getStreetId(); | ||
| 165 | + if (streetId != null) { | ||
| 166 | + stmt.bindString(12, streetId); | ||
| 129 | } | 167 | } |
| 168 | + stmt.bindLong(13, entity.getPauseCount()); | ||
| 169 | + stmt.bindLong(14, entity.getUserPauseTimeStamp()); | ||
| 130 | } | 170 | } |
| 131 | 171 | ||
| 132 | @Override | 172 | @Override |
| @@ -137,39 +177,51 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | @@ -137,39 +177,51 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | ||
| 137 | @Override | 177 | @Override |
| 138 | public UserStepEntity readEntity(Cursor cursor, int offset) { | 178 | public UserStepEntity readEntity(Cursor cursor, int offset) { |
| 139 | UserStepEntity entity = new UserStepEntity( // | 179 | UserStepEntity entity = new UserStepEntity( // |
| 140 | - cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // uuid | ||
| 141 | - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // userId | ||
| 142 | - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // date | ||
| 143 | - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // stepCount | ||
| 144 | - cursor.getLong(offset + 4), // pauseTimeStamp | ||
| 145 | - cursor.getLong(offset + 5), // recordTime | ||
| 146 | - cursor.getDouble(offset + 6), // caloriesCount | ||
| 147 | - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // serverTraceData | 180 | + cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // userId |
| 181 | + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // date | ||
| 182 | + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // stepCount | ||
| 183 | + cursor.getLong(offset + 3), // pauseTimeStamp | ||
| 184 | + cursor.getLong(offset + 4), // recordTime | ||
| 185 | + cursor.getDouble(offset + 5), // caloriesCount | ||
| 186 | + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // serverTraceData | ||
| 187 | + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // startPoint | ||
| 188 | + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // endPoint | ||
| 189 | + cursor.getLong(offset + 9), // startTimeStamp | ||
| 190 | + cursor.getLong(offset + 10), // finishTimeStamp | ||
| 191 | + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // streetId | ||
| 192 | + cursor.getInt(offset + 12), // pauseCount | ||
| 193 | + cursor.getLong(offset + 13) // userPauseTimeStamp | ||
| 148 | ); | 194 | ); |
| 149 | return entity; | 195 | return entity; |
| 150 | } | 196 | } |
| 151 | 197 | ||
| 152 | @Override | 198 | @Override |
| 153 | public void readEntity(Cursor cursor, UserStepEntity entity, int offset) { | 199 | public void readEntity(Cursor cursor, UserStepEntity entity, int offset) { |
| 154 | - entity.setUuid(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0)); | ||
| 155 | - entity.setUserId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); | ||
| 156 | - entity.setDate(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); | ||
| 157 | - entity.setStepCount(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); | ||
| 158 | - entity.setPauseTimeStamp(cursor.getLong(offset + 4)); | ||
| 159 | - entity.setRecordTime(cursor.getLong(offset + 5)); | ||
| 160 | - entity.setCaloriesCount(cursor.getDouble(offset + 6)); | ||
| 161 | - entity.setServerTraceData(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); | 200 | + entity.setUserId(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0)); |
| 201 | + entity.setDate(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); | ||
| 202 | + entity.setStepCount(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); | ||
| 203 | + entity.setPauseTimeStamp(cursor.getLong(offset + 3)); | ||
| 204 | + entity.setRecordTime(cursor.getLong(offset + 4)); | ||
| 205 | + entity.setCaloriesCount(cursor.getDouble(offset + 5)); | ||
| 206 | + entity.setServerTraceData(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); | ||
| 207 | + entity.setStartPoint(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); | ||
| 208 | + entity.setEndPoint(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); | ||
| 209 | + entity.setStartTimeStamp(cursor.getLong(offset + 9)); | ||
| 210 | + entity.setFinishTimeStamp(cursor.getLong(offset + 10)); | ||
| 211 | + entity.setStreetId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); | ||
| 212 | + entity.setPauseCount(cursor.getInt(offset + 12)); | ||
| 213 | + entity.setUserPauseTimeStamp(cursor.getLong(offset + 13)); | ||
| 162 | } | 214 | } |
| 163 | 215 | ||
| 164 | @Override | 216 | @Override |
| 165 | protected final String updateKeyAfterInsert(UserStepEntity entity, long rowId) { | 217 | protected final String updateKeyAfterInsert(UserStepEntity entity, long rowId) { |
| 166 | - return entity.getUuid(); | 218 | + return entity.getUserId(); |
| 167 | } | 219 | } |
| 168 | 220 | ||
| 169 | @Override | 221 | @Override |
| 170 | public String getKey(UserStepEntity entity) { | 222 | public String getKey(UserStepEntity entity) { |
| 171 | if(entity != null) { | 223 | if(entity != null) { |
| 172 | - return entity.getUuid(); | 224 | + return entity.getUserId(); |
| 173 | } else { | 225 | } else { |
| 174 | return null; | 226 | return null; |
| 175 | } | 227 | } |
| @@ -177,7 +229,7 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | @@ -177,7 +229,7 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { | ||
| 177 | 229 | ||
| 178 | @Override | 230 | @Override |
| 179 | public boolean hasKey(UserStepEntity entity) { | 231 | public boolean hasKey(UserStepEntity entity) { |
| 180 | - return entity.getUuid() != null; | 232 | + return entity.getUserId() != null; |
| 181 | } | 233 | } |
| 182 | 234 | ||
| 183 | @Override | 235 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/entity/UserStepEntity.java
| @@ -7,7 +7,6 @@ import org.greenrobot.greendao.annotation.Id; | @@ -7,7 +7,6 @@ import org.greenrobot.greendao.annotation.Id; | ||
| 7 | @Entity | 7 | @Entity |
| 8 | public class UserStepEntity { | 8 | public class UserStepEntity { |
| 9 | @Id | 9 | @Id |
| 10 | - private String uuid; | ||
| 11 | private String userId; | 10 | private String userId; |
| 12 | private String date; | 11 | private String date; |
| 13 | private String stepCount; | 12 | private String stepCount; |
| @@ -15,12 +14,18 @@ public class UserStepEntity { | @@ -15,12 +14,18 @@ public class UserStepEntity { | ||
| 15 | private long recordTime;//暂停时间 | 14 | private long recordTime;//暂停时间 |
| 16 | private double caloriesCount;//卡路里 | 15 | private double caloriesCount;//卡路里 |
| 17 | private String serverTraceData;//服务端赛道数据 | 16 | private String serverTraceData;//服务端赛道数据 |
| 18 | - | ||
| 19 | - @Generated(hash = 1521646580) | ||
| 20 | - public UserStepEntity(String uuid, String userId, String date, String stepCount, | ||
| 21 | - long pauseTimeStamp, long recordTime, double caloriesCount, | ||
| 22 | - String serverTraceData) { | ||
| 23 | - this.uuid = uuid; | 17 | + private String startPoint; |
| 18 | + private String endPoint; | ||
| 19 | + private long startTimeStamp; | ||
| 20 | + private long finishTimeStamp; | ||
| 21 | + private String streetId;//赛事ID | ||
| 22 | + private int pauseCount;//暂停次数 | ||
| 23 | + private long userPauseTimeStamp;//暂停时间戳 | ||
| 24 | + | ||
| 25 | + @Generated(hash = 446594441) | ||
| 26 | + public UserStepEntity(String userId, String date, String stepCount, long pauseTimeStamp, long recordTime, double caloriesCount, | ||
| 27 | + String serverTraceData, String startPoint, String endPoint, long startTimeStamp, long finishTimeStamp, String streetId, int pauseCount, | ||
| 28 | + long userPauseTimeStamp) { | ||
| 24 | this.userId = userId; | 29 | this.userId = userId; |
| 25 | this.date = date; | 30 | this.date = date; |
| 26 | this.stepCount = stepCount; | 31 | this.stepCount = stepCount; |
| @@ -28,6 +33,13 @@ public class UserStepEntity { | @@ -28,6 +33,13 @@ public class UserStepEntity { | ||
| 28 | this.recordTime = recordTime; | 33 | this.recordTime = recordTime; |
| 29 | this.caloriesCount = caloriesCount; | 34 | this.caloriesCount = caloriesCount; |
| 30 | this.serverTraceData = serverTraceData; | 35 | this.serverTraceData = serverTraceData; |
| 36 | + this.startPoint = startPoint; | ||
| 37 | + this.endPoint = endPoint; | ||
| 38 | + this.startTimeStamp = startTimeStamp; | ||
| 39 | + this.finishTimeStamp = finishTimeStamp; | ||
| 40 | + this.streetId = streetId; | ||
| 41 | + this.pauseCount = pauseCount; | ||
| 42 | + this.userPauseTimeStamp = userPauseTimeStamp; | ||
| 31 | } | 43 | } |
| 32 | 44 | ||
| 33 | @Generated(hash = 273857141) | 45 | @Generated(hash = 273857141) |
| @@ -58,14 +70,6 @@ public class UserStepEntity { | @@ -58,14 +70,6 @@ public class UserStepEntity { | ||
| 58 | this.stepCount = stepCount; | 70 | this.stepCount = stepCount; |
| 59 | } | 71 | } |
| 60 | 72 | ||
| 61 | - public String getUuid() { | ||
| 62 | - return this.uuid; | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - public void setUuid(String uuid) { | ||
| 66 | - this.uuid = uuid; | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | public long getPauseTimeStamp() { | 73 | public long getPauseTimeStamp() { |
| 70 | return this.pauseTimeStamp; | 74 | return this.pauseTimeStamp; |
| 71 | } | 75 | } |
| @@ -74,14 +78,6 @@ public class UserStepEntity { | @@ -74,14 +78,6 @@ public class UserStepEntity { | ||
| 74 | this.pauseTimeStamp = pauseTimeStamp; | 78 | this.pauseTimeStamp = pauseTimeStamp; |
| 75 | } | 79 | } |
| 76 | 80 | ||
| 77 | - public double getCaloriesCount() { | ||
| 78 | - return this.caloriesCount; | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - public void setCaloriesCount(double caloriesCount) { | ||
| 82 | - this.caloriesCount = caloriesCount; | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | public long getRecordTime() { | 81 | public long getRecordTime() { |
| 86 | return this.recordTime; | 82 | return this.recordTime; |
| 87 | } | 83 | } |
| @@ -90,6 +86,14 @@ public class UserStepEntity { | @@ -90,6 +86,14 @@ public class UserStepEntity { | ||
| 90 | this.recordTime = recordTime; | 86 | this.recordTime = recordTime; |
| 91 | } | 87 | } |
| 92 | 88 | ||
| 89 | + public double getCaloriesCount() { | ||
| 90 | + return this.caloriesCount; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public void setCaloriesCount(double caloriesCount) { | ||
| 94 | + this.caloriesCount = caloriesCount; | ||
| 95 | + } | ||
| 96 | + | ||
| 93 | public String getServerTraceData() { | 97 | public String getServerTraceData() { |
| 94 | return this.serverTraceData; | 98 | return this.serverTraceData; |
| 95 | } | 99 | } |
| @@ -98,5 +102,61 @@ public class UserStepEntity { | @@ -98,5 +102,61 @@ public class UserStepEntity { | ||
| 98 | this.serverTraceData = serverTraceData; | 102 | this.serverTraceData = serverTraceData; |
| 99 | } | 103 | } |
| 100 | 104 | ||
| 105 | + public String getStartPoint() { | ||
| 106 | + return this.startPoint; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setStartPoint(String startPoint) { | ||
| 110 | + this.startPoint = startPoint; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public String getEndPoint() { | ||
| 114 | + return this.endPoint; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public void setEndPoint(String endPoint) { | ||
| 118 | + this.endPoint = endPoint; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public long getStartTimeStamp() { | ||
| 122 | + return this.startTimeStamp; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public void setStartTimeStamp(long startTimeStamp) { | ||
| 126 | + this.startTimeStamp = startTimeStamp; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + public long getFinishTimeStamp() { | ||
| 130 | + return this.finishTimeStamp; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public void setFinishTimeStamp(long finishTimeStamp) { | ||
| 134 | + this.finishTimeStamp = finishTimeStamp; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public String getStreetId() { | ||
| 138 | + return this.streetId; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public void setStreetId(String streetId) { | ||
| 142 | + this.streetId = streetId; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public int getPauseCount() { | ||
| 146 | + return this.pauseCount; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public void setPauseCount(int pauseCount) { | ||
| 150 | + this.pauseCount = pauseCount; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public long getUserPauseTimeStamp() { | ||
| 154 | + return this.userPauseTimeStamp; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + public void setUserPauseTimeStamp(long userPauseTimeStamp) { | ||
| 158 | + this.userPauseTimeStamp = userPauseTimeStamp; | ||
| 159 | + } | ||
| 160 | + | ||
| 101 | 161 | ||
| 102 | } | 162 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunLineActivity.java
| 1 | package com.cnlive.moudle.pedometer.ui.activity; | 1 | package com.cnlive.moudle.pedometer.ui.activity; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | -import android.content.Context; | ||
| 5 | import android.content.Intent; | 4 | import android.content.Intent; |
| 6 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v7.app.AppCompatActivity; |
| 7 | import android.os.Bundle; | 6 | import android.os.Bundle; |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunMainFragment.java
| @@ -10,6 +10,7 @@ import android.view.View; | @@ -10,6 +10,7 @@ import android.view.View; | ||
| 10 | import com.cnlive.libs.base.ui.QMUIFragment; | 10 | import com.cnlive.libs.base.ui.QMUIFragment; |
| 11 | import com.cnlive.libs.base.util.StatusBarUtil; | 11 | import com.cnlive.libs.base.util.StatusBarUtil; |
| 12 | import com.cnlive.libs.base.util.StatusBarUtil2; | 12 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 13 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 13 | import com.cnlive.moudle.pedometer.frame.presenter.RunMainFragmentPresenter; | 14 | import com.cnlive.moudle.pedometer.frame.presenter.RunMainFragmentPresenter; |
| 14 | import com.cnlive.moudle.pedometer.frame.view.RunMainFragmentView; | 15 | import com.cnlive.moudle.pedometer.frame.view.RunMainFragmentView; |
| 15 | import com.cnlive.moudle.pedometer.model.Constant; | 16 | import com.cnlive.moudle.pedometer.model.Constant; |
| @@ -57,10 +58,11 @@ public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFr | @@ -57,10 +58,11 @@ public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFr | ||
| 57 | @Override | 58 | @Override |
| 58 | public void onPause() { | 59 | public void onPause() { |
| 59 | super.onPause(); | 60 | super.onPause(); |
| 61 | + //todo 第二期在用 | ||
| 60 | //记录当前计时器相关数据 | 62 | //记录当前计时器相关数据 |
| 61 | if (getMvpView() != null) { | 63 | if (getMvpView() != null) { |
| 62 | - if (!TextUtils.isEmpty(userId)) { | ||
| 63 | - getMvpView().setSQLPauseTime(userId); | 64 | + if (!TextUtils.isEmpty(CommonInfo.getUserId(getActivity()))) { |
| 65 | + getMvpView().setFragmentPauseTime(userId); | ||
| 64 | } | 66 | } |
| 65 | } | 67 | } |
| 66 | } | 68 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunRaceDetailFragment.java
| @@ -89,12 +89,14 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | @@ -89,12 +89,14 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | ||
| 89 | super.onResume(); | 89 | super.onResume(); |
| 90 | if (getMvpView() != null) { | 90 | if (getMvpView() != null) { |
| 91 | getMvpView().onResume(); | 91 | getMvpView().onResume(); |
| 92 | + getMvpView().checkStartBtnState(); | ||
| 92 | } | 93 | } |
| 93 | if (getMvpView() != null) { | 94 | if (getMvpView() != null) { |
| 94 | //为系统的方向传感器注册监听器 | 95 | //为系统的方向传感器注册监听器 |
| 95 | mSensorManager.registerListener(getMvpView(), mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), | 96 | mSensorManager.registerListener(getMvpView(), mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), |
| 96 | SensorManager.SENSOR_DELAY_UI); | 97 | SensorManager.SENSOR_DELAY_UI); |
| 97 | } | 98 | } |
| 99 | + | ||
| 98 | } | 100 | } |
| 99 | 101 | ||
| 100 | @Override | 102 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunningMapFragment.java
| @@ -109,7 +109,8 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run | @@ -109,7 +109,8 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run | ||
| 109 | } | 109 | } |
| 110 | //开始进行历史轨迹查询 | 110 | //开始进行历史轨迹查询 |
| 111 | if (getPresenter() != null && !TextUtils.isEmpty(StepService.entityName)) { | 111 | if (getPresenter() != null && !TextUtils.isEmpty(StepService.entityName)) { |
| 112 | - long stepStartTime = CommonInfo.getStepStartTime(getActivity()); | 112 | + long stepStartTime = 0; |
| 113 | +// CommonInfo.getStepStartTime(getActivity()); | ||
| 113 | Log.e(TAG, "onViewCreated: 时间"+stepStartTime ); | 114 | Log.e(TAG, "onViewCreated: 时间"+stepStartTime ); |
| 114 | long startTime = 0; | 115 | long startTime = 0; |
| 115 | if (stepStartTime != 0) { | 116 | if (stepStartTime != 0) { |
| @@ -117,7 +118,7 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run | @@ -117,7 +118,7 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run | ||
| 117 | } else { | 118 | } else { |
| 118 | startTime = (int) (System.currentTimeMillis() / 1000 -12 * 60 * 60); | 119 | startTime = (int) (System.currentTimeMillis() / 1000 -12 * 60 * 60); |
| 119 | } | 120 | } |
| 120 | - long current = TimeUtil.getCurrentTime(); | 121 | + long current = TimeUtil.getNowTimeStamp(); |
| 121 | // long startTime = current - hour * 3600 * 1000 - minute * 60 * 1000 - second * 1000; | 122 | // long startTime = current - hour * 3600 * 1000 - minute * 60 * 1000 - second * 1000; |
| 122 | long endTime = current; | 123 | long endTime = current; |
| 123 | // Log.e(TAG, "onViewCreated: " + "hour:" + hour + ",minute" + minute + ",second:" + second); | 124 | // Log.e(TAG, "onViewCreated: " + "hour:" + hour + ",minute" + minute + ",second:" + second); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/StepUtil.java
| @@ -90,14 +90,11 @@ public class StepUtil { | @@ -90,14 +90,11 @@ public class StepUtil { | ||
| 90 | */ | 90 | */ |
| 91 | public static void clearRunData(Context context, String uid) { | 91 | public static void clearRunData(Context context, String uid) { |
| 92 | DbCore.init(context, dbName); | 92 | DbCore.init(context, dbName); |
| 93 | - String CURRENT_DATE = getTodayDate(); | ||
| 94 | - List<UserStepEntity> list = DbCore.getDaoSession().getUserStepEntityDao().queryBuilder().where(UserStepEntityDao.Properties.UserId.eq(uid), UserStepEntityDao.Properties.Date.eq(CURRENT_DATE)).list(); | 93 | + List<UserStepEntity> list = DbCore.getDaoSession().getUserStepEntityDao().queryBuilder().where(UserStepEntityDao.Properties.UserId.eq(uid)).list(); |
| 95 | if (list != null && list.size() > 0) { | 94 | if (list != null && list.size() > 0) { |
| 96 | Log.e(TAG, "clearRunData: " + list.size()); | 95 | Log.e(TAG, "clearRunData: " + list.size()); |
| 97 | -// for (int i = 0; i < list.size(); i++) { | ||
| 98 | - DbCore.getDaoSession().getUserStepEntityDao().deleteByKey(list.get(0).getUuid()); | 96 | + DbCore.getDaoSession().getUserStepEntityDao().delete(list.get(0)); |
| 99 | DbCore.getDaoSession().getUserStepEntityDao().detachAll(); | 97 | DbCore.getDaoSession().getUserStepEntityDao().detachAll(); |
| 100 | -// } | ||
| 101 | } | 98 | } |
| 102 | } | 99 | } |
| 103 | 100 | ||
| @@ -111,10 +108,7 @@ public class StepUtil { | @@ -111,10 +108,7 @@ public class StepUtil { | ||
| 111 | public static UserStepEntity getUserStepData(Context context, String uid) { | 108 | public static UserStepEntity getUserStepData(Context context, String uid) { |
| 112 | if (!TextUtils.isEmpty(uid)) { | 109 | if (!TextUtils.isEmpty(uid)) { |
| 113 | DbCore.init(context, dbName); | 110 | DbCore.init(context, dbName); |
| 114 | - DbCore.getDaoSession().getUserStepEntityDao().detachAll(); | ||
| 115 | - DbCore.getDaoSession().clear(); | ||
| 116 | - String CURRENT_DATE = getTodayDate(); | ||
| 117 | - List<UserStepEntity> list = DbCore.getDaoSession().getUserStepEntityDao().queryBuilder().where(UserStepEntityDao.Properties.UserId.eq(uid), UserStepEntityDao.Properties.Date.eq(CURRENT_DATE)).list(); | 111 | + List<UserStepEntity> list = DbCore.getDaoSession().getUserStepEntityDao().queryBuilder().where(UserStepEntityDao.Properties.UserId.eq(uid)).list(); |
| 118 | if (list != null && list.size() > 0) { | 112 | if (list != null && list.size() > 0) { |
| 119 | return list.get(0); | 113 | return list.get(0); |
| 120 | } else { | 114 | } else { |
| @@ -126,18 +120,70 @@ public class StepUtil { | @@ -126,18 +120,70 @@ public class StepUtil { | ||
| 126 | } | 120 | } |
| 127 | 121 | ||
| 128 | /** | 122 | /** |
| 129 | - * 获取用户数据 | 123 | + * 设置用户数据 |
| 130 | * | 124 | * |
| 131 | * @param context | 125 | * @param context |
| 132 | * @param uid | 126 | * @param uid |
| 133 | * @return | 127 | * @return |
| 134 | */ | 128 | */ |
| 135 | - public static void setServerTraceData(Context context, String uid, UserStepEntity userStepEntity) { | 129 | + public static void setUserStepData(Context context, String uid, UserStepEntity userStepEntity) { |
| 130 | + if (getUserStepData(context, uid) != null) { | ||
| 131 | + UserStepEntity entity = getUserStepData(context, uid); | ||
| 132 | + } else { | ||
| 133 | + | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public static void setStepStartData(Context context, String uid, long startStamp, String streetId) { | ||
| 136 | if (getUserStepData(context, uid) != null) { | 138 | if (getUserStepData(context, uid) != null) { |
| 137 | UserStepEntity entity = getUserStepData(context, uid); | 139 | UserStepEntity entity = getUserStepData(context, uid); |
| 138 | -// entity.setServerTraceData(); | 140 | + entity.setStartTimeStamp(startStamp); |
| 141 | + entity.setStreetId(streetId); | ||
| 142 | + //更新数据 | ||
| 143 | + updateStepData(context, entity); | ||
| 139 | } else { | 144 | } else { |
| 145 | + //创建数据 | ||
| 146 | + UserStepEntity userStepEntity = new UserStepEntity(); | ||
| 147 | + userStepEntity.setUserId(uid); | ||
| 148 | + userStepEntity.setStartTimeStamp(startStamp); | ||
| 149 | + userStepEntity.setStreetId(streetId); | ||
| 150 | + insertStepData(context, userStepEntity); | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + public static void insertStepData(Context context, UserStepEntity userStepEntity) { | ||
| 155 | + DbCore.init(context, dbName); | ||
| 156 | + DbCore.getDaoSession().getUserStepEntityDao().insert(userStepEntity); | ||
| 157 | + } | ||
| 140 | 158 | ||
| 159 | + | ||
| 160 | + /** | ||
| 161 | + * 获取用户暂停次数 | ||
| 162 | + * | ||
| 163 | + * @param context | ||
| 164 | + * @param uid | ||
| 165 | + * @return | ||
| 166 | + */ | ||
| 167 | + public static int getUserPauseCount(Context context, String uid) { | ||
| 168 | + UserStepEntity userStepEntity = getUserStepData(context, uid); | ||
| 169 | + if (userStepEntity != null) { | ||
| 170 | + return userStepEntity.getPauseCount(); | ||
| 171 | + } else { | ||
| 172 | + return -1; | ||
| 173 | + } | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + /** | ||
| 177 | + * 设置用户完成时间戳 | ||
| 178 | + * | ||
| 179 | + * @param context | ||
| 180 | + */ | ||
| 181 | + public static void setUserFinishTimeStamp(Context context, String uid) { | ||
| 182 | + UserStepEntity userStepEntity = getUserStepData(context, uid); | ||
| 183 | + if (userStepEntity != null) { | ||
| 184 | + userStepEntity.setFinishTimeStamp(TimeUtil.getNowTimeStamp()); | ||
| 185 | + //更新 | ||
| 186 | + updateStepData(context, userStepEntity); | ||
| 141 | } | 187 | } |
| 142 | } | 188 | } |
| 143 | 189 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/TimeUtil.java
| @@ -10,14 +10,6 @@ import java.util.Date; | @@ -10,14 +10,6 @@ import java.util.Date; | ||
| 10 | * @author ShinnyYang | 10 | * @author ShinnyYang |
| 11 | */ | 11 | */ |
| 12 | public class TimeUtil { | 12 | public class TimeUtil { |
| 13 | - /** | ||
| 14 | - * 获取当前时间戳(单位:秒) | ||
| 15 | - * | ||
| 16 | - * @return | ||
| 17 | - */ | ||
| 18 | - public static long getCurrentTime() { | ||
| 19 | - return System.currentTimeMillis(); | ||
| 20 | - } | ||
| 21 | 13 | ||
| 22 | /** | 14 | /** |
| 23 | * 日期格式字符串转换成时间戳 | 15 | * 日期格式字符串转换成时间戳 |
moudle_pedometer/src/main/res/layout/dialog_tip.xml
| @@ -11,16 +11,17 @@ | @@ -11,16 +11,17 @@ | ||
| 11 | android:layout_height="wrap_content" | 11 | android:layout_height="wrap_content" |
| 12 | android:background="@drawable/free_dialog_bg" | 12 | android:background="@drawable/free_dialog_bg" |
| 13 | android:orientation="vertical" | 13 | android:orientation="vertical" |
| 14 | - android:paddingTop="10dp" | ||
| 15 | - > | 14 | + android:paddingTop="10dp"> |
| 16 | 15 | ||
| 17 | <TextView | 16 | <TextView |
| 18 | android:id="@+id/tv_dialog_tip" | 17 | android:id="@+id/tv_dialog_tip" |
| 19 | android:layout_width="wrap_content" | 18 | android:layout_width="wrap_content" |
| 20 | android:layout_height="wrap_content" | 19 | android:layout_height="wrap_content" |
| 21 | - android:minHeight="75dp" | ||
| 22 | - android:gravity="center" | ||
| 23 | android:layout_gravity="center" | 20 | android:layout_gravity="center" |
| 21 | + android:layout_marginLeft="10dp" | ||
| 22 | + android:layout_marginRight="10dp" | ||
| 23 | + android:gravity="center" | ||
| 24 | + android:minHeight="75dp" | ||
| 24 | android:text="标题" | 25 | android:text="标题" |
| 25 | android:textColor="@color/black" | 26 | android:textColor="@color/black" |
| 26 | android:textSize="17sp" | 27 | android:textSize="17sp" |
| @@ -59,7 +60,6 @@ | @@ -59,7 +60,6 @@ | ||
| 59 | </LinearLayout> | 60 | </LinearLayout> |
| 60 | 61 | ||
| 61 | 62 | ||
| 62 | - | ||
| 63 | </LinearLayout> | 63 | </LinearLayout> |
| 64 | </LinearLayout> | 64 | </LinearLayout> |
| 65 | </LinearLayout> | 65 | </LinearLayout> |
moudle_pedometer/src/main/res/layout/fragment_finish_run_map.xml
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | sothree:umanoFadeColor="@color/black_20" | 15 | sothree:umanoFadeColor="@color/black_20" |
| 16 | sothree:umanoOverlay="true" | 16 | sothree:umanoOverlay="true" |
| 17 | sothree:umanoPanelHeight="310dp" | 17 | sothree:umanoPanelHeight="310dp" |
| 18 | - sothree:umanoParallaxOffset="100dp" | 18 | + sothree:umanoParallaxOffset="0dp" |
| 19 | sothree:umanoScrollableView="@+id/scrollView" | 19 | sothree:umanoScrollableView="@+id/scrollView" |
| 20 | sothree:umanoShadowHeight="0dp"> | 20 | sothree:umanoShadowHeight="0dp"> |
| 21 | 21 |
moudle_pedometer/src/main/res/layout/fragment_run_main.xml
| @@ -31,32 +31,42 @@ | @@ -31,32 +31,42 @@ | ||
| 31 | android:src="@drawable/icon_right_close" /> | 31 | android:src="@drawable/icon_right_close" /> |
| 32 | </RelativeLayout> | 32 | </RelativeLayout> |
| 33 | <!--公里数显示--> | 33 | <!--公里数显示--> |
| 34 | - <LinearLayout | 34 | + <FrameLayout |
| 35 | android:layout_width="match_parent" | 35 | android:layout_width="match_parent" |
| 36 | android:layout_height="0dp" | 36 | android:layout_height="0dp" |
| 37 | - android:layout_weight="1.2" | ||
| 38 | - android:gravity="center" | ||
| 39 | - android:paddingLeft="50dp"> | 37 | + android:layout_weight="1.2"> |
| 40 | 38 | ||
| 39 | + <LinearLayout | ||
| 40 | + android:layout_width="match_parent" | ||
| 41 | + android:layout_height="match_parent" | ||
| 42 | + android:gravity="center" | ||
| 43 | + android:paddingLeft="50dp"> | ||
| 41 | 44 | ||
| 42 | - <TextView | ||
| 43 | - android:id="@+id/tv_run_distance" | ||
| 44 | - android:layout_width="wrap_content" | ||
| 45 | - android:layout_height="wrap_content" | ||
| 46 | - android:text="0.00" | ||
| 47 | - android:textColor="@color/white" | ||
| 48 | - android:textSize="70sp" | ||
| 49 | - android:textStyle="bold" /> | 45 | + <TextView |
| 46 | + android:id="@+id/tv_run_distance" | ||
| 47 | + android:layout_width="wrap_content" | ||
| 48 | + android:layout_height="wrap_content" | ||
| 49 | + android:text="0.00" | ||
| 50 | + android:textColor="@color/white" | ||
| 51 | + android:textSize="70sp" | ||
| 52 | + android:textStyle="bold" /> | ||
| 50 | 53 | ||
| 51 | - <TextView | ||
| 52 | - android:layout_width="wrap_content" | ||
| 53 | - android:layout_height="wrap_content" | ||
| 54 | - android:layout_marginLeft="10dp" | ||
| 55 | - android:layout_marginTop="20dp" | ||
| 56 | - android:text="公里" | ||
| 57 | - android:textColor="@color/white" | ||
| 58 | - android:textSize="15sp" /> | ||
| 59 | - </LinearLayout> | 54 | + <TextView |
| 55 | + android:layout_width="wrap_content" | ||
| 56 | + android:layout_height="wrap_content" | ||
| 57 | + android:layout_marginLeft="10dp" | ||
| 58 | + android:layout_marginTop="20dp" | ||
| 59 | + android:text="公里" | ||
| 60 | + android:textColor="@color/white" | ||
| 61 | + android:textSize="15sp" /> | ||
| 62 | + </LinearLayout> | ||
| 63 | + | ||
| 64 | + <ImageView | ||
| 65 | + android:id="@+id/iv_back" | ||
| 66 | + android:layout_width="20dp" | ||
| 67 | + android:layout_height="40dp" | ||
| 68 | + android:background="@drawable/back" /> | ||
| 69 | + </FrameLayout> | ||
| 60 | <!--GPS信息--> | 70 | <!--GPS信息--> |
| 61 | <LinearLayout | 71 | <LinearLayout |
| 62 | android:layout_width="match_parent" | 72 | android:layout_width="match_parent" |
moudle_pedometer/src/main/res/values/strings.xml
| @@ -83,6 +83,7 @@ | @@ -83,6 +83,7 @@ | ||
| 83 | <string name="up_fail">上传失败</string> | 83 | <string name="up_fail">上传失败</string> |
| 84 | <string name="enter_range_tip">您已回归轨迹 继续参与运动吧</string> | 84 | <string name="enter_range_tip">您已回归轨迹 继续参与运动吧</string> |
| 85 | <string name="exit_range_tip">您已偏离路径轨迹 请您计时回归路径!</string> | 85 | <string name="exit_range_tip">您已偏离路径轨迹 请您计时回归路径!</string> |
| 86 | + <string name="more_than_pause_count_tip">您已超过最大暂停次数,无法继续比赛!</string> | ||
| 86 | 87 | ||
| 87 | 88 | ||
| 88 | </resources> | 89 | </resources> |