Commit ed2d4ee54c93cbef170fec3295c1fcc6aa38bde0

Authored by 杨帅
2 parents ae48744f 6696155a
app/src/main/java/com/example/modulepedometer/MainActivity.java
@@ -31,7 +31,7 @@ public class MainActivity extends AppCompatActivity { @@ -31,7 +31,7 @@ public class MainActivity extends AppCompatActivity {
31 findViewById(R.id.tooll).setOnClickListener(new View.OnClickListener() { 31 findViewById(R.id.tooll).setOnClickListener(new View.OnClickListener() {
32 @Override 32 @Override
33 public void onClick(View v) { 33 public void onClick(View v) {
34 - RaceListActivity.newInstance(getApplicationContext(),"10513196",null,null); 34 + RaceListActivity.newInstance(MainActivity.this,"10513196",null,null);
35 //跳转界面 35 //跳转界面
36 // CollRunningFinishActivity.startActivity(MainActivity.this); 36 // CollRunningFinishActivity.startActivity(MainActivity.this);
37 } 37 }
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/RaceNameListPresenter.java
@@ -122,7 +122,7 @@ public class RaceNameListPresenter extends MvpBasePresenter<RaceNameListView> { @@ -122,7 +122,7 @@ public class RaceNameListPresenter extends MvpBasePresenter<RaceNameListView> {
122 public void onSuccess(BaseInfo<BindingShoeInfo> baseInfo) { 122 public void onSuccess(BaseInfo<BindingShoeInfo> baseInfo) {
123 if (getView() != null) { 123 if (getView() != null) {
124 QMUITipDialogUtil.dismessDialog(); 124 QMUITipDialogUtil.dismessDialog();
125 - getView().bindingShoeLine(position, baseInfo); 125 + getView().bindingShoeLine(position);
126 } 126 }
127 } 127 }
128 }).start(); 128 }).start();
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/RaceNameListView.java
@@ -98,9 +98,7 @@ public class RaceNameListView implements MvpView, OnFenceListener { @@ -98,9 +98,7 @@ public class RaceNameListView implements MvpView, OnFenceListener {
98 } 98 }
99 99
100 100
101 - public void bindingShoeLine(int position, BaseInfo<BindingShoeInfo> baseInfo) {  
102 - if (baseInfo.getData().getEntityName() != null) {  
103 - } 101 + public void bindingShoeLine(int position) {
104 list.get(position).setIsEnable(0); 102 list.get(position).setIsEnable(0);
105 for (int i = 0; i < list.size(); i++) { 103 for (int i = 0; i < list.size(); i++) {
106 if (i != position && list.get(i).getIsEnable() == 0) { 104 if (i != position && list.get(i).getIsEnable() == 0) {
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/model/BindingShoeInfo.java
@@ -15,7 +15,6 @@ public class BindingShoeInfo { @@ -15,7 +15,6 @@ public class BindingShoeInfo {
15 private String roadMap; 15 private String roadMap;
16 private String eventId; 16 private String eventId;
17 private int code; 17 private int code;
18 - private String entityName;  
19 18
20 public String getRoadMap() { 19 public String getRoadMap() {
21 return roadMap; 20 return roadMap;
@@ -40,12 +39,4 @@ public class BindingShoeInfo { @@ -40,12 +39,4 @@ public class BindingShoeInfo {
40 public void setCode(int code) { 39 public void setCode(int code) {
41 this.code = code; 40 this.code = code;
42 } 41 }
43 -  
44 - public String getEntityName() {  
45 - return entityName;  
46 - }  
47 -  
48 - public void setEntityName(String entityName) {  
49 - this.entityName = entityName;  
50 - }  
51 } 42 }
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/RaceNameListFragment.java
@@ -3,16 +3,24 @@ package com.cnlive.moudle.collectionTrace.ui.fragment; @@ -3,16 +3,24 @@ package com.cnlive.moudle.collectionTrace.ui.fragment;
3 3
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.support.annotation.Nullable; 5 import android.support.annotation.Nullable;
  6 +import android.util.EventLog;
6 import android.view.View; 7 import android.view.View;
7 8
8 import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; 9 import com.cnlive.libs.base.frame.fragment.MvpBindingFragment;
9 import com.cnlive.moudle.collectionTrace.frame.presenter.RaceNameListPresenter; 10 import com.cnlive.moudle.collectionTrace.frame.presenter.RaceNameListPresenter;
10 import com.cnlive.moudle.collectionTrace.frame.view.RaceNameListView; 11 import com.cnlive.moudle.collectionTrace.frame.view.RaceNameListView;
11 import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; 12 import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo;
  13 +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
  14 +import com.cnlive.moudle.pedometer.model.Constant;
  15 +import com.cnlive.moudle.pedometer.model.MessageEvent;
12 import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; 16 import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo;
13 import com.example.moudle_pedometer.R; 17 import com.example.moudle_pedometer.R;
14 import com.example.moudle_pedometer.databinding.FragmentRaceNameListBinding; 18 import com.example.moudle_pedometer.databinding.FragmentRaceNameListBinding;
15 19
  20 +import org.greenrobot.eventbus.EventBus;
  21 +import org.greenrobot.eventbus.Subscribe;
  22 +import org.greenrobot.eventbus.ThreadMode;
  23 +
16 /** 24 /**
17 * Created by hanyayun 019/06/25. 25 * Created by hanyayun 019/06/25.
18 */ 26 */
@@ -40,7 +48,7 @@ public class RaceNameListFragment extends MvpBindingFragment&lt;RaceNameListView, R @@ -40,7 +48,7 @@ public class RaceNameListFragment extends MvpBindingFragment&lt;RaceNameListView, R
40 @Override 48 @Override
41 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 49 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
42 super.onViewCreated(view, savedInstanceState); 50 super.onViewCreated(view, savedInstanceState);
43 - 51 + if(!EventBus.getDefault().isRegistered(this))EventBus.getDefault().register(this);
44 if (null != getArguments()) { 52 if (null != getArguments()) {
45 eventId = getArguments().getString("eventId"); 53 eventId = getArguments().getString("eventId");
46 runRaceDetailInfo = (RunRaceDetailInfo) getArguments().getSerializable("runRaceDetailInfo"); 54 runRaceDetailInfo = (RunRaceDetailInfo) getArguments().getSerializable("runRaceDetailInfo");
@@ -67,6 +75,11 @@ public class RaceNameListFragment extends MvpBindingFragment&lt;RaceNameListView, R @@ -67,6 +75,11 @@ public class RaceNameListFragment extends MvpBindingFragment&lt;RaceNameListView, R
67 return R.layout.fragment_race_name_list; 75 return R.layout.fragment_race_name_list;
68 } 76 }
69 77
  78 + @Override
  79 + public void onDestroy() {
  80 + super.onDestroy();
  81 + if(EventBus.getDefault().isRegistered(this))EventBus.getDefault().unregister(this);
  82 + }
70 83
71 public void addShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, String fenceId, int position) { 84 public void addShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, String fenceId, int position) {
72 getPresenter().bindingShoeLine(getActivity(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), fenceId, eventShoeLinesBean.getEventName(), position); 85 getPresenter().bindingShoeLine(getActivity(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), fenceId, eventShoeLinesBean.getEventName(), position);
@@ -75,4 +88,13 @@ public class RaceNameListFragment extends MvpBindingFragment&lt;RaceNameListView, R @@ -75,4 +88,13 @@ public class RaceNameListFragment extends MvpBindingFragment&lt;RaceNameListView, R
75 public void delectShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { 88 public void delectShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) {
76 getPresenter().delectShoeLine(getActivity(), eventShoeLinesBean.getId(), position); 89 getPresenter().delectShoeLine(getActivity(), eventShoeLinesBean.getId(), position);
77 } 90 }
  91 +
  92 + @Subscribe(threadMode = ThreadMode.MAIN)
  93 + public void Event(MessageEvent messageEvent) {
  94 + if (messageEvent.getMessageType() == Constant.UPDATA_COLL_BIND_TRACE_LIST) {
  95 + if (getMvpView() != null) {
  96 + getMvpView().bindingShoeLine((Integer) messageEvent.getMessageContent());
  97 + }
  98 + }
  99 + }
78 } 100 }
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoMaster.java
@@ -21,18 +21,18 @@ public class DaoMaster extends AbstractDaoMaster { @@ -21,18 +21,18 @@ 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 - CollFailedEntityDao.createTable(db, ifNotExists);  
25 CollUserStepEntityDao.createTable(db, ifNotExists); 24 CollUserStepEntityDao.createTable(db, ifNotExists);
26 FailedEntityDao.createTable(db, ifNotExists); 25 FailedEntityDao.createTable(db, ifNotExists);
27 UserStepEntityDao.createTable(db, ifNotExists); 26 UserStepEntityDao.createTable(db, ifNotExists);
  27 + CollFailedEntityDao.createTable(db, ifNotExists);
28 } 28 }
29 29
30 /** Drops underlying database table using DAOs. */ 30 /** Drops underlying database table using DAOs. */
31 public static void dropAllTables(Database db, boolean ifExists) { 31 public static void dropAllTables(Database db, boolean ifExists) {
32 - CollFailedEntityDao.dropTable(db, ifExists);  
33 CollUserStepEntityDao.dropTable(db, ifExists); 32 CollUserStepEntityDao.dropTable(db, ifExists);
34 FailedEntityDao.dropTable(db, ifExists); 33 FailedEntityDao.dropTable(db, ifExists);
35 UserStepEntityDao.dropTable(db, ifExists); 34 UserStepEntityDao.dropTable(db, ifExists);
  35 + CollFailedEntityDao.dropTable(db, ifExists);
36 } 36 }
37 37
38 /** 38 /**
@@ -51,10 +51,10 @@ public class DaoMaster extends AbstractDaoMaster { @@ -51,10 +51,10 @@ public class DaoMaster extends AbstractDaoMaster {
51 51
52 public DaoMaster(Database db) { 52 public DaoMaster(Database db) {
53 super(db, SCHEMA_VERSION); 53 super(db, SCHEMA_VERSION);
54 - registerDaoClass(CollFailedEntityDao.class);  
55 registerDaoClass(CollUserStepEntityDao.class); 54 registerDaoClass(CollUserStepEntityDao.class);
56 registerDaoClass(FailedEntityDao.class); 55 registerDaoClass(FailedEntityDao.class);
57 registerDaoClass(UserStepEntityDao.class); 56 registerDaoClass(UserStepEntityDao.class);
  57 + registerDaoClass(CollFailedEntityDao.class);
58 } 58 }
59 59
60 public DaoSession newSession() { 60 public DaoSession newSession() {
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoSession.java
@@ -8,15 +8,15 @@ import org.greenrobot.greendao.database.Database; @@ -8,15 +8,15 @@ 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.CollFailedEntity;  
12 import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; 11 import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity;
13 import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; 12 import com.cnlive.moudle.pedometer.sql.entity.FailedEntity;
14 import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; 13 import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity;
  14 +import com.cnlive.moudle.pedometer.sql.entity.CollFailedEntity;
15 15
16 -import com.cnlive.moudle.pedometer.sql.dao.CollFailedEntityDao;  
17 import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; 16 import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao;
18 import com.cnlive.moudle.pedometer.sql.dao.FailedEntityDao; 17 import com.cnlive.moudle.pedometer.sql.dao.FailedEntityDao;
19 import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; 18 import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao;
  19 +import com.cnlive.moudle.pedometer.sql.dao.CollFailedEntityDao;
20 20
21 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. 21 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
22 22
@@ -27,23 +27,20 @@ import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; @@ -27,23 +27,20 @@ import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao;
27 */ 27 */
28 public class DaoSession extends AbstractDaoSession { 28 public class DaoSession extends AbstractDaoSession {
29 29
30 - private final DaoConfig collFailedEntityDaoConfig;  
31 private final DaoConfig collUserStepEntityDaoConfig; 30 private final DaoConfig collUserStepEntityDaoConfig;
32 private final DaoConfig failedEntityDaoConfig; 31 private final DaoConfig failedEntityDaoConfig;
33 private final DaoConfig userStepEntityDaoConfig; 32 private final DaoConfig userStepEntityDaoConfig;
  33 + private final DaoConfig collFailedEntityDaoConfig;
34 34
35 - private final CollFailedEntityDao collFailedEntityDao;  
36 private final CollUserStepEntityDao collUserStepEntityDao; 35 private final CollUserStepEntityDao collUserStepEntityDao;
37 private final FailedEntityDao failedEntityDao; 36 private final FailedEntityDao failedEntityDao;
38 private final UserStepEntityDao userStepEntityDao; 37 private final UserStepEntityDao userStepEntityDao;
  38 + private final CollFailedEntityDao collFailedEntityDao;
39 39
40 public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> 40 public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
41 daoConfigMap) { 41 daoConfigMap) {
42 super(db); 42 super(db);
43 43
44 - collFailedEntityDaoConfig = daoConfigMap.get(CollFailedEntityDao.class).clone();  
45 - collFailedEntityDaoConfig.initIdentityScope(type);  
46 -  
47 collUserStepEntityDaoConfig = daoConfigMap.get(CollUserStepEntityDao.class).clone(); 44 collUserStepEntityDaoConfig = daoConfigMap.get(CollUserStepEntityDao.class).clone();
48 collUserStepEntityDaoConfig.initIdentityScope(type); 45 collUserStepEntityDaoConfig.initIdentityScope(type);
49 46
@@ -53,26 +50,25 @@ public class DaoSession extends AbstractDaoSession { @@ -53,26 +50,25 @@ public class DaoSession extends AbstractDaoSession {
53 userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone(); 50 userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone();
54 userStepEntityDaoConfig.initIdentityScope(type); 51 userStepEntityDaoConfig.initIdentityScope(type);
55 52
56 - collFailedEntityDao = new CollFailedEntityDao(collFailedEntityDaoConfig, this); 53 + collFailedEntityDaoConfig = daoConfigMap.get(CollFailedEntityDao.class).clone();
  54 + collFailedEntityDaoConfig.initIdentityScope(type);
  55 +
57 collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this); 56 collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this);
58 failedEntityDao = new FailedEntityDao(failedEntityDaoConfig, this); 57 failedEntityDao = new FailedEntityDao(failedEntityDaoConfig, this);
59 userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this); 58 userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this);
  59 + collFailedEntityDao = new CollFailedEntityDao(collFailedEntityDaoConfig, this);
60 60
61 - registerDao(CollFailedEntity.class, collFailedEntityDao);  
62 registerDao(CollUserStepEntity.class, collUserStepEntityDao); 61 registerDao(CollUserStepEntity.class, collUserStepEntityDao);
63 registerDao(FailedEntity.class, failedEntityDao); 62 registerDao(FailedEntity.class, failedEntityDao);
64 registerDao(UserStepEntity.class, userStepEntityDao); 63 registerDao(UserStepEntity.class, userStepEntityDao);
  64 + registerDao(CollFailedEntity.class, collFailedEntityDao);
65 } 65 }
66 66
67 public void clear() { 67 public void clear() {
68 - collFailedEntityDaoConfig.clearIdentityScope();  
69 collUserStepEntityDaoConfig.clearIdentityScope(); 68 collUserStepEntityDaoConfig.clearIdentityScope();
70 failedEntityDaoConfig.clearIdentityScope(); 69 failedEntityDaoConfig.clearIdentityScope();
71 userStepEntityDaoConfig.clearIdentityScope(); 70 userStepEntityDaoConfig.clearIdentityScope();
72 - }  
73 -  
74 - public CollFailedEntityDao getCollFailedEntityDao() {  
75 - return collFailedEntityDao; 71 + collFailedEntityDaoConfig.clearIdentityScope();
76 } 72 }
77 73
78 public CollUserStepEntityDao getCollUserStepEntityDao() { 74 public CollUserStepEntityDao getCollUserStepEntityDao() {
@@ -87,4 +83,8 @@ public class DaoSession extends AbstractDaoSession { @@ -87,4 +83,8 @@ public class DaoSession extends AbstractDaoSession {
87 return userStepEntityDao; 83 return userStepEntityDao;
88 } 84 }
89 85
  86 + public CollFailedEntityDao getCollFailedEntityDao() {
  87 + return collFailedEntityDao;
  88 + }
  89 +
90 } 90 }
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunLineFragment.java
@@ -23,11 +23,12 @@ import org.greenrobot.eventbus.ThreadMode; @@ -23,11 +23,12 @@ import org.greenrobot.eventbus.ThreadMode;
23 /** 23 /**
24 * Created by hanyayun 019/06/03. 24 * Created by hanyayun 019/06/03.
25 */ 25 */
26 -public class RunLineFragment extends MvpBindingFragment<RunLineView, RunLinePresenter,Object,FragmentRunLineBinding> { 26 +public class RunLineFragment extends MvpBindingFragment<RunLineView, RunLinePresenter, Object, FragmentRunLineBinding> {
27 27
28 28
29 public int currentPage = 1; 29 public int currentPage = 1;
30 public int pageSize = 10; 30 public int pageSize = 10;
  31 +
31 public RunLineFragment() { 32 public RunLineFragment() {
32 // Required empty public constructor 33 // Required empty public constructor
33 } 34 }
@@ -40,17 +41,17 @@ public class RunLineFragment extends MvpBindingFragment&lt;RunLineView, RunLinePres @@ -40,17 +41,17 @@ public class RunLineFragment extends MvpBindingFragment&lt;RunLineView, RunLinePres
40 @Override 41 @Override
41 public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { 42 public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
42 super.onViewCreated(view, savedInstanceState); 43 super.onViewCreated(view, savedInstanceState);
43 - if(getMvpView() != null)getMvpView().initView(); 44 + if (getMvpView() != null) getMvpView().initView();
44 EventBus.getDefault().register(this); 45 EventBus.getDefault().register(this);
45 - getPresenter().setData(getActivity(),CommonInfo.getUserId(getActivity()),currentPage,pageSize); 46 + getPresenter().setData(getActivity(), CommonInfo.getUserId(getActivity()), currentPage, pageSize);
46 47
47 - binding.refreshLayout.setOnRefreshListener(v ->{ 48 + binding.refreshLayout.setOnRefreshListener(v -> {
48 currentPage = 1; 49 currentPage = 1;
49 - getPresenter().setData(getActivity(), CommonInfo.getUserId(getActivity()),currentPage,pageSize); 50 + getPresenter().setData(getActivity(), CommonInfo.getUserId(getActivity()), currentPage, pageSize);
50 }); 51 });
51 - binding.refreshLayout.setOnLoadMoreListener(v ->{ 52 + binding.refreshLayout.setOnLoadMoreListener(v -> {
52 currentPage++; 53 currentPage++;
53 - getPresenter().setData(getActivity(),CommonInfo.getUserId(getActivity()),currentPage,pageSize); 54 + getPresenter().setData(getActivity(), CommonInfo.getUserId(getActivity()), currentPage, pageSize);
54 }); 55 });
55 } 56 }
56 57
@@ -65,10 +66,8 @@ public class RunLineFragment extends MvpBindingFragment&lt;RunLineView, RunLinePres @@ -65,10 +66,8 @@ public class RunLineFragment extends MvpBindingFragment&lt;RunLineView, RunLinePres
65 @Subscribe(threadMode = ThreadMode.MAIN) 66 @Subscribe(threadMode = ThreadMode.MAIN)
66 public void Event(MessageEvent messageEvent) { 67 public void Event(MessageEvent messageEvent) {
67 if (messageEvent.getMessageType() == Constant.REGISTRATION_SUCCESS) { 68 if (messageEvent.getMessageType() == Constant.REGISTRATION_SUCCESS) {
68 - if (getMvpView() != null) {  
69 - currentPage = 1;  
70 - getPresenter().setData(getActivity(),CommonInfo.getUserId(getActivity()),currentPage,pageSize);  
71 - } 69 + currentPage = 1;
  70 + getPresenter().setData(getActivity(), CommonInfo.getUserId(getActivity()), currentPage, pageSize);
72 } 71 }
73 } 72 }
74 } 73 }