Commit e5e787dc57b2b566c01b9909a8420f544106ce28
1 parent
7083c3e3a1
Exists in
master
文案修改
Showing
3 changed files
with
22 additions
and
4 deletions
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/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> |