Commit 928f4d9c3192faf50c7bbbb04e3949bec36d95b5
1 parent
69673b74
约跑线路页面添加
Showing
9 changed files
with
166 additions
and
8 deletions
app/src/main/java/com/example/modulepedometer/MainActivity.java
| @@ -8,6 +8,7 @@ import android.view.View; | @@ -8,6 +8,7 @@ import android.view.View; | ||
| 8 | 8 | ||
| 9 | import com.alibaba.android.arouter.launcher.ARouter; | 9 | import com.alibaba.android.arouter.launcher.ARouter; |
| 10 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; | 10 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; |
| 11 | +import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; | ||
| 11 | import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity; | 12 | import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity; |
| 12 | 13 | ||
| 13 | 14 | ||
| @@ -17,10 +18,12 @@ public class MainActivity extends AppCompatActivity { | @@ -17,10 +18,12 @@ public class MainActivity extends AppCompatActivity { | ||
| 17 | protected void onCreate(Bundle savedInstanceState) { | 18 | protected void onCreate(Bundle savedInstanceState) { |
| 18 | super.onCreate(savedInstanceState); | 19 | super.onCreate(savedInstanceState); |
| 19 | setContentView(R.layout.activity_main); | 20 | setContentView(R.layout.activity_main); |
| 20 | - ARouter.getInstance() | ||
| 21 | -// .build("/moudle_pedometer/InterestActivity") | ||
| 22 | - .build("/moudle_pedometer/RunRaceDetailActivity") | ||
| 23 | - .navigation(this); | 21 | + Intent intent = new Intent(this, RunLineActivity.class); |
| 22 | + startActivity(intent); | ||
| 23 | +// ARouter.getInstance() | ||
| 24 | +//// .build("/moudle_pedometer/InterestActivity") | ||
| 25 | +// .build("/moudle_pedometer/RunRaceDetailActivity") | ||
| 26 | +// .navigation(this); | ||
| 24 | finish(); | 27 | finish(); |
| 25 | // BottomSheetDialog bottomSheetDialog=new BottomSheetDialog(this); | 28 | // BottomSheetDialog bottomSheetDialog=new BottomSheetDialog(this); |
| 26 | // View view=getLayoutInflater().inflate(R.layout.dialog_start_tip_bottomsheet,null); | 29 | // View view=getLayoutInflater().inflate(R.layout.dialog_start_tip_bottomsheet,null); |
moudle_pedometer/src/main/AndroidManifest.xml
| @@ -52,7 +52,8 @@ | @@ -52,7 +52,8 @@ | ||
| 52 | android:required="true" /> | 52 | android:required="true" /> |
| 53 | 53 | ||
| 54 | <application android:persistent="true"> | 54 | <application android:persistent="true"> |
| 55 | - <activity android:name="com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity"></activity> | 55 | + <activity android:name="com.cnlive.moudle.pedometer.ui.activity.RunLineActivity"></activity> |
| 56 | + <activity android:name="com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity" /> | ||
| 56 | <activity android:name="com.cnlive.moudle.pedometer.ui.activity.ShareRecordActivity" /> | 57 | <activity android:name="com.cnlive.moudle.pedometer.ui.activity.ShareRecordActivity" /> |
| 57 | <activity android:name="com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity" /> | 58 | <activity android:name="com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity" /> |
| 58 | <activity android:name="com.cnlive.moudle.pedometer.ui.activity.RegistrationInfoActivity" /> | 59 | <activity android:name="com.cnlive.moudle.pedometer.ui.activity.RegistrationInfoActivity" /> |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/MyRecordView.java
| @@ -28,7 +28,7 @@ public class MyRecordView implements MvpView { | @@ -28,7 +28,7 @@ public class MyRecordView implements MvpView { | ||
| 28 | list.add("fff"); | 28 | list.add("fff"); |
| 29 | list.add("fff"); | 29 | list.add("fff"); |
| 30 | list.add("fff"); | 30 | list.add("fff"); |
| 31 | - fragment.binding.myRecordRecy.setAdapter(new MyRecordAdapter(list,fragment.getActivity())); | 31 | + fragment.binding.myRecordRecy.setAdapter(new MyRecordAdapter(list,fragment.getActivity(),true)); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | public void initView(){ | 34 | public void initView(){ |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunLineActivity.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.ui.activity; | ||
| 2 | + | ||
| 3 | +import android.support.v7.app.AppCompatActivity; | ||
| 4 | +import android.os.Bundle; | ||
| 5 | + | ||
| 6 | +import com.cnlive.libs.base.util.StatusBarUtil; | ||
| 7 | +import com.cnlive.libs.base.util.StatusBarUtil2; | ||
| 8 | +import com.cnlive.moudle.pedometer.ui.fragment.RunLineFragment; | ||
| 9 | +import com.example.moudle_pedometer.R; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 约跑线路 | ||
| 13 | + * Created by hanyayun 019/06/03. | ||
| 14 | + */ | ||
| 15 | +public class RunLineActivity extends AppCompatActivity { | ||
| 16 | + | ||
| 17 | + @Override | ||
| 18 | + protected void onCreate(Bundle savedInstanceState) { | ||
| 19 | + super.onCreate(savedInstanceState); | ||
| 20 | + StatusBarUtil.setStatusBarWrite(this); | ||
| 21 | + StatusBarUtil2.setColor(this, getResources().getColor(R.color.color_fff), 0); | ||
| 22 | + setContentView(R.layout.activity_run_line); | ||
| 23 | + | ||
| 24 | + getSupportFragmentManager().beginTransaction().replace(R.id.run_line_container, new RunLineFragment()).commit(); | ||
| 25 | + } | ||
| 26 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/MyRecordAdapter.java
| @@ -7,6 +7,8 @@ import android.support.v7.widget.RecyclerView; | @@ -7,6 +7,8 @@ import android.support.v7.widget.RecyclerView; | ||
| 7 | import android.view.LayoutInflater; | 7 | import android.view.LayoutInflater; |
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | import android.view.ViewGroup; | 9 | import android.view.ViewGroup; |
| 10 | +import android.widget.LinearLayout; | ||
| 11 | +import android.widget.RelativeLayout; | ||
| 10 | import android.widget.TextView; | 12 | import android.widget.TextView; |
| 11 | 13 | ||
| 12 | 14 | ||
| @@ -23,10 +25,17 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | @@ -23,10 +25,17 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | ||
| 23 | 25 | ||
| 24 | private List<String> list = new ArrayList<>(); | 26 | private List<String> list = new ArrayList<>(); |
| 25 | private Activity context; | 27 | private Activity context; |
| 28 | + private boolean isShow; | ||
| 29 | + private OnClickListener clickListener; | ||
| 26 | 30 | ||
| 27 | - public MyRecordAdapter(List<String> list, Activity context) { | 31 | + public void setClickListener(OnClickListener clickListener) { |
| 32 | + this.clickListener = clickListener; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public MyRecordAdapter(List<String> list, Activity context,boolean isShow) { | ||
| 28 | this.list = list; | 36 | this.list = list; |
| 29 | this.context = context; | 37 | this.context = context; |
| 38 | + this.isShow = isShow; | ||
| 30 | } | 39 | } |
| 31 | 40 | ||
| 32 | @NonNull | 41 | @NonNull |
| @@ -38,9 +47,16 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | @@ -38,9 +47,16 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | ||
| 38 | 47 | ||
| 39 | @Override | 48 | @Override |
| 40 | public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) { | 49 | public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) { |
| 50 | + if(isShow){ | ||
| 51 | + myViewHolder.my_record_ry.setVisibility(View.VISIBLE); | ||
| 52 | + }else { | ||
| 53 | + myViewHolder.my_record_ry.setVisibility(View.GONE); | ||
| 54 | + } | ||
| 41 | myViewHolder.my_record.setOnClickListener(v -> RaceRecordActivity.newInstance(context)); | 55 | myViewHolder.my_record.setOnClickListener(v -> RaceRecordActivity.newInstance(context)); |
| 42 | // myViewHolder.check_raking.setOnClickListener(v -> ); | 56 | // myViewHolder.check_raking.setOnClickListener(v -> ); |
| 43 | - | 57 | + if(clickListener != null){ |
| 58 | + myViewHolder.item_ly.setOnClickListener(v -> clickListener.onClickListener(list.get(i),i)); | ||
| 59 | + } | ||
| 44 | } | 60 | } |
| 45 | 61 | ||
| 46 | 62 | ||
| @@ -54,11 +70,20 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | @@ -54,11 +70,20 @@ public class MyRecordAdapter extends RecyclerView.Adapter<MyRecordAdapter.MyView | ||
| 54 | TextView check_raking; | 70 | TextView check_raking; |
| 55 | TextView my_record; | 71 | TextView my_record; |
| 56 | FivePersonIconView join_person; | 72 | FivePersonIconView join_person; |
| 73 | + LinearLayout item_ly; | ||
| 74 | + RelativeLayout my_record_ry; | ||
| 75 | + | ||
| 57 | public MyViewHolder(@NonNull View itemView) { | 76 | public MyViewHolder(@NonNull View itemView) { |
| 58 | super(itemView); | 77 | super(itemView); |
| 59 | check_raking = itemView.findViewById(R.id.check_raking); | 78 | check_raking = itemView.findViewById(R.id.check_raking); |
| 60 | my_record = itemView.findViewById(R.id.my_record); | 79 | my_record = itemView.findViewById(R.id.my_record); |
| 61 | join_person = itemView.findViewById(R.id.join_person); | 80 | join_person = itemView.findViewById(R.id.join_person); |
| 81 | + item_ly = itemView.findViewById(R.id.item_ly); | ||
| 82 | + my_record_ry = itemView.findViewById(R.id.my_record_ry); | ||
| 62 | } | 83 | } |
| 63 | } | 84 | } |
| 85 | + | ||
| 86 | + public interface OnClickListener{ | ||
| 87 | + void onClickListener(String msg,int position); | ||
| 88 | + } | ||
| 64 | } | 89 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunLineFragment.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.ui.fragment; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import android.content.Intent; | ||
| 5 | +import android.databinding.DataBindingUtil; | ||
| 6 | +import android.os.Bundle; | ||
| 7 | +import android.support.annotation.NonNull; | ||
| 8 | +import android.support.annotation.Nullable; | ||
| 9 | +import android.support.v4.app.Fragment; | ||
| 10 | +import android.support.v7.widget.LinearLayoutManager; | ||
| 11 | +import android.view.LayoutInflater; | ||
| 12 | +import android.view.View; | ||
| 13 | +import android.view.ViewGroup; | ||
| 14 | + | ||
| 15 | +import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity; | ||
| 16 | +import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity; | ||
| 17 | +import com.cnlive.moudle.pedometer.ui.adapter.MyRecordAdapter; | ||
| 18 | +import com.example.moudle_pedometer.R; | ||
| 19 | +import com.example.moudle_pedometer.databinding.FragmentRunLineBinding; | ||
| 20 | + | ||
| 21 | +import java.util.ArrayList; | ||
| 22 | +import java.util.List; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Created by hanyayun 019/06/03. | ||
| 26 | + */ | ||
| 27 | +public class RunLineFragment extends Fragment { | ||
| 28 | + | ||
| 29 | + private FragmentRunLineBinding binding; | ||
| 30 | + | ||
| 31 | + public RunLineFragment() { | ||
| 32 | + // Required empty public constructor | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + @Override | ||
| 37 | + public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
| 38 | + Bundle savedInstanceState) { | ||
| 39 | + // Inflate the layout for this fragment | ||
| 40 | + binding = DataBindingUtil.inflate(inflater,R.layout.fragment_run_line, container, false); | ||
| 41 | + return binding.getRoot(); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @Override | ||
| 45 | + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | ||
| 46 | + super.onViewCreated(view, savedInstanceState); | ||
| 47 | + binding.topbar.setTitle("我的活动"); | ||
| 48 | + binding.topbar.addLeftImageButton(R.drawable.top_back_black, R.id.fragment_back).setOnClickListener(v -> { | ||
| 49 | + getActivity().finish(); | ||
| 50 | + }); | ||
| 51 | + binding.topbar.addRightTextButton("我的活动",R.id.rightBtn).setOnClickListener(v -> MyRecordActivity.newInstance(getActivity())); | ||
| 52 | + List<String> list = new ArrayList<>(); | ||
| 53 | + list.add("fff"); | ||
| 54 | + list.add("fff"); | ||
| 55 | + list.add("fff"); | ||
| 56 | + list.add("fff"); | ||
| 57 | + binding.runLineRecy.setLayoutManager(new LinearLayoutManager(getActivity())); | ||
| 58 | + MyRecordAdapter myRecordAdapter = new MyRecordAdapter(list,getActivity(),false); | ||
| 59 | + binding.runLineRecy.setAdapter(myRecordAdapter); | ||
| 60 | + myRecordAdapter.setClickListener(new MyRecordAdapter.OnClickListener() { | ||
| 61 | + @Override | ||
| 62 | + public void onClickListener(String msg, int position) { | ||
| 63 | + Intent intent = new Intent(getActivity(), RunRaceDetailActivity.class); | ||
| 64 | + getActivity().startActivity(intent); | ||
| 65 | + } | ||
| 66 | + }); | ||
| 67 | + } | ||
| 68 | +} |
moudle_pedometer/src/main/res/layout/activity_run_line.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 4 | + xmlns:tools="http://schemas.android.com/tools" | ||
| 5 | + android:layout_width="match_parent" | ||
| 6 | + android:layout_height="match_parent" | ||
| 7 | + tools:context="com.cnlive.moudle.pedometer.ui.activity.RunLineActivity"> | ||
| 8 | + | ||
| 9 | + <RelativeLayout | ||
| 10 | + android:id="@+id/run_line_container" | ||
| 11 | + android:layout_width="match_parent" | ||
| 12 | + android:layout_height="match_parent"/> | ||
| 13 | +</RelativeLayout> |
moudle_pedometer/src/main/res/layout/fragment_run_line.xml
0 → 100644
| 1 | +<layout xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 2 | + | ||
| 3 | + <LinearLayout | ||
| 4 | + android:layout_width="match_parent" | ||
| 5 | + android:layout_height="match_parent" | ||
| 6 | + android:orientation="vertical"> | ||
| 7 | + | ||
| 8 | + <com.qmuiteam.qmui.widget.QMUITopBar | ||
| 9 | + android:id="@+id/topbar" | ||
| 10 | + android:layout_width="match_parent" | ||
| 11 | + android:layout_height="?attr/qmui_topbar_height" /> | ||
| 12 | + | ||
| 13 | + <android.support.v7.widget.RecyclerView | ||
| 14 | + android:id="@+id/run_line_recy" | ||
| 15 | + android:layout_width="match_parent" | ||
| 16 | + android:layout_height="match_parent" /> | ||
| 17 | + </LinearLayout> | ||
| 18 | + | ||
| 19 | +</layout> | ||
| 20 | + |
moudle_pedometer/src/main/res/layout/item_my_record.xml
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | android:layout_margin="10dp" | 7 | android:layout_margin="10dp" |
| 8 | android:background="@color/white" | 8 | android:background="@color/white" |
| 9 | android:orientation="vertical" | 9 | android:orientation="vertical" |
| 10 | + android:id="@+id/item_ly" | ||
| 10 | android:padding="10dp"> | 11 | android:padding="10dp"> |
| 11 | 12 | ||
| 12 | <TextView | 13 | <TextView |
| @@ -75,6 +76,7 @@ | @@ -75,6 +76,7 @@ | ||
| 75 | </LinearLayout> | 76 | </LinearLayout> |
| 76 | 77 | ||
| 77 | <RelativeLayout | 78 | <RelativeLayout |
| 79 | + android:id="@+id/my_record_ry" | ||
| 78 | android:layout_width="wrap_content" | 80 | android:layout_width="wrap_content" |
| 79 | android:layout_height="wrap_content" | 81 | android:layout_height="wrap_content" |
| 80 | android:layout_marginTop="10dp"> | 82 | android:layout_marginTop="10dp"> |