Commit ecc56fa8da9387bb84a328e3bbe3590c5e6594fd
1 parent
84aba0cd
Exists in
yxb_dev
and in
2 other branches
no message
Showing
10 changed files
with
278 additions
and
87 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java
... | ... | @@ -8,21 +8,34 @@ import android.support.v7.widget.LinearLayoutManager; |
8 | 8 | import android.support.v7.widget.RecyclerView; |
9 | 9 | import android.view.View; |
10 | 10 | |
11 | +import com.amy.monthweek.materialcalendarview.MonthWeekMaterialCalendarView; | |
12 | +import com.prolificinteractive.materialcalendarview.CalendarDay; | |
13 | +import com.prolificinteractive.materialcalendarview.MaterialCalendarView; | |
11 | 14 | import com.share.mvpsdk.base.BasePresenter; |
12 | 15 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
16 | +import com.share.mvpsdk.utils.ToastUtils; | |
13 | 17 | import com.shunzhi.parent.R; |
14 | 18 | import com.shunzhi.parent.adapter.ReportAdapter; |
15 | 19 | import com.shunzhi.parent.bean.ReportBean; |
16 | 20 | import com.shunzhi.parent.contract.report.ReportContract; |
17 | 21 | import com.shunzhi.parent.presenter.report.ReportPresenter; |
22 | +import com.shunzhi.parent.views.CustomLinearLayoutManager; | |
18 | 23 | |
24 | +import java.util.Calendar; | |
25 | +import java.util.Date; | |
19 | 26 | import java.util.List; |
20 | 27 | |
21 | -public class ReportFragment extends BaseMVPCompatFragment <ReportContract.ReportPresenter,ReportContract.IReportModel> | |
22 | -implements ReportContract.IReportView{ | |
28 | +public class ReportFragment extends BaseMVPCompatFragment<ReportContract.ReportPresenter, ReportContract.IReportModel> | |
29 | + implements ReportContract.IReportView { | |
23 | 30 | RecyclerView recyclerView; |
24 | 31 | ReportAdapter reportAdapter; |
25 | 32 | |
33 | + MonthWeekMaterialCalendarView monthWeekMaterialCalendarView = null; | |
34 | + | |
35 | + private CalendarDay selectedDate; | |
36 | + | |
37 | + MaterialCalendarView calendarView_month_mode; | |
38 | + | |
26 | 39 | @NonNull |
27 | 40 | @Override |
28 | 41 | public BasePresenter initPresenter() { |
... | ... | @@ -37,18 +50,52 @@ implements ReportContract.IReportView{ |
37 | 50 | @Override |
38 | 51 | public void initUI(View view, @Nullable Bundle savedInstanceState) { |
39 | 52 | recyclerView = view.findViewById(R.id.recycle_report); |
40 | - recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); | |
53 | + calendarView_month_mode=view.findViewById(R.id.calendarView_month_mode); | |
54 | + | |
55 | + LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); | |
56 | + layoutManager.setOrientation(LinearLayoutManager.VERTICAL); | |
57 | + recyclerView.setLayoutManager(new CustomLinearLayoutManager(getActivity(), | |
58 | + LinearLayoutManager.VERTICAL, false)); | |
59 | + recyclerView.setHasFixedSize(true); | |
60 | + monthWeekMaterialCalendarView = view.findViewById(R.id.slidelayout); | |
61 | + initCalendarView(); | |
41 | 62 | initReportList(); |
42 | 63 | |
43 | 64 | } |
44 | 65 | |
66 | + private void initCalendarView() { | |
67 | +// month_week_CalendarView.setMode(MonthWeekMaterialCalendarView.Mode.MONTH); | |
68 | + selectedDate = CalendarDay.today(); | |
69 | + monthWeekMaterialCalendarView.setMode(MonthWeekMaterialCalendarView.Mode.WEEK); | |
70 | + monthWeekMaterialCalendarView.setCurrentDate(selectedDate); | |
71 | + monthWeekMaterialCalendarView.setSelectedDate(selectedDate); | |
72 | + monthWeekMaterialCalendarView.state().edit().setSlideModeChangeListener(new MonthWeekMaterialCalendarView.SlideModeChangeListener() { | |
73 | + @Override | |
74 | + public void modeChange(MonthWeekMaterialCalendarView.Mode mode) { | |
75 | + | |
76 | + } | |
77 | + }).setSlideDateSelectedlistener(new MonthWeekMaterialCalendarView.SlideDateSelectedlistener() { | |
78 | + @Override | |
79 | + public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) { | |
80 | + selectedDate = date; | |
81 | + | |
82 | + } | |
83 | + }).setSlideOnMonthChangedListener(new MonthWeekMaterialCalendarView.SlideOnMonthChangedListener() { | |
84 | + @Override | |
85 | + public void onMonthChanged(MaterialCalendarView widget, CalendarDay date) { | |
86 | + | |
87 | + } | |
88 | + }).commit(); | |
89 | + | |
90 | + } | |
91 | + | |
45 | 92 | private void initReportList() { |
46 | 93 | mPresenter.reportResult(); |
47 | 94 | } |
48 | 95 | |
49 | 96 | @Override |
50 | 97 | public void UpdateList(List<ReportBean> list) { |
51 | - reportAdapter=new ReportAdapter(getActivity()); | |
98 | + reportAdapter = new ReportAdapter(getActivity()); | |
52 | 99 | reportAdapter.addAll(list); |
53 | 100 | recyclerView.setAdapter(reportAdapter); |
54 | 101 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/views/CustomLinearLayoutManager.java
0 → 100644
... | ... | @@ -0,0 +1,37 @@ |
1 | +package com.shunzhi.parent.views; | |
2 | + | |
3 | +import android.content.Context; | |
4 | +import android.support.v7.widget.LinearLayoutManager; | |
5 | +import android.util.AttributeSet; | |
6 | + | |
7 | +import com.amy.monthweek.materialcalendarview.ILayoutManager; | |
8 | + | |
9 | +/** | |
10 | + * Created by ToaHanDong on 2018/3/15. | |
11 | + */ | |
12 | + | |
13 | +public class CustomLinearLayoutManager extends LinearLayoutManager implements ILayoutManager { | |
14 | + | |
15 | + private boolean isScrollEnabled = true; | |
16 | + | |
17 | + public CustomLinearLayoutManager(Context context) { | |
18 | + super(context); | |
19 | + } | |
20 | + | |
21 | + public CustomLinearLayoutManager(Context context, int orientation, boolean reverseLayout) { | |
22 | + super(context, orientation, reverseLayout); | |
23 | + } | |
24 | + | |
25 | + public CustomLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { | |
26 | + super(context, attrs, defStyleAttr, defStyleRes); | |
27 | + } | |
28 | + @Override | |
29 | + public void setScrollEnabled(boolean enabled) { | |
30 | + this.isScrollEnabled = enabled; | |
31 | + } | |
32 | + | |
33 | + @Override | |
34 | + public boolean canScrollVertically() { | |
35 | + return isScrollEnabled && super.canScrollVertically(); | |
36 | + } | |
37 | +} | ... | ... |
app/src/main/res/layout/fragment_ce_ping.xml
app/src/main/res/layout/fragment_report.xml
... | ... | @@ -2,72 +2,161 @@ |
2 | 2 | xmlns:tools="http://schemas.android.com/tools" |
3 | 3 | android:layout_width="match_parent" |
4 | 4 | android:layout_height="match_parent" |
5 | + android:background="@color/bgColor" | |
5 | 6 | android:orientation="vertical" |
6 | 7 | tools:context="com.shunzhi.parent.ui.fragment.ReportFragment"> |
7 | 8 | |
8 | - <!-- TODO: Update blank fragment layout --> | |
9 | -<LinearLayout | |
10 | - android:layout_width="match_parent" | |
11 | - android:layout_height="match_parent" | |
12 | - android:orientation="vertical" | |
13 | - > | |
14 | -<LinearLayout | |
15 | - android:id="@+id/top_layout" | |
16 | - android:layout_width="match_parent" | |
17 | - android:layout_height="?android:actionBarSize" | |
18 | - android:orientation="horizontal" | |
19 | - android:padding="10dp" | |
20 | - android:background="@color/back_top" | |
21 | - > | |
22 | - | |
23 | - <TextView | |
24 | - android:layout_width="wrap_content" | |
25 | - android:layout_height="wrap_content" | |
26 | - android:text="马铂骞" | |
27 | - android:drawableRight="@drawable/pull" | |
28 | - android:drawablePadding="10dp" | |
29 | - android:textColor="@color/textColor" | |
30 | - android:textSize="@dimen/textSize16" | |
31 | - android:layout_gravity="center_vertical" | |
32 | - /> | |
33 | -<TextView | |
34 | - android:layout_width="wrap_content" | |
35 | - android:layout_height="wrap_content" | |
36 | - android:layout_weight="1" | |
37 | - android:text="2018年3月" | |
38 | - android:gravity="center_horizontal" | |
39 | - android:layout_gravity="center_vertical" | |
40 | - android:textColor="@color/textColor" | |
41 | - android:textSize="@dimen/textSize16" | |
42 | - /> | |
43 | - <TextView | |
44 | - android:layout_width="wrap_content" | |
45 | - android:layout_height="wrap_content" | |
46 | - android:text="筛选" | |
47 | - android:layout_gravity="center_vertical" | |
48 | - android:textColor="@color/textColor" | |
49 | - android:textSize="@dimen/textSize16" | |
50 | - android:drawableRight="@drawable/screen" | |
51 | - /> | |
52 | -</LinearLayout> | |
53 | -<LinearLayout | |
54 | - android:layout_width="match_parent" | |
55 | - android:layout_height="60dp"> | |
56 | -<TextView | |
57 | - android:layout_width="match_parent" | |
58 | - android:layout_height="match_parent" | |
59 | - android:text="日期控件" | |
60 | - android:textColor="@color/white" | |
61 | - android:gravity="center" | |
62 | - android:background="@color/textRed" | |
63 | - /> | |
9 | + <LinearLayout | |
10 | + android:id="@+id/top_layout" | |
11 | + android:layout_width="match_parent" | |
12 | + android:layout_height="?android:actionBarSize" | |
13 | + android:background="@color/back_top" | |
14 | + android:orientation="horizontal" | |
15 | + android:padding="10dp"> | |
64 | 16 | |
65 | -</LinearLayout> | |
66 | -<android.support.v7.widget.RecyclerView | |
67 | - android:id="@+id/recycle_report" | |
68 | - android:layout_width="match_parent" | |
69 | - android:layout_height="match_parent"> | |
17 | + <TextView | |
18 | + android:layout_width="wrap_content" | |
19 | + android:layout_height="wrap_content" | |
20 | + android:layout_gravity="center_vertical" | |
21 | + android:drawablePadding="10dp" | |
22 | + android:drawableRight="@drawable/pull" | |
23 | + android:text="马铂骞" | |
24 | + android:textColor="@color/textColor" | |
25 | + android:textSize="@dimen/textSize16" /> | |
26 | + | |
27 | + <TextView | |
28 | + android:layout_width="wrap_content" | |
29 | + android:layout_height="wrap_content" | |
30 | + android:layout_gravity="center_vertical" | |
31 | + android:layout_weight="1" | |
32 | + android:gravity="center_horizontal" | |
33 | + android:text="2018年3月" | |
34 | + android:textColor="@color/textColor" | |
35 | + android:textSize="@dimen/textSize16" /> | |
36 | + | |
37 | + <TextView | |
38 | + android:layout_width="wrap_content" | |
39 | + android:layout_height="wrap_content" | |
40 | + android:layout_gravity="center_vertical" | |
41 | + android:drawableRight="@drawable/screen" | |
42 | + android:text="筛选" | |
43 | + android:textColor="@color/textColor" | |
44 | + android:textSize="@dimen/textSize16" /> | |
45 | + </LinearLayout> | |
46 | + | |
47 | + <LinearLayout | |
48 | + android:layout_width="match_parent" | |
49 | + android:layout_height="match_parent" | |
50 | + android:orientation="vertical"> | |
51 | + | |
52 | + <!--<include layout="@layout/layout_week" /> android:layout_below="@+id/linearlayout"--> | |
53 | + | |
54 | + <com.amy.monthweek.materialcalendarview.MonthWeekMaterialCalendarView xmlns:app="http://schemas.android.com/apk/res-auto" | |
55 | + android:id="@+id/slidelayout" | |
56 | + android:layout_width="match_parent" | |
57 | + android:layout_height="match_parent"> | |
58 | + | |
59 | + <com.prolificinteractive.materialcalendarview.MaterialCalendarView | |
60 | + android:id="@+id/calendarView_month_mode" | |
61 | + android:layout_width="match_parent" | |
62 | + android:layout_height="wrap_content" | |
63 | + android:background="@color/white" | |
64 | + app:mcv_calendarMode="month" | |
65 | + app:mcv_dateTextAppearance="@style/TextAppearance.MaterialCalendarWidget.Date" | |
66 | + app:mcv_selectionColor="@color/huodong_blue" | |
67 | + app:mcv_showOtherDates="defaults|other_months" | |
68 | + app:mcv_showWeekView="false" /> | |
69 | + | |
70 | + <com.prolificinteractive.materialcalendarview.MaterialCalendarView | |
71 | + android:id="@+id/calendarView_week_mode" | |
72 | + android:layout_width="match_parent" | |
73 | + android:layout_height="wrap_content" | |
74 | + android:background="@android:color/white" | |
75 | + android:visibility="invisible" | |
76 | + app:mcv_calendarMode="week" | |
77 | + app:mcv_dateTextAppearance="@style/TextAppearance.MaterialCalendarWidget.Date" | |
78 | + app:mcv_selectionColor="@color/huodong_blue" | |
79 | + app:mcv_showTopBar="false" | |
80 | + app:mcv_showWeekView="false" | |
81 | + /> | |
82 | + | |
83 | + | |
84 | + <android.support.v7.widget.RecyclerView | |
85 | + android:id="@+id/recycle_report" | |
86 | + android:layout_width="match_parent" | |
87 | + android:layout_height="match_parent" | |
88 | + android:background="@color/bgColor" | |
89 | + android:padding="@dimen/size_dp_10"> | |
90 | + | |
91 | + </android.support.v7.widget.RecyclerView> | |
92 | + | |
93 | + <LinearLayout | |
94 | + android:id="@+id/weekview_top" | |
95 | + android:layout_width="match_parent" | |
96 | + android:layout_height="44dp" | |
97 | + android:background="@color/white" | |
98 | + android:orientation="horizontal"> | |
99 | + | |
100 | + <TextView | |
101 | + android:layout_width="0dp" | |
102 | + android:layout_height="match_parent" | |
103 | + android:layout_weight="1" | |
104 | + android:gravity="center" | |
105 | + android:text="周日" | |
106 | + android:textSize="@dimen/textSize16" /> | |
107 | + | |
108 | + <TextView | |
109 | + android:layout_width="0dp" | |
110 | + android:layout_height="match_parent" | |
111 | + android:layout_weight="1" | |
112 | + android:gravity="center" | |
113 | + android:text="周一" | |
114 | + android:textSize="@dimen/textSize16" /> | |
115 | + | |
116 | + <TextView | |
117 | + android:layout_width="0dp" | |
118 | + android:layout_height="match_parent" | |
119 | + android:layout_weight="1" | |
120 | + android:gravity="center" | |
121 | + android:text="周二" | |
122 | + android:textSize="@dimen/textSize16" /> | |
123 | + | |
124 | + <TextView | |
125 | + android:layout_width="0dp" | |
126 | + android:layout_height="match_parent" | |
127 | + android:layout_weight="1" | |
128 | + android:gravity="center" | |
129 | + android:text="周三" | |
130 | + android:textSize="@dimen/textSize16" /> | |
131 | + | |
132 | + <TextView | |
133 | + android:layout_width="0dp" | |
134 | + android:layout_height="match_parent" | |
135 | + android:layout_weight="1" | |
136 | + android:gravity="center" | |
137 | + android:text="周四" | |
138 | + android:textSize="@dimen/textSize16" /> | |
139 | + | |
140 | + <TextView | |
141 | + android:layout_width="0dp" | |
142 | + android:layout_height="match_parent" | |
143 | + android:layout_weight="1" | |
144 | + android:gravity="center" | |
145 | + android:text="周五" | |
146 | + android:textSize="@dimen/textSize16" /> | |
147 | + | |
148 | + <TextView | |
149 | + android:layout_width="0dp" | |
150 | + android:layout_height="match_parent" | |
151 | + android:layout_weight="1" | |
152 | + android:gravity="center" | |
153 | + android:text="周六" | |
154 | + android:textSize="@dimen/textSize16" /> | |
155 | + | |
156 | + </LinearLayout> | |
157 | + | |
158 | + </com.amy.monthweek.materialcalendarview.MonthWeekMaterialCalendarView> | |
159 | + | |
160 | + </LinearLayout> | |
70 | 161 | |
71 | -</android.support.v7.widget.RecyclerView> | |
72 | -</LinearLayout> | |
73 | 162 | </LinearLayout> | ... | ... |
app/src/main/res/layout/item_report.xml
... | ... | @@ -3,10 +3,10 @@ |
3 | 3 | android:layout_width="match_parent" |
4 | 4 | android:layout_height="match_parent"> |
5 | 5 | |
6 | - <LinearLayout | |
6 | + <LinearLayout | |
7 | + android:layout_marginTop="@dimen/size_dp_10" | |
7 | 8 | android:layout_width="match_parent" |
8 | 9 | android:layout_height="250dp" |
9 | - android:layout_margin="20dp" | |
10 | 10 | android:background="@drawable/report_white" |
11 | 11 | android:orientation="vertical"> |
12 | 12 | |
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | android:textColor="#20519f" |
21 | 21 | android:textSize="@dimen/sp_16" /> |
22 | 22 | |
23 | - <RelativeLayout | |
23 | + <RelativeLayout | |
24 | 24 | android:layout_width="match_parent" |
25 | 25 | android:layout_height="wrap_content" |
26 | 26 | android:layout_weight="1" |
... | ... | @@ -52,10 +52,10 @@ |
52 | 52 | <LinearLayout |
53 | 53 | android:layout_width="wrap_content" |
54 | 54 | android:layout_height="match_parent" |
55 | - android:layout_weight="1" | |
56 | 55 | android:layout_centerInParent="true" |
57 | - android:gravity="center_horizontal" | |
58 | - > | |
56 | + android:layout_weight="1" | |
57 | + android:gravity="center_horizontal"> | |
58 | + | |
59 | 59 | <com.shunzhi.parent.views.ProgressView |
60 | 60 | android:id="@+id/ring" |
61 | 61 | android:layout_width="160dp" |
... | ... | @@ -66,8 +66,8 @@ |
66 | 66 | <LinearLayout |
67 | 67 | android:layout_width="80dp" |
68 | 68 | android:layout_height="match_parent" |
69 | - android:layout_marginTop="10dp" | |
70 | 69 | android:layout_alignParentRight="true" |
70 | + android:layout_marginTop="10dp" | |
71 | 71 | android:orientation="vertical"> |
72 | 72 | |
73 | 73 | <TextView | ... | ... |
app/src/main/res/layout/layout_consult_content.xml
... | ... | @@ -6,14 +6,13 @@ |
6 | 6 | <LinearLayout |
7 | 7 | android:layout_width="match_parent" |
8 | 8 | android:layout_height="match_parent" |
9 | - android:layout_marginLeft="@dimen/size_dp_10" | |
10 | - android:layout_marginRight="@dimen/size_dp_10" | |
11 | - android:background="@color/white"> | |
9 | + android:background="@drawable/report_white"> | |
12 | 10 | |
13 | 11 | <LinearLayout |
14 | 12 | android:layout_width="0dp" |
15 | 13 | android:layout_height="match_parent" |
16 | 14 | android:layout_weight="4" |
15 | + android:elevation="@dimen/size_dp_3" | |
17 | 16 | android:orientation="vertical" |
18 | 17 | android:padding="@dimen/size_dp_5"> |
19 | 18 | ... | ... |
app/src/main/res/layout/layout_textandimgshow.xml
... | ... | @@ -17,7 +17,8 @@ |
17 | 17 | android:layout_height="wrap_content" |
18 | 18 | android:layout_marginBottom="@dimen/size_dp_5" |
19 | 19 | android:layout_marginTop="@dimen/size_dp_5" |
20 | - android:background="@color/white" | |
20 | + android:background="@drawable/report_white" | |
21 | + android:elevation="@dimen/size_dp_3" | |
21 | 22 | android:orientation="horizontal" |
22 | 23 | android:padding="@dimen/size_dp_10"> |
23 | 24 | ... | ... |
app/src/main/res/layout/layout_week.xml
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | -<android.support.constraint.ConstraintLayout | |
2 | +<com.amy.monthweek.materialcalendarview.MonthWeekMaterialCalendarView | |
3 | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
4 | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
6 | + android:id="@+id/slidelayout" | |
5 | 7 | android:layout_width="match_parent" |
6 | 8 | android:layout_height="match_parent"> |
7 | 9 | |
8 | - <CalendarView | |
9 | - android:id="@+id/calendarView" | |
10 | + <com.prolificinteractive.materialcalendarview.MaterialCalendarView | |
11 | + android:id="@+id/calendarView_month_mode" | |
10 | 12 | android:layout_width="match_parent" |
11 | 13 | android:layout_height="wrap_content" |
12 | - tools:layout_editor_absoluteX="0dp" | |
13 | - tools:layout_editor_absoluteY="0dp" | |
14 | - tools:ignore="MissingConstraints" /> | |
15 | -</android.support.constraint.ConstraintLayout> | |
16 | 14 | \ No newline at end of file |
15 | + app:mcv_calendarMode="month" | |
16 | + app:mcv_showOtherDates="other_months" | |
17 | + app:mcv_showWeekView="false" | |
18 | + /> | |
19 | + | |
20 | + <com.prolificinteractive.materialcalendarview.MaterialCalendarView | |
21 | + android:id="@+id/calendarView_week_mode" | |
22 | + android:layout_width="match_parent" | |
23 | + android:layout_height="wrap_content" | |
24 | + android:background="@android:color/white" | |
25 | + android:visibility="invisible" | |
26 | + app:mcv_calendarMode="week" | |
27 | + app:mcv_showTopBar="false" | |
28 | + app:mcv_showWeekView="false" /> | |
29 | + | |
30 | +</com.amy.monthweek.materialcalendarview.MonthWeekMaterialCalendarView> | |
17 | 31 | \ No newline at end of file | ... | ... |
build.gradle
mvpsdk/build.gradle