Commit 45d5814c1b2055965c5a0b8ee159b953d56bd61f

Authored by shixianjie
1 parent 3119571af6
Exists in master

沉浸式状态栏; 布局优化;

1 apply plugin: 'com.android.application' 1 apply plugin: 'com.android.application'
2 apply from: '../config.gradle' 2 apply from: '../config.gradle'
3 3
4 4
5 def androidId = rootProject.ext.androidId 5 def androidId = rootProject.ext.androidId
6 def support = rootProject.ext.dependencies 6 def support = rootProject.ext.dependencies
7 def url = rootProject.ext.url 7 def url = rootProject.ext.url
8 8
9 9
10 android { 10 android {
11 signingConfigs { 11 signingConfigs {
12 12
13 config { 13 config {
14 keyAlias 'alias' 14 keyAlias 'alias'
15 keyPassword '123456' 15 keyPassword '123456'
16 storeFile file('key.jks') 16 storeFile file('key.jks')
17 storePassword '123456' 17 storePassword '123456'
18 } 18 }
19 debug { 19 debug {
20 } 20 }
21 } 21 }
22 compileSdk 32 22 compileSdk 32
23 23
24 defaultConfig { 24 defaultConfig {
25 applicationId "com.hjx.parent" 25 applicationId "com.hjx.parent"
26 minSdk 26 26 minSdk 26
27 targetSdk 32 27 targetSdk 32
28 versionCode 1005 28 versionCode 1005
29 versionName "1.0.0.5" 29 versionName "1.0.0.5"
30 30
31 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 31 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
32 } 32 }
33 33
34 android.applicationVariants.all { 34 android.applicationVariants.all {
35 variant -> 35 variant ->
36 variant.outputs.all { 36 variant.outputs.all {
37 //在这里修改apk文件名 37 //在这里修改apk文件名
38 outputFileName = "parent-${variant.name}-v${variant.versionName}.apk" 38 outputFileName = "parent-${variant.name}-v${variant.versionName}.apk"
39 } 39 }
40 } 40 }
41 buildTypes { 41 buildTypes {
42 debug { 42 debug {
43 debuggable true 43 debuggable true
44 minifyEnabled false 44 minifyEnabled false
45 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 45 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
46 signingConfig signingConfigs.config 46 signingConfig signingConfigs.config
47 } 47 }
48 release { 48 release {
49 debuggable true 49 debuggable true
50 minifyEnabled false 50 minifyEnabled false
51 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 51 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
52 signingConfig signingConfigs.config 52 signingConfig signingConfigs.config
53 } 53 }
54 } 54 }
55 lintOptions { 55 lintOptions {
56 checkReleaseBuilds false 56 checkReleaseBuilds false
57 abortOnError false 57 abortOnError false
58 } 58 }
59 buildFeatures { 59 buildFeatures {
60 viewBinding true 60 viewBinding true
61 dataBinding true 61 dataBinding true
62 } 62 }
63 compileOptions { 63 compileOptions {
64 sourceCompatibility JavaVersion.VERSION_1_8 64 sourceCompatibility JavaVersion.VERSION_1_8
65 targetCompatibility JavaVersion.VERSION_1_8 65 targetCompatibility JavaVersion.VERSION_1_8
66 } 66 }
67 } 67 }
68 68
69 dependencies { 69 dependencies {
70 support.each { k, v -> implementation v } 70 support.each { k, v -> implementation v }
71 api project(path: ':libs:common') 71 api project(path: ':libs:common')
72 implementation 'androidx.appcompat:appcompat:1.5.1' 72 implementation 'androidx.appcompat:appcompat:1.5.1'
73 implementation 'com.google.android.material:material:1.6.1' 73 implementation 'com.google.android.material:material:1.6.1'
74 implementation 'androidx.constraintlayout:constraintlayout:2.1.4' 74 implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
75 implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.50' 75 implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.50'
76 implementation 'com.github.ForgetAll:LoadingDialog:1.1.2' 76 implementation 'com.github.ForgetAll:LoadingDialog:1.1.2'
77 implementation 'com.github.DL-ZhangTeng:ImagePicker:1.5.0' 77 implementation 'com.github.DL-ZhangTeng:ImagePicker:1.5.0'
78 //使用的三方 78 //使用的三方
79 implementation 'com.yalantis:ucrop:2.2.0' 79 implementation 'com.yalantis:ucrop:2.2.0'
80 implementation 'com.github.DL-ZhangTeng:RequestPermission:1.3.0' 80 implementation 'com.github.DL-ZhangTeng:RequestPermission:1.3.0'
81 implementation 'com.github.DL-ZhangTeng:Utils:2.2.0' 81 implementation 'com.github.DL-ZhangTeng:Utils:2.2.0'
82 82
83 // rx 83 // rx
84 implementation("com.trello.rxlifecycle2:rxlifecycle:2.2.2") 84 implementation("com.trello.rxlifecycle2:rxlifecycle:2.2.2")
85 implementation("com.trello.rxlifecycle2:rxlifecycle-android:2.2.2") 85 implementation("com.trello.rxlifecycle2:rxlifecycle-android:2.2.2")
86 86
87 implementation("com.github.PhilJay:MPAndroidChart:v3.1.0") 87 implementation("com.github.PhilJay:MPAndroidChart:v3.1.0")
88 implementation("com.contrarywind:Android-PickerView:4.1.9") 88 implementation("com.contrarywind:Android-PickerView:4.1.9")
89 89
90 implementation 'com.google.android:flexbox:1.0.0' 90 implementation 'com.google.android:flexbox:1.0.0'
91
92 // 沉浸式状态栏和他的Kotlin拓展
93 implementation 'com.geyifeng.immersionbar:immersionbar:3.2.2'
94 implementation 'com.geyifeng.immersionbar:immersionbar-ktx:3.2.2'
95
91 } 96 }
app/src/main/AndroidManifest.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:tools="http://schemas.android.com/tools" 3 xmlns:tools="http://schemas.android.com/tools"
4 package="com.hjx.parent"> 4 package="com.hjx.parent">
5 5
6 6
7 <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> 7 <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
8 <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <!-- 允许程序改变网络链接状态 --> 8 <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <!-- 允许程序改变网络链接状态 -->
9 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 允许程序访问访问WIFI网络状态信息 --> 9 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 允许程序访问访问WIFI网络状态信息 -->
10 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 允许程序改变WIFI链接状态 --> 10 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 允许程序改变WIFI链接状态 -->
11 <!-- 6.0系统需要添加权限才能获得wifi列表 --> 11 <!-- 6.0系统需要添加权限才能获得wifi列表 -->
12 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 12 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
13 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 13 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
14 <uses-permission android:name="android.permission.INTERNET" /> 14 <uses-permission android:name="android.permission.INTERNET" />
15 <uses-permission android:name="android.permission.RECORD_AUDIO" /> 15 <uses-permission android:name="android.permission.RECORD_AUDIO" />
16 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 16 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
17 17
18 <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> 18 <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
19 <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 19 <uses-permission android:name="android.permission.READ_PHONE_STATE" />
20 <uses-permission android:name="android.permission.WAKE_LOCK" /> 20 <uses-permission android:name="android.permission.WAKE_LOCK" />
21 <uses-permission android:name="android.permission.CAMERA" /> 21 <uses-permission android:name="android.permission.CAMERA" />
22 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> 22 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
23 <uses-permission android:name="android.permission.VIBRATE" /> 23 <uses-permission android:name="android.permission.VIBRATE" />
24 <uses-permission 24 <uses-permission
25 android:name="android.permission.WRITE_EXTERNAL_STORAGE" 25 android:name="android.permission.WRITE_EXTERNAL_STORAGE"
26 tools:ignore="ScopedStorage" /> 26 tools:ignore="ScopedStorage" />
27 <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> 27 <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
28 <uses-permission android:name="android.permission.GET_PACKAGE_SIZE" /> 28 <uses-permission android:name="android.permission.GET_PACKAGE_SIZE" />
29 29
30 <uses-permission 30 <uses-permission
31 android:name="android.permission.MANAGE_EXTERNAL_STORAGE" 31 android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
32 tools:ignore="ScopedStorage" /> 32 tools:ignore="ScopedStorage" />
33 33
34 <application 34 <application
35 android:name=".App" 35 android:name=".App"
36 android:allowBackup="true" 36 android:allowBackup="true"
37 android:icon="@mipmap/icon" 37 android:icon="@mipmap/icon"
38 android:label="@string/app_name" 38 android:label="@string/app_name"
39 android:networkSecurityConfig="@xml/network_security_config" 39 android:networkSecurityConfig="@xml/network_security_config"
40 android:supportsRtl="true" 40 android:supportsRtl="true"
41 android:theme="@style/Theme.AppCompat.Light.NoActionBar"> 41 android:theme="@style/Theme.AppCompat.Light.NoActionBar">
42 <activity 42 <activity
43 android:name=".LoginActivity" 43 android:name=".LoginActivity"
44 android:exported="true" 44 android:exported="true"
45 android:screenOrientation="portrait" 45 android:screenOrientation="portrait"
46 android:theme="@style/ThemeSplash"> 46 android:theme="@style/ThemeSplash">
47 <intent-filter> 47 <intent-filter>
48 <action android:name="android.intent.action.MAIN" /> 48 <action android:name="android.intent.action.MAIN" />
49 <category android:name="android.intent.category.LAUNCHER" /> 49 <category android:name="android.intent.category.LAUNCHER" />
50 </intent-filter> 50 </intent-filter>
51 </activity> 51 </activity>
52 <activity 52 <activity
53 android:name=".MainActivity" 53 android:name=".MainActivity"
54 android:launchMode="singleTask" 54 android:launchMode="singleTask"
55 android:screenOrientation="portrait" 55 android:screenOrientation="portrait"
56 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 56 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
57 <activity 57 <activity
58 android:name=".RegisterActivity" 58 android:name=".RegisterActivity"
59 android:screenOrientation="portrait" 59 android:screenOrientation="portrait"
60 android:theme="@style/ThemeSplash" /> 60 android:theme="@style/ThemeSplash" />
61 <activity 61 <activity
62 android:name=".UserActivity" 62 android:name=".UserActivity"
63 android:screenOrientation="portrait" 63 android:screenOrientation="portrait"
64 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 64 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
65 <activity 65 <activity
66 android:name=".YinsiActivity" 66 android:name=".YinsiActivity"
67 android:screenOrientation="portrait" 67 android:screenOrientation="portrait"
68 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 68 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
69 <activity 69 <activity
70 android:name=".QRActivity" 70 android:name=".QRActivity"
71 android:screenOrientation="portrait" 71 android:screenOrientation="portrait"
72 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 72 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
73 <activity 73 <activity
74 android:name=".AddStudentActivity" 74 android:name=".AddStudentActivity"
75 android:screenOrientation="portrait" 75 android:screenOrientation="portrait"
76 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 76 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
77 <activity 77 <activity
78 android:name=".NickActivity" 78 android:name=".NickActivity"
79 android:screenOrientation="portrait" 79 android:screenOrientation="portrait"
80 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 80 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
81 <activity 81 <activity
82 android:name=".SexActivity" 82 android:name=".SexActivity"
83 android:screenOrientation="portrait" 83 android:screenOrientation="portrait"
84 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 84 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
85 <activity 85 <activity
86 android:name=".NianActivity" 86 android:name=".NianActivity"
87 android:screenOrientation="portrait" 87 android:screenOrientation="portrait"
88 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 88 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
89 <activity 89 <activity
90 android:name=".ShenActivity" 90 android:name=".ShenActivity"
91 android:screenOrientation="portrait" 91 android:screenOrientation="portrait"
92 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 92 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
93 <activity 93 <activity
94 android:name=".UserAgreementActivity" 94 android:name=".UserAgreementActivity"
95 android:screenOrientation="portrait" 95 android:screenOrientation="portrait"
96 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 96 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
97 <activity 97 <activity
98 android:name=".AccountActivity" 98 android:name=".AccountActivity"
99 android:screenOrientation="portrait" 99 android:screenOrientation="portrait"
100 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 100 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
101 101
102 <activity 102 <activity
103 android:name=".ChangePwdActivity" 103 android:name=".ChangePwdActivity"
104 android:screenOrientation="portrait" 104 android:screenOrientation="portrait"
105 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 105 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
106 <activity 106 <activity
107 android:name=".EditStudentActivity" 107 android:name=".EditStudentActivity"
108 android:screenOrientation="portrait" 108 android:screenOrientation="portrait"
109 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 109 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
110 <activity 110 <activity
111 android:name=".ChooseActivity" 111 android:name=".ChooseActivity"
112 android:screenOrientation="portrait" 112 android:screenOrientation="portrait"
113 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 113 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
114 <activity 114 <activity
115 android:name=".AddTeacherActivity" 115 android:name=".AddTeacherActivity"
116 android:screenOrientation="portrait" 116 android:screenOrientation="portrait"
117 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 117 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
118 <activity 118 <activity
119 android:name=".ErrorBookActivity" 119 android:name=".ErrorBookActivity"
120 android:screenOrientation="portrait" 120 android:screenOrientation="portrait"
121 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 121 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
122 <activity 122 <activity
123 android:name=".ImageActivity" 123 android:name=".ImageActivity"
124 android:screenOrientation="portrait" 124 android:screenOrientation="portrait"
125 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 125 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
126 <activity 126 <activity
127 android:name=".ImageEditActivity" 127 android:name=".ImageEditActivity"
128 android:screenOrientation="portrait" 128 android:screenOrientation="portrait"
129 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 129 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
130 <activity 130 <activity
131 android:name=".ImageSelectActivity" 131 android:name=".ImageSelectActivity"
132 android:screenOrientation="portrait" 132 android:screenOrientation="portrait"
133 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 133 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
134 <activity 134 <activity
135 android:name=".AddSuccessActivity" 135 android:name=".AddSuccessActivity"
136 android:screenOrientation="portrait" 136 android:screenOrientation="portrait"
137 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 137 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
138 <activity 138 <activity
139 android:name=".ErrorListActivity" 139 android:name=".ErrorListActivity"
140 android:screenOrientation="portrait" 140 android:screenOrientation="portrait"
141 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 141 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
142 <activity 142 <activity
143 android:name=".ErrorDetailActivity" 143 android:name=".ErrorDetailActivity"
144 android:screenOrientation="portrait" 144 android:screenOrientation="portrait"
145 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 145 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
146 <activity 146 <activity
147 android:name=".TeacherChooseActivity" 147 android:name=".TeacherChooseActivity"
148 android:screenOrientation="portrait" 148 android:screenOrientation="portrait"
149 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 149 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
150 <activity 150 <activity
151 android:name=".TeacherMainActivity" 151 android:name=".TeacherMainActivity"
152 android:screenOrientation="portrait" 152 android:screenOrientation="portrait"
153 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 153 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
154 <activity android:name=".StuHomeworkActivity" /> 154 <activity android:name=".StuHomeworkActivity" />
155 <activity android:name=".HomeworkDetailActivity" /> 155 <activity android:name=".HomeworkDetailActivity" />
156 <activity android:name=".HomeworkSelectActivity" /> 156 <activity android:name=".HomeworkSelectActivity" />
157 <activity android:name=".HomeworkFeedbackActivity" /> 157 <activity android:name=".HomeworkFeedbackActivity" />
158 <activity android:name=".HomeworkTopicActivity" /> 158 <activity android:name=".HomeworkTopicActivity" />
159 <activity android:name=".HomeworkShareActivity" /> 159 <activity android:name=".HomeworkShareActivity"
160 android:screenOrientation="landscape"/>
160 <activity android:name=".HuyouDetailActivity" /> 161 <activity android:name=".HuyouDetailActivity" />
161 162
162 <provider 163 <provider
163 android:name="androidx.core.content.FileProvider" 164 android:name="androidx.core.content.FileProvider"
164 android:authorities="com.hjx.parent.fileprovider" 165 android:authorities="com.hjx.parent.fileprovider"
165 android:exported="false" 166 android:exported="false"
166 android:grantUriPermissions="true" 167 android:grantUriPermissions="true"
167 tools:replace="android:authorities"> 168 tools:replace="android:authorities">
168 <meta-data 169 <meta-data
169 android:name="android.support.FILE_PROVIDER_PATHS" 170 android:name="android.support.FILE_PROVIDER_PATHS"
170 android:resource="@xml/file_provider_paths" 171 android:resource="@xml/file_provider_paths"
171 tools:replace="android:resource" /> 172 tools:replace="android:resource" />
172 </provider> 173 </provider>
173 </application> 174 </application>
174 175
175 </manifest> 176 </manifest>
app/src/main/java/com/hjx/parent/HomeworkShareActivity.java
1 package com.hjx.parent; 1 package com.hjx.parent;
2 2
3 import android.annotation.SuppressLint; 3 import android.annotation.SuppressLint;
4 import android.content.Intent; 4 import android.content.Intent;
5 import android.graphics.Bitmap; 5 import android.graphics.Bitmap;
6 import android.net.Uri; 6 import android.net.Uri;
7 import android.os.Bundle; 7 import android.os.Bundle;
8 import android.text.Html; 8 import android.text.Html;
9 import android.view.View; 9 import android.view.View;
10 import android.widget.ImageView; 10 import android.widget.ImageView;
11 import android.widget.LinearLayout; 11 import android.widget.LinearLayout;
12 import android.widget.TextView; 12 import android.widget.TextView;
13 13
14 import androidx.annotation.NonNull; 14 import androidx.annotation.NonNull;
15 15
16 import com.bumptech.glide.Glide; 16 import com.bumptech.glide.Glide;
17 import com.chad.library.adapter.base.BaseQuickAdapter; 17 import com.chad.library.adapter.base.BaseQuickAdapter;
18 import com.chad.library.adapter.base.BaseViewHolder; 18 import com.chad.library.adapter.base.BaseViewHolder;
19 import com.google.gson.Gson; 19 import com.google.gson.Gson;
20 import com.gyf.immersionbar.ImmersionBar;
20 import com.hjx.parent.databinding.ActivityHomeworkShareBinding; 21 import com.hjx.parent.databinding.ActivityHomeworkShareBinding;
21 import com.hjx.parent.rx.BaseRxActivity; 22 import com.hjx.parent.rx.BaseRxActivity;
22 import com.prws.common.bean.ResponseResult; 23 import com.prws.common.bean.ResponseResult;
23 import com.prws.common.bean.Student; 24 import com.prws.common.bean.Student;
24 import com.prws.common.bean.homework.HomeWork; 25 import com.prws.common.bean.homework.HomeWork;
25 import com.prws.common.bean.homework.HomeworkDetail; 26 import com.prws.common.bean.homework.HomeworkDetail;
26 import com.prws.common.bean.homework.KeyValue; 27 import com.prws.common.bean.homework.KeyValue;
27 import com.prws.common.net.NetWorks; 28 import com.prws.common.net.NetWorks;
28 import com.prws.common.utils.BitmapUtils; 29 import com.prws.common.utils.BitmapUtils;
29 import com.prws.common.utils.CommonUtil; 30 import com.prws.common.utils.CommonUtil;
30 import com.prws.common.utils.ContentUtil; 31 import com.prws.common.utils.ContentUtil;
31 32
32 import java.text.DecimalFormat; 33 import java.text.DecimalFormat;
33 import java.text.SimpleDateFormat; 34 import java.text.SimpleDateFormat;
34 import java.util.ArrayList; 35 import java.util.ArrayList;
35 import java.util.HashSet; 36 import java.util.HashSet;
36 import java.util.List; 37 import java.util.List;
37 import java.util.Locale; 38 import java.util.Locale;
38 import java.util.Set; 39 import java.util.Set;
39 40
40 import io.reactivex.Single; 41 import io.reactivex.Single;
41 import io.reactivex.android.schedulers.AndroidSchedulers; 42 import io.reactivex.android.schedulers.AndroidSchedulers;
42 import io.reactivex.schedulers.Schedulers; 43 import io.reactivex.schedulers.Schedulers;
43 44
44 public class HomeworkShareActivity extends BaseRxActivity<ActivityHomeworkShareBinding> { 45 public class HomeworkShareActivity extends BaseRxActivity<ActivityHomeworkShareBinding> {
45 private String id; 46 private String id;
46 47
47 String indent = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; 48 String indent = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
48 49
49 private String title; 50 private String title;
50 private Student student; 51 private Student student;
51 private ErrorAdapter mAdapter = new ErrorAdapter(); 52 private ErrorAdapter mAdapter = new ErrorAdapter();
52 53
53 private Uri shareUri; 54 private Uri shareUri;
54 55
55 @SuppressLint("SetTextI18n") 56 @SuppressLint("SetTextI18n")
56 @Override 57 @Override
57 public void initView(Bundle savedInstanceState) { 58 public void initView(Bundle savedInstanceState) {
59 ImmersionBar.with(this).init();
58 binding.btnBack.setOnClickListener(v -> onBackPressed()); 60 binding.btnBack.setOnClickListener(v -> onBackPressed());
59 binding.rvWrong.setAdapter(mAdapter); 61 binding.rvWrong.setAdapter(mAdapter);
60 mAdapter.setEmptyView(R.layout.empty_statistical_no_error, binding.rvWrong); 62 mAdapter.setEmptyView(R.layout.empty_statistical_no_error, binding.rvWrong);
61 63
62 id = getIntent().getStringExtra("id"); 64 id = getIntent().getStringExtra("id");
63 title = getIntent().getStringExtra("name"); 65 title = getIntent().getStringExtra("name");
64 binding.tvTitle.setText(title); 66 binding.tvTitle.setText(title);
65 student = (Student) getIntent().getSerializableExtra("student"); 67 student = (Student) getIntent().getSerializableExtra("student");
66 assert student != null; 68 assert student != null;
67 binding.tvName.setText(student.stuName); 69 binding.tvName.setText(student.stuName);
68 Glide.with(this).load(student.photo).centerCrop().error(R.mipmap.ic_avatar_male).into(binding.ivAvatar); 70 Glide.with(this).load(student.photo).centerCrop().error(R.mipmap.ic_avatar_male).into(binding.ivAvatar);
69 binding.tvGrade.setText("学员年级:" + getIntent().getStringExtra("grade")); 71 binding.tvGrade.setText("学员年级:" + getIntent().getStringExtra("grade"));
70 binding.tvSubject.setText("作业科目:" + getIntent().getStringExtra("subject")); 72 binding.tvSubject.setText("作业科目:" + getIntent().getStringExtra("subject"));
71 73
72 binding.btnShare.setOnClickListener(v -> { 74 binding.btnShare.setOnClickListener(v -> {
73 if (shareUri == null) shareUri = saveBitmap(); 75 if (shareUri == null) shareUri = saveBitmap();
74 if (shareUri != null) { 76 if (shareUri != null) {
75 Intent shareIntent = new Intent(Intent.ACTION_SEND); 77 Intent shareIntent = new Intent(Intent.ACTION_SEND);
76 shareIntent.setType("image/jpeg"); 78 shareIntent.setType("image/jpeg");
77 shareIntent.putExtra(Intent.EXTRA_STREAM, shareUri); 79 shareIntent.putExtra(Intent.EXTRA_STREAM, shareUri);
78 shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); 80 shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
79 81
80 startActivity(shareIntent); 82 startActivity(shareIntent);
81 } 83 }
82 }); 84 });
83 85
84 loadHomework(); 86 loadHomework();
85 } 87 }
86 88
87 @SuppressLint("CheckResult") 89 @SuppressLint("CheckResult")
88 private void loadHomework() { 90 private void loadHomework() {
89 NetWorks.service_url.getHomeworkCompleteDetail(NetWorks.getHeader(), student.stuId, id, true) 91 NetWorks.service_url.getHomeworkCompleteDetail(NetWorks.getHeader(), student.stuId, id, true)
90 .compose(transformSingle()) 92 .compose(transformSingle())
91 .map(ResponseResult::getData) 93 .map(ResponseResult::getData)
92 .map(data -> { 94 .map(data -> {
93 if (data.getHomeworkList() == null) return data; 95 if (data.getHomeworkList() == null) return data;
94 for (HomeWork homeWork: data.getHomeworkList()){ 96 for (HomeWork homeWork: data.getHomeworkList()){
95 homeWork.formatPoints(new Gson()); 97 homeWork.formatPoints(new Gson());
96 } 98 }
97 return data; 99 return data;
98 }) 100 })
99 .subscribe((data, th) -> { 101 .subscribe((data, th) -> {
100 if (th != null) th.printStackTrace(); 102 if (th != null) th.printStackTrace();
101 if (data != null) showHomework(data); 103 if (data != null) showHomework(data);
102 }); 104 });
103 } 105 }
104 @SuppressLint({"SetTextI18n", "DefaultLocale"}) 106 @SuppressLint({"SetTextI18n", "DefaultLocale"})
105 private void showHomework(HomeworkDetail detail) { 107 private void showHomework(HomeworkDetail detail) {
106 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); 108 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
107 binding.tvDate.setText("作业时间:" + format.format(detail.getDate())); 109 binding.tvDate.setText("作业时间:" + format.format(detail.getDate()));
108 binding.flComment.setVisibility(detail.getComment() == null || detail.getComment().isEmpty() ? View.INVISIBLE : View.VISIBLE); 110 binding.flComment.setVisibility(detail.getComment() == null || detail.getComment().isEmpty() ? View.INVISIBLE : View.VISIBLE);
109 binding.tvComment.setText(ifEmpty(detail.getComment(), "-")); 111 binding.tvComment.setText(ifEmpty(detail.getComment(), "-"));
110 binding.tvRating.setText("-"); 112 binding.tvRating.setText("-");
111 113
112 String temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好;答错题目有 %s 道,错题涵盖的知识点主要有%s,这部分还要再加强学习。错题老师已经帮你收录到错题本中,要记得复习整理错题,及时消灭薄弱知识点。"; 114 String temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好;答错题目有 %s 道,错题涵盖的知识点主要有%s,这部分还要再加强学习。错题老师已经帮你收录到错题本中,要记得复习整理错题,及时消灭薄弱知识点。";
113 List<HomeWork> errorList = new ArrayList<>(); 115 List<HomeWork> errorList = new ArrayList<>();
114 if (detail.getHomeworkList() != null && detail.getHomeworkList().size() != 0) { 116 if (detail.getHomeworkList() != null && detail.getHomeworkList().size() != 0) {
115 int total = detail.getHomeworkList().size(); 117 int total = detail.getHomeworkList().size();
116 int correctNum = 0; 118 int correctNum = 0;
117 Set<KeyValue> correctSet = new HashSet<>(); 119 Set<KeyValue> correctSet = new HashSet<>();
118 Set<KeyValue> errorSet = new HashSet<>(); 120 Set<KeyValue> errorSet = new HashSet<>();
119 for (HomeWork homeWork: detail.getHomeworkList()) { 121 for (HomeWork homeWork: detail.getHomeworkList()) {
120 if (homeWork.correction == 0) { 122 if (homeWork.correction == 0) {
121 correctNum ++; 123 correctNum ++;
122 correctSet.addAll(homeWork.pointsObj); 124 correctSet.addAll(homeWork.pointsObj);
123 } else { 125 } else {
124 errorList.add(homeWork); 126 errorList.add(homeWork);
125 errorSet.addAll(homeWork.pointsObj); 127 errorSet.addAll(homeWork.pointsObj);
126 } 128 }
127 } 129 }
128 StringBuilder correctPoint = new StringBuilder(); 130 StringBuilder correctPoint = new StringBuilder();
129 StringBuilder errorPoint = new StringBuilder(); 131 StringBuilder errorPoint = new StringBuilder();
130 for (KeyValue point: correctSet) { 132 for (KeyValue point: correctSet) {
131 correctPoint.append("、").append(point.Value); 133 correctPoint.append("、").append(point.Value);
132 } 134 }
133 for (KeyValue point: errorSet) { 135 for (KeyValue point: errorSet) {
134 errorPoint.append("、").append(point.Value); 136 errorPoint.append("、").append(point.Value);
135 } 137 }
136 float rate = 100f * correctNum / total; 138 float rate = 100f * correctNum / total;
137 int errorNum = total - correctNum; 139 int errorNum = total - correctNum;
138 binding.tvPercent.setText(new DecimalFormat("0").format(rate)); 140 binding.tvPercent.setText(new DecimalFormat("0").format(rate));
139 binding.tvCorrect.setText(String.valueOf(correctNum)); 141 binding.tvCorrect.setText(String.valueOf(correctNum));
140 binding.tvWrong.setText(String.valueOf(errorNum)); 142 binding.tvWrong.setText(String.valueOf(errorNum));
141 143
142 String correct = "-", error = "-"; 144 String correct = "-", error = "-";
143 if (correctPoint.length() != 0) correct = correctPoint.substring(1); 145 if (correctPoint.length() != 0) correct = correctPoint.substring(1);
144 if (errorPoint.length() != 0) error = errorPoint.substring(1); 146 if (errorPoint.length() != 0) error = errorPoint.substring(1);
145 if (errorNum == 0) { 147 if (errorNum == 0) {
146 temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好。"; 148 temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好。";
147 String s = String.format(temp, 149 String s = String.format(temp,
148 fromColor(String.valueOf(correctNum), "#489afa"), 150 fromColor(String.valueOf(correctNum), "#489afa"),
149 fromColor(correct, "#489afa") 151 fromColor(correct, "#489afa")
150 ); 152 );
151 binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); 153 binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT));
152 } else { 154 } else {
153 String s = String.format(temp, 155 String s = String.format(temp,
154 fromColor(String.valueOf(correctNum), "#489afa"), 156 fromColor(String.valueOf(correctNum), "#489afa"),
155 fromColor(correct, "#489afa"), 157 fromColor(correct, "#489afa"),
156 fromColor(String.valueOf(errorNum), "#ff4134"), 158 fromColor(String.valueOf(errorNum), "#ff4134"),
157 fromColor(error, "#ff4134") 159 fromColor(error, "#ff4134")
158 ); 160 );
159 binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); 161 binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT));
160 } 162 }
161 } 163 }
162 164
163 mAdapter.setNewData(errorList); 165 mAdapter.setNewData(errorList);
164 } 166 }
165 167
166 private String fromColor(String str, String color) { 168 private String fromColor(String str, String color) {
167 return String.format("<font color='%s'>%s</font>", color, str); 169 return String.format("<font color='%s'>%s</font>", color, str);
168 } 170 }
169 171
170 @Override 172 @Override
171 protected ActivityHomeworkShareBinding getViewBinding() { 173 protected ActivityHomeworkShareBinding getViewBinding() {
172 return ActivityHomeworkShareBinding.inflate(getLayoutInflater()); 174 return ActivityHomeworkShareBinding.inflate(getLayoutInflater());
173 } 175 }
174 176
175 private Uri saveBitmap() { 177 private Uri saveBitmap() {
176 try { 178 try {
177 Bitmap bitmap = BitmapUtils.shotView(binding.viewRoot); 179 Bitmap bitmap = BitmapUtils.shotView(binding.viewRoot);
178 String fileName = student.stuName + "_" + title; 180 String fileName = student.stuName + "_" + title;
179 return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); 181 return ContentUtil.saveBitmapToGallery(this, bitmap, fileName);
180 } catch (Exception e) { 182 } catch (Exception e) {
181 e.printStackTrace(); 183 e.printStackTrace();
182 } 184 }
183 return null; 185 return null;
184 } 186 }
185 187
186 private static String ifEmpty(String s, String placeholder) { 188 private static String ifEmpty(String s, String placeholder) {
187 if (s == null || s.isEmpty()) return placeholder; 189 if (s == null || s.isEmpty()) return placeholder;
188 return s; 190 return s;
189 } 191 }
190 192
191 public static class ErrorAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { 193 public static class ErrorAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> {
192 194
193 public ErrorAdapter() { 195 public ErrorAdapter() {
194 super(R.layout.item_homework_error); 196 super(R.layout.item_homework_error);
195 } 197 }
196 198
197 @Override 199 @Override
198 protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { 200 protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) {
199 ImageView ivTopic = holder.getView(R.id.ivTopic); 201 ImageView ivTopic = holder.getView(R.id.ivTopic);
200 TextView tvPoints = holder.getView(R.id.tvPoints); 202 TextView tvPoints = holder.getView(R.id.tvPoints);
201 ImageView ivAnalyze = holder.getView(R.id.ivAnalyze); 203 ImageView ivAnalyze = holder.getView(R.id.ivAnalyze);
202 204
203 showImage(ivTopic, homeWork.url); 205 showImage(ivTopic, homeWork.url);
204 showImage(ivAnalyze, homeWork.analyseUrl); 206 showImage(ivAnalyze, homeWork.analyseUrl);
205 tvPoints.setText("-"); 207 tvPoints.setText("-");
206 if (homeWork.pointsObj == null || homeWork.pointsObj.isEmpty()) return; 208 if (homeWork.pointsObj == null || homeWork.pointsObj.isEmpty()) return;
207 StringBuilder builder = new StringBuilder(); 209 StringBuilder builder = new StringBuilder();
208 for (KeyValue pair: homeWork.pointsObj) { 210 for (KeyValue pair: homeWork.pointsObj) {
209 builder.append(pair.Value).append("\n"); 211 builder.append(pair.Value).append("\n");
210 } 212 }
211 tvPoints.setText(ifEmpty(builder.toString().trim(), "-")); 213 tvPoints.setText(ifEmpty(builder.toString().trim(), "-"));
212 } 214 }
213 215
214 @SuppressLint("CheckResult") 216 @SuppressLint("CheckResult")
215 private void showImage(ImageView view, String url) { 217 private void showImage(ImageView view, String url) {
216 view.setVisibility(View.GONE); 218 view.setVisibility(View.GONE);
217 view.setImageBitmap(null); 219 view.setImageBitmap(null);
218 if (url == null) { 220 if (url == null) {
219 return; 221 return;
220 } 222 }
221 Single.just(url) 223 Single.just(url)
222 .subscribeOn(Schedulers.io()) 224 .subscribeOn(Schedulers.io())
223 .map(u -> Glide.with(mContext).asBitmap().load(url).submit().get()) 225 .map(u -> Glide.with(mContext).asBitmap().load(url).submit().get())
224 .observeOn(AndroidSchedulers.mainThread()) 226 .observeOn(AndroidSchedulers.mainThread())
225 .subscribe((bitmap, th) -> { 227 .subscribe((bitmap, th) -> {
226 if (bitmap == null) return; 228 if (bitmap == null) return;
227 229
228 float imageHeight = bitmap.getHeight(); 230 float imageHeight = bitmap.getHeight();
229 float imageWidth = bitmap.getWidth(); 231 float imageWidth = bitmap.getWidth();
230 int viewHeight = (int) (CommonUtil.getScreenHeight(mContext) * 0.75f); 232 int viewHeight = (int) (CommonUtil.getScreenHeight(mContext) * 0.75f);
231 int viewWidth = (int) (CommonUtil.getScreenWidth(mContext) * 0.75f); 233 int viewWidth = (int) (CommonUtil.getScreenWidth(mContext) * 0.75f);
232 LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(view.getLayoutParams()); 234 LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(view.getLayoutParams());
233 if (imageHeight > imageWidth) { 235 if (imageHeight > imageWidth) {
234 if (viewHeight > imageHeight) { 236 if (viewHeight > imageHeight) {
235 layoutParams.height = (int) imageHeight; 237 layoutParams.height = (int) imageHeight;
236 layoutParams.width = (int) imageWidth; 238 layoutParams.width = (int) imageWidth;
237 } else { 239 } else {
238 layoutParams.height = viewHeight; 240 layoutParams.height = viewHeight;
239 layoutParams.width = (int) (imageWidth / imageHeight * viewHeight); 241 layoutParams.width = (int) (imageWidth / imageHeight * viewHeight);
240 } 242 }
241 } else { 243 } else {
242 if (viewWidth > imageWidth) { 244 if (viewWidth > imageWidth) {
243 layoutParams.height = (int) imageHeight; 245 layoutParams.height = (int) imageHeight;
244 layoutParams.width = (int) imageWidth; 246 layoutParams.width = (int) imageWidth;
245 } else { 247 } else {
246 layoutParams.height = (int) (imageHeight / imageWidth * viewWidth); 248 layoutParams.height = (int) (imageHeight / imageWidth * viewWidth);
247 layoutParams.width = viewWidth; 249 layoutParams.width = viewWidth;
248 } 250 }
249 } 251 }
250 252
251 layoutParams.setMargins(CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5)); 253 layoutParams.setMargins(CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5));
252 view.setLayoutParams(layoutParams); 254 view.setLayoutParams(layoutParams);
253 view.setImageBitmap(bitmap); 255 view.setImageBitmap(bitmap);
254 view.setVisibility(View.VISIBLE); 256 view.setVisibility(View.VISIBLE);
255 }); 257 });
256 } 258 }
257 } 259 }
258 } 260 }
259 261
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.hjx.parent.databinding.ActivityHuyouDetailBinding; 29 import com.hjx.parent.databinding.ActivityHuyouDetailBinding;
29 import com.hjx.parent.rx.BaseRxActivity; 30 import com.hjx.parent.rx.BaseRxActivity;
30 import com.prws.common.bean.Student; 31 import com.prws.common.bean.Student;
31 import com.prws.common.bean.homework.StDetail; 32 import com.prws.common.bean.homework.StDetail;
32 import com.prws.common.net.NetWorks; 33 import com.prws.common.net.NetWorks;
33 import com.prws.common.utils.BitmapUtils; 34 import com.prws.common.utils.BitmapUtils;
34 import com.prws.common.utils.ContentUtil; 35 import com.prws.common.utils.ContentUtil;
35 import com.trello.rxlifecycle2.android.RxLifecycleAndroid; 36 import com.trello.rxlifecycle2.android.RxLifecycleAndroid;
36 37
37 import java.text.DecimalFormat; 38 import java.text.DecimalFormat;
38 import java.text.SimpleDateFormat; 39 import java.text.SimpleDateFormat;
39 import java.util.ArrayList; 40 import java.util.ArrayList;
40 import java.util.Date; 41 import java.util.Date;
41 import java.util.List; 42 import java.util.List;
42 import java.util.Locale; 43 import java.util.Locale;
43 import java.util.TimeZone; 44 import java.util.TimeZone;
44 45
45 import io.reactivex.android.schedulers.AndroidSchedulers; 46 import io.reactivex.android.schedulers.AndroidSchedulers;
46 import io.reactivex.schedulers.Schedulers; 47 import io.reactivex.schedulers.Schedulers;
47 48
48 public class HuyouDetailActivity extends BaseRxActivity<ActivityHuyouDetailBinding> { 49 public class HuyouDetailActivity extends BaseRxActivity<ActivityHuyouDetailBinding> {
49 50
50 private String id; 51 private String id;
51 private int type; // 0:周 1:阶段 52 private int type; // 0:周 1:阶段
52 private Student student; 53 private Student student;
53 54
54 private StDetail mData; 55 private StDetail mData;
55 56
56 final String indent = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; 57 final String indent = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
57 58
58 private boolean a4 = false; 59 private boolean a4 = false;
59 60
60 @Override 61 @Override
61 protected void onResume() { 62 protected void onResume() {
62 super.onResume(); 63 super.onResume();
63 binding.root.postDelayed(() -> { 64 binding.root.postDelayed(() -> {
64 float scale = 1f * binding.getRoot().getWidth() / binding.root.getWidth(); 65 float scale = 1f * binding.getRoot().getWidth() / binding.root.getWidth();
65 if (scale >= 1) return; 66 if (scale >= 1) return;
66 binding.root.setScaleX(scale); 67 binding.root.setScaleX(scale);
67 binding.root.setScaleY(scale); 68 binding.root.setScaleY(scale);
68 }, 100); 69 }, 100);
69 } 70 }
70 71
71 @SuppressLint("CheckResult") 72 @SuppressLint("CheckResult")
72 @Override 73 @Override
73 public void initView(Bundle savedInstanceState) { 74 public void initView(Bundle savedInstanceState) {
75 ImmersionBar.with(this).init();
74 id = getIntent().getStringExtra("id"); 76 id = getIntent().getStringExtra("id");
75 type = getIntent().getIntExtra("type", 0); 77 type = getIntent().getIntExtra("type", 0);
76 student = (Student) getIntent().getSerializableExtra("student"); 78 student = (Student) getIntent().getSerializableExtra("student");
77 79
78 if (type == 1) binding.tvTitle.setText("阶段作业学习总结"); 80 if (type == 1) binding.tvTitle.setText("阶段作业学习总结");
79 81
80 Glide.with(this).load(student.photo).into(binding.ivAvatar); 82 Glide.with(this).load(student.photo).into(binding.ivAvatar);
81 binding.tvStuName.setText(student.stuName); 83 binding.tvStuName.setText(student.stuName);
82 84
83 setupChart(); 85 setupChart();
84 NetWorks.service_url.getHuyouDetail(NetWorks.getHeader(), id) 86 NetWorks.service_url.getHuyouDetail(NetWorks.getHeader(), id)
85 .subscribeOn(Schedulers.io()) 87 .subscribeOn(Schedulers.io())
86 .map(response -> response.getData()) 88 .map(response -> response.getData())
87 .map(data -> { 89 .map(data -> {
88 if (type == 1) data.formatCollection(); 90 if (type == 1) data.formatCollection();
89 return data; 91 return data;
90 }) 92 })
91 .observeOn(AndroidSchedulers.mainThread()) 93 .observeOn(AndroidSchedulers.mainThread())
92 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) 94 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle()))
93 .subscribe((data, th) -> { 95 .subscribe((data, th) -> {
94 mData = data; 96 mData = data;
95 if (th != null) th.printStackTrace(); 97 if (th != null) th.printStackTrace();
96 if (data != null) showData(data); 98 if (data != null) showData(data);
97 }); 99 });
98 100
99 binding.btnShare.setOnClickListener(v -> { 101 binding.btnShare.setOnClickListener(v -> {
100 Uri shareUri = prepareShare(); 102 Uri shareUri = prepareShare();
101 if (shareUri != null) { 103 if (shareUri != null) {
102 Intent shareIntent = new Intent(Intent.ACTION_SEND); 104 Intent shareIntent = new Intent(Intent.ACTION_SEND);
103 shareIntent.setType("image/jpeg"); 105 shareIntent.setType("image/jpeg");
104 shareIntent.putExtra(Intent.EXTRA_STREAM, shareUri); 106 shareIntent.putExtra(Intent.EXTRA_STREAM, shareUri);
105 shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); 107 shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
106 108
107 startActivity(shareIntent); 109 startActivity(shareIntent);
108 } 110 }
109 }); 111 });
110 112
111 binding.btnSwitch.setOnClickListener(v -> { 113 binding.btnSwitch.setOnClickListener(v -> {
112 switchPage(); 114 switchPage();
113 }); 115 });
114 116
115 } 117 }
116 118
117 private SimpleDateFormat getFormatWithGmt8(String pattern) { 119 private SimpleDateFormat getFormatWithGmt8(String pattern) {
118 SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.CHINA); 120 SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.CHINA);
119 format.setTimeZone(TimeZone.getTimeZone("GMT+16")); 121 format.setTimeZone(TimeZone.getTimeZone("GMT+16"));
120 return format; 122 return format;
121 } 123 }
122 124
123 @SuppressLint("SetTextI18n") 125 @SuppressLint("SetTextI18n")
124 private void showData(StDetail data) { 126 private void showData(StDetail data) {
125 binding.tvGrade.setText(data.grade); 127 binding.tvGrade.setText(data.grade);
126 binding.tvSubject.setText(data.homeworkSubject); 128 binding.tvSubject.setText(data.homeworkSubject);
127 String start = getFormatWithGmt8("yyyy.M.d").format(data.startTime); 129 String start = getFormatWithGmt8("yyyy.M.d").format(data.startTime);
128 String end = new SimpleDateFormat(" - M.d", Locale.CHINA).format(data.endTime); 130 String end = new SimpleDateFormat(" - M.d", Locale.CHINA).format(data.endTime);
129 binding.tvDate.setText(start + end); 131 binding.tvDate.setText(start + end);
130 132
131 if (data.points == null) data.points = new ArrayList<>(); 133 if (data.points == null) data.points = new ArrayList<>();
132 if (data.points.size() == 0) { 134 if (data.points.size() == 0) {
133 binding.cpBefore.setValue(0); 135 binding.cpBefore.setValue(0);
134 binding.cpAfter.setValue(0); 136 binding.cpAfter.setValue(0);
135 binding.pgBefore.setText("0"); 137 binding.pgBefore.setText("0");
136 binding.pgAfter.setText("0"); 138 binding.pgAfter.setText("0");
137 } else { 139 } else {
138 float before = 0; 140 float before = 0;
139 float after = 0; 141 float after = 0;
140 for (StDetail.Point point: data.points) { 142 for (StDetail.Point point: data.points) {
141 before += point.beforeState; 143 before += point.beforeState;
142 after += point.afterState; 144 after += point.afterState;
143 } 145 }
144 before = (int) (100f * before / data.points.size() + 0.5f); 146 before = (int) (100f * before / data.points.size() + 0.5f);
145 after = (int) (100f * after / data.points.size() + 0.5f); 147 after = (int) (100f * after / data.points.size() + 0.5f);
146 binding.cpBefore.setValue(before); 148 binding.cpBefore.setValue(before);
147 binding.cpAfter.setValue(after); 149 binding.cpAfter.setValue(after);
148 DecimalFormat format = new DecimalFormat("0"); 150 DecimalFormat format = new DecimalFormat("0");
149 binding.pgBefore.setText(format.format(before)); 151 binding.pgBefore.setText(format.format(before));
150 binding.pgAfter.setText(format.format(after)); 152 binding.pgAfter.setText(format.format(after));
151 153
152 String comment; 154 String comment;
153 if (after >= 90) { 155 if (after >= 90) {
154 comment = "知识点掌握的比较扎实,多练习多巩固掌握一般的知识点会有很大帮助。"; 156 comment = "知识点掌握的比较扎实,多练习多巩固掌握一般的知识点会有很大帮助。";
155 } else if (after >= 80) { 157 } else if (after >= 80) {
156 comment = "知识点掌握程度有进步,还要再继续学习,多练习,不断巩固。"; 158 comment = "知识点掌握程度有进步,还要再继续学习,多练习,不断巩固。";
157 } else if (after >= 60) { 159 } else if (after >= 60) {
158 comment = "薄弱知识点还有进步空间,再多做一些类似题目来巩固知识点,继续努力。"; 160 comment = "薄弱知识点还有进步空间,再多做一些类似题目来巩固知识点,继续努力。";
159 } else { 161 } else {
160 comment = "你的薄弱知识点还需要再深入了解,有不清楚的地方及时问老师,继续加油。"; 162 comment = "你的薄弱知识点还需要再深入了解,有不清楚的地方及时问老师,继续加油。";
161 } 163 }
162 String percent = new DecimalFormat("0%").format(after / 100); 164 String percent = new DecimalFormat("0%").format(after / 100);
163 String temp = indent + "通过学习,你的薄弱知识点掌握程度为 %s," + comment; 165 String temp = indent + "通过学习,你的薄弱知识点掌握程度为 %s," + comment;
164 temp = String.format(temp, fromColor(percent, "#F24E38")); 166 temp = String.format(temp, fromColor(percent, "#F24E38"));
165 binding.tvWeakRate.setText(Html.fromHtml(temp, Html.FROM_HTML_MODE_COMPACT)); 167 binding.tvWeakRate.setText(Html.fromHtml(temp, Html.FROM_HTML_MODE_COMPACT));
166 } 168 }
167 169
168 binding.tvTotalRate.setText(new DecimalFormat("0").format(100f * data.correct / data.total)); 170 binding.tvTotalRate.setText(new DecimalFormat("0").format(100f * data.correct / data.total));
169 binding.tvTotalCorrect.setText(String.valueOf(data.correct)); 171 binding.tvTotalCorrect.setText(String.valueOf(data.correct));
170 binding.tvTotalError.setText(String.valueOf(data.total - data.correct)); 172 binding.tvTotalError.setText(String.valueOf(data.total - data.correct));
171 if (data.total == 0) { 173 if (data.total == 0) {
172 binding.tvRating.setText(""); 174 binding.tvRating.setText("");
173 } else { 175 } else {
174 float rate = 100f * data.correct / data.total; 176 float rate = 100f * data.correct / data.total;
175 String comment; 177 String comment;
176 if (rate >= 90) { 178 if (rate >= 90) {
177 comment = "掌握程度比较优秀,你对知识的理解和运用能力非常强,这是你努力的结果。请继续保持这份优秀,在未来的学习中,可以继续挑战更难的题目,勇攀高峰。"; 179 comment = "掌握程度比较优秀,你对知识的理解和运用能力非常强,这是你努力的结果。请继续保持这份优秀,在未来的学习中,可以继续挑战更难的题目,勇攀高峰。";
178 } else if (rate >= 80) { 180 } else if (rate >= 80) {
179 comment = "掌握良好。接下来,跟随老师的学习规划,针对薄弱环节重点突破。加油,只要持之以恒,坚持下去,你一定会更加出色。"; 181 comment = "掌握良好。接下来,跟随老师的学习规划,针对薄弱环节重点突破。加油,只要持之以恒,坚持下去,你一定会更加出色。";
180 } else if (rate >= 60) { 182 } else if (rate >= 60) {
181 comment = "掌握程度一般。不过别灰心,你有提升的潜力。跟随老师的步伐,制定合理的学习计划,多做一些练习题来巩固知识。老师相信你一定可以做到。"; 183 comment = "掌握程度一般。不过别灰心,你有提升的潜力。跟随老师的步伐,制定合理的学习计划,多做一些练习题来巩固知识。老师相信你一定可以做到。";
182 } else { 184 } else {
183 comment = "掌握程度较为薄弱。但不要放弃,这正是你奋起直追的好时机。认真分析自己的问题,从基础开始逐步提升。老师会一直支持你,只要你有决心,就没有克服不了的困难。"; 185 comment = "掌握程度较为薄弱。但不要放弃,这正是你奋起直追的好时机。认真分析自己的问题,从基础开始逐步提升。老师会一直支持你,只要你有决心,就没有克服不了的困难。";
184 } 186 }
185 String rateStr = new DecimalFormat("0%").format(rate / 100f); 187 String rateStr = new DecimalFormat("0%").format(rate / 100f);
186 String temp; 188 String temp;
187 if (type == 0) { 189 if (type == 0) {
188 temp = indent + "在本周作业中,你的综合正确率是 %s," + comment; 190 temp = indent + "在本周作业中,你的综合正确率是 %s," + comment;
189 } else { 191 } else {
190 temp = indent + "你的综合正确率是 %s," + comment; 192 temp = indent + "你的综合正确率是 %s," + comment;
191 } 193 }
192 temp = String.format(temp, fromColor(rateStr, "#3BC3B6")); 194 temp = String.format(temp, fromColor(rateStr, "#3BC3B6"));
193 binding.tvRating.setText(Html.fromHtml(temp, Html.FROM_HTML_MODE_COMPACT)); 195 binding.tvRating.setText(Html.fromHtml(temp, Html.FROM_HTML_MODE_COMPACT));
194 } 196 }
195 197
196 List<Entry> entries = new ArrayList<>(); 198 List<Entry> entries = new ArrayList<>();
197 if (type == 0) { 199 if (type == 0) {
198 entries.add(new Entry(1, data.mondayCorrection)); 200 entries.add(new Entry(1, data.mondayCorrection));
199 entries.add(new Entry(2, data.tuesdayCorrection)); 201 entries.add(new Entry(2, data.tuesdayCorrection));
200 entries.add(new Entry(3, data.wednesdayCorrection)); 202 entries.add(new Entry(3, data.wednesdayCorrection));
201 entries.add(new Entry(4, data.thursdayCorrection)); 203 entries.add(new Entry(4, data.thursdayCorrection));
202 entries.add(new Entry(5, data.fridayCorrection)); 204 entries.add(new Entry(5, data.fridayCorrection));
203 } else { 205 } else {
204 for (int i = 0; i < data.correctionList.size(); i ++) { 206 for (int i = 0; i < data.correctionList.size(); i ++) {
205 StDetail.Correction c = data.correctionList.get(i); 207 StDetail.Correction c = data.correctionList.get(i);
206 entries.add(new Entry(i, c.correction)); 208 entries.add(new Entry(i, c.correction));
207 } 209 }
208 XAxis xAxis = binding.lineChart.getXAxis(); 210 XAxis xAxis = binding.lineChart.getXAxis();
209 xAxis.setLabelCount(Math.min(entries.size(), 5), true); 211 xAxis.setLabelCount(Math.min(entries.size(), 5), true);
210 xAxis.setValueFormatter(new ValueFormatter() { 212 xAxis.setValueFormatter(new ValueFormatter() {
211 SimpleDateFormat format = new SimpleDateFormat("M.d", Locale.CHINA); 213 SimpleDateFormat format = new SimpleDateFormat("M.d", Locale.CHINA);
212 @Override 214 @Override
213 public String getFormattedValue(float value) { 215 public String getFormattedValue(float value) {
214 int index = (int) value; 216 int index = (int) value;
215 if (index < 0 || index >= data.correctionList.size()) return ""; 217 if (index < 0 || index >= data.correctionList.size()) return "";
216 Date date = data.correctionList.get(index).date; 218 Date date = data.correctionList.get(index).date;
217 return format.format(date); 219 return format.format(date);
218 } 220 }
219 }); 221 });
220 } 222 }
221 223
222 LineDataSet set = new LineDataSet(entries, ""); 224 LineDataSet set = new LineDataSet(entries, "");
223 set.setColor(0xFF3BC3B6); 225 set.setColor(0xFF3BC3B6);
224 set.setCircleColor(0xFF3BC3B6); 226 set.setCircleColor(0xFF3BC3B6);
225 set.setDrawFilled(true); 227 set.setDrawFilled(true);
226 set.setDrawCircles(type == 0 || entries.size() == 1); 228 set.setDrawCircles(type == 0 || entries.size() == 1);
227 set.setDrawValues(false); 229 set.setDrawValues(false);
228 set.setHighlightEnabled(false); 230 set.setHighlightEnabled(false);
229 set.setDrawHighlightIndicators(false); 231 set.setDrawHighlightIndicators(false);
230 set.setFillDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.bg_line_chart_fill2, null)); 232 set.setFillDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.bg_line_chart_fill2, null));
231 binding.lineChart.setData(new LineData(set)); 233 binding.lineChart.setData(new LineData(set));
232 binding.lineChart.invalidate(); 234 binding.lineChart.invalidate();
233 235
234 if (!data.points.isEmpty()) { 236 if (!data.points.isEmpty()) {
235 int exNo = 0, goodNo = 0, normalNo = 0, weakNo = 0; 237 int exNo = 0, goodNo = 0, normalNo = 0, weakNo = 0;
236 float total = 0; 238 float total = 0;
237 for (StDetail.Point point: data.points) { 239 for (StDetail.Point point: data.points) {
238 total += point.afterState; 240 total += point.afterState;
239 if (point.afterState >= 0.9) { 241 if (point.afterState >= 0.9) {
240 exNo ++; 242 exNo ++;
241 } else if (point.afterState >= 0.8) { 243 } else if (point.afterState >= 0.8) {
242 goodNo ++; 244 goodNo ++;
243 } else if (point.afterState >= 0.6) { 245 } else if (point.afterState >= 0.6) {
244 normalNo ++; 246 normalNo ++;
245 } else { 247 } else {
246 weakNo ++; 248 weakNo ++;
247 } 249 }
248 } 250 }
249 binding.tvExcellent.setText(String.valueOf(exNo)); 251 binding.tvExcellent.setText(String.valueOf(exNo));
250 binding.tvGood.setText(String.valueOf(goodNo)); 252 binding.tvGood.setText(String.valueOf(goodNo));
251 binding.tvNormal.setText(String.valueOf(normalNo)); 253 binding.tvNormal.setText(String.valueOf(normalNo));
252 binding.tvWeak.setText(String.valueOf(weakNo)); 254 binding.tvWeak.setText(String.valueOf(weakNo));
253 255
254 float exRate = 100f * exNo / data.points.size(); 256 float exRate = 100f * exNo / data.points.size();
255 float goodRate = 100f * goodNo / data.points.size(); 257 float goodRate = 100f * goodNo / data.points.size();
256 float normalRate = 100f * normalNo / data.points.size(); 258 float normalRate = 100f * normalNo / data.points.size();
257 float weakRate = 100f * weakNo / data.points.size(); 259 float weakRate = 100f * weakNo / data.points.size();
258 binding.cpGood.setValue(goodRate + normalRate + weakRate); 260 binding.cpGood.setValue(goodRate + normalRate + weakRate);
259 binding.cpNormal.setValue(normalRate + weakRate); 261 binding.cpNormal.setValue(normalRate + weakRate);
260 binding.cpWeak.setValue(weakRate); 262 binding.cpWeak.setValue(weakRate);
261 binding.tvAvePoint.setText(new DecimalFormat("0").format(100f * total / data.points.size())); 263 binding.tvAvePoint.setText(new DecimalFormat("0").format(100f * total / data.points.size()));
262 } 264 }
263 265
264 List<StDetail.Point> points = new ArrayList<>(); 266 List<StDetail.Point> points = new ArrayList<>();
265 for (StDetail.Point point: data.points) { 267 for (StDetail.Point point: data.points) {
266 if (point.beforeState < 1) points.add(point); 268 if (point.beforeState < 1) points.add(point);
267 } 269 }
268 binding.tableRoot.setClipToOutline(true); 270 binding.tableRoot.setClipToOutline(true);
269 binding.rvPoint.setAdapter(new Adapter(points)); 271 binding.rvPoint.setAdapter(new Adapter(points));
270 binding.tableRoot.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); 272 binding.tableRoot.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE);
271 binding.flPointDesc.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE); 273 binding.flPointDesc.setVisibility(points.isEmpty() ? View.GONE : View.VISIBLE);
272 binding.flEmptyPoints.setVisibility(points.isEmpty() ? View.VISIBLE : View.GONE); 274 binding.flEmptyPoints.setVisibility(points.isEmpty() ? View.VISIBLE : View.GONE);
273 } 275 }
274 276
275 private void setupChart() { 277 private void setupChart() {
276 binding.lineChart.getLegend().setForm(Legend.LegendForm.NONE); 278 binding.lineChart.getLegend().setForm(Legend.LegendForm.NONE);
277 binding.lineChart.setScaleEnabled(false); 279 binding.lineChart.setScaleEnabled(false);
278 binding.lineChart.setTouchEnabled(false); 280 binding.lineChart.setTouchEnabled(false);
279 binding.lineChart.setDescription(null); 281 binding.lineChart.setDescription(null);
280 binding.lineChart.getAxisRight().setEnabled(false); 282 binding.lineChart.getAxisRight().setEnabled(false);
281 YAxis yAxis = binding.lineChart.getAxisLeft(); 283 YAxis yAxis = binding.lineChart.getAxisLeft();
282 yAxis.setDrawAxisLine(false); 284 yAxis.setDrawAxisLine(false);
283 yAxis.setDrawGridLines(true); 285 yAxis.setDrawGridLines(true);
284 yAxis.setGridColor(0xFFDDDDDD); 286 yAxis.setGridColor(0xFFDDDDDD);
285 yAxis.setTextColor(0xFF333333); 287 yAxis.setTextColor(0xFF333333);
286 if (type == 0) { 288 if (type == 0) {
287 yAxis.setTextSize(16); 289 yAxis.setTextSize(16);
288 yAxis.setXOffset(16); 290 yAxis.setXOffset(16);
289 } else { 291 } else {
290 yAxis.setTextSize(13); 292 yAxis.setTextSize(13);
291 } 293 }
292 yAxis.setAxisMinimum(0); 294 yAxis.setAxisMinimum(0);
293 yAxis.setAxisMaximum(1); 295 yAxis.setAxisMaximum(1);
294 yAxis.setLabelCount(5, true); 296 yAxis.setLabelCount(5, true);
295 yAxis.setValueFormatter(new ValueFormatter() { 297 yAxis.setValueFormatter(new ValueFormatter() {
296 @Override 298 @Override
297 public String getFormattedValue(float value) { 299 public String getFormattedValue(float value) {
298 return new DecimalFormat("0%").format(value); 300 return new DecimalFormat("0%").format(value);
299 } 301 }
300 }); 302 });
301 303
302 XAxis xAxis = binding.lineChart.getXAxis(); 304 XAxis xAxis = binding.lineChart.getXAxis();
303 xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); 305 xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
304 xAxis.setDrawAxisLine(false); 306 xAxis.setDrawAxisLine(false);
305 xAxis.setDrawGridLines(false); 307 xAxis.setDrawGridLines(false);
306 xAxis.setTextColor(0xFF333333); 308 xAxis.setTextColor(0xFF333333);
307 xAxis.setTextSize(16); 309 xAxis.setTextSize(16);
308 xAxis.setYOffset(16); 310 xAxis.setYOffset(16);
309 if (type == 0) { 311 if (type == 0) {
310 xAxis.setAxisMinimum(0.5f); 312 xAxis.setAxisMinimum(0.5f);
311 xAxis.setAxisMaximum(5.5f); 313 xAxis.setAxisMaximum(5.5f);
312 xAxis.setLabelCount(11, true); 314 xAxis.setLabelCount(11, true);
313 xAxis.setValueFormatter(new ValueFormatter() { 315 xAxis.setValueFormatter(new ValueFormatter() {
314 @Override 316 @Override
315 public String getFormattedValue(float value) { 317 public String getFormattedValue(float value) {
316 if (value == 1) { 318 if (value == 1) {
317 return "周一"; 319 return "周一";
318 } else if (value == 2) { 320 } else if (value == 2) {
319 return "周二"; 321 return "周二";
320 } else if (value == 3) { 322 } else if (value == 3) {
321 return "周三"; 323 return "周三";
322 } else if (value == 4) { 324 } else if (value == 4) {
323 return "周四"; 325 return "周四";
324 } else if (value == 5) { 326 } else if (value == 5) {
325 return "周五"; 327 return "周五";
326 } 328 }
327 return ""; 329 return "";
328 } 330 }
329 }); 331 });
330 } else { 332 } else {
331 xAxis.setTextSize(13); 333 xAxis.setTextSize(13);
332 } 334 }
333 } 335 }
334 336
335 private String fromColor(String str, String color) { 337 private String fromColor(String str, String color) {
336 return String.format("<font color='%s'><b>%s</b></font>", color, str); 338 return String.format("<font color='%s'><b>%s</b></font>", color, str);
337 } 339 }
338 340
339 private void switchPage() { 341 private void switchPage() {
340 Intent intent = new Intent(getIntent()); 342 Intent intent = new Intent(getIntent());
341 intent.putExtra("a4", !a4); 343 intent.putExtra("a4", !a4);
342 startActivity(intent); 344 startActivity(intent);
343 finish(); 345 finish();
344 } 346 }
345 347
346 private Uri prepareShare() { 348 private Uri prepareShare() {
347 try { 349 try {
348 binding.toolbar.setVisibility(View.INVISIBLE); 350 binding.toolbar.setVisibility(View.INVISIBLE);
349 Bitmap bitmap = BitmapUtils.shotView(binding.root); 351 Bitmap bitmap = BitmapUtils.shotView(binding.root);
350 binding.toolbar.setVisibility(View.VISIBLE); 352 binding.toolbar.setVisibility(View.VISIBLE);
351 353
352 String fileName = student.stuName + "_周作业学习报告_" + System.currentTimeMillis(); 354 String fileName = student.stuName + "_周作业学习报告_" + System.currentTimeMillis();
353 return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); 355 return ContentUtil.saveBitmapToGallery(this, bitmap, fileName);
354 } catch (Exception e) { 356 } catch (Exception e) {
355 e.printStackTrace(); 357 e.printStackTrace();
356 } 358 }
357 return null; 359 return null;
358 } 360 }
359 361
360 @Override 362 @Override
361 protected ActivityHuyouDetailBinding getViewBinding() { 363 protected ActivityHuyouDetailBinding getViewBinding() {
362 a4 = getIntent().getBooleanExtra("a4", false); 364 a4 = getIntent().getBooleanExtra("a4", false);
363 View view; 365 View view;
364 if (a4) view = getLayoutInflater().inflate(R.layout.activity_huyou_detail_a4, null); 366 if (a4) view = getLayoutInflater().inflate(R.layout.activity_huyou_detail_a4, null);
365 else view = getLayoutInflater().inflate(R.layout.activity_huyou_detail, null); 367 else view = getLayoutInflater().inflate(R.layout.activity_huyou_detail, null);
366 return ActivityHuyouDetailBinding.bind(view); 368 return ActivityHuyouDetailBinding.bind(view);
367 } 369 }
368 370
369 public static class Adapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> { 371 public static class Adapter extends BaseQuickAdapter<StDetail.Point, BaseViewHolder> {
370 372
371 public Adapter(@Nullable List<StDetail.Point> data) { 373 public Adapter(@Nullable List<StDetail.Point> data) {
372 super(R.layout.item_huyou_point, data); 374 super(R.layout.item_huyou_point, data);
373 } 375 }
374 376
375 @Override 377 @Override
376 protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) { 378 protected void convert(@NonNull BaseViewHolder holder, StDetail.Point point) {
377 DecimalFormat format1 = new DecimalFormat("0%"); 379 DecimalFormat format1 = new DecimalFormat("0%");
378 DecimalFormat format2 = new DecimalFormat("0"); 380 DecimalFormat format2 = new DecimalFormat("0");
379 holder.setText(R.id.tvName, point.pointName); 381 holder.setText(R.id.tvName, point.pointName);
380 holder.setText(R.id.tvBefore, format1.format(point.beforeState)); 382 holder.setText(R.id.tvBefore, format1.format(point.beforeState));
381 holder.setText(R.id.tvAfter, format1.format(point.afterState)); 383 holder.setText(R.id.tvAfter, format1.format(point.afterState));
382 holder.setText(R.id.tvGap, format2.format(point.gap * 100)); 384 holder.setText(R.id.tvGap, format2.format(point.gap * 100));
383 holder.setGone(R.id.ivFlag, getData().indexOf(point) == 0); 385 holder.setGone(R.id.ivFlag, getData().indexOf(point) == 0);
384 holder.<TextView>getView(R.id.tvName).setTooltipText(point.pointName); 386 holder.<TextView>getView(R.id.tvName).setTooltipText(point.pointName);
385 387
386 TextView before = holder.getView(R.id.tvBeforeState); 388 TextView before = holder.getView(R.id.tvBeforeState);
387 TextView after = holder.getView(R.id.tvAfterState); 389 TextView after = holder.getView(R.id.tvAfterState);
388 390
389 if (point.beforeState >= 0.9) { 391 if (point.beforeState >= 0.9) {
390 before.setText("掌握优秀"); 392 before.setText("掌握优秀");
391 before.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); 393 before.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A));
392 } else if (point.beforeState >= 0.8) { 394 } else if (point.beforeState >= 0.8) {
393 before.setText("掌握良好"); 395 before.setText("掌握良好");
394 before.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); 396 before.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA));
395 } else if (point.beforeState >= 0.6) { 397 } else if (point.beforeState >= 0.6) {
396 before.setText("掌握一般"); 398 before.setText("掌握一般");
397 before.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); 399 before.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725));
398 } else { 400 } else {
399 before.setText("掌握薄弱"); 401 before.setText("掌握薄弱");
400 before.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); 402 before.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127));
401 } 403 }
402 if (point.afterState >= 0.9) { 404 if (point.afterState >= 0.9) {
403 after.setText("掌握优秀"); 405 after.setText("掌握优秀");
404 after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A)); 406 after.setBackgroundTintList(ColorStateList.valueOf(0xFF4FBB7A));
405 } else if (point.afterState >= 0.8) { 407 } else if (point.afterState >= 0.8) {
406 after.setText("掌握良好"); 408 after.setText("掌握良好");
407 after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA)); 409 after.setBackgroundTintList(ColorStateList.valueOf(0xFF489AFA));
408 } else if (point.afterState >= 0.6) { 410 } else if (point.afterState >= 0.6) {
409 after.setText("掌握一般"); 411 after.setText("掌握一般");
410 after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725)); 412 after.setBackgroundTintList(ColorStateList.valueOf(0xFFF58725));
411 } else { 413 } else {
412 after.setText("掌握薄弱"); 414 after.setText("掌握薄弱");
413 after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127)); 415 after.setBackgroundTintList(ColorStateList.valueOf(0xFFEA5127));
414 } 416 }
415 417
416 holder.setText(R.id.tvHuyou, format1.format(point.correctness)); 418 holder.setText(R.id.tvHuyou, format1.format(point.correctness));
417 } 419 }
418 420
419 } 421 }
420 422
421 } 423 }
422 424
app/src/main/res/layout/activity_homework_share.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout 2 <LinearLayout
3 xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:android="http://schemas.android.com/apk/res/android"
4 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:app="http://schemas.android.com/apk/res-auto"
5 xmlns:tools="http://schemas.android.com/tools" 5 xmlns:tools="http://schemas.android.com/tools"
6 android:orientation="vertical" 6 android:orientation="vertical"
7 android:background="@drawable/bg_service" 7 android:background="@drawable/bg_service"
8 android:layout_width="match_parent" 8 android:layout_width="match_parent"
9 android:layout_height="match_parent" 9 android:layout_height="match_parent"
10 tools:ignore="HardcodedText,ContentDescription"> 10 tools:ignore="HardcodedText,ContentDescription">
11 11
12 <androidx.appcompat.widget.Toolbar 12 <androidx.appcompat.widget.Toolbar
13 app:contentInsetStart="0px" 13 app:contentInsetStart="0px"
14 android:paddingTop="16dp"
14 android:layout_width="match_parent" 15 android:layout_width="match_parent"
15 android:layout_height="70dp"> 16 android:layout_height="70dp">
16 <androidx.appcompat.widget.AppCompatImageView 17 <androidx.appcompat.widget.AppCompatImageView
17 android:id="@+id/btnBack" 18 android:id="@+id/btnBack"
18 android:tint="@color/white" 19 android:tint="@color/white"
19 android:src="@drawable/svg_arrow_head_start_black" 20 android:src="@drawable/svg_arrow_head_start_black"
20 android:layout_width="48dp" 21 android:layout_width="48dp"
21 android:layout_height="wrap_content"/> 22 android:layout_height="wrap_content"/>
22 23
23 <TextView 24 <TextView
24 android:id="@+id/tvTitle" 25 android:id="@+id/tvTitle"
25 android:text="-" 26 android:text="-"
26 android:textSize="20sp" 27 android:textSize="20sp"
27 android:textColor="@color/white" 28 android:textColor="@color/white"
28 android:textStyle="bold" 29 android:textStyle="bold"
29 android:layout_gravity="center" 30 android:layout_gravity="center"
30 android:layout_width="wrap_content" 31 android:layout_width="wrap_content"
31 android:layout_height="wrap_content"/> 32 android:layout_height="wrap_content"/>
32 33
33 <TextView 34 <TextView
34 android:id="@+id/btnShare" 35 android:id="@+id/btnShare"
35 android:text="分享" 36 android:text="分享"
36 android:textSize="15sp" 37 android:textSize="15sp"
37 android:textColor="@color/black" 38 android:textColor="@color/black"
38 android:paddingHorizontal="15dp" 39 android:paddingHorizontal="15dp"
39 android:paddingVertical="5dp" 40 android:paddingVertical="5dp"
40 android:background="@drawable/shape_circle" 41 android:background="@drawable/shape_circle"
41 android:backgroundTint="#FCDC28" 42 android:backgroundTint="#FCDC28"
42 android:layout_marginEnd="25dp" 43 android:layout_marginEnd="25dp"
43 android:layout_width="wrap_content" 44 android:layout_width="wrap_content"
44 android:layout_height="wrap_content" 45 android:layout_height="wrap_content"
45 android:layout_gravity="end|center_vertical" /> 46 android:layout_gravity="end|center_vertical" />
46 </androidx.appcompat.widget.Toolbar> 47 </androidx.appcompat.widget.Toolbar>
47 48
48 <androidx.core.widget.NestedScrollView 49 <androidx.core.widget.NestedScrollView
49 android:layout_marginHorizontal="25dp" 50 android:layout_marginHorizontal="16dp"
50 android:layout_marginBottom="28dp"
51 android:layout_width="match_parent" 51 android:layout_width="match_parent"
52 android:layout_height="match_parent"> 52 android:layout_height="match_parent">
53 <LinearLayout 53 <LinearLayout
54 android:id="@+id/viewRoot" 54 android:id="@+id/viewRoot"
55 android:orientation="vertical" 55 android:orientation="vertical"
56 android:background="@drawable/bg_statistical_once_content" 56 android:background="@drawable/bg_statistical_once_content"
57 android:paddingVertical="8dp" 57 android:paddingVertical="8dp"
58 android:paddingHorizontal="16dp" 58 android:paddingHorizontal="16dp"
59 android:layout_marginBottom="16dp"
59 android:layout_width="match_parent" 60 android:layout_width="match_parent"
60 android:layout_height="wrap_content"> 61 android:layout_height="wrap_content">
61 <androidx.constraintlayout.utils.widget.ImageFilterView 62 <androidx.constraintlayout.utils.widget.ImageFilterView
62 android:id="@+id/ivAvatar" 63 android:id="@+id/ivAvatar"
63 app:round="888dp" 64 app:round="888dp"
64 android:background="#ddd" 65 android:background="#ddd"
65 android:layout_width="50dp" 66 android:layout_width="50dp"
66 android:layout_height="50dp" 67 android:layout_height="50dp"
67 android:layout_gravity="center_horizontal" 68 android:layout_gravity="center_horizontal"
68 android:layout_marginVertical="8dp"/> 69 android:layout_marginVertical="8dp"/>
69 <TextView 70 <TextView
70 android:id="@+id/tvName" 71 android:id="@+id/tvName"
71 android:text="-" 72 android:text="-"
72 android:textSize="20sp" 73 android:textSize="20sp"
73 android:textColor="#333" 74 android:textColor="#333"
74 android:textStyle="bold" 75 android:textStyle="bold"
75 android:layout_gravity="center_horizontal" 76 android:layout_gravity="center_horizontal"
76 android:layout_width="wrap_content" 77 android:layout_width="wrap_content"
77 android:layout_height="wrap_content" 78 android:layout_height="wrap_content"
78 android:layout_marginVertical="8dp"/> 79 android:layout_marginVertical="8dp"/>
79 <LinearLayout 80 <LinearLayout
80 android:layout_width="match_parent" 81 android:layout_width="match_parent"
81 android:layout_height="wrap_content" 82 android:layout_height="wrap_content"
82 android:layout_marginVertical="8dp"> 83 android:layout_marginVertical="8dp">
83 <TextView 84 <TextView
84 android:id="@+id/tvGrade" 85 android:id="@+id/tvGrade"
85 android:text="学员年级:-" 86 android:text="学员年级:-"
86 android:textSize="15sp" 87 android:textSize="15sp"
87 android:textColor="#333" 88 android:textColor="#333"
88 android:gravity="center_horizontal" 89 android:gravity="center_horizontal"
89 android:layout_width="0dp" 90 android:layout_width="0dp"
90 android:layout_height="wrap_content" 91 android:layout_height="wrap_content"
91 android:layout_weight="1"/> 92 android:layout_weight="1"/>
92 <TextView 93 <TextView
93 android:id="@+id/tvSubject" 94 android:id="@+id/tvSubject"
94 android:text="作业科目:-" 95 android:text="作业科目:-"
95 android:textSize="15sp" 96 android:textSize="15sp"
96 android:textColor="#333" 97 android:textColor="#333"
97 android:gravity="center_horizontal" 98 android:gravity="center_horizontal"
98 android:layout_width="0dp" 99 android:layout_width="0dp"
99 android:layout_height="wrap_content" 100 android:layout_height="wrap_content"
100 android:layout_weight="1"/> 101 android:layout_weight="1"/>
101 <TextView 102 <TextView
102 android:id="@+id/tvDate" 103 android:id="@+id/tvDate"
103 android:text="作业时间:-" 104 android:text="作业时间:-"
104 android:textSize="15sp" 105 android:textSize="15sp"
105 android:textColor="#333" 106 android:textColor="#333"
106 android:gravity="center_horizontal" 107 android:gravity="center_horizontal"
107 android:layout_width="0dp" 108 android:layout_width="0dp"
108 android:layout_height="wrap_content" 109 android:layout_height="wrap_content"
109 android:layout_weight="1"/> 110 android:layout_weight="1"/>
110 </LinearLayout> 111 </LinearLayout>
111 112
112 <TextView 113 <TextView
113 android:text="作业总评" 114 android:text="作业总评"
114 android:textSize="20sp" 115 android:textSize="20sp"
115 android:textStyle="bold" 116 android:textStyle="bold"
116 android:textColor="#333" 117 android:textColor="#333"
117 android:paddingStart="36dp" 118 android:paddingStart="36dp"
118 android:paddingEnd="0dp" 119 android:paddingEnd="0dp"
119 android:background="@drawable/bg_homework_eval" 120 android:background="@drawable/bg_homework_eval"
120 android:layout_width="wrap_content" 121 android:layout_width="wrap_content"
121 android:layout_height="wrap_content" 122 android:layout_height="wrap_content"
122 android:layout_marginTop="20dp"/> 123 android:layout_marginTop="20dp"/>
123 124
124 <androidx.constraintlayout.widget.ConstraintLayout 125 <androidx.constraintlayout.widget.ConstraintLayout
125 android:background="@drawable/shape_radius_5" 126 android:background="@drawable/shape_radius_5"
126 android:backgroundTint="#F4FAFF" 127 android:backgroundTint="#F4FAFF"
127 android:layout_width="match_parent" 128 android:layout_width="match_parent"
128 android:layout_height="80dp" 129 android:layout_height="80dp"
129 android:layout_marginTop="16dp"> 130 android:layout_marginTop="16dp">
130 <androidx.constraintlayout.widget.Guideline 131 <androidx.constraintlayout.widget.Guideline
131 android:id="@+id/guidVCenter" 132 android:id="@+id/guidVCenter"
132 android:orientation="horizontal" 133 android:orientation="horizontal"
133 app:layout_constraintGuide_percent="0.53" 134 app:layout_constraintGuide_percent="0.53"
134 android:layout_width="0dp" 135 android:layout_width="0dp"
135 android:layout_height="0dp"/> 136 android:layout_height="0dp"/>
136 <View 137 <View
137 android:id="@+id/line1" 138 android:id="@+id/line1"
138 android:background="#9ECAFC" 139 android:background="#9ECAFC"
139 android:layout_width="1dp" 140 android:layout_width="1dp"
140 android:layout_height="match_parent" 141 android:layout_height="match_parent"
141 android:layout_marginVertical="8dp" 142 android:layout_marginVertical="8dp"
142 app:layout_constraintStart_toStartOf="parent" 143 app:layout_constraintStart_toStartOf="parent"
143 app:layout_constraintEnd_toStartOf="@id/line2"/> 144 app:layout_constraintEnd_toStartOf="@id/line2"/>
144 <View 145 <View
145 android:id="@+id/line2" 146 android:id="@+id/line2"
146 android:background="#9ECAFC" 147 android:background="#9ECAFC"
147 android:layout_width="1dp" 148 android:layout_width="1dp"
148 android:layout_height="match_parent" 149 android:layout_height="match_parent"
149 android:layout_marginVertical="8dp" 150 android:layout_marginVertical="8dp"
150 app:layout_constraintStart_toEndOf="@id/line1" 151 app:layout_constraintStart_toEndOf="@id/line1"
151 app:layout_constraintEnd_toEndOf="parent"/> 152 app:layout_constraintEnd_toEndOf="parent"/>
152 153
153 <!-- 作业正确率 --> 154 <!-- 作业正确率 -->
154 155
155 <ImageView 156 <ImageView
156 android:id="@+id/ic1" 157 android:id="@+id/ic1"
157 android:src="@drawable/png_icon_statistical_accuracy" 158 android:src="@drawable/png_icon_statistical_accuracy"
158 android:layout_width="38sp" 159 android:layout_width="38sp"
159 android:layout_height="44sp" 160 android:layout_height="44sp"
160 app:layout_constraintTop_toTopOf="parent" 161 app:layout_constraintTop_toTopOf="parent"
161 app:layout_constraintBottom_toBottomOf="parent" 162 app:layout_constraintBottom_toBottomOf="parent"
162 app:layout_constraintStart_toStartOf="parent" 163 app:layout_constraintStart_toStartOf="parent"
163 app:layout_constraintEnd_toStartOf="@id/tx1" 164 app:layout_constraintEnd_toStartOf="@id/tx1"
164 app:layout_constraintHorizontal_chainStyle="packed"/> 165 app:layout_constraintHorizontal_chainStyle="packed"/>
165 <TextView 166 <TextView
166 android:id="@+id/tx1" 167 android:id="@+id/tx1"
167 android:text="作业正确率" 168 android:text="作业正确率"
168 android:textSize="15sp" 169 android:textSize="15sp"
169 android:textColor="#333" 170 android:textColor="#333"
170 android:textStyle="bold" 171 android:textStyle="bold"
171 android:layout_width="wrap_content" 172 android:layout_width="wrap_content"
172 android:layout_height="wrap_content" 173 android:layout_height="wrap_content"
173 android:layout_marginStart="14dp" 174 android:layout_marginStart="14dp"
174 app:layout_constraintTop_toTopOf="@id/guidVCenter" 175 app:layout_constraintTop_toTopOf="@id/guidVCenter"
175 app:layout_constraintStart_toEndOf="@id/ic1" 176 app:layout_constraintStart_toEndOf="@id/ic1"
176 app:layout_constraintEnd_toStartOf="@id/line1" 177 app:layout_constraintEnd_toStartOf="@id/line1"
177 app:layout_constraintHorizontal_chainStyle="packed"/> 178 app:layout_constraintHorizontal_chainStyle="packed"/>
178 <TextView 179 <TextView
179 android:id="@+id/tvPercent" 180 android:id="@+id/tvPercent"
180 android:text="-" 181 android:text="-"
181 android:textSize="25sp" 182 android:textSize="25sp"
182 android:textColor="#489AFA" 183 android:textColor="#489AFA"
183 android:textStyle="bold" 184 android:textStyle="bold"
184 android:layout_width="wrap_content" 185 android:layout_width="wrap_content"
185 android:layout_height="wrap_content" 186 android:layout_height="wrap_content"
186 android:layout_marginBottom="-2dp" 187 android:layout_marginBottom="-2dp"
187 app:layout_constraintBottom_toBottomOf="@id/guidVCenter" 188 app:layout_constraintBottom_toBottomOf="@id/guidVCenter"
188 app:layout_constraintStart_toStartOf="@id/tx1" 189 app:layout_constraintStart_toStartOf="@id/tx1"
189 app:layout_constraintEnd_toStartOf="@id/tv11" 190 app:layout_constraintEnd_toStartOf="@id/tv11"
190 app:layout_constraintHorizontal_chainStyle="packed"/> 191 app:layout_constraintHorizontal_chainStyle="packed"/>
191 <TextView 192 <TextView
192 android:id="@+id/tv11" 193 android:id="@+id/tv11"
193 android:text="%" 194 android:text="%"
194 android:textSize="15sp" 195 android:textSize="15sp"
195 android:textColor="#489AFA" 196 android:textColor="#489AFA"
196 android:textStyle="bold" 197 android:textStyle="bold"
197 android:layout_width="wrap_content" 198 android:layout_width="wrap_content"
198 android:layout_height="wrap_content" 199 android:layout_height="wrap_content"
199 app:layout_constraintBaseline_toBaselineOf="@id/tvPercent" 200 app:layout_constraintBaseline_toBaselineOf="@id/tvPercent"
200 app:layout_constraintStart_toEndOf="@id/tvPercent" 201 app:layout_constraintStart_toEndOf="@id/tvPercent"
201 app:layout_constraintEnd_toEndOf="@id/tx1" 202 app:layout_constraintEnd_toEndOf="@id/tx1"
202 app:layout_constraintHorizontal_chainStyle="packed"/> 203 app:layout_constraintHorizontal_chainStyle="packed"/>
203 204
204 <!-- 答对题数 --> 205 <!-- 答对题数 -->
205 206
206 <ImageView 207 <ImageView
207 android:id="@+id/ic2" 208 android:id="@+id/ic2"
208 android:src="@drawable/png_icon_statistical_correct" 209 android:src="@drawable/png_icon_statistical_correct"
209 android:layout_width="38sp" 210 android:layout_width="38sp"
210 android:layout_height="44sp" 211 android:layout_height="44sp"
211 app:layout_constraintTop_toTopOf="parent" 212 app:layout_constraintTop_toTopOf="parent"
212 app:layout_constraintBottom_toBottomOf="parent" 213 app:layout_constraintBottom_toBottomOf="parent"
213 app:layout_constraintStart_toStartOf="@id/line1" 214 app:layout_constraintStart_toStartOf="@id/line1"
214 app:layout_constraintEnd_toStartOf="@id/tx2" 215 app:layout_constraintEnd_toStartOf="@id/tx2"
215 app:layout_constraintHorizontal_chainStyle="packed"/> 216 app:layout_constraintHorizontal_chainStyle="packed"/>
216 <TextView 217 <TextView
217 android:id="@+id/tx2" 218 android:id="@+id/tx2"
218 android:text="答对题数" 219 android:text="答对题数"
219 android:textSize="15sp" 220 android:textSize="15sp"
220 android:textColor="#333" 221 android:textColor="#333"
221 android:textStyle="bold" 222 android:textStyle="bold"
222 android:layout_width="wrap_content" 223 android:layout_width="wrap_content"
223 android:layout_height="wrap_content" 224 android:layout_height="wrap_content"
224 android:layout_marginStart="14dp" 225 android:layout_marginStart="14dp"
225 app:layout_constraintTop_toTopOf="@id/guidVCenter" 226 app:layout_constraintTop_toTopOf="@id/guidVCenter"
226 app:layout_constraintStart_toEndOf="@id/ic2" 227 app:layout_constraintStart_toEndOf="@id/ic2"
227 app:layout_constraintEnd_toStartOf="@id/line2" 228 app:layout_constraintEnd_toStartOf="@id/line2"
228 app:layout_constraintHorizontal_chainStyle="packed"/> 229 app:layout_constraintHorizontal_chainStyle="packed"/>
229 <TextView 230 <TextView
230 android:id="@+id/tvCorrect" 231 android:id="@+id/tvCorrect"
231 android:text="-" 232 android:text="-"
232 android:textSize="25sp" 233 android:textSize="25sp"
233 android:textColor="#489AFA" 234 android:textColor="#489AFA"
234 android:textStyle="bold" 235 android:textStyle="bold"
235 android:layout_width="wrap_content" 236 android:layout_width="wrap_content"
236 android:layout_height="wrap_content" 237 android:layout_height="wrap_content"
237 android:layout_marginBottom="-2dp" 238 android:layout_marginBottom="-2dp"
238 app:layout_constraintBottom_toBottomOf="@id/guidVCenter" 239 app:layout_constraintBottom_toBottomOf="@id/guidVCenter"
239 app:layout_constraintStart_toStartOf="@id/tx2" 240 app:layout_constraintStart_toStartOf="@id/tx2"
240 app:layout_constraintEnd_toStartOf="@id/tv22" 241 app:layout_constraintEnd_toStartOf="@id/tv22"
241 app:layout_constraintHorizontal_chainStyle="packed"/> 242 app:layout_constraintHorizontal_chainStyle="packed"/>
242 <TextView 243 <TextView
243 android:id="@+id/tv22" 244 android:id="@+id/tv22"
244 android:text="道" 245 android:text="道"
245 android:textSize="15sp" 246 android:textSize="15sp"
246 android:textColor="#489AFA" 247 android:textColor="#489AFA"
247 android:textStyle="bold" 248 android:textStyle="bold"
248 android:layout_width="wrap_content" 249 android:layout_width="wrap_content"
249 android:layout_height="wrap_content" 250 android:layout_height="wrap_content"
250 app:layout_constraintBaseline_toBaselineOf="@id/tvCorrect" 251 app:layout_constraintBaseline_toBaselineOf="@id/tvCorrect"
251 app:layout_constraintStart_toEndOf="@id/tvCorrect" 252 app:layout_constraintStart_toEndOf="@id/tvCorrect"
252 app:layout_constraintEnd_toEndOf="@id/tx2" 253 app:layout_constraintEnd_toEndOf="@id/tx2"
253 app:layout_constraintHorizontal_chainStyle="packed"/> 254 app:layout_constraintHorizontal_chainStyle="packed"/>
254 255
255 <!-- 答错题数 --> 256 <!-- 答错题数 -->
256 257
257 <ImageView 258 <ImageView
258 android:id="@+id/ic3" 259 android:id="@+id/ic3"
259 android:src="@drawable/png_icon_statistical_wrong" 260 android:src="@drawable/png_icon_statistical_wrong"
260 android:layout_width="38sp" 261 android:layout_width="38sp"
261 android:layout_height="44sp" 262 android:layout_height="44sp"
262 app:layout_constraintTop_toTopOf="parent" 263 app:layout_constraintTop_toTopOf="parent"
263 app:layout_constraintBottom_toBottomOf="parent" 264 app:layout_constraintBottom_toBottomOf="parent"
264 app:layout_constraintStart_toStartOf="@id/line2" 265 app:layout_constraintStart_toStartOf="@id/line2"
265 app:layout_constraintEnd_toStartOf="@id/tx3" 266 app:layout_constraintEnd_toStartOf="@id/tx3"
266 app:layout_constraintHorizontal_chainStyle="packed"/> 267 app:layout_constraintHorizontal_chainStyle="packed"/>
267 <TextView 268 <TextView
268 android:id="@+id/tx3" 269 android:id="@+id/tx3"
269 android:text="答错题数" 270 android:text="答错题数"
270 android:textSize="15sp" 271 android:textSize="15sp"
271 android:textColor="#333" 272 android:textColor="#333"
272 android:textStyle="bold" 273 android:textStyle="bold"
273 android:layout_width="wrap_content" 274 android:layout_width="wrap_content"
274 android:layout_height="wrap_content" 275 android:layout_height="wrap_content"
275 android:layout_marginStart="14dp" 276 android:layout_marginStart="14dp"
276 app:layout_constraintTop_toTopOf="@id/guidVCenter" 277 app:layout_constraintTop_toTopOf="@id/guidVCenter"
277 app:layout_constraintStart_toEndOf="@id/ic3" 278 app:layout_constraintStart_toEndOf="@id/ic3"
278 app:layout_constraintEnd_toEndOf="parent" 279 app:layout_constraintEnd_toEndOf="parent"
279 app:layout_constraintHorizontal_chainStyle="packed"/> 280 app:layout_constraintHorizontal_chainStyle="packed"/>
280 <TextView 281 <TextView
281 android:id="@+id/tvWrong" 282 android:id="@+id/tvWrong"
282 android:text="-" 283 android:text="-"
283 android:textSize="25sp" 284 android:textSize="25sp"
284 android:textColor="#489AFA" 285 android:textColor="#489AFA"
285 android:textStyle="bold" 286 android:textStyle="bold"
286 android:layout_width="wrap_content" 287 android:layout_width="wrap_content"
287 android:layout_height="wrap_content" 288 android:layout_height="wrap_content"
288 android:layout_marginBottom="-2dp" 289 android:layout_marginBottom="-2dp"
289 app:layout_constraintBottom_toBottomOf="@id/guidVCenter" 290 app:layout_constraintBottom_toBottomOf="@id/guidVCenter"
290 app:layout_constraintStart_toStartOf="@id/tx3" 291 app:layout_constraintStart_toStartOf="@id/tx3"
291 app:layout_constraintEnd_toStartOf="@id/tv33" 292 app:layout_constraintEnd_toStartOf="@id/tv33"
292 app:layout_constraintHorizontal_chainStyle="packed"/> 293 app:layout_constraintHorizontal_chainStyle="packed"/>
293 <TextView 294 <TextView
294 android:id="@+id/tv33" 295 android:id="@+id/tv33"
295 android:text="道" 296 android:text="道"
296 android:textSize="15sp" 297 android:textSize="15sp"
297 android:textColor="#489AFA" 298 android:textColor="#489AFA"
298 android:textStyle="bold" 299 android:textStyle="bold"
299 android:layout_width="wrap_content" 300 android:layout_width="wrap_content"
300 android:layout_height="wrap_content" 301 android:layout_height="wrap_content"
301 app:layout_constraintBaseline_toBaselineOf="@id/tvWrong" 302 app:layout_constraintBaseline_toBaselineOf="@id/tvWrong"
302 app:layout_constraintStart_toEndOf="@id/tvWrong" 303 app:layout_constraintStart_toEndOf="@id/tvWrong"
303 app:layout_constraintEnd_toEndOf="@id/tx3" 304 app:layout_constraintEnd_toEndOf="@id/tx3"
304 app:layout_constraintHorizontal_chainStyle="packed"/> 305 app:layout_constraintHorizontal_chainStyle="packed"/>
305 </androidx.constraintlayout.widget.ConstraintLayout> 306 </androidx.constraintlayout.widget.ConstraintLayout>
306 307
307 <TextView 308 <TextView
308 android:id="@+id/tvRating" 309 android:id="@+id/tvRating"
309 android:text="-" 310 android:text="-"
310 android:textSize="18sp" 311 android:textSize="18sp"
311 android:textColor="#333" 312 android:textColor="#333"
312 android:lineSpacingMultiplier="1.3" 313 android:lineSpacingMultiplier="1.3"
313 android:layout_width="match_parent" 314 android:layout_width="match_parent"
314 android:layout_height="wrap_content" 315 android:layout_height="wrap_content"
315 android:layout_marginHorizontal="24dp" 316 android:layout_marginHorizontal="24dp"
316 android:layout_marginTop="48dp"/> 317 android:layout_marginTop="48dp"/>
317 318
318 <TextView 319 <TextView
319 android:text="作业错题" 320 android:text="作业错题"
320 android:textSize="20sp" 321 android:textSize="20sp"
321 android:textStyle="bold" 322 android:textStyle="bold"
322 android:textColor="#333" 323 android:textColor="#333"
323 android:paddingStart="36dp" 324 android:paddingStart="36dp"
324 android:paddingEnd="0dp" 325 android:paddingEnd="0dp"
325 android:background="@drawable/bg_homework_error" 326 android:background="@drawable/bg_homework_error"
326 android:layout_width="wrap_content" 327 android:layout_width="wrap_content"
327 android:layout_height="wrap_content" 328 android:layout_height="wrap_content"
328 android:layout_marginTop="64dp"/> 329 android:layout_marginTop="64dp"/>
329 330
330 <androidx.recyclerview.widget.RecyclerView 331 <androidx.recyclerview.widget.RecyclerView
331 android:id="@+id/rvWrong" 332 android:id="@+id/rvWrong"
332 android:orientation="vertical" 333 android:orientation="vertical"
333 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" 334 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
334 android:layout_marginTop="20dp" 335 android:layout_marginTop="20dp"
335 tools:listitem="@layout/item_homework_error" 336 tools:listitem="@layout/item_homework_error"
336 tools:itemCount="1" 337 tools:itemCount="1"
337 android:layout_width="match_parent" 338 android:layout_width="match_parent"
338 android:layout_height="wrap_content"/> 339 android:layout_height="wrap_content"/>
339 340
340 <LinearLayout 341 <LinearLayout
341 android:id="@+id/flComment" 342 android:id="@+id/flComment"
342 android:orientation="vertical" 343 android:orientation="vertical"
343 android:layout_width="match_parent" 344 android:layout_width="match_parent"
344 android:layout_height="wrap_content"> 345 android:layout_height="wrap_content">
345 346
346 <TextView 347 <TextView
347 android:text="教师评语" 348 android:text="教师评语"
348 android:textSize="20sp" 349 android:textSize="20sp"
349 android:textStyle="bold" 350 android:textStyle="bold"
350 android:textColor="#333" 351 android:textColor="#333"
351 android:paddingStart="36dp" 352 android:paddingStart="36dp"
352 android:paddingEnd="0dp" 353 android:paddingEnd="0dp"
353 android:background="@drawable/bg_homework_comment" 354 android:background="@drawable/bg_homework_comment"
354 android:layout_width="wrap_content" 355 android:layout_width="wrap_content"
355 android:layout_height="wrap_content" 356 android:layout_height="wrap_content"
356 android:layout_marginTop="32dp"/> 357 android:layout_marginTop="32dp"/>
357 358
358 <TextView 359 <TextView
359 android:id="@+id/tvComment" 360 android:id="@+id/tvComment"
360 android:text="-" 361 android:text="-"
361 android:textSize="18sp" 362 android:textSize="18sp"
362 android:textColor="#333" 363 android:textColor="#333"
363 android:lineSpacingMultiplier="1.3" 364 android:lineSpacingMultiplier="1.3"
364 android:layout_width="match_parent" 365 android:layout_width="match_parent"
365 android:layout_height="wrap_content" 366 android:layout_height="wrap_content"
366 android:layout_marginVertical="16dp"/> 367 android:layout_marginVertical="16dp"/>
367 368
368 </LinearLayout> 369 </LinearLayout>
369 </LinearLayout> 370 </LinearLayout>
370 </androidx.core.widget.NestedScrollView> 371 </androidx.core.widget.NestedScrollView>
371 372