Commit f0c79d5e641f2474082e2b3cbb4513c7f06c566d
1 parent
82bc1071
我的记录页面逻辑修改
Showing
4 changed files
with
83 additions
and
84 deletions
config.gradle
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/SelfRecordView.java
| ... | ... | @@ -51,57 +51,27 @@ public class SelfRecordView implements MvpView { |
| 51 | 51 | return; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | + SelfRecordInfo.RecordSumBean recordSumBean = selfRecordInfoBaseInfo.getData().getRecordSum(); | |
| 55 | + if (!TextUtils.isEmpty(recordSumBean.getCountMileage() + "")) | |
| 56 | + fragment.binding.kilometerNum.setText(recordSumBean.getCountMileage() + ""); | |
| 57 | + if (!TextUtils.isEmpty(recordSumBean.getYetStep())) | |
| 58 | + fragment.binding.stepNum.setText(recordSumBean.getYetStep()); | |
| 59 | + if (!TextUtils.isEmpty(recordSumBean.getYetEmployTime())) | |
| 60 | + fragment.binding.allTime.setText(TimeUtil.stampToChronometers(Double.parseDouble(recordSumBean.getYetEmployTime()))); | |
| 61 | + if (!TextUtils.isEmpty(recordSumBean.getYetNumber())) | |
| 62 | + fragment.binding.finishNum.setText(recordSumBean.getYetNumber()); | |
| 63 | + if (!TextUtils.isEmpty(recordSumBean.getNotStep())) | |
| 64 | + fragment.binding.stepNumNo.setText(recordSumBean.getNotStep()); | |
| 65 | + if (!TextUtils.isEmpty(recordSumBean.getNotEmployTime())) | |
| 66 | + fragment.binding.allTimeNo.setText(TimeUtil.stampToChronometers(Double.parseDouble(recordSumBean.getNotEmployTime()))); | |
| 67 | + if (!TextUtils.isEmpty(recordSumBean.getNotNumber())) | |
| 68 | + fragment.binding.finishNumNo.setText(recordSumBean.getNotNumber()); | |
| 69 | + | |
| 54 | 70 | if (fragment.currentPage == 1) { |
| 55 | 71 | list.clear(); |
| 56 | 72 | list.addAll(selfRecordInfoBaseInfo.getData().getEventRouteRecordBeanVoList()); |
| 57 | - if (adapter == null) { | |
| 58 | - | |
| 59 | - fragment.binding.recordRecy.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); | |
| 60 | - adapter = new RaceRecordAdapter(list, fragment.getActivity(),false); | |
| 61 | - fragment.binding.recordRecy.setAdapter(adapter); | |
| 62 | - adapter.setOnClickListener(new RaceRecordAdapter.OnClickListener() { | |
| 63 | - @Override | |
| 64 | - public void onClickListener(EventRouteRecordBeanVoListBean bean, int position) { | |
| 65 | - if (null != bean) { | |
| 66 | - //设置数据 | |
| 67 | - RunningFinishBean runningFinishBean = new RunningFinishBean(); | |
| 68 | - //设置赛事标题 | |
| 69 | - runningFinishBean.setStreetTitle(bean.getEventTitle()); | |
| 70 | - //设置步数 | |
| 71 | - runningFinishBean.setStep(bean.getStep()); | |
| 72 | - //设置距离 | |
| 73 | - runningFinishBean.setRunDistance(bean.getMileage()); | |
| 74 | - //设置配速 | |
| 75 | - runningFinishBean.setSpeed(bean.getPace()); | |
| 76 | - //设置用时 | |
| 77 | - runningFinishBean.setEmployTime(bean.getEmployTime()); | |
| 78 | - //设置开始位置 | |
| 79 | - runningFinishBean.setStartPoint(bean.getStartLocation()); | |
| 80 | - //设置结束位置 | |
| 81 | - runningFinishBean.setEndPoint(bean.getEndLocation()); | |
| 82 | - //设置用户轨迹开始时间 | |
| 83 | - runningFinishBean.setUserStartTime(bean.getStartTime()); | |
| 84 | - //设置用户轨迹结束时间 | |
| 85 | - runningFinishBean.setUserFinishTime(bean.getEndTime()); | |
| 86 | - //设置用户是否完成 | |
| 87 | - runningFinishBean.setIsFinish(bean.getCompleteStatus() + ""); | |
| 88 | - //设置是否暂停 | |
| 89 | - if (!TextUtils.isEmpty(bean.getPauseTime())) { | |
| 90 | - runningFinishBean.setPause(true); | |
| 91 | - //设置暂停时间 | |
| 92 | - runningFinishBean.setUserPauseTime(bean.getPauseTime()); | |
| 93 | - //设置用户继续时间 | |
| 94 | - runningFinishBean.setUserContinueTime(bean.getContinueTime()); | |
| 95 | - } | |
| 96 | - //设置起点 | |
| 97 | - ALLScoreDetailActivity.startActivity(fragment.getActivity(), runningFinishBean); | |
| 98 | - | |
| 99 | - } | |
| 100 | - } | |
| 101 | - }); | |
| 102 | - } else { | |
| 103 | - adapter.notifyDataSetChanged(); | |
| 104 | - } | |
| 73 | + } else { | |
| 74 | + list.addAll(selfRecordInfoBaseInfo.getData().getEventRouteRecordBeanVoList()); | |
| 105 | 75 | } |
| 106 | 76 | |
| 107 | 77 | if (list.size() != 0) { |
| ... | ... | @@ -110,33 +80,62 @@ public class SelfRecordView implements MvpView { |
| 110 | 80 | fragment.binding.refreshLayout.setVisibility(View.VISIBLE); |
| 111 | 81 | } else { |
| 112 | 82 | showEmpty(); |
| 83 | + return; | |
| 113 | 84 | } |
| 114 | 85 | |
| 115 | - SelfRecordInfo.RecordSumBean recordSumBean = selfRecordInfoBaseInfo.getData().getRecordSum(); | |
| 116 | - fragment.binding.kilometerNum.setText(recordSumBean.getCountMileage() + ""); | |
| 117 | - if (recordSumBean.getYetStep() != null) | |
| 118 | - fragment.binding.stepNum.setText(recordSumBean.getYetStep()); | |
| 119 | - if (recordSumBean.getYetEmployTime() != null) | |
| 120 | - fragment.binding.allTime.setText(TimeUtil.stampToChronometers(Double.parseDouble(recordSumBean.getYetEmployTime()))); | |
| 121 | - if (recordSumBean.getYetNumber() != null) | |
| 122 | - fragment.binding.finishNum.setText(recordSumBean.getYetNumber()); | |
| 86 | + if (adapter == null) { | |
| 87 | + fragment.binding.recordRecy.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); | |
| 88 | + adapter = new RaceRecordAdapter(list, fragment.getActivity(), false); | |
| 89 | + fragment.binding.recordRecy.setAdapter(adapter); | |
| 90 | + adapter.setOnClickListener(new RaceRecordAdapter.OnClickListener() { | |
| 91 | + @Override | |
| 92 | + public void onClickListener(EventRouteRecordBeanVoListBean bean, int position) { | |
| 93 | + if (null != bean) { | |
| 94 | + //设置数据 | |
| 95 | + RunningFinishBean runningFinishBean = new RunningFinishBean(); | |
| 96 | + //设置赛事标题 | |
| 97 | + runningFinishBean.setStreetTitle(bean.getEventTitle()); | |
| 98 | + //设置步数 | |
| 99 | + runningFinishBean.setStep(bean.getStep()); | |
| 100 | + //设置距离 | |
| 101 | + runningFinishBean.setRunDistance(bean.getMileage()); | |
| 102 | + //设置配速 | |
| 103 | + runningFinishBean.setSpeed(bean.getPace()); | |
| 104 | + //设置用时 | |
| 105 | + runningFinishBean.setEmployTime(bean.getEmployTime()); | |
| 106 | + //设置开始位置 | |
| 107 | + runningFinishBean.setStartPoint(bean.getStartLocation()); | |
| 108 | + //设置结束位置 | |
| 109 | + runningFinishBean.setEndPoint(bean.getEndLocation()); | |
| 110 | + //设置用户轨迹开始时间 | |
| 111 | + runningFinishBean.setUserStartTime(bean.getStartTime()); | |
| 112 | + //设置用户轨迹结束时间 | |
| 113 | + runningFinishBean.setUserFinishTime(bean.getEndTime()); | |
| 114 | + //设置用户是否完成 | |
| 115 | + runningFinishBean.setIsFinish(bean.getCompleteStatus() + ""); | |
| 116 | + //设置是否暂停 | |
| 117 | + if (!TextUtils.isEmpty(bean.getPauseTime())) { | |
| 118 | + runningFinishBean.setPause(true); | |
| 119 | + //设置暂停时间 | |
| 120 | + runningFinishBean.setUserPauseTime(bean.getPauseTime()); | |
| 121 | + //设置用户继续时间 | |
| 122 | + runningFinishBean.setUserContinueTime(bean.getContinueTime()); | |
| 123 | + } | |
| 124 | + //设置起点 | |
| 125 | + ALLScoreDetailActivity.startActivity(fragment.getActivity(), runningFinishBean); | |
| 123 | 126 | |
| 124 | - if (recordSumBean.getNotStep() != null) | |
| 125 | - fragment.binding.stepNumNo.setText(recordSumBean.getNotStep()); | |
| 126 | - if (recordSumBean.getNotEmployTime() != null) | |
| 127 | - fragment.binding.allTimeNo.setText(TimeUtil.stampToChronometers(Double.parseDouble(recordSumBean.getNotEmployTime()))); | |
| 128 | - if (recordSumBean.getNotNumber() != null) | |
| 129 | - fragment.binding.finishNumNo.setText(recordSumBean.getNotNumber()); | |
| 127 | + } | |
| 128 | + } | |
| 129 | + }); | |
| 130 | + } else { | |
| 131 | + adapter.notifyDataSetChanged(); | |
| 132 | + } | |
| 130 | 133 | |
| 131 | 134 | if (selfRecordInfoBaseInfo.getData().getEventRouteRecordBeanVoList().size() < fragment.pageSize) { |
| 132 | 135 | fragment.binding.refreshLayout.setEnableLoadMore(false); |
| 133 | 136 | } else { |
| 134 | 137 | fragment.binding.refreshLayout.setEnableLoadMore(true); |
| 135 | 138 | } |
| 136 | - if (fragment.currentPage > 1) { | |
| 137 | - list.addAll(selfRecordInfoBaseInfo.getData().getEventRouteRecordBeanVoList()); | |
| 138 | - adapter.notifyDataSetChanged(); | |
| 139 | - } | |
| 140 | 139 | fragment.binding.refreshLayout.finishRefresh(); |
| 141 | 140 | fragment.binding.refreshLayout.finishLoadMore(); |
| 142 | 141 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoMaster.java
| ... | ... | @@ -21,20 +21,20 @@ public class DaoMaster extends AbstractDaoMaster { |
| 21 | 21 | |
| 22 | 22 | /** Creates underlying database table using DAOs. */ |
| 23 | 23 | public static void createAllTables(Database db, boolean ifNotExists) { |
| 24 | + CalorieEntityDao.createTable(db, ifNotExists); | |
| 24 | 25 | CollFailedEntityDao.createTable(db, ifNotExists); |
| 25 | 26 | CollUserStepEntityDao.createTable(db, ifNotExists); |
| 26 | 27 | FailedEntityDao.createTable(db, ifNotExists); |
| 27 | 28 | UserStepEntityDao.createTable(db, ifNotExists); |
| 28 | - CalorieEntityDao.createTable(db, ifNotExists); | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** Drops underlying database table using DAOs. */ |
| 32 | 32 | public static void dropAllTables(Database db, boolean ifExists) { |
| 33 | + CalorieEntityDao.dropTable(db, ifExists); | |
| 33 | 34 | CollFailedEntityDao.dropTable(db, ifExists); |
| 34 | 35 | CollUserStepEntityDao.dropTable(db, ifExists); |
| 35 | 36 | FailedEntityDao.dropTable(db, ifExists); |
| 36 | 37 | UserStepEntityDao.dropTable(db, ifExists); |
| 37 | - CalorieEntityDao.dropTable(db, ifExists); | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| ... | ... | @@ -53,11 +53,11 @@ public class DaoMaster extends AbstractDaoMaster { |
| 53 | 53 | |
| 54 | 54 | public DaoMaster(Database db) { |
| 55 | 55 | super(db, SCHEMA_VERSION); |
| 56 | + registerDaoClass(CalorieEntityDao.class); | |
| 56 | 57 | registerDaoClass(CollFailedEntityDao.class); |
| 57 | 58 | registerDaoClass(CollUserStepEntityDao.class); |
| 58 | 59 | registerDaoClass(FailedEntityDao.class); |
| 59 | 60 | registerDaoClass(UserStepEntityDao.class); |
| 60 | - registerDaoClass(CalorieEntityDao.class); | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public DaoSession newSession() { | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoSession.java
| ... | ... | @@ -8,17 +8,17 @@ import org.greenrobot.greendao.database.Database; |
| 8 | 8 | import org.greenrobot.greendao.identityscope.IdentityScopeType; |
| 9 | 9 | import org.greenrobot.greendao.internal.DaoConfig; |
| 10 | 10 | |
| 11 | +import com.cnlive.moudle.pedometer.sql.entity.CalorieEntity; | |
| 11 | 12 | import com.cnlive.moudle.pedometer.sql.entity.CollFailedEntity; |
| 12 | 13 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; |
| 13 | 14 | import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; |
| 14 | 15 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; |
| 15 | -import com.cnlive.moudle.pedometer.sql.entity.CalorieEntity; | |
| 16 | 16 | |
| 17 | +import com.cnlive.moudle.pedometer.sql.dao.CalorieEntityDao; | |
| 17 | 18 | import com.cnlive.moudle.pedometer.sql.dao.CollFailedEntityDao; |
| 18 | 19 | import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; |
| 19 | 20 | import com.cnlive.moudle.pedometer.sql.dao.FailedEntityDao; |
| 20 | 21 | import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; |
| 21 | -import com.cnlive.moudle.pedometer.sql.dao.CalorieEntityDao; | |
| 22 | 22 | |
| 23 | 23 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. |
| 24 | 24 | |
| ... | ... | @@ -29,22 +29,25 @@ import com.cnlive.moudle.pedometer.sql.dao.CalorieEntityDao; |
| 29 | 29 | */ |
| 30 | 30 | public class DaoSession extends AbstractDaoSession { |
| 31 | 31 | |
| 32 | + private final DaoConfig calorieEntityDaoConfig; | |
| 32 | 33 | private final DaoConfig collFailedEntityDaoConfig; |
| 33 | 34 | private final DaoConfig collUserStepEntityDaoConfig; |
| 34 | 35 | private final DaoConfig failedEntityDaoConfig; |
| 35 | 36 | private final DaoConfig userStepEntityDaoConfig; |
| 36 | - private final DaoConfig calorieEntityDaoConfig; | |
| 37 | 37 | |
| 38 | + private final CalorieEntityDao calorieEntityDao; | |
| 38 | 39 | private final CollFailedEntityDao collFailedEntityDao; |
| 39 | 40 | private final CollUserStepEntityDao collUserStepEntityDao; |
| 40 | 41 | private final FailedEntityDao failedEntityDao; |
| 41 | 42 | private final UserStepEntityDao userStepEntityDao; |
| 42 | - private final CalorieEntityDao calorieEntityDao; | |
| 43 | 43 | |
| 44 | 44 | public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> |
| 45 | 45 | daoConfigMap) { |
| 46 | 46 | super(db); |
| 47 | 47 | |
| 48 | + calorieEntityDaoConfig = daoConfigMap.get(CalorieEntityDao.class).clone(); | |
| 49 | + calorieEntityDaoConfig.initIdentityScope(type); | |
| 50 | + | |
| 48 | 51 | collFailedEntityDaoConfig = daoConfigMap.get(CollFailedEntityDao.class).clone(); |
| 49 | 52 | collFailedEntityDaoConfig.initIdentityScope(type); |
| 50 | 53 | |
| ... | ... | @@ -57,28 +60,29 @@ public class DaoSession extends AbstractDaoSession { |
| 57 | 60 | userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone(); |
| 58 | 61 | userStepEntityDaoConfig.initIdentityScope(type); |
| 59 | 62 | |
| 60 | - calorieEntityDaoConfig = daoConfigMap.get(CalorieEntityDao.class).clone(); | |
| 61 | - calorieEntityDaoConfig.initIdentityScope(type); | |
| 62 | - | |
| 63 | + calorieEntityDao = new CalorieEntityDao(calorieEntityDaoConfig, this); | |
| 63 | 64 | collFailedEntityDao = new CollFailedEntityDao(collFailedEntityDaoConfig, this); |
| 64 | 65 | collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this); |
| 65 | 66 | failedEntityDao = new FailedEntityDao(failedEntityDaoConfig, this); |
| 66 | 67 | userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this); |
| 67 | - calorieEntityDao = new CalorieEntityDao(calorieEntityDaoConfig, this); | |
| 68 | 68 | |
| 69 | + registerDao(CalorieEntity.class, calorieEntityDao); | |
| 69 | 70 | registerDao(CollFailedEntity.class, collFailedEntityDao); |
| 70 | 71 | registerDao(CollUserStepEntity.class, collUserStepEntityDao); |
| 71 | 72 | registerDao(FailedEntity.class, failedEntityDao); |
| 72 | 73 | registerDao(UserStepEntity.class, userStepEntityDao); |
| 73 | - registerDao(CalorieEntity.class, calorieEntityDao); | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | public void clear() { |
| 77 | + calorieEntityDaoConfig.clearIdentityScope(); | |
| 77 | 78 | collFailedEntityDaoConfig.clearIdentityScope(); |
| 78 | 79 | collUserStepEntityDaoConfig.clearIdentityScope(); |
| 79 | 80 | failedEntityDaoConfig.clearIdentityScope(); |
| 80 | 81 | userStepEntityDaoConfig.clearIdentityScope(); |
| 81 | - calorieEntityDaoConfig.clearIdentityScope(); | |
| 82 | + } | |
| 83 | + | |
| 84 | + public CalorieEntityDao getCalorieEntityDao() { | |
| 85 | + return calorieEntityDao; | |
| 82 | 86 | } |
| 83 | 87 | |
| 84 | 88 | public CollFailedEntityDao getCollFailedEntityDao() { |
| ... | ... | @@ -97,8 +101,4 @@ public class DaoSession extends AbstractDaoSession { |
| 97 | 101 | return userStepEntityDao; |
| 98 | 102 | } |
| 99 | 103 | |
| 100 | - public CalorieEntityDao getCalorieEntityDao() { | |
| 101 | - return calorieEntityDao; | |
| 102 | - } | |
| 103 | - | |
| 104 | 104 | } | ... | ... |