Commit f3a94eeeb12c01248bbeafc1cce5bf744119e560
Exists in
yxb_dev
and in
2 other branches
no message
Showing
29 changed files
with
546 additions
and
229 deletions
Show diff stats
app/libs/processor.jar
No preview for this file type
app/src/main/java/com/shunzhi/parent/adapter/DeyuDetialAdapter.java
... | ... | @@ -10,7 +10,7 @@ import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter; |
10 | 10 | import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder; |
11 | 11 | import com.shunzhi.parent.R; |
12 | 12 | import com.shunzhi.parent.bean.report.DeyuDetialBean; |
13 | -import com.shunzhi.parent.ui.activity.report.ReportSceneActivity; | |
13 | + | |
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Created by Administrator on 2018/3/28 0028. |
... | ... | @@ -18,9 +18,20 @@ import com.shunzhi.parent.ui.activity.report.ReportSceneActivity; |
18 | 18 | |
19 | 19 | public class DeyuDetialAdapter extends BaseRecyclerViewAdapter<DeyuDetialBean> { |
20 | 20 | private Context mContext = null; |
21 | + private int type; | |
22 | + private String objectId,startDate,endDate; | |
21 | 23 | |
22 | 24 | public DeyuDetialAdapter(Context context) { |
23 | 25 | mContext = context; |
26 | + | |
27 | + } | |
28 | + | |
29 | + public void setType(int type, String objectId,String startDate,String endDate) { | |
30 | + this.type = type; | |
31 | + this.objectId = objectId; | |
32 | + this.startDate = startDate; | |
33 | + this.endDate = endDate; | |
34 | + | |
24 | 35 | } |
25 | 36 | |
26 | 37 | |
... | ... | @@ -32,46 +43,45 @@ public class DeyuDetialAdapter extends BaseRecyclerViewAdapter<DeyuDetialBean> { |
32 | 43 | |
33 | 44 | private class DeyuDetialViewHolder extends BaseRecyclerViewHolder<DeyuDetialBean> { |
34 | 45 | |
35 | - TextView txt_name,jidian,paiming,pingjia; | |
46 | + TextView txt_name, tv_jidian, tv_paiming, pingjia; | |
36 | 47 | |
37 | 48 | public DeyuDetialViewHolder(View itemView) { |
38 | 49 | super(itemView); |
39 | - txt_name=itemView.findViewById(R.id.txt_name); | |
40 | - jidian=itemView.findViewById(R.id.jidian); | |
41 | - paiming=itemView.findViewById(R.id.paiming); | |
42 | - pingjia=itemView.findViewById(R.id.pingjia); | |
50 | + | |
51 | + txt_name = itemView.findViewById(R.id.txt_name); | |
52 | + tv_jidian = itemView.findViewById(R.id.tv_jidian); | |
53 | + tv_paiming = itemView.findViewById(R.id.tv_paiming); | |
54 | + pingjia = itemView.findViewById(R.id.tv_pingjia); | |
43 | 55 | |
44 | 56 | } |
45 | 57 | |
46 | 58 | @Override |
47 | 59 | public void onBindViewHolder(final DeyuDetialBean object, int position) { |
48 | 60 | txt_name.setText(object.getSceneName()); |
49 | - jidian.setText("绩点:"+String.format("%.1f", object.getPointScore())+" "+object.getRisePoint()); | |
50 | - String pStr=getPaiming(object.getRanking()); | |
51 | - paiming.setText("排名:"+pStr+" "+object.getRiseRanking()); | |
52 | - pingjia.setText(object.getEvaluationGrade()); | |
53 | - | |
61 | + tv_jidian.setText("绩点:" + String.format("%.1f", object.getPoint()) + " " + object.getPointChangeName()); | |
62 | + String pStr = getPaiming(object.getSort()); | |
63 | + tv_paiming.setText("排名:" + pStr + " " + object.getSortChangeName()); | |
64 | + pingjia.setText(object.getLeavel()); | |
54 | 65 | |
55 | 66 | itemView.setOnClickListener(new View.OnClickListener() { |
56 | 67 | @Override |
57 | 68 | public void onClick(View v) { |
58 | - ReportSceneActivity.getInstance(mContext,object.getSceneId()); | |
69 | + | |
59 | 70 | } |
60 | 71 | }); |
61 | - | |
62 | 72 | } |
63 | 73 | } |
64 | 74 | |
65 | - public String getPaiming(float ranking) { | |
66 | - String s=String.valueOf((int)ranking); | |
75 | + public String getPaiming(float ranking) { | |
76 | + String s = String.valueOf((int) ranking); | |
67 | 77 | |
68 | - return "第"+toChinese(s)+"名"; | |
78 | + return "第" + toChinese(s) + "名"; | |
69 | 79 | } |
70 | 80 | |
71 | 81 | |
72 | 82 | public String toChinese(String string) { |
73 | - String[] s1 = { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" }; | |
74 | - String[] s2 = { "十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千" }; | |
83 | + String[] s1 = {"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"}; | |
84 | + String[] s2 = {"十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千"}; | |
75 | 85 | |
76 | 86 | String result = ""; |
77 | 87 | |
... | ... | @@ -85,7 +95,7 @@ public class DeyuDetialAdapter extends BaseRecyclerViewAdapter<DeyuDetialBean> { |
85 | 95 | } else { |
86 | 96 | result += s1[num]; |
87 | 97 | } |
88 | - System.out.println(" "+result); | |
98 | + System.out.println(" " + result); | |
89 | 99 | } |
90 | 100 | |
91 | 101 | System.out.println("----------------"); | ... | ... |
app/src/main/java/com/shunzhi/parent/adapter/ReportAdapter.java
... | ... | @@ -2,7 +2,6 @@ package com.shunzhi.parent.adapter; |
2 | 2 | |
3 | 3 | |
4 | 4 | import android.content.Context; |
5 | -import android.content.Intent; | |
6 | 5 | import android.support.v7.widget.LinearLayoutManager; |
7 | 6 | import android.support.v7.widget.RecyclerView; |
8 | 7 | import android.view.LayoutInflater; |
... | ... | @@ -63,7 +62,7 @@ public class ReportAdapter extends BaseRecyclerViewAdapter<ReportBean> { |
63 | 62 | deyu_content.setOnClickListener(new View.OnClickListener() { |
64 | 63 | @Override |
65 | 64 | public void onClick(View v) { |
66 | - context.startActivity(new Intent().setClass(context, ReportDetialActivity.class)); | |
65 | + ReportDetialActivity.getInstance(context,"2018-04-11",2,"34345"); | |
67 | 66 | } |
68 | 67 | }); |
69 | 68 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/api/ReportApi.java
... | ... | @@ -23,11 +23,11 @@ public interface ReportApi { |
23 | 23 | @Field("endDate") String endDate); |
24 | 24 | |
25 | 25 | @FormUrlEncoded |
26 | - @POST("api/EvaluationLabel/Getstatisticsanalytical") | |
26 | + @POST("api/EvaluationWay/getClassAndStudentCal") | |
27 | 27 | Observable<JsonObject> getReportDetial(@Field("screenId") int screenId, |
28 | 28 | @Field("schoolId") int SchoolId, |
29 | - @Field("objectType") int ObjectType, | |
30 | - @Field("classId") String classId, | |
29 | + @Field("searchType") int ObjectType, | |
30 | + @Field("objectId") String classId, | |
31 | 31 | @Field("startDate") String startDate, |
32 | 32 | @Field("endDate") String endDate); |
33 | 33 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/bean/report/ChatBean.java
0 → 100644
... | ... | @@ -0,0 +1,26 @@ |
1 | +package com.shunzhi.parent.bean.report; | |
2 | + | |
3 | +/** | |
4 | + * Created by lenovo on 2018/4/10. | |
5 | + */ | |
6 | + | |
7 | +public class ChatBean { | |
8 | + public String date; | |
9 | + public float gap; | |
10 | + | |
11 | + public String getDate() { | |
12 | + return date; | |
13 | + } | |
14 | + | |
15 | + public void setDate(String date) { | |
16 | + this.date = date; | |
17 | + } | |
18 | + | |
19 | + public float getGap() { | |
20 | + return gap; | |
21 | + } | |
22 | + | |
23 | + public void setGap(float gap) { | |
24 | + this.gap = gap; | |
25 | + } | |
26 | +} | ... | ... |
app/src/main/java/com/shunzhi/parent/bean/report/DeyuDetialBean.java
... | ... | @@ -5,14 +5,29 @@ package com.shunzhi.parent.bean.report; |
5 | 5 | */ |
6 | 6 | |
7 | 7 | public class DeyuDetialBean { |
8 | - float pointScore; | |
9 | - String risePoint; | |
10 | - float ranking; | |
11 | - String riseRanking; | |
12 | - String evaluationGrade; | |
13 | - int sceneId; | |
8 | + float point; | |
9 | + String pointChangeName; | |
10 | + float sort; | |
11 | + String sortChangeName; | |
12 | + String leavel; | |
13 | + int sceneID; | |
14 | 14 | String sceneName; |
15 | 15 | |
16 | + public String getPointChangeName() { | |
17 | + return pointChangeName; | |
18 | + } | |
19 | + | |
20 | + public void setPointChangeName(String pointChangeName) { | |
21 | + this.pointChangeName = pointChangeName; | |
22 | + } | |
23 | + | |
24 | + public String getSortChangeName() { | |
25 | + return sortChangeName; | |
26 | + } | |
27 | + | |
28 | + public void setSortChangeName(String sortChangeName) { | |
29 | + this.sortChangeName = sortChangeName; | |
30 | + } | |
16 | 31 | |
17 | 32 | public String getSceneName() { |
18 | 33 | return sceneName; |
... | ... | @@ -22,60 +37,39 @@ public class DeyuDetialBean { |
22 | 37 | this.sceneName = sceneName; |
23 | 38 | } |
24 | 39 | |
25 | - public float getPointScore() { | |
26 | - return pointScore; | |
40 | + public float getPoint() { | |
41 | + return point; | |
27 | 42 | } |
28 | 43 | |
29 | - public void setPointScore(float pointScore) { | |
30 | - this.pointScore = pointScore; | |
44 | + public void setPoint(float point) { | |
45 | + this.point = point; | |
31 | 46 | } |
32 | 47 | |
33 | - public String getRisePoint() { | |
34 | - return risePoint; | |
35 | - } | |
36 | 48 | |
37 | - public void setRisePoint(String risePoint) { | |
38 | - this.risePoint = risePoint; | |
39 | - } | |
40 | 49 | |
41 | - public float getRanking() { | |
42 | - return ranking; | |
50 | + public float getSort() { | |
51 | + return sort; | |
43 | 52 | } |
44 | 53 | |
45 | - public void setRanking(float ranking) { | |
46 | - this.ranking = ranking; | |
54 | + public void setSort(float sort) { | |
55 | + this.sort = sort; | |
47 | 56 | } |
48 | 57 | |
49 | - public String getRiseRanking() { | |
50 | - return riseRanking; | |
51 | - } | |
52 | 58 | |
53 | - public void setRiseRanking(String riseRanking) { | |
54 | - this.riseRanking = riseRanking; | |
55 | - } | |
56 | 59 | |
57 | - public String getEvaluationGrade() { | |
58 | - return evaluationGrade; | |
60 | + public String getLeavel() { | |
61 | + return leavel; | |
59 | 62 | } |
60 | 63 | |
61 | - public void setEvaluationGrade(String evaluationGrade) { | |
62 | - this.evaluationGrade = evaluationGrade; | |
64 | + public void setLeavel(String leavel) { | |
65 | + this.leavel = leavel; | |
63 | 66 | } |
64 | 67 | |
65 | - public int getSceneId() { | |
66 | - return sceneId; | |
68 | + public int getSceneID() { | |
69 | + return sceneID; | |
67 | 70 | } |
68 | 71 | |
69 | - public void setSceneId(int sceneId) { | |
70 | - this.sceneId = sceneId; | |
72 | + public void setSceneID(int sceneID) { | |
73 | + this.sceneID = sceneID; | |
71 | 74 | } |
72 | 75 | } |
73 | - | |
74 | -//score":0.0, | |
75 | -// "pointScore":2.6624999046325684, | |
76 | -// "risePoint":"同期保持一致", | |
77 | -// "ranking":1.0, | |
78 | -// "riseRanking":"与同期保持一致", | |
79 | -// "evaluationGrade":"E", | |
80 | -// "sceneId":10, | |
81 | -// "sceneName":"好人好事" | |
82 | 76 | \ No newline at end of file | ... | ... |
app/src/main/java/com/shunzhi/parent/contract/report/ReportDetialContract.java
1 | 1 | package com.shunzhi.parent.contract.report; |
2 | 2 | |
3 | +import com.google.gson.JsonArray; | |
3 | 4 | import com.google.gson.JsonObject; |
4 | 5 | import com.share.mvpsdk.base.BasePresenter; |
5 | 6 | import com.share.mvpsdk.base.IBaseModel; |
... | ... | @@ -22,7 +23,8 @@ public interface ReportDetialContract { |
22 | 23 | Observable<JsonObject> getReportDetialResult(int screenId, int schoolId,String classId,int objectType, String startDate, String endDate); |
23 | 24 | } |
24 | 25 | interface IReportDetialView extends IBaseView { |
25 | - void showDetialList(List<DeyuDetialBean> list); | |
26 | +// pointNow,pointPast,sceneName | |
27 | + void showDetialList(List<DeyuDetialBean> list, JsonArray pointNow, JsonArray pointPast, JsonArray sceneName); | |
26 | 28 | void showDetialInfo(float rank, String scoree, String bijiao1,String bijiao2,String bijiao3,String bijiao4,String describe); |
27 | 29 | |
28 | 30 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/contract/report/ReportSceneContract.java
... | ... | @@ -4,9 +4,11 @@ import com.google.gson.JsonObject; |
4 | 4 | import com.share.mvpsdk.base.BasePresenter; |
5 | 5 | import com.share.mvpsdk.base.IBaseModel; |
6 | 6 | import com.share.mvpsdk.base.IBaseView; |
7 | +import com.shunzhi.parent.bean.report.ChatBean; | |
7 | 8 | import com.shunzhi.parent.bean.report.SceneDetialBean; |
8 | 9 | |
9 | 10 | import java.util.List; |
11 | +import java.util.Map; | |
10 | 12 | |
11 | 13 | import io.reactivex.Observable; |
12 | 14 | |
... | ... | @@ -23,6 +25,7 @@ public interface ReportSceneContract { |
23 | 25 | } |
24 | 26 | interface IReportSceneView extends IBaseView { |
25 | 27 | void showSceneList(List<SceneDetialBean> list); |
28 | + void showChart(List<ChatBean>list1, List<ChatBean>list2, List<ChatBean>list3); | |
26 | 29 | void showSceneInfo(String rank,String scoree,String pscoree,String sceneName); |
27 | 30 | |
28 | 31 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/report/ReportDetialPresenter.java
... | ... | @@ -37,15 +37,20 @@ public class ReportDetialPresenter extends ReportDetialContract.ReportDetialPres |
37 | 37 | |
38 | 38 | ToastUtils.showToast(jsonObject.toString()); |
39 | 39 | JsonObject data = jsonObject.getAsJsonObject("data"); |
40 | - String risePoint = data.get("risePoint").getAsString(); | |
41 | - String pointUpAverage = data.get("pointUpAverage").getAsString(); | |
40 | + String risePoint = data.get("pointChangeName").getAsString(); | |
41 | + String pointUpAverage = data.get("pointChangeForAveName").getAsString(); | |
42 | +// float ranking = 0.00f; | |
42 | 43 | float ranking = data.get("ranking").getAsFloat(); |
43 | - String riseRanking = data.get("riseRanking").getAsString(); | |
44 | - String averageRanking = data.get("averageRanking").getAsString(); | |
45 | - String evaluationDescripe = data.get("evaluationDescripe").getAsString(); | |
46 | - String pscore = String.format("%.1f", data.get("pscore").getAsFloat()); | |
44 | + String riseRanking = data.get("rankingChangeName").getAsString(); | |
45 | + String averageRanking = data.get("rankingChangeForAveName").getAsString(); | |
46 | + String evaluationDescripe = data.get("describe").getAsString(); | |
47 | +// String pscore = ""; | |
48 | + String pscore = String.format("%.1f", data.get("point").getAsFloat()); | |
47 | 49 | |
48 | - JsonArray reportDetialArray = data.getAsJsonArray("sceneStatistics"); | |
50 | + JsonArray pointNow = data.getAsJsonArray("pointNow");//今日 | |
51 | + JsonArray pointPast = data.getAsJsonArray("pointPast");//昨日 | |
52 | + JsonArray sceneName = data.getAsJsonArray("sceneName");//今日场景 | |
53 | + JsonArray reportDetialArray = data.getAsJsonArray("sceneNow"); | |
49 | 54 | Gson g = new Gson(); |
50 | 55 | List<DeyuDetialBean> list = new ArrayList<>(); |
51 | 56 | Iterator it = reportDetialArray.iterator(); //Iterator处理 |
... | ... | @@ -53,10 +58,11 @@ public class ReportDetialPresenter extends ReportDetialContract.ReportDetialPres |
53 | 58 | DeyuDetialBean bean = g.fromJson(it.next().toString(), DeyuDetialBean.class); //String转化成JavaBean |
54 | 59 | list.add(bean); //加入list |
55 | 60 | } |
56 | - mIView.showDetialList(list); | |
61 | + mIView.showDetialList(list,pointNow,pointPast,sceneName); | |
57 | 62 | mIView.showDetialInfo(ranking, pscore, risePoint, pointUpAverage, riseRanking, averageRanking, evaluationDescripe); |
58 | 63 | |
59 | 64 | |
65 | + | |
60 | 66 | } |
61 | 67 | }, new Consumer<Throwable>() { |
62 | 68 | @Override | ... | ... |
app/src/main/java/com/shunzhi/parent/presenter/report/ReportPresenter.java
app/src/main/java/com/shunzhi/parent/presenter/report/ReportScenePresenter.java
... | ... | @@ -5,6 +5,7 @@ import com.google.gson.Gson; |
5 | 5 | import com.google.gson.JsonArray; |
6 | 6 | import com.google.gson.JsonObject; |
7 | 7 | import com.share.mvpsdk.utils.ToastUtils; |
8 | +import com.shunzhi.parent.bean.report.ChatBean; | |
8 | 9 | import com.shunzhi.parent.bean.report.SceneDetialBean; |
9 | 10 | import com.shunzhi.parent.contract.report.ReportSceneContract; |
10 | 11 | import com.shunzhi.parent.model.report.ReportSceneModel; |
... | ... | @@ -49,7 +50,30 @@ public class ReportScenePresenter extends ReportSceneContract.ReportScenePresent |
49 | 50 | SceneDetialBean bean = g.fromJson(it.next().toString(), SceneDetialBean.class); //String转化成JavaBean |
50 | 51 | list.add(bean); //加入list |
51 | 52 | } |
53 | + List<ChatBean>list1=new ArrayList<>(); | |
54 | + List<ChatBean>list2=new ArrayList<>(); | |
55 | + List<ChatBean>list3=new ArrayList<>(); | |
56 | + JsonArray objectGap = data.getAsJsonArray("objectGap"); | |
57 | + JsonArray averageGap = data.getAsJsonArray("averageGap"); | |
58 | + JsonArray highGap = data.getAsJsonArray("highGap"); | |
59 | + Iterator it1 = objectGap.iterator(); //Iterator处理 | |
60 | + while (it1.hasNext()) { //循环 | |
61 | + ChatBean bean = g.fromJson(it1.next().toString(), ChatBean.class); //String转化成JavaBean | |
62 | + list1.add(bean); //加入list | |
63 | + } | |
64 | + Iterator it2 = averageGap.iterator(); //Iterator处理 | |
65 | + while (it2.hasNext()) { //循环 | |
66 | + ChatBean bean = g.fromJson(it2.next().toString(), ChatBean.class); //String转化成JavaBean | |
67 | + list2.add(bean); //加入list | |
68 | + } | |
69 | + Iterator it3 = highGap.iterator(); //Iterator处理 | |
70 | + while (it3.hasNext()) { //循环 | |
71 | + ChatBean bean = g.fromJson(it3.next().toString(), ChatBean.class); //String转化成JavaBean | |
72 | + list3.add(bean); //加入list | |
73 | + } | |
74 | + | |
52 | 75 | mIView.showSceneList(list); |
76 | + mIView.showChart(list1,list2,list3); | |
53 | 77 | mIView.showSceneInfo(rank,scoree,pscoree,sceneName); |
54 | 78 | } |
55 | 79 | }, new Consumer<Throwable>() { | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/ChildDetialActivity.java
1 | 1 | package com.shunzhi.parent.ui.activity; |
2 | 2 | |
3 | 3 | import android.os.Bundle; |
4 | +import android.support.annotation.NonNull; | |
4 | 5 | import android.text.TextUtils; |
6 | +import android.view.Gravity; | |
7 | +import android.view.LayoutInflater; | |
5 | 8 | import android.view.View; |
9 | +import android.view.ViewGroup; | |
10 | +import android.view.WindowManager; | |
6 | 11 | import android.widget.ImageView; |
12 | +import android.widget.PopupWindow; | |
7 | 13 | import android.widget.TextView; |
8 | 14 | |
9 | 15 | import com.google.gson.Gson; |
10 | -import com.share.mvpsdk.base.activity.BaseCompatActivity; | |
16 | +import com.share.mvpsdk.base.BasePresenter; | |
17 | +import com.share.mvpsdk.base.activity.BaseMVPCompatActivity; | |
11 | 18 | import com.shunzhi.parent.R; |
12 | 19 | import com.shunzhi.parent.bean.ChildBean; |
20 | +import com.shunzhi.parent.bean.ChildClass; | |
21 | +import com.shunzhi.parent.bean.CurrentBean; | |
22 | +import com.shunzhi.parent.contract.mine.MyChildContract; | |
23 | + | |
24 | +import java.util.List; | |
13 | 25 | |
14 | 26 | /** |
15 | 27 | * Created by Administrator on 2018/3/16 0016. |
16 | 28 | */ |
17 | 29 | |
18 | -public class ChildDetialActivity extends BaseCompatActivity { | |
19 | - TextView child_name, child_school, child_class, school_area, student_code,center_title; | |
30 | +public class ChildDetialActivity extends BaseMVPCompatActivity<MyChildContract.MyChildPresenter, MyChildContract.IMyChildModel> | |
31 | + implements MyChildContract.IMyChildView, View.OnClickListener { | |
32 | + TextView child_name, child_school, child_class, school_area, student_code, center_title; | |
20 | 33 | ImageView back; |
21 | 34 | |
22 | 35 | @Override |
23 | 36 | protected void initView(Bundle savedInstanceState) { |
24 | - String childJson=getIntent().getStringExtra("childJson"); | |
37 | + String childJson = getIntent().getStringExtra("childJson"); | |
25 | 38 | child_name = findViewById(R.id.child_name); |
26 | 39 | child_school = findViewById(R.id.child_school); |
27 | 40 | child_class = findViewById(R.id.child_class); |
... | ... | @@ -36,17 +49,17 @@ public class ChildDetialActivity extends BaseCompatActivity { |
36 | 49 | finish(); |
37 | 50 | } |
38 | 51 | }); |
39 | - if(!TextUtils.isEmpty(childJson)) | |
40 | - initChild(childJson); | |
52 | + if (!TextUtils.isEmpty(childJson)) | |
53 | + initChild(childJson); | |
41 | 54 | } |
42 | 55 | |
43 | 56 | private void initChild(String childJson) { |
44 | - Gson g=new Gson(); | |
45 | - ChildBean childBean=g.fromJson(childJson, ChildBean.class); | |
57 | + Gson g = new Gson(); | |
58 | + ChildBean childBean = g.fromJson(childJson, ChildBean.class); | |
46 | 59 | child_name.setText(childBean.getStudentName()); |
47 | 60 | child_school.setText(childBean.getSchoolName()); |
48 | 61 | child_class.setText(childBean.getClassName()); |
49 | - school_area.setText(childBean.getCityName()+childBean.getAreaName()); | |
62 | + school_area.setText(childBean.getCityName() + childBean.getAreaName()); | |
50 | 63 | student_code.setText(childBean.getStudentCode()); |
51 | 64 | |
52 | 65 | } |
... | ... | @@ -55,4 +68,74 @@ public class ChildDetialActivity extends BaseCompatActivity { |
55 | 68 | protected int getLayoutId() { |
56 | 69 | return R.layout.activity_child_detail; |
57 | 70 | } |
71 | + | |
72 | + @Override | |
73 | + public void onClick(View v) { | |
74 | + | |
75 | + } | |
76 | + | |
77 | + @NonNull | |
78 | + @Override | |
79 | + public BasePresenter initPresenter() { | |
80 | + return null; | |
81 | + } | |
82 | + | |
83 | + @Override | |
84 | + public void updateChildList(CurrentBean currentBean) { | |
85 | + | |
86 | + } | |
87 | + | |
88 | + @Override | |
89 | + public void addChildSuccess(String account, String password) { | |
90 | + | |
91 | + } | |
92 | + | |
93 | + @Override | |
94 | + public void showClass(List<ChildClass> list) { | |
95 | + | |
96 | + } | |
97 | + | |
98 | + @Override | |
99 | + public void showError(String error) { | |
100 | + | |
101 | + } | |
102 | + | |
103 | + public void delectChild() { | |
104 | + | |
105 | + final PopupWindow popupWindow = new PopupWindow(); | |
106 | + popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); | |
107 | + popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); | |
108 | + backgroundAlpha(0.5f); | |
109 | + View view = LayoutInflater.from(ChildDetialActivity.this).inflate(R.layout.dialog_view, null); | |
110 | + TextView tv = view.findViewById(R.id.dialog_info); | |
111 | + tv.setText("是否解除绑定?"); | |
112 | + TextView btn_cancel = view.findViewById(R.id.cancel_btn); | |
113 | + btn_cancel.setOnClickListener(new View.OnClickListener() { | |
114 | + @Override | |
115 | + public void onClick(View v) { | |
116 | + popupWindow.dismiss(); | |
117 | + backgroundAlpha(1f); | |
118 | + } | |
119 | + }); | |
120 | + TextView btn_right = view.findViewById(R.id.right_btn); | |
121 | + btn_right.setOnClickListener(new View.OnClickListener() { | |
122 | + @Override | |
123 | + public void onClick(View v) { | |
124 | + popupWindow.dismiss(); | |
125 | + backgroundAlpha(1f); | |
126 | + | |
127 | + } | |
128 | + }); | |
129 | + popupWindow.setContentView(view); | |
130 | + popupWindow.showAtLocation(child_name, Gravity.CENTER, 0, 0); | |
131 | + | |
132 | + } | |
133 | + | |
134 | + | |
135 | + public void backgroundAlpha(float bgAlpha) { | |
136 | + WindowManager.LayoutParams lp = getWindow().getAttributes(); | |
137 | + lp.alpha = bgAlpha; //0.0-1.0 | |
138 | + getWindow().setAttributes(lp); | |
139 | + } | |
140 | + | |
58 | 141 | } | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/report/ReportDetialActivity.java
... | ... | @@ -20,8 +20,11 @@ import com.shunzhi.parent.ui.fragment.report.ReportDetialFragment; |
20 | 20 | */ |
21 | 21 | |
22 | 22 | public class ReportDetialActivity extends BaseMVPCompatActivity implements View.OnClickListener{ |
23 | - public static void getInstance(Context context) { | |
23 | + public static void getInstance(Context context,String day,int schoolId,String objectId ) { | |
24 | 24 | Intent intent = new Intent(context, ReportDetialActivity.class); |
25 | + intent.putExtra("day",day); | |
26 | + intent.putExtra("schoolId",schoolId); | |
27 | + intent.putExtra("objectId",objectId); | |
25 | 28 | context.startActivity(intent); |
26 | 29 | } |
27 | 30 | |
... | ... | @@ -35,6 +38,9 @@ public class ReportDetialActivity extends BaseMVPCompatActivity implements View. |
35 | 38 | |
36 | 39 | ReportDetialFragment reportDetialFragment = null; |
37 | 40 | |
41 | + String day,objectId; | |
42 | + int schoolId; | |
43 | + | |
38 | 44 | @NonNull |
39 | 45 | @Override |
40 | 46 | public BasePresenter initPresenter() { |
... | ... | @@ -53,7 +59,14 @@ public class ReportDetialActivity extends BaseMVPCompatActivity implements View. |
53 | 59 | center_title = findViewById(R.id.center_title); |
54 | 60 | center_title.setText("德育报告"); |
55 | 61 | ivBack.setOnClickListener(this); |
56 | - | |
62 | + day=getIntent().getStringExtra("day"); | |
63 | + objectId=getIntent().getStringExtra("objectId"); | |
64 | + schoolId = getIntent().getIntExtra("schoolId",0); | |
65 | + Bundle bundle=new Bundle(); | |
66 | + bundle.putString("day",day); | |
67 | + bundle.putString("objectId",objectId); | |
68 | + bundle.putInt("schoolId",schoolId); | |
69 | + reportDetialFragment.setArguments(bundle); | |
57 | 70 | fragmentTransaction = getSupportFragmentManager().beginTransaction(); |
58 | 71 | fragmentTransaction.add(R.id.frame_detial, reportDetialFragment) |
59 | 72 | .show(reportDetialFragment).commit(); | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/activity/report/ReportSceneActivity.java
... | ... | @@ -20,9 +20,9 @@ import com.shunzhi.parent.ui.fragment.report.ReportSceneFragment; |
20 | 20 | */ |
21 | 21 | |
22 | 22 | public class ReportSceneActivity extends BaseMVPCompatActivity implements View.OnClickListener { |
23 | - public static void getInstance(Context context,int screenID) { | |
23 | + public static void getInstance(Context context,int sceneID) { | |
24 | 24 | Intent intent = new Intent(context, ReportSceneActivity.class); |
25 | - intent.putExtra("screenID",screenID); | |
25 | + intent.putExtra("sceneID",sceneID); | |
26 | 26 | context.startActivity(intent); |
27 | 27 | } |
28 | 28 | |
... | ... | @@ -54,9 +54,9 @@ public class ReportSceneActivity extends BaseMVPCompatActivity implements View.O |
54 | 54 | center_title = findViewById(R.id.center_title); |
55 | 55 | center_title.setText("场景详情"); |
56 | 56 | ivBack.setOnClickListener(this); |
57 | - int screenID = getIntent().getIntExtra("screenID",0); | |
57 | + int sceneID = getIntent().getIntExtra("sceneID",0); | |
58 | 58 | Bundle bundle=new Bundle(); |
59 | - bundle.putInt("screenID",screenID); | |
59 | + bundle.putInt("sceneID",sceneID); | |
60 | 60 | reportSceneFragment.setArguments(bundle); |
61 | 61 | fragmentTransaction = getSupportFragmentManager().beginTransaction(); |
62 | 62 | fragmentTransaction.add(R.id.frame_scene, reportSceneFragment) | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java
... | ... | @@ -4,33 +4,19 @@ package com.shunzhi.parent.ui.fragment; |
4 | 4 | import android.os.Bundle; |
5 | 5 | import android.os.Handler; |
6 | 6 | import android.os.Message; |
7 | -import android.support.annotation.NonNull; | |
8 | 7 | import android.support.annotation.Nullable; |
9 | 8 | import android.support.design.widget.TabLayout; |
10 | 9 | import android.support.v4.app.Fragment; |
11 | 10 | import android.support.v4.app.FragmentManager; |
12 | 11 | import android.support.v4.app.FragmentPagerAdapter; |
13 | 12 | import android.support.v4.view.ViewPager; |
14 | -import android.support.v7.widget.LinearLayoutManager; | |
15 | -import android.support.v7.widget.RecyclerView; | |
16 | 13 | import android.view.View; |
17 | 14 | import android.widget.TextView; |
18 | 15 | |
19 | -import com.amy.monthweek.materialcalendarview.MonthWeekMaterialCalendarView; | |
20 | -import com.prolificinteractive.materialcalendarview.CalendarDay; | |
21 | -import com.prolificinteractive.materialcalendarview.MaterialCalendarView; | |
22 | -import com.share.mvpsdk.base.BasePresenter; | |
23 | 16 | import com.share.mvpsdk.base.fragment.BaseCompatFragment; |
24 | -import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | |
25 | -import com.share.mvpsdk.utils.ToastUtils; | |
26 | 17 | import com.shunzhi.parent.R; |
27 | -import com.shunzhi.parent.adapter.ReportAdapter; | |
28 | -import com.shunzhi.parent.bean.ReportBean; | |
29 | -import com.shunzhi.parent.contract.report.ReportContract; | |
30 | 18 | import com.shunzhi.parent.popu.ShaiXuanPop; |
31 | -import com.shunzhi.parent.presenter.report.ReportPresenter; | |
32 | 19 | import com.shunzhi.parent.ui.fragment.report.ChengZhangFragment; |
33 | -import com.shunzhi.parent.views.CustomLinearLayoutManager; | |
34 | 20 | |
35 | 21 | import java.util.List; |
36 | 22 | |
... | ... | @@ -45,7 +31,7 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi |
45 | 31 | |
46 | 32 | ChengZhangFragment chengZhangFragment1 = null, chengZhangFragment2 = null;//成长、报告页面 |
47 | 33 | |
48 | - ShaiXuanPop shaiXuanPop=null; | |
34 | + ShaiXuanPop shaiXuanPop = null; | |
49 | 35 | |
50 | 36 | @Override |
51 | 37 | public int getLayoutId() { |
... | ... | @@ -60,6 +46,9 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi |
60 | 46 | tvNoData = view.findViewById(R.id.tvNoData); |
61 | 47 | tabLayout = view.findViewById(R.id.tabLayout); |
62 | 48 | |
49 | + | |
50 | + | |
51 | + tvNoData.setOnClickListener(this); | |
63 | 52 | tvShaiXuan.setOnClickListener(this); |
64 | 53 | |
65 | 54 | myFragmentAdapter = new MyFragmentAdapter(getChildFragmentManager()); |
... | ... | @@ -77,7 +66,7 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi |
77 | 66 | |
78 | 67 | @Override |
79 | 68 | public void onPageSelected(int position) { |
80 | - if (position==0)tvShaiXuan.setVisibility(View.GONE); | |
69 | + if (position == 0) tvShaiXuan.setVisibility(View.GONE); | |
81 | 70 | else tvShaiXuan.setVisibility(View.VISIBLE); |
82 | 71 | } |
83 | 72 | |
... | ... | @@ -91,7 +80,7 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi |
91 | 80 | |
92 | 81 | @Override |
93 | 82 | public void onClick(View view) { |
94 | - switch (view.getId()){ | |
83 | + switch (view.getId()) { | |
95 | 84 | case R.id.tvShaiXuan: |
96 | 85 | if (null == shaiXuanPop) shaiXuanPop = new ShaiXuanPop(getActivity()); |
97 | 86 | chengZhangFragment2.showShaixuan(handler); |
... | ... | @@ -99,7 +88,7 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi |
99 | 88 | } |
100 | 89 | } |
101 | 90 | |
102 | - Handler handler=new Handler(){ | |
91 | + Handler handler = new Handler() { | |
103 | 92 | @Override |
104 | 93 | public void handleMessage(Message msg) { |
105 | 94 | super.handleMessage(msg); |
... | ... | @@ -111,7 +100,7 @@ public class ReportFragment extends BaseCompatFragment implements View.OnClickLi |
111 | 100 | @Override |
112 | 101 | public void onDestroy() { |
113 | 102 | super.onDestroy(); |
114 | - if (handler!=null)handler=null; | |
103 | + if (handler != null) handler = null; | |
115 | 104 | } |
116 | 105 | |
117 | 106 | private class MyFragmentAdapter extends FragmentPagerAdapter { | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/report/ChengZhangFragment.java
... | ... | @@ -18,7 +18,6 @@ import com.shunzhi.parent.R; |
18 | 18 | import com.shunzhi.parent.adapter.ReportAdapter; |
19 | 19 | import com.shunzhi.parent.bean.ReportBean; |
20 | 20 | import com.shunzhi.parent.contract.report.ReportContract; |
21 | -import com.shunzhi.parent.popu.ShaiXuanPop; | |
22 | 21 | import com.shunzhi.parent.presenter.report.ReportPresenter; |
23 | 22 | |
24 | 23 | import java.util.List; | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/report/ReportDetialFragment.java
... | ... | @@ -8,6 +8,7 @@ import android.support.v7.widget.RecyclerView; |
8 | 8 | import android.view.View; |
9 | 9 | import android.widget.TextView; |
10 | 10 | |
11 | +import com.google.gson.JsonArray; | |
11 | 12 | import com.share.mvpsdk.base.BasePresenter; |
12 | 13 | import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; |
13 | 14 | import com.share.mvpsdk.view.chartview.ChartView; |
... | ... | @@ -18,10 +19,7 @@ import com.shunzhi.parent.bean.report.DeyuDetialBean; |
18 | 19 | import com.shunzhi.parent.contract.report.ReportDetialContract; |
19 | 20 | import com.shunzhi.parent.presenter.report.ReportDetialPresenter; |
20 | 21 | |
21 | -import java.text.SimpleDateFormat; | |
22 | 22 | import java.util.ArrayList; |
23 | -import java.util.Calendar; | |
24 | -import java.util.Date; | |
25 | 23 | import java.util.List; |
26 | 24 | |
27 | 25 | /** |
... | ... | @@ -35,10 +33,12 @@ public class ReportDetialFragment extends BaseMVPCompatFragment<ReportDetialCont |
35 | 33 | private DeyuDetialAdapter deyuDetialAdapter; |
36 | 34 | List<DeyuDetialBean> deyulist = new ArrayList<>(); |
37 | 35 | |
38 | - private TextView tv_source, tv_bijiao1, tv_bijiao2, tv_bijiao3, tv_bijiao4, tv_date, tv_ranking, tv_describe; | |
36 | + private TextView tv_source, tv_bijiao1, tv_bijiao2, tv_bijiao3, tv_bijiao4, tv_date, tv_ranking, tv_describe, tvToday, tvYesToday, tvChartData; | |
39 | 37 | |
40 | 38 | |
41 | - private String startDate = "2018-04 -08", endDate = "2018-04-08"; | |
39 | + private String startDate = "", endDate = "", objectId = ""; | |
40 | + | |
41 | + int schoolId; | |
42 | 42 | |
43 | 43 | private ChartView chartView; |
44 | 44 | |
... | ... | @@ -65,23 +65,32 @@ public class ReportDetialFragment extends BaseMVPCompatFragment<ReportDetialCont |
65 | 65 | tv_date = view.findViewById(R.id.tv_date); |
66 | 66 | tv_ranking = view.findViewById(R.id.tv_ranking); |
67 | 67 | tv_describe = view.findViewById(R.id.tv_describe); |
68 | - Calendar c = Calendar.getInstance(); | |
69 | - Date date = c.getTime(); | |
70 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
71 | - String dateStr = sdf.format(date); | |
72 | - tv_date.setText(dateStr); | |
68 | + tvToday = view.findViewById(R.id.tvToday); | |
69 | + tvYesToday = view.findViewById(R.id.tvYesToday); | |
70 | + tvChartData = view.findViewById(R.id.tvChartData); | |
71 | + tvToday.setText("今日"); | |
72 | + tvYesToday.setText("昨日"); | |
73 | + | |
74 | + startDate = getArguments().getString("day"); | |
75 | + endDate = getArguments().getString("day"); | |
76 | + objectId = getArguments().getString("objectId"); | |
77 | + schoolId = getArguments().getInt("schoolId"); | |
78 | + | |
79 | + | |
80 | + tv_date.setText(startDate); | |
73 | 81 | |
74 | 82 | recycle_deyu.setLayoutManager(new LinearLayoutManager(getActivity())); |
75 | 83 | deyuDetialAdapter = new DeyuDetialAdapter(getActivity()); |
76 | 84 | recycle_deyu.setAdapter(deyuDetialAdapter); |
77 | - initChartViews(); | |
78 | - mPresenter.reportDetialResult(0, 1, "70", 0, startDate, endDate); | |
85 | +// initChartViews(); | |
86 | + mPresenter.reportDetialResult(0, schoolId, objectId, 0, startDate, endDate); | |
87 | + | |
79 | 88 | |
80 | 89 | } |
81 | 90 | |
82 | 91 | private void initChartViews() { |
83 | 92 | |
84 | - chartView.setColors(R.color.textColor, R.color.huodong_blue, R.color.gray); | |
93 | + chartView.setColors(R.color.blue, R.color.green, R.color.gray); | |
85 | 94 | List<InputData> inputDataList = new ArrayList<>(); |
86 | 95 | List<InputData> inputDataList1 = new ArrayList<>(); |
87 | 96 | for (int i = 0; i < 7; i++) { |
... | ... | @@ -101,12 +110,41 @@ public class ReportDetialFragment extends BaseMVPCompatFragment<ReportDetialCont |
101 | 110 | } |
102 | 111 | |
103 | 112 | @Override |
104 | - public void showDetialList(List<DeyuDetialBean> list) { | |
113 | + public void showDetialList(List<DeyuDetialBean> list, JsonArray pointNow, JsonArray pointPast, JsonArray sceneName) { | |
105 | 114 | deyulist.clear(); |
106 | 115 | deyulist.addAll(list); |
107 | 116 | deyuDetialAdapter.addAll(deyulist); |
108 | 117 | deyuDetialAdapter.notifyDataSetChanged(); |
109 | - | |
118 | + chartView.setColors(R.color.blue, R.color.green, R.color.gray); | |
119 | + List<InputData> inputDataListNow = new ArrayList<>(); | |
120 | + | |
121 | + List<InputData> inputDataListPast = new ArrayList<>(); | |
122 | + try { | |
123 | + | |
124 | + InputData inputData0 = new InputData("0", 0); | |
125 | + inputDataListNow.add(inputData0); | |
126 | + inputDataListPast.add(inputData0); | |
127 | + for (int i = 0; i < sceneName.size(); i++) { | |
128 | + | |
129 | + InputData inputData = new InputData(sceneName.get(i).getAsString(), (float) pointNow.get(i).getAsDouble()); | |
130 | + inputDataListNow.add(inputData); | |
131 | + | |
132 | + InputData inputData1 = new InputData(sceneName.get(i).getAsString(), (float) pointPast.get(i).getAsDouble()); | |
133 | + inputDataListPast.add(inputData1); | |
134 | + | |
135 | + } | |
136 | + if (inputDataListNow.size()>0){ | |
137 | + tvChartData.setVisibility(View.GONE); | |
138 | + chartView.setVisibility(View.VISIBLE); | |
139 | + chartView.setChartPaths(inputDataListNow); | |
140 | + chartView.setChartPaths(inputDataListPast); | |
141 | + }else { | |
142 | + tvChartData.setVisibility(View.VISIBLE); | |
143 | + chartView.setVisibility(View.GONE); | |
144 | + } | |
145 | + } catch (Exception e) { | |
146 | + e.printStackTrace(); | |
147 | + } | |
110 | 148 | |
111 | 149 | } |
112 | 150 | ... | ... |
app/src/main/java/com/shunzhi/parent/ui/fragment/report/ReportSceneFragment.java
1 | 1 | package com.shunzhi.parent.ui.fragment.report; |
2 | 2 | |
3 | -import android.annotation.SuppressLint; | |
3 | +import android.content.res.Resources; | |
4 | 4 | import android.os.Bundle; |
5 | 5 | import android.support.annotation.NonNull; |
6 | 6 | import android.support.annotation.Nullable; |
... | ... | @@ -15,6 +15,7 @@ import com.share.mvpsdk.view.chartview.ChartView; |
15 | 15 | import com.share.mvpsdk.view.chartview.data.InputData; |
16 | 16 | import com.shunzhi.parent.R; |
17 | 17 | import com.shunzhi.parent.adapter.ReportSceneAdapter; |
18 | +import com.shunzhi.parent.bean.report.ChatBean; | |
18 | 19 | import com.shunzhi.parent.bean.report.SceneDetialBean; |
19 | 20 | import com.shunzhi.parent.contract.report.ReportSceneContract; |
20 | 21 | import com.shunzhi.parent.presenter.report.ReportScenePresenter; |
... | ... | @@ -34,7 +35,7 @@ public class ReportSceneFragment extends BaseMVPCompatFragment<ReportSceneContra |
34 | 35 | private TextView tv_rank, tv_scoree, tv_pscoree,tv_sceneName; |
35 | 36 | |
36 | 37 | private ChartView chartView; |
37 | - String startData="2018-04-04",endData="2018-04-04",objectId="102697"; | |
38 | + String startData="",endData="",objectId=""; | |
38 | 39 | int schoolId=1,sceneId; |
39 | 40 | |
40 | 41 | @NonNull |
... | ... | @@ -62,56 +63,62 @@ public class ReportSceneFragment extends BaseMVPCompatFragment<ReportSceneContra |
62 | 63 | sceneDetialAdapter.addAll(scenenlist); |
63 | 64 | recycle_scene.setAdapter(sceneDetialAdapter); |
64 | 65 | mPresenter.reportSceneResult(sceneId,0,objectId,schoolId, 0,startData,endData); |
65 | - initChartViews(); | |
66 | 66 | } |
67 | 67 | |
68 | - private void initChartViews() { | |
69 | 68 | |
69 | + @Override | |
70 | + public void showSceneList(List<SceneDetialBean> list) { | |
71 | + scenenlist.clear(); | |
72 | + scenenlist.addAll(list); | |
73 | + sceneDetialAdapter.addAll(scenenlist); | |
74 | + sceneDetialAdapter.notifyDataSetChanged(); | |
75 | + } | |
76 | + | |
77 | + @Override | |
78 | + public void showChart(List<ChatBean> list1, List<ChatBean> list2, List<ChatBean> list3) { | |
79 | + if(list1==null||list2==null||list3==null) { | |
80 | + return ; | |
81 | + } | |
70 | 82 | chartView.setColors(R.color.textColor, R.color.huodong_blue, R.color.gray); |
71 | - List<InputData> inputDataList = new ArrayList<>(); | |
72 | 83 | List<InputData> inputDataList1 = new ArrayList<>(); |
73 | 84 | List<InputData> inputDataList2 = new ArrayList<>(); |
74 | - for (int i = 0; i < 7; i++) { | |
75 | - InputData inputData = new InputData("3/" + i, 10 * i); | |
76 | - inputDataList.add(inputData); | |
77 | - } | |
78 | - | |
79 | - chartView.setChartPaths(inputDataList); | |
80 | - | |
81 | - for (int i = 0; i < 7; i++) { | |
82 | - InputData inputData = new InputData("3/" + i, 20 * i); | |
85 | + List<InputData> inputDataList3 = new ArrayList<>(); | |
86 | + inputDataList1.add(new InputData("0",0)); | |
87 | + inputDataList2.add(new InputData("0",0)); | |
88 | + inputDataList3.add(new InputData("0",0)); | |
89 | + for (int i = 0; i < list1.size(); i++) { | |
90 | + InputData inputData = new InputData(list1.get(i).getDate(), list1.get(i).getGap()); | |
83 | 91 | inputDataList1.add(inputData); |
84 | 92 | } |
85 | 93 | |
86 | 94 | chartView.setChartPaths(inputDataList1); |
87 | 95 | |
88 | - for (int i = 0; i < 7; i++) { | |
89 | - InputData inputData = new InputData("3/" + i, 15 * i); | |
96 | + for (int i = 0; i < list2.size(); i++) { | |
97 | + InputData inputData = new InputData(list2.get(i).getDate(), list2.get(i).getGap()); | |
90 | 98 | inputDataList2.add(inputData); |
91 | 99 | } |
92 | 100 | |
93 | 101 | chartView.setChartPaths(inputDataList2); |
94 | 102 | |
95 | - } | |
103 | + for (int i = 0; i <list3.size(); i++) { | |
104 | + InputData inputData = new InputData(list3.get(i).getDate(), list3.get(i).getGap()); | |
105 | + inputDataList3.add(inputData); | |
106 | + } | |
107 | + | |
108 | + chartView.setChartPaths(inputDataList3); | |
96 | 109 | |
97 | 110 | |
98 | - @Override | |
99 | - public void showSceneList(List<SceneDetialBean> list) { | |
100 | - scenenlist.clear(); | |
101 | - scenenlist.addAll(list); | |
102 | - sceneDetialAdapter.addAll(scenenlist); | |
103 | - sceneDetialAdapter.notifyDataSetChanged(); | |
104 | 111 | } |
105 | 112 | |
106 | - @SuppressLint("ResourceAsColor") | |
107 | 113 | @Override |
108 | 114 | public void showSceneInfo(String rank, String scoree, String pscoree,String sceneName) { |
109 | 115 | tv_rank.setText("等级:" + rank); |
116 | + Resources res=getResources(); | |
110 | 117 | if(!scoree.startsWith("-")){ |
111 | 118 | scoree="+"+scoree; |
112 | - tv_scoree.setTextColor(R.color.textGreen); | |
119 | + tv_scoree.setTextColor(res.getColor(R.color.textGreen)); | |
113 | 120 | }else{ |
114 | - tv_scoree.setTextColor(R.color.textRed); | |
121 | + tv_scoree.setTextColor(res.getColor(R.color.textRed)); | |
115 | 122 | } |
116 | 123 | tv_scoree.setText("得分:" + scoree); |
117 | 124 | tv_pscoree.setText("绩点:" + pscoree); | ... | ... |
app/src/main/res/layout/fragment_report.xml
... | ... | @@ -68,7 +68,13 @@ |
68 | 68 | android:layout_width="match_parent" |
69 | 69 | android:layout_height="match_parent" |
70 | 70 | android:background="@color/white" |
71 | +<<<<<<< HEAD | |
71 | 72 | android:visibility="visible"> |
73 | +======= | |
74 | + android:visibility="gone" | |
75 | + | |
76 | + > | |
77 | +>>>>>>> eda704dec86974be81437b97aa949c3570bb8be0 | |
72 | 78 | |
73 | 79 | <TextView |
74 | 80 | android:id="@+id/tvNoData" | ... | ... |
app/src/main/res/layout/fragment_report_detial.xml
... | ... | @@ -166,11 +166,12 @@ |
166 | 166 | |
167 | 167 | </LinearLayout> |
168 | 168 | |
169 | - <FrameLayout | |
169 | + <android.support.v4.widget.NestedScrollView | |
170 | 170 | android:layout_width="match_parent" |
171 | - android:layout_height="wrap_content" | |
172 | - android:layout_marginTop="@dimen/size_dp_10"> | |
171 | + android:layout_height="0dp" | |
172 | + android:layout_weight="1.5"> | |
173 | 173 | |
174 | +<<<<<<< HEAD | |
174 | 175 | <com.share.mvpsdk.view.chartview.ChartView |
175 | 176 | android:id="@+id/chartView" |
176 | 177 | android:layout_width="match_parent" |
... | ... | @@ -185,18 +186,94 @@ |
185 | 186 | android:text="图表控件" |
186 | 187 | android:textColor="@color/md_red_500" |
187 | 188 | android:visibility="gone" /> |
189 | +======= | |
190 | + <LinearLayout | |
191 | + android:layout_width="match_parent" | |
192 | + android:layout_height="match_parent" | |
193 | + android:orientation="vertical"> | |
188 | 194 | |
189 | - </FrameLayout> | |
195 | + <LinearLayout | |
196 | + android:layout_marginTop="@dimen/size_dp_10" | |
197 | + android:layout_marginBottom="@dimen/size_dp_10" | |
198 | + android:gravity="center" | |
199 | + android:layout_width="wrap_content" | |
200 | + android:layout_height="wrap_content" | |
201 | + android:layout_gravity="center_horizontal" | |
202 | + > | |
190 | 203 | |
204 | + <TextView | |
205 | + android:layout_width="@dimen/size_dp_16" | |
206 | + android:layout_height="@dimen/size_dp_16" | |
207 | + android:background="@drawable/shape_blue_8" | |
208 | + /> | |
209 | +>>>>>>> eda704dec86974be81437b97aa949c3570bb8be0 | |
191 | 210 | |
192 | - <android.support.v7.widget.RecyclerView | |
193 | - android:id="@+id/recycle_deyu" | |
194 | - android:layout_width="match_parent" | |
195 | - android:layout_height="wrap_content" | |
196 | - android:layout_marginTop="@dimen/size_dp_10" | |
197 | - android:background="@color/bgColor"> | |
211 | + <TextView | |
212 | + android:layout_marginLeft="@dimen/size_dp_5" | |
213 | + android:layout_width="wrap_content" | |
214 | + android:layout_height="wrap_content" | |
215 | + android:text="今日" | |
216 | + android:id="@+id/tvToday" | |
217 | + android:textSize="@dimen/size_dp_16" | |
218 | + android:textColor="@color/textColor" | |
219 | + /> | |
220 | + | |
221 | + <TextView | |
222 | + android:layout_marginLeft="@dimen/size_dp_25" | |
223 | + android:layout_width="@dimen/size_dp_16" | |
224 | + android:layout_height="@dimen/size_dp_16" | |
225 | + android:background="@drawable/shape_green_circle" | |
226 | + /> | |
227 | + | |
228 | + <TextView | |
229 | + android:layout_marginLeft="@dimen/size_dp_5" | |
230 | + android:layout_width="wrap_content" | |
231 | + android:layout_height="wrap_content" | |
232 | + android:text="昨日" | |
233 | + android:id="@+id/tvYesToday" | |
234 | + android:textSize="@dimen/size_dp_16" | |
235 | + android:textColor="@color/textColor" | |
236 | + /> | |
237 | + | |
238 | + </LinearLayout> | |
239 | + <FrameLayout | |
240 | + android:layout_width="match_parent" | |
241 | + android:layout_height="@dimen/size_dp_200" | |
242 | + android:layout_marginTop="@dimen/size_dp_10"> | |
243 | + | |
244 | + <com.share.mvpsdk.view.chartview.ChartView | |
245 | + android:id="@+id/chartView" | |
246 | + android:layout_width="match_parent" | |
247 | + android:layout_height="match_parent" /> | |
248 | + | |
249 | + <TextView | |
250 | + android:layout_width="match_parent" | |
251 | + android:layout_height="match_parent" | |
252 | + android:layout_gravity="center" | |
253 | + android:background="@color/blue" | |
254 | + android:textSize="@dimen/size_dp_18" | |
255 | + android:gravity="center" | |
256 | + android:text="暂无图表数据" | |
257 | + android:id="@+id/tvChartData" | |
258 | + android:textColor="@color/textColor" | |
259 | + android:visibility="gone" /> | |
260 | + | |
261 | + </FrameLayout> | |
262 | + | |
263 | + | |
264 | + <android.support.v7.widget.RecyclerView | |
265 | + android:id="@+id/recycle_deyu" | |
266 | + android:layout_width="match_parent" | |
267 | + android:layout_height="wrap_content" | |
268 | + android:layout_marginTop="@dimen/size_dp_10" | |
269 | + android:background="@color/bgColor"> | |
270 | + | |
271 | + </android.support.v7.widget.RecyclerView> | |
272 | + | |
273 | + | |
274 | + </LinearLayout> | |
198 | 275 | |
199 | - </android.support.v7.widget.RecyclerView> | |
276 | + </android.support.v4.widget.NestedScrollView> | |
200 | 277 | |
201 | 278 | </LinearLayout> |
202 | 279 | ... | ... |
app/src/main/res/layout/item_deyu_detial.xml
... | ... | @@ -30,13 +30,13 @@ |
30 | 30 | android:layout_height="wrap_content"> |
31 | 31 | |
32 | 32 | <TextView |
33 | - android:id="@+id/jidian" | |
33 | + android:id="@+id/tv_jidian" | |
34 | 34 | android:layout_width="wrap_content" |
35 | 35 | android:layout_height="wrap_content" |
36 | 36 | android:text="绩点:4.3 增长1.1分" /> |
37 | 37 | <TextView |
38 | 38 | android:layout_marginLeft="10dp" |
39 | - android:id="@+id/paiming" | |
39 | + android:id="@+id/tv_paiming" | |
40 | 40 | android:layout_width="wrap_content" |
41 | 41 | android:layout_height="wrap_content" |
42 | 42 | android:text="排名:第三名 增长1名" /> |
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | |
48 | 48 | |
49 | 49 | <TextView |
50 | - android:id="@+id/pingjia" | |
50 | + android:id="@+id/tv_pingjia" | |
51 | 51 | android:layout_width="wrap_content" |
52 | 52 | android:layout_height="wrap_content" |
53 | 53 | android:paddingTop="5dp" | ... | ... |
app/src/main/res/values/colors.xml
... | ... | @@ -8,7 +8,11 @@ |
8 | 8 | <color name="hintTextColor">#494947</color> |
9 | 9 | <color name="bottomline">#B8B8B9</color> |
10 | 10 | <color name="bg_main">#F0EFF5</color> |
11 | + | |
11 | 12 | <color name="textRed">#FC5B6A</color> |
13 | + | |
14 | + <color name="blue">#2956FE</color> | |
15 | + <color name="green">#00CB87</color> | |
12 | 16 | <color name="back_top">#A6DAFF</color> |
13 | 17 | <color name="textBlue">#ACC9FC</color> |
14 | 18 | <color name="titleColor">#A6DAFF</color> | ... | ... |
mvpsdk/src/main/java/com/share/mvpsdk/utils/ValueUtils.java
... | ... | @@ -3,8 +3,6 @@ package com.share.mvpsdk.utils; |
3 | 3 | import android.support.annotation.NonNull; |
4 | 4 | import android.support.annotation.Nullable; |
5 | 5 | import android.support.v4.app.NotificationCompat; |
6 | -import android.util.Log; | |
7 | - | |
8 | 6 | |
9 | 7 | import com.share.mvpsdk.view.chartview.data.Chart; |
10 | 8 | import com.share.mvpsdk.view.chartview.data.ChartPath; |
... | ... | @@ -14,12 +12,11 @@ import com.share.mvpsdk.view.chartview.data.InputData; |
14 | 12 | import java.util.ArrayList; |
15 | 13 | import java.util.List; |
16 | 14 | import java.util.ListIterator; |
17 | -import java.util.concurrent.TimeUnit; | |
18 | 15 | |
19 | 16 | public class ValueUtils { |
20 | 17 | |
21 | - public static long getCorrectedMaxValue(long maxValue) { | |
22 | - for (long value = maxValue; value >= Chart.CHART_PART_VALUE; value--) { | |
18 | + public static float getCorrectedMaxValue(float maxValue) { | |
19 | + for (float value = maxValue; value >= Chart.CHART_PART_VALUE; value--) { | |
23 | 20 | if (isRightValue(value)) { |
24 | 21 | return value; |
25 | 22 | } |
... | ... | @@ -28,8 +25,8 @@ public class ValueUtils { |
28 | 25 | return maxValue; |
29 | 26 | } |
30 | 27 | |
31 | - public static long max(@Nullable List<ChartPath> dataList) { | |
32 | - long maxValue = 0; | |
28 | + public static float max(@Nullable List<ChartPath> dataList) { | |
29 | + float maxValue = 0; | |
33 | 30 | |
34 | 31 | if (dataList == null || dataList.isEmpty()) { |
35 | 32 | return maxValue; |
... | ... | @@ -46,29 +43,42 @@ public class ValueUtils { |
46 | 43 | return maxValue; |
47 | 44 | } |
48 | 45 | |
49 | - private static long maxOne(List<InputData> dataList) { | |
50 | - long maxValue = 0; | |
46 | + private static long getMax(long max) { | |
47 | + if (max < 10) { | |
48 | + max = 10; | |
49 | + } else if (max / 10 < 10) { | |
50 | + max = (max / 10 + 1) * 10; | |
51 | + } else if (max / 100 < 10) { | |
52 | + max = (max / 100 + 1) * 100; | |
53 | + } else if (max / 1000 < 10) { | |
54 | + max = (max / 1000 + 1) * 1000; | |
55 | + } | |
56 | + return max; | |
57 | + } | |
58 | + | |
59 | + private static float maxOne(List<InputData> dataList) { | |
60 | + float maxValue = 0; | |
51 | 61 | |
52 | 62 | if (dataList == null || dataList.isEmpty()) { |
53 | 63 | return maxValue; |
54 | 64 | } |
55 | - for (InputData data : dataList) { | |
56 | - if (data.valueY > maxValue) { | |
57 | - maxValue = data.valueY; | |
58 | - } | |
65 | + for (InputData data : dataList) { | |
66 | + if (data.valueY > maxValue) { | |
67 | + maxValue = data.valueY; | |
59 | 68 | } |
69 | + } | |
60 | 70 | |
61 | 71 | return maxValue; |
62 | 72 | } |
63 | 73 | |
64 | - private static boolean isRightValue(long value) { | |
65 | - long valueResidual = value % Chart.CHART_PART_VALUE; | |
74 | + private static boolean isRightValue(float value) { | |
75 | + float valueResidual = value % Chart.CHART_PART_VALUE; | |
66 | 76 | return valueResidual == 0; |
67 | 77 | } |
68 | 78 | |
69 | 79 | @NotificationCompat.NotificationVisibility |
70 | 80 | public static List<DrawData> getDrawData(@Nullable Chart chart) { |
71 | - if (chart == null || chart.getInputDataList().isEmpty()) { | |
81 | + if (chart == null || chart.getInputDataList()==null||chart.getInputDataList().isEmpty()) { | |
72 | 82 | return new ArrayList<>(); |
73 | 83 | } |
74 | 84 | |
... | ... | @@ -78,7 +88,7 @@ public class ValueUtils { |
78 | 88 | } |
79 | 89 | |
80 | 90 | @NotificationCompat.NotificationVisibility |
81 | - public static List<DrawData> getDrawDatas(@Nullable List<InputData> inputDataList,@NonNull Chart chart) { | |
91 | + public static List<DrawData> getDrawDatas(@Nullable List<InputData> inputDataList, @NonNull Chart chart) { | |
82 | 92 | return createDrawDataList(chart, createValueList(inputDataList)); |
83 | 93 | } |
84 | 94 | |
... | ... | @@ -111,13 +121,22 @@ public class ValueUtils { |
111 | 121 | iterator.next(); |
112 | 122 | } |
113 | 123 | } |
114 | - static long topValue=0; | |
124 | + | |
125 | + public static float topValue = 0.00f; | |
126 | + | |
127 | + public static void calMax(List<ChartPath> chartPathList) { | |
128 | + | |
129 | + for (int i = 0; i < chartPathList.size(); i++) { | |
130 | + createValueList(chartPathList.get(i).inputDataList); | |
131 | + } | |
132 | + } | |
133 | + | |
115 | 134 | private static List<Float> createValueList(@NonNull List<InputData> dataList) { |
116 | 135 | List<Float> valueList = new ArrayList<>(); |
117 | - topValue=topValue > ValueUtils.maxOne(dataList)?topValue:ValueUtils.maxOne(dataList);//取最大值 | |
136 | + topValue = topValue > ValueUtils.maxOne(dataList) ? topValue : ValueUtils.maxOne(dataList);//取最大值 | |
118 | 137 | |
119 | 138 | for (InputData data : dataList) { |
120 | - float value = (float) data.valueY / topValue; | |
139 | + float value = data.valueY / topValue; | |
121 | 140 | valueList.add(value); |
122 | 141 | } |
123 | 142 | |
... | ... | @@ -142,8 +161,8 @@ public class ValueUtils { |
142 | 161 | } |
143 | 162 | |
144 | 163 | float value = valueList.get(position); |
145 | - int startX = getCoordinateX(chart, position); | |
146 | - int startY = getCoordinateY(chart, value); | |
164 | + float startX = getCoordinateX(chart, position); | |
165 | + float startY = getCoordinateY(chart, value); | |
147 | 166 | drawData.startX = startX; |
148 | 167 | drawData.startY = startY; |
149 | 168 | // drawData.setStartX(startX); |
... | ... | @@ -151,8 +170,8 @@ public class ValueUtils { |
151 | 170 | int nextPosition = position + 1; |
152 | 171 | if (nextPosition < valueList.size()) { |
153 | 172 | float nextValue = valueList.get(nextPosition); |
154 | - int stopX = getCoordinateX(chart, nextPosition); | |
155 | - int stopY = getCoordinateY(chart, nextValue); | |
173 | + float stopX = getCoordinateX(chart, nextPosition); | |
174 | + float stopY = getCoordinateY(chart, nextValue); | |
156 | 175 | |
157 | 176 | // drawData.setStopX(stopX); |
158 | 177 | // drawData.setStopY(stopY); |
... | ... | @@ -165,13 +184,13 @@ public class ValueUtils { |
165 | 184 | } |
166 | 185 | |
167 | 186 | @SuppressWarnings("UnnecessaryLocalVariable") |
168 | - private static int getCoordinateX(@NonNull Chart chart, int index) { | |
169 | - int width = chart.width; | |
170 | - int titleWidth = chart.titleWidth; | |
187 | + private static float getCoordinateX(@NonNull Chart chart, int index) { | |
188 | + float width = chart.width; | |
189 | + float titleWidth = chart.titleWidth; | |
171 | 190 | |
172 | - int widthCorrected = width - titleWidth; | |
173 | - int partWidth = widthCorrected / (Chart.MAX_ITEMS_COUNT - 1); | |
174 | - int coordinate = titleWidth + (partWidth * index); | |
191 | + float widthCorrected = width - titleWidth; | |
192 | + float partWidth = widthCorrected / (Chart.MAX_ITEMS_COUNT - 1); | |
193 | + float coordinate = titleWidth + (partWidth * index); | |
175 | 194 | |
176 | 195 | if (coordinate < 0) { |
177 | 196 | coordinate = 0; |
... | ... | @@ -184,13 +203,11 @@ public class ValueUtils { |
184 | 203 | } |
185 | 204 | |
186 | 205 | @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 | - | |
206 | + private static float getCoordinateY(@NonNull Chart chart, float value) { | |
207 | + float height = chart.height - chart.padding - chart.textSize; | |
208 | + float heightOffset = chart.heightOffset; | |
209 | + float heightCorrected = height - heightOffset; | |
210 | + float coordinate = (heightCorrected - (heightCorrected * value)); | |
194 | 211 | if (coordinate < 0) { |
195 | 212 | coordinate = 0; |
196 | 213 | |
... | ... | @@ -201,4 +218,5 @@ public class ValueUtils { |
201 | 218 | coordinate += heightOffset; |
202 | 219 | return coordinate; |
203 | 220 | } |
221 | + | |
204 | 222 | } | ... | ... |
mvpsdk/src/main/java/com/share/mvpsdk/view/chartview/ChartView.java
... | ... | @@ -2,13 +2,9 @@ package com.share.mvpsdk.view.chartview; |
2 | 2 | |
3 | 3 | import android.content.Context; |
4 | 4 | import android.graphics.Canvas; |
5 | -import android.graphics.Color; | |
6 | -import android.graphics.DashPathEffect; | |
7 | 5 | import android.graphics.Paint; |
8 | 6 | import android.graphics.Path; |
9 | 7 | import android.graphics.PathDashPathEffect; |
10 | -import android.graphics.RectF; | |
11 | -import android.graphics.Shader; | |
12 | 8 | import android.support.annotation.NonNull; |
13 | 9 | import android.support.annotation.Nullable; |
14 | 10 | import android.util.AttributeSet; |
... | ... | @@ -16,13 +12,13 @@ import android.util.Log; |
16 | 12 | import android.view.View; |
17 | 13 | |
18 | 14 | import com.share.mvpsdk.R; |
19 | -import com.share.mvpsdk.utils.DateUtils; | |
20 | 15 | import com.share.mvpsdk.utils.ValueUtils; |
21 | 16 | import com.share.mvpsdk.view.chartview.data.Chart; |
22 | 17 | import com.share.mvpsdk.view.chartview.data.ChartPath; |
23 | 18 | import com.share.mvpsdk.view.chartview.data.DrawData; |
24 | 19 | import com.share.mvpsdk.view.chartview.data.InputData; |
25 | 20 | |
21 | +import java.text.DecimalFormat; | |
26 | 22 | import java.util.ArrayList; |
27 | 23 | import java.util.List; |
28 | 24 | |
... | ... | @@ -97,7 +93,11 @@ public class ChartView extends View { |
97 | 93 | chart.setInputDataList(inputData); |
98 | 94 | chart.titleWidth = getTitleWidth(); |
99 | 95 | invalidate(); |
96 | + } | |
100 | 97 | |
98 | + public void setDrawData(){ | |
99 | +// chart.setDrawDataList(ValueUtils.getDrawData(chart)); | |
100 | + invalidate(); | |
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
... | ... | @@ -163,11 +163,11 @@ public class ChartView extends View { |
163 | 163 | return; |
164 | 164 | } |
165 | 165 | |
166 | - long maxValue = ValueUtils.max(chartPathList); | |
167 | - long correctedMaxValue = ValueUtils.getCorrectedMaxValue(maxValue); | |
166 | + float maxValue = ValueUtils.max(chartPathList); | |
167 | + float correctedMaxValue = ValueUtils.getCorrectedMaxValue(maxValue); | |
168 | 168 | float value = (float) correctedMaxValue / maxValue; |
169 | 169 | |
170 | - long heightOffset = chart.heightOffset; | |
170 | + float heightOffset = chart.heightOffset; | |
171 | 171 | int padding = chart.padding; |
172 | 172 | int textSize = chart.textSize; |
173 | 173 | int titleWidth = chart.titleWidth; |
... | ... | @@ -177,7 +177,7 @@ public class ChartView extends View { |
177 | 177 | float chartPartHeight = ((height - heightOffset) * value) / Chart.CHART_PARTS; |
178 | 178 | |
179 | 179 | float currHeight = height; |
180 | - int currTitle = 0; | |
180 | + float currTitle = 0.0f; | |
181 | 181 | |
182 | 182 | for (int i = 0; i <= Chart.CHART_PARTS; i++) { |
183 | 183 | float titleY = currHeight; |
... | ... | @@ -192,12 +192,13 @@ public class ChartView extends View { |
192 | 192 | if (i > 0) { |
193 | 193 | // canvas.drawLine(titleWidth, currHeight, width, currHeight, frameInternalPaint); |
194 | 194 | //横向间隔线 |
195 | - canvas.drawLine(titleWidth-5,titleY-textSize/2,width,titleY-textSize/2,textPaint); | |
195 | + textPaint.setColor(0xFFE7E5E7); | |
196 | + canvas.drawLine(titleWidth - 5, titleY - textSize / 2, width, titleY - textSize / 2, textPaint); | |
196 | 197 | } |
197 | - | |
198 | - String title = String.valueOf(currTitle); | |
199 | - canvas.drawText(title, padding, titleY, textPaint); | |
198 | + DecimalFormat decimalFormat = new DecimalFormat("0.0"); | |
199 | + String title = String.valueOf(decimalFormat.format(currTitle)); | |
200 | 200 | textPaint.setColor(getResources().getColor(R.color.gray)); |
201 | + canvas.drawText(title, padding - textSize / 2, titleY, textPaint); | |
201 | 202 | |
202 | 203 | currHeight -= chartPartHeight; |
203 | 204 | currTitle += correctedMaxValue / Chart.CHART_PARTS; |
... | ... | @@ -205,11 +206,15 @@ public class ChartView extends View { |
205 | 206 | } |
206 | 207 | |
207 | 208 | private void drawChartHorizontal(@NonNull Canvas canvas) { |
209 | + if (null!=chartPathList){ | |
210 | + ValueUtils.calMax(chartPathList); | |
208 | 211 | for (int j = 0; j < chartPathList.size(); j++) { |
209 | 212 | chagerColor(j); |
210 | 213 | List<InputData> inputDataList = chart.getInputDataList(); |
211 | 214 | // List<DrawData> drawDataList = chart.getDrawDataList(); |
212 | 215 | List<DrawData> drawDataList = ValueUtils.getDrawDatas(chartPathList.get(j).inputDataList, chart); |
216 | +// Log.e("111111", "chartPathList.get(j).inputDataList----===="+chartPathList.get(j).inputDataList); | |
217 | +// Log.e("111111", "drawDataList----===="+drawDataList); | |
213 | 218 | if (inputDataList == null || inputDataList.isEmpty() || drawDataList == null || drawDataList.isEmpty()) { |
214 | 219 | return; |
215 | 220 | } |
... | ... | @@ -219,7 +224,7 @@ public class ChartView extends View { |
219 | 224 | // String date = DateUtils.format(inputData.valueX); |
220 | 225 | String date = inputData.valueX; |
221 | 226 | int dateWidth = (int) axisPaint.measureText(date); |
222 | - int x; | |
227 | + float x; | |
223 | 228 | if (drawDataList.size() > i) { |
224 | 229 | DrawData drawData = drawDataList.get(i); |
225 | 230 | x = drawData.startX; |
... | ... | @@ -246,7 +251,7 @@ public class ChartView extends View { |
246 | 251 | |
247 | 252 | //画圆点 |
248 | 253 | canvas.drawCircle(startX, startY, 10, valuesPaint); |
249 | - | |
254 | + Log.e("11111", "startX----===="+startX+"startY="+startY); | |
250 | 255 | //点之间的连线 |
251 | 256 | if (i < drawDataList.size() - 1) { |
252 | 257 | canvas.drawLine(startX, startY, drawDataList.get(i + 1).startX - chart.padding - chart.textSize, drawDataList.get(i + 1).startY, valuesPaint); |
... | ... | @@ -257,10 +262,11 @@ public class ChartView extends View { |
257 | 262 | } |
258 | 263 | } |
259 | 264 | } |
265 | + } | |
260 | 266 | } |
261 | 267 | |
262 | 268 | private void chagerColor(int j) { |
263 | - switch (j){ | |
269 | + switch (j) { | |
264 | 270 | case 0: |
265 | 271 | valuesPaint.setColor(getResources().getColor(R.color.theme_day_blue)); |
266 | 272 | break; |
... | ... | @@ -280,7 +286,7 @@ public class ChartView extends View { |
280 | 286 | |
281 | 287 | int height = chart.height - textSize - padding; |
282 | 288 | int width = chart.width - textSize - padding; |
283 | - int titleWidth = chart.titleWidth-5; | |
289 | + int titleWidth = chart.titleWidth - 5; | |
284 | 290 | int heightOffset = chart.heightOffset; |
285 | 291 | |
286 | 292 | canvas.drawLine(titleWidth, heightOffset, titleWidth, height, axisPaint); |
... | ... | @@ -292,7 +298,7 @@ public class ChartView extends View { |
292 | 298 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
293 | 299 | |
294 | 300 | int width = MeasureSpec.getSize(widthMeasureSpec); |
295 | - int height = MeasureSpec.getSize(heightMeasureSpec) / 2; | |
301 | + int height = MeasureSpec.getSize(heightMeasureSpec); | |
296 | 302 | chart.width = width; |
297 | 303 | chart.height = height; |
298 | 304 | setMeasuredDimension(width, height); | ... | ... |
mvpsdk/src/main/java/com/share/mvpsdk/view/chartview/data/Chart.java
... | ... | @@ -9,7 +9,7 @@ import java.util.List; |
9 | 9 | |
10 | 10 | public class Chart { |
11 | 11 | |
12 | - public static final int CHART_PARTS = 5; | |
12 | + public static final float CHART_PARTS = 5.0f; | |
13 | 13 | public static final int MAX_ITEMS_COUNT = 7; |
14 | 14 | public static final int CHART_PART_VALUE = 10; |
15 | 15 | public static final int TEXT_SIZE_OFFSET = 10; | ... | ... |
mvpsdk/src/main/java/com/share/mvpsdk/view/chartview/data/DrawData.java
... | ... | @@ -6,11 +6,11 @@ package com.share.mvpsdk.view.chartview.data; |
6 | 6 | |
7 | 7 | public class DrawData { |
8 | 8 | |
9 | - public int startX; | |
10 | - public int startY; | |
9 | + public float startX; | |
10 | + public float startY; | |
11 | 11 | |
12 | - public int stopX; | |
13 | - public int stopY; | |
12 | + public float stopX; | |
13 | + public float stopY; | |
14 | 14 | |
15 | 15 | @Override |
16 | 16 | public String toString() { | ... | ... |
mvpsdk/src/main/java/com/share/mvpsdk/view/chartview/data/InputData.java
... | ... | @@ -9,9 +9,9 @@ public class InputData { |
9 | 9 | |
10 | 10 | public String valueX; |
11 | 11 | |
12 | - public long valueY; | |
12 | + public float valueY; | |
13 | 13 | |
14 | - public InputData(String valueX,long valueY){ | |
14 | + public InputData(String valueX,float valueY){ | |
15 | 15 | this.valueX=valueX; |
16 | 16 | this.valueY=valueY; |
17 | 17 | } | ... | ... |