Commit 762b1b1da72de54f203446f8af8de9456440ff56
Exists in
yxb_dev
and in
2 other branches
Merge branch 'developer' of http://git.shunzhi.net/taohd/parentwork into developer
Showing
32 changed files
with
1590 additions
and
45 deletions
Show diff stats
.idea/modules.xml
@@ -4,8 +4,8 @@ | @@ -4,8 +4,8 @@ | ||
4 | <modules> | 4 | <modules> |
5 | <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> | 5 | <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> |
6 | <module fileurl="file://$PROJECT_DIR$/mvpsdk/mvpsdk.iml" filepath="$PROJECT_DIR$/mvpsdk/mvpsdk.iml" /> | 6 | <module fileurl="file://$PROJECT_DIR$/mvpsdk/mvpsdk.iml" filepath="$PROJECT_DIR$/mvpsdk/mvpsdk.iml" /> |
7 | - <module fileurl="file://$PROJECT_DIR$/parentWorkHolper.iml" filepath="$PROJECT_DIR$/parentWorkHolper.iml" /> | ||
8 | <module fileurl="file://E:\parentwork\parentWorkHolper.iml" filepath="E:\parentwork\parentWorkHolper.iml" /> | 7 | <module fileurl="file://E:\parentwork\parentWorkHolper.iml" filepath="E:\parentwork\parentWorkHolper.iml" /> |
8 | + <module fileurl="file://$PROJECT_DIR$/parentwork.iml" filepath="$PROJECT_DIR$/parentwork.iml" /> | ||
9 | <module fileurl="file://F:\parentWorkHolper\parentwork.iml" filepath="F:\parentWorkHolper\parentwork.iml" /> | 9 | <module fileurl="file://F:\parentWorkHolper\parentwork.iml" filepath="F:\parentWorkHolper\parentwork.iml" /> |
10 | <module fileurl="file://$PROJECT_DIR$/processor/processor.iml" filepath="$PROJECT_DIR$/processor/processor.iml" /> | 10 | <module fileurl="file://$PROJECT_DIR$/processor/processor.iml" filepath="$PROJECT_DIR$/processor/processor.iml" /> |
11 | <module fileurl="file://$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" filepath="$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" /> | 11 | <module fileurl="file://$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" filepath="$PROJECT_DIR$/roundedimageview-2.2.1/roundedimageview-2.2.1.iml" /> |
app/src/main/AndroidManifest.xml
@@ -186,6 +186,12 @@ | @@ -186,6 +186,12 @@ | ||
186 | <activity | 186 | <activity |
187 | android:name=".ui.activity.orderdetail.OrderDetailActivity" | 187 | android:name=".ui.activity.orderdetail.OrderDetailActivity" |
188 | android:launchMode="singleInstance" /> | 188 | android:launchMode="singleInstance" /> |
189 | + <activity | ||
190 | + android:name=".ui.activity.report.ReportDetialActivity" | ||
191 | + android:launchMode="singleInstance" /> | ||
192 | + <activity | ||
193 | + android:name=".ui.activity.report.ReportSceneActivity" | ||
194 | + android:launchMode="singleInstance" /> | ||
189 | 195 | ||
190 | <service | 196 | <service |
191 | android:name=".ui.service.BadgeIntentService" | 197 | android:name=".ui.service.BadgeIntentService" |
app/src/main/java/com/shunzhi/parent/adapter/ChildAdapter.java
@@ -33,7 +33,7 @@ public class ChildAdapter extends BaseRecyclerViewAdapter<ChildBean> { | @@ -33,7 +33,7 @@ public class ChildAdapter extends BaseRecyclerViewAdapter<ChildBean> { | ||
33 | 33 | ||
34 | @Override | 34 | @Override |
35 | public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 35 | public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
36 | - View view = LayoutInflater.from(context).inflate(R.layout.item_childlist, null); | 36 | + View view = LayoutInflater.from(context).inflate(R.layout.item_childlist, parent,false); |
37 | return new MyViewHolder(view); | 37 | return new MyViewHolder(view); |
38 | } | 38 | } |
39 | 39 |
app/src/main/java/com/shunzhi/parent/adapter/DeyuDetialAdapter.java
0 → 100644
@@ -0,0 +1,52 @@ | @@ -0,0 +1,52 @@ | ||
1 | +package com.shunzhi.parent.adapter; | ||
2 | + | ||
3 | +import android.content.Context; | ||
4 | +import android.content.Intent; | ||
5 | +import android.view.LayoutInflater; | ||
6 | +import android.view.View; | ||
7 | +import android.view.ViewGroup; | ||
8 | + | ||
9 | +import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; | ||
10 | +import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; | ||
11 | +import com.shunzhi.parent.R; | ||
12 | +import com.shunzhi.parent.bean.report.DeyuDetialBean; | ||
13 | +import com.shunzhi.parent.ui.activity.report.ReportSceneActivity; | ||
14 | + | ||
15 | +/** | ||
16 | + * Created by Administrator on 2018/3/28 0028. | ||
17 | + */ | ||
18 | + | ||
19 | +public class DeyuDetialAdapter extends BaseRecyclerViewAdapter<DeyuDetialBean> { | ||
20 | + private Context mContext = null; | ||
21 | + | ||
22 | + public DeyuDetialAdapter(Context context) { | ||
23 | + mContext = context; | ||
24 | + } | ||
25 | + | ||
26 | + | ||
27 | + @Override | ||
28 | + public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
29 | + View view = LayoutInflater.from(mContext).inflate(R.layout.item_deyu_detial, parent, false); | ||
30 | + return new DeyuDetialAdapter.DeyuDetialViewHolder(view); | ||
31 | + } | ||
32 | + | ||
33 | + private class DeyuDetialViewHolder extends BaseRecyclerViewHolder<DeyuDetialBean> { | ||
34 | + | ||
35 | + | ||
36 | + public DeyuDetialViewHolder(View itemView) { | ||
37 | + super(itemView); | ||
38 | + | ||
39 | + } | ||
40 | + | ||
41 | + @Override | ||
42 | + public void onBindViewHolder(final DeyuDetialBean object, int position) { | ||
43 | + itemView.setOnClickListener(new View.OnClickListener() { | ||
44 | + @Override | ||
45 | + public void onClick(View v) { | ||
46 | + mContext.startActivity(new Intent().setClass(mContext, ReportSceneActivity.class)); | ||
47 | + } | ||
48 | + }); | ||
49 | + | ||
50 | + } | ||
51 | + } | ||
52 | +} |
app/src/main/java/com/shunzhi/parent/adapter/ReportAdapter.java
@@ -2,15 +2,17 @@ package com.shunzhi.parent.adapter; | @@ -2,15 +2,17 @@ package com.shunzhi.parent.adapter; | ||
2 | 2 | ||
3 | 3 | ||
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | +import android.content.Intent; | ||
5 | import android.view.LayoutInflater; | 6 | import android.view.LayoutInflater; |
6 | import android.view.View; | 7 | import android.view.View; |
7 | import android.view.ViewGroup; | 8 | import android.view.ViewGroup; |
9 | +import android.widget.LinearLayout; | ||
8 | 10 | ||
9 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; | 11 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; |
10 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; | 12 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; |
11 | import com.shunzhi.parent.R; | 13 | import com.shunzhi.parent.R; |
12 | import com.shunzhi.parent.bean.ReportBean; | 14 | import com.shunzhi.parent.bean.ReportBean; |
13 | -import com.shunzhi.parent.views.ProgressView; | 15 | +import com.shunzhi.parent.ui.activity.report.ReportDetialActivity; |
14 | 16 | ||
15 | /** | 17 | /** |
16 | * Created by Administrator on 2018/3/9 0009. | 18 | * Created by Administrator on 2018/3/9 0009. |
@@ -27,25 +29,32 @@ public class ReportAdapter extends BaseRecyclerViewAdapter<ReportBean> { | @@ -27,25 +29,32 @@ public class ReportAdapter extends BaseRecyclerViewAdapter<ReportBean> { | ||
27 | 29 | ||
28 | @Override | 30 | @Override |
29 | public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 31 | public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
30 | - View view = LayoutInflater.from(context).inflate(R.layout.item_report, null); | 32 | + View view = LayoutInflater.from(context).inflate(R.layout.item_report_deyu, parent,false); |
31 | return new MyViewHolder(view); | 33 | return new MyViewHolder(view); |
32 | } | 34 | } |
33 | 35 | ||
34 | private class MyViewHolder extends BaseRecyclerViewHolder<ReportBean> { | 36 | private class MyViewHolder extends BaseRecyclerViewHolder<ReportBean> { |
35 | 37 | ||
36 | - ProgressView ringView; | ||
37 | - | 38 | + // ProgressView ringView; |
39 | + LinearLayout deyu_content; | ||
38 | 40 | ||
39 | public MyViewHolder(View view) { | 41 | public MyViewHolder(View view) { |
40 | super(view); | 42 | super(view); |
41 | - ringView = view.findViewById(R.id.ring); | 43 | +// ringView = view.findViewById(R.id.ring); |
44 | + deyu_content = view.findViewById(R.id.deyu_content); | ||
42 | } | 45 | } |
43 | 46 | ||
44 | @Override | 47 | @Override |
45 | public void onBindViewHolder(ReportBean object, int position) { | 48 | public void onBindViewHolder(ReportBean object, int position) { |
46 | - ringView.setMaxCount(100.0f); | ||
47 | - ringView.setCurrentCount(100); | ||
48 | - ringView.setScore(100); | 49 | +// ringView.setMaxCount(100.0f); |
50 | +// ringView.setCurrentCount(100); | ||
51 | +// ringView.setScore(100); | ||
52 | + deyu_content.setOnClickListener(new View.OnClickListener() { | ||
53 | + @Override | ||
54 | + public void onClick(View v) { | ||
55 | + context.startActivity(new Intent().setClass(context, ReportDetialActivity.class)); | ||
56 | + } | ||
57 | + }); | ||
49 | } | 58 | } |
50 | 59 | ||
51 | } | 60 | } |
app/src/main/java/com/shunzhi/parent/adapter/SchoolListAdapter.java
@@ -51,7 +51,7 @@ public class SchoolListAdapter extends BaseRecyclerViewAdapter<SortBean> { | @@ -51,7 +51,7 @@ public class SchoolListAdapter extends BaseRecyclerViewAdapter<SortBean> { | ||
51 | 51 | ||
52 | @Override | 52 | @Override |
53 | public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 53 | public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
54 | - View view = LayoutInflater.from(context).inflate(R.layout.item_school, null); | 54 | + View view = LayoutInflater.from(context).inflate(R.layout.item_school, parent,false); |
55 | return new MyViewHolder(view); | 55 | return new MyViewHolder(view); |
56 | } | 56 | } |
57 | 57 |
app/src/main/java/com/shunzhi/parent/bean/report/DeyuDetialBean.java
0 → 100644
app/src/main/java/com/shunzhi/parent/ui/activity/report/ReportDetialActivity.java
0 → 100644
@@ -0,0 +1,72 @@ | @@ -0,0 +1,72 @@ | ||
1 | +package com.shunzhi.parent.ui.activity.report; | ||
2 | + | ||
3 | +import android.content.Context; | ||
4 | +import android.content.Intent; | ||
5 | +import android.os.Bundle; | ||
6 | +import android.support.annotation.NonNull; | ||
7 | +import android.support.v4.app.FragmentTransaction; | ||
8 | +import android.view.View; | ||
9 | +import android.widget.FrameLayout; | ||
10 | +import android.widget.ImageView; | ||
11 | +import android.widget.TextView; | ||
12 | + | ||
13 | +import com.share.mvpsdk.base.BasePresenter; | ||
14 | +import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; | ||
15 | +import com.shunzhi.parent.R; | ||
16 | +import com.shunzhi.parent.ui.fragment.report.ReportDetialFragment; | ||
17 | + | ||
18 | +/** | ||
19 | + * Created by Administrator on 2018/3/28 0028. | ||
20 | + */ | ||
21 | + | ||
22 | +public class ReportDetialActivity extends BaseMVPCompatActivity implements View.OnClickListener{ | ||
23 | + public static void getInstance(Context context) { | ||
24 | + Intent intent = new Intent(context, ReportDetialActivity.class); | ||
25 | + context.startActivity(intent); | ||
26 | + } | ||
27 | + | ||
28 | + TextView center_title; | ||
29 | + | ||
30 | + ImageView ivBack; | ||
31 | + | ||
32 | + FrameLayout frame_detial; | ||
33 | + | ||
34 | + FragmentTransaction fragmentTransaction = null; | ||
35 | + | ||
36 | + ReportDetialFragment reportDetialFragment = null; | ||
37 | + | ||
38 | + @NonNull | ||
39 | + @Override | ||
40 | + public BasePresenter initPresenter() { | ||
41 | + return null; | ||
42 | + } | ||
43 | + | ||
44 | + @Override | ||
45 | + protected void initView(Bundle savedInstanceState) { | ||
46 | + initViews(); | ||
47 | + } | ||
48 | + | ||
49 | + private void initViews() { | ||
50 | + reportDetialFragment = new ReportDetialFragment(); | ||
51 | + ivBack = findViewById(R.id.back_top); | ||
52 | + frame_detial = findViewById(R.id.frame_detial); | ||
53 | + center_title = findViewById(R.id.center_title); | ||
54 | + center_title.setText("德育报告"); | ||
55 | + ivBack.setOnClickListener(this); | ||
56 | + | ||
57 | + fragmentTransaction = getSupportFragmentManager().beginTransaction(); | ||
58 | + fragmentTransaction.add(R.id.frame_detial, reportDetialFragment) | ||
59 | + .show(reportDetialFragment).commit(); | ||
60 | + | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + protected int getLayoutId() { | ||
65 | + return R.layout.activity_report_detial; | ||
66 | + } | ||
67 | + | ||
68 | + @Override | ||
69 | + public void onClick(View v) { | ||
70 | + finish(); | ||
71 | + } | ||
72 | +} |
app/src/main/java/com/shunzhi/parent/ui/activity/report/ReportSceneActivity.java
0 → 100644
@@ -0,0 +1,70 @@ | @@ -0,0 +1,70 @@ | ||
1 | +package com.shunzhi.parent.ui.activity.report; | ||
2 | + | ||
3 | +import android.content.Context; | ||
4 | +import android.content.Intent; | ||
5 | +import android.os.Bundle; | ||
6 | +import android.support.annotation.NonNull; | ||
7 | +import android.support.v4.app.FragmentTransaction; | ||
8 | +import android.view.View; | ||
9 | +import android.widget.FrameLayout; | ||
10 | +import android.widget.ImageView; | ||
11 | +import android.widget.TextView; | ||
12 | + | ||
13 | +import com.share.mvpsdk.base.BasePresenter; | ||
14 | +import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; | ||
15 | +import com.shunzhi.parent.R; | ||
16 | +import com.shunzhi.parent.ui.fragment.report.ReportSceneFragment; | ||
17 | + | ||
18 | +/** | ||
19 | + * Created by Administrator on 2018/3/28 0028. | ||
20 | + */ | ||
21 | + | ||
22 | +public class ReportSceneActivity extends BaseMVPCompatActivity implements View.OnClickListener{ | ||
23 | + public static void getInstance(Context context) { | ||
24 | + Intent intent = new Intent(context, ReportSceneActivity.class); | ||
25 | + context.startActivity(intent); | ||
26 | + } | ||
27 | + | ||
28 | + TextView center_title; | ||
29 | + | ||
30 | + ImageView ivBack; | ||
31 | + | ||
32 | + FrameLayout frame_scene; | ||
33 | + | ||
34 | + FragmentTransaction fragmentTransaction = null; | ||
35 | + | ||
36 | + ReportSceneFragment reportSceneFragment = null; | ||
37 | + | ||
38 | + @NonNull | ||
39 | + @Override | ||
40 | + public BasePresenter initPresenter() { | ||
41 | + return null; | ||
42 | + } | ||
43 | + | ||
44 | + @Override | ||
45 | + protected void initView(Bundle savedInstanceState) { | ||
46 | + initViews(); | ||
47 | + } | ||
48 | + private void initViews() { | ||
49 | + reportSceneFragment = new ReportSceneFragment(); | ||
50 | + ivBack = findViewById(R.id.back_top); | ||
51 | + frame_scene = findViewById(R.id.frame_scene); | ||
52 | + center_title = findViewById(R.id.center_title); | ||
53 | + center_title.setText("场景详情"); | ||
54 | + ivBack.setOnClickListener(this); | ||
55 | + | ||
56 | + fragmentTransaction = getSupportFragmentManager().beginTransaction(); | ||
57 | + fragmentTransaction.add(R.id.frame_scene, reportSceneFragment) | ||
58 | + .show(reportSceneFragment).commit(); | ||
59 | + | ||
60 | + } | ||
61 | + @Override | ||
62 | + protected int getLayoutId() { | ||
63 | + return R.layout.activity_report_scene; | ||
64 | + } | ||
65 | + | ||
66 | + @Override | ||
67 | + public void onClick(View v) { | ||
68 | + | ||
69 | + } | ||
70 | +} |
app/src/main/java/com/shunzhi/parent/ui/fragment/report/ReportDetialFragment.java
0 → 100644
@@ -0,0 +1,82 @@ | @@ -0,0 +1,82 @@ | ||
1 | +package com.shunzhi.parent.ui.fragment.report; | ||
2 | + | ||
3 | +import android.os.Bundle; | ||
4 | +import android.support.annotation.NonNull; | ||
5 | +import android.support.annotation.Nullable; | ||
6 | +import android.support.v7.widget.LinearLayoutManager; | ||
7 | +import android.support.v7.widget.RecyclerView; | ||
8 | +import android.view.View; | ||
9 | + | ||
10 | +import com.share.mvpsdk.base.BasePresenter; | ||
11 | +import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | ||
12 | +import com.share.mvpsdk.utils.DateUtils; | ||
13 | +import com.share.mvpsdk.view.chartview.ChartView; | ||
14 | +import com.share.mvpsdk.view.chartview.data.InputData; | ||
15 | +import com.shunzhi.parent.R; | ||
16 | +import com.shunzhi.parent.adapter.DeyuDetialAdapter; | ||
17 | +import com.shunzhi.parent.bean.report.DeyuDetialBean; | ||
18 | + | ||
19 | +import java.util.ArrayList; | ||
20 | +import java.util.Date; | ||
21 | +import java.util.List; | ||
22 | + | ||
23 | +/** | ||
24 | + * Created by Administrator on 2018/3/28 0028. | ||
25 | + */ | ||
26 | + | ||
27 | +public class ReportDetialFragment extends BaseMVPCompatFragment { | ||
28 | + | ||
29 | + private RecyclerView recycle_deyu; | ||
30 | + private DeyuDetialAdapter deyuDetialAdapter; | ||
31 | + List<DeyuDetialBean>list=new ArrayList<>(); | ||
32 | + | ||
33 | + private ChartView chartView; | ||
34 | + @NonNull | ||
35 | + @Override | ||
36 | + public BasePresenter initPresenter() { | ||
37 | + return null; | ||
38 | + } | ||
39 | + | ||
40 | + @Override | ||
41 | + public int getLayoutId() { | ||
42 | + return R.layout.fragment_report_detial; | ||
43 | + } | ||
44 | + | ||
45 | + @Override | ||
46 | + public void initUI(View view, @Nullable Bundle savedInstanceState) { | ||
47 | + recycle_deyu=view.findViewById(R.id.recycle_deyu); | ||
48 | + chartView=view.findViewById(R.id.chartView); | ||
49 | + recycle_deyu.setLayoutManager(new LinearLayoutManager(getActivity())); | ||
50 | + deyuDetialAdapter=new DeyuDetialAdapter(getActivity()); | ||
51 | + DeyuDetialBean deyuDetialBean=new DeyuDetialBean(); | ||
52 | + list.add(deyuDetialBean); | ||
53 | + list.add(deyuDetialBean); | ||
54 | + list.add(deyuDetialBean); | ||
55 | + deyuDetialAdapter.addAll(list); | ||
56 | + recycle_deyu.setAdapter(deyuDetialAdapter); | ||
57 | + | ||
58 | + initChartViews(); | ||
59 | + | ||
60 | + } | ||
61 | + | ||
62 | + private void initChartViews() { | ||
63 | + | ||
64 | + chartView.setColors(R.color.textColor,R.color.huodong_blue,R.color.gray); | ||
65 | + List<InputData> inputDataList=new ArrayList<>(); | ||
66 | + List<InputData> inputDataList1=new ArrayList<>(); | ||
67 | + for (int i = 0; i < 7; i++) { | ||
68 | + InputData inputData=new InputData("文明",10*i); | ||
69 | + inputDataList.add(inputData); | ||
70 | + } | ||
71 | + | ||
72 | + chartView.setChartPaths(inputDataList); | ||
73 | + | ||
74 | + for (int i = 0; i < 7; i++) { | ||
75 | + InputData inputData=new InputData("文明1",20*i); | ||
76 | + inputDataList1.add(inputData); | ||
77 | + } | ||
78 | + | ||
79 | + chartView.setChartPaths(inputDataList1); | ||
80 | + | ||
81 | + } | ||
82 | +} |
app/src/main/java/com/shunzhi/parent/ui/fragment/report/ReportSceneFragment.java
0 → 100644
@@ -0,0 +1,34 @@ | @@ -0,0 +1,34 @@ | ||
1 | +package com.shunzhi.parent.ui.fragment.report; | ||
2 | + | ||
3 | +import android.os.Bundle; | ||
4 | +import android.support.annotation.NonNull; | ||
5 | +import android.support.annotation.Nullable; | ||
6 | +import android.view.View; | ||
7 | + | ||
8 | +import com.share.mvpsdk.base.BasePresenter; | ||
9 | +import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | ||
10 | +import com.shunzhi.parent.R; | ||
11 | + | ||
12 | +/** | ||
13 | + * Created by Administrator on 2018/3/28 0028. | ||
14 | + */ | ||
15 | + | ||
16 | +public class ReportSceneFragment extends BaseMVPCompatFragment { | ||
17 | + | ||
18 | + @NonNull | ||
19 | + @Override | ||
20 | + public BasePresenter initPresenter() { | ||
21 | + return null; | ||
22 | + } | ||
23 | + | ||
24 | + @Override | ||
25 | + public int getLayoutId() { | ||
26 | + return R.layout.fragment_report_scene; | ||
27 | + } | ||
28 | + | ||
29 | + @Override | ||
30 | + public void initUI(View view, @Nullable Bundle savedInstanceState) { | ||
31 | + | ||
32 | + | ||
33 | + } | ||
34 | +} |
35.1 KB
22.7 KB
app/src/main/res/drawable-xhdpi/screen.png
app/src/main/res/drawable/report_white.xml
@@ -2,5 +2,5 @@ | @@ -2,5 +2,5 @@ | ||
2 | <shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android"> | 2 | <shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android"> |
3 | <stroke android:color="#00000000" android:width="1dp"/> | 3 | <stroke android:color="#00000000" android:width="1dp"/> |
4 | <solid android:color="@color/white" /> | 4 | <solid android:color="@color/white" /> |
5 | - <corners android:radius="10dp"/> | 5 | + <corners android:radius="@dimen/size_dp_10"/> |
6 | </shape> | 6 | </shape> |
7 | \ No newline at end of file | 7 | \ No newline at end of file |
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
3 | + <stroke android:color="#00000000" android:width="1dp"/> | ||
4 | + <!--<solid android:color="#AACFFC" />--> | ||
5 | + <gradient | ||
6 | + android:startColor="#64b5f6" | ||
7 | + android:endColor="#c2e9fb" | ||
8 | + android:angle="315" /> | ||
9 | + | ||
10 | + <corners android:radius="@dimen/size_dp_10"/> | ||
11 | +</shape> | ||
0 | \ No newline at end of file | 12 | \ No newline at end of file |
app/src/main/res/drawable/rudiobtn_report_top.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android"> | 2 | <shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android"> |
3 | <stroke android:color="#00000000" android:width="1dp"/> | 3 | <stroke android:color="#00000000" android:width="1dp"/> |
4 | - <solid android:color="#AACFFC" /> | 4 | + <!--<solid android:color="#AACFFC" />--> |
5 | + <gradient | ||
6 | + android:startColor="#64b5f6" | ||
7 | + android:endColor="#c2e9fb" | ||
8 | + android:angle="315" /> | ||
9 | + | ||
5 | <corners android:topLeftRadius="10dp" android:topRightRadius="10dp"/> | 10 | <corners android:topLeftRadius="10dp" android:topRightRadius="10dp"/> |
6 | </shape> | 11 | </shape> |
7 | \ No newline at end of file | 12 | \ No newline at end of file |
@@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<LinearLayout 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 | + android:orientation="vertical" | ||
8 | + tools:context="com.shunzhi.parent.ui.activity.report.ReportDetialActivity"> | ||
9 | + | ||
10 | + <include layout="@layout/top"/> | ||
11 | + | ||
12 | + | ||
13 | + <FrameLayout | ||
14 | + android:layout_width="match_parent" | ||
15 | + android:layout_height="match_parent" | ||
16 | + android:id="@+id/frame_detial" | ||
17 | + ></FrameLayout> | ||
18 | + | ||
19 | +</LinearLayout> |
@@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<LinearLayout 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 | + android:orientation="vertical" | ||
8 | + tools:context="com.shunzhi.parent.ui.activity.report.ReportSceneActivity"> | ||
9 | + | ||
10 | + <include layout="@layout/top"/> | ||
11 | + | ||
12 | + | ||
13 | + <FrameLayout | ||
14 | + android:layout_width="match_parent" | ||
15 | + android:layout_height="match_parent" | ||
16 | + android:id="@+id/frame_scene" | ||
17 | + ></FrameLayout> | ||
18 | + | ||
19 | +</LinearLayout> |
app/src/main/res/layout/fragment_report.xml
@@ -22,17 +22,16 @@ | @@ -22,17 +22,16 @@ | ||
22 | android:drawablePadding="10dp" | 22 | android:drawablePadding="10dp" |
23 | android:drawableRight="@drawable/pull" | 23 | android:drawableRight="@drawable/pull" |
24 | android:text="" | 24 | android:text="" |
25 | - android:visibility="gone" | ||
26 | android:textColor="@color/textColor" | 25 | android:textColor="@color/textColor" |
27 | android:textSize="@dimen/textSize16" /> | 26 | android:textSize="@dimen/textSize16" /> |
28 | 27 | ||
29 | <TextView | 28 | <TextView |
29 | + android:id="@+id/tvDate" | ||
30 | android:layout_width="wrap_content" | 30 | android:layout_width="wrap_content" |
31 | android:layout_height="wrap_content" | 31 | android:layout_height="wrap_content" |
32 | android:layout_gravity="center_vertical" | 32 | android:layout_gravity="center_vertical" |
33 | android:layout_weight="1" | 33 | android:layout_weight="1" |
34 | android:gravity="center_horizontal" | 34 | android:gravity="center_horizontal" |
35 | - android:id="@+id/tvDate" | ||
36 | android:text="报告" | 35 | android:text="报告" |
37 | android:textColor="@color/white" | 36 | android:textColor="@color/white" |
38 | android:textSize="@dimen/textSize18" /> | 37 | android:textSize="@dimen/textSize18" /> |
@@ -43,32 +42,33 @@ | @@ -43,32 +42,33 @@ | ||
43 | android:layout_height="wrap_content" | 42 | android:layout_height="wrap_content" |
44 | android:layout_gravity="center_vertical" | 43 | android:layout_gravity="center_vertical" |
45 | android:drawableRight="@drawable/screen" | 44 | android:drawableRight="@drawable/screen" |
46 | - android:visibility="gone" | ||
47 | android:text="筛选" | 45 | android:text="筛选" |
48 | - android:textColor="@color/textColor" | 46 | + android:textColor="@color/white" |
49 | android:textSize="@dimen/textSize16" /> | 47 | android:textSize="@dimen/textSize16" /> |
50 | </LinearLayout> | 48 | </LinearLayout> |
51 | -<RelativeLayout | ||
52 | - android:layout_width="match_parent" | ||
53 | - android:layout_height="match_parent" | ||
54 | - android:background="@color/white" | ||
55 | - | ||
56 | - > | ||
57 | - <TextView | ||
58 | - android:layout_width="wrap_content" | ||
59 | - android:layout_height="wrap_content" | ||
60 | - android:layout_centerInParent="true" | ||
61 | - android:textSize="@dimen/size_dp_16" | ||
62 | - android:textColor="@color/xueqing_blue" | ||
63 | - android:background="@drawable/baogao_back" | ||
64 | - android:lineSpacingExtra="@dimen/size_dp_5" | ||
65 | - android:id="@+id/tvNoData" | ||
66 | - /> | ||
67 | -</RelativeLayout> | ||
68 | - <LinearLayout | 49 | + |
50 | + <RelativeLayout | ||
69 | android:layout_width="match_parent" | 51 | android:layout_width="match_parent" |
70 | android:layout_height="match_parent" | 52 | android:layout_height="match_parent" |
53 | + android:background="@color/white" | ||
71 | android:visibility="gone" | 54 | android:visibility="gone" |
55 | + | ||
56 | + > | ||
57 | + | ||
58 | + <TextView | ||
59 | + android:id="@+id/tvNoData" | ||
60 | + android:layout_width="wrap_content" | ||
61 | + android:layout_height="wrap_content" | ||
62 | + android:layout_centerInParent="true" | ||
63 | + android:background="@drawable/baogao_back" | ||
64 | + android:lineSpacingExtra="@dimen/size_dp_5" | ||
65 | + android:textColor="@color/xueqing_blue" | ||
66 | + android:textSize="@dimen/size_dp_16" /> | ||
67 | + </RelativeLayout> | ||
68 | + | ||
69 | + <LinearLayout | ||
70 | + android:layout_width="match_parent" | ||
71 | + android:layout_height="match_parent" | ||
72 | android:orientation="vertical"> | 72 | android:orientation="vertical"> |
73 | 73 | ||
74 | <!--<include layout="@layout/layout_week" /> android:layout_below="@+id/linearlayout"--> | 74 | <!--<include layout="@layout/layout_week" /> android:layout_below="@+id/linearlayout"--> |
@@ -99,18 +99,17 @@ | @@ -99,18 +99,17 @@ | ||
99 | app:mcv_dateTextAppearance="@style/TextAppearance.MaterialCalendarWidget.Date" | 99 | app:mcv_dateTextAppearance="@style/TextAppearance.MaterialCalendarWidget.Date" |
100 | app:mcv_selectionColor="@color/huodong_blue" | 100 | app:mcv_selectionColor="@color/huodong_blue" |
101 | app:mcv_showTopBar="false" | 101 | app:mcv_showTopBar="false" |
102 | - app:mcv_showWeekView="false" | ||
103 | - /> | 102 | + app:mcv_showWeekView="false" /> |
104 | 103 | ||
105 | 104 | ||
106 | - <android.support.v7.widget.RecyclerView | ||
107 | - android:id="@+id/recycle_report" | ||
108 | - android:layout_width="match_parent" | ||
109 | - android:layout_height="match_parent" | ||
110 | - android:background="@color/bgColor" | ||
111 | - android:padding="@dimen/size_dp_10"> | 105 | + <android.support.v7.widget.RecyclerView |
106 | + android:id="@+id/recycle_report" | ||
107 | + android:layout_width="match_parent" | ||
108 | + android:layout_height="match_parent" | ||
109 | + android:background="@color/bgColor" | ||
110 | + android:padding="@dimen/size_dp_10"> | ||
112 | 111 | ||
113 | - </android.support.v7.widget.RecyclerView> | 112 | + </android.support.v7.widget.RecyclerView> |
114 | 113 | ||
115 | <LinearLayout | 114 | <LinearLayout |
116 | android:id="@+id/weekview_top" | 115 | android:id="@+id/weekview_top" |
@@ -0,0 +1,198 @@ | @@ -0,0 +1,198 @@ | ||
1 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | + xmlns:tools="http://schemas.android.com/tools" | ||
3 | + android:layout_width="match_parent" | ||
4 | + android:layout_height="match_parent" | ||
5 | + android:background="@color/bgColor" | ||
6 | + android:orientation="vertical" | ||
7 | + tools:context="com.shunzhi.parent.ui.fragment.ReportFragment"> | ||
8 | + | ||
9 | + <RelativeLayout | ||
10 | + android:layout_width="match_parent" | ||
11 | + android:layout_height="match_parent" | ||
12 | + android:background="@color/white" | ||
13 | + android:visibility="gone" | ||
14 | + | ||
15 | + > | ||
16 | + | ||
17 | + <TextView | ||
18 | + android:id="@+id/tvNoData" | ||
19 | + android:layout_width="wrap_content" | ||
20 | + android:layout_height="wrap_content" | ||
21 | + android:layout_centerInParent="true" | ||
22 | + android:background="@drawable/baogao_back" | ||
23 | + android:lineSpacingExtra="@dimen/size_dp_5" | ||
24 | + android:textColor="@color/xueqing_blue" | ||
25 | + android:textSize="@dimen/size_dp_16" /> | ||
26 | + </RelativeLayout> | ||
27 | + | ||
28 | + <LinearLayout | ||
29 | + android:layout_width="match_parent" | ||
30 | + android:layout_height="match_parent" | ||
31 | + android:orientation="vertical" | ||
32 | + android:padding="@dimen/size_dp_10"> | ||
33 | + | ||
34 | + <!--<include layout="@layout/layout_week" /> android:layout_below="@+id/linearlayout"--> | ||
35 | + <LinearLayout | ||
36 | + android:layout_width="match_parent" | ||
37 | + android:layout_height="wrap_content" | ||
38 | + android:background="@drawable/rudiobtn_report_deyu" | ||
39 | + android:orientation="vertical"> | ||
40 | + | ||
41 | + <LinearLayout | ||
42 | + android:layout_width="match_parent" | ||
43 | + android:layout_height="wrap_content" | ||
44 | + android:orientation="horizontal"> | ||
45 | + | ||
46 | + <LinearLayout | ||
47 | + android:layout_width="wrap_content" | ||
48 | + android:layout_height="match_parent" | ||
49 | + android:layout_weight="1" | ||
50 | + android:orientation="vertical"> | ||
51 | + | ||
52 | + <TextView | ||
53 | + android:layout_width="wrap_content" | ||
54 | + android:layout_height="wrap_content" | ||
55 | + android:layout_gravity="center" | ||
56 | + android:layout_marginTop="10dp" | ||
57 | + android:gravity="center" | ||
58 | + android:text="德育得分" | ||
59 | + android:textColor="@color/deyu_BlueColor" | ||
60 | + android:textSize="@dimen/sp_16" /> | ||
61 | + | ||
62 | + <TextView | ||
63 | + android:layout_width="wrap_content" | ||
64 | + android:layout_height="wrap_content" | ||
65 | + android:gravity="center" | ||
66 | + android:padding="@dimen/size_dp_5" | ||
67 | + android:text="4.3分" | ||
68 | + android:layout_gravity="center" | ||
69 | + android:textColor="@color/white" | ||
70 | + android:textSize="@dimen/dp_36" /> | ||
71 | + | ||
72 | + <TextView | ||
73 | + android:layout_width="wrap_content" | ||
74 | + android:layout_height="wrap_content" | ||
75 | + android:layout_marginTop="10dp" | ||
76 | + android:gravity="center" | ||
77 | + android:layout_gravity="center" | ||
78 | + android:text="同期上升1.1分" | ||
79 | + android:textColor="@color/white" | ||
80 | + android:textSize="@dimen/sp_16" /> | ||
81 | + | ||
82 | + <TextView | ||
83 | + android:layout_width="wrap_content" | ||
84 | + android:layout_height="wrap_content" | ||
85 | + android:layout_marginTop="5dp" | ||
86 | + android:gravity="center" | ||
87 | + android:layout_gravity="center" | ||
88 | + android:text="高于平均分1.1分" | ||
89 | + android:textColor="@color/white" | ||
90 | + android:textSize="@dimen/sp_16" /> | ||
91 | + | ||
92 | + | ||
93 | + </LinearLayout> | ||
94 | + | ||
95 | + <LinearLayout | ||
96 | + android:layout_width="wrap_content" | ||
97 | + android:layout_height="match_parent" | ||
98 | + android:layout_weight="1" | ||
99 | + android:orientation="vertical"> | ||
100 | + | ||
101 | + <TextView | ||
102 | + android:layout_width="wrap_content" | ||
103 | + android:layout_height="wrap_content" | ||
104 | + android:layout_gravity="center" | ||
105 | + android:layout_marginTop="@dimen/size_dp_10" | ||
106 | + android:gravity="center" | ||
107 | + android:text="2018年03月08日" | ||
108 | + android:textColor="@color/deyu_BlueColor" | ||
109 | + android:textSize="@dimen/sp_16" /> | ||
110 | + | ||
111 | + <TextView | ||
112 | + android:layout_width="wrap_content" | ||
113 | + android:layout_height="wrap_content" | ||
114 | + android:gravity="center" | ||
115 | + android:layout_gravity="center" | ||
116 | + android:padding="@dimen/size_dp_5" | ||
117 | + android:text="第三名" | ||
118 | + android:textColor="@color/white" | ||
119 | + android:textSize="@dimen/dp_36" /> | ||
120 | + | ||
121 | + <TextView | ||
122 | + android:layout_width="wrap_content" | ||
123 | + android:layout_height="wrap_content" | ||
124 | + android:layout_marginTop="10dp" | ||
125 | + android:gravity="center" | ||
126 | + android:layout_gravity="center" | ||
127 | + android:text="同期上升5名" | ||
128 | + android:textColor="@color/white" | ||
129 | + android:textSize="@dimen/sp_16" /> | ||
130 | + | ||
131 | + <TextView | ||
132 | + android:layout_width="wrap_content" | ||
133 | + android:layout_height="wrap_content" | ||
134 | + android:layout_marginTop="5dp" | ||
135 | + android:gravity="center" | ||
136 | + android:layout_gravity="center" | ||
137 | + android:text="高于平均排名1.1名" | ||
138 | + android:textColor="@color/white" | ||
139 | + android:textSize="@dimen/sp_16" /> | ||
140 | + | ||
141 | + | ||
142 | + </LinearLayout> | ||
143 | + | ||
144 | + | ||
145 | + </LinearLayout> | ||
146 | + | ||
147 | + <TextView | ||
148 | + android:layout_width="match_parent" | ||
149 | + android:layout_height="wrap_content" | ||
150 | + android:layout_marginTop="@dimen/size_dp_30" | ||
151 | + android:layout_marginBottom="@dimen/size_dp_20" | ||
152 | + android:layout_marginLeft="@dimen/size_dp_25" | ||
153 | + android:layout_marginRight="@dimen/size_dp_25" | ||
154 | + android:gravity="center" | ||
155 | + android:lineSpacingExtra="@dimen/size_dp_5" | ||
156 | + android:text="哎哟不错哦,德育评价打败了88%的同学!注意行为规范将更上一层" | ||
157 | + android:textColor="@color/deyu_BlueColor" | ||
158 | + android:textSize="@dimen/sp_16" /> | ||
159 | + | ||
160 | + | ||
161 | + </LinearLayout> | ||
162 | + | ||
163 | + <FrameLayout | ||
164 | + android:layout_width="match_parent" | ||
165 | + android:layout_height="wrap_content" | ||
166 | + android:layout_marginTop="@dimen/size_dp_10"> | ||
167 | + | ||
168 | + <com.share.mvpsdk.view.chartview.ChartView | ||
169 | + android:layout_width="match_parent" | ||
170 | + android:layout_height="match_parent" | ||
171 | + android:id="@+id/chartView" | ||
172 | + /> | ||
173 | + | ||
174 | + <TextView | ||
175 | + android:visibility="gone" | ||
176 | + android:layout_width="match_parent" | ||
177 | + android:layout_height="200dp" | ||
178 | + android:text="图表控件" | ||
179 | + android:layout_gravity="center" | ||
180 | + android:gravity="center" | ||
181 | + android:textColor="@color/md_red_500" | ||
182 | + android:background="@color/huodong_blue" /> | ||
183 | + | ||
184 | + </FrameLayout> | ||
185 | + | ||
186 | + | ||
187 | + <android.support.v7.widget.RecyclerView | ||
188 | + android:id="@+id/recycle_deyu" | ||
189 | + android:layout_width="match_parent" | ||
190 | + android:layout_height="wrap_content" | ||
191 | + android:layout_marginTop="@dimen/size_dp_10" | ||
192 | + android:background="@color/bgColor"> | ||
193 | + | ||
194 | + </android.support.v7.widget.RecyclerView> | ||
195 | + | ||
196 | + </LinearLayout> | ||
197 | + | ||
198 | +</LinearLayout> |
@@ -0,0 +1,153 @@ | @@ -0,0 +1,153 @@ | ||
1 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | + xmlns:tools="http://schemas.android.com/tools" | ||
3 | + android:layout_width="match_parent" | ||
4 | + android:layout_height="match_parent" | ||
5 | + android:background="@color/bgColor" | ||
6 | + android:orientation="vertical" | ||
7 | + tools:context="com.shunzhi.parent.ui.fragment.ReportFragment"> | ||
8 | + | ||
9 | + <RelativeLayout | ||
10 | + android:layout_width="match_parent" | ||
11 | + android:layout_height="match_parent" | ||
12 | + android:background="@color/white" | ||
13 | + android:visibility="gone" | ||
14 | + | ||
15 | + > | ||
16 | + | ||
17 | + <TextView | ||
18 | + android:id="@+id/tvNoData" | ||
19 | + android:layout_width="wrap_content" | ||
20 | + android:layout_height="wrap_content" | ||
21 | + android:layout_centerInParent="true" | ||
22 | + android:background="@drawable/baogao_back" | ||
23 | + android:lineSpacingExtra="@dimen/size_dp_5" | ||
24 | + android:textColor="@color/xueqing_blue" | ||
25 | + android:textSize="@dimen/size_dp_16" /> | ||
26 | + </RelativeLayout> | ||
27 | + | ||
28 | + <LinearLayout | ||
29 | + android:layout_width="match_parent" | ||
30 | + android:layout_height="match_parent" | ||
31 | + android:orientation="vertical" | ||
32 | + android:padding="@dimen/size_dp_10"> | ||
33 | + | ||
34 | + <!--<include layout="@layout/layout_week" /> android:layout_below="@+id/linearlayout"--> | ||
35 | + <LinearLayout | ||
36 | + android:layout_width="match_parent" | ||
37 | + android:layout_height="wrap_content" | ||
38 | + android:background="@drawable/report_white" | ||
39 | + android:orientation="vertical"> | ||
40 | + | ||
41 | + <LinearLayout | ||
42 | + android:id="@+id/layout_top" | ||
43 | + android:layout_width="match_parent" | ||
44 | + android:layout_height="wrap_content" | ||
45 | + android:weightSum="2" | ||
46 | + android:orientation="horizontal"> | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + <ImageView | ||
51 | + android:id="@+id/image" | ||
52 | + android:layout_width="0dp" | ||
53 | + android:layout_height="match_parent" | ||
54 | + android:layout_weight="1" | ||
55 | + android:padding="@dimen/size_dp_20" | ||
56 | + android:src="@drawable/scene_detial1" /> | ||
57 | + | ||
58 | + | ||
59 | + <LinearLayout | ||
60 | + android:layout_margin="@dimen/size_dp_10" | ||
61 | + android:layout_width="0dp" | ||
62 | + android:layout_height="match_parent" | ||
63 | + android:layout_weight="1" | ||
64 | + android:orientation="vertical"> | ||
65 | + | ||
66 | + <TextView | ||
67 | + android:layout_width="wrap_content" | ||
68 | + android:layout_height="wrap_content" | ||
69 | + android:gravity="center" | ||
70 | + android:text="文明礼仪" | ||
71 | + android:textColor="@color/deyu_BlueColor" | ||
72 | + android:textSize="@dimen/sp_16" /> | ||
73 | + | ||
74 | + <TextView | ||
75 | + android:layout_width="wrap_content" | ||
76 | + android:layout_height="wrap_content" | ||
77 | + android:layout_marginTop="10dp" | ||
78 | + android:gravity="center" | ||
79 | + android:text="得分:85分" | ||
80 | + android:textColor="@color/deyu_textColor" | ||
81 | + android:textSize="@dimen/sp_16" /> | ||
82 | + | ||
83 | + <TextView | ||
84 | + android:layout_width="wrap_content" | ||
85 | + android:layout_height="wrap_content" | ||
86 | + android:layout_marginTop="10dp" | ||
87 | + android:gravity="center" | ||
88 | + android:text="绩点:4.3分" | ||
89 | + android:textColor="@color/deyu_textColor" | ||
90 | + android:textSize="@dimen/sp_16" /> | ||
91 | + | ||
92 | + <TextView | ||
93 | + android:layout_width="wrap_content" | ||
94 | + android:layout_height="wrap_content" | ||
95 | + android:layout_marginTop="5dp" | ||
96 | + android:gravity="center" | ||
97 | + android:text="等级:A-" | ||
98 | + android:textColor="@color/deyu_textColor" | ||
99 | + android:textSize="@dimen/sp_16" /> | ||
100 | + | ||
101 | + <TextView | ||
102 | + android:layout_width="wrap_content" | ||
103 | + android:layout_height="wrap_content" | ||
104 | + android:layout_marginTop="5dp" | ||
105 | + android:gravity="center" | ||
106 | + android:text="指导意见:" | ||
107 | + android:textColor="@color/deyu_BlueColor" | ||
108 | + android:textSize="@dimen/sp_16" /> | ||
109 | + | ||
110 | + <TextView | ||
111 | + android:layout_width="wrap_content" | ||
112 | + android:layout_height="wrap_content" | ||
113 | + android:layout_marginTop="5dp" | ||
114 | + android:text="与上期相比有进步,保持文明礼仪,注意行为规范" | ||
115 | + android:textColor="@color/deyu_BlueColor" | ||
116 | + android:textSize="@dimen/sp_14" /> | ||
117 | + | ||
118 | + | ||
119 | + </LinearLayout> | ||
120 | + | ||
121 | + | ||
122 | + </LinearLayout> | ||
123 | + </LinearLayout> | ||
124 | + | ||
125 | + <LinearLayout | ||
126 | + android:layout_width="match_parent" | ||
127 | + android:layout_height="wrap_content" | ||
128 | + android:layout_marginTop="@dimen/size_dp_10"> | ||
129 | + | ||
130 | + <TextView | ||
131 | + android:layout_width="match_parent" | ||
132 | + android:layout_height="200dp" | ||
133 | + android:layout_gravity="center" | ||
134 | + android:background="@color/huodong_blue" | ||
135 | + android:gravity="center" | ||
136 | + android:text="图表控件" | ||
137 | + android:textColor="@color/md_red_500" /> | ||
138 | + | ||
139 | + </LinearLayout> | ||
140 | + | ||
141 | + | ||
142 | + <android.support.v7.widget.RecyclerView | ||
143 | + android:id="@+id/recycle_deyu" | ||
144 | + android:layout_width="match_parent" | ||
145 | + android:layout_height="wrap_content" | ||
146 | + android:layout_marginTop="@dimen/size_dp_10" | ||
147 | + android:background="@color/bgColor"> | ||
148 | + | ||
149 | + </android.support.v7.widget.RecyclerView> | ||
150 | + | ||
151 | + </LinearLayout> | ||
152 | + | ||
153 | +</LinearLayout> |
@@ -0,0 +1,65 @@ | @@ -0,0 +1,65 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + android:layout_width="match_parent" | ||
4 | + android:background="@color/white" | ||
5 | + android:divider="@color/divider_gray" | ||
6 | + android:layout_marginTop="@dimen/size_dp_10" | ||
7 | + android:layout_height="wrap_content"> | ||
8 | + | ||
9 | + <LinearLayout | ||
10 | + android:id="@+id/item_view" | ||
11 | + android:layout_margin="10dp" | ||
12 | + android:layout_width="match_parent" | ||
13 | + android:layout_height="wrap_content"> | ||
14 | + | ||
15 | + <LinearLayout | ||
16 | + android:layout_width="wrap_content" | ||
17 | + android:layout_height="wrap_content" | ||
18 | + android:layout_weight="1" | ||
19 | + android:orientation="vertical"> | ||
20 | + | ||
21 | + <TextView | ||
22 | + android:id="@+id/txt_childname" | ||
23 | + android:layout_width="wrap_content" | ||
24 | + android:layout_height="wrap_content" | ||
25 | + android:textSize="@dimen/txtsize_title" | ||
26 | + android:text="行为规范" /> | ||
27 | + <LinearLayout | ||
28 | + android:layout_marginTop="10dp" | ||
29 | + android:layout_width="wrap_content" | ||
30 | + android:layout_height="wrap_content"> | ||
31 | + | ||
32 | + <TextView | ||
33 | + android:id="@+id/jidian" | ||
34 | + android:layout_width="wrap_content" | ||
35 | + android:layout_height="wrap_content" | ||
36 | + android:text="绩点:4.3 增长1.1分" /> | ||
37 | + <TextView | ||
38 | + android:layout_marginLeft="10dp" | ||
39 | + android:id="@+id/paiming" | ||
40 | + android:layout_width="wrap_content" | ||
41 | + android:layout_height="wrap_content" | ||
42 | + android:text="排名:第三名 增长1名" /> | ||
43 | + </LinearLayout> | ||
44 | + | ||
45 | + </LinearLayout> | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + <TextView | ||
50 | + android:id="@+id/go_buy" | ||
51 | + android:layout_width="wrap_content" | ||
52 | + android:layout_height="wrap_content" | ||
53 | + android:paddingTop="5dp" | ||
54 | + android:paddingBottom="5dp" | ||
55 | + android:paddingLeft="10dp" | ||
56 | + android:paddingRight="10dp" | ||
57 | + android:layout_gravity="center_vertical" | ||
58 | + android:gravity="center" | ||
59 | + android:textSize="@dimen/txtsize_headline" | ||
60 | + android:textColor="@color/textGreen" | ||
61 | + android:text="A-" /> | ||
62 | + | ||
63 | + </LinearLayout> | ||
64 | + | ||
65 | +</LinearLayout> |
@@ -0,0 +1,96 @@ | @@ -0,0 +1,96 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + android:layout_width="match_parent" | ||
4 | + android:layout_height="wrap_content"> | ||
5 | + | ||
6 | + <LinearLayout | ||
7 | + android:layout_width="match_parent" | ||
8 | + android:layout_height="250dp" | ||
9 | + android:layout_marginTop="@dimen/size_dp_10" | ||
10 | + android:background="@drawable/report_white" | ||
11 | + android:orientation="vertical"> | ||
12 | + | ||
13 | + <TextView | ||
14 | + android:layout_width="match_parent" | ||
15 | + android:layout_height="40dp" | ||
16 | + android:background="@drawable/rudiobtn_report_top" | ||
17 | + android:gravity="center_vertical" | ||
18 | + android:paddingLeft="20dp" | ||
19 | + android:text="今日德育报告" | ||
20 | + android:textColor="@color/deyu_BlueColor" | ||
21 | + android:textSize="@dimen/sp_16" /> | ||
22 | + | ||
23 | + <LinearLayout | ||
24 | + android:id="@+id/deyu_content" | ||
25 | + android:layout_width="match_parent" | ||
26 | + android:layout_height="wrap_content" | ||
27 | + android:layout_weight="1" | ||
28 | + android:orientation="horizontal"> | ||
29 | + | ||
30 | + <LinearLayout | ||
31 | + android:layout_width="wrap_content" | ||
32 | + android:layout_height="match_parent" | ||
33 | + android:layout_marginTop="10dp" | ||
34 | + android:layout_weight="1" | ||
35 | + android:gravity="center" | ||
36 | + android:orientation="vertical"> | ||
37 | + | ||
38 | + <TextView | ||
39 | + android:layout_width="wrap_content" | ||
40 | + android:layout_height="wrap_content" | ||
41 | + android:gravity="center" | ||
42 | + android:text="4.3分" | ||
43 | + android:textColor="@color/deyu_textColor" | ||
44 | + android:textSize="@dimen/txtsize_num" /> | ||
45 | + | ||
46 | + <TextView | ||
47 | + android:layout_width="match_parent" | ||
48 | + android:layout_height="wrap_content" | ||
49 | + android:layout_marginTop="20dp" | ||
50 | + android:gravity="center" | ||
51 | + android:text="获得A-评价" | ||
52 | + android:textColor="@color/deyu_textColor" | ||
53 | + android:textSize="@dimen/sp_16" /> | ||
54 | + </LinearLayout> | ||
55 | + | ||
56 | + | ||
57 | + <LinearLayout | ||
58 | + android:layout_width="wrap_content" | ||
59 | + android:layout_height="match_parent" | ||
60 | + android:layout_marginTop="10dp" | ||
61 | + android:layout_weight="1" | ||
62 | + android:gravity="center" | ||
63 | + android:orientation="vertical"> | ||
64 | + | ||
65 | + <TextView | ||
66 | + android:layout_width="wrap_content" | ||
67 | + android:layout_height="wrap_content" | ||
68 | + android:gravity="center" | ||
69 | + android:text="第三名" | ||
70 | + android:textColor="@color/deyu_textColor" | ||
71 | + android:textSize="@dimen/txtsize_num" /> | ||
72 | + | ||
73 | + <TextView | ||
74 | + android:layout_width="match_parent" | ||
75 | + android:layout_height="wrap_content" | ||
76 | + android:layout_marginTop="20dp" | ||
77 | + android:gravity="center" | ||
78 | + android:text="名次上升一名" | ||
79 | + android:textColor="@color/deyu_textColor" | ||
80 | + android:textSize="@dimen/sp_16" /> | ||
81 | + </LinearLayout> | ||
82 | + | ||
83 | + </LinearLayout> | ||
84 | + | ||
85 | + <TextView | ||
86 | + android:layout_width="match_parent" | ||
87 | + android:layout_height="wrap_content" | ||
88 | + android:height="40dp" | ||
89 | + android:gravity="center" | ||
90 | + android:paddingLeft="20dp" | ||
91 | + android:text="3月4日语文作业" | ||
92 | + android:textColor="@color/deyu_BlueColor" | ||
93 | + android:textSize="@dimen/sp_14" /> | ||
94 | + | ||
95 | + </LinearLayout> | ||
96 | +</LinearLayout> |
app/src/main/res/values/colors.xml
@@ -20,4 +20,6 @@ | @@ -20,4 +20,6 @@ | ||
20 | <color name="text_color">#757575</color> | 20 | <color name="text_color">#757575</color> |
21 | <color name="textGreen">#5FB762</color> | 21 | <color name="textGreen">#5FB762</color> |
22 | <color name="transparent">#00000000</color> | 22 | <color name="transparent">#00000000</color> |
23 | + <color name="deyu_textColor">#60b3f6</color> | ||
24 | + <color name="deyu_BlueColor">#2b71c4</color> | ||
23 | </resources> | 25 | </resources> |
mvpsdk/src/main/java/com/share/mvpsdk/utils/DateUtils.java
@@ -54,7 +54,10 @@ public class DateUtils { | @@ -54,7 +54,10 @@ public class DateUtils { | ||
54 | return str; | 54 | return str; |
55 | } | 55 | } |
56 | 56 | ||
57 | - | 57 | + public static String format(long millis){ |
58 | + SimpleDateFormat format = new SimpleDateFormat("MM/dd", Locale.getDefault()); | ||
59 | + return format.format(millis); | ||
60 | + } | ||
58 | 61 | ||
59 | /** | 62 | /** |
60 | * 获取日期 PATTERN_DATE 部分 | 63 | * 获取日期 PATTERN_DATE 部分 |
@@ -247,4 +250,5 @@ public class DateUtils { | @@ -247,4 +250,5 @@ public class DateUtils { | ||
247 | public static String calendar2str(Calendar calendar, String format) { | 250 | public static String calendar2str(Calendar calendar, String format) { |
248 | return date2str(calendar.getTime(), format); | 251 | return date2str(calendar.getTime(), format); |
249 | } | 252 | } |
253 | + | ||
250 | } | 254 | } |
mvpsdk/src/main/java/com/share/mvpsdk/utils/ValueUtils.java
0 → 100644
@@ -0,0 +1,204 @@ | @@ -0,0 +1,204 @@ | ||
1 | +package com.share.mvpsdk.utils; | ||
2 | + | ||
3 | +import android.support.annotation.NonNull; | ||
4 | +import android.support.annotation.Nullable; | ||
5 | +import android.support.v4.app.NotificationCompat; | ||
6 | +import android.util.Log; | ||
7 | + | ||
8 | + | ||
9 | +import com.share.mvpsdk.view.chartview.data.Chart; | ||
10 | +import com.share.mvpsdk.view.chartview.data.ChartPath; | ||
11 | +import com.share.mvpsdk.view.chartview.data.DrawData; | ||
12 | +import com.share.mvpsdk.view.chartview.data.InputData; | ||
13 | + | ||
14 | +import java.util.ArrayList; | ||
15 | +import java.util.List; | ||
16 | +import java.util.ListIterator; | ||
17 | +import java.util.concurrent.TimeUnit; | ||
18 | + | ||
19 | +public class ValueUtils { | ||
20 | + | ||
21 | + public static long getCorrectedMaxValue(long maxValue) { | ||
22 | + for (long value = maxValue; value >= Chart.CHART_PART_VALUE; value--) { | ||
23 | + if (isRightValue(value)) { | ||
24 | + return value; | ||
25 | + } | ||
26 | + } | ||
27 | + | ||
28 | + return maxValue; | ||
29 | + } | ||
30 | + | ||
31 | + public static long max(@Nullable List<ChartPath> dataList) { | ||
32 | + long maxValue = 0; | ||
33 | + | ||
34 | + if (dataList == null || dataList.isEmpty()) { | ||
35 | + return maxValue; | ||
36 | + } | ||
37 | + for (ChartPath charpath : | ||
38 | + dataList) { | ||
39 | + for (InputData data : charpath.inputDataList) { | ||
40 | + if (data.valueY > maxValue) { | ||
41 | + maxValue = data.valueY; | ||
42 | + } | ||
43 | + } | ||
44 | + } | ||
45 | + | ||
46 | + return maxValue; | ||
47 | + } | ||
48 | + | ||
49 | + private static long maxOne(List<InputData> dataList) { | ||
50 | + long maxValue = 0; | ||
51 | + | ||
52 | + if (dataList == null || dataList.isEmpty()) { | ||
53 | + return maxValue; | ||
54 | + } | ||
55 | + for (InputData data : dataList) { | ||
56 | + if (data.valueY > maxValue) { | ||
57 | + maxValue = data.valueY; | ||
58 | + } | ||
59 | + } | ||
60 | + | ||
61 | + return maxValue; | ||
62 | + } | ||
63 | + | ||
64 | + private static boolean isRightValue(long value) { | ||
65 | + long valueResidual = value % Chart.CHART_PART_VALUE; | ||
66 | + return valueResidual == 0; | ||
67 | + } | ||
68 | + | ||
69 | + @NotificationCompat.NotificationVisibility | ||
70 | + public static List<DrawData> getDrawData(@Nullable Chart chart) { | ||
71 | + if (chart == null || chart.getInputDataList().isEmpty()) { | ||
72 | + return new ArrayList<>(); | ||
73 | + } | ||
74 | + | ||
75 | + List<InputData> dataList = chart.getInputDataList(); | ||
76 | +// correctDataListSize(dataList);//移除多余的数据 | ||
77 | + return createDrawDataList(chart, createValueList(dataList)); | ||
78 | + } | ||
79 | + | ||
80 | + @NotificationCompat.NotificationVisibility | ||
81 | + public static List<DrawData> getDrawDatas(@Nullable List<InputData> inputDataList,@NonNull Chart chart) { | ||
82 | + return createDrawDataList(chart, createValueList(inputDataList)); | ||
83 | + } | ||
84 | + | ||
85 | +// private static void correctDataListSize(@NonNull List<InputData> dataList) { | ||
86 | +// if (dataList.size() < Chart.MAX_ITEMS_COUNT) { | ||
87 | +// addLackingItems(dataList); | ||
88 | +// | ||
89 | +// } else if (dataList.size() > Chart.MAX_ITEMS_COUNT) { | ||
90 | +// removeExcessItems(dataList); | ||
91 | +// } | ||
92 | +// } | ||
93 | +// | ||
94 | +// private static void addLackingItems(@NonNull List<InputData> dataList) { | ||
95 | +// for (int i = dataList.size(); i < Chart.MAX_ITEMS_COUNT; i++) { | ||
96 | +// long millis = dataList.get(0).valueX - TimeUnit.DAYS.toMillis(1); | ||
97 | +// if (millis < 0) { | ||
98 | +// millis = 0; | ||
99 | +// } | ||
100 | +// | ||
101 | +// dataList.add(0, new InputData(0, millis)); | ||
102 | +// } | ||
103 | +// } | ||
104 | + | ||
105 | + private static void removeExcessItems(@NonNull List<InputData> dataList) { | ||
106 | + for (ListIterator<InputData> iterator = dataList.listIterator(); iterator.hasNext(); ) { | ||
107 | + if (iterator.nextIndex() > Chart.MAX_ITEMS_COUNT) { | ||
108 | + iterator.remove(); | ||
109 | + return; | ||
110 | + } | ||
111 | + iterator.next(); | ||
112 | + } | ||
113 | + } | ||
114 | + static long topValue=0; | ||
115 | + private static List<Float> createValueList(@NonNull List<InputData> dataList) { | ||
116 | + List<Float> valueList = new ArrayList<>(); | ||
117 | + topValue=topValue > ValueUtils.maxOne(dataList)?topValue:ValueUtils.maxOne(dataList);//取最大值 | ||
118 | + | ||
119 | + for (InputData data : dataList) { | ||
120 | + float value = (float) data.valueY / topValue; | ||
121 | + valueList.add(value); | ||
122 | + } | ||
123 | + | ||
124 | + return valueList; | ||
125 | + } | ||
126 | + | ||
127 | + @NonNull | ||
128 | + private static List<DrawData> createDrawDataList(@NonNull Chart chart, @NonNull List<Float> valueList) { | ||
129 | + List<DrawData> drawDataList = new ArrayList<>(); | ||
130 | + for (int i = 0; i < valueList.size() - 1; i++) { | ||
131 | + DrawData drawData = createDrawData(chart, valueList, i); | ||
132 | + drawDataList.add(drawData); | ||
133 | + } | ||
134 | + return drawDataList; | ||
135 | + } | ||
136 | + | ||
137 | + @NonNull | ||
138 | + private static DrawData createDrawData(@NonNull Chart chart, @NonNull List<Float> valueList, int position) { | ||
139 | + DrawData drawData = new DrawData(); | ||
140 | + if (position > valueList.size() - 1) { | ||
141 | + return drawData; | ||
142 | + } | ||
143 | + | ||
144 | + float value = valueList.get(position); | ||
145 | + int startX = getCoordinateX(chart, position); | ||
146 | + int startY = getCoordinateY(chart, value); | ||
147 | + drawData.startX = startX; | ||
148 | + drawData.startY = startY; | ||
149 | +// drawData.setStartX(startX); | ||
150 | +// drawData.setStartY(startY); | ||
151 | + int nextPosition = position + 1; | ||
152 | + if (nextPosition < valueList.size()) { | ||
153 | + float nextValue = valueList.get(nextPosition); | ||
154 | + int stopX = getCoordinateX(chart, nextPosition); | ||
155 | + int stopY = getCoordinateY(chart, nextValue); | ||
156 | + | ||
157 | +// drawData.setStopX(stopX); | ||
158 | +// drawData.setStopY(stopY); | ||
159 | + | ||
160 | + drawData.stopX = stopX; | ||
161 | + drawData.stopY = stopY; | ||
162 | + } | ||
163 | + | ||
164 | + return drawData; | ||
165 | + } | ||
166 | + | ||
167 | + @SuppressWarnings("UnnecessaryLocalVariable") | ||
168 | + private static int getCoordinateX(@NonNull Chart chart, int index) { | ||
169 | + int width = chart.width; | ||
170 | + int titleWidth = chart.titleWidth; | ||
171 | + | ||
172 | + int widthCorrected = width - titleWidth; | ||
173 | + int partWidth = widthCorrected / (Chart.MAX_ITEMS_COUNT - 1); | ||
174 | + int coordinate = titleWidth + (partWidth * index); | ||
175 | + | ||
176 | + if (coordinate < 0) { | ||
177 | + coordinate = 0; | ||
178 | + | ||
179 | + } else if (coordinate > width) { | ||
180 | + coordinate = width; | ||
181 | + } | ||
182 | + | ||
183 | + return coordinate; | ||
184 | + } | ||
185 | + | ||
186 | + @SuppressWarnings("UnnecessaryLocalVariable") | ||
187 | + private static int getCoordinateY(@NonNull Chart chart, float value) { | ||
188 | + int height = chart.height - chart.padding - chart.textSize; | ||
189 | + int heightOffset = chart.heightOffset; | ||
190 | + | ||
191 | + int heightCorrected = height - heightOffset; | ||
192 | + int coordinate = (int) (heightCorrected - (heightCorrected * value)); | ||
193 | + | ||
194 | + if (coordinate < 0) { | ||
195 | + coordinate = 0; | ||
196 | + | ||
197 | + } else if (coordinate > heightCorrected) { | ||
198 | + coordinate = heightCorrected; | ||
199 | + } | ||
200 | + | ||
201 | + coordinate += heightOffset; | ||
202 | + return coordinate; | ||
203 | + } | ||
204 | +} |
mvpsdk/src/main/java/com/share/mvpsdk/view/chartview/ChartView.java
0 → 100644
@@ -0,0 +1,301 @@ | @@ -0,0 +1,301 @@ | ||
1 | +package com.share.mvpsdk.view.chartview; | ||
2 | + | ||
3 | +import android.content.Context; | ||
4 | +import android.graphics.Canvas; | ||
5 | +import android.graphics.Color; | ||
6 | +import android.graphics.DashPathEffect; | ||
7 | +import android.graphics.Paint; | ||
8 | +import android.graphics.Path; | ||
9 | +import android.graphics.PathDashPathEffect; | ||
10 | +import android.graphics.RectF; | ||
11 | +import android.graphics.Shader; | ||
12 | +import android.support.annotation.NonNull; | ||
13 | +import android.support.annotation.Nullable; | ||
14 | +import android.util.AttributeSet; | ||
15 | +import android.util.Log; | ||
16 | +import android.view.View; | ||
17 | + | ||
18 | +import com.share.mvpsdk.R; | ||
19 | +import com.share.mvpsdk.utils.DateUtils; | ||
20 | +import com.share.mvpsdk.utils.ValueUtils; | ||
21 | +import com.share.mvpsdk.view.chartview.data.Chart; | ||
22 | +import com.share.mvpsdk.view.chartview.data.ChartPath; | ||
23 | +import com.share.mvpsdk.view.chartview.data.DrawData; | ||
24 | +import com.share.mvpsdk.view.chartview.data.InputData; | ||
25 | + | ||
26 | +import java.util.ArrayList; | ||
27 | +import java.util.List; | ||
28 | + | ||
29 | +/** | ||
30 | + * Created by ToaHanDong on 2018/3/28. | ||
31 | + */ | ||
32 | + | ||
33 | +public class ChartView extends View { | ||
34 | + | ||
35 | + Paint axisPaint;//轴的画笔 | ||
36 | + | ||
37 | + Paint valuesPaint;//值的画笔 | ||
38 | + | ||
39 | + Paint textPaint;//轴的数值的画笔 | ||
40 | + | ||
41 | + Paint effectPaint;//有间隔的画笔 | ||
42 | + | ||
43 | + Chart chart;//图表属性 | ||
44 | + | ||
45 | + List<ChartPath> chartPathList = null;//路径的集合 | ||
46 | + | ||
47 | + private int axisColor, valuesColor, textColor; | ||
48 | + | ||
49 | + | ||
50 | + public ChartView(Context context) { | ||
51 | + super(context); | ||
52 | + initCharView(); | ||
53 | + } | ||
54 | + | ||
55 | + public ChartView(Context context, @Nullable AttributeSet attrs) { | ||
56 | + super(context, attrs); | ||
57 | + initCharView(); | ||
58 | + } | ||
59 | + | ||
60 | + public ChartView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { | ||
61 | + super(context, attrs, defStyleAttr); | ||
62 | + initCharView(); | ||
63 | + } | ||
64 | + | ||
65 | + private void initCharView() { | ||
66 | + | ||
67 | + initPaint(); | ||
68 | + | ||
69 | + | ||
70 | + } | ||
71 | + | ||
72 | + //设置颜色 | ||
73 | + public void setColors(int textColor, int axisColor, int valuesColor) { | ||
74 | + this.textColor = textColor; | ||
75 | + this.axisColor = axisColor; | ||
76 | + this.valuesColor = valuesColor; | ||
77 | + } | ||
78 | + | ||
79 | + private int getTitleWidth() { | ||
80 | + List<InputData> valueList = chart.inputDataList; | ||
81 | + if (valueList == null || valueList.isEmpty()) { | ||
82 | + return 0; | ||
83 | + } | ||
84 | + | ||
85 | + String maxValue = String.valueOf(ValueUtils.max(chartPathList)); | ||
86 | + int titleWidth = (int) textPaint.measureText(maxValue); | ||
87 | + int padding = chart.padding; | ||
88 | + | ||
89 | + return padding + titleWidth + padding; | ||
90 | + } | ||
91 | + | ||
92 | + //添加路径 | ||
93 | + public void setChartPaths(List<InputData> inputData) { | ||
94 | + if (null == chartPathList) chartPathList = new ArrayList<>(); | ||
95 | + ChartPath chartPath = new ChartPath(inputData); | ||
96 | + chartPathList.add(chartPath); | ||
97 | + chart.setInputDataList(inputData); | ||
98 | + chart.titleWidth = getTitleWidth(); | ||
99 | + invalidate(); | ||
100 | + | ||
101 | + } | ||
102 | + | ||
103 | + /** | ||
104 | + * 初始化 画笔 | ||
105 | + */ | ||
106 | + Path path = new Path(); | ||
107 | + | ||
108 | + private void initPaint() { | ||
109 | + | ||
110 | + chart = new Chart(); | ||
111 | +// chart.height = getMeasuredHeight(); | ||
112 | +// chart.width = getWidth(); | ||
113 | + chart.heightOffset = (int) (getResources().getDimension(R.dimen.dp_4) + getResources().getDimension(R.dimen.dp_4)); | ||
114 | + chart.padding = (int) (getResources().getDimension(R.dimen.dp_10)); | ||
115 | + chart.textSize = (int) getResources().getDimension(R.dimen.dp_14); | ||
116 | + chart.radius = (int) getResources().getDimension(R.dimen.dp_4); | ||
117 | + chart.inerRadius = (int) getResources().getDimension(R.dimen.dp_4); | ||
118 | + | ||
119 | + axisPaint = new Paint(); | ||
120 | + axisPaint.setColor(getResources().getColor(R.color.theme_day_blue)); | ||
121 | + axisPaint.setStyle(Paint.Style.FILL); | ||
122 | + axisPaint.setAntiAlias(true); | ||
123 | + axisPaint.setTextSize(chart.textSize); | ||
124 | + | ||
125 | + valuesPaint = new Paint(); | ||
126 | + valuesPaint.setAntiAlias(true); | ||
127 | + valuesPaint.setTextSize(chart.textSize); | ||
128 | + valuesPaint.setStrokeWidth(2); | ||
129 | + valuesPaint.setStyle(Paint.Style.FILL); | ||
130 | + valuesPaint.setColor(getResources().getColor(R.color.theme_day_blue)); | ||
131 | + | ||
132 | + textPaint = new Paint(); | ||
133 | + textPaint.setColor(getResources().getColor(R.color.text_color_dark)); | ||
134 | + textPaint.setTextSize(chart.textSize); | ||
135 | + textPaint.setAntiAlias(true); | ||
136 | + textPaint.setStyle(Paint.Style.FILL); | ||
137 | + | ||
138 | + effectPaint = new Paint(); | ||
139 | + effectPaint.setStyle(Paint.Style.STROKE); | ||
140 | + effectPaint.setAntiAlias(true); | ||
141 | + effectPaint.setStrokeWidth(2); | ||
142 | + effectPaint.setColor(getResources().getColor(R.color.theme_day_blue)); | ||
143 | +// path.lineTo(); | ||
144 | + effectPaint.setPathEffect(new PathDashPathEffect(path, 15, 0, PathDashPathEffect.Style.ROTATE)); | ||
145 | + | ||
146 | + } | ||
147 | + | ||
148 | + @Override | ||
149 | + protected void onDraw(Canvas canvas) { | ||
150 | + super.onDraw(canvas); | ||
151 | + | ||
152 | + drawChartVertical(canvas); | ||
153 | + drawFrameLines(canvas); | ||
154 | + drawChartHorizontal(canvas); | ||
155 | + | ||
156 | + | ||
157 | + } | ||
158 | + | ||
159 | + | ||
160 | + private void drawChartVertical(@NonNull Canvas canvas) { | ||
161 | + List<InputData> inputDataList = chart.getInputDataList(); | ||
162 | + if (inputDataList == null || inputDataList.isEmpty()) { | ||
163 | + return; | ||
164 | + } | ||
165 | + | ||
166 | + long maxValue = ValueUtils.max(chartPathList); | ||
167 | + long correctedMaxValue = ValueUtils.getCorrectedMaxValue(maxValue); | ||
168 | + float value = (float) correctedMaxValue / maxValue; | ||
169 | + | ||
170 | + long heightOffset = chart.heightOffset; | ||
171 | + int padding = chart.padding; | ||
172 | + int textSize = chart.textSize; | ||
173 | + int titleWidth = chart.titleWidth; | ||
174 | + | ||
175 | + float width = chart.width - chart.textSize - chart.padding; | ||
176 | + float height = chart.height - textSize - padding; | ||
177 | + float chartPartHeight = ((height - heightOffset) * value) / Chart.CHART_PARTS; | ||
178 | + | ||
179 | + float currHeight = height; | ||
180 | + int currTitle = 0; | ||
181 | + | ||
182 | + for (int i = 0; i <= Chart.CHART_PARTS; i++) { | ||
183 | + float titleY = currHeight; | ||
184 | + | ||
185 | + if (i <= 0) { | ||
186 | + titleY = height; | ||
187 | + | ||
188 | + } else if (textSize + chart.heightOffset > currHeight) { | ||
189 | + titleY = currHeight + textSize - Chart.TEXT_SIZE_OFFSET; | ||
190 | + } | ||
191 | + | ||
192 | + if (i > 0) { | ||
193 | +// canvas.drawLine(titleWidth, currHeight, width, currHeight, frameInternalPaint); | ||
194 | + //横向间隔线 | ||
195 | + canvas.drawLine(titleWidth-5,titleY-textSize/2,width,titleY-textSize/2,textPaint); | ||
196 | + } | ||
197 | + | ||
198 | + String title = String.valueOf(currTitle); | ||
199 | + canvas.drawText(title, padding, titleY, textPaint); | ||
200 | + textPaint.setColor(getResources().getColor(R.color.gray)); | ||
201 | + | ||
202 | + currHeight -= chartPartHeight; | ||
203 | + currTitle += correctedMaxValue / Chart.CHART_PARTS; | ||
204 | + } | ||
205 | + } | ||
206 | + | ||
207 | + private void drawChartHorizontal(@NonNull Canvas canvas) { | ||
208 | + for (int j = 0; j < chartPathList.size(); j++) { | ||
209 | + chagerColor(j); | ||
210 | + List<InputData> inputDataList = chart.getInputDataList(); | ||
211 | +// List<DrawData> drawDataList = chart.getDrawDataList(); | ||
212 | + List<DrawData> drawDataList = ValueUtils.getDrawDatas(chartPathList.get(j).inputDataList, chart); | ||
213 | + if (inputDataList == null || inputDataList.isEmpty() || drawDataList == null || drawDataList.isEmpty()) { | ||
214 | + return; | ||
215 | + } | ||
216 | + for (int i = 0; i < inputDataList.size(); i++) { | ||
217 | + | ||
218 | + InputData inputData = inputDataList.get(i); | ||
219 | +// String date = DateUtils.format(inputData.valueX); | ||
220 | + String date = inputData.valueX; | ||
221 | + int dateWidth = (int) axisPaint.measureText(date); | ||
222 | + int x; | ||
223 | + if (drawDataList.size() > i) { | ||
224 | + DrawData drawData = drawDataList.get(i); | ||
225 | + x = drawData.startX; | ||
226 | + if (i > 0) { | ||
227 | +// x -= (dateWidth / 2); | ||
228 | + x = drawDataList.get(i).startX - (dateWidth / 2) - chart.padding - chart.textSize; | ||
229 | + } | ||
230 | + } else { | ||
231 | + x = drawDataList.get(drawDataList.size() - 1).stopX - dateWidth - chart.padding - chart.textSize; | ||
232 | + } | ||
233 | + if (i > 0) { | ||
234 | + float startX = i == drawDataList.size() ? x + chart.textSize : x + dateWidth / 2; | ||
235 | + float startY = drawDataList.get(i - 1).stopY; | ||
236 | + float stopX = i == drawDataList.size() ? x + chart.textSize : x + dateWidth / 2; | ||
237 | + float stopY = chart.height - chart.textSize - chart.padding; | ||
238 | + | ||
239 | +// canvas.drawLine(startX, | ||
240 | +// startY, | ||
241 | +// stopX, | ||
242 | +// stopY, effectPaint); | ||
243 | + | ||
244 | + //画文字 | ||
245 | + canvas.drawText(date, x, chart.height - chart.padding / 2, textPaint); | ||
246 | + | ||
247 | + //画圆点 | ||
248 | + canvas.drawCircle(startX, startY, 10, valuesPaint); | ||
249 | + | ||
250 | + //点之间的连线 | ||
251 | + if (i < drawDataList.size() - 1) { | ||
252 | + canvas.drawLine(startX, startY, drawDataList.get(i + 1).startX - chart.padding - chart.textSize, drawDataList.get(i + 1).startY, valuesPaint); | ||
253 | + } else { | ||
254 | + canvas.drawLine(drawDataList.get(drawDataList.size() - 1).startX - chart.padding - chart.textSize, | ||
255 | + drawDataList.get(drawDataList.size() - 1).startY, startX, startY, valuesPaint); | ||
256 | + } | ||
257 | + } | ||
258 | + } | ||
259 | + } | ||
260 | + } | ||
261 | + | ||
262 | + private void chagerColor(int j) { | ||
263 | + switch (j){ | ||
264 | + case 0: | ||
265 | + valuesPaint.setColor(getResources().getColor(R.color.theme_day_blue)); | ||
266 | + break; | ||
267 | + case 1: | ||
268 | + valuesPaint.setColor(getResources().getColor(R.color.md_light_green_500)); | ||
269 | + break; | ||
270 | + case 2: | ||
271 | + valuesPaint.setColor(getResources().getColor(R.color.light_yellow)); | ||
272 | + break; | ||
273 | + } | ||
274 | + } | ||
275 | + | ||
276 | + //画横纵坐标轴 | ||
277 | + private void drawFrameLines(@NonNull Canvas canvas) { | ||
278 | + int textSize = chart.textSize; | ||
279 | + int padding = chart.padding; | ||
280 | + | ||
281 | + int height = chart.height - textSize - padding; | ||
282 | + int width = chart.width - textSize - padding; | ||
283 | + int titleWidth = chart.titleWidth-5; | ||
284 | + int heightOffset = chart.heightOffset; | ||
285 | + | ||
286 | + canvas.drawLine(titleWidth, heightOffset, titleWidth, height, axisPaint); | ||
287 | + canvas.drawLine(titleWidth, height, width, height, axisPaint); | ||
288 | + } | ||
289 | + | ||
290 | + @Override | ||
291 | + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | ||
292 | + super.onMeasure(widthMeasureSpec, heightMeasureSpec); | ||
293 | + | ||
294 | + int width = MeasureSpec.getSize(widthMeasureSpec); | ||
295 | + int height = MeasureSpec.getSize(heightMeasureSpec) / 2; | ||
296 | + chart.width = width; | ||
297 | + chart.height = height; | ||
298 | + setMeasuredDimension(width, height); | ||
299 | + chart.setDrawDataList(ValueUtils.getDrawData(chart)); | ||
300 | + } | ||
301 | +} |
mvpsdk/src/main/java/com/share/mvpsdk/view/chartview/data/Chart.java
0 → 100644
@@ -0,0 +1,62 @@ | @@ -0,0 +1,62 @@ | ||
1 | +package com.share.mvpsdk.view.chartview.data; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | + | ||
5 | +/** | ||
6 | + * Created by ToaHanDong on 2018/3/28. | ||
7 | + * 定义chart表单需要的一些数据 | ||
8 | + */ | ||
9 | + | ||
10 | +public class Chart { | ||
11 | + | ||
12 | + public static final int CHART_PARTS = 5; | ||
13 | + public static final int MAX_ITEMS_COUNT = 7; | ||
14 | + public static final int CHART_PART_VALUE = 10; | ||
15 | + public static final int TEXT_SIZE_OFFSET = 10; | ||
16 | + | ||
17 | + public int width;//表单的宽 | ||
18 | + public int height;//表单的高 | ||
19 | + | ||
20 | + public int padding;//内边距 | ||
21 | + public int titleWidth;// | ||
22 | + public int textSize;//字体大小 | ||
23 | + public int heightOffset; | ||
24 | + | ||
25 | + public int radius; | ||
26 | + public int inerRadius; | ||
27 | + | ||
28 | + public List<InputData> inputDataList; | ||
29 | + | ||
30 | + public List<DrawData> drawDataList; | ||
31 | + | ||
32 | + public void setInputDataList(List<InputData> inputDataList){ | ||
33 | + this.inputDataList=inputDataList; | ||
34 | + } | ||
35 | + | ||
36 | + public List<InputData> getInputDataList(){ | ||
37 | + return inputDataList; | ||
38 | + } | ||
39 | + | ||
40 | + public void setDrawDataList(List<DrawData> drawDataList){ | ||
41 | + this.drawDataList=drawDataList; | ||
42 | + } | ||
43 | + | ||
44 | + public List<DrawData> getDrawDataList(){ | ||
45 | + return drawDataList; | ||
46 | + } | ||
47 | + | ||
48 | + | ||
49 | + @Override | ||
50 | + public String toString() { | ||
51 | + return "Chart{" + | ||
52 | + "width=" + width + | ||
53 | + ", height=" + height + | ||
54 | + ", padding=" + padding + | ||
55 | + ", titleWidth=" + titleWidth + | ||
56 | + ", textSize=" + textSize + | ||
57 | + ", heightOffset=" + heightOffset + | ||
58 | + ", radius=" + radius + | ||
59 | + ", inerRadius=" + inerRadius + | ||
60 | + '}'; | ||
61 | + } | ||
62 | +} |
mvpsdk/src/main/java/com/share/mvpsdk/view/chartview/data/ChartPath.java
0 → 100644
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +package com.share.mvpsdk.view.chartview.data; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | + | ||
5 | +/** | ||
6 | + * Created by ToaHanDong on 2018/3/28. | ||
7 | + */ | ||
8 | + | ||
9 | +//路径 | ||
10 | +public class ChartPath { | ||
11 | + | ||
12 | + public List<InputData> inputDataList; | ||
13 | + | ||
14 | + public ChartPath(List<InputData> inputData) { | ||
15 | + this.inputDataList=inputData; | ||
16 | + } | ||
17 | + | ||
18 | + @Override | ||
19 | + public String toString() { | ||
20 | + return "ChartPath{" + | ||
21 | + "inputDataList=" + inputDataList + | ||
22 | + '}'; | ||
23 | + } | ||
24 | +} |
mvpsdk/src/main/java/com/share/mvpsdk/view/chartview/data/DrawData.java
0 → 100644
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +package com.share.mvpsdk.view.chartview.data; | ||
2 | + | ||
3 | +/** | ||
4 | + * Created by ToaHanDong on 2018/3/28. | ||
5 | + */ | ||
6 | + | ||
7 | +public class DrawData { | ||
8 | + | ||
9 | + public int startX; | ||
10 | + public int startY; | ||
11 | + | ||
12 | + public int stopX; | ||
13 | + public int stopY; | ||
14 | + | ||
15 | + @Override | ||
16 | + public String toString() { | ||
17 | + return "DrawData{" + | ||
18 | + "startX=" + startX + | ||
19 | + ", startY=" + startY + | ||
20 | + ", stopX=" + stopX + | ||
21 | + ", stopY=" + stopY + | ||
22 | + '}'; | ||
23 | + } | ||
24 | +} |
mvpsdk/src/main/java/com/share/mvpsdk/view/chartview/data/InputData.java
0 → 100644
@@ -0,0 +1,26 @@ | @@ -0,0 +1,26 @@ | ||
1 | +package com.share.mvpsdk.view.chartview.data; | ||
2 | + | ||
3 | +/** | ||
4 | + * Created by ToaHanDong on 2018/3/28. | ||
5 | + * 输入的x、y参数 | ||
6 | + */ | ||
7 | + | ||
8 | +public class InputData { | ||
9 | + | ||
10 | + public String valueX; | ||
11 | + | ||
12 | + public long valueY; | ||
13 | + | ||
14 | + public InputData(String valueX,long valueY){ | ||
15 | + this.valueX=valueX; | ||
16 | + this.valueY=valueY; | ||
17 | + } | ||
18 | + | ||
19 | + @Override | ||
20 | + public String toString() { | ||
21 | + return "InputData{" + | ||
22 | + "valueX=" + valueX + | ||
23 | + ", valueY=" + valueY + | ||
24 | + '}'; | ||
25 | + } | ||
26 | +} |