Commit f4ff510176417f82b62e030854574f24d9db72b4
1 parent
15afa0c196
Exists in
master
文案修改. 版本发布
Showing
2 changed files
with
6 additions
and
6 deletions
Show diff stats
app/build.gradle
1 | apply plugin: 'com.android.application' | 1 | apply plugin: 'com.android.application' |
2 | 2 | ||
3 | 3 | ||
4 | def androidId = rootProject.ext.androidId | 4 | def androidId = rootProject.ext.androidId |
5 | def support = rootProject.ext.dependencies | 5 | def support = rootProject.ext.dependencies |
6 | def url = rootProject.ext.url | 6 | def url = rootProject.ext.url |
7 | 7 | ||
8 | 8 | ||
9 | android { | 9 | android { |
10 | signingConfigs { | 10 | signingConfigs { |
11 | 11 | ||
12 | config { | 12 | config { |
13 | keyAlias 'alias' | 13 | keyAlias 'alias' |
14 | keyPassword '123456' | 14 | keyPassword '123456' |
15 | storeFile file('key.jks') | 15 | storeFile file('key.jks') |
16 | storePassword '123456' | 16 | storePassword '123456' |
17 | } | 17 | } |
18 | debug { | 18 | debug { |
19 | } | 19 | } |
20 | } | 20 | } |
21 | compileSdk 32 | 21 | compileSdk 32 |
22 | 22 | ||
23 | defaultConfig { | 23 | defaultConfig { |
24 | applicationId "com.hjx.parent" | 24 | applicationId "com.hjx.parent" |
25 | minSdk 26 | 25 | minSdk 26 |
26 | targetSdk 32 | 26 | targetSdk 32 |
27 | versionCode 1011 | 27 | versionCode 1012 |
28 | versionName "1.0.11" | 28 | versionName "1.0.12" |
29 | 29 | ||
30 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | 30 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
31 | } | 31 | } |
32 | 32 | ||
33 | android.applicationVariants.all { | 33 | android.applicationVariants.all { |
34 | variant -> | 34 | variant -> |
35 | variant.outputs.all { | 35 | variant.outputs.all { |
36 | //在这里修改apk文件名 | 36 | //在这里修改apk文件名 |
37 | outputFileName = "parent-${variant.name}-v${variant.versionName}.apk" | 37 | outputFileName = "parent-${variant.name}-v${variant.versionName}.apk" |
38 | } | 38 | } |
39 | } | 39 | } |
40 | buildTypes { | 40 | buildTypes { |
41 | debug { | 41 | debug { |
42 | debuggable true | 42 | debuggable true |
43 | minifyEnabled false | 43 | minifyEnabled false |
44 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | 44 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
45 | signingConfig signingConfigs.config | 45 | signingConfig signingConfigs.config |
46 | } | 46 | } |
47 | release { | 47 | release { |
48 | debuggable true | 48 | debuggable true |
49 | minifyEnabled false | 49 | minifyEnabled false |
50 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | 50 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
51 | signingConfig signingConfigs.config | 51 | signingConfig signingConfigs.config |
52 | } | 52 | } |
53 | } | 53 | } |
54 | lintOptions { | 54 | lintOptions { |
55 | checkReleaseBuilds false | 55 | checkReleaseBuilds false |
56 | abortOnError false | 56 | abortOnError false |
57 | } | 57 | } |
58 | buildFeatures { | 58 | buildFeatures { |
59 | viewBinding true | 59 | viewBinding true |
60 | dataBinding true | 60 | dataBinding true |
61 | } | 61 | } |
62 | compileOptions { | 62 | compileOptions { |
63 | sourceCompatibility JavaVersion.VERSION_1_8 | 63 | sourceCompatibility JavaVersion.VERSION_1_8 |
64 | targetCompatibility JavaVersion.VERSION_1_8 | 64 | targetCompatibility JavaVersion.VERSION_1_8 |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | dependencies { | 68 | dependencies { |
69 | support.each { k, v -> implementation v } | 69 | support.each { k, v -> implementation v } |
70 | api project(path: ':libs:common') | 70 | api project(path: ':libs:common') |
71 | implementation 'androidx.appcompat:appcompat:1.5.1' | 71 | implementation 'androidx.appcompat:appcompat:1.5.1' |
72 | implementation 'com.google.android.material:material:1.6.1' | 72 | implementation 'com.google.android.material:material:1.6.1' |
73 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4' | 73 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4' |
74 | implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.50' | 74 | implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.50' |
75 | implementation 'com.github.ForgetAll:LoadingDialog:1.1.2' | 75 | implementation 'com.github.ForgetAll:LoadingDialog:1.1.2' |
76 | implementation 'com.github.DL-ZhangTeng:ImagePicker:1.5.0' | 76 | implementation 'com.github.DL-ZhangTeng:ImagePicker:1.5.0' |
77 | //使用的三方 | 77 | //使用的三方 |
78 | implementation 'com.yalantis:ucrop:2.2.0' | 78 | implementation 'com.yalantis:ucrop:2.2.0' |
79 | implementation 'com.github.DL-ZhangTeng:RequestPermission:1.3.0' | 79 | implementation 'com.github.DL-ZhangTeng:RequestPermission:1.3.0' |
80 | implementation 'com.github.DL-ZhangTeng:Utils:2.2.0' | 80 | implementation 'com.github.DL-ZhangTeng:Utils:2.2.0' |
81 | 81 | ||
82 | // rx | 82 | // rx |
83 | implementation("com.trello.rxlifecycle2:rxlifecycle:2.2.2") | 83 | implementation("com.trello.rxlifecycle2:rxlifecycle:2.2.2") |
84 | implementation("com.trello.rxlifecycle2:rxlifecycle-android:2.2.2") | 84 | implementation("com.trello.rxlifecycle2:rxlifecycle-android:2.2.2") |
85 | 85 | ||
86 | implementation("com.github.PhilJay:MPAndroidChart:v3.1.0") | 86 | implementation("com.github.PhilJay:MPAndroidChart:v3.1.0") |
87 | implementation("com.contrarywind:Android-PickerView:4.1.9") | 87 | implementation("com.contrarywind:Android-PickerView:4.1.9") |
88 | 88 | ||
89 | implementation 'com.google.android:flexbox:1.0.0' | 89 | implementation 'com.google.android:flexbox:1.0.0' |
90 | 90 | ||
91 | // 沉浸式状态栏和他的Kotlin拓展 | 91 | // 沉浸式状态栏和他的Kotlin拓展 |
92 | implementation 'com.geyifeng.immersionbar:immersionbar:3.2.2' | 92 | implementation 'com.geyifeng.immersionbar:immersionbar:3.2.2' |
93 | implementation 'com.geyifeng.immersionbar:immersionbar-ktx:3.2.2' | 93 | implementation 'com.geyifeng.immersionbar:immersionbar-ktx:3.2.2' |
94 | 94 | ||
95 | // 图片查看 | 95 | // 图片查看 |
96 | implementation 'com.github.chrisbanes:PhotoView:2.0.0' | 96 | implementation 'com.github.chrisbanes:PhotoView:2.0.0' |
97 | 97 | ||
98 | implementation 'com.jakewharton:butterknife:10.2.3' | 98 | implementation 'com.jakewharton:butterknife:10.2.3' |
99 | annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3' | 99 | annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3' |
100 | } | 100 | } |
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 | if (type == 0) { | 179 | if (type == 0) { |
180 | for (StDetail.Point point: data.points) { | 180 | for (StDetail.Point point: data.points) { |
181 | total += point.beforeState; | 181 | total += point.beforeState; |
182 | if (point.beforeState >= 0.9) { | 182 | if (point.beforeState >= 0.9) { |
183 | exNo ++; | 183 | exNo ++; |
184 | } else if (point.beforeState >= 0.8) { | 184 | } else if (point.beforeState >= 0.8) { |
185 | goodNo ++; | 185 | goodNo ++; |
186 | } else if (point.beforeState >= 0.6) { | 186 | } else if (point.beforeState >= 0.6) { |
187 | normalNo ++; | 187 | normalNo ++; |
188 | } else { | 188 | } else { |
189 | weakNo ++; | 189 | weakNo ++; |
190 | } | 190 | } |
191 | } | 191 | } |
192 | } else { | 192 | } else { |
193 | for (StDetail.Point point: data.points) { | 193 | for (StDetail.Point point: data.points) { |
194 | total += point.afterState; | 194 | total += point.afterState; |
195 | if (point.afterState >= 0.9) { | 195 | if (point.afterState >= 0.9) { |
196 | exNo ++; | 196 | exNo ++; |
197 | } else if (point.afterState >= 0.8) { | 197 | } else if (point.afterState >= 0.8) { |
198 | goodNo ++; | 198 | goodNo ++; |
199 | } else if (point.afterState >= 0.6) { | 199 | } else if (point.afterState >= 0.6) { |
200 | normalNo ++; | 200 | normalNo ++; |
201 | } else { | 201 | } else { |
202 | weakNo ++; | 202 | weakNo ++; |
203 | } | 203 | } |
204 | } | 204 | } |
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | float rate = 100f * data.correct / Math.max(data.total - data.unfinished, 1); | 208 | float rate = 100f * data.correct / Math.max(data.total - data.unfinished, 1); |
209 | binding.tvTotalRate.setText(new DecimalFormat("0").format(rate)); | 209 | binding.tvTotalRate.setText(new DecimalFormat("0").format(rate)); |
210 | binding.tvTotalCorrect.setText(String.valueOf(data.correct)); | 210 | binding.tvTotalCorrect.setText(String.valueOf(data.correct)); |
211 | binding.tvTotalError.setText(String.valueOf(data.total - data.correct - data.unfinished)); | 211 | binding.tvTotalError.setText(String.valueOf(data.total - data.correct - data.unfinished)); |
212 | binding.tvTotalBlank.setText(String.valueOf(data.unfinished)); | 212 | binding.tvTotalBlank.setText(String.valueOf(data.unfinished)); |
213 | if (data.total == 0) { | 213 | if (data.total == 0) { |
214 | binding.tvRating.setText(""); | 214 | binding.tvRating.setText(""); |
215 | } else { | 215 | } else { |
216 | String rateComment; | 216 | String rateComment; |
217 | String encComment; | 217 | String encComment; |
218 | if (rate >= 90) { | 218 | if (rate >= 90) { |
219 | rateComment = "知识点掌握得比较优秀,多练习多巩固掌握一般的知识点会有很大帮助。"; | 219 | rateComment = "知识点掌握得比较优秀,多练习多巩固掌握一般的知识点会有很大帮助。"; |
220 | encComment = "在未来的学习中,请保持这份优秀,继续挑战更难的题目,勇攀高峰"; | 220 | encComment = "在未来的学习中,请保持这份优秀,继续挑战更难的题目,勇攀高峰!"; |
221 | } else if (rate >= 80) { | 221 | } else if (rate >= 80) { |
222 | rateComment = "知识点掌握程度有进步,还要再继续学习,多练习,不断巩固。"; | 222 | rateComment = "知识点掌握程度有进步,还要再继续学习,多练习,不断巩固。"; |
223 | encComment = "在未来的学习中,请保持这份优秀,继续挑战更难的题目,勇攀高峰"; | 223 | encComment = "在未来的学习中,请保持这份优秀,继续挑战更难的题目,勇攀高峰!"; |
224 | } else if (rate >= 60) { | 224 | } else if (rate >= 60) { |
225 | rateComment = "薄弱知识点还有进步空间,再多做一些类似题目来巩固知识点,继续努力。"; | 225 | rateComment = "薄弱知识点还有进步空间,再多做一些类似题目来巩固知识点,继续努力。"; |
226 | encComment = "在未来的学习中,请不要灰心,继续努力"; | 226 | encComment = "在未来的学习中,请不要灰心,继续努力!"; |
227 | } else { | 227 | } else { |
228 | rateComment = "你的薄弱知识点还需要再深入了解,有不清楚的地方及时问老师,继续加油。"; | 228 | rateComment = "你的薄弱知识点还需要再深入了解,有不清楚的地方及时问老师,继续加油。"; |
229 | encComment = "在未来的学习中,请不要灰心,继续努力"; | 229 | encComment = "在未来的学习中,请不要灰心,继续努力!"; |
230 | } | 230 | } |
231 | 231 | ||
232 | String correctNumHt = fromColor(String.valueOf(data.correct), "#3BC3B6"); | 232 | String correctNumHt = fromColor(String.valueOf(data.correct), "#3BC3B6"); |
233 | String errNumHt = fromColor(String.valueOf(data.total - data.correct - data.unfinished), "#3BC3B6"); | 233 | String errNumHt = fromColor(String.valueOf(data.total - data.correct - data.unfinished), "#3BC3B6"); |
234 | StringBuilder pointComment = new StringBuilder("其中,答对题目 ") | 234 | StringBuilder pointComment = new StringBuilder("其中,答对题目 ") |
235 | .append(correctNumHt).append(" 个,答错题目 ") | 235 | .append(correctNumHt).append(" 个,答错题目 ") |
236 | .append(errNumHt).append(" 个"); | 236 | .append(errNumHt).append(" 个"); |
237 | if (exNo > 0) { | 237 | if (exNo > 0) { |
238 | String ht = fromColor(String.valueOf(exNo), "#3BC3B6"); | 238 | String ht = fromColor(String.valueOf(exNo), "#3BC3B6"); |
239 | pointComment.append(",").append(ht).append(" 个知识点非常棒"); | 239 | pointComment.append(",").append(ht).append(" 个知识点非常棒"); |
240 | } | 240 | } |
241 | if (weakNo > 0) { | 241 | if (weakNo > 0) { |
242 | String ht = fromColor(String.valueOf(weakNo), "#3BC3B6"); | 242 | String ht = fromColor(String.valueOf(weakNo), "#3BC3B6"); |
243 | pointComment.append(",").append(ht).append(" 个知识点还需努力,这部分还要再加强学习"); | 243 | pointComment.append(",").append(ht).append(" 个知识点还需努力,这部分还要再加强学习"); |
244 | } | 244 | } |
245 | pointComment.append("。"); | 245 | pointComment.append("。"); |
246 | String rateStr = new DecimalFormat("0%").format(rate / 100f); | 246 | String rateStr = new DecimalFormat("0%").format(rate / 100f); |
247 | String temp; | 247 | String temp; |
248 | if (type == 0) { | 248 | if (type == 0) { |
249 | temp = indent + "在本周作业中,你的综合正确率是 %s," + pointComment + rateComment + encComment; | 249 | temp = indent + "在本周作业中,你的综合正确率是 %s," + pointComment + rateComment + encComment; |
250 | } else { | 250 | } else { |
251 | temp = indent + "在本阶段作业中,你的综合正确率是 %s," + pointComment + rateComment + encComment; | 251 | temp = indent + "在本阶段作业中,你的综合正确率是 %s," + pointComment + rateComment + encComment; |
252 | } | 252 | } |
253 | temp = String.format(temp, fromColor(rateStr, "#3BC3B6")); | 253 | temp = String.format(temp, fromColor(rateStr, "#3BC3B6")); |
254 | binding.tvRating.setText(Html.fromHtml(temp, Html.FROM_HTML_MODE_COMPACT)); | 254 | binding.tvRating.setText(Html.fromHtml(temp, Html.FROM_HTML_MODE_COMPACT)); |
255 | } | 255 | } |
256 | 256 | ||
257 | List<Entry> entries = new ArrayList<>(); | 257 | List<Entry> entries = new ArrayList<>(); |
258 | if (type == 0) { | 258 | if (type == 0) { |
259 | entries.add(new Entry(1, data.mondayCorrection)); | 259 | entries.add(new Entry(1, data.mondayCorrection)); |
260 | entries.add(new Entry(2, data.tuesdayCorrection)); | 260 | entries.add(new Entry(2, data.tuesdayCorrection)); |
261 | entries.add(new Entry(3, data.wednesdayCorrection)); | 261 | entries.add(new Entry(3, data.wednesdayCorrection)); |
262 | entries.add(new Entry(4, data.thursdayCorrection)); | 262 | entries.add(new Entry(4, data.thursdayCorrection)); |
263 | entries.add(new Entry(5, data.fridayCorrection)); | 263 | entries.add(new Entry(5, data.fridayCorrection)); |
264 | } else { | 264 | } else { |
265 | for (int i = 0; i < data.correctionList.size(); i ++) { | 265 | for (int i = 0; i < data.correctionList.size(); i ++) { |
266 | StDetail.Correction c = data.correctionList.get(i); | 266 | StDetail.Correction c = data.correctionList.get(i); |
267 | entries.add(new Entry(i, c.correction)); | 267 | entries.add(new Entry(i, c.correction)); |
268 | } | 268 | } |
269 | XAxis xAxis = binding.lineChart.getXAxis(); | 269 | XAxis xAxis = binding.lineChart.getXAxis(); |
270 | xAxis.setLabelCount(Math.min(entries.size(), 5), true); | 270 | xAxis.setLabelCount(Math.min(entries.size(), 5), true); |
271 | xAxis.setValueFormatter(new ValueFormatter() { | 271 | xAxis.setValueFormatter(new ValueFormatter() { |
272 | SimpleDateFormat format = new SimpleDateFormat("M.d", Locale.CHINA); | 272 | SimpleDateFormat format = new SimpleDateFormat("M.d", Locale.CHINA); |
273 | @Override | 273 | @Override |
274 | public String getFormattedValue(float value) { | 274 | public String getFormattedValue(float value) { |
275 | int index = (int) value; | 275 | int index = (int) value; |
276 | if (index < 0 || index >= data.correctionList.size()) return ""; | 276 | if (index < 0 || index >= data.correctionList.size()) return ""; |
277 | Date date = data.correctionList.get(index).date; | 277 | Date date = data.correctionList.get(index).date; |
278 | return format.format(date); | 278 | return format.format(date); |
279 | } | 279 | } |
280 | }); | 280 | }); |
281 | } | 281 | } |
282 | 282 | ||
283 | LineDataSet set = new LineDataSet(entries, ""); | 283 | LineDataSet set = new LineDataSet(entries, ""); |
284 | set.setColor(0xFF3BC3B6); | 284 | set.setColor(0xFF3BC3B6); |
285 | set.setCircleColor(0xFF3BC3B6); | 285 | set.setCircleColor(0xFF3BC3B6); |
286 | set.setDrawFilled(true); | 286 | set.setDrawFilled(true); |
287 | set.setDrawCircles(type == 0 || entries.size() == 1); | 287 | set.setDrawCircles(type == 0 || entries.size() == 1); |
288 | set.setDrawValues(false); | 288 | set.setDrawValues(false); |
289 | set.setHighlightEnabled(false); | 289 | set.setHighlightEnabled(false); |
290 | set.setDrawHighlightIndicators(false); | 290 | set.setDrawHighlightIndicators(false); |
291 | set.setFillDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.bg_line_chart_fill2, null)); | 291 | set.setFillDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.bg_line_chart_fill2, null)); |
292 | binding.lineChart.setData(new LineData(set)); | 292 | binding.lineChart.setData(new LineData(set)); |
293 | binding.lineChart.invalidate(); | 293 | binding.lineChart.invalidate(); |
294 | 294 | ||
295 | if (!data.points.isEmpty()) { | 295 | if (!data.points.isEmpty()) { |
296 | binding.tvExcellent.setText(String.valueOf(exNo)); | 296 | binding.tvExcellent.setText(String.valueOf(exNo)); |
297 | binding.tvGood.setText(String.valueOf(goodNo)); | 297 | binding.tvGood.setText(String.valueOf(goodNo)); |
298 | binding.tvNormal.setText(String.valueOf(normalNo)); | 298 | binding.tvNormal.setText(String.valueOf(normalNo)); |
299 | binding.tvWeak.setText(String.valueOf(weakNo)); | 299 | binding.tvWeak.setText(String.valueOf(weakNo)); |
300 | 300 | ||
301 | float exRate = 100f * exNo / data.points.size(); | 301 | float exRate = 100f * exNo / data.points.size(); |
302 | float goodRate = 100f * goodNo / data.points.size(); | 302 | float goodRate = 100f * goodNo / data.points.size(); |
303 | float normalRate = 100f * normalNo / data.points.size(); | 303 | float normalRate = 100f * normalNo / data.points.size(); |
304 | float weakRate = 100f * weakNo / data.points.size(); | 304 | float weakRate = 100f * weakNo / data.points.size(); |
305 | binding.cpGood.setValue(goodRate + normalRate + weakRate); | 305 | binding.cpGood.setValue(goodRate + normalRate + weakRate); |
306 | binding.cpNormal.setValue(normalRate + weakRate); | 306 | binding.cpNormal.setValue(normalRate + weakRate); |
307 | binding.cpWeak.setValue(weakRate); | 307 | binding.cpWeak.setValue(weakRate); |
308 | binding.tvAvePoint.setText(new DecimalFormat("0").format(100f * total / data.points.size())); | 308 | binding.tvAvePoint.setText(new DecimalFormat("0").format(100f * total / data.points.size())); |
309 | } | 309 | } |
310 | 310 | ||
311 | List<StDetail.Point> points = new ArrayList<>(); | 311 | List<StDetail.Point> points = new ArrayList<>(); |
312 | for (StDetail.Point point: data.points) { | 312 | for (StDetail.Point point: data.points) { |
313 | if (point.beforeState < 1) points.add(point); | 313 | if (point.beforeState < 1) points.add(point); |
314 | } | 314 | } |
315 | binding.tableRoot.setClipToOutline(true); | 315 | binding.tableRoot.setClipToOutline(true); |
316 | binding.tableWeekRoot.setClipToOutline(true); | 316 | binding.tableWeekRoot.setClipToOutline(true); |
317 | binding.rvPoint.setAdapter(new Adapter(points)); | 317 | binding.rvPoint.setAdapter(new Adapter(points)); |
318 | binding.rvWeekPoint.setAdapter(new WeekAdapter(data.points)); | 318 | binding.rvWeekPoint.setAdapter(new WeekAdapter(data.points)); |
319 | binding.tableRoot.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); | 319 | binding.tableRoot.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); |
320 | binding.flPointDesc.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); | 320 | binding.flPointDesc.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); |
321 | binding.flEmptyPoints.setVisibility(points.isEmpty() ? View.VISIBLE : View.GONE); | 321 | binding.flEmptyPoints.setVisibility(points.isEmpty() ? View.VISIBLE : View.GONE); |
322 | } | 322 | } |
323 | 323 | ||
324 | private void setupChart() { | 324 | private void setupChart() { |
325 | binding.lineChart.getLegend().setForm(Legend.LegendForm.NONE); | 325 | binding.lineChart.getLegend().setForm(Legend.LegendForm.NONE); |
326 | binding.lineChart.setScaleEnabled(false); | 326 | binding.lineChart.setScaleEnabled(false); |
327 | binding.lineChart.setTouchEnabled(false); | 327 | binding.lineChart.setTouchEnabled(false); |
328 | binding.lineChart.setDescription(null); | 328 | binding.lineChart.setDescription(null); |
329 | binding.lineChart.getAxisRight().setEnabled(false); | 329 | binding.lineChart.getAxisRight().setEnabled(false); |
330 | YAxis yAxis = binding.lineChart.getAxisLeft(); | 330 | YAxis yAxis = binding.lineChart.getAxisLeft(); |
331 | yAxis.setDrawAxisLine(false); | 331 | yAxis.setDrawAxisLine(false); |
332 | yAxis.setDrawGridLines(true); | 332 | yAxis.setDrawGridLines(true); |
333 | yAxis.setGridColor(0xFFDDDDDD); | 333 | yAxis.setGridColor(0xFFDDDDDD); |
334 | yAxis.setTextColor(0xFF333333); | 334 | yAxis.setTextColor(0xFF333333); |
335 | if (type == 0) { | 335 | if (type == 0) { |
336 | yAxis.setTextSize(16); | 336 | yAxis.setTextSize(16); |
337 | yAxis.setXOffset(16); | 337 | yAxis.setXOffset(16); |
338 | } else { | 338 | } else { |
339 | yAxis.setTextSize(13); | 339 | yAxis.setTextSize(13); |
340 | } | 340 | } |
341 | yAxis.setAxisMinimum(0); | 341 | yAxis.setAxisMinimum(0); |
342 | yAxis.setAxisMaximum(1); | 342 | yAxis.setAxisMaximum(1); |
343 | yAxis.setLabelCount(5, true); | 343 | yAxis.setLabelCount(5, true); |
344 | yAxis.setValueFormatter(new ValueFormatter() { | 344 | yAxis.setValueFormatter(new ValueFormatter() { |
345 | @Override | 345 | @Override |
346 | public String getFormattedValue(float value) { | 346 | public String getFormattedValue(float value) { |
347 | return new DecimalFormat("0%").format(value); | 347 | return new DecimalFormat("0%").format(value); |
348 | } | 348 | } |
349 | }); | 349 | }); |
350 | 350 | ||
351 | XAxis xAxis = binding.lineChart.getXAxis(); | 351 | XAxis xAxis = binding.lineChart.getXAxis(); |
352 | xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); | 352 | xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); |
353 | xAxis.setDrawAxisLine(false); | 353 | xAxis.setDrawAxisLine(false); |
354 | xAxis.setDrawGridLines(false); | 354 | xAxis.setDrawGridLines(false); |
355 | xAxis.setTextColor(0xFF333333); | 355 | xAxis.setTextColor(0xFF333333); |
356 | xAxis.setTextSize(16); | 356 | xAxis.setTextSize(16); |
357 | xAxis.setYOffset(16); | 357 | xAxis.setYOffset(16); |
358 | if (type == 0) { | 358 | if (type == 0) { |
359 | xAxis.setAxisMinimum(0.5f); | 359 | xAxis.setAxisMinimum(0.5f); |
360 | xAxis.setAxisMaximum(5.5f); | 360 | xAxis.setAxisMaximum(5.5f); |
361 | xAxis.setLabelCount(11, true); | 361 | xAxis.setLabelCount(11, true); |
362 | xAxis.setValueFormatter(new ValueFormatter() { | 362 | xAxis.setValueFormatter(new ValueFormatter() { |
363 | @Override | 363 | @Override |
364 | public String getFormattedValue(float value) { | 364 | public String getFormattedValue(float value) { |
365 | if (value == 1) { | 365 | if (value == 1) { |
366 | return "周一"; | 366 | return "周一"; |
367 | } else if (value == 2) { | 367 | } else if (value == 2) { |
368 | return "周二"; | 368 | return "周二"; |
369 | } else if (value == 3) { | 369 | } else if (value == 3) { |
370 | return "周三"; | 370 | return "周三"; |
371 | } else if (value == 4) { | 371 | } else if (value == 4) { |
372 | return "周四"; | 372 | return "周四"; |
373 | } else if (value == 5) { | 373 | } else if (value == 5) { |
374 | return "周五"; | 374 | return "周五"; |
375 | } | 375 | } |
376 | return ""; | 376 | return ""; |
377 | } | 377 | } |
378 | }); | 378 | }); |
379 | } else { | 379 | } else { |
380 | xAxis.setTextSize(13); | 380 | xAxis.setTextSize(13); |
381 | } | 381 | } |
382 | } | 382 | } |
383 | 383 | ||
384 | private String fromColor(String str, String color) { | 384 | private String fromColor(String str, String color) { |
385 | return String.format("<font color='%s'><b>%s</b></font>", color, str); | 385 | return String.format("<font color='%s'><b>%s</b></font>", color, str); |
386 | } | 386 | } |
387 | 387 | ||
388 | private void switchPage() { | 388 | private void switchPage() { |
389 | Intent intent = new Intent(getIntent()); | 389 | Intent intent = new Intent(getIntent()); |
390 | intent.putExtra("a4", !a4); | 390 | intent.putExtra("a4", !a4); |
391 | startActivity(intent); | 391 | startActivity(intent); |
392 | finish(); | 392 | finish(); |
393 | } | 393 | } |
394 | 394 | ||
395 | private Uri prepareShare() { | 395 | private Uri prepareShare() { |
396 | try { | 396 | try { |
397 | binding.toolbar.setVisibility(View.INVISIBLE); | 397 | binding.toolbar.setVisibility(View.INVISIBLE); |
398 | Bitmap bitmap = BitmapUtils.shotView(binding.root); | 398 | Bitmap bitmap = BitmapUtils.shotView(binding.root); |
399 | binding.toolbar.setVisibility(View.VISIBLE); | 399 | binding.toolbar.setVisibility(View.VISIBLE); |
400 | 400 | ||
401 | String fileName = student.stuName + "_周作业学习报告_" + System.currentTimeMillis(); | 401 | String fileName = student.stuName + "_周作业学习报告_" + System.currentTimeMillis(); |
402 | return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); | 402 | return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); |
403 | } catch (Exception e) { | 403 | } catch (Exception e) { |
404 | e.printStackTrace(); | 404 | e.printStackTrace(); |
405 | } | 405 | } |
406 | return null; | 406 | return null; |
407 | } | 407 | } |
408 | 408 | ||
409 | @Override | 409 | @Override |
410 | protected ActivityHuyouDetailBinding getViewBinding() { | 410 | protected ActivityHuyouDetailBinding getViewBinding() { |
411 | a4 = getIntent().getBooleanExtra("a4", false); | 411 | a4 = getIntent().getBooleanExtra("a4", false); |
412 | View view; | 412 | View view; |
413 | if (a4) view = getLayoutInflater().inflate(R.layout.activity_huyou_detail_a4, null); | 413 | if (a4) view = getLayoutInflater().inflate(R.layout.activity_huyou_detail_a4, null); |
414 | else view = getLayoutInflater().inflate(R.layout.activity_huyou_detail, null); | 414 | else view = getLayoutInflater().inflate(R.layout.activity_huyou_detail, null); |
415 | return ActivityHuyouDetailBinding.bind(view); | 415 | return ActivityHuyouDetailBinding.bind(view); |
416 | } | 416 | } |
417 | 417 | ||
418 | public static class Adapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> { | 418 | public static class Adapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> { |
419 | 419 | ||
420 | public Adapter(@Nullable List<StDetail.Point> data) { | 420 | public Adapter(@Nullable List<StDetail.Point> data) { |
421 | super(R.layout.item_huyou_point, data); | 421 | super(R.layout.item_huyou_point, data); |
422 | } | 422 | } |
423 | 423 | ||
424 | @Override | 424 | @Override |
425 | protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) { | 425 | protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) { |
426 | DecimalFormat format1 = new DecimalFormat("0%"); | 426 | DecimalFormat format1 = new DecimalFormat("0%"); |
427 | DecimalFormat format2 = new DecimalFormat("0"); | 427 | DecimalFormat format2 = new DecimalFormat("0"); |
428 | holder.setText(R.id.tvName, point.pointName); | 428 | holder.setText(R.id.tvName, point.pointName); |
429 | holder.setText(R.id.tvBefore, format1.format(point.beforeState)); | 429 | holder.setText(R.id.tvBefore, format1.format(point.beforeState)); |
430 | holder.setText(R.id.tvAfter, format1.format(point.afterState)); | 430 | holder.setText(R.id.tvAfter, format1.format(point.afterState)); |
431 | holder.setText(R.id.tvGap, format2.format(point.gap * 100)); | 431 | holder.setText(R.id.tvGap, format2.format(point.gap * 100)); |
432 | holder.setGone(R.id.ivFlag, getData().indexOf(point) == 0); | 432 | holder.setGone(R.id.ivFlag, getData().indexOf(point) == 0); |
433 | holder.<TextView>getView(R.id.tvName).setTooltipText(point.pointName); | 433 | holder.<TextView>getView(R.id.tvName).setTooltipText(point.pointName); |
434 | 434 | ||
435 | TextView before = holder.getView(R.id.tvBeforeState); | 435 | TextView before = holder.getView(R.id.tvBeforeState); |
436 | TextView after = holder.getView(R.id.tvAfterState); | 436 | TextView after = holder.getView(R.id.tvAfterState); |
437 | 437 | ||
438 | if (point.beforeState >= 0.9) { | 438 | if (point.beforeState >= 0.9) { |
439 | before.setText("掌握优秀"); | 439 | before.setText("掌握优秀"); |
440 | before.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); | 440 | before.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); |
441 | } else if (point.beforeState >= 0.8) { | 441 | } else if (point.beforeState >= 0.8) { |
442 | before.setText("掌握良好"); | 442 | before.setText("掌握良好"); |
443 | before.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); | 443 | before.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); |
444 | } else if (point.beforeState >= 0.6) { | 444 | } else if (point.beforeState >= 0.6) { |
445 | before.setText("掌握一般"); | 445 | before.setText("掌握一般"); |
446 | before.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); | 446 | before.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); |
447 | } else { | 447 | } else { |
448 | before.setText("掌握薄弱"); | 448 | before.setText("掌握薄弱"); |
449 | before.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); | 449 | before.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); |
450 | } | 450 | } |
451 | if (point.afterState >= 0.9) { | 451 | if (point.afterState >= 0.9) { |
452 | after.setText("掌握优秀"); | 452 | after.setText("掌握优秀"); |
453 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); | 453 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); |
454 | } else if (point.afterState >= 0.8) { | 454 | } else if (point.afterState >= 0.8) { |
455 | after.setText("掌握良好"); | 455 | after.setText("掌握良好"); |
456 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); | 456 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); |
457 | } else if (point.afterState >= 0.6) { | 457 | } else if (point.afterState >= 0.6) { |
458 | after.setText("掌握一般"); | 458 | after.setText("掌握一般"); |
459 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); | 459 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); |
460 | } else { | 460 | } else { |
461 | after.setText("掌握薄弱"); | 461 | after.setText("掌握薄弱"); |
462 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); | 462 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); |
463 | } | 463 | } |
464 | 464 | ||
465 | holder.setText(R.id.tvHuyou, format1.format(point.correctness)); | 465 | holder.setText(R.id.tvHuyou, format1.format(point.correctness)); |
466 | } | 466 | } |
467 | 467 | ||
468 | } | 468 | } |
469 | 469 | ||
470 | public static class WeekAdapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> { | 470 | public static class WeekAdapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> { |
471 | public WeekAdapter(@Nullable List<StDetail.Point> data) { | 471 | public WeekAdapter(@Nullable List<StDetail.Point> data) { |
472 | super(R.layout.item_huyou_week_point, data); | 472 | super(R.layout.item_huyou_week_point, data); |
473 | } | 473 | } |
474 | 474 | ||
475 | @Override | 475 | @Override |
476 | protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) { | 476 | protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) { |
477 | holder.setText(R.id.tvName, point.pointName); | 477 | holder.setText(R.id.tvName, point.pointName); |
478 | 478 | ||
479 | TextView after = holder.getView(R.id.tvState); | 479 | TextView after = holder.getView(R.id.tvState); |
480 | if (point.beforeState >= 0.9) { | 480 | if (point.beforeState >= 0.9) { |
481 | after.setText("掌握优秀"); | 481 | after.setText("掌握优秀"); |
482 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); | 482 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); |
483 | } else if (point.beforeState >= 0.8) { | 483 | } else if (point.beforeState >= 0.8) { |
484 | after.setText("掌握良好"); | 484 | after.setText("掌握良好"); |
485 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); | 485 | after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); |
486 | } else if (point.beforeState >= 0.6) { | 486 | } else if (point.beforeState >= 0.6) { |
487 | after.setText("掌握一般"); | 487 | after.setText("掌握一般"); |
488 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); | 488 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); |
489 | } else { | 489 | } else { |
490 | after.setText("掌握薄弱"); | 490 | after.setText("掌握薄弱"); |
491 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); | 491 | after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); |
492 | } | 492 | } |
493 | 493 | ||
494 | DecimalFormat format1 = new DecimalFormat("0%"); | 494 | DecimalFormat format1 = new DecimalFormat("0%"); |
495 | holder.setText(R.id.tvHuyou, format1.format(point.beforeState)); | 495 | holder.setText(R.id.tvHuyou, format1.format(point.beforeState)); |
496 | } | 496 | } |
497 | } | 497 | } |
498 | 498 | ||
499 | } | 499 | } |
500 | 500 |