Commit cde055503e47a996ddba1f6fd8b034607e612c13
1 parent
c754427c
1.修复倒计时显示异常
Showing
7 changed files
with
45 additions
and
34 deletions
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/commonInfo/CommonInfo.java
| @@ -232,29 +232,26 @@ public class CommonInfo { | @@ -232,29 +232,26 @@ 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 | - public static String getUserNickName(Context context) { | ||
| 236 | - return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getString("RunUserNickName", ""); | ||
| 237 | 235 | ||
| 238 | } | 236 | } |
| 239 | 237 | ||
| 240 | /** | 238 | /** |
| 241 | - * 设置用户头像 | 239 | + * 是否第一次显示倒计时动画 |
| 242 | * | 240 | * |
| 243 | * @param context | 241 | * @param context |
| 242 | + * @param isAllow | ||
| 244 | */ | 243 | */ |
| 245 | - public static void setUserFaceUrl(Context context, String faceUrl) { | ||
| 246 | - MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putString("RunUserFaceUrl", faceUrl); | ||
| 247 | - | 244 | + public static void setIsFirstShowTimeTip(Context context, boolean isAllow) { |
| 245 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putBoolean("IsFirstShowTimeTip", isAllow); | ||
| 248 | } | 246 | } |
| 249 | 247 | ||
| 250 | /** | 248 | /** |
| 251 | - * 获取用户头像 | 249 | + * 是否第一次显示倒计时动画 |
| 252 | * | 250 | * |
| 253 | * @param context | 251 | * @param context |
| 254 | */ | 252 | */ |
| 255 | - public static String getUserFaceUrl(Context context) { | ||
| 256 | - return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getString("RunUserFaceUrl", ""); | ||
| 257 | - | 253 | + public static boolean getIsFirstShowTimeTip(Context context) { |
| 254 | + return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("IsFirstShowTimeTip", true); | ||
| 258 | } | 255 | } |
| 259 | 256 | ||
| 260 | 257 | ||
| @@ -269,9 +266,18 @@ public class CommonInfo { | @@ -269,9 +266,18 @@ public class CommonInfo { | ||
| 269 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("streetId"); | 266 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("streetId"); |
| 270 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FirstStepSendTraceTip"); | 267 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FirstStepSendTraceTip"); |
| 271 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FenceId"); | 268 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FenceId"); |
| 272 | - | ||
| 273 | - | 269 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("IsFirstShowTimeTip"); |
| 274 | } | 270 | } |
| 275 | 271 | ||
| 276 | - | 272 | + /*重置赛事 |
| 273 | + * @param context | ||
| 274 | + */ | ||
| 275 | + public static void resetRace(Context context) { | ||
| 276 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("writeUserStep"); | ||
| 277 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("runStepService"); | ||
| 278 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("KeepAliveService"); | ||
| 279 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("RunBaiduTraceService"); | ||
| 280 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FirstStepSendTraceTip"); | ||
| 281 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("IsFirstShowTimeTip"); | ||
| 282 | + } | ||
| 277 | } | 283 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunMainFragmentView.java
| @@ -117,7 +117,6 @@ public class RunMainFragmentView implements MvpView { | @@ -117,7 +117,6 @@ public class RunMainFragmentView implements MvpView { | ||
| 117 | */ | 117 | */ |
| 118 | public void initView() { | 118 | public void initView() { |
| 119 | uid = CommonInfo.getUserId(getContext()); | 119 | uid = CommonInfo.getUserId(getContext()); |
| 120 | - UserStepEntity userStepEntity = StepUtil.getUserStepData(getContext(), uid); | ||
| 121 | initLocationClient(); | 120 | initLocationClient(); |
| 122 | fragment.binding.llRunMainRoot.setVisibility(View.GONE); | 121 | fragment.binding.llRunMainRoot.setVisibility(View.GONE); |
| 123 | ButtonAnimUtil.startAnimation(fragment.binding.llStartTimeTip, false); | 122 | ButtonAnimUtil.startAnimation(fragment.binding.llStartTimeTip, false); |
| @@ -177,12 +176,14 @@ public class RunMainFragmentView implements MvpView { | @@ -177,12 +176,14 @@ public class RunMainFragmentView implements MvpView { | ||
| 177 | 176 | ||
| 178 | } | 177 | } |
| 179 | }); | 178 | }); |
| 180 | - | 179 | + boolean isFirstShowTime = CommonInfo.getIsFirstShowTimeTip(getContext()); |
| 181 | //当前用户已经在运动 | 180 | //当前用户已经在运动 |
| 182 | - if (userStepEntity == null) { | 181 | + if (isFirstShowTime) { |
| 183 | //依次倒计时 | 182 | //依次倒计时 |
| 184 | handler.postDelayed(runnable, 1000); | 183 | handler.postDelayed(runnable, 1000); |
| 184 | + CommonInfo.setIsFirstShowTimeTip(getContext(), false); | ||
| 185 | } else { | 185 | } else { |
| 186 | + UserStepEntity userStepEntity = StepUtil.getUserStepData(getContext(), uid); | ||
| 186 | //隐藏计时界面 | 187 | //隐藏计时界面 |
| 187 | fragment.binding.llStartTimeTip.setVisibility(View.GONE); | 188 | fragment.binding.llStartTimeTip.setVisibility(View.GONE); |
| 188 | fragment.binding.llRunMainRoot.setVisibility(View.VISIBLE); | 189 | fragment.binding.llRunMainRoot.setVisibility(View.VISIBLE); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| @@ -403,6 +403,8 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -403,6 +403,8 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 403 | StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); | 403 | StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); |
| 404 | //停止服务 | 404 | //停止服务 |
| 405 | stopStepService(); | 405 | stopStepService(); |
| 406 | + //清除数据 | ||
| 407 | + CommonInfo.resetRace(getContext()); | ||
| 406 | //更改当前按钮 | 408 | //更改当前按钮 |
| 407 | fragment.binding.tvRunNow.setText("立即开始"); | 409 | fragment.binding.tvRunNow.setText("立即开始"); |
| 408 | fragment.binding.rlScrollViewStartBtn.setTag("1"); | 410 | fragment.binding.rlScrollViewStartBtn.setTag("1"); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunningFinishFragmentView.java
| @@ -27,7 +27,7 @@ public class RunningFinishFragmentView implements MvpView { | @@ -27,7 +27,7 @@ public class RunningFinishFragmentView implements MvpView { | ||
| 27 | 27 | ||
| 28 | public void initView(RunningFinishBean runningFinishBean) { | 28 | public void initView(RunningFinishBean runningFinishBean) { |
| 29 | //设置用户头像 | 29 | //设置用户头像 |
| 30 | - String faceUrl = CommonInfo.getUserFaceUrl(getContext()); | 30 | + String faceUrl = CommonInfo.getUserIcon(getContext()); |
| 31 | if (!TextUtils.isEmpty(faceUrl)) { | 31 | if (!TextUtils.isEmpty(faceUrl)) { |
| 32 | Glide.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | 32 | Glide.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); |
| 33 | } | 33 | } |
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/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; | ||
| 4 | +import android.content.Intent; | ||
| 3 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v7.app.AppCompatActivity; |
| 4 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 5 | 7 |