Commit ceaf39e5a0ddbe6e614ab6b5b4fb69d50be39b59
1 parent
40225442
踩点轨迹删除
Showing
12 changed files
with
236 additions
and
29 deletions
app/src/main/java/com/example/modulepedometer/MainActivity.java
| @@ -5,6 +5,7 @@ import android.os.Bundle; | @@ -5,6 +5,7 @@ import android.os.Bundle; | ||
| 5 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v7.app.AppCompatActivity; |
| 6 | 6 | ||
| 7 | import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; | 7 | import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; |
| 8 | +import com.cnlive.moudle.collectionTrace.ui.activity.RaceListActivity; | ||
| 8 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity; | 9 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity; |
| 9 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; | 10 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; |
| 10 | 11 | ||
| @@ -16,7 +17,7 @@ public class MainActivity extends AppCompatActivity { | @@ -16,7 +17,7 @@ public class MainActivity extends AppCompatActivity { | ||
| 16 | super.onCreate(savedInstanceState); | 17 | super.onCreate(savedInstanceState); |
| 17 | setContentView(R.layout.activity_main); | 18 | setContentView(R.layout.activity_main); |
| 18 | // RunLineActivity.newInstance(this,null,null,null); | 19 | // RunLineActivity.newInstance(this,null,null,null); |
| 19 | - Intent intent = new Intent(this, RaceNameListActivity.class); | 20 | + Intent intent = new Intent(this, CollRunRaceDetailActivity.class); |
| 20 | startActivity(intent); | 21 | startActivity(intent); |
| 21 | // ARouter.getInstance() | 22 | // ARouter.getInstance() |
| 22 | //// .build("/moudle_pedometer/InterestActivity") | 23 | //// .build("/moudle_pedometer/InterestActivity") |
config.gradle
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/RaceNameListPresenter.java
| @@ -22,6 +22,8 @@ import io.reactivex.disposables.Disposable; | @@ -22,6 +22,8 @@ import io.reactivex.disposables.Disposable; | ||
| 22 | * Created by hanyayun 019/06/25. | 22 | * Created by hanyayun 019/06/25. |
| 23 | */ | 23 | */ |
| 24 | public class RaceNameListPresenter extends MvpBasePresenter<RaceNameListView> { | 24 | public class RaceNameListPresenter extends MvpBasePresenter<RaceNameListView> { |
| 25 | + | ||
| 26 | + | ||
| 25 | public void setData(Context context,String eventId, int pageNo, int pageSize){ | 27 | public void setData(Context context,String eventId, int pageNo, int pageSize){ |
| 26 | HashMap<String, String> map = new HashMap<>(); | 28 | HashMap<String, String> map = new HashMap<>(); |
| 27 | map.put("eventId", eventId); | 29 | map.put("eventId", eventId); |
| @@ -50,4 +52,68 @@ public class RaceNameListPresenter extends MvpBasePresenter<RaceNameListView> { | @@ -50,4 +52,68 @@ public class RaceNameListPresenter extends MvpBasePresenter<RaceNameListView> { | ||
| 50 | } | 52 | } |
| 51 | }).start(); | 53 | }).start(); |
| 52 | } | 54 | } |
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * 轨迹删除 | ||
| 58 | + * @param context | ||
| 59 | + * @param id 轨迹id | ||
| 60 | + */ | ||
| 61 | + public void delectShoeLine(Context context,int id,int position){ | ||
| 62 | + Map<String,String> map = new HashMap<>(); | ||
| 63 | + map.put("id",id+""); | ||
| 64 | + Logic.create(map).action(new Logic.Action<Map<String,String>, BaseInfo>() { | ||
| 65 | + @Override | ||
| 66 | + public Disposable action(Map<String, String> stringStringMap, DataCallback<BaseInfo> dataCallback) { | ||
| 67 | + return SubscriptionRequest.service(ApiServiceRunLin.class, api -> api.deleteShoeLineInfo(stringStringMap)).subscribe(context, dataCallback); | ||
| 68 | + } | ||
| 69 | + }).<BaseInfo>event().setFailureCallback(new FailureCallback() { | ||
| 70 | + @Override | ||
| 71 | + public void onFailure(int code, String message) { | ||
| 72 | + if (getView() != null) { | ||
| 73 | + getView().showToast(message); | ||
| 74 | + getView().hideLoading(); | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + }).setSuccessCallback(new SuccessCallback<BaseInfo>() { | ||
| 78 | + @Override | ||
| 79 | + public void onSuccess(BaseInfo baseInfo) { | ||
| 80 | + if (getView() != null){ | ||
| 81 | + getView().delectShoeLine(position); | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + }).start(); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + *踩点轨迹与赛事绑定 | ||
| 89 | + * @param context | ||
| 90 | + * @param id 轨迹id | ||
| 91 | + * @param eventId 赛事id | ||
| 92 | + */ | ||
| 93 | + public void bindingShoeLine(Context context,int id,String eventId,int position){ | ||
| 94 | + Map<String,String> map = new HashMap<>(); | ||
| 95 | + map.put("id",id+""); | ||
| 96 | + map.put("eventId",eventId); | ||
| 97 | + Logic.create(map).action(new Logic.Action<Map<String,String>, BaseInfo>() { | ||
| 98 | + @Override | ||
| 99 | + public Disposable action(Map<String, String> stringStringMap, DataCallback<BaseInfo> dataCallback) { | ||
| 100 | + return SubscriptionRequest.service(ApiServiceRunLin.class, api -> api.bindingShoeLineInfo(stringStringMap)).subscribe(context, dataCallback); | ||
| 101 | + } | ||
| 102 | + }).<BaseInfo>event().setFailureCallback(new FailureCallback() { | ||
| 103 | + @Override | ||
| 104 | + public void onFailure(int code, String message) { | ||
| 105 | + if (getView() != null) { | ||
| 106 | + getView().showToast(message); | ||
| 107 | + getView().hideLoading(); | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + }).setSuccessCallback(new SuccessCallback<BaseInfo>() { | ||
| 111 | + @Override | ||
| 112 | + public void onSuccess(BaseInfo baseInfo) { | ||
| 113 | + if (getView() != null){ | ||
| 114 | + getView().bindingShoeLine(position); | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + }).start(); | ||
| 118 | + } | ||
| 53 | } | 119 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/RaceNameListView.java
| @@ -39,12 +39,29 @@ public class RaceNameListView implements MvpView { | @@ -39,12 +39,29 @@ public class RaceNameListView implements MvpView { | ||
| 39 | public void initView(){ | 39 | public void initView(){ |
| 40 | fragment.binding.raceBack.setOnClickListener(v -> fragment.getActivity().finish()); | 40 | fragment.binding.raceBack.setOnClickListener(v -> fragment.getActivity().finish()); |
| 41 | // fragment.binding.intoPath.setOnClickListener(v -> ); | 41 | // fragment.binding.intoPath.setOnClickListener(v -> ); |
| 42 | - fragment.binding.raceTittle.setText("赛事名称轨迹列表"); | 42 | + fragment.binding.raceTittle.setText("赛事轨迹列表"); |
| 43 | fragment.binding.refreshLayout.setRefreshHeader(new ClassicsHeader(fragment.getActivity())); | 43 | fragment.binding.refreshLayout.setRefreshHeader(new ClassicsHeader(fragment.getActivity())); |
| 44 | fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity())); | 44 | fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity())); |
| 45 | fragment.binding.raceRecy.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); | 45 | fragment.binding.raceRecy.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | + | ||
| 49 | + public void bindingShoeLine(int position){ | ||
| 50 | + list.get(position).setIsEnable(0); | ||
| 51 | + for(int i = 0;i <list.size();i++){ | ||
| 52 | + if(i != position && list.get(i).getIsEnable() == 0){ | ||
| 53 | + list.get(i).setIsEnable(1); | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + adapter.notifyDataSetChanged(); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + | ||
| 60 | + public void delectShoeLine(int position){ | ||
| 61 | + list.remove(position); | ||
| 62 | + adapter.notifyDataSetChanged(); | ||
| 63 | + } | ||
| 64 | + | ||
| 48 | public void onSuccess(BaseInfo<RaceNameListInfo> raceNameListInfoBaseInfo){ | 65 | public void onSuccess(BaseInfo<RaceNameListInfo> raceNameListInfoBaseInfo){ |
| 49 | hideLoading(); | 66 | hideLoading(); |
| 50 | if(fragment.currentPage == 1){ | 67 | if(fragment.currentPage == 1){ |
| @@ -53,12 +70,25 @@ public class RaceNameListView implements MvpView { | @@ -53,12 +70,25 @@ public class RaceNameListView implements MvpView { | ||
| 53 | if(adapter == null){ | 70 | if(adapter == null){ |
| 54 | adapter = new RaceNameListAdapter(list,fragment.getActivity()); | 71 | adapter = new RaceNameListAdapter(list,fragment.getActivity()); |
| 55 | fragment.binding.raceRecy.setAdapter(adapter); | 72 | fragment.binding.raceRecy.setAdapter(adapter); |
| 56 | -// adapter.setClickListener(new RunLineAdapter.OnClickListener() { | ||
| 57 | -// @Override | ||
| 58 | -// public void onClickListener(RunLineInfo.ListBean bean, int position) { | ||
| 59 | -// RunRaceDetailActivity.startActivity(fragment.getActivity(),bean.getId()+"",null,null,null,null); | ||
| 60 | -// } | ||
| 61 | -// }); | 73 | + adapter.setOnItemClick(new RaceNameListAdapter.OnItemClick() { |
| 74 | + @Override | ||
| 75 | + public void onItemClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { | ||
| 76 | + | ||
| 77 | + } | ||
| 78 | + }); | ||
| 79 | + adapter.setOnAddShoeLineClick(new RaceNameListAdapter.OnAddShoeLineClick() { | ||
| 80 | + @Override | ||
| 81 | + public void onAddSholeLineClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { | ||
| 82 | + fragment.addShoeLine(eventShoeLinesBean,position); | ||
| 83 | + } | ||
| 84 | + }); | ||
| 85 | + | ||
| 86 | + adapter.setOnDelectShoeLineClick(new RaceNameListAdapter.OnDelectShoeLineClick() { | ||
| 87 | + @Override | ||
| 88 | + public void onDelectShoeLineClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { | ||
| 89 | + fragment.delectShoeLine(eventShoeLinesBean,position); | ||
| 90 | + } | ||
| 91 | + }); | ||
| 62 | }else { | 92 | }else { |
| 63 | adapter.notifyDataSetChanged(); | 93 | adapter.notifyDataSetChanged(); |
| 64 | } | 94 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/RaceListActivity.java
| 1 | package com.cnlive.moudle.collectionTrace.ui.activity; | 1 | package com.cnlive.moudle.collectionTrace.ui.activity; |
| 2 | 2 | ||
| 3 | +import android.content.Context; | ||
| 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 | ||
| @@ -15,13 +17,27 @@ import com.example.moudle_pedometer.R; | @@ -15,13 +17,27 @@ import com.example.moudle_pedometer.R; | ||
| 15 | */ | 17 | */ |
| 16 | public class RaceListActivity extends AppCompatActivity { | 18 | public class RaceListActivity extends AppCompatActivity { |
| 17 | 19 | ||
| 20 | + public static void newInstance(Context context,String userId,String userName,String userIcon){ | ||
| 21 | + Intent intent = new Intent(context,RaceListActivity.class); | ||
| 22 | + intent.putExtra("userId",userId); | ||
| 23 | + intent.putExtra("userName",userName); | ||
| 24 | + intent.putExtra("userIcon",userIcon); | ||
| 25 | + context.startActivity(intent); | ||
| 26 | + } | ||
| 27 | + | ||
| 18 | @Override | 28 | @Override |
| 19 | protected void onCreate(Bundle savedInstanceState) { | 29 | protected void onCreate(Bundle savedInstanceState) { |
| 20 | super.onCreate(savedInstanceState); | 30 | super.onCreate(savedInstanceState); |
| 21 | StatusBarUtil.setStatusBarWrite(this); | 31 | StatusBarUtil.setStatusBarWrite(this); |
| 22 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0); | 32 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0); |
| 23 | setContentView(R.layout.activity_race_list); | 33 | setContentView(R.layout.activity_race_list); |
| 24 | - CommonInfo.setUserId(this, "10513196"); | 34 | + if(getIntent().getStringExtra("userId") != null){ |
| 35 | + CommonInfo.setUserId(this,getIntent().getStringExtra("userId")); | ||
| 36 | + CommonInfo.setUserNickName(this,getIntent().getStringExtra("userName")); | ||
| 37 | + CommonInfo.setUserIcon(this,getIntent().getStringExtra("userIcon")); | ||
| 38 | + }else { | ||
| 39 | + CommonInfo.setUserId(this, "10513196"); | ||
| 40 | + } | ||
| 25 | getSupportFragmentManager().beginTransaction().replace(R.id.race_container,new RaceListFragment()).commit(); | 41 | getSupportFragmentManager().beginTransaction().replace(R.id.race_container,new RaceListFragment()).commit(); |
| 26 | } | 42 | } |
| 27 | } | 43 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/RaceNameListActivity.java
| 1 | package com.cnlive.moudle.collectionTrace.ui.activity; | 1 | package com.cnlive.moudle.collectionTrace.ui.activity; |
| 2 | 2 | ||
| 3 | +import android.content.Context; | ||
| 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 | ||
| @@ -8,18 +10,25 @@ import com.cnlive.libs.base.util.StatusBarUtil2; | @@ -8,18 +10,25 @@ import com.cnlive.libs.base.util.StatusBarUtil2; | ||
| 8 | import com.cnlive.moudle.collectionTrace.ui.fragment.RaceNameListFragment; | 10 | import com.cnlive.moudle.collectionTrace.ui.fragment.RaceNameListFragment; |
| 9 | import com.example.moudle_pedometer.R; | 11 | import com.example.moudle_pedometer.R; |
| 10 | 12 | ||
| 13 | + | ||
| 11 | /** | 14 | /** |
| 12 | * 赛事名称轨迹列表 | 15 | * 赛事名称轨迹列表 |
| 13 | * Created by hanyayun 019/06/25. | 16 | * Created by hanyayun 019/06/25. |
| 14 | */ | 17 | */ |
| 15 | public class RaceNameListActivity extends AppCompatActivity { | 18 | public class RaceNameListActivity extends AppCompatActivity { |
| 16 | 19 | ||
| 20 | + public static void newInstance(Context context,String eventId){ | ||
| 21 | + Intent intent = new Intent(context,RaceNameListActivity.class); | ||
| 22 | + intent.putExtra("eventId",eventId); | ||
| 23 | + context.startActivity(intent); | ||
| 24 | + } | ||
| 25 | + | ||
| 17 | @Override | 26 | @Override |
| 18 | protected void onCreate(Bundle savedInstanceState) { | 27 | protected void onCreate(Bundle savedInstanceState) { |
| 19 | super.onCreate(savedInstanceState); | 28 | super.onCreate(savedInstanceState); |
| 20 | StatusBarUtil.setStatusBarWrite(this); | 29 | StatusBarUtil.setStatusBarWrite(this); |
| 21 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0); | 30 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0); |
| 22 | setContentView(R.layout.activity_race_name_list); | 31 | setContentView(R.layout.activity_race_name_list); |
| 23 | - getSupportFragmentManager().beginTransaction().replace(R.id.race_container,new RaceNameListFragment()).commit(); | 32 | + getSupportFragmentManager().beginTransaction().replace(R.id.race_container,RaceNameListFragment.newInstance(getIntent().getStringExtra("eventId"))).commit(); |
| 24 | } | 33 | } |
| 25 | } | 34 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/adapter/RaceNameListAdapter.java
| @@ -7,6 +7,7 @@ import android.view.LayoutInflater; | @@ -7,6 +7,7 @@ import android.view.LayoutInflater; | ||
| 7 | import android.view.View; | 7 | import android.view.View; |
| 8 | import android.view.ViewGroup; | 8 | import android.view.ViewGroup; |
| 9 | import android.widget.ImageView; | 9 | import android.widget.ImageView; |
| 10 | +import android.widget.LinearLayout; | ||
| 10 | import android.widget.TextView; | 11 | import android.widget.TextView; |
| 11 | 12 | ||
| 12 | import com.bumptech.glide.Glide; | 13 | import com.bumptech.glide.Glide; |
| @@ -24,6 +25,21 @@ public class RaceNameListAdapter extends RecyclerView.Adapter<RaceNameListAdapte | @@ -24,6 +25,21 @@ public class RaceNameListAdapter extends RecyclerView.Adapter<RaceNameListAdapte | ||
| 24 | 25 | ||
| 25 | private List<RaceNameListInfo.EventShoeLinesBean> list = new ArrayList<>(); | 26 | private List<RaceNameListInfo.EventShoeLinesBean> list = new ArrayList<>(); |
| 26 | private Activity context; | 27 | private Activity context; |
| 28 | + private OnItemClick onItemClick; | ||
| 29 | + private OnAddShoeLineClick onAddShoeLineClick; | ||
| 30 | + private OnDelectShoeLineClick onDelectShoeLineClick; | ||
| 31 | + | ||
| 32 | + public void setOnItemClick(OnItemClick onItemClick) { | ||
| 33 | + this.onItemClick = onItemClick; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public void setOnAddShoeLineClick(OnAddShoeLineClick onAddShoeLineClick) { | ||
| 37 | + this.onAddShoeLineClick = onAddShoeLineClick; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public void setOnDelectShoeLineClick(OnDelectShoeLineClick onDelectShoeLineClick) { | ||
| 41 | + this.onDelectShoeLineClick = onDelectShoeLineClick; | ||
| 42 | + } | ||
| 27 | 43 | ||
| 28 | public RaceNameListAdapter(List<RaceNameListInfo.EventShoeLinesBean> list, Activity context) { | 44 | public RaceNameListAdapter(List<RaceNameListInfo.EventShoeLinesBean> list, Activity context) { |
| 29 | this.list = list; | 45 | this.list = list; |
| @@ -45,16 +61,37 @@ public class RaceNameListAdapter extends RecyclerView.Adapter<RaceNameListAdapte | @@ -45,16 +61,37 @@ public class RaceNameListAdapter extends RecyclerView.Adapter<RaceNameListAdapte | ||
| 45 | myViewHolder.kilometer_num.setText(list.get(i).getMileage()); | 61 | myViewHolder.kilometer_num.setText(list.get(i).getMileage()); |
| 46 | myViewHolder.tv_start_addr.setText(list.get(i).getStartLocation()); | 62 | myViewHolder.tv_start_addr.setText(list.get(i).getStartLocation()); |
| 47 | myViewHolder.tv_end_addr.setText(list.get(i).getEndLocation()); | 63 | myViewHolder.tv_end_addr.setText(list.get(i).getEndLocation()); |
| 48 | -// myViewHolder.delect_path.setOnClickListener(v -> ); | 64 | + myViewHolder.shoe_ly.setOnClickListener(new View.OnClickListener() { |
| 65 | + @Override | ||
| 66 | + public void onClick(View v) { | ||
| 67 | + if(onItemClick != null)onItemClick.onItemClickListener(list.get(i),i); | ||
| 68 | + } | ||
| 69 | + }); | ||
| 70 | + | ||
| 49 | if(list.get(i).getIsEnable() == 0){ | 71 | if(list.get(i).getIsEnable() == 0){ |
| 50 | myViewHolder.has_path.setText("已绑定轨迹"); | 72 | myViewHolder.has_path.setText("已绑定轨迹"); |
| 51 | myViewHolder.has_path.setTextColor(context.getResources().getColor(R.color.text_gray99)); | 73 | myViewHolder.has_path.setTextColor(context.getResources().getColor(R.color.text_gray99)); |
| 52 | myViewHolder.has_path.setBackground(context.getResources().getDrawable(R.drawable.gray_raduis_bg)); | 74 | myViewHolder.has_path.setBackground(context.getResources().getDrawable(R.drawable.gray_raduis_bg)); |
| 75 | + myViewHolder.delect_path.setTextColor(context.getResources().getColor(R.color.text_gray99)); | ||
| 76 | + myViewHolder.delect_path.setBackground(context.getResources().getDrawable(R.drawable.gray_raduis_bg)); | ||
| 53 | }else { | 77 | }else { |
| 54 | myViewHolder.has_path.setText("绑定轨迹"); | 78 | myViewHolder.has_path.setText("绑定轨迹"); |
| 55 | myViewHolder.has_path.setTextColor(context.getResources().getColor(R.color.green_tx)); | 79 | myViewHolder.has_path.setTextColor(context.getResources().getColor(R.color.green_tx)); |
| 56 | myViewHolder.has_path.setBackground(context.getResources().getDrawable(R.drawable.green_raduis_bg)); | 80 | myViewHolder.has_path.setBackground(context.getResources().getDrawable(R.drawable.green_raduis_bg)); |
| 57 | - // myViewHolder.has_path.setOnClickListener(v -> ); | 81 | + myViewHolder.delect_path.setTextColor(context.getResources().getColor(R.color.green_tx)); |
| 82 | + myViewHolder.delect_path.setBackground(context.getResources().getDrawable(R.drawable.green_raduis_bg)); | ||
| 83 | + myViewHolder.has_path.setOnClickListener(new View.OnClickListener() { | ||
| 84 | + @Override | ||
| 85 | + public void onClick(View v) { | ||
| 86 | + if(onAddShoeLineClick != null)onAddShoeLineClick.onAddSholeLineClickListener(list.get(i),i); | ||
| 87 | + } | ||
| 88 | + }); | ||
| 89 | + myViewHolder.delect_path.setOnClickListener(new View.OnClickListener() { | ||
| 90 | + @Override | ||
| 91 | + public void onClick(View v) { | ||
| 92 | + if(onDelectShoeLineClick != null)onDelectShoeLineClick.onDelectShoeLineClickListener(list.get(i),i); | ||
| 93 | + } | ||
| 94 | + }); | ||
| 58 | } | 95 | } |
| 59 | } | 96 | } |
| 60 | 97 | ||
| @@ -65,6 +102,7 @@ public class RaceNameListAdapter extends RecyclerView.Adapter<RaceNameListAdapte | @@ -65,6 +102,7 @@ public class RaceNameListAdapter extends RecyclerView.Adapter<RaceNameListAdapte | ||
| 65 | 102 | ||
| 66 | class MyViewHolder extends RecyclerView.ViewHolder { | 103 | class MyViewHolder extends RecyclerView.ViewHolder { |
| 67 | 104 | ||
| 105 | + LinearLayout shoe_ly; | ||
| 68 | TextView record_time_day; | 106 | TextView record_time_day; |
| 69 | TextView record_time; | 107 | TextView record_time; |
| 70 | ImageView item_img; | 108 | ImageView item_img; |
| @@ -76,6 +114,7 @@ public class RaceNameListAdapter extends RecyclerView.Adapter<RaceNameListAdapte | @@ -76,6 +114,7 @@ public class RaceNameListAdapter extends RecyclerView.Adapter<RaceNameListAdapte | ||
| 76 | 114 | ||
| 77 | public MyViewHolder(@NonNull View itemView) { | 115 | public MyViewHolder(@NonNull View itemView) { |
| 78 | super(itemView); | 116 | super(itemView); |
| 117 | + shoe_ly = itemView.findViewById(R.id.shoe_ly); | ||
| 79 | record_time_day = itemView.findViewById(R.id.record_time_day); | 118 | record_time_day = itemView.findViewById(R.id.record_time_day); |
| 80 | record_time = itemView.findViewById(R.id.record_time); | 119 | record_time = itemView.findViewById(R.id.record_time); |
| 81 | item_img = itemView.findViewById(R.id.item_img); | 120 | item_img = itemView.findViewById(R.id.item_img); |
| @@ -86,4 +125,17 @@ public class RaceNameListAdapter extends RecyclerView.Adapter<RaceNameListAdapte | @@ -86,4 +125,17 @@ public class RaceNameListAdapter extends RecyclerView.Adapter<RaceNameListAdapte | ||
| 86 | delect_path = itemView.findViewById(R.id.delect_path); | 125 | delect_path = itemView.findViewById(R.id.delect_path); |
| 87 | } | 126 | } |
| 88 | } | 127 | } |
| 128 | + | ||
| 129 | + public interface OnItemClick{ | ||
| 130 | + void onItemClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean,int position); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public interface OnAddShoeLineClick{ | ||
| 134 | + void onAddSholeLineClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean,int position); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public interface OnDelectShoeLineClick{ | ||
| 138 | + void onDelectShoeLineClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean,int position); | ||
| 139 | + } | ||
| 89 | } | 140 | } |
| 141 | + |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/adapter/RunListAdapter.java
| @@ -8,6 +8,7 @@ import android.view.View; | @@ -8,6 +8,7 @@ import android.view.View; | ||
| 8 | import android.view.ViewGroup; | 8 | import android.view.ViewGroup; |
| 9 | import android.widget.TextView; | 9 | import android.widget.TextView; |
| 10 | 10 | ||
| 11 | +import com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity; | ||
| 11 | import com.cnlive.moudle.pedometer.net.bean.RunLineInfo; | 12 | import com.cnlive.moudle.pedometer.net.bean.RunLineInfo; |
| 12 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 13 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 13 | import com.example.moudle_pedometer.R; | 14 | import com.example.moudle_pedometer.R; |
| @@ -42,7 +43,7 @@ public class RunListAdapter extends RecyclerView.Adapter<RunListAdapter.MyViewHo | @@ -42,7 +43,7 @@ public class RunListAdapter extends RecyclerView.Adapter<RunListAdapter.MyViewHo | ||
| 42 | myViewHolder.line_address.setText(list.get(i).getAddress() + " " + list.get(i).getMileage()); | 43 | myViewHolder.line_address.setText(list.get(i).getAddress() + " " + list.get(i).getMileage()); |
| 43 | //添加轨迹 | 44 | //添加轨迹 |
| 44 | // myViewHolder.add_path.setOnClickListener(v -> ); | 45 | // myViewHolder.add_path.setOnClickListener(v -> ); |
| 45 | -// myViewHolder.path_list.setOnClickListener(v -> ); | 46 | + myViewHolder.path_list.setOnClickListener(v -> RaceNameListActivity.newInstance(context,list.get(i).getId()+"")); |
| 46 | } | 47 | } |
| 47 | 48 | ||
| 48 | @Override | 49 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/RaceNameListFragment.java
| @@ -8,7 +8,7 @@ import android.view.View; | @@ -8,7 +8,7 @@ import android.view.View; | ||
| 8 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | 8 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| 9 | import com.cnlive.moudle.collectionTrace.frame.presenter.RaceNameListPresenter; | 9 | import com.cnlive.moudle.collectionTrace.frame.presenter.RaceNameListPresenter; |
| 10 | import com.cnlive.moudle.collectionTrace.frame.view.RaceNameListView; | 10 | import com.cnlive.moudle.collectionTrace.frame.view.RaceNameListView; |
| 11 | -import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 11 | +import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; |
| 12 | import com.example.moudle_pedometer.R; | 12 | import com.example.moudle_pedometer.R; |
| 13 | import com.example.moudle_pedometer.databinding.FragmentRaceNameListBinding; | 13 | import com.example.moudle_pedometer.databinding.FragmentRaceNameListBinding; |
| 14 | 14 | ||
| @@ -19,6 +19,15 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | @@ -19,6 +19,15 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | ||
| 19 | 19 | ||
| 20 | public int currentPage = 1; | 20 | public int currentPage = 1; |
| 21 | public int pageSize = 10; | 21 | public int pageSize = 10; |
| 22 | + private String eventId; | ||
| 23 | + | ||
| 24 | + public static RaceNameListFragment newInstance(String eventId){ | ||
| 25 | + RaceNameListFragment fragment = new RaceNameListFragment(); | ||
| 26 | + Bundle bundle = new Bundle(); | ||
| 27 | + bundle.putString("eventId",eventId); | ||
| 28 | + fragment.setArguments(bundle); | ||
| 29 | + return fragment; | ||
| 30 | + } | ||
| 22 | public RaceNameListFragment() { | 31 | public RaceNameListFragment() { |
| 23 | // Required empty public constructor | 32 | // Required empty public constructor |
| 24 | } | 33 | } |
| @@ -28,14 +37,15 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | @@ -28,14 +37,15 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | ||
| 28 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 37 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 29 | super.onViewCreated(view, savedInstanceState); | 38 | super.onViewCreated(view, savedInstanceState); |
| 30 | if(getMvpView() != null) getMvpView().initView(); | 39 | if(getMvpView() != null) getMvpView().initView(); |
| 31 | - getPresenter().setData(getActivity(),"116",currentPage,pageSize); | 40 | + eventId = getArguments().getString("eventId"); |
| 41 | + getPresenter().setData(getActivity(),"117",currentPage,pageSize); | ||
| 32 | binding.refreshLayout.setOnRefreshListener(v ->{ | 42 | binding.refreshLayout.setOnRefreshListener(v ->{ |
| 33 | currentPage = 1; | 43 | currentPage = 1; |
| 34 | - getPresenter().setData(getActivity(),"116",currentPage,pageSize); | 44 | + getPresenter().setData(getActivity(),"117",currentPage,pageSize); |
| 35 | }); | 45 | }); |
| 36 | binding.refreshLayout.setOnLoadMoreListener(v ->{ | 46 | binding.refreshLayout.setOnLoadMoreListener(v ->{ |
| 37 | currentPage++; | 47 | currentPage++; |
| 38 | - getPresenter().setData(getActivity(),"116",currentPage,pageSize); | 48 | + getPresenter().setData(getActivity(),"117",currentPage,pageSize); |
| 39 | }); | 49 | }); |
| 40 | } | 50 | } |
| 41 | 51 | ||
| @@ -44,4 +54,12 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | @@ -44,4 +54,12 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | ||
| 44 | return R.layout.fragment_race_name_list; | 54 | return R.layout.fragment_race_name_list; |
| 45 | } | 55 | } |
| 46 | 56 | ||
| 57 | + | ||
| 58 | + public void addShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean,int position){ | ||
| 59 | + getPresenter().bindingShoeLine(getActivity(),eventShoeLinesBean.getId(),eventShoeLinesBean.getEventId(),position); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public void delectShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean,int position){ | ||
| 63 | + getPresenter().delectShoeLine(getActivity(),eventShoeLinesBean.getId(),position); | ||
| 64 | + } | ||
| 47 | } | 65 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/net/ApiServiceRunLin.java
| @@ -71,5 +71,18 @@ public interface ApiServiceRunLin { | @@ -71,5 +71,18 @@ public interface ApiServiceRunLin { | ||
| 71 | */ | 71 | */ |
| 72 | @POST("Daren/event/getShoeLineList.action") | 72 | @POST("Daren/event/getShoeLineList.action") |
| 73 | Observable<Result<BaseInfo<RaceNameListInfo>>> getRaceNameListInfo(@QueryMap() Map<String, String> maps); | 73 | Observable<Result<BaseInfo<RaceNameListInfo>>> getRaceNameListInfo(@QueryMap() Map<String, String> maps); |
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 踩点轨迹删除 | ||
| 77 | + */ | ||
| 78 | + @POST("Daren/event/deleteShoeLine.action") | ||
| 79 | + Observable<Result<BaseInfo>> deleteShoeLineInfo(@QueryMap() Map<String, String> maps); | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 踩点轨迹绑定 | ||
| 83 | + */ | ||
| 84 | + @POST("Daren/event/bindingShoeLine.action") | ||
| 85 | + Observable<Result<BaseInfo>> bindingShoeLineInfo(@QueryMap() Map<String, String> maps); | ||
| 86 | + | ||
| 74 | } | 87 | } |
| 75 | 88 |
moudle_pedometer/src/main/res/layout/fragment_race_name_list.xml
| @@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
| 26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
| 27 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
| 28 | android:layout_centerInParent="true" | 28 | android:layout_centerInParent="true" |
| 29 | - android:textSize="18sp" | 29 | + android:textSize="16sp" |
| 30 | android:textColor="#333333" | 30 | android:textColor="#333333" |
| 31 | /> | 31 | /> |
| 32 | 32 | ||
| @@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
| 34 | android:id="@+id/into_path" | 34 | android:id="@+id/into_path" |
| 35 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
| 36 | android:layout_height="wrap_content" | 36 | android:layout_height="wrap_content" |
| 37 | - android:textSize="14sp" | 37 | + android:textSize="13sp" |
| 38 | android:textColor="#333333" | 38 | android:textColor="#333333" |
| 39 | android:layout_alignParentRight="true" | 39 | android:layout_alignParentRight="true" |
| 40 | android:layout_centerVertical="true" | 40 | android:layout_centerVertical="true" |
moudle_pedometer/src/main/res/layout/item_race_name_list.xml
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | android:layout_height="wrap_content" | 4 | android:layout_height="wrap_content" |
| 5 | android:layout_margin="5dp" | 5 | android:layout_margin="5dp" |
| 6 | android:orientation="vertical" | 6 | android:orientation="vertical" |
| 7 | + android:id="@+id/shoe_ly" | ||
| 7 | android:background="@color/white" | 8 | android:background="@color/white" |
| 8 | android:padding="10dp"> | 9 | android:padding="10dp"> |
| 9 | 10 | ||
| @@ -63,7 +64,7 @@ | @@ -63,7 +64,7 @@ | ||
| 63 | android:layout_height="wrap_content" | 64 | android:layout_height="wrap_content" |
| 64 | android:text="4.42 公里" | 65 | android:text="4.42 公里" |
| 65 | android:textColor="#333333" | 66 | android:textColor="#333333" |
| 66 | - android:textSize="18sp" /> | 67 | + android:textSize="16sp" /> |
| 67 | 68 | ||
| 68 | <LinearLayout | 69 | <LinearLayout |
| 69 | android:layout_width="match_parent" | 70 | android:layout_width="match_parent" |
| @@ -82,7 +83,7 @@ | @@ -82,7 +83,7 @@ | ||
| 82 | android:layout_marginLeft="5dp" | 83 | android:layout_marginLeft="5dp" |
| 83 | android:text="@string/layout_street_start_point" | 84 | android:text="@string/layout_street_start_point" |
| 84 | android:textColor="@color/bottom_sheet_dialog_race_location_text" | 85 | android:textColor="@color/bottom_sheet_dialog_race_location_text" |
| 85 | - android:textSize="13sp" /> | 86 | + android:textSize="12sp" /> |
| 86 | 87 | ||
| 87 | <TextView | 88 | <TextView |
| 88 | android:id="@+id/tv_start_addr" | 89 | android:id="@+id/tv_start_addr" |
| @@ -91,7 +92,7 @@ | @@ -91,7 +92,7 @@ | ||
| 91 | android:layout_marginLeft="10dp" | 92 | android:layout_marginLeft="10dp" |
| 92 | android:text="首都师范大学操场东门" | 93 | android:text="首都师范大学操场东门" |
| 93 | android:textColor="@color/text_black" | 94 | android:textColor="@color/text_black" |
| 94 | - android:textSize="13sp" /> | 95 | + android:textSize="12sp" /> |
| 95 | </LinearLayout> | 96 | </LinearLayout> |
| 96 | 97 | ||
| 97 | <LinearLayout | 98 | <LinearLayout |
| @@ -111,7 +112,7 @@ | @@ -111,7 +112,7 @@ | ||
| 111 | android:layout_marginLeft="5dp" | 112 | android:layout_marginLeft="5dp" |
| 112 | android:text="@string/layout_street_end_point" | 113 | android:text="@string/layout_street_end_point" |
| 113 | android:textColor="@color/bottom_sheet_dialog_race_location_text" | 114 | android:textColor="@color/bottom_sheet_dialog_race_location_text" |
| 114 | - android:textSize="13sp" /> | 115 | + android:textSize="12sp" /> |
| 115 | 116 | ||
| 116 | <TextView | 117 | <TextView |
| 117 | android:id="@+id/tv_end_addr" | 118 | android:id="@+id/tv_end_addr" |
| @@ -120,7 +121,7 @@ | @@ -120,7 +121,7 @@ | ||
| 120 | android:layout_marginLeft="10dp" | 121 | android:layout_marginLeft="10dp" |
| 121 | android:text="首都师范大学操场西门" | 122 | android:text="首都师范大学操场西门" |
| 122 | android:textColor="@color/text_black" | 123 | android:textColor="@color/text_black" |
| 123 | - android:textSize="13sp" /> | 124 | + android:textSize="12sp" /> |
| 124 | </LinearLayout> | 125 | </LinearLayout> |
| 125 | 126 | ||
| 126 | <LinearLayout | 127 | <LinearLayout |
| @@ -135,9 +136,9 @@ | @@ -135,9 +136,9 @@ | ||
| 135 | android:layout_width="wrap_content" | 136 | android:layout_width="wrap_content" |
| 136 | android:layout_height="wrap_content" | 137 | android:layout_height="wrap_content" |
| 137 | android:background="@drawable/green_raduis_bg" | 138 | android:background="@drawable/green_raduis_bg" |
| 138 | - android:paddingLeft="10dp" | 139 | + android:paddingLeft="11dp" |
| 139 | android:paddingTop="7dp" | 140 | android:paddingTop="7dp" |
| 140 | - android:paddingRight="10dp" | 141 | + android:paddingRight="11dp" |
| 141 | android:paddingBottom="7dp" | 142 | android:paddingBottom="7dp" |
| 142 | android:text="@string/addpath" | 143 | android:text="@string/addpath" |
| 143 | android:textColor="@color/green_tx" | 144 | android:textColor="@color/green_tx" |
| @@ -149,9 +150,9 @@ | @@ -149,9 +150,9 @@ | ||
| 149 | android:layout_height="wrap_content" | 150 | android:layout_height="wrap_content" |
| 150 | android:layout_marginLeft="15dp" | 151 | android:layout_marginLeft="15dp" |
| 151 | android:background="@drawable/green_raduis_bg" | 152 | android:background="@drawable/green_raduis_bg" |
| 152 | - android:paddingLeft="9dp" | 153 | + android:paddingLeft="10dp" |
| 153 | android:paddingTop="7dp" | 154 | android:paddingTop="7dp" |
| 154 | - android:paddingRight="9dp" | 155 | + android:paddingRight="10dp" |
| 155 | android:paddingBottom="7dp" | 156 | android:paddingBottom="7dp" |
| 156 | android:text="@string/delect" | 157 | android:text="@string/delect" |
| 157 | android:textColor="#36C28D" | 158 | android:textColor="#36C28D" |