Commit b5769c213db8e6f4438f32889036aa52d1257d08

Authored by shixianjie
1 parent 79ce9240dd
Exists in master

日报布局修改

.idea/deploymentTargetDropDown.xml
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <project version="4"> 2 <project version="4">
3 <component name="deploymentTargetDropDown"> 3 <component name="deploymentTargetDropDown">
4 <value> 4 <value>
5 <entry key="app"> 5 <entry key="app">
6 <State /> 6 <State>
7 <runningDeviceTargetSelectedWithDropDown>
8 <Target>
9 <type value="RUNNING_DEVICE_TARGET" />
10 <deviceKey>
11 <Key>
12 <type value="SERIAL_NUMBER" />
13 <value value="951f9ace" />
14 </Key>
15 </deviceKey>
16 </Target>
17 </runningDeviceTargetSelectedWithDropDown>
18 <timeTargetWasSelectedWithDropDown value="2024-10-11T03:19:45.857926300Z" />
19 </State>
7 </entry> 20 </entry>
8 </value> 21 </value>
9 </component> 22 </component>
10 </project> 23 </project>
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"/>
161 <activity android:name=".HuyouDetailActivity" /> 160 <activity android:name=".HuyouDetailActivity" />
162 161
163 <provider 162 <provider
164 android:name="androidx.core.content.FileProvider" 163 android:name="androidx.core.content.FileProvider"
165 android:authorities="com.hjx.parent.fileprovider" 164 android:authorities="com.hjx.parent.fileprovider"
166 android:exported="false" 165 android:exported="false"
167 android:grantUriPermissions="true" 166 android:grantUriPermissions="true"
168 tools:replace="android:authorities"> 167 tools:replace="android:authorities">
169 <meta-data 168 <meta-data
170 android:name="android.support.FILE_PROVIDER_PATHS" 169 android:name="android.support.FILE_PROVIDER_PATHS"
171 android:resource="@xml/file_provider_paths" 170 android:resource="@xml/file_provider_paths"
172 tools:replace="android:resource" /> 171 tools:replace="android:resource" />
173 </provider> 172 </provider>
174 </application> 173 </application>
175 174
176 </manifest> 175 </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.gyf.immersionbar.ImmersionBar;
21 import com.hjx.parent.databinding.ActivityHomeworkShareBinding; 21 import com.hjx.parent.databinding.ActivityHomeworkShareBinding;
22 import com.hjx.parent.dialog.PhotoViewDialog; 22 import com.hjx.parent.dialog.PhotoViewDialog;
23 import com.hjx.parent.rx.BaseRxActivity; 23 import com.hjx.parent.rx.BaseRxActivity;
24 import com.prws.common.bean.ResponseResult; 24 import com.prws.common.bean.ResponseResult;
25 import com.prws.common.bean.Student; 25 import com.prws.common.bean.Student;
26 import com.prws.common.bean.homework.HomeWork; 26 import com.prws.common.bean.homework.HomeWork;
27 import com.prws.common.bean.homework.HomeworkDetail; 27 import com.prws.common.bean.homework.HomeworkDetail;
28 import com.prws.common.bean.homework.KeyValue; 28 import com.prws.common.bean.homework.KeyValue;
29 import com.prws.common.net.NetWorks; 29 import com.prws.common.net.NetWorks;
30 import com.prws.common.utils.BitmapUtils; 30 import com.prws.common.utils.BitmapUtils;
31 import com.prws.common.utils.CommonUtil; 31 import com.prws.common.utils.CommonUtil;
32 import com.prws.common.utils.ContentUtil; 32 import com.prws.common.utils.ContentUtil;
33 33
34 import java.text.DecimalFormat; 34 import java.text.DecimalFormat;
35 import java.text.SimpleDateFormat; 35 import java.text.SimpleDateFormat;
36 import java.util.ArrayList; 36 import java.util.ArrayList;
37 import java.util.HashSet; 37 import java.util.HashSet;
38 import java.util.List; 38 import java.util.List;
39 import java.util.Locale; 39 import java.util.Locale;
40 import java.util.Set; 40 import java.util.Set;
41 41
42 import io.reactivex.Single; 42 import io.reactivex.Single;
43 import io.reactivex.android.schedulers.AndroidSchedulers; 43 import io.reactivex.android.schedulers.AndroidSchedulers;
44 import io.reactivex.schedulers.Schedulers; 44 import io.reactivex.schedulers.Schedulers;
45 45
46 public class HomeworkShareActivity extends BaseRxActivity<ActivityHomeworkShareBinding> { 46 public class HomeworkShareActivity extends BaseRxActivity<ActivityHomeworkShareBinding> {
47 private String id; 47 private String id;
48 48
49 String indent = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; 49 String indent = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
50 50
51 private String title; 51 private String title;
52 private Student student; 52 private Student student;
53 private ErrorAdapter mAdapter = new ErrorAdapter(); 53 private ErrorAdapter mAdapter = new ErrorAdapter();
54 54
55 private Uri shareUri; 55 private Uri shareUri;
56 56
57 @SuppressLint("SetTextI18n") 57 @SuppressLint("SetTextI18n")
58 @Override 58 @Override
59 public void initView(Bundle savedInstanceState) { 59 public void initView(Bundle savedInstanceState) {
60 ImmersionBar.with(this).init(); 60 ImmersionBar.with(this).init();
61 binding.btnBack.setOnClickListener(v -> onBackPressed()); 61 binding.btnBack.setOnClickListener(v -> onBackPressed());
62 binding.rvWrong.setAdapter(mAdapter); 62 binding.rvWrong.setAdapter(mAdapter);
63 mAdapter.setEmptyView(R.layout.empty_statistical_no_error, binding.rvWrong); 63 mAdapter.setEmptyView(R.layout.empty_statistical_no_error, binding.rvWrong);
64 64
65 id = getIntent().getStringExtra("id"); 65 id = getIntent().getStringExtra("id");
66 title = getIntent().getStringExtra("name"); 66 title = getIntent().getStringExtra("name");
67 binding.tvTitle.setText(title); 67 binding.tvTitle.setText(title);
68 student = (Student) getIntent().getSerializableExtra("student"); 68 student = (Student) getIntent().getSerializableExtra("student");
69 assert student != null; 69 assert student != null;
70 binding.tvName.setText(student.stuName); 70 binding.tvStuName.setText(student.stuName);
71 Glide.with(this).load(student.photo).centerCrop().error(R.mipmap.ic_avatar_male).into(binding.ivAvatar); 71 Glide.with(this).load(student.photo).centerCrop().error(R.mipmap.ic_avatar_male).into(binding.ivAvatar);
72 binding.tvGrade.setText("学员年级:" + getIntent().getStringExtra("grade")); 72 binding.tvGrade.setText(getIntent().getStringExtra("grade"));
73 binding.tvSubject.setText("作业科目:" + getIntent().getStringExtra("subject")); 73 binding.tvSubject.setText(getIntent().getStringExtra("subject"));
74 74
75 binding.btnShare.setOnClickListener(v -> { 75 binding.btnShare.setOnClickListener(v -> {
76 if (shareUri == null) shareUri = saveBitmap(); 76 if (shareUri == null) shareUri = saveBitmap();
77 if (shareUri != null) { 77 if (shareUri != null) {
78 Intent shareIntent = new Intent(Intent.ACTION_SEND); 78 Intent shareIntent = new Intent(Intent.ACTION_SEND);
79 shareIntent.setType("image/jpeg"); 79 shareIntent.setType("image/jpeg");
80 shareIntent.putExtra(Intent.EXTRA_STREAM, shareUri); 80 shareIntent.putExtra(Intent.EXTRA_STREAM, shareUri);
81 shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); 81 shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
82 82
83 startActivity(shareIntent); 83 startActivity(shareIntent);
84 } 84 }
85 }); 85 });
86 86
87 loadHomework(); 87 loadHomework();
88 } 88 }
89 89
90 @SuppressLint("CheckResult") 90 @SuppressLint("CheckResult")
91 private void loadHomework() { 91 private void loadHomework() {
92 NetWorks.service_url.getHomeworkCompleteDetail(NetWorks.getHeader(), student.stuId, id, true) 92 NetWorks.service_url.getHomeworkCompleteDetail(NetWorks.getHeader(), student.stuId, id, true)
93 .compose(transformSingle()) 93 .compose(transformSingle())
94 .map(ResponseResult::getData) 94 .map(ResponseResult::getData)
95 .map(data -> { 95 .map(data -> {
96 if (data.getHomeworkList() == null) return data; 96 if (data.getHomeworkList() == null) return data;
97 for (HomeWork homeWork: data.getHomeworkList()){ 97 for (HomeWork homeWork: data.getHomeworkList()){
98 homeWork.formatPoints(new Gson()); 98 homeWork.formatPoints(new Gson());
99 } 99 }
100 return data; 100 return data;
101 }) 101 })
102 .subscribe((data, th) -> { 102 .subscribe((data, th) -> {
103 if (th != null) th.printStackTrace(); 103 if (th != null) th.printStackTrace();
104 if (data != null) showHomework(data); 104 if (data != null) showHomework(data);
105 }); 105 });
106 } 106 }
107 @SuppressLint({"SetTextI18n", "DefaultLocale"}) 107 @SuppressLint({"SetTextI18n", "DefaultLocale"})
108 private void showHomework(HomeworkDetail detail) { 108 private void showHomework(HomeworkDetail detail) {
109 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); 109 SimpleDateFormat format = new SimpleDateFormat("yyyy.M.d", Locale.CHINA);
110 binding.tvDate.setText("作业时间:" + format.format(detail.getDate())); 110 binding.tvDate.setText(format.format(detail.getDate()));
111 binding.flComment.setVisibility(detail.getComment() == null || detail.getComment().isEmpty() ? View.INVISIBLE : View.VISIBLE); 111 binding.flComment.setVisibility(detail.getComment() == null || detail.getComment().isEmpty() ? View.INVISIBLE : View.VISIBLE);
112 binding.tvComment.setText(ifEmpty(detail.getComment(), "-")); 112 binding.tvComment.setText(ifEmpty(detail.getComment(), "-"));
113 binding.tvRating.setText("-"); 113 binding.tvRating.setText("-");
114 114
115 String temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好;答错题目有 %s 道,错题涵盖的知识点主要有%s,这部分还要再加强学习。错题老师已经帮你收录到错题本中,要记得复习整理错题,及时消灭薄弱知识点。"; 115 String temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好;答错题目有 %s 道,错题涵盖的知识点主要有%s,这部分还要再加强学习。错题老师已经帮你收录到错题本中,要记得复习整理错题,及时消灭薄弱知识点。";
116 List<HomeWork> errorList = new ArrayList<>(); 116 List<HomeWork> errorList = new ArrayList<>();
117 if (detail.getHomeworkList() != null && detail.getHomeworkList().size() != 0) { 117 if (detail.getHomeworkList() != null && detail.getHomeworkList().size() != 0) {
118 int total = detail.getHomeworkList().size(); 118 int total = detail.getHomeworkList().size();
119 int correctNum = 0; 119 int correctNum = 0;
120 Set<KeyValue> correctSet = new HashSet<>(); 120 Set<KeyValue> correctSet = new HashSet<>();
121 Set<KeyValue> errorSet = new HashSet<>(); 121 Set<KeyValue> errorSet = new HashSet<>();
122 for (HomeWork homeWork: detail.getHomeworkList()) { 122 for (HomeWork homeWork: detail.getHomeworkList()) {
123 if (homeWork.correction == 0) { 123 if (homeWork.correction == 0) {
124 correctNum ++; 124 correctNum ++;
125 correctSet.addAll(homeWork.pointsObj); 125 correctSet.addAll(homeWork.pointsObj);
126 } else { 126 } else {
127 errorList.add(homeWork); 127 errorList.add(homeWork);
128 errorSet.addAll(homeWork.pointsObj); 128 errorSet.addAll(homeWork.pointsObj);
129 } 129 }
130 } 130 }
131 StringBuilder correctPoint = new StringBuilder(); 131 StringBuilder correctPoint = new StringBuilder();
132 StringBuilder errorPoint = new StringBuilder(); 132 StringBuilder errorPoint = new StringBuilder();
133 for (KeyValue point: correctSet) { 133 for (KeyValue point: correctSet) {
134 correctPoint.append("、").append(point.Value); 134 correctPoint.append("、").append(point.Value);
135 } 135 }
136 for (KeyValue point: errorSet) { 136 for (KeyValue point: errorSet) {
137 errorPoint.append("、").append(point.Value); 137 errorPoint.append("、").append(point.Value);
138 } 138 }
139 float rate = 100f * correctNum / total; 139 float rate = 100f * correctNum / total;
140 int errorNum = total - correctNum; 140 int errorNum = total - correctNum;
141 binding.tvPercent.setText(new DecimalFormat("0").format(rate)); 141 binding.tvPercent.setText(new DecimalFormat("0").format(rate));
142 binding.tvCorrect.setText(String.valueOf(correctNum)); 142 binding.tvCorrect.setText(String.valueOf(correctNum));
143 binding.tvWrong.setText(String.valueOf(errorNum)); 143 binding.tvWrong.setText(String.valueOf(errorNum));
144 144
145 String correct = "-", error = "-"; 145 String correct = "-", error = "-";
146 if (correctPoint.length() != 0) correct = correctPoint.substring(1); 146 if (correctPoint.length() != 0) correct = correctPoint.substring(1);
147 if (errorPoint.length() != 0) error = errorPoint.substring(1); 147 if (errorPoint.length() != 0) error = errorPoint.substring(1);
148 if (errorNum == 0) { 148 if (errorNum == 0) {
149 temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好。"; 149 temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好。";
150 String s = String.format(temp, 150 String s = String.format(temp,
151 fromColor(String.valueOf(correctNum), "#489afa"), 151 fromColor(String.valueOf(correctNum), "#489afa"),
152 fromColor(correct, "#489afa") 152 fromColor(correct, "#489afa")
153 ); 153 );
154 binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); 154 binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT));
155 } else { 155 } else {
156 String s = String.format(temp, 156 String s = String.format(temp,
157 fromColor(String.valueOf(correctNum), "#489afa"), 157 fromColor(String.valueOf(correctNum), "#489afa"),
158 fromColor(correct, "#489afa"), 158 fromColor(correct, "#489afa"),
159 fromColor(String.valueOf(errorNum), "#ff4134"), 159 fromColor(String.valueOf(errorNum), "#ff4134"),
160 fromColor(error, "#ff4134") 160 fromColor(error, "#ff4134")
161 ); 161 );
162 binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); 162 binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT));
163 } 163 }
164 } 164 }
165 165
166 mAdapter.setNewData(errorList); 166 mAdapter.setNewData(errorList);
167 } 167 }
168 168
169 private String fromColor(String str, String color) { 169 private String fromColor(String str, String color) {
170 return String.format("<font color='%s'>%s</font>", color, str); 170 return String.format("<font color='%s'>%s</font>", color, str);
171 } 171 }
172 172
173 @Override 173 @Override
174 protected ActivityHomeworkShareBinding getViewBinding() { 174 protected ActivityHomeworkShareBinding getViewBinding() {
175 return ActivityHomeworkShareBinding.inflate(getLayoutInflater()); 175 return ActivityHomeworkShareBinding.inflate(getLayoutInflater());
176 } 176 }
177 177
178 private Uri saveBitmap() { 178 private Uri saveBitmap() {
179 try { 179 try {
180 // binding.toolbar.setVisibility(View.GONE);
180 Bitmap bitmap = BitmapUtils.shotView(binding.viewRoot); 181 Bitmap bitmap = BitmapUtils.shotView(binding.viewRoot);
182 // binding.toolbar.setVisibility(View.VISIBLE);
181 String fileName = student.stuName + "_" + title; 183 String fileName = student.stuName + "_" + title;
182 return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); 184 return ContentUtil.saveBitmapToGallery(this, bitmap, fileName);
183 } catch (Exception e) { 185 } catch (Exception e) {
184 e.printStackTrace(); 186 e.printStackTrace();
185 } 187 }
186 return null; 188 return null;
187 } 189 }
188 190
189 private static String ifEmpty(String s, String placeholder) { 191 private static String ifEmpty(String s, String placeholder) {
190 if (s == null || s.isEmpty()) return placeholder; 192 if (s == null || s.isEmpty()) return placeholder;
191 return s; 193 return s;
192 } 194 }
193 195
194 public static class ErrorAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { 196 public static class ErrorAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> {
195 197
196 public ErrorAdapter() { 198 public ErrorAdapter() {
197 super(R.layout.item_homework_error); 199 super(R.layout.item_homework_error);
198 } 200 }
199 201
200 @Override 202 @Override
201 protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { 203 protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) {
202 ImageView ivTopic = holder.getView(R.id.ivTopic); 204 ImageView ivTopic = holder.getView(R.id.ivTopic);
203 TextView tvPoints = holder.getView(R.id.tvPoints); 205 TextView tvPoints = holder.getView(R.id.tvPoints);
204 ImageView ivAnalyze = holder.getView(R.id.ivAnalyze); 206 ImageView ivAnalyze = holder.getView(R.id.ivAnalyze);
205 207
206 showImage(ivTopic, homeWork.url); 208 showImage(ivTopic, homeWork.url);
207 showImage(ivAnalyze, homeWork.analyseUrl); 209 showImage(ivAnalyze, homeWork.analyseUrl);
208 tvPoints.setText("-"); 210 tvPoints.setText("-");
209 if (homeWork.pointsObj == null || homeWork.pointsObj.isEmpty()) return; 211 if (homeWork.pointsObj == null || homeWork.pointsObj.isEmpty()) return;
210 StringBuilder builder = new StringBuilder(); 212 StringBuilder builder = new StringBuilder();
211 for (KeyValue pair: homeWork.pointsObj) { 213 for (KeyValue pair: homeWork.pointsObj) {
212 builder.append(pair.Value).append("\n"); 214 builder.append(pair.Value).append("\n");
213 } 215 }
214 tvPoints.setText(ifEmpty(builder.toString().trim(), "-")); 216 tvPoints.setText(ifEmpty(builder.toString().trim(), "-"));
215 } 217 }
216 218
217 @SuppressLint("CheckResult") 219 @SuppressLint("CheckResult")
218 private void showImage(ImageView view, String url) { 220 private void showImage(ImageView view, String url) {
219 view.setVisibility(View.GONE); 221 view.setVisibility(View.GONE);
220 view.setImageBitmap(null); 222 view.setImageBitmap(null);
221 if (url == null) { 223 if (url == null) {
222 return; 224 return;
223 } 225 }
224 view.setOnClickListener(v -> { 226 view.setOnClickListener(v -> {
225 new PhotoViewDialog(mContext).show(url); 227 new PhotoViewDialog(mContext).show(url);
226 }); 228 });
227 Single.just(url) 229 Single.just(url)
228 .subscribeOn(Schedulers.io()) 230 .subscribeOn(Schedulers.io())
229 .map(u -> Glide.with(mContext).asBitmap().load(url).submit().get()) 231 .map(u -> Glide.with(mContext).asBitmap().load(url).submit().get())
230 .observeOn(AndroidSchedulers.mainThread()) 232 .observeOn(AndroidSchedulers.mainThread())
231 .subscribe((bitmap, th) -> { 233 .subscribe((bitmap, th) -> {
232 if (bitmap == null) return; 234 if (bitmap == null) return;
233 235
234 float imageHeight = bitmap.getHeight(); 236 float imageHeight = bitmap.getHeight();
235 float imageWidth = bitmap.getWidth(); 237 float imageWidth = bitmap.getWidth();
236 int viewHeight = (int) (CommonUtil.getScreenHeight(mContext) * 0.75f); 238 int viewHeight = (int) (CommonUtil.getScreenHeight(mContext) * 0.75f);
237 int viewWidth = (int) (CommonUtil.getScreenWidth(mContext) * 0.75f); 239 int viewWidth = (int) (CommonUtil.getScreenWidth(mContext) * 0.75f);
238 LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(view.getLayoutParams()); 240 LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(view.getLayoutParams());
239 if (imageHeight > imageWidth) { 241 if (imageHeight > imageWidth) {
240 if (viewHeight > imageHeight) { 242 if (viewHeight > imageHeight) {
241 layoutParams.height = (int) imageHeight; 243 layoutParams.height = (int) imageHeight;
242 layoutParams.width = (int) imageWidth; 244 layoutParams.width = (int) imageWidth;
243 } else { 245 } else {
244 layoutParams.height = viewHeight; 246 layoutParams.height = viewHeight;
245 layoutParams.width = (int) (imageWidth / imageHeight * viewHeight); 247 layoutParams.width = (int) (imageWidth / imageHeight * viewHeight);
246 } 248 }
247 } else { 249 } else {
248 if (viewWidth > imageWidth) { 250 if (viewWidth > imageWidth) {
249 layoutParams.height = (int) imageHeight; 251 layoutParams.height = (int) imageHeight;
250 layoutParams.width = (int) imageWidth; 252 layoutParams.width = (int) imageWidth;
251 } else { 253 } else {
252 layoutParams.height = (int) (imageHeight / imageWidth * viewWidth); 254 layoutParams.height = (int) (imageHeight / imageWidth * viewWidth);
253 layoutParams.width = viewWidth; 255 layoutParams.width = viewWidth;
254 } 256 }
255 } 257 }
256 258
257 layoutParams.setMargins(CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5)); 259 layoutParams.setMargins(CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5));
258 view.setLayoutParams(layoutParams); 260 view.setLayoutParams(layoutParams);
259 view.setImageBitmap(bitmap); 261 view.setImageBitmap(bitmap);
260 view.setVisibility(View.VISIBLE); 262 view.setVisibility(View.VISIBLE);
261 }); 263 });
262 } 264 }
263 } 265 }
264 } 266 }
265 267
app/src/main/java/com/hjx/parent/StuHomeworkActivity.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.os.Bundle; 5 import android.os.Bundle;
6 import android.view.View; 6 import android.view.View;
7 import android.widget.LinearLayout; 7 import android.widget.LinearLayout;
8 import android.widget.PopupWindow; 8 import android.widget.PopupWindow;
9 9
10 import androidx.annotation.NonNull; 10 import androidx.annotation.NonNull;
11 import androidx.annotation.Nullable; 11 import androidx.annotation.Nullable;
12 import androidx.lifecycle.MutableLiveData; 12 import androidx.lifecycle.MutableLiveData;
13 13
14 import com.chad.library.adapter.base.BaseQuickAdapter; 14 import com.chad.library.adapter.base.BaseQuickAdapter;
15 import com.chad.library.adapter.base.BaseViewHolder; 15 import com.chad.library.adapter.base.BaseViewHolder;
16 import com.google.android.material.tabs.TabLayout; 16 import com.google.android.material.tabs.TabLayout;
17 import com.google.gson.Gson; 17 import com.google.gson.Gson;
18 import com.hjx.parent.adapter.HomeworkListAdapter; 18 import com.hjx.parent.adapter.HomeworkListAdapter;
19 import com.hjx.parent.databinding.ActivityStudentHomeworkBinding; 19 import com.hjx.parent.databinding.ActivityStudentHomeworkBinding;
20 import com.hjx.parent.databinding.PopupFilterFeedbackBinding; 20 import com.hjx.parent.databinding.PopupFilterFeedbackBinding;
21 import com.hjx.parent.databinding.PopupFilterGradeBinding; 21 import com.hjx.parent.databinding.PopupFilterGradeBinding;
22 import com.hjx.parent.databinding.PopupFilterSubjectBinding; 22 import com.hjx.parent.databinding.PopupFilterSubjectBinding;
23 import com.hjx.parent.databinding.PopupFilterTermBinding; 23 import com.hjx.parent.databinding.PopupFilterTermBinding;
24 import com.hjx.parent.dialog.MsgConfirmDialog; 24 import com.hjx.parent.dialog.MsgConfirmDialog;
25 import com.hjx.parent.dialog.StageHuyouDialog; 25 import com.hjx.parent.dialog.StageHuyouDialog;
26 import com.hjx.parent.function.Function1; 26 import com.hjx.parent.function.Function1;
27 import com.hjx.parent.rx.BaseRxActivity; 27 import com.hjx.parent.rx.BaseRxActivity;
28 import com.prws.common.bean.ResponseResult; 28 import com.prws.common.bean.ResponseResult;
29 import com.prws.common.bean.Student; 29 import com.prws.common.bean.Student;
30 import com.prws.common.bean.homework.HomeworkList; 30 import com.prws.common.bean.homework.HomeworkList;
31 import com.prws.common.bean.homework.StDetail; 31 import com.prws.common.bean.homework.StDetail;
32 import com.prws.common.net.NetWorks; 32 import com.prws.common.net.NetWorks;
33 import com.prws.common.utils.SharedPreferencesUtil; 33 import com.prws.common.utils.SharedPreferencesUtil;
34 import com.trello.rxlifecycle2.android.RxLifecycleAndroid; 34 import com.trello.rxlifecycle2.android.RxLifecycleAndroid;
35 35
36 import java.text.SimpleDateFormat; 36 import java.text.SimpleDateFormat;
37 import java.util.ArrayList; 37 import java.util.ArrayList;
38 import java.util.Calendar; 38 import java.util.Calendar;
39 import java.util.Collections; 39 import java.util.Collections;
40 import java.util.Date; 40 import java.util.Date;
41 import java.util.HashMap; 41 import java.util.HashMap;
42 import java.util.List; 42 import java.util.List;
43 import java.util.Locale; 43 import java.util.Locale;
44 import java.util.Map; 44 import java.util.Map;
45 45
46 import io.reactivex.Observable; 46 import io.reactivex.Observable;
47 import io.reactivex.android.schedulers.AndroidSchedulers; 47 import io.reactivex.android.schedulers.AndroidSchedulers;
48 import io.reactivex.schedulers.Schedulers; 48 import io.reactivex.schedulers.Schedulers;
49 49
50 public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkBinding> { 50 public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkBinding> {
51 51
52 private final HomeworkListAdapter homeworkAdapter = new HomeworkListAdapter(); 52 private final HomeworkListAdapter homeworkAdapter = new HomeworkListAdapter();
53 53
54 private final List<StDetail> mWeekList = new ArrayList<>(); 54 private final List<StDetail> mWeekList = new ArrayList<>();
55 private final List<StDetail> mStageList = new ArrayList<>(); 55 private final List<StDetail> mStageList = new ArrayList<>();
56 private final HuyouAdapter weekAdapter = new HuyouAdapter(mWeekList); 56 private final HuyouAdapter weekAdapter = new HuyouAdapter(mWeekList);
57 private final HuyouAdapter stageAdapter = new HuyouAdapter(mStageList); 57 private final HuyouAdapter stageAdapter = new HuyouAdapter(mStageList);
58 58
59 PopupWindow subjectFilter, gradeFilter, termFilter, feedbackFilter; 59 PopupWindow subjectFilter, gradeFilter, termFilter, feedbackFilter;
60 MsgConfirmDialog deleteDialog; 60 MsgConfirmDialog deleteDialog;
61 StageHuyouDialog stageHuyouDialog; 61 StageHuyouDialog stageHuyouDialog;
62 State state = new State(); 62 State state = new State();
63 63
64 private void handlerIntent() { 64 private void handlerIntent() {
65 String json = getIntent().getStringExtra("studentJson"); 65 String json = getIntent().getStringExtra("studentJson");
66 if (json == null) json = (String) SharedPreferencesUtil.getData("student", ""); 66 if (json == null) json = (String) SharedPreferencesUtil.getData("student", "");
67 try { state.student = new Gson().fromJson(json, Student.class); } 67 try { state.student = new Gson().fromJson(json, Student.class); }
68 catch (Throwable t) { t.printStackTrace(); } 68 catch (Throwable t) { t.printStackTrace(); }
69 } 69 }
70 70
71 @SuppressLint("SetTextI18n") 71 @SuppressLint("SetTextI18n")
72 @Override 72 @Override
73 public void initView(Bundle savedInstanceState) { 73 public void initView(Bundle savedInstanceState) {
74 handlerIntent(); 74 handlerIntent();
75 if (state.student == null) { 75 if (state.student == null) {
76 finish(); 76 finish();
77 return; 77 return;
78 } 78 }
79 binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); 79 binding.toolbar.setNavigationOnClickListener(v -> onBackPressed());
80 binding.tvTitle.setText(state.student.stuName + "的全部作业"); 80 binding.tvTitle.setText(state.student.stuName + "的全部作业");
81 setupTab(); 81 setupTab();
82 homeworkAdapter.setEmptyView(R.layout.empty_list_homework, binding.recyclerView); 82 homeworkAdapter.setEmptyView(R.layout.empty_list_homework, binding.recyclerView);
83 binding.recyclerView.setAdapter(homeworkAdapter); 83 binding.recyclerView.setAdapter(homeworkAdapter);
84 84
85 deleteDialog = new MsgConfirmDialog.Builder(this) 85 deleteDialog = new MsgConfirmDialog.Builder(this)
86 .setMessage("确认要删除吗?一旦删除不可恢复") 86 .setMessage("确认要删除吗?一旦删除不可恢复")
87 .setPositive("暂不删除") 87 .setPositive("暂不删除")
88 .setNegative("确定删除") 88 .setNegative("确定删除")
89 .build(); 89 .build();
90 90
91 binding.ftSubject.setOnClickListener(v -> showSubjectFilter()); 91 binding.ftSubject.setOnClickListener(v -> showSubjectFilter());
92 binding.ftGrade.setOnClickListener(v -> showGradeFilter()); 92 binding.ftGrade.setOnClickListener(v -> showGradeFilter());
93 binding.ftTerm.setOnClickListener(v -> showTermFilter()); 93 binding.ftTerm.setOnClickListener(v -> showTermFilter());
94 binding.ftFeedback.setOnClickListener(v -> showFeedbackFilter()); 94 binding.ftFeedback.setOnClickListener(v -> showFeedbackFilter());
95 homeworkAdapter.deleteCall = data -> { 95 homeworkAdapter.deleteCall = data -> {
96 deleteDialog.show(null, () -> { 96 deleteDialog.show(null, () -> {
97 deleteHomework(data); 97 deleteHomework(data);
98 return true; 98 return true;
99 }); 99 });
100 }; 100 };
101 homeworkAdapter.detailCall = data -> { 101 homeworkAdapter.detailCall = data -> {
102 if (data.getRight() == null) { 102 if (data.getRight() == null) {
103 Intent intent = new Intent(this, HomeworkDetailActivity.class); 103 Intent intent = new Intent(this, HomeworkDetailActivity.class);
104 intent.putExtra("data", data); 104 intent.putExtra("data", data);
105 intent.putExtra("student", state.student); 105 intent.putExtra("student", state.student);
106 startActivity(intent); 106 startActivity(intent);
107 } else { 107 } else {
108 Intent intent = new Intent(this, HomeworkShareActivity.class); 108 Intent intent = new Intent(this, HomeworkShareActivity.class);
109 intent.putExtra("student", state.student); 109 intent.putExtra("student", state.student);
110 intent.putExtra("id", data.getId()); 110 intent.putExtra("id", data.getId());
111 intent.putExtra("grade", data.getGrade()); 111 intent.putExtra("grade", data.getGrade());
112 intent.putExtra("subject", data.getSubject()); 112 intent.putExtra("subject", data.getSubject());
113 String name = new SimpleDateFormat("yyyy年M月d日作业", Locale.CHINA).format(data.uploadTime);
114 intent.putExtra("name", name);
113 startActivity(intent); 115 startActivity(intent);
114 } 116 }
115 }; 117 };
116 118
117 binding.btnChangeStudent.setOnClickListener(v -> { 119 binding.btnChangeStudent.setOnClickListener(v -> {
118 Intent intent = new Intent(this, TeacherChooseActivity.class); 120 Intent intent = new Intent(this, TeacherChooseActivity.class);
119 intent.putExtra("needBack", true); 121 intent.putExtra("needBack", true);
120 startActivityForResult(intent, 0xA01); 122 startActivityForResult(intent, 0xA01);
121 }); 123 });
122 124
123 binding.btnGeneralHuyou.setOnClickListener(v -> generalWeek()); 125 binding.btnGeneralHuyou.setOnClickListener(v -> generalWeek());
124 binding.btnStageHuyou.setOnClickListener(v -> { 126 binding.btnStageHuyou.setOnClickListener(v -> {
125 if (stageHuyouDialog == null) stageHuyouDialog = new StageHuyouDialog(this); 127 if (stageHuyouDialog == null) stageHuyouDialog = new StageHuyouDialog(this);
126 stageHuyouDialog.show(this::generalStage); 128 stageHuyouDialog.show(this::generalStage);
127 }); 129 });
128 130
129 weekAdapter.detailCall = data -> goHuyou(data, 0); 131 weekAdapter.detailCall = data -> goHuyou(data, 0);
130 stageAdapter.detailCall = data -> goHuyou(data, 1); 132 stageAdapter.detailCall = data -> goHuyou(data, 1);
131 weekAdapter.deleteCall = data -> { 133 weekAdapter.deleteCall = data -> {
132 deleteDialog.show(null, () -> { 134 deleteDialog.show(null, () -> {
133 deleteHuyou(data); 135 deleteHuyou(data);
134 return true; 136 return true;
135 }); 137 });
136 }; 138 };
137 stageAdapter.deleteCall = weekAdapter.deleteCall; 139 stageAdapter.deleteCall = weekAdapter.deleteCall;
138 140
139 getWeekHuyou(); 141 getWeekHuyou();
140 getStageHuyou(); 142 getStageHuyou();
141 } 143 }
142 144
143 private void goHuyou(StDetail data, int type) { 145 private void goHuyou(StDetail data, int type) {
144 Intent intent = new Intent(this, HuyouDetailActivity.class); 146 Intent intent = new Intent(this, HuyouDetailActivity.class);
145 intent.putExtra("id", data.id); 147 intent.putExtra("id", data.id);
146 intent.putExtra("type", type); 148 intent.putExtra("type", type);
147 intent.putExtra("student", state.student); 149 intent.putExtra("student", state.student);
148 startActivity(intent); 150 startActivity(intent);
149 } 151 }
150 152
151 @Override 153 @Override
152 protected void onStart() { 154 protected void onStart() {
153 super.onStart(); 155 super.onStart();
154 getHomework(); 156 getHomework();
155 } 157 }
156 158
157 @SuppressLint("SetTextI18n") 159 @SuppressLint("SetTextI18n")
158 @Override 160 @Override
159 protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { 161 protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
160 super.onActivityResult(requestCode, resultCode, data); 162 super.onActivityResult(requestCode, resultCode, data);
161 if (requestCode == 0xA01 && resultCode == RESULT_OK) { 163 if (requestCode == 0xA01 && resultCode == RESULT_OK) {
162 String json = (String) SharedPreferencesUtil.getData("student", ""); 164 String json = (String) SharedPreferencesUtil.getData("student", "");
163 try { 165 try {
164 state.student = new Gson().fromJson(json, Student.class); 166 state.student = new Gson().fromJson(json, Student.class);
165 binding.tvTitle.setText(state.student.stuName + "的全部作业"); 167 binding.tvTitle.setText(state.student.stuName + "的全部作业");
166 getHomework(); 168 getHomework();
167 getWeekHuyou(); 169 getWeekHuyou();
168 getStageHuyou(); 170 getStageHuyou();
169 } 171 }
170 catch (Throwable t) { t.printStackTrace(); } 172 catch (Throwable t) { t.printStackTrace(); }
171 } 173 }
172 } 174 }
173 175
174 private void setupTab() { 176 private void setupTab() {
175 binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每日作业")); 177 binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每日作业"));
176 binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每周总结")); 178 binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每周总结"));
177 binding.tabLayout.addTab(binding.tabLayout.newTab().setText("阶段性总结")); 179 binding.tabLayout.addTab(binding.tabLayout.newTab().setText("阶段性总结"));
178 binding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { 180 binding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
179 @Override 181 @Override
180 public void onTabSelected(TabLayout.Tab tab) { 182 public void onTabSelected(TabLayout.Tab tab) {
181 binding.filterBar.setVisibility(View.GONE); 183 binding.filterBar.setVisibility(View.GONE);
182 binding.weekBar.setVisibility(View.GONE); 184 binding.weekBar.setVisibility(View.GONE);
183 binding.stageBar.setVisibility(View.GONE); 185 binding.stageBar.setVisibility(View.GONE);
184 if (tab.getPosition() == 0) { //每日 186 if (tab.getPosition() == 0) { //每日
185 binding.filterBar.setVisibility(View.VISIBLE); 187 binding.filterBar.setVisibility(View.VISIBLE);
186 binding.recyclerView.setAdapter(homeworkAdapter); 188 binding.recyclerView.setAdapter(homeworkAdapter);
187 } else if (tab.getPosition() == 1) { //每周 189 } else if (tab.getPosition() == 1) { //每周
188 binding.weekBar.setVisibility(View.VISIBLE); 190 binding.weekBar.setVisibility(View.VISIBLE);
189 binding.recyclerView.setAdapter(weekAdapter); 191 binding.recyclerView.setAdapter(weekAdapter);
190 } else if (tab.getPosition() == 2) { //阶段 192 } else if (tab.getPosition() == 2) { //阶段
191 binding.stageBar.setVisibility(View.VISIBLE); 193 binding.stageBar.setVisibility(View.VISIBLE);
192 binding.recyclerView.setAdapter(stageAdapter); 194 binding.recyclerView.setAdapter(stageAdapter);
193 } 195 }
194 } 196 }
195 @Override 197 @Override
196 public void onTabUnselected(TabLayout.Tab tab) { 198 public void onTabUnselected(TabLayout.Tab tab) {
197 } 199 }
198 @Override 200 @Override
199 public void onTabReselected(TabLayout.Tab tab) { 201 public void onTabReselected(TabLayout.Tab tab) {
200 } 202 }
201 }); 203 });
202 } 204 }
203 205
204 @SuppressLint("CheckResult") 206 @SuppressLint("CheckResult")
205 protected void deleteHomework(HomeworkList data) { 207 protected void deleteHomework(HomeworkList data) {
206 NetWorks.service_url.deleteHomework(NetWorks.getHeader(), data.getId()) 208 NetWorks.service_url.deleteHomework(NetWorks.getHeader(), data.getId())
207 .subscribeOn(Schedulers.io()) 209 .subscribeOn(Schedulers.io())
208 .observeOn(AndroidSchedulers.mainThread()) 210 .observeOn(AndroidSchedulers.mainThread())
209 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) 211 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle()))
210 .subscribe((response, th) -> { 212 .subscribe((response, th) -> {
211 if (th != null) th.printStackTrace(); 213 if (th != null) th.printStackTrace();
212 if (response != null && response.getSuccess()) { 214 if (response != null && response.getSuccess()) {
213 getHomework(); 215 getHomework();
214 } 216 }
215 }); 217 });
216 218
217 } 219 }
218 220
219 @SuppressLint("CheckResult") 221 @SuppressLint("CheckResult")
220 protected void getHomework() { 222 protected void getHomework() {
221 NetWorks.service_url.getStudentHomework(NetWorks.getHeader(), state.student.stuId) 223 NetWorks.service_url.getStudentHomework(NetWorks.getHeader(), state.student.stuId)
222 .subscribeOn(Schedulers.io()) 224 .subscribeOn(Schedulers.io())
223 .observeOn(AndroidSchedulers.mainThread()) 225 .observeOn(AndroidSchedulers.mainThread())
224 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) 226 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle()))
225 .toObservable() 227 .toObservable()
226 .concatMap(response -> Observable.fromIterable(response.getData())) 228 .concatMap(response -> Observable.fromIterable(response.getData()))
227 // 过滤 229 // 过滤
228 .filter(data -> { // 学科 230 .filter(data -> { // 学科
229 String subject = state.subject.getValue(); 231 String subject = state.subject.getValue();
230 if (subject == null || subject.isEmpty()) return true; 232 if (subject == null || subject.isEmpty()) return true;
231 else return subject.equals(data.getSubject()); 233 else return subject.equals(data.getSubject());
232 }) 234 })
233 .filter(data -> { // 年级 235 .filter(data -> { // 年级
234 String grade = state.grade.getValue(); 236 String grade = state.grade.getValue();
235 if (grade == null || grade.isEmpty()) return true; 237 if (grade == null || grade.isEmpty()) return true;
236 else return grade.equals(data.getGrade()); 238 else return grade.equals(data.getGrade());
237 }) 239 })
238 .filter(data -> { // 学期 240 .filter(data -> { // 学期
239 String term = state.term.getValue(); 241 String term = state.term.getValue();
240 if (term == null || term.isEmpty()) return true; 242 if (term == null || term.isEmpty()) return true;
241 else return term.equals(data.getTerm()); 243 else return term.equals(data.getTerm());
242 }) 244 })
243 .filter(data -> { // 反馈 245 .filter(data -> { // 反馈
244 Integer feedback = state.feedback.getValue(); 246 Integer feedback = state.feedback.getValue();
245 if (feedback == null || feedback == 0) return true; 247 if (feedback == null || feedback == 0) return true;
246 else return (feedback == 1 && data.getRight() != null) || (feedback == 2 && data.getRight() == null); 248 else return (feedback == 1 && data.getRight() != null) || (feedback == 2 && data.getRight() == null);
247 }) 249 })
248 // 过滤完成, 收集 250 // 过滤完成, 收集
249 .toList() 251 .toList()
250 .subscribe((data, th) -> { 252 .subscribe((data, th) -> {
251 if (th != null) th.printStackTrace(); 253 if (th != null) th.printStackTrace();
252 if (data != null) { 254 if (data != null) {
253 Collections.sort(data); 255 Collections.sort(data);
254 } 256 }
255 homeworkAdapter.setNewData(data); 257 homeworkAdapter.setNewData(data);
256 }); 258 });
257 } 259 }
258 260
259 @SuppressLint({"CheckResult", "NotifyDataSetChanged"}) 261 @SuppressLint({"CheckResult", "NotifyDataSetChanged"})
260 private void getWeekHuyou() { 262 private void getWeekHuyou() {
261 NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 0) 263 NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 0)
262 .compose(transformSingle()) 264 .compose(transformSingle())
263 .map(ResponseResult::getData) 265 .map(ResponseResult::getData)
264 .subscribe((list, throwable) -> { 266 .subscribe((list, throwable) -> {
265 if (throwable != null) { 267 if (throwable != null) {
266 throwable.printStackTrace(); 268 throwable.printStackTrace();
267 return; 269 return;
268 } 270 }
269 if (list != null) { 271 if (list != null) {
270 mWeekList.clear(); 272 mWeekList.clear();
271 mWeekList.addAll(list); 273 mWeekList.addAll(list);
272 weekAdapter.notifyDataSetChanged(); 274 weekAdapter.notifyDataSetChanged();
273 275
274 boolean exist = false; 276 boolean exist = false;
275 int thisWeek = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR); 277 int thisWeek = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR);
276 for (StDetail bean: mWeekList) { 278 for (StDetail bean: mWeekList) {
277 Calendar other = Calendar.getInstance(); 279 Calendar other = Calendar.getInstance();
278 other.setTime(bean.endTime); 280 other.setTime(bean.endTime);
279 if (other.get(Calendar.WEEK_OF_YEAR) == thisWeek) { 281 if (other.get(Calendar.WEEK_OF_YEAR) == thisWeek) {
280 exist = true; 282 exist = true;
281 break; 283 break;
282 } 284 }
283 } 285 }
284 binding.btnGeneralHuyou.setVisibility(exist ? View.GONE : View.VISIBLE); 286 binding.btnGeneralHuyou.setVisibility(exist ? View.GONE : View.VISIBLE);
285 } 287 }
286 }); 288 });
287 } 289 }
288 290
289 @SuppressLint({"CheckResult", "NotifyDataSetChanged"}) 291 @SuppressLint({"CheckResult", "NotifyDataSetChanged"})
290 private void getStageHuyou() { 292 private void getStageHuyou() {
291 NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 1) 293 NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 1)
292 .compose(transformSingle()) 294 .compose(transformSingle())
293 .map(ResponseResult::getData) 295 .map(ResponseResult::getData)
294 .subscribe((list, throwable) -> { 296 .subscribe((list, throwable) -> {
295 if (throwable != null) { 297 if (throwable != null) {
296 throwable.printStackTrace(); 298 throwable.printStackTrace();
297 return; 299 return;
298 } 300 }
299 if (list != null) { 301 if (list != null) {
300 mStageList.clear(); 302 mStageList.clear();
301 mStageList.addAll(list); 303 mStageList.addAll(list);
302 stageAdapter.notifyDataSetChanged(); 304 stageAdapter.notifyDataSetChanged();
303 } 305 }
304 }); 306 });
305 } 307 }
306 308
307 @SuppressLint("CheckResult") 309 @SuppressLint("CheckResult")
308 private void generalWeek() { 310 private void generalWeek() {
309 showLoadingDialog("稍等..."); 311 showLoadingDialog("稍等...");
310 NetWorks.service_url.generalHuyou() 312 NetWorks.service_url.generalHuyou()
311 .compose(transformSingle()) 313 .compose(transformSingle())
312 .subscribe((response, throwable) -> { 314 .subscribe((response, throwable) -> {
313 cancelLoadingDialog(); 315 cancelLoadingDialog();
314 if (throwable != null) { 316 if (throwable != null) {
315 loadFail("失败"); 317 loadFail("失败");
316 throwable.printStackTrace(); 318 throwable.printStackTrace();
317 return; 319 return;
318 } 320 }
319 if (response != null && response.getSuccess()) { 321 if (response != null && response.getSuccess()) {
320 binding.btnGeneralHuyou.setVisibility(View.GONE); 322 binding.btnGeneralHuyou.setVisibility(View.GONE);
321 getWeekHuyou(); 323 getWeekHuyou();
322 } 324 }
323 }); 325 });
324 } 326 }
325 327
326 @SuppressLint("CheckResult") 328 @SuppressLint("CheckResult")
327 private void generalStage(Date startDate, Date endDate, String subject) { 329 private void generalStage(Date startDate, Date endDate, String subject) {
328 SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd HH:mm:ss", Locale.CHINA); 330 SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd HH:mm:ss", Locale.CHINA);
329 Map<String, Object> body = new HashMap<>(); 331 Map<String, Object> body = new HashMap<>();
330 body.put("stuId", state.student.stuId); 332 body.put("stuId", state.student.stuId);
331 body.put("startTime", format.format(startDate)); 333 body.put("startTime", format.format(startDate));
332 body.put("endTime", format.format(endDate)); 334 body.put("endTime", format.format(endDate));
333 body.put("subject", subject); 335 body.put("subject", subject);
334 showLoadingDialog("稍等..."); 336 showLoadingDialog("稍等...");
335 NetWorks.service_url.generalStageHuyou(NetWorks.getHeader(), body) 337 NetWorks.service_url.generalStageHuyou(NetWorks.getHeader(), body)
336 .subscribeOn(Schedulers.io()) 338 .subscribeOn(Schedulers.io())
337 .observeOn(AndroidSchedulers.mainThread()) 339 .observeOn(AndroidSchedulers.mainThread())
338 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) 340 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle()))
339 .subscribe((response, throwable) -> { 341 .subscribe((response, throwable) -> {
340 if (throwable != null) { 342 if (throwable != null) {
341 loadFail("失败"); 343 loadFail("失败");
342 throwable.printStackTrace(); 344 throwable.printStackTrace();
343 return; 345 return;
344 } 346 }
345 if (response.getSuccess()) { 347 if (response.getSuccess()) {
346 getStageHuyou(); 348 getStageHuyou();
347 cancelLoadingDialog(); 349 cancelLoadingDialog();
348 } else { 350 } else {
349 loadFail(response.getMsg()); 351 loadFail(response.getMsg());
350 } 352 }
351 }); 353 });
352 } 354 }
353 355
354 @SuppressLint("CheckResult") 356 @SuppressLint("CheckResult")
355 private void deleteHuyou(StDetail detail) { 357 private void deleteHuyou(StDetail detail) {
356 showLoadingDialog("稍等..."); 358 showLoadingDialog("稍等...");
357 NetWorks.service_url.deleteHuyou(NetWorks.getHeader(), detail.id) 359 NetWorks.service_url.deleteHuyou(NetWorks.getHeader(), detail.id)
358 .subscribeOn(Schedulers.io()) 360 .subscribeOn(Schedulers.io())
359 .observeOn(AndroidSchedulers.mainThread()) 361 .observeOn(AndroidSchedulers.mainThread())
360 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) 362 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle()))
361 .subscribe((response, throwable) -> { 363 .subscribe((response, throwable) -> {
362 cancelLoadingDialog(); 364 cancelLoadingDialog();
363 if (throwable != null) { 365 if (throwable != null) {
364 loadFail("失败"); 366 loadFail("失败");
365 throwable.printStackTrace(); 367 throwable.printStackTrace();
366 return; 368 return;
367 } 369 }
368 if (detail.type == 0) { 370 if (detail.type == 0) {
369 getWeekHuyou(); 371 getWeekHuyou();
370 } else { 372 } else {
371 getStageHuyou(); 373 getStageHuyou();
372 } 374 }
373 }); 375 });
374 } 376 }
375 377
376 private void showSubjectFilter() { 378 private void showSubjectFilter() {
377 if (subjectFilter == null) { 379 if (subjectFilter == null) {
378 PopupFilterSubjectBinding db = PopupFilterSubjectBinding.inflate(getLayoutInflater()); 380 PopupFilterSubjectBinding db = PopupFilterSubjectBinding.inflate(getLayoutInflater());
379 db.setLifecycleOwner(this); 381 db.setLifecycleOwner(this);
380 db.setState(state); 382 db.setState(state);
381 db.bg.setOnClickListener(v -> subjectFilter.dismiss()); 383 db.bg.setOnClickListener(v -> subjectFilter.dismiss());
382 subjectFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); 384 subjectFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
383 subjectFilter.setOutsideTouchable(true); 385 subjectFilter.setOutsideTouchable(true);
384 } 386 }
385 subjectFilter.showAsDropDown(binding.anchorView); 387 subjectFilter.showAsDropDown(binding.anchorView);
386 state.onFilter = i -> { 388 state.onFilter = i -> {
387 subjectFilter.dismiss(); 389 subjectFilter.dismiss();
388 String subject = state.subject.getValue(); 390 String subject = state.subject.getValue();
389 binding.ftSubject.setActivated(subject != null && !subject.isEmpty()); 391 binding.ftSubject.setActivated(subject != null && !subject.isEmpty());
390 binding.ftSubject.setText(subject == null || subject.isEmpty() ? "学科" : subject); 392 binding.ftSubject.setText(subject == null || subject.isEmpty() ? "学科" : subject);
391 getHomework(); 393 getHomework();
392 }; 394 };
393 } 395 }
394 396
395 private void showGradeFilter() { 397 private void showGradeFilter() {
396 if (gradeFilter == null) { 398 if (gradeFilter == null) {
397 PopupFilterGradeBinding db = PopupFilterGradeBinding.inflate(getLayoutInflater()); 399 PopupFilterGradeBinding db = PopupFilterGradeBinding.inflate(getLayoutInflater());
398 db.setLifecycleOwner(this); 400 db.setLifecycleOwner(this);
399 db.setState(state); 401 db.setState(state);
400 db.bg.setOnClickListener(v -> gradeFilter.dismiss()); 402 db.bg.setOnClickListener(v -> gradeFilter.dismiss());
401 gradeFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); 403 gradeFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
402 gradeFilter.setOutsideTouchable(true); 404 gradeFilter.setOutsideTouchable(true);
403 } 405 }
404 gradeFilter.showAsDropDown(binding.anchorView); 406 gradeFilter.showAsDropDown(binding.anchorView);
405 state.onFilter = i -> { 407 state.onFilter = i -> {
406 gradeFilter.dismiss(); 408 gradeFilter.dismiss();
407 String grade = state.grade.getValue(); 409 String grade = state.grade.getValue();
408 binding.ftGrade.setActivated(grade != null && !grade.isEmpty()); 410 binding.ftGrade.setActivated(grade != null && !grade.isEmpty());
409 binding.ftGrade.setText(grade == null || grade.isEmpty() ? "年级" : grade); 411 binding.ftGrade.setText(grade == null || grade.isEmpty() ? "年级" : grade);
410 412
411 getHomework(); 413 getHomework();
412 }; 414 };
413 } 415 }
414 416
415 private void showTermFilter() { 417 private void showTermFilter() {
416 if (termFilter == null) { 418 if (termFilter == null) {
417 PopupFilterTermBinding db = PopupFilterTermBinding.inflate(getLayoutInflater()); 419 PopupFilterTermBinding db = PopupFilterTermBinding.inflate(getLayoutInflater());
418 db.setLifecycleOwner(this); 420 db.setLifecycleOwner(this);
419 db.setState(state); 421 db.setState(state);
420 db.bg.setOnClickListener(v -> termFilter.dismiss()); 422 db.bg.setOnClickListener(v -> termFilter.dismiss());
421 termFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); 423 termFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
422 termFilter.setOutsideTouchable(true); 424 termFilter.setOutsideTouchable(true);
423 } 425 }
424 termFilter.showAsDropDown(binding.anchorView); 426 termFilter.showAsDropDown(binding.anchorView);
425 state.onFilter = i -> { 427 state.onFilter = i -> {
426 termFilter.dismiss(); 428 termFilter.dismiss();
427 String term = state.term.getValue(); 429 String term = state.term.getValue();
428 binding.ftTerm.setActivated(term != null && !term.isEmpty()); 430 binding.ftTerm.setActivated(term != null && !term.isEmpty());
429 binding.ftTerm.setText(term == null || term.isEmpty() ? "学期" : term); 431 binding.ftTerm.setText(term == null || term.isEmpty() ? "学期" : term);
430 432
431 getHomework(); 433 getHomework();
432 }; 434 };
433 } 435 }
434 436
435 private void showFeedbackFilter() { 437 private void showFeedbackFilter() {
436 if (feedbackFilter == null) { 438 if (feedbackFilter == null) {
437 PopupFilterFeedbackBinding db = PopupFilterFeedbackBinding.inflate(getLayoutInflater()); 439 PopupFilterFeedbackBinding db = PopupFilterFeedbackBinding.inflate(getLayoutInflater());
438 db.setLifecycleOwner(this); 440 db.setLifecycleOwner(this);
439 db.setState(state); 441 db.setState(state);
440 db.bg.setOnClickListener(v -> feedbackFilter.dismiss()); 442 db.bg.setOnClickListener(v -> feedbackFilter.dismiss());
441 feedbackFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); 443 feedbackFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
442 feedbackFilter.setOutsideTouchable(true); 444 feedbackFilter.setOutsideTouchable(true);
443 } 445 }
444 feedbackFilter.showAsDropDown(binding.anchorView); 446 feedbackFilter.showAsDropDown(binding.anchorView);
445 state.onFilter = i -> { 447 state.onFilter = i -> {
446 feedbackFilter.dismiss(); 448 feedbackFilter.dismiss();
447 int feedback = state.feedback.getValue().intValue(); 449 int feedback = state.feedback.getValue().intValue();
448 binding.ftFeedback.setActivated(feedback != 0); 450 binding.ftFeedback.setActivated(feedback != 0);
449 binding.ftFeedback.setText(feedback == 0 ? "反馈状态" : feedback == 1 ? "已反馈" : "未反馈"); 451 binding.ftFeedback.setText(feedback == 0 ? "反馈状态" : feedback == 1 ? "已反馈" : "未反馈");
450 452
451 getHomework(); 453 getHomework();
452 }; 454 };
453 } 455 }
454 456
455 @Override 457 @Override
456 protected ActivityStudentHomeworkBinding getViewBinding() { 458 protected ActivityStudentHomeworkBinding getViewBinding() {
457 return ActivityStudentHomeworkBinding.inflate(getLayoutInflater()); 459 return ActivityStudentHomeworkBinding.inflate(getLayoutInflater());
458 } 460 }
459 461
460 public static class State { 462 public static class State {
461 public Student student; 463 public Student student;
462 464
463 public Function1<Integer> onFilter = i -> { }; 465 public Function1<Integer> onFilter = i -> { };
464 466
465 public MutableLiveData<String> subject = new MutableLiveData<>(""); 467 public MutableLiveData<String> subject = new MutableLiveData<>("");
466 public void setSubject(String value) { 468 public void setSubject(String value) {
467 subject.setValue(value); 469 subject.setValue(value);
468 onFilter.invoke(1); 470 onFilter.invoke(1);
469 } 471 }
470 472
471 public MutableLiveData<String> grade = new MutableLiveData<>(""); 473 public MutableLiveData<String> grade = new MutableLiveData<>("");
472 public void setGrade(String value) { 474 public void setGrade(String value) {
473 grade.setValue(value); 475 grade.setValue(value);
474 onFilter.invoke(2); 476 onFilter.invoke(2);
475 } 477 }
476 478
477 public MutableLiveData<String> term = new MutableLiveData<>(""); 479 public MutableLiveData<String> term = new MutableLiveData<>("");
478 public void setTerm(String value) { 480 public void setTerm(String value) {
479 term.setValue(value); 481 term.setValue(value);
480 onFilter.invoke(3); 482 onFilter.invoke(3);
481 } 483 }
482 484
483 //0:全部, 1: 已反馈, 2:未反馈 485 //0:全部, 1: 已反馈, 2:未反馈
484 public MutableLiveData<Integer> feedback = new MutableLiveData<>(0); 486 public MutableLiveData<Integer> feedback = new MutableLiveData<>(0);
485 public void setFeedback(int value) { 487 public void setFeedback(int value) {
486 feedback.setValue(value); 488 feedback.setValue(value);
487 onFilter.invoke(4); 489 onFilter.invoke(4);
488 } 490 }
489 } 491 }
490 492
491 static class HuyouAdapter extends BaseQuickAdapter<StDetail, BaseViewHolder> { 493 static class HuyouAdapter extends BaseQuickAdapter<StDetail, BaseViewHolder> {
492 public Function1<StDetail> deleteCall; 494 public Function1<StDetail> deleteCall;
493 public Function1<StDetail> detailCall; 495 public Function1<StDetail> detailCall;
494 public Student student; 496 public Student student;
495 497
496 public HuyouAdapter(@Nullable List<StDetail> data) { 498 public HuyouAdapter(@Nullable List<StDetail> data) {
497 super(R.layout.item_homework_list, data); 499 super(R.layout.item_homework_list, data);
498 } 500 }
499 501
500 @SuppressLint("SetTextI18n,SimpleDateFormat") 502 @SuppressLint("SetTextI18n,SimpleDateFormat")
501 @Override 503 @Override
502 protected void convert(@NonNull BaseViewHolder holder, StDetail data) { 504 protected void convert(@NonNull BaseViewHolder holder, StDetail data) {
503 holder.setGone(R.id.tvFlag, false); 505 holder.setGone(R.id.tvFlag, false);
504 int subjectImg; 506 int subjectImg;
505 switch (data.homeworkSubject) { 507 switch (data.homeworkSubject) {
506 case "语文": 508 case "语文":
507 subjectImg = R.drawable.ic_chinese; 509 subjectImg = R.drawable.ic_chinese;
508 break; 510 break;
509 case "英语": 511 case "英语":
510 subjectImg = R.drawable.ic_english; 512 subjectImg = R.drawable.ic_english;
511 break; 513 break;
512 case "物理": 514 case "物理":
513 subjectImg = R.drawable.ic_physics; 515 subjectImg = R.drawable.ic_physics;
514 break; 516 break;
515 case "化学": 517 case "化学":
516 subjectImg = R.drawable.ic_chemistry; 518 subjectImg = R.drawable.ic_chemistry;
517 break; 519 break;
518 case "数学": 520 case "数学":
519 default: 521 default:
520 subjectImg = R.drawable.ic_math; 522 subjectImg = R.drawable.ic_math;
521 } 523 }
522 holder.setImageResource(R.id.ivSubject, subjectImg); 524 holder.setImageResource(R.id.ivSubject, subjectImg);
523 Date endDate = new Date(data.endTime.getTime() - 1000); 525 Date endDate = new Date(data.endTime.getTime() - 1000);
524 String startStr = new SimpleDateFormat("yyyy.M.d").format(data.startTime); 526 String startStr = new SimpleDateFormat("yyyy.M.d").format(data.startTime);
525 String endStr = new SimpleDateFormat("-M.d").format(endDate); 527 String endStr = new SimpleDateFormat("-M.d").format(endDate);
526 String typeStr = data.type == 0 ? "作业周总结" : "作业阶段性总结"; 528 String typeStr = data.type == 0 ? "作业周总结" : "作业阶段性总结";
527 String title = startStr + endStr + data.homeworkSubject + typeStr; 529 String title = startStr + endStr + data.homeworkSubject + typeStr;
528 holder.setText(R.id.tvName, title); 530 holder.setText(R.id.tvName, title);
529 holder.setText(R.id.tvGrade, data.grade); 531 holder.setText(R.id.tvGrade, data.grade);
530 View btnDelete = holder.getView(R.id.btnDelete); 532 View btnDelete = holder.getView(R.id.btnDelete);
531 View btnDetail = holder.getView(R.id.btnDetail); 533 View btnDetail = holder.getView(R.id.btnDetail);
532 btnDelete.setOnClickListener(v -> { 534 btnDelete.setOnClickListener(v -> {
533 if (deleteCall != null) deleteCall.invoke(data); 535 if (deleteCall != null) deleteCall.invoke(data);
534 }); 536 });
535 btnDetail.setOnClickListener(v -> { 537 btnDetail.setOnClickListener(v -> {
536 if (detailCall != null) detailCall.invoke(data); 538 if (detailCall != null) detailCall.invoke(data);
537 }); 539 });
538 } 540 }
539 541
540 private SimpleDateFormat getFormatWithGmt8(String pattern) { 542 private SimpleDateFormat getFormatWithGmt8(String pattern) {
541 SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.CHINA); 543 SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.CHINA);
542 //format.setTimeZone(TimeZone.getTimeZone("GMT+16")); 544 //format.setTimeZone(TimeZone.getTimeZone("GMT+16"));
543 return format; 545 return format;
544 } 546 }
545 } 547 }
546 548
547 } 549 }
548 550
app/src/main/res/drawable/bg_homework_comment.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 2 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
3 3
4 <item android:height="5dp" 4 <item android:height="2dp"
5 android:bottom="3dp"
5 android:gravity="bottom"> 6 android:gravity="bottom">
6 <shape> 7 <shape>
7 <corners android:radius="8dp"/> 8 <corners android:radius="8dp"/>
8 <solid android:color="#AAD1FF"/> 9 <solid android:color="#489AFA"/>
9 </shape> 10 </shape>
10 </item> 11 </item>
11 12
12 <item android:drawable="@drawable/png_icon_statistical_comment" 13 <item android:drawable="@drawable/png_icon_statistical_comment"
13 android:width="30dp" android:height="30dp" /> 14 android:gravity="bottom" android:bottom="4dp" android:start="4dp"
15 android:width="18dp" android:height="18dp" />
14 16
15 17
16 </layer-list> 18 </layer-list>
app/src/main/res/drawable/bg_homework_error.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 2 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
3 3
4 <item android:height="5dp" 4 <item android:height="2dp"
5 android:bottom="3dp"
5 android:gravity="bottom"> 6 android:gravity="bottom">
6 <shape> 7 <shape>
7 <corners android:radius="8dp"/> 8 <corners android:radius="8dp"/>
8 <solid android:color="#AAD1FF"/> 9 <solid android:color="#489AFA"/>
9 </shape> 10 </shape>
10 </item> 11 </item>
11 12
12 <item android:drawable="@drawable/png_icon_statistical_error" 13 <item android:drawable="@drawable/png_icon_statistical_error"
13 android:width="30dp" android:height="30dp" /> 14 android:gravity="bottom" android:bottom="4dp" android:start="4dp"
15 android:width="18dp" android:height="18dp" />
14 16
15 17
16 </layer-list> 18 </layer-list>
app/src/main/res/drawable/bg_homework_eval.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 2 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
3 3
4 <item android:height="5dp" 4 <item android:height="2dp"
5 android:bottom="3dp"
5 android:gravity="bottom"> 6 android:gravity="bottom">
6 <shape> 7 <shape>
7 <corners android:radius="8dp"/> 8 <corners android:radius="8dp"/>
8 <solid android:color="#AAD1FF"/> 9 <solid android:color="#489AFA"/>
9 </shape> 10 </shape>
10 </item> 11 </item>
11 12
12 <item android:drawable="@drawable/png_icon_statistical_evaluate" 13 <item android:drawable="@drawable/png_icon_statistical_evaluate"
13 android:width="30dp" android:height="30dp" /> 14 android:gravity="bottom" android:bottom="4dp" android:start="4dp"
15 android:width="18dp" android:height="18dp" />
14 16
15 17
16 </layer-list> 18 </layer-list>
app/src/main/res/drawable/png_iv_grade.png

5.4 KB

app/src/main/res/drawable/png_share_top.png

81 KB

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="#489AFA"
8 android:layout_width="match_parent" 8 android:layout_width="match_parent"
9 android:layout_height="match_parent" 9 android:layout_height="match_parent"
10 tools:ignore="HardcodedText,ContentDescription"> 10 tools:ignore="HardcodedText,ContentDescription">
11 11
12 <androidx.appcompat.widget.Toolbar
13 app:contentInsetStart="0px"
14 android:paddingTop="16dp"
15 android:layout_width="match_parent"
16 android:layout_height="70dp">
17 <androidx.appcompat.widget.AppCompatImageView
18 android:id="@+id/btnBack"
19 android:tint="@color/white"
20 android:src="@drawable/svg_arrow_head_start_black"
21 android:layout_width="48dp"
22 android:layout_height="wrap_content"/>
23
24 <TextView
25 android:id="@+id/tvTitle"
26 android:text="-"
27 android:textSize="20sp"
28 android:textColor="@color/white"
29 android:textStyle="bold"
30 android:layout_gravity="center"
31 android:layout_width="wrap_content"
32 android:layout_height="wrap_content"/>
33
34 <TextView
35 android:id="@+id/btnShare"
36 android:text="分享"
37 android:textSize="15sp"
38 android:textColor="@color/black"
39 android:paddingHorizontal="15dp"
40 android:paddingVertical="5dp"
41 android:background="@drawable/shape_circle"
42 android:backgroundTint="#FCDC28"
43 android:layout_marginEnd="25dp"
44 android:layout_width="wrap_content"
45 android:layout_height="wrap_content"
46 android:layout_gravity="end|center_vertical" />
47 </androidx.appcompat.widget.Toolbar>
48
49 <androidx.core.widget.NestedScrollView 12 <androidx.core.widget.NestedScrollView
50 android:layout_marginHorizontal="16dp"
51 android:layout_width="match_parent" 13 android:layout_width="match_parent"
52 android:layout_height="match_parent"> 14 android:layout_height="match_parent">
53 <LinearLayout 15 <LinearLayout
54 android:id="@+id/viewRoot" 16 android:id="@+id/viewRoot"
55 android:orientation="vertical" 17 android:orientation="vertical"
56 android:background="@drawable/bg_statistical_once_content"
57 android:paddingVertical="8dp"
58 android:paddingHorizontal="16dp" 18 android:paddingHorizontal="16dp"
59 android:layout_marginBottom="16dp" 19 android:paddingVertical="16dp"
20 android:background="#489AFA"
60 android:layout_width="match_parent" 21 android:layout_width="match_parent"
61 android:layout_height="wrap_content"> 22 android:layout_height="wrap_content">
62 <androidx.constraintlayout.utils.widget.ImageFilterView
63 android:id="@+id/ivAvatar"
64 app:round="888dp"
65 android:background="#ddd"
66 android:layout_width="50dp"
67 android:layout_height="50dp"
68 android:layout_gravity="center_horizontal"
69 android:layout_marginVertical="8dp"/>
70 <TextView
71 android:id="@+id/tvName"
72 android:text="-"
73 android:textSize="20sp"
74 android:textColor="#333"
75 android:textStyle="bold"
76 android:layout_gravity="center_horizontal"
77 android:layout_width="wrap_content"
78 android:layout_height="wrap_content"
79 android:layout_marginVertical="8dp"/>
80 <LinearLayout
81 android:layout_width="match_parent"
82 android:layout_height="wrap_content"
83 android:layout_marginVertical="8dp">
84 <TextView
85 android:id="@+id/tvGrade"
86 android:text="学员年级:-"
87 android:textSize="15sp"
88 android:textColor="#333"
89 android:gravity="center_horizontal"
90 android:layout_width="0dp"
91 android:layout_height="wrap_content"
92 android:layout_weight="1"/>
93 <TextView
94 android:id="@+id/tvSubject"
95 android:text="作业科目:-"
96 android:textSize="15sp"
97 android:textColor="#333"
98 android:gravity="center_horizontal"
99 android:layout_width="0dp"
100 android:layout_height="wrap_content"
101 android:layout_weight="1"/>
102 <TextView
103 android:id="@+id/tvDate"
104 android:text="作业时间:-"
105 android:textSize="15sp"
106 android:textColor="#333"
107 android:gravity="center_horizontal"
108 android:layout_width="0dp"
109 android:layout_height="wrap_content"
110 android:layout_weight="1"/>
111 </LinearLayout>
112
113 <TextView
114 android:text="作业总评"
115 android:textSize="20sp"
116 android:textStyle="bold"
117 android:textColor="#333"
118 android:paddingStart="36dp"
119 android:paddingEnd="0dp"
120 android:background="@drawable/bg_homework_eval"
121 android:layout_width="wrap_content"
122 android:layout_height="wrap_content"
123 android:layout_marginTop="20dp"/>
124 23
125 <androidx.constraintlayout.widget.ConstraintLayout 24 <androidx.appcompat.widget.Toolbar
126 android:background="@drawable/shape_radius_5" 25 android:id="@+id/toolbar"
127 android:backgroundTint="#F4FAFF" 26 app:contentInsetStart="0px"
128 android:layout_width="match_parent" 27 android:layout_width="match_parent"
129 android:layout_height="80dp" 28 android:layout_height="56dp">
130 android:layout_marginTop="16dp"> 29 <androidx.appcompat.widget.AppCompatImageView
131 <androidx.constraintlayout.widget.Guideline 30 android:id="@+id/btnBack"
132 android:id="@+id/guidVCenter" 31 android:tint="@color/white"
133 android:orientation="horizontal" 32 android:src="@drawable/svg_arrow_head_start_black"
134 app:layout_constraintGuide_percent="0.53" 33 android:paddingEnd="16dp"
135 android:layout_width="0dp"
136 android:layout_height="0dp"/>
137 <View
138 android:id="@+id/line1"
139 android:background="#9ECAFC"
140 android:layout_width="1dp"
141 android:layout_height="match_parent"
142 android:layout_marginVertical="8dp"
143 app:layout_constraintStart_toStartOf="parent"
144 app:layout_constraintEnd_toStartOf="@id/line2"/>
145 <View
146 android:id="@+id/line2"
147 android:background="#9ECAFC"
148 android:layout_width="1dp"
149 android:layout_height="match_parent"
150 android:layout_marginVertical="8dp"
151 app:layout_constraintStart_toEndOf="@id/line1"
152 app:layout_constraintEnd_toEndOf="parent"/>
153
154 <!-- 作业正确率 -->
155
156 <ImageView
157 android:id="@+id/ic1"
158 android:src="@drawable/png_icon_statistical_accuracy"
159 android:layout_width="38sp"
160 android:layout_height="44sp"
161 app:layout_constraintTop_toTopOf="parent"
162 app:layout_constraintBottom_toBottomOf="parent"
163 app:layout_constraintStart_toStartOf="parent"
164 app:layout_constraintEnd_toStartOf="@id/tx1"
165 app:layout_constraintHorizontal_chainStyle="packed"/>
166 <TextView
167 android:id="@+id/tx1"
168 android:text="作业正确率"
169 android:textSize="15sp"
170 android:textColor="#333"
171 android:textStyle="bold"
172 android:layout_width="wrap_content" 34 android:layout_width="wrap_content"
173 android:layout_height="wrap_content" 35 android:layout_height="wrap_content"/>
174 android:layout_marginStart="14dp" 36
175 app:layout_constraintTop_toTopOf="@id/guidVCenter"
176 app:layout_constraintStart_toEndOf="@id/ic1"
177 app:layout_constraintEnd_toStartOf="@id/line1"
178 app:layout_constraintHorizontal_chainStyle="packed"/>
179 <TextView 37 <TextView
180 android:id="@+id/tvPercent" 38 android:id="@+id/tvTitle"
181 android:text="-" 39 android:text="-"
182 android:textSize="25sp" 40 android:textSize="18sp"
183 android:textColor="#489AFA" 41 android:singleLine="true"
42 android:ellipsize="middle"
43 android:textColor="@color/white"
184 android:textStyle="bold" 44 android:textStyle="bold"
45 android:layout_gravity="center"
185 android:layout_width="wrap_content" 46 android:layout_width="wrap_content"
186 android:layout_height="wrap_content" 47 android:layout_height="wrap_content"/>
187 android:layout_marginBottom="-2dp" 48
188 app:layout_constraintBottom_toBottomOf="@id/guidVCenter"
189 app:layout_constraintStart_toStartOf="@id/tx1"
190 app:layout_constraintEnd_toStartOf="@id/tv11"
191 app:layout_constraintHorizontal_chainStyle="packed"/>
192 <TextView 49 <TextView
193 android:id="@+id/tv11" 50 android:id="@+id/btnShare"
194 android:text="%" 51 android:text="分享"
195 android:textSize="15sp" 52 android:textSize="15sp"
196 android:textColor="#489AFA" 53 android:textColor="@color/black"
197 android:textStyle="bold" 54 android:paddingHorizontal="15dp"
55 android:paddingVertical="5dp"
56 android:background="@drawable/shape_circle"
57 android:backgroundTint="#FCDC28"
198 android:layout_width="wrap_content" 58 android:layout_width="wrap_content"
199 android:layout_height="wrap_content" 59 android:layout_height="wrap_content"
200 app:layout_constraintBaseline_toBaselineOf="@id/tvPercent" 60 android:layout_gravity="end|center_vertical" />
201 app:layout_constraintStart_toEndOf="@id/tvPercent" 61 </androidx.appcompat.widget.Toolbar>
202 app:layout_constraintEnd_toEndOf="@id/tx1" 62
203 app:layout_constraintHorizontal_chainStyle="packed"/> 63 <ImageView
64 android:src="@drawable/png_share_top"
65 android:elevation="1dp"
66 android:layout_gravity="end"
67 android:layout_marginEnd="5dp"
68 android:layout_width="90dp"
69 android:layout_height="80dp"/>
204 70
205 <!-- 答对题数 --> 71 <LinearLayout
72 android:orientation="vertical"
73 android:background="@drawable/png_info_bg"
74 android:paddingHorizontal="16dp"
75 android:paddingVertical="16dp"
76 android:layout_marginTop="-70dp"
77 android:layout_width="match_parent"
78 android:layout_height="144dp">
79 <LinearLayout
80 android:orientation="horizontal"
81 android:layout_width="match_parent"
82 android:layout_height="wrap_content">
83 <androidx.constraintlayout.utils.widget.ImageFilterView
84 android:id="@+id/ivAvatar"
85 tools:background="#2491FF"
86 app:round="40dp"
87 android:layout_width="40dp"
88 android:layout_height="40dp"/>
89 <TextView
90 android:id="@+id/tvStuName"
91 tools:text="杨同学 "
92 android:textSize="14sp"
93 android:textColor="#333"
94 android:textStyle="bold"
95 android:layout_marginStart="8dp"
96 android:layout_gravity="center_vertical"
97 android:layout_width="wrap_content"
98 android:layout_height="wrap_content"/>
99 </LinearLayout>
100 <LinearLayout
101 android:orientation="horizontal"
102 android:background="@drawable/shape_radius_10"
103 android:backgroundTint="#F4FAFF"
104 android:layout_marginTop="12dp"
105 android:layout_width="match_parent"
106 android:layout_height="60dp">
107 <LinearLayout
108 android:orientation="vertical"
109 android:gravity="center"
110 android:layout_width="0dp"
111 android:layout_height="match_parent"
112 android:layout_weight="1">
113 <LinearLayout
114 android:paddingEnd="20dp"
115 android:gravity="center_vertical"
116 android:layout_width="wrap_content"
117 android:layout_height="wrap_content">
118 <ImageView
119 android:src="@drawable/png_iv_grade"
120 android:layout_marginEnd="5dp"
121 android:layout_width="16dp"
122 android:layout_height="14dp"/>
123 <TextView
124 android:text="年级"
125 android:textSize="12sp"
126 android:textColor="#333"
127 android:textStyle="bold"
128 android:layout_width="wrap_content"
129 android:layout_height="wrap_content"/>
130 </LinearLayout>
131 <TextView
132 android:id="@+id/tvGrade"
133 tools:text="七年级"
134 android:textSize="12sp"
135 android:textColor="#489AFA"
136 android:textStyle="bold"
137 android:layout_marginTop="8dp"
138 android:layout_width="wrap_content"
139 android:layout_height="wrap_content"/>
140 </LinearLayout>
141 <LinearLayout
142 android:orientation="vertical"
143 android:gravity="center"
144 android:layout_width="0dp"
145 android:layout_height="match_parent"
146 android:layout_weight="1">
147 <LinearLayout
148 android:paddingEnd="20dp"
149 android:gravity="center_vertical"
150 android:layout_width="wrap_content"
151 android:layout_height="wrap_content">
152 <ImageView
153 android:src="@drawable/png_iv_subject"
154 android:layout_marginEnd="5dp"
155 android:layout_width="16dp"
156 android:layout_height="14dp"/>
157 <TextView
158 android:text="学科"
159 android:textSize="12sp"
160 android:textColor="#333"
161 android:textStyle="bold"
162 android:layout_width="wrap_content"
163 android:layout_height="wrap_content"/>
164 </LinearLayout>
165 <TextView
166 android:id="@+id/tvSubject"
167 tools:text="数学"
168 android:textSize="12sp"
169 android:textColor="#489AFA"
170 android:textStyle="bold"
171 android:layout_marginTop="8dp"
172 android:layout_width="wrap_content"
173 android:layout_height="wrap_content"/>
174 </LinearLayout>
175 <LinearLayout
176 android:orientation="vertical"
177 android:gravity="center"
178 android:layout_width="0dp"
179 android:layout_height="match_parent"
180 android:layout_weight="1">
181 <LinearLayout
182 android:paddingEnd="20dp"
183 android:gravity="center_vertical"
184 android:layout_width="wrap_content"
185 android:layout_height="wrap_content">
186 <ImageView
187 android:src="@drawable/png_ic_during"
188 android:layout_marginEnd="5dp"
189 android:layout_width="14dp"
190 android:layout_height="13dp"/>
191 <TextView
192 android:text="周期"
193 android:textSize="12sp"
194 android:textColor="#333"
195 android:textStyle="bold"
196 android:layout_width="wrap_content"
197 android:layout_height="wrap_content"/>
198 </LinearLayout>
199 <TextView
200 android:id="@+id/tvDate"
201 tools:text="2024.09.01"
202 android:textSize="12sp"
203 android:textColor="#489AFA"
204 android:textStyle="bold"
205 android:layout_marginTop="8dp"
206 android:layout_width="wrap_content"
207 android:layout_height="wrap_content"/>
208 </LinearLayout>
209 </LinearLayout>
210 </LinearLayout>
206 211
207 <ImageView 212 <LinearLayout
208 android:id="@+id/ic2" 213 android:orientation="vertical"
209 android:src="@drawable/png_icon_statistical_correct" 214 android:background="@drawable/shape_radius_10"
210 android:layout_width="38sp" 215 android:backgroundTint="@color/white"
211 android:layout_height="44sp" 216 android:paddingHorizontal="16dp"
212 app:layout_constraintTop_toTopOf="parent" 217 android:paddingBottom="16dp"
213 app:layout_constraintBottom_toBottomOf="parent" 218 android:layout_marginTop="12dp"
214 app:layout_constraintStart_toStartOf="@id/line1" 219 android:layout_width="match_parent"
215 app:layout_constraintEnd_toStartOf="@id/tx2" 220 android:layout_height="wrap_content">
216 app:layout_constraintHorizontal_chainStyle="packed"/>
217 <TextView 221 <TextView
218 android:id="@+id/tx2" 222 android:text="作业总评"
219 android:text="答对题数" 223 android:textSize="16sp"
220 android:textSize="15sp"
221 android:textColor="#333"
222 android:textStyle="bold" 224 android:textStyle="bold"
225 android:textColor="#333"
226 android:paddingStart="24dp"
227 android:paddingEnd="4dp"
228 android:paddingTop="4dp"
229 android:background="@drawable/bg_homework_eval"
230 android:layout_gravity="center_horizontal"
231 android:layout_marginTop="12dp"
223 android:layout_width="wrap_content" 232 android:layout_width="wrap_content"
224 android:layout_height="wrap_content" 233 android:layout_height="wrap_content"/>
225 android:layout_marginStart="14dp" 234
226 app:layout_constraintTop_toTopOf="@id/guidVCenter" 235 <LinearLayout
227 app:layout_constraintStart_toEndOf="@id/ic2" 236 android:orientation="horizontal"
228 app:layout_constraintEnd_toStartOf="@id/line2" 237 android:background="@drawable/shape_radius_5"
229 app:layout_constraintHorizontal_chainStyle="packed"/> 238 android:backgroundTint="#F4FAFF"
239 android:layout_width="match_parent"
240 android:layout_height="80dp"
241 android:layout_marginTop="12dp">
242 <LinearLayout
243 android:orientation="vertical"
244 android:gravity="center"
245 android:layout_width="0dp"
246 android:layout_height="match_parent"
247 android:layout_weight="1">
248 <LinearLayout
249 android:orientation="horizontal"
250 android:gravity="center_vertical"
251 android:layout_width="wrap_content"
252 android:layout_height="wrap_content">
253 <ImageView
254 android:src="@drawable/png_icon_statistical_accuracy"
255 android:layout_width="12dp"
256 android:layout_height="13dp"/>
257 <TextView
258 android:text="作业正确率"
259 android:textSize="11sp"
260 android:textColor="#333"
261 android:textStyle="bold"
262 android:layout_marginStart="5dp"
263 android:layout_width="wrap_content"
264 android:layout_height="wrap_content"/>
265 </LinearLayout>
266 <LinearLayout
267 android:orientation="horizontal"
268 android:layout_marginTop="8dp"
269 android:layout_width="wrap_content"
270 android:layout_height="wrap_content">
271 <TextView
272 android:id="@+id/tvPercent"
273 tools:text="88"
274 android:textSize="14sp"
275 android:textColor="#489AFA"
276 android:textStyle="bold"
277 android:layout_width="wrap_content"
278 android:layout_height="wrap_content"/>
279 <TextView
280 android:text="%"
281 android:textSize="9sp"
282 android:textColor="#489AFA"
283 android:textStyle="bold"
284 android:layout_width="wrap_content"
285 android:layout_height="wrap_content"/>
286 </LinearLayout>
287 </LinearLayout>
288 <LinearLayout
289 android:orientation="vertical"
290 android:gravity="center"
291 android:layout_width="0dp"
292 android:layout_height="match_parent"
293 android:layout_weight="1">
294 <LinearLayout
295 android:orientation="horizontal"
296 android:gravity="center_vertical"
297 android:layout_width="wrap_content"
298 android:layout_height="wrap_content">
299 <ImageView
300 android:src="@drawable/png_icon_statistical_accuracy"
301 android:layout_width="12dp"
302 android:layout_height="13dp"/>
303 <TextView
304 android:text="答对题数"
305 android:textSize="11sp"
306 android:textColor="#333"
307 android:textStyle="bold"
308 android:layout_marginStart="5dp"
309 android:layout_width="wrap_content"
310 android:layout_height="wrap_content"/>
311 </LinearLayout>
312 <LinearLayout
313 android:orientation="horizontal"
314 android:layout_marginTop="8dp"
315 android:layout_width="wrap_content"
316 android:layout_height="wrap_content">
317 <TextView