Commit ed2d4ee54c93cbef170fec3295c1fcc6aa38bde0
Merge branch 'master' of http://bj.gitlab.cnlive.com/cnlive-team/ModulePedometer
Showing
8 changed files
with
53 additions
and
43 deletions
app/src/main/java/com/example/modulepedometer/MainActivity.java
| ... | ... | @@ -31,7 +31,7 @@ public class MainActivity extends AppCompatActivity { |
| 31 | 31 | findViewById(R.id.tooll).setOnClickListener(new View.OnClickListener() { |
| 32 | 32 | @Override |
| 33 | 33 | public void onClick(View v) { |
| 34 | - RaceListActivity.newInstance(getApplicationContext(),"10513196",null,null); | |
| 34 | + RaceListActivity.newInstance(MainActivity.this,"10513196",null,null); | |
| 35 | 35 | //跳转界面 |
| 36 | 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 | 122 | public void onSuccess(BaseInfo<BindingShoeInfo> baseInfo) { |
| 123 | 123 | if (getView() != null) { |
| 124 | 124 | QMUITipDialogUtil.dismessDialog(); |
| 125 | - getView().bindingShoeLine(position, baseInfo); | |
| 125 | + getView().bindingShoeLine(position); | |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 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 | 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 | 102 | list.get(position).setIsEnable(0); |
| 105 | 103 | for (int i = 0; i < list.size(); i++) { |
| 106 | 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 | 15 | private String roadMap; |
| 16 | 16 | private String eventId; |
| 17 | 17 | private int code; |
| 18 | - private String entityName; | |
| 19 | 18 | |
| 20 | 19 | public String getRoadMap() { |
| 21 | 20 | return roadMap; |
| ... | ... | @@ -40,12 +39,4 @@ public class BindingShoeInfo { |
| 40 | 39 | public void setCode(int code) { |
| 41 | 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 | 3 | |
| 4 | 4 | import android.os.Bundle; |
| 5 | 5 | import android.support.annotation.Nullable; |
| 6 | +import android.util.EventLog; | |
| 6 | 7 | import android.view.View; |
| 7 | 8 | |
| 8 | 9 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| 9 | 10 | import com.cnlive.moudle.collectionTrace.frame.presenter.RaceNameListPresenter; |
| 10 | 11 | import com.cnlive.moudle.collectionTrace.frame.view.RaceNameListView; |
| 11 | 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 | 16 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 13 | 17 | import com.example.moudle_pedometer.R; |
| 14 | 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 | 25 | * Created by hanyayun 019/06/25. |
| 18 | 26 | */ |
| ... | ... | @@ -40,7 +48,7 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R |
| 40 | 48 | @Override |
| 41 | 49 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 42 | 50 | super.onViewCreated(view, savedInstanceState); |
| 43 | - | |
| 51 | + if(!EventBus.getDefault().isRegistered(this))EventBus.getDefault().register(this); | |
| 44 | 52 | if (null != getArguments()) { |
| 45 | 53 | eventId = getArguments().getString("eventId"); |
| 46 | 54 | runRaceDetailInfo = (RunRaceDetailInfo) getArguments().getSerializable("runRaceDetailInfo"); |
| ... | ... | @@ -67,6 +75,11 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R |
| 67 | 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 | 84 | public void addShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, String fenceId, int position) { |
| 72 | 85 | getPresenter().bindingShoeLine(getActivity(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), fenceId, eventShoeLinesBean.getEventName(), position); |
| ... | ... | @@ -75,4 +88,13 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R |
| 75 | 88 | public void delectShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { |
| 76 | 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 | 21 | |
| 22 | 22 | /** Creates underlying database table using DAOs. */ |
| 23 | 23 | public static void createAllTables(Database db, boolean ifNotExists) { |
| 24 | - CollFailedEntityDao.createTable(db, ifNotExists); | |
| 25 | 24 | CollUserStepEntityDao.createTable(db, ifNotExists); |
| 26 | 25 | FailedEntityDao.createTable(db, ifNotExists); |
| 27 | 26 | UserStepEntityDao.createTable(db, ifNotExists); |
| 27 | + CollFailedEntityDao.createTable(db, ifNotExists); | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** Drops underlying database table using DAOs. */ |
| 31 | 31 | public static void dropAllTables(Database db, boolean ifExists) { |
| 32 | - CollFailedEntityDao.dropTable(db, ifExists); | |
| 33 | 32 | CollUserStepEntityDao.dropTable(db, ifExists); |
| 34 | 33 | FailedEntityDao.dropTable(db, ifExists); |
| 35 | 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 | 51 | |
| 52 | 52 | public DaoMaster(Database db) { |
| 53 | 53 | super(db, SCHEMA_VERSION); |
| 54 | - registerDaoClass(CollFailedEntityDao.class); | |
| 55 | 54 | registerDaoClass(CollUserStepEntityDao.class); |
| 56 | 55 | registerDaoClass(FailedEntityDao.class); |
| 57 | 56 | registerDaoClass(UserStepEntityDao.class); |
| 57 | + registerDaoClass(CollFailedEntityDao.class); | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 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 | 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.CollFailedEntity; | |
| 12 | 11 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; |
| 13 | 12 | import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; |
| 14 | 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 | 16 | import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; |
| 18 | 17 | import com.cnlive.moudle.pedometer.sql.dao.FailedEntityDao; |
| 19 | 18 | import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; |
| 19 | +import com.cnlive.moudle.pedometer.sql.dao.CollFailedEntityDao; | |
| 20 | 20 | |
| 21 | 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 | 27 | */ |
| 28 | 28 | public class DaoSession extends AbstractDaoSession { |
| 29 | 29 | |
| 30 | - private final DaoConfig collFailedEntityDaoConfig; | |
| 31 | 30 | private final DaoConfig collUserStepEntityDaoConfig; |
| 32 | 31 | private final DaoConfig failedEntityDaoConfig; |
| 33 | 32 | private final DaoConfig userStepEntityDaoConfig; |
| 33 | + private final DaoConfig collFailedEntityDaoConfig; | |
| 34 | 34 | |
| 35 | - private final CollFailedEntityDao collFailedEntityDao; | |
| 36 | 35 | private final CollUserStepEntityDao collUserStepEntityDao; |
| 37 | 36 | private final FailedEntityDao failedEntityDao; |
| 38 | 37 | private final UserStepEntityDao userStepEntityDao; |
| 38 | + private final CollFailedEntityDao collFailedEntityDao; | |
| 39 | 39 | |
| 40 | 40 | public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> |
| 41 | 41 | daoConfigMap) { |
| 42 | 42 | super(db); |
| 43 | 43 | |
| 44 | - collFailedEntityDaoConfig = daoConfigMap.get(CollFailedEntityDao.class).clone(); | |
| 45 | - collFailedEntityDaoConfig.initIdentityScope(type); | |
| 46 | - | |
| 47 | 44 | collUserStepEntityDaoConfig = daoConfigMap.get(CollUserStepEntityDao.class).clone(); |
| 48 | 45 | collUserStepEntityDaoConfig.initIdentityScope(type); |
| 49 | 46 | |
| ... | ... | @@ -53,26 +50,25 @@ public class DaoSession extends AbstractDaoSession { |
| 53 | 50 | userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone(); |
| 54 | 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 | 56 | collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this); |
| 58 | 57 | failedEntityDao = new FailedEntityDao(failedEntityDaoConfig, this); |
| 59 | 58 | userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this); |
| 59 | + collFailedEntityDao = new CollFailedEntityDao(collFailedEntityDaoConfig, this); | |
| 60 | 60 | |
| 61 | - registerDao(CollFailedEntity.class, collFailedEntityDao); | |
| 62 | 61 | registerDao(CollUserStepEntity.class, collUserStepEntityDao); |
| 63 | 62 | registerDao(FailedEntity.class, failedEntityDao); |
| 64 | 63 | registerDao(UserStepEntity.class, userStepEntityDao); |
| 64 | + registerDao(CollFailedEntity.class, collFailedEntityDao); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | public void clear() { |
| 68 | - collFailedEntityDaoConfig.clearIdentityScope(); | |
| 69 | 68 | collUserStepEntityDaoConfig.clearIdentityScope(); |
| 70 | 69 | failedEntityDaoConfig.clearIdentityScope(); |
| 71 | 70 | userStepEntityDaoConfig.clearIdentityScope(); |
| 72 | - } | |
| 73 | - | |
| 74 | - public CollFailedEntityDao getCollFailedEntityDao() { | |
| 75 | - return collFailedEntityDao; | |
| 71 | + collFailedEntityDaoConfig.clearIdentityScope(); | |
| 76 | 72 | } |
| 77 | 73 | |
| 78 | 74 | public CollUserStepEntityDao getCollUserStepEntityDao() { |
| ... | ... | @@ -87,4 +83,8 @@ public class DaoSession extends AbstractDaoSession { |
| 87 | 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 | 23 | /** |
| 24 | 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 | 29 | public int currentPage = 1; |
| 30 | 30 | public int pageSize = 10; |
| 31 | + | |
| 31 | 32 | public RunLineFragment() { |
| 32 | 33 | // Required empty public constructor |
| 33 | 34 | } |
| ... | ... | @@ -40,17 +41,17 @@ public class RunLineFragment extends MvpBindingFragment<RunLineView, RunLinePres |
| 40 | 41 | @Override |
| 41 | 42 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
| 42 | 43 | super.onViewCreated(view, savedInstanceState); |
| 43 | - if(getMvpView() != null)getMvpView().initView(); | |
| 44 | + if (getMvpView() != null) getMvpView().initView(); | |
| 44 | 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 | 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 | 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<RunLineView, RunLinePres |
| 65 | 66 | @Subscribe(threadMode = ThreadMode.MAIN) |
| 66 | 67 | public void Event(MessageEvent messageEvent) { |
| 67 | 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 | } | ... | ... |