Commit eed2f75b0efbeaf32dbde80a1306f61464b5fdae
1 parent
e5e787dc57
Exists in
master
计算错误修改
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
app/src/main/java/com/hjx/parent/HomeworkShareActivity.java
1 | package com.hjx.parent; | 1 | package com.hjx.parent; |
2 | 2 | ||
3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
4 | import android.content.Intent; | 4 | import android.content.Intent; |
5 | import android.graphics.Bitmap; | 5 | import android.graphics.Bitmap; |
6 | import android.net.Uri; | 6 | import android.net.Uri; |
7 | import android.os.Bundle; | 7 | import android.os.Bundle; |
8 | import android.text.Html; | 8 | import android.text.Html; |
9 | import android.view.View; | 9 | import android.view.View; |
10 | import android.widget.ImageView; | 10 | import android.widget.ImageView; |
11 | import android.widget.LinearLayout; | 11 | import android.widget.LinearLayout; |
12 | import android.widget.TextView; | 12 | import android.widget.TextView; |
13 | 13 | ||
14 | import androidx.annotation.NonNull; | 14 | import androidx.annotation.NonNull; |
15 | import androidx.annotation.Nullable; | 15 | import androidx.annotation.Nullable; |
16 | 16 | ||
17 | import com.bumptech.glide.Glide; | 17 | import com.bumptech.glide.Glide; |
18 | import com.chad.library.adapter.base.BaseQuickAdapter; | 18 | import com.chad.library.adapter.base.BaseQuickAdapter; |
19 | import com.chad.library.adapter.base.BaseViewHolder; | 19 | import com.chad.library.adapter.base.BaseViewHolder; |
20 | import com.google.gson.Gson; | 20 | import com.google.gson.Gson; |
21 | import com.gyf.immersionbar.ImmersionBar; | 21 | import com.gyf.immersionbar.ImmersionBar; |
22 | import com.hjx.parent.databinding.ActivityHomeworkShareBinding; | 22 | import com.hjx.parent.databinding.ActivityHomeworkShareBinding; |
23 | import com.hjx.parent.dialog.PhotoViewDialog; | 23 | import com.hjx.parent.dialog.PhotoViewDialog; |
24 | import com.hjx.parent.rx.BaseRxActivity; | 24 | import com.hjx.parent.rx.BaseRxActivity; |
25 | import com.prws.common.bean.ResponseResult; | 25 | import com.prws.common.bean.ResponseResult; |
26 | import com.prws.common.bean.Student; | 26 | import com.prws.common.bean.Student; |
27 | import com.prws.common.bean.homework.HomeWork; | 27 | import com.prws.common.bean.homework.HomeWork; |
28 | import com.prws.common.bean.homework.HomeworkDetail; | 28 | import com.prws.common.bean.homework.HomeworkDetail; |
29 | import com.prws.common.bean.homework.KeyValue; | 29 | import com.prws.common.bean.homework.KeyValue; |
30 | import com.prws.common.net.NetWorks; | 30 | import com.prws.common.net.NetWorks; |
31 | import com.prws.common.utils.BitmapUtils; | 31 | import com.prws.common.utils.BitmapUtils; |
32 | import com.prws.common.utils.CommonUtil; | 32 | import com.prws.common.utils.CommonUtil; |
33 | import com.prws.common.utils.ContentUtil; | 33 | import com.prws.common.utils.ContentUtil; |
34 | 34 | ||
35 | import java.text.DecimalFormat; | 35 | import java.text.DecimalFormat; |
36 | import java.text.SimpleDateFormat; | 36 | import java.text.SimpleDateFormat; |
37 | import java.util.ArrayList; | 37 | import java.util.ArrayList; |
38 | import java.util.HashSet; | 38 | import java.util.HashSet; |
39 | import java.util.List; | 39 | import java.util.List; |
40 | import java.util.Locale; | 40 | import java.util.Locale; |
41 | import java.util.Set; | 41 | import java.util.Set; |
42 | 42 | ||
43 | import io.reactivex.Single; | 43 | import io.reactivex.Single; |
44 | import io.reactivex.android.schedulers.AndroidSchedulers; | 44 | import io.reactivex.android.schedulers.AndroidSchedulers; |
45 | import io.reactivex.schedulers.Schedulers; | 45 | import io.reactivex.schedulers.Schedulers; |
46 | 46 | ||
47 | public class HomeworkShareActivity extends BaseRxActivity<ActivityHomeworkShareBinding> { | 47 | public class HomeworkShareActivity extends BaseRxActivity<ActivityHomeworkShareBinding> { |
48 | private String id; | 48 | private String id; |
49 | 49 | ||
50 | String indent = " "; | 50 | String indent = " "; |
51 | 51 | ||
52 | private String title; | 52 | private String title; |
53 | private Student student; | 53 | private Student student; |
54 | private ErrorAdapter mAdapter = new ErrorAdapter(); | 54 | private ErrorAdapter mAdapter = new ErrorAdapter(); |
55 | 55 | ||
56 | private Uri shareUri; | 56 | private Uri shareUri; |
57 | 57 | ||
58 | @SuppressLint("SetTextI18n") | 58 | @SuppressLint("SetTextI18n") |
59 | @Override | 59 | @Override |
60 | public void initView(Bundle savedInstanceState) { | 60 | public void initView(Bundle savedInstanceState) { |
61 | ImmersionBar.with(this).init(); | 61 | ImmersionBar.with(this).init(); |
62 | binding.btnBack.setOnClickListener(v -> onBackPressed()); | 62 | binding.btnBack.setOnClickListener(v -> onBackPressed()); |
63 | binding.rvWrong.setAdapter(mAdapter); | 63 | binding.rvWrong.setAdapter(mAdapter); |
64 | mAdapter.setEmptyView(R.layout.empty_statistical_no_error, binding.rvWrong); | 64 | mAdapter.setEmptyView(R.layout.empty_statistical_no_error, binding.rvWrong); |
65 | 65 | ||
66 | id = getIntent().getStringExtra("id"); | 66 | id = getIntent().getStringExtra("id"); |
67 | title = getIntent().getStringExtra("name"); | 67 | title = getIntent().getStringExtra("name"); |
68 | binding.tvTitle.setText(title); | 68 | binding.tvTitle.setText(title); |
69 | student = (Student) getIntent().getSerializableExtra("student"); | 69 | student = (Student) getIntent().getSerializableExtra("student"); |
70 | assert student != null; | 70 | assert student != null; |
71 | binding.tvStuName.setText(student.stuName); | 71 | binding.tvStuName.setText(student.stuName); |
72 | Glide.with(this).load(student.photo).centerCrop().error(R.mipmap.ic_avatar_male).into(binding.ivAvatar); | 72 | Glide.with(this).load(student.photo).centerCrop().error(R.mipmap.ic_avatar_male).into(binding.ivAvatar); |
73 | binding.tvGrade.setText(getIntent().getStringExtra("grade")); | 73 | binding.tvGrade.setText(getIntent().getStringExtra("grade")); |
74 | binding.tvSubject.setText(getIntent().getStringExtra("subject")); | 74 | binding.tvSubject.setText(getIntent().getStringExtra("subject")); |
75 | 75 | ||
76 | binding.btnShare.setOnClickListener(v -> { | 76 | binding.btnShare.setOnClickListener(v -> { |
77 | if (shareUri == null) shareUri = saveBitmap(); | 77 | if (shareUri == null) shareUri = saveBitmap(); |
78 | if (shareUri != null) { | 78 | if (shareUri != null) { |
79 | Intent shareIntent = new Intent(Intent.ACTION_SEND); | 79 | Intent shareIntent = new Intent(Intent.ACTION_SEND); |
80 | shareIntent.setType("image/jpeg"); | 80 | shareIntent.setType("image/jpeg"); |
81 | shareIntent.putExtra(Intent.EXTRA_STREAM, shareUri); | 81 | shareIntent.putExtra(Intent.EXTRA_STREAM, shareUri); |
82 | shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 82 | shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
83 | 83 | ||
84 | startActivity(shareIntent); | 84 | startActivity(shareIntent); |
85 | } | 85 | } |
86 | }); | 86 | }); |
87 | 87 | ||
88 | loadHomework(); | 88 | loadHomework(); |
89 | } | 89 | } |
90 | 90 | ||
91 | @SuppressLint("CheckResult") | 91 | @SuppressLint("CheckResult") |
92 | private void loadHomework() { | 92 | private void loadHomework() { |
93 | NetWorks.service_url.getHomeworkCompleteDetail(NetWorks.getHeader(), student.stuId, id, true) | 93 | NetWorks.service_url.getHomeworkCompleteDetail(NetWorks.getHeader(), student.stuId, id, true) |
94 | .compose(transformSingle()) | 94 | .compose(transformSingle()) |
95 | .map(ResponseResult::getData) | 95 | .map(ResponseResult::getData) |
96 | .map(data -> { | 96 | .map(data -> { |
97 | if (data.getHomeworkList() == null) return data; | 97 | if (data.getHomeworkList() == null) return data; |
98 | for (HomeWork homeWork: data.getHomeworkList()){ | 98 | for (HomeWork homeWork: data.getHomeworkList()){ |
99 | homeWork.formatPoints(new Gson()); | 99 | homeWork.formatPoints(new Gson()); |
100 | } | 100 | } |
101 | return data; | 101 | return data; |
102 | }) | 102 | }) |
103 | .subscribe((data, th) -> { | 103 | .subscribe((data, th) -> { |
104 | if (th != null) th.printStackTrace(); | 104 | if (th != null) th.printStackTrace(); |
105 | if (data != null) showHomework(data); | 105 | if (data != null) showHomework(data); |
106 | }); | 106 | }); |
107 | } | 107 | } |
108 | @SuppressLint({"SetTextI18n", "DefaultLocale"}) | 108 | @SuppressLint({"SetTextI18n", "DefaultLocale"}) |
109 | private void showHomework(HomeworkDetail detail) { | 109 | private void showHomework(HomeworkDetail detail) { |
110 | SimpleDateFormat format = new SimpleDateFormat("yyyy.M.d", Locale.CHINA); | 110 | SimpleDateFormat format = new SimpleDateFormat("yyyy.M.d", Locale.CHINA); |
111 | binding.tvDate.setText(format.format(detail.getDate())); | 111 | binding.tvDate.setText(format.format(detail.getDate())); |
112 | binding.flComment.setVisibility(detail.getComment() == null || detail.getComment().isEmpty() ? View.INVISIBLE : View.VISIBLE); | 112 | binding.flComment.setVisibility(detail.getComment() == null || detail.getComment().isEmpty() ? View.INVISIBLE : View.VISIBLE); |
113 | binding.tvComment.setText(ifEmpty(detail.getComment(), "-")); | 113 | binding.tvComment.setText(ifEmpty(detail.getComment(), "-")); |
114 | binding.tvRating.setText("-"); | 114 | binding.tvRating.setText("-"); |
115 | 115 | ||
116 | String temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好;答错题目有 %s 道,错题涵盖的知识点主要有%s,这部分还要再加强学习。错题老师已经帮你收录到错题本中,要记得复习整理错题,及时消灭薄弱知识点。"; | 116 | String temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好;答错题目有 %s 道,错题涵盖的知识点主要有%s,这部分还要再加强学习。错题老师已经帮你收录到错题本中,要记得复习整理错题,及时消灭薄弱知识点。"; |
117 | List<HomeWork> errorList = new ArrayList<>(); | 117 | List<HomeWork> errorList = new ArrayList<>(); |
118 | List<HomeWork> blankList = new ArrayList<>(); | 118 | List<HomeWork> blankList = new ArrayList<>(); |
119 | if (detail.getHomeworkList() != null && detail.getHomeworkList().size() != 0) { | 119 | if (detail.getHomeworkList() != null && detail.getHomeworkList().size() != 0) { |
120 | int total = detail.getHomeworkList().size(); | 120 | int total = detail.getHomeworkList().size(); |
121 | int correctNum = 0, blankNumber = 0; | 121 | int correctNum = 0, blankNumber = 0; |
122 | Set<KeyValue> correctSet = new HashSet<>(); | 122 | Set<KeyValue> correctSet = new HashSet<>(); |
123 | Set<KeyValue> errorSet = new HashSet<>(); | 123 | Set<KeyValue> errorSet = new HashSet<>(); |
124 | for (HomeWork homeWork: detail.getHomeworkList()) { | 124 | for (HomeWork homeWork: detail.getHomeworkList()) { |
125 | if (homeWork.correction == 0) { | 125 | if (homeWork.correction == 0) { |
126 | correctNum ++; | 126 | correctNum ++; |
127 | correctSet.addAll(homeWork.pointsObj); | 127 | correctSet.addAll(homeWork.pointsObj); |
128 | } else if (homeWork.correction == 1){ | 128 | } else if (homeWork.correction == 1){ |
129 | errorList.add(homeWork); | 129 | errorList.add(homeWork); |
130 | errorSet.addAll(homeWork.pointsObj); | 130 | errorSet.addAll(homeWork.pointsObj); |
131 | } else if (homeWork.correction == 2) { | 131 | } else if (homeWork.correction == 2) { |
132 | blankList.add(homeWork); | 132 | blankList.add(homeWork); |
133 | blankNumber ++; | 133 | blankNumber ++; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | StringBuilder correctPoint = new StringBuilder(); | 136 | StringBuilder correctPoint = new StringBuilder(); |
137 | StringBuilder errorPoint = new StringBuilder(); | 137 | StringBuilder errorPoint = new StringBuilder(); |
138 | for (KeyValue point: correctSet) { | 138 | for (KeyValue point: correctSet) { |
139 | correctPoint.append("、").append(point.Value); | 139 | correctPoint.append("、").append(point.Value); |
140 | } | 140 | } |
141 | for (KeyValue point: errorSet) { | 141 | for (KeyValue point: errorSet) { |
142 | errorPoint.append("、").append(point.Value); | 142 | errorPoint.append("、").append(point.Value); |
143 | } | 143 | } |
144 | float rate = 100f * correctNum / Math.max(total - blankNumber, 1); | 144 | float rate = 100f * correctNum / Math.max(total - blankNumber, 1); |
145 | int errorNum = total - correctNum; | 145 | int errorNum = errorList.size(); |
146 | binding.tvPercent.setText(new DecimalFormat("0").format(rate)); | 146 | binding.tvPercent.setText(new DecimalFormat("0").format(rate)); |
147 | binding.tvCorrect.setText(String.valueOf(correctNum)); | 147 | binding.tvCorrect.setText(String.valueOf(correctNum)); |
148 | binding.tvWrong.setText(String.valueOf(errorNum)); | 148 | binding.tvWrong.setText(String.valueOf(errorNum)); |
149 | binding.tvBlank.setText(String.valueOf(blankNumber)); | 149 | binding.tvBlank.setText(String.valueOf(blankNumber)); |
150 | 150 | ||
151 | String correct = "-", error = "-"; | 151 | String correct = "-", error = "-"; |
152 | if (correctPoint.length() != 0) correct = correctPoint.substring(1); | 152 | if (correctPoint.length() != 0) correct = correctPoint.substring(1); |
153 | if (errorPoint.length() != 0) error = errorPoint.substring(1); | 153 | if (errorPoint.length() != 0) error = errorPoint.substring(1); |
154 | if (errorNum == 0) { | 154 | if (errorNum == 0) { |
155 | temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好。"; | 155 | temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好。"; |
156 | String s = String.format(temp, | 156 | String s = String.format(temp, |
157 | fromColor(String.valueOf(correctNum), "#489afa"), | 157 | fromColor(String.valueOf(correctNum), "#489afa"), |
158 | fromColor(correct, "#489afa") | 158 | fromColor(correct, "#489afa") |
159 | ); | 159 | ); |
160 | binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); | 160 | binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); |
161 | } else { | 161 | } else { |
162 | String s = String.format(temp, | 162 | String s = String.format(temp, |
163 | fromColor(String.valueOf(correctNum), "#489afa"), | 163 | fromColor(String.valueOf(correctNum), "#489afa"), |
164 | fromColor(correct, "#489afa"), | 164 | fromColor(correct, "#489afa"), |
165 | fromColor(String.valueOf(errorNum), "#ff4134"), | 165 | fromColor(String.valueOf(errorNum), "#ff4134"), |
166 | fromColor(error, "#ff4134") | 166 | fromColor(error, "#ff4134") |
167 | ); | 167 | ); |
168 | binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); | 168 | binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | mAdapter.setNewData(errorList); | 172 | mAdapter.setNewData(errorList); |
173 | binding.rvBlank.setAdapter(new BlankAdapter(blankList)); | 173 | binding.rvBlank.setAdapter(new BlankAdapter(blankList)); |
174 | binding.viewBlank.setVisibility(blankList.isEmpty() ? View.GONE : View.VISIBLE); | 174 | binding.viewBlank.setVisibility(blankList.isEmpty() ? View.GONE : View.VISIBLE); |
175 | } | 175 | } |
176 | 176 | ||
177 | private String fromColor(String str, String color) { | 177 | private String fromColor(String str, String color) { |
178 | return String.format("<font color='%s'>%s</font>", color, str); | 178 | return String.format("<font color='%s'>%s</font>", color, str); |
179 | } | 179 | } |
180 | 180 | ||
181 | @Override | 181 | @Override |
182 | protected ActivityHomeworkShareBinding getViewBinding() { | 182 | protected ActivityHomeworkShareBinding getViewBinding() { |
183 | return ActivityHomeworkShareBinding.inflate(getLayoutInflater()); | 183 | return ActivityHomeworkShareBinding.inflate(getLayoutInflater()); |
184 | } | 184 | } |
185 | 185 | ||
186 | private Uri saveBitmap() { | 186 | private Uri saveBitmap() { |
187 | try { | 187 | try { |
188 | binding.btnShare.setVisibility(View.GONE); | 188 | binding.btnShare.setVisibility(View.GONE); |
189 | binding.btnBack.setVisibility(View.GONE); | 189 | binding.btnBack.setVisibility(View.GONE); |
190 | Bitmap bitmap = BitmapUtils.shotView(binding.viewRoot); | 190 | Bitmap bitmap = BitmapUtils.shotView(binding.viewRoot); |
191 | binding.btnShare.setVisibility(View.VISIBLE); | 191 | binding.btnShare.setVisibility(View.VISIBLE); |
192 | binding.btnBack.setVisibility(View.VISIBLE); | 192 | binding.btnBack.setVisibility(View.VISIBLE); |
193 | 193 | ||
194 | String fileName = student.stuName + "_" + title; | 194 | String fileName = student.stuName + "_" + title; |
195 | return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); | 195 | return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); |
196 | } catch (Exception e) { | 196 | } catch (Exception e) { |
197 | e.printStackTrace(); | 197 | e.printStackTrace(); |
198 | } | 198 | } |
199 | return null; | 199 | return null; |
200 | } | 200 | } |
201 | 201 | ||
202 | private static String ifEmpty(String s, String placeholder) { | 202 | private static String ifEmpty(String s, String placeholder) { |
203 | if (s == null || s.isEmpty()) return placeholder; | 203 | if (s == null || s.isEmpty()) return placeholder; |
204 | return s; | 204 | return s; |
205 | } | 205 | } |
206 | 206 | ||
207 | public static class BlankAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { | 207 | public static class BlankAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { |
208 | 208 | ||
209 | public BlankAdapter(@Nullable List<HomeWork> data) { | 209 | public BlankAdapter(@Nullable List<HomeWork> data) { |
210 | super(R.layout.item_huyou_daily_blank, data); | 210 | super(R.layout.item_huyou_daily_blank, data); |
211 | } | 211 | } |
212 | 212 | ||
213 | @Override | 213 | @Override |
214 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { | 214 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { |
215 | ImageView imageView = holder.getView(R.id.imageView); | 215 | ImageView imageView = holder.getView(R.id.imageView); |
216 | Glide.with(mContext).load(homeWork.url).into(imageView); | 216 | Glide.with(mContext).load(homeWork.url).into(imageView); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | public static class ErrorAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { | 220 | public static class ErrorAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { |
221 | 221 | ||
222 | public ErrorAdapter() { | 222 | public ErrorAdapter() { |
223 | super(R.layout.item_homework_error); | 223 | super(R.layout.item_homework_error); |
224 | } | 224 | } |
225 | 225 | ||
226 | @Override | 226 | @Override |
227 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { | 227 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { |
228 | ImageView ivTopic = holder.getView(R.id.ivTopic); | 228 | ImageView ivTopic = holder.getView(R.id.ivTopic); |
229 | TextView tvPoints = holder.getView(R.id.tvPoints); | 229 | TextView tvPoints = holder.getView(R.id.tvPoints); |
230 | ImageView ivAnalyze = holder.getView(R.id.ivAnalyze); | 230 | ImageView ivAnalyze = holder.getView(R.id.ivAnalyze); |
231 | 231 | ||
232 | showImage(ivTopic, homeWork.url); | 232 | showImage(ivTopic, homeWork.url); |
233 | showImage(ivAnalyze, homeWork.analyseUrl); | 233 | showImage(ivAnalyze, homeWork.analyseUrl); |
234 | tvPoints.setText("-"); | 234 | tvPoints.setText("-"); |
235 | if (homeWork.pointsObj == null || homeWork.pointsObj.isEmpty()) return; | 235 | if (homeWork.pointsObj == null || homeWork.pointsObj.isEmpty()) return; |
236 | StringBuilder builder = new StringBuilder(); | 236 | StringBuilder builder = new StringBuilder(); |
237 | for (KeyValue pair: homeWork.pointsObj) { | 237 | for (KeyValue pair: homeWork.pointsObj) { |
238 | builder.append(pair.Value).append("\n"); | 238 | builder.append(pair.Value).append("\n"); |
239 | } | 239 | } |
240 | tvPoints.setText(ifEmpty(builder.toString().trim(), "-")); | 240 | tvPoints.setText(ifEmpty(builder.toString().trim(), "-")); |
241 | } | 241 | } |
242 | 242 | ||
243 | @SuppressLint("CheckResult") | 243 | @SuppressLint("CheckResult") |
244 | private void showImage(ImageView view, String url) { | 244 | private void showImage(ImageView view, String url) { |
245 | view.setVisibility(View.GONE); | 245 | view.setVisibility(View.GONE); |
246 | view.setImageBitmap(null); | 246 | view.setImageBitmap(null); |
247 | if (url == null) { | 247 | if (url == null) { |
248 | return; | 248 | return; |
249 | } | 249 | } |
250 | view.setOnClickListener(v -> { | 250 | view.setOnClickListener(v -> { |
251 | new PhotoViewDialog(mContext).show(url); | 251 | new PhotoViewDialog(mContext).show(url); |
252 | }); | 252 | }); |
253 | Single.just(url) | 253 | Single.just(url) |
254 | .subscribeOn(Schedulers.io()) | 254 | .subscribeOn(Schedulers.io()) |
255 | .map(u -> Glide.with(mContext).asBitmap().load(url).submit().get()) | 255 | .map(u -> Glide.with(mContext).asBitmap().load(url).submit().get()) |
256 | .observeOn(AndroidSchedulers.mainThread()) | 256 | .observeOn(AndroidSchedulers.mainThread()) |
257 | .subscribe((bitmap, th) -> { | 257 | .subscribe((bitmap, th) -> { |
258 | if (bitmap == null) return; | 258 | if (bitmap == null) return; |
259 | 259 | ||
260 | float imageHeight = bitmap.getHeight(); | 260 | float imageHeight = bitmap.getHeight(); |
261 | float imageWidth = bitmap.getWidth(); | 261 | float imageWidth = bitmap.getWidth(); |
262 | int viewHeight = (int) (CommonUtil.getScreenHeight(mContext) * 0.75f); | 262 | int viewHeight = (int) (CommonUtil.getScreenHeight(mContext) * 0.75f); |
263 | int viewWidth = (int) (CommonUtil.getScreenWidth(mContext) * 0.75f); | 263 | int viewWidth = (int) (CommonUtil.getScreenWidth(mContext) * 0.75f); |
264 | LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(view.getLayoutParams()); | 264 | LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(view.getLayoutParams()); |
265 | if (imageHeight > imageWidth) { | 265 | if (imageHeight > imageWidth) { |
266 | if (viewHeight > imageHeight) { | 266 | if (viewHeight > imageHeight) { |
267 | layoutParams.height = (int) imageHeight; | 267 | layoutParams.height = (int) imageHeight; |
268 | layoutParams.width = (int) imageWidth; | 268 | layoutParams.width = (int) imageWidth; |
269 | } else { | 269 | } else { |
270 | layoutParams.height = viewHeight; | 270 | layoutParams.height = viewHeight; |
271 | layoutParams.width = (int) (imageWidth / imageHeight * viewHeight); | 271 | layoutParams.width = (int) (imageWidth / imageHeight * viewHeight); |
272 | } | 272 | } |
273 | } else { | 273 | } else { |
274 | if (viewWidth > imageWidth) { | 274 | if (viewWidth > imageWidth) { |
275 | layoutParams.height = (int) imageHeight; | 275 | layoutParams.height = (int) imageHeight; |
276 | layoutParams.width = (int) imageWidth; | 276 | layoutParams.width = (int) imageWidth; |
277 | } else { | 277 | } else { |
278 | layoutParams.height = (int) (imageHeight / imageWidth * viewWidth); | 278 | layoutParams.height = (int) (imageHeight / imageWidth * viewWidth); |
279 | layoutParams.width = viewWidth; | 279 | layoutParams.width = viewWidth; |
280 | } | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
283 | layoutParams.setMargins(CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5)); | 283 | layoutParams.setMargins(CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5)); |
284 | view.setLayoutParams(layoutParams); | 284 | view.setLayoutParams(layoutParams); |
285 | view.setImageBitmap(bitmap); | 285 | view.setImageBitmap(bitmap); |
286 | view.setVisibility(View.VISIBLE); | 286 | view.setVisibility(View.VISIBLE); |
287 | }); | 287 | }); |
288 | } | 288 | } |
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 |
app/src/main/java/com/hjx/parent/HuyouDetailActivity.java
1 | package com.hjx.parent; | 1 | package com.hjx.parent; |
2 | 2 | ||
3 | 3 | ||
4 | import android.annotation.SuppressLint; | 4 | import android.annotation.SuppressLint; |
5 | import android.content.Intent; | 5 | import android.content.Intent; |
6 | import android.content.res.ColorStateList; | 6 | import android.content.res.ColorStateList; |
7 | import android.graphics.Bitmap; | 7 | import android.graphics.Bitmap; |
8 | import android.net.Uri; | 8 | import android.net.Uri; |
9 | import android.os.Bundle; | 9 | import android.os.Bundle; |
10 | import android.text.Html; | 10 | import android.text.Html; |
11 | import android.view.View; | 11 | import android.view.View; |
12 | import android.widget.TextView; | 12 | import android.widget.TextView; |
13 | 13 | ||
14 | import androidx.annotation.NonNull; | 14 | import androidx.annotation.NonNull; |
15 | import androidx.annotation.Nullable; | 15 | import androidx.annotation.Nullable; |
16 | import androidx.core.content.res.ResourcesCompat; | 16 | import androidx.core.content.res.ResourcesCompat; |
17 | 17 | ||
18 | import com.bumptech.glide.Glide; | 18 | import com.bumptech.glide.Glide; |
19 | import com.chad.library.adapter.base.BaseQuickAdapter; | 19 | import com.chad.library.adapter.base.BaseQuickAdapter; |
20 | import com.chad.library.adapter.base.BaseViewHolder; | 20 | import com.chad.library.adapter.base.BaseViewHolder; |
21 | import com.github.mikephil.charting.components.Legend; | 21 | import com.github.mikephil.charting.components.Legend; |
22 | import com.github.mikephil.charting.components.XAxis; | 22 | import com.github.mikephil.charting.components.XAxis; |
23 | import com.github.mikephil.charting.components.YAxis; | 23 | import com.github.mikephil.charting.components.YAxis; |
24 | import com.github.mikephil.charting.data.Entry; | 24 | import com.github.mikephil.charting.data.Entry; |
25 | import com.github.mikephil.charting.data.LineData; | 25 | import com.github.mikephil.charting.data.LineData; |
26 | import com.github.mikephil.charting.data.LineDataSet; | 26 | import com.github.mikephil.charting.data.LineDataSet; |
27 | import com.github.mikephil.charting.formatter.ValueFormatter; | 27 | import com.github.mikephil.charting.formatter.ValueFormatter; |
28 | import com.gyf.immersionbar.ImmersionBar; | 28 | import com.gyf.immersionbar.ImmersionBar; |
29 | import com.hjx.parent.databinding.ActivityHuyouDetailBinding; | 29 | import com.hjx.parent.databinding.ActivityHuyouDetailBinding; |
30 | import com.hjx.parent.rx.BaseRxActivity; | 30 | import com.hjx.parent.rx.BaseRxActivity; |
31 | import com.prws.common.bean.Student; | 31 | import com.prws.common.bean.Student; |
32 | import com.prws.common.bean.homework.StDetail; | 32 | import com.prws.common.bean.homework.StDetail; |
33 | import com.prws.common.net.NetWorks; | 33 | import com.prws.common.net.NetWorks; |
34 | import com.prws.common.utils.BitmapUtils; | 34 | import com.prws.common.utils.BitmapUtils; |
35 | import com.prws.common.utils.ContentUtil; | 35 | import com.prws.common.utils.ContentUtil; |
36 | import com.trello.rxlifecycle2.android.RxLifecycleAndroid; | 36 | import com.trello.rxlifecycle2.android.RxLifecycleAndroid; |
37 | 37 | ||
38 | import java.text.DecimalFormat; | 38 | import java.text.DecimalFormat; |
39 | import java.text.SimpleDateFormat; | 39 | import java.text.SimpleDateFormat; |
40 | import java.util.ArrayList; | 40 | import java.util.ArrayList; |
41 | import java.util.Date; | 41 | import java.util.Date; |
42 | import java.util.List; | 42 | import java.util.List; |
43 | import java.util.Locale; | 43 | import java.util.Locale; |
44 | import java.util.TimeZone; | 44 | import java.util.TimeZone; |
45 | 45 | ||
46 | import io.reactivex.android.schedulers.AndroidSchedulers; | 46 | import io.reactivex.android.schedulers.AndroidSchedulers; |
47 | import io.reactivex.schedulers.Schedulers; | 47 | import io.reactivex.schedulers.Schedulers; |
48 | 48 | ||
49 | public class HuyouDetailActivity extends BaseRxActivity<ActivityHuyouDetailBinding> { | 49 | public class HuyouDetailActivity extends BaseRxActivity<ActivityHuyouDetailBinding> { |
50 | 50 | ||
51 | private String id; | 51 | private String id; |
52 | private int type; // 0:周 1:阶段 | 52 | private int type; // 0:周 1:阶段 |
53 | private Student student; | 53 | private Student student; |
54 | 54 | ||
55 | private StDetail mData; | 55 | private StDetail mData; |
56 | 56 | ||
57 | final String indent = " "; | 57 | final String indent = " "; |
58 | 58 | ||
59 | private boolean a4 = false; | 59 | private boolean a4 = false; |
60 | 60 | ||
61 | @Override | 61 | @Override |
62 | protected void onResume() { | 62 | protected void onResume() { |
63 | super.onResume(); | 63 | super.onResume(); |
64 | binding.root.postDelayed(() -> { | 64 | binding.root.postDelayed(() -> { |
65 | float scale = 1f * binding.getRoot().getWidth() / binding.root.getWidth(); | 65 | float scale = 1f * binding.getRoot().getWidth() / binding.root.getWidth(); |
66 | if (scale >= 1) return; | 66 | if (scale >= 1) return; |
67 | binding.root.setScaleX(scale); | 67 | binding.root.setScaleX(scale); |
68 | binding.root.setScaleY(scale); | 68 | binding.root.setScaleY(scale); |
69 | }, 100); | 69 | }, 100); |
70 | } | 70 | } |
71 | 71 | ||
72 | @SuppressLint("CheckResult") | 72 | @SuppressLint("CheckResult") |
73 | @Override | 73 | @Override |
74 | public void initView(Bundle savedInstanceState) { | 74 | public void initView(Bundle savedInstanceState) { |
75 | binding.btnBack.setOnClickListener(v -> onBackPressed()); | 75 | binding.btnBack.setOnClickListener(v -> onBackPressed()); |
76 | id = getIntent().getStringExtra("id"); | 76 | id = getIntent().getStringExtra("id"); |
77 | type = getIntent().getIntExtra("type", 0); | 77 | type = getIntent().getIntExtra("type", 0); |
78 | student = (Student) getIntent().getSerializableExtra("student"); | 78 | student = (Student) getIntent().getSerializableExtra("student"); |
79 | 79 | ||
80 | if (type == 1) { | 80 | if (type == 1) { |
81 | binding.tvTitle.setText("阶段作业学习总结"); | 81 | binding.tvTitle.setText("阶段作业学习总结"); |
82 | binding.viewWeekTable.setVisibility(View.GONE); | 82 | binding.viewWeekTable.setVisibility(View.GONE); |
83 | } else { | 83 | } else { |
84 | binding.viewPointTotal.setVisibility(View.GONE); | 84 | binding.viewPointTotal.setVisibility(View.GONE); |
85 | binding.viewTable.setVisibility(View.GONE); | 85 | binding.viewTable.setVisibility(View.GONE); |
86 | } | 86 | } |
87 | 87 | ||
88 | Glide.with(this).load(student.photo).into(binding.ivAvatar); | 88 | Glide.with(this).load(student.photo).into(binding.ivAvatar); |
89 | binding.tvStuName.setText(student.stuName); | 89 | binding.tvStuName.setText(student.stuName); |
90 | 90 | ||
91 | setupChart(); | 91 | setupChart(); |
92 | NetWorks.service_url.getHuyouDetail(NetWorks.getHeader(), id) | 92 | NetWorks.service_url.getHuyouDetail(NetWorks.getHeader(), id) |
93 | .subscribeOn(Schedulers.io()) | 93 | .subscribeOn(Schedulers.io()) |
94 | .map(response -> response.getData()) | 94 | .map(response -> response.getData()) |
95 | .map(data -> { | 95 | .map(data -> { |
96 | if (type == 1) data.formatCollection(); | 96 | if (type == 1) data.formatCollection(); |
97 | return data; | 97 | return data; |
98 | }) | 98 | }) |
99 | .observeOn(AndroidSchedulers.mainThread()) | 99 | .observeOn(AndroidSchedulers.mainThread()) |
100 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) | 100 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) |
101 | .subscribe((data, th) -> { | 101 | .subscribe((data, th) -> { |
102 | mData = data; | 102 | mData = data; |
103 | if (th != null) th.printStackTrace(); | 103 | if (th != null) th.printStackTrace(); |
104 | if (data != null) showData(data); | 104 | if (data != null) showData(data); |
105 | }); | 105 | }); |
106 | 106 | ||
107 | binding.btnShare.setOnClickListener(v -> { | 107 | binding.btnShare.setOnClickListener(v -> { |
108 | Uri shareUri = prepareShare(); | 108 | Uri shareUri = prepareShare(); |
109 | if (shareUri != null) { | 109 | if (shareUri != null) { |
110 | Intent shareIntent = new Intent(Intent.ACTION_SEND); | 110 | Intent shareIntent = new Intent(Intent.ACTION_SEND); |
111 | shareIntent.setType("image/jpeg"); | 111 | shareIntent.setType("image/jpeg"); |
112 | shareIntent.putExtra(Intent.EXTRA_STREAM, shareUri); | 112 | shareIntent.putExtra(Intent.EXTRA_STREAM, shareUri); |
113 | shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 113 | shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
114 | 114 | ||
115 | startActivity(shareIntent); | 115 | startActivity(shareIntent); |
116 | } | 116 | } |
117 | }); | 117 | }); |
118 | 118 | ||
119 | binding.btnSwitch.setOnClickListener(v -> { | 119 | binding.btnSwitch.setOnClickListener(v -> { |
120 | switchPage(); | 120 | switchPage(); |
121 | }); | 121 | }); |
122 | 122 | ||
123 | } | 123 | } |
124 | 124 | ||
125 | private SimpleDateFormat getFormatWithGmt8(String pattern) { | 125 | private SimpleDateFormat getFormatWithGmt8(String pattern) { |
126 | SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.CHINA); | 126 | SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.CHINA); |
127 | format.setTimeZone(TimeZone.getTimeZone("GMT+16")); | 127 | format.setTimeZone(TimeZone.getTimeZone("GMT+16")); |
128 | return format; | 128 | return format; |
129 | } | 129 | } |
130 | 130 | ||
131 | @SuppressLint("SetTextI18n") | 131 | @SuppressLint("SetTextI18n") |
132 | private void showData(StDetail data) { | 132 | private void showData(StDetail data) { |
133 | binding.tvGrade.setText(data.grade); | 133 | binding.tvGrade.setText(data.grade); |
134 | binding.tvSubject.setText(data.homeworkSubject); | 134 | binding.tvSubject.setText(data.homeworkSubject); |
135 | String start = getFormatWithGmt8("yyyy.M.d").format(data.startTime); | 135 | String start = getFormatWithGmt8("yyyy.M.d").format(data.startTime); |
136 | String end = new SimpleDateFormat(" - M.d", Locale.CHINA).format(data.endTime); | 136 | String end = new SimpleDateFormat(" - M.d", Locale.CHINA).format(data.endTime); |
137 | binding.tvDate.setText(start + end); | 137 | binding.tvDate.setText(start + end); |
138 | 138 | ||
139 | if (data.points == null) data.points = new ArrayList<>(); | 139 | if (data.points == null) data.points = new ArrayList<>(); |
140 | if (data.points.size() == 0) { | 140 | if (data.points.size() == 0) { |
141 | binding.cpBefore.setValue(0); | 141 | binding.cpBefore.setValue(0); |
142 | binding.cpAfter.setValue(0); | 142 | binding.cpAfter.setValue(0); |
143 | binding.pgBefore.setText("0"); | 143 | binding.pgBefore.setText("0"); |
144 | binding.pgAfter.setText("0"); | 144 | binding.pgAfter.setText("0"); |
145 | } else { | 145 | } else { |
146 | float before = 0; | 146 | float before = 0; |
147 | float after = 0; | 147 | float after = 0; |
148 | for (StDetail.Point point: data.points) { | 148 | for (StDetail.Point point: data.points) { |
149 | before += point.beforeState; | 149 | before += point.beforeState; |
150 | after += point.afterState; | 150 | after += point.afterState; |
151 | } | 151 | } |
152 | before = (int) (100f * before / data.points.size() + 0.5f); | 152 | before = (int) (100f * before / data.points.size() + 0.5f); |
153 | after = (int) (100f * after / data.points.size() + 0.5f); | 153 | after = (int) (100f * after / data.points.size() + 0.5f); |
154 | binding.cpBefore.setValue(before); | 154 | binding.cpBefore.setValue(before); |
155 | binding.cpAfter.setValue(after); | 155 | binding.cpAfter.setValue(after); |
156 | DecimalFormat format = new DecimalFormat("0"); | 156 | DecimalFormat format = new DecimalFormat("0"); |
157 | binding.pgBefore.setText(format.format(before)); | 157 | binding.pgBefore.setText(format.format(before)); |
158 | binding.pgAfter.setText(format.format(after)); | 158 | binding.pgAfter.setText(format.format(after)); |
159 | 159 | ||
160 | String comment; | 160 | String comment; |
161 | if (after >= 90) { | 161 | if (after >= 90) { |
162 | comment = "知识点掌握的比较扎实,多练习多巩固掌握一般的知识点会有很大帮助。"; | 162 | comment = "知识点掌握的比较扎实,多练习多巩固掌握一般的知识点会有很大帮助。"; |
163 | } else if (after >= 80) { | 163 | } else if (after >= 80) { |
164 | comment = "知识点掌握程度有进步,还要再继续学习,多练习,不断巩固。"; | 164 | comment = "知识点掌握程度有进步,还要再继续学习,多练习,不断巩固。"; |
165 | } else if (after >= 60) { | 165 | } else if (after >= 60) { |
166 | comment = "薄弱知识点还有进步空间,再多做一些类似题目来巩固知识点,继续努力。"; | 166 | comment = "薄弱知识点还有进步空间,再多做一些类似题目来巩固知识点,继续努力。"; |
167 | } else { | 167 | } else { |
168 | comment = "你的薄弱知识点还需要再深入了解,有不清楚的地方及时问老师,继续加油。"; | 168 | comment = "你的薄弱知识点还需要再深入了解,有不清楚的地方及时问老师,继续加油。"; |
169 | } | 169 | } |
170 | String percent = new DecimalFormat("0%").format(after / 100); | 170 | String percent = new DecimalFormat("0%").format(after / 100); |
171 | String temp = indent + "通过学习,你的薄弱知识点掌握程度为 %s," + comment; | 171 | String temp = indent + "通过学习,你的薄弱知识点掌握程度为 %s," + comment; |
172 | temp = String.format(temp, fromColor(percent, "#F24E38")); | 172 | temp = String.format(temp, fromColor(percent, "#F24E38")); |
173 | binding.tvWeakRate.setText(Html.fromHtml(temp, Html.FROM_HTML_MODE_COMPACT)); | 173 | binding.tvWeakRate.setText(Html.fromHtml(temp, Html.FROM_HTML_MODE_COMPACT)); |
174 | } | 174 | } |
175 | 175 | ||
176 | int exNo = 0, goodNo = 0, normalNo = 0, weakNo = 0; | 176 | int exNo = 0, goodNo = 0, normalNo = 0, weakNo = 0; |
177 | float total = 0; | 177 | float total = 0; |
178 | if (data.points != null) { | 178 | if (data.points != null) { |
179 | for (StDetail.Point point: data.points) { | 179 | for (StDetail.Point point: data.points) { |
180 | total += point.afterState; | 180 | total += point.afterState; |
181 | if (point.afterState >= 0.9) { | 181 | if (point.afterState >= 0.9) { |
182 | exNo ++; | 182 | exNo ++; |
183 | } else if (point.afterState >= 0.8) { | 183 | } else if (point.afterState >= 0.8) { |
184 | goodNo ++; | 184 | goodNo ++; |
185 | } else if (point.afterState >= 0.6) { | 185 | } else if (point.afterState >= 0.6) { |
186 | normalNo ++; | 186 | normalNo ++; |
187 | } else { | 187 | } else { |
188 | weakNo ++; | 188 | weakNo ++; |
189 | } | 189 | } |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | float rate = 100f * data.correct / Math.max(data.total - data.unfinished, 1); | 193 | float rate = 100f * data.correct / Math.max(data.total - data.unfinished, 1); |
194 | binding.tvTotalRate.setText(new DecimalFormat("0").format(rate)); | 194 | binding.tvTotalRate.setText(new DecimalFormat("0").format(rate)); |
195 | binding.tvTotalCorrect.setText(String.valueOf(data.correct)); | 195 | binding.tvTotalCorrect.setText(String.valueOf(data.correct)); |
196 | binding.tvTotalError.setText(String.valueOf(data.total - data.correct)); | 196 | binding.tvTotalError.setText(String.valueOf(data.total - data.correct - data.unfinished)); |
197 | binding.tvTotalBlank.setText(String.valueOf(data.unfinished)); | 197 | binding.tvTotalBlank.setText(String.valueOf(data.unfinished)); |
198 | if (data.total == 0) { | 198 | if (data.total == 0) { |
199 | binding.tvRating.setText(""); | 199 | binding.tvRating.setText(""); |
200 | } else { | 200 | } else { |
201 | String rateComment; | 201 | String rateComment; |
202 | String encComment; | 202 | String encComment; |
203 | if (rate >= 90) { | 203 | if (rate >= 90) { |
204 | rateComment = "知识点掌握得比较优秀,多练习多巩固掌握一般的知识点会有很大帮助。"; | 204 | rateComment = "知识点掌握得比较优秀,多练习多巩固掌握一般的知识点会有很大帮助。"; |
205 | encComment = "在未来的学习中,请保持这份优秀,继续挑战更难的题目,勇攀高峰"; | 205 | encComment = "在未来的学习中,请保持这份优秀,继续挑战更难的题目,勇攀高峰"; |
206 | } else if (rate >= 80) { | 206 | } else if (rate >= 80) { |
207 | rateComment = "知识点掌握程度有进步,还要再继续学习,多练习,不断巩固。"; | 207 | rateComment = "知识点掌握程度有进步,还要再继续学习,多练习,不断巩固。"; |
208 | encComment = "在未来的学习中,请保持这份优秀,继续挑战更难的题目,勇攀高峰"; | 208 | encComment = "在未来的学习中,请保持这份优秀,继续挑战更难的题目,勇攀高峰"; |
209 | } else if (rate >= 60) { | 209 | } else if (rate >= 60) { |
210 | rateComment = "薄弱知识点还有进步空间,再多做一些类似题目来巩固知识点,继续努力。"; | 210 | rateComment = "薄弱知识点还有进步空间,再多做一些类似题目来巩固知识点,继续努力。"; |
211 | encComment = "在未来的学习中,请不要灰心,继续努力"; | 211 | encComment = "在未来的学习中,请不要灰心,继续努力"; |
212 | } else { | 212 | } else { |
213 | rateComment = "你的薄弱知识点还需要再深入了解,有不清楚的地方及时问老师,继续加油。"; | 213 | rateComment = "你的薄弱知识点还需要再深入了解,有不清楚的地方及时问老师,继续加油。"; |
214 | encComment = "在未来的学习中,请不要灰心,继续努力"; | 214 | encComment = "在未来的学习中,请不要灰心,继续努力"; |
215 | } | 215 | } |
216 | 216 | ||
217 | String correctNumHt = fromColor(String.valueOf(data.correct), "#3BC3B6"); | 217 | String correctNumHt = fromColor(String.valueOf(data.correct), "#3BC3B6"); |
218 | String errNumHt = fromColor(String.valueOf(data.total - data.correct - data.unfinished), "#3BC3B6"); | 218 | String errNumHt = fromColor(String.valueOf(data.total - data.correct - data.unfinished), "#3BC3B6"); |
219 | StringBuilder pointComment = new StringBuilder("其中,答对题目 ") | 219 | StringBuilder pointComment = new StringBuilder("其中,答对题目 ") |
220 | .append(correctNumHt).append(" 个,答错题目 ") | 220 | .append(correctNumHt).append(" 个,答错题目 ") |
221 | .append(errNumHt).append(" 个"); | 221 | .append(errNumHt).append(" 个"); |
222 | if (exNo > 0) { | 222 | if (exNo > 0) { |
223 | pointComment.append(",").append(exNo).append(" 个知识点掌握的非常棒"); | 223 | pointComment.append(",").append(exNo).append(" 个知识点掌握的非常棒"); |
224 | } | 224 | } |
225 | if (weakNo > 0) { | 225 | if (weakNo > 0) { |
226 | pointComment.append(",").append(weakNo).append(" 个知识点掌握的还需努力,这部分还要再加强学习"); | 226 | pointComment.append(",").append(weakNo).append(" 个知识点掌握的还需努力,这部分还要再加强学习"); |
227 | } | 227 | } |
228 | pointComment.append("。"); | 228 | pointComment.append("。"); |
229 | String rateStr = new DecimalFormat("0%").format(rate / 100f); | 229 | String rateStr = new DecimalFormat("0%").format(rate / 100f); |
230 | String temp; | 230 | String temp; |
231 | if (type == 0) { | 231 | if (type == 0) { |
232 | temp = indent + "在本周作业中,你的综合正确率是 %s," + pointComment + rateComment + encComment; | 232 | temp = indent + "在本周作业中,你的综合正确率是 %s," + pointComment + rateComment + encComment; |
233 | } else { | 233 | } else { |
234 | temp = indent + "在本阶段作业中,你的综合正确率是 %s," + pointComment + rateComment + encComment; | 234 | temp = indent + "在本阶段作业中,你的综合正确率是 %s," + pointComment + rateComment + encComment; |
235 | } | 235 | } |
236 | temp = String.format(temp, fromColor(rateStr, "#3BC3B6")); | 236 | temp = String.format(temp, fromColor(rateStr, "#3BC3B6")); |
237 | binding.tvRating.setText(Html.fromHtml(temp, Html.FROM_HTML_MODE_COMPACT)); | 237 | binding.tvRating.setText(Html.fromHtml(temp, Html.FROM_HTML_MODE_COMPACT)); |
238 | } | 238 | } |
239 | 239 | ||
240 | List<Entry> entries = new ArrayList<>(); | 240 | List<Entry> entries = new ArrayList<>(); |
241 | if (type == 0) { | 241 | if (type == 0) { |
242 | entries.add(new Entry(1, data.mondayCorrection)); | 242 | entries.add(new Entry(1, data.mondayCorrection)); |
243 | entries.add(new Entry(2, data.tuesdayCorrection)); | 243 | entries.add(new Entry(2, data.tuesdayCorrection)); |
244 | entries.add(new Entry(3, data.wednesdayCorrection)); | 244 | entries.add(new Entry(3, data.wednesdayCorrection)); |
245 | entries.add(new Entry(4, data.thursdayCorrection)); | 245 | entries.add(new Entry(4, data.thursdayCorrection)); |
246 | entries.add(new Entry(5, data.fridayCorrection)); | 246 | entries.add(new Entry(5, data.fridayCorrection)); |
247 | } else { | 247 | } else { |
248 | for (int i = 0; i < data.correctionList.size(); i ++) { | 248 | for (int i = 0; i < data.correctionList.size(); i ++) { |
249 | StDetail.Correction c = data.correctionList.get(i); | 249 | StDetail.Correction c = data.correctionList.get(i); |
250 | entries.add(new Entry(i, c.correction)); | 250 | entries.add(new Entry(i, c.correction)); |
251 | } | 251 | } |
252 | XAxis xAxis = binding.lineChart.getXAxis(); | 252 | XAxis xAxis = binding.lineChart.getXAxis(); |
253 | xAxis.setLabelCount(Math.min(entries.size(), 5), true); | 253 | xAxis.setLabelCount(Math.min(entries.size(), 5), true); |
254 | xAxis.setValueFormatter(new ValueFormatter() { | 254 | xAxis.setValueFormatter(new ValueFormatter() { |
255 | SimpleDateFormat format = new SimpleDateFormat("M.d", Locale.CHINA); | 255 | SimpleDateFormat format = new SimpleDateFormat("M.d", Locale.CHINA); |
256 | @Override | 256 | @Override |
257 | public String getFormattedValue(float value) { | 257 | public String getFormattedValue(float value) { |
258 | int index = (int) value; | 258 | int index = (int) value; |
259 | if (index < 0 || index >= data.correctionList.size()) return ""; | 259 | if (index < 0 || index >= data.correctionList.size()) return ""; |
260 | Date date = data.correctionList.get(index).date; | 260 | Date date = data.correctionList.get(index).date; |
261 | return format.format(date); | 261 | return format.format(date); |
262 | } | 262 | } |
263 | }); | 263 | }); |
264 | } | 264 | } |
265 | 265 | ||
266 | LineDataSet set = new LineDataSet(entries, ""); | 266 | LineDataSet set = new LineDataSet(entries, ""); |
267 | set.setColor(0xFF3BC3B6); | 267 | set.setColor(0xFF3BC3B6); |
268 | set.setCircleColor(0xFF3BC3B6); | 268 | set.setCircleColor(0xFF3BC3B6); |
269 | set.setDrawFilled(true); | 269 | set.setDrawFilled(true); |
270 | set.setDrawCircles(type == 0 || entries.size() == 1); | 270 | set.setDrawCircles(type == 0 || entries.size() == 1); |
271 | set.setDrawValues(false); | 271 | set.setDrawValues(false); |
272 | set.setHighlightEnabled(false); | 272 | set.setHighlightEnabled(false); |
273 | set.setDrawHighlightIndicators(false); | 273 | set.setDrawHighlightIndicators(false); |
274 | set.setFillDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.bg_line_chart_fill2, null)); | 274 | set.setFillDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.bg_line_chart_fill2, null)); |
275 | binding.lineChart.setData(new LineData(set)); | 275 | binding.lineChart.setData(new LineData(set)); |
276 | binding.lineChart.invalidate(); | 276 | binding.lineChart.invalidate(); |
277 | 277 | ||
278 | if (!data.points.isEmpty()) { | 278 | if (!data.points.isEmpty()) { |
279 | binding.tvExcellent.setText(String.valueOf(exNo)); | 279 | binding.tvExcellent.setText(String.valueOf(exNo)); |
280 | binding.tvGood.setText(String.valueOf(goodNo)); | 280 | binding.tvGood.setText(String.valueOf(goodNo)); |
281 | binding.tvNormal.setText(String.valueOf(normalNo)); | 281 | binding.tvNormal.setText(String.valueOf(normalNo)); |
282 | binding.tvWeak.setText(String.valueOf(weakNo)); | 282 | binding.tvWeak.setText(String.valueOf(weakNo)); |
283 | 283 | ||
284 | float exRate = 100f * exNo / data.points.size(); | 284 | float exRate = 100f * exNo / data.points.size(); |
285 | float goodRate = 100f * goodNo / data.points.size(); | 285 | float goodRate = 100f * goodNo / data.points.size(); |
286 | float normalRate = 100f * normalNo / data.points.size(); | 286 | float normalRate = 100f * normalNo / data.points.size(); |
287 | float weakRate = 100f * weakNo / data.points.size(); | 287 | float weakRate = 100f * weakNo / data.points.size(); |
288 | binding.cpGood.setValue(goodRate + normalRate + weakRate); | 288 | binding.cpGood.setValue(goodRate + normalRate + weakRate); |
289 | binding.cpNormal.setValue(normalRate + weakRate); | 289 | binding.cpNormal.setValue(normalRate + weakRate); |
290 | binding.cpWeak.setValue(weakRate); | 290 | binding.cpWeak.setValue(weakRate); |
291 | binding.tvAvePoint.setText(new DecimalFormat("0").format(100f * total / data.points.size())); | 291 | binding.tvAvePoint.setText(new DecimalFormat("0").format(100f * total / data.points.size())); |
292 | } | 292 | } |
293 | 293 | ||
294 | List<StDetail.Point> points = new ArrayList<>(); | 294 | List<StDetail.Point> points = new ArrayList<>(); |
295 | for (StDetail.Point point: data.points) { | 295 | for (StDetail.Point point: data.points) { |
296 | if (point.beforeState < 1) points.add(point); | 296 | if (point.beforeState < 1) points.add(point); |
297 | } | 297 | } |
298 | binding.tableRoot.setClipToOutline(true); | 298 | binding.tableRoot.setClipToOutline(true); |
299 | binding.tableWeekRoot.setClipToOutline(true); | 299 | binding.tableWeekRoot.setClipToOutline(true); |
300 | binding.rvPoint.setAdapter(new Adapter(points)); | 300 | binding.rvPoint.setAdapter(new Adapter(points)); |
301 | binding.rvWeekPoint.setAdapter(new WeekAdapter(data.points)); | 301 | binding.rvWeekPoint.setAdapter(new WeekAdapter(data.points)); |
302 | binding.tableRoot.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); | 302 | binding.tableRoot.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); |
303 | binding.flPointDesc.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); | 303 | binding.flPointDesc.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); |
304 | binding.flEmptyPoints.setVisibility(points.isEmpty() ? View.VISIBLE : View.GONE); | 304 | binding.flEmptyPoints.setVisibility(points.isEmpty() ? View.VISIBLE : View.GONE); |
305 | } | 305 | } |
306 | 306 | ||
307 | private void setupChart() { | 307 | private void setupChart() { |
308 | binding.lineChart.getLegend().setForm(Legend.LegendForm.NONE); | 308 | binding.lineChart.getLegend().setForm(Legend.LegendForm.NONE); |
309 | binding.lineChart.setScaleEnabled(false); | 309 | binding.lineChart.setScaleEnabled(false); |
310 | binding.lineChart.setTouchEnabled(false); | 310 | binding.lineChart.setTouchEnabled(false); |
311 | binding.lineChart.setDescription(null); | 311 | binding.lineChart.setDescription(null); |
312 | binding.lineChart.getAxisRight().setEnabled(false); | 312 | binding.lineChart.getAxisRight().setEnabled(false); |
313 | YAxis yAxis = binding.lineChart.getAxisLeft(); | 313 | YAxis yAxis = binding.lineChart.getAxisLeft(); |
314 | yAxis.setDrawAxisLine(false); | 314 | yAxis.setDrawAxisLine(false); |
315 | yAxis.setDrawGridLines(true); | 315 | yAxis.setDrawGridLines(true); |
316 | yAxis.setGridColor(0xFFDDDDDD); | 316 | yAxis.setGridColor(0xFFDDDDDD); |
317 | yAxis.setTextColor(0xFF333333); | 317 | yAxis.setTextColor(0xFF333333); |
318 | if (type == 0) { | 318 | if (type == 0) { |
319 | yAxis.setTextSize(16); | 319 | yAxis.setTextSize(16); |
320 | yAxis.setXOffset(16); | 320 | yAxis.setXOffset(16); |
321 | } else { | 321 | } else { |
322 | yAxis.setTextSize(13); | 322 | yAxis.setTextSize(13); |
323 | } | 323 | } |
324 | yAxis.setAxisMinimum(0); | 324 | yAxis.setAxisMinimum(0); |
325 | yAxis.setAxisMaximum(1); | 325 | yAxis.setAxisMaximum(1); |
326 | yAxis.setLabelCount(5, true); | 326 | yAxis.setLabelCount(5, true); |
327 | yAxis.setValueFormatter(new ValueFormatter() { | 327 | yAxis.setValueFormatter(new ValueFormatter() { |
328 | @Override | 328 | @Override |
329 | public String getFormattedValue(float value) { | 329 | public String getFormattedValue(float value) { |
330 | return new DecimalFormat("0%").format(value); | 330 | return new DecimalFormat("0%").format(value); |
331 | } | 331 | } |
332 | }); | 332 | }); |
333 | 333 | ||
334 | XAxis xAxis = binding.lineChart.getXAxis(); | 334 | XAxis xAxis = binding.lineChart.getXAxis(); |
335 | xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); | 335 | xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); |
336 | xAxis.setDrawAxisLine(false); | 336 | xAxis.setDrawAxisLine(false); |
337 | xAxis.setDrawGridLines(false); | 337 | xAxis.setDrawGridLines(false); |
338 | xAxis.setTextColor(0xFF333333); | 338 | xAxis.setTextColor(0xFF333333); |
339 | xAxis.setTextSize(16); | 339 | xAxis.setTextSize(16); |
340 | xAxis.setYOffset(16); | 340 | xAxis.setYOffset(16); |
341 | if (type == 0) { | 341 | if (type == 0) { |
342 | xAxis.setAxisMinimum(0.5f); | 342 | xAxis.setAxisMinimum(0.5f); |
343 | xAxis.setAxisMaximum(5.5f); | 343 | xAxis.setAxisMaximum(5.5f); |
344 | xAxis.setLabelCount(11, true); | 344 | xAxis.setLabelCount(11, true); |
345 | xAxis.setValueFormatter(new ValueFormatter() { | 345 | xAxis.setValueFormatter(new ValueFormatter() { |
346 | @Override | 346 | @Override |
347 | public String getFormattedValue(float value) { | 347 | public String getFormattedValue(float value) { |
348 | if (value == 1) { | 348 | if (value == 1) { |
349 | return "周一"; | 349 | return "周一"; |
350 | } else if (value == 2) { | 350 | } else if (value == 2) { |
351 | return "周二"; | 351 | return "周二"; |
352 | } else if (value == 3) { | 352 | } else if (value == 3) { |
353 | return "周三"; | 353 | return "周三"; |
354 | } else if (value == 4) { | 354 | } else if (value == 4) { |
355 | return "周四"; | 355 | return "周四"; |
356 | } else if (value == 5) { | 356 | } else if (value == 5) { |
357 | return "周五"; | 357 | return "周五"; |
358 | } | 358 | } |
359 | return ""; | 359 | return ""; |
360 | } | 360 | } |
361 | }); | 361 | }); |
362 | } else { | 362 | } else { |
363 | xAxis.setTextSize(13); | 363 | xAxis.setTextSize(13); |
364 | } | 364 | } |
365 | } | 365 | } |
366 | 366 | ||
367 | private String fromColor(String str, String color) { | 367 | private String fromColor(String str, String color) { |
368 | return String.format("<font color='%s'><b>%s</b></font>", color, str); | 368 | return String.format("<font color='%s'><b>%s</b></font>", color, str); |
369 | } | 369 | } |
370 | 370 | ||
371 | private void switchPage() { | 371 | private void switchPage() { |
372 | Intent intent = new Intent(getIntent()); | 372 | Intent intent = new Intent(getIntent()); |
373 | intent.putExtra("a4", !a4); | 373 | intent.putExtra("a4", !a4); |
374 | startActivity(intent); | 374 | startActivity(intent); |
375 | finish(); | 375 | finish(); |
376 | } | 376 | } |
377 | 377 | ||
378 | private Uri prepareShare() { | 378 | private Uri prepareShare() { |
379 | try { | 379 | try { |
380 | binding.toolbar.setVisibility(View.INVISIBLE); | 380 | binding.toolbar.setVisibility(View.INVISIBLE); |
381 | Bitmap bitmap = BitmapUtils.shotView(binding.root); | 381 | Bitmap bitmap = BitmapUtils.shotView(binding.root); |
382 | binding.toolbar.setVisibility(View.VISIBLE); | 382 | binding.toolbar.setVisibility(View.VISIBLE); |
383 | 383 | ||
384 | String fileName = student.stuName + "_周作业学习报告_" + System.currentTimeMillis(); | 384 | String fileName = student.stuName + "_周作业学习报告_" + System.currentTimeMillis(); |
385 | return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); | 385 | return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); |
386 | } catch (Exception e) { | 386 | } catch (Exception e) { |
387 | e.printStackTrace(); | 387 | e.printStackTrace(); |
388 | } | 388 | } |
389 | return null; | 389 | return null; |
390 | } | 390 | } |
391 | 391 | ||
392 | @Override | 392 | @Override |
393 | protected ActivityHuyouDetailBinding getViewBinding() { | 393 | protected ActivityHuyouDetailBinding getViewBinding() { |
394 | a4 = getIntent().getBooleanExtra("a4", false); | 394 | a4 = getIntent().getBooleanExtra("a4", false); |
395 | View view; | 395 | View view; |
396 | if (a4) view = getLayoutInflater().inflate(R.layout.activity_huyou_detail_a4, null); | 396 | if (a4) view = getLayoutInflater().inflate(R.layout.activity_huyou_detail_a4, null); |
397 | else view = getLayoutInflater().inflate(R.layout.activity_huyou_detail, null); | 397 | else view = getLayoutInflater().inflate(R.layout.activity_huyou_detail, null); |
398 | return ActivityHuyouDetailBinding.bind(view); | 398 | return ActivityHuyouDetailBinding.bind(view); |
399 | } | 399 | } |
400 | 400 | ||
401 | public static class Adapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> { | 401 | public static class Adapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> { |
402 | 402 | ||
403 | public Adapter(@Nullable List<StDetail.Point> data) { | 403 | public Adapter(@Nullable List<StDetail.Point> data) { |
404 | super(R.layout.item_huyou_point, data); | 404 | super(R.layout.item_huyou_point, data); |
405 | } | 405 | } |
406 | 406 | ||
407 | @Override | 407 | @Override |
408 | protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) { | 408 | protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) { |
409 | DecimalFormat format1 = new DecimalFormat("0%"); | 409 | DecimalFormat format1 = new DecimalFormat("0%"); |
410 | DecimalFormat format2 = new DecimalFormat("0"); | 410 | DecimalFormat format2 = new DecimalFormat("0"); |
411 | holder.setText(R.id.tvName, point.pointName); | 411 | holder.setText(R.id.tvName, point.pointName); |
412 | holder.setText(R.id.tvBefore, format1.format(point.beforeState)); | 412 | holder.setText(R.id.tvBefore, format1.format(point.beforeState)); |
413 | holder.setText(R.id.tvAfter, format1.format(point.afterState)); | 413 | holder.setText(R.id.tvAfter, format1.format(point.afterState)); |
414 | holder.setText(R.id.tvGap, format2.format(point.gap * 100)); | 414 | holder.setText(R.id.tvGap, format2.format(point.gap * 100)); |
415 | holder.setGone(R.id.ivFlag, getData().indexOf(point) == 0); | 415 | holder.setGone(R.id.ivFlag, getData().indexOf(point) == 0); |
416 | holder.<TextView>getView(R.id.tvName).setTooltipText(point.pointName); | 416 | holder.<TextView>getView(R.id.tvName).setTooltipText(point.pointName); |
417 | 417 | ||
418 | TextView before = holder.getView(R.id.tvBeforeState); | 418 | TextView before = holder.getView(R.id.tvBeforeState); |
419 | TextView after = holder.getView(R.id.tvAfterState); | 419 | TextView after = holder.getView(R.id.tvAfterState); |
420 | 420 | ||
421 | if (point.beforeState >= 0.9) { | 421 | if (point.beforeState >= 0.9) { |
422 | before.setText("掌握优秀"); | 422 | before.setText("掌握优秀"); |
423 | before.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); | 423 | before.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); |
424 | } else if (point.beforeState >= 0.8) { | 424 | } else if (point.beforeState >= 0.8) { |
425 | before.setText("掌握良好"); | 425 | before.setText("掌握良好"); |
426 | before.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); | 426 | before.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); |
427 | } else if (point.beforeState >= 0.6) { | 427 | } else if (point.beforeState >= 0.6) { |
428 | before.setText("掌握一般"); | 428 | before.setText("掌握一般"); |
429 | before.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); | 429 | before.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); |
430 | } else { | 430 | } else { |
431 | before.setText("掌握薄弱"); | 431 | before.setText("掌握薄弱"); |
432 | before.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); | 432 | before.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); |
433 | } | 433 | } |
434 | if (point.afterState >= 0.9) { | 434 | if (point.afterState >= 0.9) { |
435 | after.setText("掌握优秀"); | 435 | after.setText("掌握优秀"); |
436 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); | 436 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); |
437 | } else if (point.afterState >= 0.8) { | 437 | } else if (point.afterState >= 0.8) { |
438 | after.setText("掌握良好"); | 438 | after.setText("掌握良好"); |
439 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); | 439 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); |
440 | } else if (point.afterState >= 0.6) { | 440 | } else if (point.afterState >= 0.6) { |
441 | after.setText("掌握一般"); | 441 | after.setText("掌握一般"); |
442 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); | 442 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); |
443 | } else { | 443 | } else { |
444 | after.setText("掌握薄弱"); | 444 | after.setText("掌握薄弱"); |
445 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); | 445 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); |
446 | } | 446 | } |
447 | 447 | ||
448 | holder.setText(R.id.tvHuyou, format1.format(point.correctness)); | 448 | holder.setText(R.id.tvHuyou, format1.format(point.correctness)); |
449 | } | 449 | } |
450 | 450 | ||
451 | } | 451 | } |
452 | 452 | ||
453 | public static class WeekAdapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> { | 453 | public static class WeekAdapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> { |
454 | public WeekAdapter(@Nullable List<StDetail.Point> data) { | 454 | public WeekAdapter(@Nullable List<StDetail.Point> data) { |
455 | super(R.layout.item_huyou_week_point, data); | 455 | super(R.layout.item_huyou_week_point, data); |
456 | } | 456 | } |
457 | 457 | ||
458 | @Override | 458 | @Override |
459 | protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) { | 459 | protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) { |
460 | holder.setText(R.id.tvName, point.pointName); | 460 | holder.setText(R.id.tvName, point.pointName); |
461 | 461 | ||
462 | TextView after = holder.getView(R.id.tvState); | 462 | TextView after = holder.getView(R.id.tvState); |
463 | if (point.afterState >= 0.9) { | 463 | if (point.afterState >= 0.9) { |
464 | after.setText("掌握优秀"); | 464 | after.setText("掌握优秀"); |
465 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); | 465 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); |
466 | } else if (point.afterState >= 0.8) { | 466 | } else if (point.afterState >= 0.8) { |
467 | after.setText("掌握良好"); | 467 | after.setText("掌握良好"); |
468 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); | 468 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); |
469 | } else if (point.afterState >= 0.6) { | 469 | } else if (point.afterState >= 0.6) { |
470 | after.setText("掌握一般"); | 470 | after.setText("掌握一般"); |
471 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); | 471 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); |
472 | } else { | 472 | } else { |
473 | after.setText("掌握薄弱"); | 473 | after.setText("掌握薄弱"); |
474 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); | 474 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); |
475 | } | 475 | } |
476 | 476 | ||
477 | DecimalFormat format1 = new DecimalFormat("0%"); | 477 | DecimalFormat format1 = new DecimalFormat("0%"); |
478 | holder.setText(R.id.tvHuyou, format1.format(point.correctness)); | 478 | holder.setText(R.id.tvHuyou, format1.format(point.correctness)); |
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||
482 | } | 482 | } |
483 | 483 |