Compare View
Commits (2)
Showing
6 changed files
Show diff stats
.idea/deploymentTargetDropDown.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <project version="4"> | 2 | <project version="4"> |
3 | <component name="deploymentTargetDropDown"> | 3 | <component name="deploymentTargetDropDown"> |
4 | <value> | 4 | <value> |
5 | <entry key="app"> | 5 | <entry key="app"> |
6 | <State /> | 6 | <State> |
7 | <runningDeviceTargetSelectedWithDropDown> | ||
8 | <Target> | ||
9 | <type value="RUNNING_DEVICE_TARGET" /> | ||
10 | <deviceKey> | ||
11 | <Key> | ||
12 | <type value="SERIAL_NUMBER" /> | ||
13 | <value value="951f9ace" /> | ||
14 | </Key> | ||
15 | </deviceKey> | ||
16 | </Target> | ||
17 | </runningDeviceTargetSelectedWithDropDown> | ||
18 | <timeTargetWasSelectedWithDropDown value="2025-03-20T09:48:34.278363400Z" /> | ||
19 | </State> | ||
7 | </entry> | 20 | </entry> |
8 | </value> | 21 | </value> |
9 | </component> | 22 | </component> |
10 | </project> | 23 | </project> |
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<>(); |
118 | List<HomeWork> blankList = new ArrayList<>(); | ||
117 | List<HomeWork> errorList = new ArrayList<>(); | 119 | if (detail.getHomeworkList() != null && detail.getHomeworkList().size() != 0) { |
118 | List<HomeWork> blankList = new ArrayList<>(); | 120 | int total = detail.getHomeworkList().size(); |
119 | if (detail.getHomeworkList() != null && detail.getHomeworkList().size() != 0) { | 121 | int correctNum = 0, blankNumber = 0; |
120 | int total = detail.getHomeworkList().size(); | 122 | Set<KeyValue> correctSet = new HashSet<>(); |
121 | int correctNum = 0, blankNumber = 0; | 123 | Set<KeyValue> errorSet = new HashSet<>(); |
122 | Set<KeyValue> correctSet = new HashSet<>(); | 124 | for (HomeWork homeWork: detail.getHomeworkList()) { |
123 | Set<KeyValue> errorSet = new HashSet<>(); | 125 | if (homeWork.correction == 0) { |
124 | for (HomeWork homeWork: detail.getHomeworkList()) { | 126 | correctNum ++; |
125 | if (homeWork.correction == 0) { | 127 | correctSet.addAll(homeWork.pointsObj); |
126 | correctNum ++; | 128 | } else if (homeWork.correction == 1){ |
127 | correctSet.addAll(homeWork.pointsObj); | 129 | errorList.add(homeWork); |
128 | } else if (homeWork.correction == 1){ | 130 | errorSet.addAll(homeWork.pointsObj); |
131 | } else if (homeWork.correction == 2) { | ||
132 | blankList.add(homeWork); | ||
133 | blankNumber ++; | ||
129 | errorList.add(homeWork); | 134 | } |
130 | errorSet.addAll(homeWork.pointsObj); | 135 | } |
131 | } else if (homeWork.correction == 2) { | 136 | StringBuilder correctPoint = new StringBuilder(); |
132 | blankList.add(homeWork); | 137 | StringBuilder errorPoint = new StringBuilder(); |
133 | blankNumber ++; | 138 | for (KeyValue point: correctSet) { |
134 | } | 139 | correctPoint.append("、").append(point.Value); |
135 | } | 140 | } |
136 | StringBuilder correctPoint = new StringBuilder(); | 141 | for (KeyValue point: errorSet) { |
137 | StringBuilder errorPoint = new StringBuilder(); | 142 | errorPoint.append("、").append(point.Value); |
138 | for (KeyValue point: correctSet) { | 143 | } |
139 | correctPoint.append("、").append(point.Value); | 144 | float rate = 100f * correctNum / Math.max(total - blankNumber, 1); |
140 | } | 145 | int errorNum = total - correctNum; |
141 | for (KeyValue point: errorSet) { | 146 | binding.tvPercent.setText(new DecimalFormat("0").format(rate)); |
142 | errorPoint.append("、").append(point.Value); | 147 | binding.tvCorrect.setText(String.valueOf(correctNum)); |
143 | } | 148 | binding.tvWrong.setText(String.valueOf(errorNum)); |
149 | binding.tvBlank.setText(String.valueOf(blankNumber)); | ||
144 | float rate = 100f * correctNum / Math.max(total - blankNumber, 1); | 150 | |
145 | int errorNum = total - correctNum; | 151 | String correct = "-", error = "-"; |
146 | binding.tvPercent.setText(new DecimalFormat("0").format(rate)); | 152 | if (correctPoint.length() != 0) correct = correctPoint.substring(1); |
147 | binding.tvCorrect.setText(String.valueOf(correctNum)); | 153 | if (errorPoint.length() != 0) error = errorPoint.substring(1); |
148 | binding.tvWrong.setText(String.valueOf(errorNum)); | 154 | if (errorNum == 0) { |
149 | binding.tvBlank.setText(String.valueOf(blankNumber)); | 155 | temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好。"; |
150 | 156 | String s = String.format(temp, | |
151 | String correct = "-", error = "-"; | 157 | fromColor(String.valueOf(correctNum), "#489afa"), |
152 | if (correctPoint.length() != 0) correct = correctPoint.substring(1); | 158 | fromColor(correct, "#489afa") |
153 | if (errorPoint.length() != 0) error = errorPoint.substring(1); | 159 | ); |
154 | if (errorNum == 0) { | 160 | binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); |
155 | temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好。"; | 161 | } else { |
156 | String s = String.format(temp, | 162 | String s = String.format(temp, |
157 | fromColor(String.valueOf(correctNum), "#489afa"), | 163 | fromColor(String.valueOf(correctNum), "#489afa"), |
158 | fromColor(correct, "#489afa") | 164 | fromColor(correct, "#489afa"), |
159 | ); | 165 | fromColor(String.valueOf(errorNum), "#ff4134"), |
160 | binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); | 166 | fromColor(error, "#ff4134") |
161 | } else { | 167 | ); |
162 | String s = String.format(temp, | 168 | binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); |
163 | fromColor(String.valueOf(correctNum), "#489afa"), | 169 | } |
164 | fromColor(correct, "#489afa"), | 170 | } |
165 | fromColor(String.valueOf(errorNum), "#ff4134"), | 171 | |
166 | fromColor(error, "#ff4134") | 172 | mAdapter.setNewData(errorList); |
173 | binding.rvBlank.setAdapter(new BlankAdapter(blankList)); | ||
174 | binding.viewBlank.setVisibility(blankList.isEmpty() ? View.GONE : View.VISIBLE); | ||
167 | ); | 175 | } |
168 | binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); | 176 | |
169 | } | 177 | private String fromColor(String str, String color) { |
170 | } | 178 | return String.format("<font color='%s'>%s</font>", color, str); |
171 | 179 | } | |
172 | mAdapter.setNewData(errorList); | 180 | |
173 | binding.rvBlank.setAdapter(new BlankAdapter(blankList)); | 181 | @Override |
174 | binding.viewBlank.setVisibility(blankList.isEmpty() ? View.GONE : View.VISIBLE); | 182 | protected ActivityHomeworkShareBinding getViewBinding() { |
175 | } | 183 | return ActivityHomeworkShareBinding.inflate(getLayoutInflater()); |
176 | 184 | } | |
177 | private String fromColor(String str, String color) { | 185 | |
178 | return String.format("<font color='%s'>%s</font>", color, str); | 186 | private Uri saveBitmap() { |
179 | } | 187 | try { |
180 | 188 | binding.btnShare.setVisibility(View.GONE); | |
181 | @Override | 189 | binding.btnBack.setVisibility(View.GONE); |
182 | protected ActivityHomeworkShareBinding getViewBinding() { | 190 | Bitmap bitmap = BitmapUtils.shotView(binding.viewRoot); |
183 | return ActivityHomeworkShareBinding.inflate(getLayoutInflater()); | 191 | binding.btnShare.setVisibility(View.VISIBLE); |
184 | } | 192 | binding.btnBack.setVisibility(View.VISIBLE); |
185 | 193 | ||
186 | private Uri saveBitmap() { | 194 | String fileName = student.stuName + "_" + title; |
187 | try { | 195 | return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); |
188 | binding.btnShare.setVisibility(View.GONE); | 196 | } catch (Exception e) { |
189 | binding.btnBack.setVisibility(View.GONE); | 197 | e.printStackTrace(); |
190 | Bitmap bitmap = BitmapUtils.shotView(binding.viewRoot); | 198 | } |
191 | binding.btnShare.setVisibility(View.VISIBLE); | 199 | return null; |
192 | binding.btnBack.setVisibility(View.VISIBLE); | 200 | } |
193 | 201 | ||
194 | String fileName = student.stuName + "_" + title; | 202 | private static String ifEmpty(String s, String placeholder) { |
195 | return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); | 203 | if (s == null || s.isEmpty()) return placeholder; |
196 | } catch (Exception e) { | 204 | return s; |
197 | e.printStackTrace(); | 205 | } |
198 | } | 206 | |
207 | public static class BlankAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { | ||
208 | |||
209 | public BlankAdapter(@Nullable List<HomeWork> data) { | ||
210 | super(R.layout.item_huyou_daily_blank, data); | ||
211 | } | ||
212 | |||
213 | @Override | ||
214 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { | ||
215 | ImageView imageView = holder.getView(R.id.imageView); | ||
216 | Glide.with(mContext).load(homeWork.url).into(imageView); | ||
217 | } | ||
218 | } | ||
219 | |||
199 | return null; | 220 | public static class ErrorAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { |
200 | } | 221 | |
201 | 222 | public ErrorAdapter() { | |
202 | private static String ifEmpty(String s, String placeholder) { | 223 | super(R.layout.item_homework_error); |
203 | if (s == null || s.isEmpty()) return placeholder; | 224 | } |
204 | return s; | 225 | |
205 | } | 226 | @Override |
206 | 227 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { | |
207 | public static class BlankAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { | 228 | ImageView ivTopic = holder.getView(R.id.ivTopic); |
208 | 229 | TextView tvPoints = holder.getView(R.id.tvPoints); | |
209 | public BlankAdapter(@Nullable List<HomeWork> data) { | 230 | ImageView ivAnalyze = holder.getView(R.id.ivAnalyze); |
210 | super(R.layout.item_huyou_daily_blank, data); | 231 | |
211 | } | 232 | showImage(ivTopic, homeWork.url); |
212 | 233 | showImage(ivAnalyze, homeWork.analyseUrl); | |
213 | @Override | 234 | tvPoints.setText("-"); |
214 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { | 235 | if (homeWork.pointsObj == null || homeWork.pointsObj.isEmpty()) return; |
215 | ImageView imageView = holder.getView(R.id.imageView); | 236 | StringBuilder builder = new StringBuilder(); |
216 | Glide.with(mContext).load(homeWork.url).into(imageView); | 237 | for (KeyValue pair: homeWork.pointsObj) { |
217 | } | 238 | builder.append(pair.Value).append("\n"); |
218 | } | 239 | } |
219 | 240 | tvPoints.setText(ifEmpty(builder.toString().trim(), "-")); | |
220 | public static class ErrorAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { | 241 | } |
221 | 242 | ||
222 | public ErrorAdapter() { | 243 | @SuppressLint("CheckResult") |
223 | super(R.layout.item_homework_error); | 244 | private void showImage(ImageView view, String url) { |
224 | } | 245 | view.setVisibility(View.GONE); |
225 | 246 | view.setImageBitmap(null); | |
226 | @Override | 247 | if (url == null) { |
227 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { | 248 | return; |
228 | ImageView ivTopic = holder.getView(R.id.ivTopic); | 249 | } |
229 | TextView tvPoints = holder.getView(R.id.tvPoints); | 250 | view.setOnClickListener(v -> { |
230 | ImageView ivAnalyze = holder.getView(R.id.ivAnalyze); | 251 | new PhotoViewDialog(mContext).show(url); |
231 | 252 | }); | |
232 | showImage(ivTopic, homeWork.url); | 253 | Single.just(url) |
233 | showImage(ivAnalyze, homeWork.analyseUrl); | 254 | .subscribeOn(Schedulers.io()) |
234 | tvPoints.setText("-"); | 255 | .map(u -> Glide.with(mContext).asBitmap().load(url).submit().get()) |
235 | if (homeWork.pointsObj == null || homeWork.pointsObj.isEmpty()) return; | 256 | .observeOn(AndroidSchedulers.mainThread()) |
236 | StringBuilder builder = new StringBuilder(); | 257 | .subscribe((bitmap, th) -> { |
237 | for (KeyValue pair: homeWork.pointsObj) { | 258 | if (bitmap == null) return; |
238 | builder.append(pair.Value).append("\n"); | 259 | |
239 | } | 260 | float imageHeight = bitmap.getHeight(); |
240 | tvPoints.setText(ifEmpty(builder.toString().trim(), "-")); | 261 | float imageWidth = bitmap.getWidth(); |
241 | } | 262 | int viewHeight = (int) (CommonUtil.getScreenHeight(mContext) * 0.75f); |
242 | 263 | int viewWidth = (int) (CommonUtil.getScreenWidth(mContext) * 0.75f); | |
243 | @SuppressLint("CheckResult") | 264 | LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(view.getLayoutParams()); |
244 | private void showImage(ImageView view, String url) { | 265 | if (imageHeight > imageWidth) { |
245 | view.setVisibility(View.GONE); | 266 | if (viewHeight > imageHeight) { |
246 | view.setImageBitmap(null); | 267 | layoutParams.height = (int) imageHeight; |
247 | if (url == null) { | 268 | layoutParams.width = (int) imageWidth; |
248 | return; | 269 | } else { |
249 | } | 270 | layoutParams.height = viewHeight; |
250 | view.setOnClickListener(v -> { | 271 | layoutParams.width = (int) (imageWidth / imageHeight * viewHeight); |
251 | new PhotoViewDialog(mContext).show(url); | 272 | } |
252 | }); | 273 | } else { |
253 | Single.just(url) | 274 | if (viewWidth > imageWidth) { |
254 | .subscribeOn(Schedulers.io()) | 275 | layoutParams.height = (int) imageHeight; |
255 | .map(u -> Glide.with(mContext).asBitmap().load(url).submit().get()) | 276 | layoutParams.width = (int) imageWidth; |
256 | .observeOn(AndroidSchedulers.mainThread()) | 277 | } else { |
257 | .subscribe((bitmap, th) -> { | 278 | layoutParams.height = (int) (imageHeight / imageWidth * viewWidth); |
258 | if (bitmap == null) return; | 279 | layoutParams.width = viewWidth; |
259 | 280 | } | |
260 | float imageHeight = bitmap.getHeight(); | 281 | } |
261 | float imageWidth = bitmap.getWidth(); | 282 | |
262 | int viewHeight = (int) (CommonUtil.getScreenHeight(mContext) * 0.75f); | 283 | layoutParams.setMargins(CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5)); |
263 | int viewWidth = (int) (CommonUtil.getScreenWidth(mContext) * 0.75f); | 284 | view.setLayoutParams(layoutParams); |
264 | LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(view.getLayoutParams()); | 285 | view.setImageBitmap(bitmap); |
265 | if (imageHeight > imageWidth) { | 286 | view.setVisibility(View.VISIBLE); |
266 | if (viewHeight > imageHeight) { | 287 | }); |
267 | layoutParams.height = (int) imageHeight; | 288 | } |
268 | layoutParams.width = (int) imageWidth; | 289 | } |
269 | } else { | 290 | } |
270 | layoutParams.height = viewHeight; | 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)); |
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 | if (rate >= 90) { | 203 | if (rate >= 90) { |
203 | rateComment = "知识点掌握得比较优秀,多练习多巩固掌握一般的知识点会有很大帮助。"; | 204 | rateComment = "知识点掌握得比较优秀,多练习多巩固掌握一般的知识点会有很大帮助。"; |
205 | encComment = "在未来的学习中,请保持这份优秀,继续挑战更难的题目,勇攀高峰"; | ||
204 | } else if (rate >= 80) { | 206 | } else if (rate >= 80) { |
205 | rateComment = "知识点掌握程度有进步,还要再继续学习,多练习,不断巩固。"; | 207 | rateComment = "知识点掌握程度有进步,还要再继续学习,多练习,不断巩固。"; |
208 | encComment = "在未来的学习中,请保持这份优秀,继续挑战更难的题目,勇攀高峰"; | ||
206 | } else if (rate >= 60) { | 209 | } else if (rate >= 60) { |
207 | rateComment = "薄弱知识点还有进步空间,再多做一些类似题目来巩固知识点,继续努力。"; | 210 | rateComment = "薄弱知识点还有进步空间,再多做一些类似题目来巩固知识点,继续努力。"; |
211 | encComment = "在未来的学习中,请不要灰心,继续努力"; | ||
208 | } else { | 212 | } else { |
209 | rateComment = "你的薄弱知识点还需要再深入了解,有不清楚的地方及时问老师,继续加油。"; | 213 | rateComment = "你的薄弱知识点还需要再深入了解,有不清楚的地方及时问老师,继续加油。"; |
214 | encComment = "在未来的学习中,请不要灰心,继续努力"; | ||
210 | } | 215 | } |
211 | 216 | ||
212 | String correctNumHt = fromColor(String.valueOf(data.correct), "#3BC3B6"); | 217 | String correctNumHt = fromColor(String.valueOf(data.correct), "#3BC3B6"); |
213 | 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"); |
214 | StringBuilder pointComment = new StringBuilder("其中,答对题目 ") | 219 | StringBuilder pointComment = new StringBuilder("其中,答对题目 ") |
215 | .append(correctNumHt).append(" 个,答错题目 ") | 220 | .append(correctNumHt).append(" 个,答错题目 ") |
216 | .append(errNumHt).append(" 个"); | 221 | .append(errNumHt).append(" 个"); |
217 | if (exNo > 0) { | 222 | if (exNo > 0) { |
218 | pointComment.append(",").append(exNo).append(" 个知识点掌握的非常棒"); | 223 | pointComment.append(",").append(exNo).append(" 个知识点掌握的非常棒"); |
219 | } | 224 | } |
220 | if (weakNo > 0) { | 225 | if (weakNo > 0) { |
221 | pointComment.append(",").append(weakNo).append(" 个知识点掌握的还需努力,这部分还要再加强学习"); | 226 | pointComment.append(",").append(weakNo).append(" 个知识点掌握的还需努力,这部分还要再加强学习"); |
222 | } | 227 | } |
223 | pointComment.append("。"); | 228 | pointComment.append("。"); |
224 | String rateStr = new DecimalFormat("0%").format(rate / 100f); | 229 | String rateStr = new DecimalFormat("0%").format(rate / 100f); |
225 | String temp; | 230 | String temp; |
226 | if (type == 0) { | 231 | if (type == 0) { |
227 | temp = indent + "在本周作业中,你的综合正确率是 %s," + rateComment + pointComment + "在未来的学习中,请保持这份优秀,继续挑战更难的题目,勇攀高峰。"; | 232 | temp = indent + "在本周作业中,你的综合正确率是 %s," + pointComment + rateComment + encComment; |
228 | } else { | 233 | } else { |
229 | temp = indent + "你的综合正确率是 %s," + rateComment; | 234 | temp = indent + "在本阶段作业中,你的综合正确率是 %s," + pointComment + rateComment + encComment; |
230 | } | 235 | } |
231 | temp = String.format(temp, fromColor(rateStr, "#3BC3B6")); | 236 | temp = String.format(temp, fromColor(rateStr, "#3BC3B6")); |
232 | binding.tvRating.setText(Html.fromHtml(temp, Html.FROM_HTML_MODE_COMPACT)); | 237 | binding.tvRating.setText(Html.fromHtml(temp, Html.FROM_HTML_MODE_COMPACT)); |
233 | } | 238 | } |
234 | 239 | ||
235 | List<Entry> entries = new ArrayList<>(); | 240 | List<Entry> entries = new ArrayList<>(); |
236 | if (type == 0) { | 241 | if (type == 0) { |
237 | entries.add(new Entry(1, data.mondayCorrection)); | 242 | entries.add(new Entry(1, data.mondayCorrection)); |
238 | entries.add(new Entry(2, data.tuesdayCorrection)); | 243 | entries.add(new Entry(2, data.tuesdayCorrection)); |
239 | entries.add(new Entry(3, data.wednesdayCorrection)); | 244 | entries.add(new Entry(3, data.wednesdayCorrection)); |
240 | entries.add(new Entry(4, data.thursdayCorrection)); | 245 | entries.add(new Entry(4, data.thursdayCorrection)); |
241 | entries.add(new Entry(5, data.fridayCorrection)); | 246 | entries.add(new Entry(5, data.fridayCorrection)); |
242 | } else { | 247 | } else { |
243 | for (int i = 0; i < data.correctionList.size(); i ++) { | 248 | for (int i = 0; i < data.correctionList.size(); i ++) { |
244 | StDetail.Correction c = data.correctionList.get(i); | 249 | StDetail.Correction c = data.correctionList.get(i); |
245 | entries.add(new Entry(i, c.correction)); | 250 | entries.add(new Entry(i, c.correction)); |
246 | } | 251 | } |
247 | XAxis xAxis = binding.lineChart.getXAxis(); | 252 | XAxis xAxis = binding.lineChart.getXAxis(); |
248 | xAxis.setLabelCount(Math.min(entries.size(), 5), true); | 253 | xAxis.setLabelCount(Math.min(entries.size(), 5), true); |
249 | xAxis.setValueFormatter(new ValueFormatter() { | 254 | xAxis.setValueFormatter(new ValueFormatter() { |
250 | SimpleDateFormat format = new SimpleDateFormat("M.d", Locale.CHINA); | 255 | SimpleDateFormat format = new SimpleDateFormat("M.d", Locale.CHINA); |
251 | @Override | 256 | @Override |
252 | public String getFormattedValue(float value) { | 257 | public String getFormattedValue(float value) { |
253 | int index = (int) value; | 258 | int index = (int) value; |
254 | if (index < 0 || index >= data.correctionList.size()) return ""; | 259 | if (index < 0 || index >= data.correctionList.size()) return ""; |
255 | Date date = data.correctionList.get(index).date; | 260 | Date date = data.correctionList.get(index).date; |
256 | return format.format(date); | 261 | return format.format(date); |
257 | } | 262 | } |
258 | }); | 263 | }); |
259 | } | 264 | } |
260 | 265 | ||
261 | LineDataSet set = new LineDataSet(entries, ""); | 266 | LineDataSet set = new LineDataSet(entries, ""); |
262 | set.setColor(0xFF3BC3B6); | 267 | set.setColor(0xFF3BC3B6); |
263 | set.setCircleColor(0xFF3BC3B6); | 268 | set.setCircleColor(0xFF3BC3B6); |
264 | set.setDrawFilled(true); | 269 | set.setDrawFilled(true); |
265 | set.setDrawCircles(type == 0 || entries.size() == 1); | 270 | set.setDrawCircles(type == 0 || entries.size() == 1); |
266 | set.setDrawValues(false); | 271 | set.setDrawValues(false); |
267 | set.setHighlightEnabled(false); | 272 | set.setHighlightEnabled(false); |
268 | set.setDrawHighlightIndicators(false); | 273 | set.setDrawHighlightIndicators(false); |
269 | 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)); |
270 | binding.lineChart.setData(new LineData(set)); | 275 | binding.lineChart.setData(new LineData(set)); |
271 | binding.lineChart.invalidate(); | 276 | binding.lineChart.invalidate(); |
272 | 277 | ||
273 | if (!data.points.isEmpty()) { | 278 | if (!data.points.isEmpty()) { |
274 | binding.tvExcellent.setText(String.valueOf(exNo)); | 279 | binding.tvExcellent.setText(String.valueOf(exNo)); |
275 | binding.tvGood.setText(String.valueOf(goodNo)); | 280 | binding.tvGood.setText(String.valueOf(goodNo)); |
276 | binding.tvNormal.setText(String.valueOf(normalNo)); | 281 | binding.tvNormal.setText(String.valueOf(normalNo)); |
277 | binding.tvWeak.setText(String.valueOf(weakNo)); | 282 | binding.tvWeak.setText(String.valueOf(weakNo)); |
278 | 283 | ||
279 | float exRate = 100f * exNo / data.points.size(); | 284 | float exRate = 100f * exNo / data.points.size(); |
280 | float goodRate = 100f * goodNo / data.points.size(); | 285 | float goodRate = 100f * goodNo / data.points.size(); |
281 | float normalRate = 100f * normalNo / data.points.size(); | 286 | float normalRate = 100f * normalNo / data.points.size(); |
282 | float weakRate = 100f * weakNo / data.points.size(); | 287 | float weakRate = 100f * weakNo / data.points.size(); |
283 | binding.cpGood.setValue(goodRate + normalRate + weakRate); | 288 | binding.cpGood.setValue(goodRate + normalRate + weakRate); |
284 | binding.cpNormal.setValue(normalRate + weakRate); | 289 | binding.cpNormal.setValue(normalRate + weakRate); |
285 | binding.cpWeak.setValue(weakRate); | 290 | binding.cpWeak.setValue(weakRate); |
286 | 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())); |
287 | } | 292 | } |
288 | 293 | ||
289 | List<StDetail.Point> points = new ArrayList<>(); | 294 | List<StDetail.Point> points = new ArrayList<>(); |
290 | for (StDetail.Point point: data.points) { | 295 | for (StDetail.Point point: data.points) { |
291 | if (point.beforeState < 1) points.add(point); | 296 | if (point.beforeState < 1) points.add(point); |
292 | } | 297 | } |
293 | binding.tableRoot.setClipToOutline(true); | 298 | binding.tableRoot.setClipToOutline(true); |
294 | binding.tableWeekRoot.setClipToOutline(true); | 299 | binding.tableWeekRoot.setClipToOutline(true); |
295 | binding.rvPoint.setAdapter(new Adapter(points)); | 300 | binding.rvPoint.setAdapter(new Adapter(points)); |
296 | binding.rvWeekPoint.setAdapter(new WeekAdapter(data.points)); | 301 | binding.rvWeekPoint.setAdapter(new WeekAdapter(data.points)); |
297 | binding.tableRoot.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); | 302 | binding.tableRoot.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); |
298 | binding.flPointDesc.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); | 303 | binding.flPointDesc.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); |
299 | binding.flEmptyPoints.setVisibility(points.isEmpty() ? View.VISIBLE : View.GONE); | 304 | binding.flEmptyPoints.setVisibility(points.isEmpty() ? View.VISIBLE : View.GONE); |
300 | } | 305 | } |
301 | 306 | ||
302 | private void setupChart() { | 307 | private void setupChart() { |
303 | binding.lineChart.getLegend().setForm(Legend.LegendForm.NONE); | 308 | binding.lineChart.getLegend().setForm(Legend.LegendForm.NONE); |
304 | binding.lineChart.setScaleEnabled(false); | 309 | binding.lineChart.setScaleEnabled(false); |
305 | binding.lineChart.setTouchEnabled(false); | 310 | binding.lineChart.setTouchEnabled(false); |
306 | binding.lineChart.setDescription(null); | 311 | binding.lineChart.setDescription(null); |
307 | binding.lineChart.getAxisRight().setEnabled(false); | 312 | binding.lineChart.getAxisRight().setEnabled(false); |
308 | YAxis yAxis = binding.lineChart.getAxisLeft(); | 313 | YAxis yAxis = binding.lineChart.getAxisLeft(); |
309 | yAxis.setDrawAxisLine(false); | 314 | yAxis.setDrawAxisLine(false); |
310 | yAxis.setDrawGridLines(true); | 315 | yAxis.setDrawGridLines(true); |
311 | yAxis.setGridColor(0xFFDDDDDD); | 316 | yAxis.setGridColor(0xFFDDDDDD); |
312 | yAxis.setTextColor(0xFF333333); | 317 | yAxis.setTextColor(0xFF333333); |
313 | if (type == 0) { | 318 | if (type == 0) { |
314 | yAxis.setTextSize(16); | 319 | yAxis.setTextSize(16); |
315 | yAxis.setXOffset(16); | 320 | yAxis.setXOffset(16); |
316 | } else { | 321 | } else { |
317 | yAxis.setTextSize(13); | 322 | yAxis.setTextSize(13); |
318 | } | 323 | } |
319 | yAxis.setAxisMinimum(0); | 324 | yAxis.setAxisMinimum(0); |
320 | yAxis.setAxisMaximum(1); | 325 | yAxis.setAxisMaximum(1); |
321 | yAxis.setLabelCount(5, true); | 326 | yAxis.setLabelCount(5, true); |
322 | yAxis.setValueFormatter(new ValueFormatter() { | 327 | yAxis.setValueFormatter(new ValueFormatter() { |
323 | @Override | 328 | @Override |
324 | public String getFormattedValue(float value) { | 329 | public String getFormattedValue(float value) { |
325 | return new DecimalFormat("0%").format(value); | 330 | return new DecimalFormat("0%").format(value); |
326 | } | 331 | } |
327 | }); | 332 | }); |
328 | 333 | ||
329 | XAxis xAxis = binding.lineChart.getXAxis(); | 334 | XAxis xAxis = binding.lineChart.getXAxis(); |
330 | xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); | 335 | xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); |
331 | xAxis.setDrawAxisLine(false); | 336 | xAxis.setDrawAxisLine(false); |
332 | xAxis.setDrawGridLines(false); | 337 | xAxis.setDrawGridLines(false); |
333 | xAxis.setTextColor(0xFF333333); | 338 | xAxis.setTextColor(0xFF333333); |
334 | xAxis.setTextSize(16); | 339 | xAxis.setTextSize(16); |
335 | xAxis.setYOffset(16); | 340 | xAxis.setYOffset(16); |
336 | if (type == 0) { | 341 | if (type == 0) { |
337 | xAxis.setAxisMinimum(0.5f); | 342 | xAxis.setAxisMinimum(0.5f); |
338 | xAxis.setAxisMaximum(5.5f); | 343 | xAxis.setAxisMaximum(5.5f); |
339 | xAxis.setLabelCount(11, true); | 344 | xAxis.setLabelCount(11, true); |
340 | xAxis.setValueFormatter(new ValueFormatter() { | 345 | xAxis.setValueFormatter(new ValueFormatter() { |
341 | @Override | 346 | @Override |
342 | public String getFormattedValue(float value) { | 347 | public String getFormattedValue(float value) { |
343 | if (value == 1) { | 348 | if (value == 1) { |
344 | return "周一"; | 349 | return "周一"; |
345 | } else if (value == 2) { | 350 | } else if (value == 2) { |
346 | return "周二"; | 351 | return "周二"; |
347 | } else if (value == 3) { | 352 | } else if (value == 3) { |
348 | return "周三"; | 353 | return "周三"; |
349 | } else if (value == 4) { | 354 | } else if (value == 4) { |
350 | return "周四"; | 355 | return "周四"; |
351 | } else if (value == 5) { | 356 | } else if (value == 5) { |
352 | return "周五"; | 357 | return "周五"; |
353 | } | 358 | } |
354 | return ""; | 359 | return ""; |
355 | } | 360 | } |
356 | }); | 361 | }); |
357 | } else { | 362 | } else { |
358 | xAxis.setTextSize(13); | 363 | xAxis.setTextSize(13); |
359 | } | 364 | } |
360 | } | 365 | } |
361 | 366 | ||
362 | private String fromColor(String str, String color) { | 367 | private String fromColor(String str, String color) { |
363 | 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); |
364 | } | 369 | } |
365 | 370 | ||
366 | private void switchPage() { | 371 | private void switchPage() { |
367 | Intent intent = new Intent(getIntent()); | 372 | Intent intent = new Intent(getIntent()); |
368 | intent.putExtra("a4", !a4); | 373 | intent.putExtra("a4", !a4); |
369 | startActivity(intent); | 374 | startActivity(intent); |
370 | finish(); | 375 | finish(); |
371 | } | 376 | } |
372 | 377 | ||
373 | private Uri prepareShare() { | 378 | private Uri prepareShare() { |
374 | try { | 379 | try { |
375 | binding.toolbar.setVisibility(View.INVISIBLE); | 380 | binding.toolbar.setVisibility(View.INVISIBLE); |
376 | Bitmap bitmap = BitmapUtils.shotView(binding.root); | 381 | Bitmap bitmap = BitmapUtils.shotView(binding.root); |
377 | binding.toolbar.setVisibility(View.VISIBLE); | 382 | binding.toolbar.setVisibility(View.VISIBLE); |
378 | 383 | ||
379 | String fileName = student.stuName + "_周作业学习报告_" + System.currentTimeMillis(); | 384 | String fileName = student.stuName + "_周作业学习报告_" + System.currentTimeMillis(); |
380 | return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); | 385 | return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); |
381 | } catch (Exception e) { | 386 | } catch (Exception e) { |
382 | e.printStackTrace(); | 387 | e.printStackTrace(); |
383 | } | 388 | } |
384 | return null; | 389 | return null; |
385 | } | 390 | } |
386 | 391 | ||
387 | @Override | 392 | @Override |
388 | protected ActivityHuyouDetailBinding getViewBinding() { | 393 | protected ActivityHuyouDetailBinding getViewBinding() { |
389 | a4 = getIntent().getBooleanExtra("a4", false); | 394 | a4 = getIntent().getBooleanExtra("a4", false); |
390 | View view; | 395 | View view; |
391 | 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); |
392 | else view = getLayoutInflater().inflate(R.layout.activity_huyou_detail, null); | 397 | else view = getLayoutInflater().inflate(R.layout.activity_huyou_detail, null); |
393 | return ActivityHuyouDetailBinding.bind(view); | 398 | return ActivityHuyouDetailBinding.bind(view); |
394 | } | 399 | } |
395 | 400 | ||
396 | public static class Adapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> { | 401 | public static class Adapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> { |
397 | 402 | ||
398 | public Adapter(@Nullable List<StDetail.Point> data) { | 403 | public Adapter(@Nullable List<StDetail.Point> data) { |
399 | super(R.layout.item_huyou_point, data); | 404 | super(R.layout.item_huyou_point, data); |
400 | } | 405 | } |
401 | 406 | ||
402 | @Override | 407 | @Override |
403 | protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) { | 408 | protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) { |
404 | DecimalFormat format1 = new DecimalFormat("0%"); | 409 | DecimalFormat format1 = new DecimalFormat("0%"); |
405 | DecimalFormat format2 = new DecimalFormat("0"); | 410 | DecimalFormat format2 = new DecimalFormat("0"); |
406 | holder.setText(R.id.tvName, point.pointName); | 411 | holder.setText(R.id.tvName, point.pointName); |
407 | holder.setText(R.id.tvBefore, format1.format(point.beforeState)); | 412 | holder.setText(R.id.tvBefore, format1.format(point.beforeState)); |
408 | holder.setText(R.id.tvAfter, format1.format(point.afterState)); | 413 | holder.setText(R.id.tvAfter, format1.format(point.afterState)); |
409 | holder.setText(R.id.tvGap, format2.format(point.gap * 100)); | 414 | holder.setText(R.id.tvGap, format2.format(point.gap * 100)); |
410 | holder.setGone(R.id.ivFlag, getData().indexOf(point) == 0); | 415 | holder.setGone(R.id.ivFlag, getData().indexOf(point) == 0); |
411 | holder.<TextView>getView(R.id.tvName).setTooltipText(point.pointName); | 416 | holder.<TextView>getView(R.id.tvName).setTooltipText(point.pointName); |
412 | 417 | ||
413 | TextView before = holder.getView(R.id.tvBeforeState); | 418 | TextView before = holder.getView(R.id.tvBeforeState); |
414 | TextView after = holder.getView(R.id.tvAfterState); | 419 | TextView after = holder.getView(R.id.tvAfterState); |
415 | 420 | ||
416 | if (point.beforeState >= 0.9) { | 421 | if (point.beforeState >= 0.9) { |
417 | before.setText("掌握优秀"); | 422 | before.setText("掌握优秀"); |
418 | before.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); | 423 | before.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); |
419 | } else if (point.beforeState >= 0.8) { | 424 | } else if (point.beforeState >= 0.8) { |
420 | before.setText("掌握良好"); | 425 | before.setText("掌握良好"); |
421 | before.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); | 426 | before.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); |
422 | } else if (point.beforeState >= 0.6) { | 427 | } else if (point.beforeState >= 0.6) { |
423 | before.setText("掌握一般"); | 428 | before.setText("掌握一般"); |
424 | before.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); | 429 | before.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); |
425 | } else { | 430 | } else { |
426 | before.setText("掌握薄弱"); | 431 | before.setText("掌握薄弱"); |
427 | before.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); | 432 | before.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); |
428 | } | 433 | } |
429 | if (point.afterState >= 0.9) { | 434 | if (point.afterState >= 0.9) { |
430 | after.setText("掌握优秀"); | 435 | after.setText("掌握优秀"); |
431 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); | 436 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); |
432 | } else if (point.afterState >= 0.8) { | 437 | } else if (point.afterState >= 0.8) { |
433 | after.setText("掌握良好"); | 438 | after.setText("掌握良好"); |
434 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); | 439 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); |
435 | } else if (point.afterState >= 0.6) { | 440 | } else if (point.afterState >= 0.6) { |
436 | after.setText("掌握一般"); | 441 | after.setText("掌握一般"); |
437 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); | 442 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); |
438 | } else { | 443 | } else { |
439 | after.setText("掌握薄弱"); | 444 | after.setText("掌握薄弱"); |
440 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); | 445 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); |
441 | } | 446 | } |
442 | 447 | ||
443 | holder.setText(R.id.tvHuyou, format1.format(point.correctness)); | 448 | holder.setText(R.id.tvHuyou, format1.format(point.correctness)); |
444 | } | 449 | } |
445 | 450 | ||
446 | } | 451 | } |
447 | 452 | ||
448 | public static class WeekAdapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> { | 453 | public static class WeekAdapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> { |
449 | public WeekAdapter(@Nullable List<StDetail.Point> data) { | 454 | public WeekAdapter(@Nullable List<StDetail.Point> data) { |
450 | super(R.layout.item_huyou_week_point, data); | 455 | super(R.layout.item_huyou_week_point, data); |
451 | } | 456 | } |
452 | 457 | ||
453 | @Override | 458 | @Override |
454 | protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) { | 459 | protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) { |
455 | holder.setText(R.id.tvName, point.pointName); | 460 | holder.setText(R.id.tvName, point.pointName); |
456 | 461 | ||
457 | TextView after = holder.getView(R.id.tvState); | 462 | TextView after = holder.getView(R.id.tvState); |
458 | if (point.afterState >= 0.9) { | 463 | if (point.afterState >= 0.9) { |
459 | after.setText("掌握优秀"); | 464 | after.setText("掌握优秀"); |
460 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); | 465 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); |
461 | } else if (point.afterState >= 0.8) { | 466 | } else if (point.afterState >= 0.8) { |
462 | after.setText("掌握良好"); | 467 | after.setText("掌握良好"); |
463 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); | 468 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); |
464 | } else if (point.afterState >= 0.6) { | 469 | } else if (point.afterState >= 0.6) { |
465 | after.setText("掌握一般"); | 470 | after.setText("掌握一般"); |
466 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); | 471 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); |
467 | } else { | 472 | } else { |
468 | after.setText("掌握薄弱"); | 473 | after.setText("掌握薄弱"); |
469 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); | 474 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); |
470 | } | 475 | } |
471 | 476 | ||
472 | DecimalFormat format1 = new DecimalFormat("0%"); | 477 | DecimalFormat format1 = new DecimalFormat("0%"); |
473 | holder.setText(R.id.tvHuyou, format1.format(point.correctness)); | 478 | holder.setText(R.id.tvHuyou, format1.format(point.correctness)); |
474 | } | 479 | } |
475 | } | 480 | } |
476 | 481 | ||
477 | } | 482 | } |
478 | 483 |
app/src/main/res/layout/activity_homework_select.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout | 2 | <LinearLayout |
3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
5 | xmlns:tools="http://schemas.android.com/tools" | 5 | xmlns:tools="http://schemas.android.com/tools" |
6 | android:orientation="vertical" | 6 | android:orientation="vertical" |
7 | android:layout_width="match_parent" | 7 | android:layout_width="match_parent" |
8 | android:layout_height="match_parent" | 8 | android:layout_height="match_parent" |
9 | tools:ignore="HardcodedText"> | 9 | tools:ignore="HardcodedText"> |
10 | 10 | ||
11 | <androidx.appcompat.widget.Toolbar | 11 | <androidx.appcompat.widget.Toolbar |
12 | android:id="@+id/toolbar" | 12 | android:id="@+id/toolbar" |
13 | app:navigationIcon="@drawable/svg_back" | 13 | app:navigationIcon="@drawable/svg_back" |
14 | app:contentInsetStartWithNavigation="14dp" | 14 | app:contentInsetStartWithNavigation="14dp" |
15 | android:paddingStart="-8dp" | 15 | android:paddingStart="-8dp" |
16 | android:paddingEnd="-8dp" | 16 | android:paddingEnd="-8dp" |
17 | android:background="@color/white" | 17 | android:background="@color/white" |
18 | android:layout_width="match_parent" | 18 | android:layout_width="match_parent" |
19 | android:layout_height="40dp"> | 19 | android:layout_height="40dp"> |
20 | <TextView | 20 | <TextView |
21 | android:text="第一步:选择错题" | 21 | android:text="第一步:选择完成情况" |
22 | android:textSize="18sp" | 22 | android:textSize="18sp" |
23 | android:textColor="#333" | 23 | android:textColor="#333" |
24 | android:textStyle="bold" | 24 | android:textStyle="bold" |
25 | android:layout_gravity="center" | 25 | android:layout_gravity="center" |
26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
27 | android:layout_height="wrap_content"/> | 27 | android:layout_height="wrap_content"/> |
28 | </androidx.appcompat.widget.Toolbar> | 28 | </androidx.appcompat.widget.Toolbar> |
29 | 29 | ||
30 | <LinearLayout | 30 | <LinearLayout |
31 | android:orientation="horizontal" | 31 | android:orientation="horizontal" |
32 | android:layout_marginHorizontal="16dp" | 32 | android:layout_marginHorizontal="16dp" |
33 | android:layout_marginTop="16dp" | 33 | android:layout_marginTop="16dp" |
34 | android:layout_marginBottom="8dp" | 34 | android:layout_marginBottom="8dp" |
35 | android:layout_width="match_parent" | 35 | android:layout_width="match_parent" |
36 | android:layout_height="wrap_content"> | 36 | android:layout_height="wrap_content"> |
37 | <Space style="@style/empty_space"/> | 37 | <Space style="@style/empty_space"/> |
38 | <TextView | 38 | <TextView |
39 | android:id="@+id/tvNumber" | 39 | android:id="@+id/tvNumber" |
40 | android:text="0" | 40 | android:text="0" |
41 | android:textSize="13sp" | 41 | android:textSize="13sp" |
42 | android:textColor="#1C90F3" | 42 | android:textColor="#1C90F3" |
43 | android:layout_width="wrap_content" | 43 | android:layout_width="wrap_content" |
44 | android:layout_height="wrap_content"/> | 44 | android:layout_height="wrap_content"/> |
45 | <TextView | 45 | <TextView |
46 | android:text=" 道错题, " | 46 | android:text=" 道错题, " |
47 | android:textSize="13sp" | 47 | android:textSize="13sp" |
48 | android:textColor="#333" | 48 | android:textColor="#333" |
49 | android:layout_width="wrap_content" | 49 | android:layout_width="wrap_content" |
50 | android:layout_height="wrap_content"/> | 50 | android:layout_height="wrap_content"/> |
51 | <TextView | 51 | <TextView |
52 | android:id="@+id/tvBlankNumber" | 52 | android:id="@+id/tvBlankNumber" |
53 | android:text="0" | 53 | android:text="0" |
54 | android:textSize="13sp" | 54 | android:textSize="13sp" |
55 | android:textColor="#1C90F3" | 55 | android:textColor="#1C90F3" |
56 | android:layout_width="wrap_content" | 56 | android:layout_width="wrap_content" |
57 | android:layout_height="wrap_content"/> | 57 | android:layout_height="wrap_content"/> |
58 | <TextView | 58 | <TextView |
59 | android:text=" 道未做题" | 59 | android:text=" 道未做题" |
60 | android:textSize="13sp" | 60 | android:textSize="13sp" |
61 | android:textColor="#333" | 61 | android:textColor="#333" |
62 | android:layout_width="wrap_content" | 62 | android:layout_width="wrap_content" |
63 | android:layout_height="wrap_content"/> | 63 | android:layout_height="wrap_content"/> |
64 | </LinearLayout> | 64 | </LinearLayout> |
65 | 65 | ||
66 | <androidx.recyclerview.widget.RecyclerView | 66 | <androidx.recyclerview.widget.RecyclerView |
67 | android:id="@+id/recyclerView" | 67 | android:id="@+id/recyclerView" |
68 | android:orientation="vertical" | 68 | android:orientation="vertical" |
69 | app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | 69 | app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" |
70 | android:layout_width="match_parent" | 70 | android:layout_width="match_parent" |
71 | android:layout_height="0px" | 71 | android:layout_height="0px" |
72 | android:layout_weight="1"/> | 72 | android:layout_weight="1"/> |
73 | 73 | ||
74 | <FrameLayout | 74 | <FrameLayout |
75 | android:background="@color/white" | 75 | android:background="@color/white" |
76 | android:paddingTop="8dp" | 76 | android:paddingTop="8dp" |
77 | android:paddingBottom="16dp" | 77 | android:paddingBottom="16dp" |
78 | android:layout_width="match_parent" | 78 | android:layout_width="match_parent" |
79 | android:layout_height="wrap_content"> | 79 | android:layout_height="wrap_content"> |
80 | <TextView | 80 | <TextView |
81 | android:id="@+id/btnConfirm" | 81 | android:id="@+id/btnConfirm" |
82 | android:text="下一步" | 82 | android:text="下一步" |
83 | android:textSize="16sp" | 83 | android:textSize="16sp" |
84 | android:textColor="@color/white" | 84 | android:textColor="@color/white" |
85 | android:gravity="center" | 85 | android:gravity="center" |
86 | android:layout_gravity="center" | 86 | android:layout_gravity="center" |
87 | android:background="@drawable/shape_radius_5" | 87 | android:background="@drawable/shape_radius_5" |
88 | android:backgroundTint="#1C90F3" | 88 | android:backgroundTint="#1C90F3" |
89 | android:layout_width="265dp" | 89 | android:layout_width="265dp" |
90 | android:layout_height="36dp"/> | 90 | android:layout_height="36dp"/> |
91 | </FrameLayout> | 91 | </FrameLayout> |
92 | </LinearLayout> | 92 | </LinearLayout> |
app/src/main/res/layout/activity_homework_share.xml
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout | 2 | <LinearLayout |
3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
5 | xmlns:tools="http://schemas.android.com/tools" | 5 | xmlns:tools="http://schemas.android.com/tools" |
6 | android:orientation="vertical" | 6 | android:orientation="vertical" |
7 | android:background="#489AFA" | 7 | android:background="#489AFA" |
8 | android:layout_width="match_parent" | 8 | android:layout_width="match_parent" |
9 | android:layout_height="match_parent" | 9 | android:layout_height="match_parent" |
10 | tools:ignore="HardcodedText,ContentDescription,SmallSp"> | 10 | tools:ignore="HardcodedText,ContentDescription,SmallSp"> |
11 | 11 | ||
12 | <androidx.core.widget.NestedScrollView | 12 | <androidx.core.widget.NestedScrollView |
13 | android:layout_width="match_parent" | 13 | android:layout_width="match_parent" |
14 | android:layout_height="match_parent"> | 14 | android:layout_height="match_parent"> |
15 | <LinearLayout | 15 | <LinearLayout |
16 | android:id="@+id/viewRoot" | 16 | android:id="@+id/viewRoot" |
17 | android:orientation="vertical" | 17 | android:orientation="vertical" |
18 | android:paddingHorizontal="16dp" | 18 | android:paddingHorizontal="16dp" |
19 | android:paddingVertical="16dp" | 19 | android:paddingVertical="16dp" |
20 | android:background="#489AFA" | 20 | android:background="#489AFA" |
21 | android:layout_width="match_parent" | 21 | android:layout_width="match_parent" |
22 | android:layout_height="wrap_content"> | 22 | android:layout_height="wrap_content"> |
23 | 23 | ||
24 | <androidx.appcompat.widget.Toolbar | 24 | <androidx.appcompat.widget.Toolbar |
25 | android:id="@+id/toolbar" | 25 | android:id="@+id/toolbar" |
26 | app:contentInsetStart="0px" | 26 | app:contentInsetStart="0px" |
27 | android:layout_width="match_parent" | 27 | android:layout_width="match_parent" |
28 | android:layout_height="56dp"> | 28 | android:layout_height="56dp"> |
29 | <androidx.appcompat.widget.AppCompatImageView | 29 | <androidx.appcompat.widget.AppCompatImageView |
30 | android:id="@+id/btnBack" | 30 | android:id="@+id/btnBack" |
31 | android:tint="@color/white" | 31 | android:tint="@color/white" |
32 | android:src="@drawable/svg_arrow_head_start_black" | 32 | android:src="@drawable/svg_arrow_head_start_black" |
33 | android:paddingEnd="16dp" | 33 | android:paddingEnd="16dp" |
34 | android:paddingStart="0px" | ||
34 | android:paddingStart="0px" | 35 | android:layout_width="wrap_content" |
35 | android:layout_width="wrap_content" | 36 | android:layout_height="wrap_content"/> |
36 | android:layout_height="wrap_content"/> | 37 | |
37 | 38 | <TextView | |
38 | <TextView | 39 | android:id="@+id/tvTitle" |
39 | android:id="@+id/tvTitle" | 40 | android:text="-" |
40 | android:text="-" | 41 | android:textSize="18sp" |
41 | android:textSize="18sp" | 42 | android:singleLine="true" |
42 | android:singleLine="true" | 43 | android:ellipsize="middle" |
43 | android:ellipsize="middle" | 44 | android:textColor="@color/white" |
44 | android:textColor="@color/white" | 45 | android:textStyle="bold" |
45 | android:textStyle="bold" | 46 | android:layout_gravity="center" |
46 | android:layout_gravity="center" | 47 | android:layout_width="wrap_content" |
47 | android:layout_width="wrap_content" | 48 | android:layout_height="wrap_content"/> |
48 | android:layout_height="wrap_content"/> | 49 | |
49 | 50 | <TextView | |
50 | <TextView | 51 | android:id="@+id/btnShare" |
51 | android:id="@+id/btnShare" | 52 | android:text="分享" |
52 | android:text="分享" | 53 | android:textSize="15sp" |
53 | android:textSize="15sp" | 54 | android:textColor="@color/black" |
54 | android:textColor="@color/black" | 55 | android:paddingHorizontal="15dp" |
55 | android:paddingHorizontal="15dp" | 56 | android:paddingVertical="5dp" |
56 | android:paddingVertical="5dp" | 57 | android:background="@drawable/shape_circle" |
57 | android:background="@drawable/shape_circle" | 58 | android:backgroundTint="#FCDC28" |
58 | android:backgroundTint="#FCDC28" | 59 | android:layout_width="wrap_content" |
59 | android:layout_width="wrap_content" | 60 | android:layout_height="wrap_content" |
60 | android:layout_height="wrap_content" | 61 | android:layout_gravity="end|center_vertical" /> |
61 | android:layout_gravity="end|center_vertical" /> | 62 | </androidx.appcompat.widget.Toolbar> |
62 | </androidx.appcompat.widget.Toolbar> | 63 | |
63 | 64 | <ImageView | |
64 | <ImageView | 65 | android:src="@drawable/png_share_top" |
65 | android:src="@drawable/png_share_top" | 66 | android:elevation="1dp" |
66 | android:elevation="1dp" | 67 | android:layout_gravity="end" |
67 | android:layout_gravity="end" | 68 | android:layout_marginEnd="5dp" |
68 | android:layout_marginEnd="5dp" | 69 | android:layout_width="90dp" |
69 | android:layout_width="90dp" | 70 | android:layout_height="80dp"/> |
70 | android:layout_height="80dp"/> | 71 | |
71 | 72 | <LinearLayout | |
72 | <LinearLayout | 73 | android:orientation="vertical" |
73 | android:orientation="vertical" | 74 | android:background="@drawable/png_info_bg" |
74 | android:background="@drawable/png_info_bg" | 75 | android:paddingHorizontal="16dp" |
75 | android:paddingHorizontal="16dp" | 76 | android:paddingVertical="16dp" |
76 | android:paddingVertical="16dp" | 77 | android:layout_marginTop="-70dp" |
77 | android:layout_marginTop="-70dp" | 78 | android:layout_width="match_parent" |
78 | android:layout_width="match_parent" | 79 | android:layout_height="144dp"> |
79 | android:layout_height="144dp"> | 80 | <LinearLayout |
80 | <LinearLayout | 81 | android:orientation="horizontal" |
81 | android:orientation="horizontal" | 82 | android:layout_width="match_parent" |
82 | android:layout_width="match_parent" | 83 | android:layout_height="wrap_content"> |
83 | android:layout_height="wrap_content"> | 84 | <androidx.constraintlayout.utils.widget.ImageFilterView |
84 | <androidx.constraintlayout.utils.widget.ImageFilterView | 85 | android:id="@+id/ivAvatar" |
85 | android:id="@+id/ivAvatar" | 86 | tools:background="#2491FF" |
86 | tools:background="#2491FF" | 87 | app:round="40dp" |
87 | app:round="40dp" | 88 | android:layout_width="40dp" |
88 | android:layout_width="40dp" | 89 | android:layout_height="40dp"/> |
89 | android:layout_height="40dp"/> | 90 | <TextView |
90 | <TextView | 91 | android:id="@+id/tvStuName" |
91 | android:id="@+id/tvStuName" | 92 | tools:text="杨同学 " |
92 | tools:text="杨同学 " | 93 | android:textSize="14sp" |
93 | android:textSize="14sp" | 94 | android:textColor="#333" |
94 | android:textColor="#333" | 95 | android:textStyle="bold" |
95 | android:textStyle="bold" | 96 | android:layout_marginStart="8dp" |
96 | android:layout_marginStart="8dp" | 97 | android:layout_gravity="center_vertical" |
97 | android:layout_gravity="center_vertical" | 98 | android:layout_width="wrap_content" |
98 | android:layout_width="wrap_content" | 99 | android:layout_height="wrap_content"/> |
99 | android:layout_height="wrap_content"/> | 100 | </LinearLayout> |
100 | </LinearLayout> | 101 | <LinearLayout |
101 | <LinearLayout | 102 | android:orientation="horizontal" |
102 | android:orientation="horizontal" | 103 | android:background="@drawable/shape_radius_10" |
103 | android:background="@drawable/shape_radius_10" | 104 | android:backgroundTint="#F4FAFF" |
104 | android:backgroundTint="#F4FAFF" | 105 | android:layout_marginTop="12dp" |
105 | android:layout_marginTop="12dp" | 106 | android:layout_width="match_parent" |
106 | android:layout_width="match_parent" | 107 | android:layout_height="60dp"> |
107 | android:layout_height="60dp"> | 108 | <LinearLayout |
108 | <LinearLayout | 109 | android:orientation="vertical" |
109 | android:orientation="vertical" | 110 | android:gravity="center" |
110 | android:gravity="center" | 111 | android:layout_width="0dp" |
111 | android:layout_width="0dp" | 112 | android:layout_height="match_parent" |
112 | android:layout_height="match_parent" | 113 | android:layout_weight="1"> |
113 | android:layout_weight="1"> | 114 | <LinearLayout |
114 | <LinearLayout | 115 | android:paddingEnd="20dp" |
116 | android:paddingStart="0px" | ||
115 | android:paddingEnd="20dp" | 117 | android:gravity="center_vertical" |
116 | android:paddingStart="0px" | 118 | android:layout_width="wrap_content" |
117 | android:gravity="center_vertical" | 119 | android:layout_height="wrap_content"> |
118 | android:layout_width="wrap_content" | 120 | <ImageView |
119 | android:layout_height="wrap_content"> | 121 | android:src="@drawable/png_iv_grade" |
120 | <ImageView | 122 | android:layout_marginEnd="5dp" |
121 | android:src="@drawable/png_iv_grade" | 123 | android:layout_width="16dp" |
122 | android:layout_marginEnd="5dp" | 124 | android:layout_height="14dp"/> |
123 | android:layout_width="16dp" | 125 | <TextView |
124 | android:layout_height="14dp"/> | 126 | android:text="年级" |
125 | <TextView | 127 | android:textSize="12sp" |
126 | android:text="年级" | 128 | android:textColor="#333" |
127 | android:textSize="12sp" | 129 | android:textStyle="bold" |
128 | android:textColor="#333" | 130 | android:layout_width="wrap_content" |
129 | android:textStyle="bold" | 131 | android:layout_height="wrap_content"/> |
130 | android:layout_width="wrap_content" | 132 | </LinearLayout> |
131 | android:layout_height="wrap_content"/> | 133 | <TextView |
132 | </LinearLayout> | 134 | android:id="@+id/tvGrade" |
133 | <TextView | 135 | tools:text="七年级" |
134 | android:id="@+id/tvGrade" | 136 | android:textSize="12sp" |
135 | tools:text="七年级" | 137 | android:textColor="#489AFA" |
136 | android:textSize="12sp" | 138 | android:textStyle="bold" |
137 | android:textColor="#489AFA" | 139 | android:layout_marginTop="8dp" |
138 | android:textStyle="bold" | 140 | android:layout_width="wrap_content" |
139 | android:layout_marginTop="8dp" | 141 | android:layout_height="wrap_content"/> |
140 | android:layout_width="wrap_content" | 142 | </LinearLayout> |
141 | android:layout_height="wrap_content"/> | 143 | <LinearLayout |
142 | </LinearLayout> | 144 | android:orientation="vertical" |
143 | <LinearLayout | 145 | android:gravity="center" |
144 | android:orientation="vertical" | 146 | android:layout_width="0dp" |
145 | android:gravity="center" | 147 | android:layout_height="match_parent" |
146 | android:layout_width="0dp" | 148 | android:layout_weight="1"> |
147 | android:layout_height="match_parent" | 149 | <LinearLayout |
148 | android:layout_weight="1"> | 150 | android:paddingEnd="20dp" |
151 | android:paddingStart="0px" | ||
149 | <LinearLayout | 152 | android:gravity="center_vertical" |
150 | android:paddingEnd="20dp" | 153 | android:layout_width="wrap_content" |
151 | android:paddingStart="0px" | 154 | android:layout_height="wrap_content"> |
152 | android:gravity="center_vertical" | 155 | <ImageView |
153 | android:layout_width="wrap_content" | 156 | android:src="@drawable/png_iv_subject" |
154 | android:layout_height="wrap_content"> | 157 | android:layout_marginEnd="5dp" |
155 | <ImageView | 158 | android:layout_width="16dp" |
156 | android:src="@drawable/png_iv_subject" | 159 | android:layout_height="14dp"/> |
157 | android:layout_marginEnd="5dp" | 160 | <TextView |
158 | android:layout_width="16dp" | 161 | android:text="学科" |
159 | android:layout_height="14dp"/> | 162 | android:textSize="12sp" |
160 | <TextView | 163 | android:textColor="#333" |
161 | android:text="学科" | 164 | android:textStyle="bold" |
162 | android:textSize="12sp" | 165 | android:layout_width="wrap_content" |
163 | android:textColor="#333" | 166 | android:layout_height="wrap_content"/> |
164 | android:textStyle="bold" | 167 | </LinearLayout> |
165 | android:layout_width="wrap_content" | 168 | <TextView |
166 | android:layout_height="wrap_content"/> | 169 | android:id="@+id/tvSubject" |
167 | </LinearLayout> | 170 | tools:text="数学" |
168 | <TextView | 171 | android:textSize="12sp" |
169 | android:id="@+id/tvSubject" | 172 | android:textColor="#489AFA" |
170 | tools:text="数学" | 173 | android:textStyle="bold" |
171 | android:textSize="12sp" | 174 | android:layout_marginTop="8dp" |
172 | android:textColor="#489AFA" | 175 | android:layout_width="wrap_content" |
173 | android:textStyle="bold" | 176 | android:layout_height="wrap_content"/> |
174 | android:layout_marginTop="8dp" | 177 | </LinearLayout> |
175 | android:layout_width="wrap_content" | 178 | <LinearLayout |
176 | android:layout_height="wrap_content"/> | 179 | android:orientation="vertical" |
177 | </LinearLayout> | 180 | android:gravity="center" |
178 | <LinearLayout | 181 | android:layout_width="0dp" |
179 | android:orientation="vertical" | 182 | android:layout_height="match_parent" |
180 | android:gravity="center" | 183 | android:layout_weight="1"> |
181 | android:layout_width="0dp" | 184 | <LinearLayout |
182 | android:layout_height="match_parent" | 185 | android:paddingEnd="20dp" |
186 | android:paddingStart="0px" | ||
183 | android:layout_weight="1"> | 187 | android:gravity="center_vertical" |
184 | <LinearLayout | 188 | android:layout_width="wrap_content" |
185 | android:paddingEnd="20dp" | 189 | android:layout_height="wrap_content"> |
186 | android:paddingStart="0px" | 190 | <ImageView |
187 | android:gravity="center_vertical" | 191 | android:src="@drawable/png_ic_during" |
188 | android:layout_width="wrap_content" | 192 | android:layout_marginEnd="5dp" |
189 | android:layout_height="wrap_content"> | 193 | android:layout_width="14dp" |
190 | <ImageView | 194 | android:layout_height="13dp"/> |
191 | android:src="@drawable/png_ic_during" | 195 | <TextView |
192 | android:layout_marginEnd="5dp" | 196 | android:text="周期" |
193 | android:layout_width="14dp" | 197 | android:textSize="12sp" |
194 | android:layout_height="13dp"/> | 198 | android:textColor="#333" |
195 | <TextView | 199 | android:textStyle="bold" |
196 | android:text="周期" | 200 | android:layout_width="wrap_content" |
197 | android:textSize="12sp" | 201 | android:layout_height="wrap_content"/> |
198 | android:textColor="#333" | 202 | </LinearLayout> |
199 | android:textStyle="bold" | 203 | <TextView |
200 | android:layout_width="wrap_content" | 204 | android:id="@+id/tvDate" |
201 | android:layout_height="wrap_content"/> | 205 | tools:text="2024.09.01" |
202 | </LinearLayout> | 206 | android:textSize="12sp" |
203 | <TextView | 207 | android:textColor="#489AFA" |
204 | android:id="@+id/tvDate" | 208 | android:textStyle="bold" |
205 | tools:text="2024.09.01" | 209 | android:layout_marginTop="8dp" |
206 | android:textSize="12sp" | 210 | android:layout_width="wrap_content" |
207 | android:textColor="#489AFA" | 211 | android:layout_height="wrap_content"/> |
208 | android:textStyle="bold" | 212 | </LinearLayout> |
209 | android:layout_marginTop="8dp" | 213 | </LinearLayout> |
210 | android:layout_width="wrap_content" | 214 | </LinearLayout> |
211 | android:layout_height="wrap_content"/> | 215 | |
212 | </LinearLayout> | 216 | <LinearLayout |
213 | </LinearLayout> | 217 | android:orientation="vertical" |
214 | </LinearLayout> | 218 | android:background="@drawable/shape_radius_10" |
215 | 219 | android:backgroundTint="@color/white" | |
216 | <LinearLayout | 220 | android:paddingHorizontal="16dp" |
217 | android:orientation="vertical" | 221 | android:paddingBottom="16dp" |
218 | android:background="@drawable/shape_radius_10" | 222 | android:layout_marginTop="12dp" |
219 | android:backgroundTint="@color/white" | 223 | android:layout_width="match_parent" |
220 | android:paddingHorizontal="16dp" | 224 | android:layout_height="wrap_content"> |
221 | android:paddingBottom="16dp" | 225 | <TextView |
222 | android:layout_marginTop="12dp" | 226 | android:text="作业总评" |
223 | android:layout_width="match_parent" | 227 | android:textSize="16sp" |
224 | android:layout_height="wrap_content"> | 228 | android:textStyle="bold" |
225 | <TextView | 229 | android:textColor="#333" |
226 | android:text="作业总评" | 230 | android:paddingStart="24dp" |
227 | android:textSize="16sp" | 231 | android:paddingEnd="4dp" |
228 | android:textStyle="bold" | 232 | android:paddingTop="4dp" |
229 | android:textColor="#333" | 233 | android:background="@drawable/bg_homework_eval" |
230 | android:paddingStart="24dp" | 234 | android:layout_gravity="center_horizontal" |
231 | android:paddingEnd="4dp" | 235 | android:layout_marginTop="12dp" |
232 | android:paddingTop="4dp" | 236 | android:layout_width="wrap_content" |
233 | android:background="@drawable/bg_homework_eval" | 237 | android:layout_height="wrap_content"/> |
234 | android:layout_gravity="center_horizontal" | 238 | |
235 | android:layout_marginTop="12dp" | 239 | <LinearLayout |
236 | android:layout_width="wrap_content" | 240 | android:orientation="horizontal" |
237 | android:layout_height="wrap_content"/> | 241 | android:background="@drawable/shape_radius_5" |
238 | 242 | android:backgroundTint="#F4FAFF" | |
239 | <LinearLayout | 243 | android:layout_width="match_parent" |
240 | android:orientation="horizontal" | 244 | android:layout_height="80dp" |
241 | android:background="@drawable/shape_radius_5" | 245 | android:layout_marginTop="12dp"> |
242 | android:backgroundTint="#F4FAFF" | 246 | <LinearLayout |
243 | android:layout_width="match_parent" | 247 | android:orientation="vertical" |
244 | android:layout_height="80dp" | 248 | android:gravity="center" |
245 | android:layout_marginTop="12dp"> | 249 | android:layout_width="0dp" |
246 | <LinearLayout | 250 | android:layout_height="match_parent" |
247 | android:orientation="vertical" | 251 | android:layout_weight="1"> |
248 | android:gravity="center" | 252 | <LinearLayout |
249 | android:layout_width="0dp" | 253 | android:orientation="horizontal" |
250 | android:layout_height="match_parent" | 254 | android:gravity="center_vertical" |
251 | android:layout_weight="1"> | 255 | android:layout_width="wrap_content" |
252 | <LinearLayout | 256 | android:layout_height="wrap_content"> |
253 | android:orientation="horizontal" | 257 | <ImageView |
254 | android:gravity="center_vertical" | 258 | android:src="@drawable/png_icon_statistical_accuracy" |
255 | android:layout_width="wrap_content" | 259 | android:layout_width="12dp" |
256 | android:layout_height="wrap_content"> | 260 | android:layout_height="13dp"/> |
257 | <ImageView | 261 | <TextView |
258 | android:src="@drawable/png_icon_statistical_accuracy" | 262 | android:text="作业正确率" |
259 | android:layout_width="12dp" | 263 | android:textSize="11sp" |
260 | android:layout_height="13dp"/> | 264 | android:textColor="#333" |
261 | <TextView | 265 | android:textStyle="bold" |
262 | android:text="作业正确率" | 266 | android:layout_marginStart="5dp" |
263 | android:textSize="11sp" | 267 | android:layout_width="wrap_content" |
264 | android:textColor="#333" | 268 | android:layout_height="wrap_content"/> |
265 | android:textStyle="bold" | 269 | </LinearLayout> |
266 | android:layout_marginStart="5dp" | 270 | <LinearLayout |
267 | android:layout_width="wrap_content" | 271 | android:orientation="horizontal" |
268 | android:layout_height="wrap_content"/> | 272 | android:layout_marginTop="8dp" |
269 | </LinearLayout> | 273 | android:layout_width="wrap_content" |
270 | <LinearLayout | 274 | android:layout_height="wrap_content"> |
271 | android:orientation="horizontal" | 275 | <TextView |
272 | android:layout_marginTop="8dp" | 276 | android:id="@+id/tvPercent" |
273 | android:layout_width="wrap_content" | 277 | tools:text="88" |
274 | android:layout_height="wrap_content"> | 278 | android:textSize="14sp" |
275 | <TextView | 279 | android:textColor="#489AFA" |
276 | android:id="@+id/tvPercent" | 280 | android:textStyle="bold" |
277 | tools:text="88" | 281 | android:layout_width="wrap_content" |
278 | android:textSize="14sp" | 282 | android:layout_height="wrap_content"/> |
279 | android:textColor="#489AFA" | 283 | <TextView |
280 | android:textStyle="bold" | 284 | android:text="%" |
281 | android:layout_width="wrap_content" | 285 | android:textSize="9sp" |
282 | android:layout_height="wrap_content"/> | 286 | android:textColor="#489AFA" |
283 | <TextView | 287 | android:textStyle="bold" |
284 | android:text="%" | 288 | android:layout_width="wrap_content" |
285 | android:textSize="9sp" | 289 | android:layout_height="wrap_content"/> |
286 | android:textColor="#489AFA" | 290 | </LinearLayout> |
287 | android:textStyle="bold" | 291 | </LinearLayout> |
288 | android:layout_width="wrap_content" | 292 | <LinearLayout |
289 | android:layout_height="wrap_content"/> | 293 | android:orientation="vertical" |
290 | </LinearLayout> | 294 | android:gravity="center" |
291 | </LinearLayout> | 295 | android:layout_width="0dp" |
292 | <LinearLayout | 296 | android:layout_height="match_parent" |
293 | android:orientation="vertical" | 297 | android:layout_weight="1"> |
294 | android:gravity="center" | 298 | <LinearLayout |
295 | android:layout_width="0dp" | 299 | android:orientation="horizontal" |
296 | android:layout_height="match_parent" | 300 | android:gravity="center_vertical" |
297 | android:layout_weight="1"> | 301 | android:layout_width="wrap_content" |
298 | <LinearLayout | 302 | android:layout_height="wrap_content"> |
299 | android:orientation="horizontal" | 303 | <ImageView |
300 | android:gravity="center_vertical" | 304 | android:src="@drawable/png_icon_statistical_accuracy" |
301 | android:layout_width="wrap_content" | 305 | android:layout_width="12dp" |
302 | android:layout_height="wrap_content"> | 306 | android:layout_height="13dp"/> |
303 | <ImageView | 307 | <TextView |
304 | android:src="@drawable/png_icon_statistical_accuracy" | 308 | android:text="答对题数" |
305 | android:layout_width="12dp" | 309 | android:textSize="11sp" |
306 | android:layout_height="13dp"/> | 310 | android:textColor="#333" |
307 | <TextView | 311 | android:textStyle="bold" |
308 | android:text="答对题数" | 312 | android:layout_marginStart="5dp" |
309 | android:textSize="11sp" | 313 | android:layout_width="wrap_content" |
310 | android:textColor="#333" | 314 | android:layout_height="wrap_content"/> |
311 | android:textStyle="bold" | 315 | </LinearLayout> |
312 | android:layout_marginStart="5dp" | 316 | <LinearLayout |
313 | android:layout_width="wrap_content" | 317 | android:orientation="horizontal" |
314 | android:layout_height="wrap_content"/> | 318 | android:layout_marginTop="8dp" |
315 | </LinearLayout> | 319 | android:layout_width="wrap_content" |
316 | <LinearLayout | 320 | android:layout_height="wrap_content"> |
317 | android:orientation="horizontal" | 321 | <TextView |
318 | android:layout_marginTop="8dp" | 322 | android:id="@+id/tvCorrect" |
319 | android:layout_width="wrap_content" | 323 | tools:text="88" |
320 | android:layout_height="wrap_content"> | 324 | android:textSize="14sp" |
321 | <TextView | 325 | android:textColor="#489AFA" |
322 | android:id="@+id/tvCorrect" | 326 | android:textStyle="bold" |
323 | tools:text="88" | 327 | android:layout_width="wrap_content" |
324 | android:textSize="14sp" | 328 | android:layout_height="wrap_content"/> |
325 | android:textColor="#489AFA" | 329 | <TextView |
326 | android:textStyle="bold" | 330 | android:text="道" |
327 | android:layout_width="wrap_content" | 331 | android:textSize="9sp" |
328 | android:layout_height="wrap_content"/> | 332 | android:textColor="#489AFA" |
329 | <TextView | 333 | android:textStyle="bold" |
330 | android:text="道" | 334 | android:layout_width="wrap_content" |
331 | android:textSize="9sp" | 335 | android:layout_height="wrap_content"/> |
332 | android:textColor="#489AFA" | 336 | </LinearLayout> |
333 | android:textStyle="bold" | 337 | </LinearLayout> |
334 | android:layout_width="wrap_content" | 338 | <LinearLayout |
335 | android:layout_height="wrap_content"/> | 339 | android:orientation="vertical" |
336 | </LinearLayout> | 340 | android:gravity="center" |
337 | </LinearLayout> | 341 | android:layout_width="0dp" |
338 | <LinearLayout | 342 | android:layout_height="match_parent" |
339 | android:orientation="vertical" | 343 | android:layout_weight="1"> |
340 | android:gravity="center" | 344 | <LinearLayout |
341 | android:layout_width="0dp" | 345 | android:orientation="horizontal" |
342 | android:layout_height="match_parent" | 346 | android:gravity="center_vertical" |
343 | android:layout_weight="1"> | 347 | android:layout_width="wrap_content" |
344 | <LinearLayout | 348 | android:layout_height="wrap_content"> |
345 | android:orientation="horizontal" | 349 | <ImageView |
346 | android:gravity="center_vertical" | 350 | android:src="@drawable/png_icon_statistical_accuracy" |
347 | android:layout_width="wrap_content" | 351 | android:layout_width="12dp" |
348 | android:layout_height="wrap_content"> | 352 | android:layout_height="13dp"/> |
349 | <ImageView | 353 | <TextView |
350 | android:src="@drawable/png_icon_statistical_accuracy" | 354 | android:text="答错题数" |
351 | android:layout_width="12dp" | 355 | android:textSize="11sp" |
352 | android:layout_height="13dp"/> | 356 | android:textColor="#333" |
353 | <TextView | 357 | android:textStyle="bold" |
354 | android:text="答错题数" | 358 | android:layout_marginStart="5dp" |
355 | android:textSize="11sp" | 359 | android:layout_width="wrap_content" |
356 | android:textColor="#333" | 360 | android:layout_height="wrap_content"/> |
357 | android:textStyle="bold" | 361 | </LinearLayout> |
358 | android:layout_marginStart="5dp" | 362 | <LinearLayout |
359 | android:layout_width="wrap_content" | 363 | android:orientation="horizontal" |
360 | android:layout_height="wrap_content"/> | 364 | android:layout_marginTop="8dp" |
361 | </LinearLayout> | 365 | android:layout_width="wrap_content" |
362 | <LinearLayout | 366 | android:layout_height="wrap_content"> |
363 | android:orientation="horizontal" | 367 | <TextView |
364 | android:layout_marginTop="8dp" | 368 | android:id="@+id/tvWrong" |
365 | android:layout_width="wrap_content" | 369 | tools:text="88" |
366 | android:layout_height="wrap_content"> | 370 | android:textSize="14sp" |
367 | <TextView | 371 | android:textColor="#489AFA" |
368 | android:id="@+id/tvWrong" | 372 | android:textStyle="bold" |
369 | tools:text="88" | 373 | android:layout_width="wrap_content" |
370 | android:textSize="14sp" | 374 | android:layout_height="wrap_content"/> |
371 | android:textColor="#489AFA" | 375 | <TextView |
372 | android:textStyle="bold" | 376 | android:text="道" |
373 | android:layout_width="wrap_content" | 377 | android:textSize="9sp" |
374 | android:layout_height="wrap_content"/> | 378 | android:textColor="#489AFA" |
375 | <TextView | 379 | android:textStyle="bold" |
376 | android:text="道" | 380 | android:layout_width="wrap_content" |
377 | android:textSize="9sp" | 381 | android:layout_height="wrap_content"/> |
378 | android:textColor="#489AFA" | 382 | </LinearLayout> |
379 | android:textStyle="bold" | 383 | </LinearLayout> |
384 | <LinearLayout | ||
385 | android:orientation="vertical" | ||
386 | android:gravity="center" | ||
387 | android:layout_width="0dp" | ||
388 | android:layout_height="match_parent" | ||
389 | android:layout_weight="1"> | ||
390 | <LinearLayout | ||
391 | android:orientation="horizontal" | ||
392 | android:gravity="center_vertical" | ||
393 | android:layout_width="wrap_content" | ||
394 | android:layout_height="wrap_content"> | ||
395 | <ImageView | ||
396 | android:src="@drawable/png_icon_statistical_accuracy" | ||
397 | android:layout_width="12dp" | ||
398 | android:layout_height="13dp"/> | ||
399 | <TextView | ||
400 | android:text="未做题数" | ||
401 | android:textSize="11sp" | ||
402 | android:textColor="#333" | ||
403 | android:textStyle="bold" | ||
404 | android:layout_marginStart="5dp" | ||
405 | android:layout_width="wrap_content" | ||
406 | android:layout_height="wrap_content"/> | ||
407 | </LinearLayout> | ||
408 | <LinearLayout | ||
409 | android:orientation="horizontal" | ||
410 | android:layout_marginTop="8dp" | ||
411 | android:layout_width="wrap_content" | ||
412 | android:layout_height="wrap_content"> | ||
413 | <TextView | ||
414 | android:id="@+id/tvBlank" | ||
415 | tools:text="88" | ||
416 | android:textSize="14sp" | ||
417 | android:textColor="#489AFA" | ||
418 | android:textStyle="bold" | ||
419 | android:layout_width="wrap_content" | ||
420 | android:layout_height="wrap_content"/> | ||
421 | <TextView | ||
422 | android:text="道" | ||
423 | android:textSize="9sp" | ||
424 | android:textColor="#489AFA" | ||
425 | android:textStyle="bold" | ||
426 | android:layout_width="wrap_content" | ||
427 | android:layout_height="wrap_content" /> | ||
428 | </LinearLayout> | ||
429 | </LinearLayout> | ||
380 | android:layout_width="wrap_content" | 430 | </LinearLayout> |
381 | android:layout_height="wrap_content"/> | 431 | <TextView |
382 | </LinearLayout> | 432 | android:id="@+id/tvRating" |
383 | </LinearLayout> | 433 | android:text="-" |
384 | <LinearLayout | 434 | android:textSize="12sp" |
385 | android:orientation="vertical" | 435 | android:textColor="#333" |
386 | android:gravity="center" | 436 | android:lineSpacingMultiplier="1.3" |
387 | android:layout_width="0dp" | 437 | android:layout_width="match_parent" |
388 | android:layout_height="match_parent" | 438 | android:layout_height="wrap_content" |
389 | android:layout_weight="1"> | 439 | android:layout_marginTop="16dp"/> |
390 | <LinearLayout | 440 | </LinearLayout> |
391 | android:orientation="horizontal" | 441 | |
392 | android:gravity="center_vertical" | 442 | <LinearLayout |
393 | android:layout_width="wrap_content" | 443 | android:orientation="vertical" |
394 | android:layout_height="wrap_content"> | 444 | android:background="@drawable/shape_radius_10" |
395 | <ImageView | 445 | android:backgroundTint="@color/white" |
396 | android:src="@drawable/png_icon_statistical_accuracy" | 446 | android:paddingHorizontal="16dp" |
397 | android:layout_width="12dp" | 447 | android:paddingBottom="16dp" |
398 | android:layout_height="13dp"/> | 448 | android:layout_marginTop="12dp" |
399 | <TextView | 449 | android:layout_width="match_parent" |
400 | android:text="未做题数" | 450 | android:layout_height="wrap_content"> |
401 | android:textSize="11sp" | 451 | |
402 | android:textColor="#333" | 452 | <TextView |
403 | android:textStyle="bold" | 453 | android:text="作业错题" |
404 | android:layout_marginStart="5dp" | 454 | android:textSize="16sp" |
405 | android:layout_width="wrap_content" | 455 | android:textStyle="bold" |
406 | android:layout_height="wrap_content"/> | 456 | android:textColor="#333" |
407 | </LinearLayout> | 457 | android:paddingStart="24dp" |
408 | <LinearLayout | 458 | android:paddingEnd="4dp" |
409 | android:orientation="horizontal" | 459 | android:paddingTop="4dp" |
410 | android:layout_marginTop="8dp" | 460 | android:background="@drawable/bg_homework_error" |
411 | android:layout_width="wrap_content" | 461 | android:layout_gravity="center_horizontal" |
412 | android:layout_height="wrap_content"> | 462 | android:layout_marginTop="12dp" |
413 | <TextView | 463 | android:layout_width="wrap_content" |
414 | android:id="@+id/tvBlank" | 464 | android:layout_height="wrap_content"/> |
415 | tools:text="88" | 465 | |
416 | android:textSize="14sp" | 466 | <androidx.recyclerview.widget.RecyclerView |
417 | android:textColor="#489AFA" | 467 | android:id="@+id/rvWrong" |
418 | android:textStyle="bold" | 468 | android:orientation="vertical" |
419 | android:layout_width="wrap_content" | 469 | app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" |
420 | android:layout_height="wrap_content"/> | 470 | android:layout_marginTop="12dp" |
421 | <TextView | 471 | tools:listitem="@layout/item_homework_error" |
422 | android:text="道" | 472 | tools:itemCount="1" |
423 | android:textSize="9sp" | 473 | android:layout_width="match_parent" |
424 | android:textColor="#489AFA" | 474 | android:layout_height="wrap_content"/> |
425 | android:textStyle="bold" | 475 | |
426 | android:layout_width="wrap_content" | 476 | </LinearLayout> |
427 | android:layout_height="wrap_content" /> | 477 | |
428 | </LinearLayout> | 478 | <LinearLayout |
479 | android:id="@+id/viewBlank" | ||
480 | android:orientation="vertical" | ||
481 | android:background="@drawable/shape_radius_10" | ||
482 | android:backgroundTint="@color/white" | ||
483 | android:paddingHorizontal="16dp" | ||
484 | android:paddingBottom="16dp" | ||
485 | android:layout_marginTop="12dp" | ||
486 | android:layout_width="match_parent" | ||
487 | android:layout_height="wrap_content"> | ||
488 | <TextView | ||
489 | android:text="未做题目" | ||
490 | android:textSize="16sp" | ||
491 | android:textStyle="bold" | ||
492 | android:textColor="#333" | ||
493 | android:paddingStart="24dp" | ||
494 | android:paddingEnd="4dp" | ||
495 | android:paddingTop="4dp" | ||
496 | android:background="@drawable/bg_homework_error" | ||
497 | android:layout_gravity="center_horizontal" | ||
498 | android:layout_marginTop="12dp" | ||
499 | android:layout_width="wrap_content" | ||
500 | android:layout_height="wrap_content"/> | ||
501 | |||
502 | <androidx.recyclerview.widget.RecyclerView | ||
503 | android:id="@+id/rvBlank" | ||
504 | android:orientation="vertical" | ||
505 | app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | ||
506 | android:layout_marginTop="12dp" | ||
507 | android:layout_width="match_parent" | ||
508 | android:layout_height="wrap_content"/> | ||
509 | </LinearLayout> | ||
510 | |||
511 | <LinearLayout | ||
429 | </LinearLayout> | 512 | android:id="@+id/flComment" |
430 | </LinearLayout> | 513 | android:orientation="vertical" |
431 | <TextView | 514 | android:background="@drawable/shape_radius_10" |
432 | android:id="@+id/tvRating" | 515 | android:backgroundTint="@color/white" |
433 | android:text="-" | 516 | android:layout_marginTop="12dp" |
434 | android:textSize="12sp" | 517 | android:layout_width="match_parent" |
435 | android:textColor="#333" | 518 | android:layout_height="wrap_content"> |
436 | android:lineSpacingMultiplier="1.3" | 519 | |
437 | android:layout_width="match_parent" | 520 | <TextView |
438 | android:layout_height="wrap_content" | 521 | android:text="教师评语" |
439 | android:layout_marginTop="16dp"/> | 522 | android:textSize="16sp" |
440 | </LinearLayout> | 523 | android:textStyle="bold" |
441 | 524 | android:textColor="#333" | |
442 | <LinearLayout | 525 | android:paddingStart="24dp" |
443 | android:orientation="vertical" | 526 | android:paddingEnd="4dp" |
444 | android:background="@drawable/shape_radius_10" | 527 | android:paddingTop="4dp" |
445 | android:backgroundTint="@color/white" | 528 | android:background="@drawable/bg_homework_comment" |
446 | android:paddingHorizontal="16dp" | 529 | android:layout_gravity="center_horizontal" |
447 | android:paddingBottom="16dp" | 530 | android:layout_width="wrap_content" |
448 | android:layout_marginTop="12dp" | 531 | android:layout_height="wrap_content" |
449 | android:layout_width="match_parent" | 532 | android:layout_marginTop="12dp"/> |
450 | android:layout_height="wrap_content"> | 533 | |
451 | 534 | <TextView | |
452 | <TextView | 535 | android:id="@+id/tvComment" |
453 | android:text="作业错题" | 536 | android:text="-" |
454 | android:textSize="16sp" | 537 | android:textSize="12sp" |
455 | android:textStyle="bold" | 538 | android:textColor="#333" |
456 | android:textColor="#333" | 539 | android:lineSpacingMultiplier="1.3" |
457 | android:paddingStart="24dp" | 540 | android:layout_marginHorizontal="16dp" |
458 | android:paddingEnd="4dp" | 541 | android:layout_marginTop="12dp" |
459 | android:paddingTop="4dp" | 542 | android:layout_marginBottom="16dp" |
460 | android:background="@drawable/bg_homework_error" | 543 | android:layout_width="match_parent" |
461 | android:layout_gravity="center_horizontal" | 544 | android:layout_height="wrap_content"/> |
462 | android:layout_marginTop="12dp" | 545 | |
463 | android:layout_width="wrap_content" | 546 | </LinearLayout> |
464 | android:layout_height="wrap_content"/> | 547 | </LinearLayout> |
465 | 548 | </androidx.core.widget.NestedScrollView> | |
466 | <androidx.recyclerview.widget.RecyclerView | 549 | |
467 | android:id="@+id/rvWrong" | 550 | </LinearLayout> |
app/src/main/res/layout/item_huyou_daily_blank.xml
File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | xmlns:tools="http://schemas.android.com/tools" | ||
5 | android:orientation="vertical" | ||
6 | android:background="@drawable/bg_feedback_blank" | ||
7 | android:layout_width="match_parent" | ||
8 | android:layout_height="wrap_content" | ||
9 | tools:ignore="UseCompoundDrawables,HardcodedText,SmallSp,ContentDescription"> | ||
10 | |||
11 | <ImageView | ||
12 | android:id="@+id/imageView" | ||
13 | android:adjustViewBounds="true" | ||
14 | android:layout_margin="10dp" | ||
15 | android:layout_width="match_parent" | ||
16 | android:layout_height="wrap_content"/> | ||
17 | |||
18 | </LinearLayout> |