Compare View

switch
from
...
to
 
Commits (5)
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/AppTheme"> 41 android:theme="@style/AppTheme">
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 <activity
57 android:name=".RegisterActivity" 56 <activity
58 android:screenOrientation="portrait" 57 android:name=".RegisterActivity"
59 android:theme="@style/ThemeSplash" /> 58 android:screenOrientation="portrait"
60 <activity 59 android:theme="@style/ThemeSplash" />
61 android:name=".UserActivity" 60 <activity
62 android:screenOrientation="portrait" /> 61 android:name=".UserActivity"
63 <activity 62 android:screenOrientation="portrait" />
64 android:name=".YinsiActivity"
65 android:screenOrientation="portrait" /> 63 <activity
66 <activity 64 android:name=".YinsiActivity"
67 android:name=".QRActivity" 65 android:screenOrientation="portrait" />
68 android:screenOrientation="portrait" />
69 <activity 66 <activity
70 android:name=".AddStudentActivity" 67 android:name=".QRActivity"
71 android:screenOrientation="portrait" /> 68 android:screenOrientation="portrait" />
72 <activity
73 android:name=".NickActivity" 69 <activity
74 android:screenOrientation="portrait" /> 70 android:name=".AddStudentActivity"
75 <activity 71 android:screenOrientation="portrait" />
76 android:name=".SexActivity"
77 android:screenOrientation="portrait" /> 72 <activity
78 <activity 73 android:name=".NickActivity"
79 android:name=".NianActivity" 74 android:screenOrientation="portrait" />
80 android:screenOrientation="portrait" />
81 <activity 75 <activity
82 android:name=".ShenActivity" 76 android:name=".SexActivity"
83 android:screenOrientation="portrait" /> 77 android:screenOrientation="portrait" />
84 <activity
85 android:name=".UserAgreementActivity" 78 <activity
86 android:screenOrientation="portrait" /> 79 android:name=".NianActivity"
87 <activity 80 android:screenOrientation="portrait" />
88 android:name=".AccountActivity"
89 android:screenOrientation="portrait" /> 81 <activity
90 82 android:name=".ShenActivity"
91 <activity 83 android:screenOrientation="portrait" />
92 android:name=".ChangePwdActivity"
93 android:screenOrientation="portrait" /> 84 <activity
94 <activity 85 android:name=".UserAgreementActivity"
95 android:name=".EditStudentActivity" 86 android:screenOrientation="portrait" />
96 android:screenOrientation="portrait" />
97 <activity 87 <activity
98 android:name=".ChooseActivity" 88 android:name=".AccountActivity"
99 android:screenOrientation="portrait" /> 89 android:screenOrientation="portrait" />
100 <activity
101 android:name=".AddTeacherActivity" 90
102 android:screenOrientation="portrait" /> 91 <activity
103 <activity 92 android:name=".ChangePwdActivity"
104 android:name=".ErrorBookActivity" 93 android:screenOrientation="portrait" />
105 android:screenOrientation="portrait" />
106 <activity 94 <activity
107 android:name=".ImageActivity" 95 android:name=".EditStudentActivity"
108 android:screenOrientation="portrait" /> 96 android:screenOrientation="portrait" />
109 <activity
110 android:name=".ImageEditActivity" 97 <activity
111 android:screenOrientation="portrait" /> 98 android:name=".ChooseActivity"
112 <activity 99 android:screenOrientation="portrait" />
113 android:name=".ImageSelectActivity"
114 android:screenOrientation="portrait" /> 100 <activity
115 <activity 101 android:name=".AddTeacherActivity"
116 android:name=".AddSuccessActivity" 102 android:screenOrientation="portrait" />
117 android:screenOrientation="portrait" />
118 <activity 103 <activity
119 android:name=".ErrorListActivity" 104 android:name=".ErrorBookActivity"
120 android:screenOrientation="portrait" /> 105 android:screenOrientation="portrait" />
121 <activity
122 android:name=".ErrorDetailActivity" 106 <activity
123 android:screenOrientation="portrait" /> 107 android:name=".ImageActivity"
124 <activity 108 android:screenOrientation="portrait" />
125 android:name=".TeacherChooseActivity"
126 android:screenOrientation="portrait" /> 109 <activity
127 <activity 110 android:name=".ImageEditActivity"
128 android:name=".TeacherMainActivity" 111 android:screenOrientation="portrait" />
129 android:screenOrientation="portrait" />
130 <activity android:name=".StuHomeworkActivity" /> 112 <activity
131 <activity android:name=".HomeworkDetailActivity" /> 113 android:name=".ImageSelectActivity"
132 <activity android:name=".HomeworkSelectActivity" /> 114 android:screenOrientation="portrait" />
133 <activity android:name=".HomeworkFeedbackActivity" />
134 <activity android:name=".HomeworkTopicActivity" /> 115 <activity
135 <activity android:name=".HomeworkShareActivity" /> 116 android:name=".AddSuccessActivity"
136 <activity android:name=".HuyouDetailActivity" /> 117 android:screenOrientation="portrait" />
137
138 <provider 118 <activity
139 android:name="androidx.core.content.FileProvider" 119 android:name=".ErrorListActivity"
140 android:authorities="com.hjx.parent.fileprovider" 120 android:screenOrientation="portrait" />
141 android:exported="false"
142 android:grantUriPermissions="true" 121 <activity
143 tools:replace="android:authorities"> 122 android:name=".ErrorDetailActivity"
144 <meta-data 123 android:screenOrientation="portrait" />
145 android:name="android.support.FILE_PROVIDER_PATHS"
146 android:resource="@xml/file_provider_paths" 124 <activity
147 tools:replace="android:resource" /> 125 android:name=".TeacherChooseActivity"
148 </provider> 126 android:screenOrientation="portrait" />
149 </application>
150 127 <activity
151 </manifest> 128 android:name=".TeacherMainActivity"
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.Date; 39 import java.util.Date;
40 import java.util.HashMap; 40 import java.util.HashMap;
41 import java.util.List; 41 import java.util.List;
42 import java.util.Locale; 42 import java.util.Locale;
43 import java.util.Map; 43 import java.util.Map;
44 44
45 import io.reactivex.Observable; 45 import io.reactivex.Observable;
46 import io.reactivex.android.schedulers.AndroidSchedulers; 46 import io.reactivex.android.schedulers.AndroidSchedulers;
47 import io.reactivex.schedulers.Schedulers; 47 import io.reactivex.schedulers.Schedulers;
48 48
49 public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkBinding> { 49 public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkBinding> {
50 50
51 private final HomeworkListAdapter homeworkAdapter = new HomeworkListAdapter(); 51 private final HomeworkListAdapter homeworkAdapter = new HomeworkListAdapter();
52 52
53 private final List<StDetail> mWeekList = new ArrayList<>(); 53 private final List<StDetail> mWeekList = new ArrayList<>();
54 private final List<StDetail> mStageList = new ArrayList<>(); 54 private final List<StDetail> mStageList = new ArrayList<>();
55 private final HuyouAdapter weekAdapter = new HuyouAdapter(mWeekList); 55 private final HuyouAdapter weekAdapter = new HuyouAdapter(mWeekList);
56 private final HuyouAdapter stageAdapter = new HuyouAdapter(mStageList); 56 private final HuyouAdapter stageAdapter = new HuyouAdapter(mStageList);
57 57
58 PopupWindow subjectFilter, gradeFilter, termFilter, feedbackFilter; 58 PopupWindow subjectFilter, gradeFilter, termFilter, feedbackFilter;
59 MsgConfirmDialog deleteDialog; 59 MsgConfirmDialog deleteDialog;
60 StageHuyouDialog stageHuyouDialog; 60 StageHuyouDialog stageHuyouDialog;
61 State state = new State(); 61 State state = new State();
62 62
63 private void handlerIntent() { 63 private void handlerIntent() {
64 String json = getIntent().getStringExtra("studentJson"); 64 String json = getIntent().getStringExtra("studentJson");
65 if (json == null) json = (String) SharedPreferencesUtil.getData("student", ""); 65 if (json == null) json = (String) SharedPreferencesUtil.getData("student", "");
66 try { state.student = new Gson().fromJson(json, Student.class); } 66 try { state.student = new Gson().fromJson(json, Student.class); }
67 catch (Throwable t) { t.printStackTrace(); } 67 catch (Throwable t) { t.printStackTrace(); }
68 } 68 }
69 69
70 @SuppressLint("SetTextI18n") 70 @SuppressLint("SetTextI18n")
71 @Override 71 @Override
72 public void initView(Bundle savedInstanceState) { 72 public void initView(Bundle savedInstanceState) {
73 handlerIntent(); 73 handlerIntent();
74 if (state.student == null) { 74 if (state.student == null) {
75 finish(); 75 finish();
76 return; 76 return;
77 } 77 }
78 binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); 78 binding.toolbar.setNavigationOnClickListener(v -> onBackPressed());
79 binding.tvTitle.setText(state.student.stuName + "的全部作业"); 79 binding.tvTitle.setText(state.student.stuName + "的全部作业");
80 setupTab(); 80 setupTab();
81 homeworkAdapter.setEmptyView(R.layout.empty_list_homework, binding.recyclerView); 81 homeworkAdapter.setEmptyView(R.layout.empty_list_homework, binding.recyclerView);
82 weekAdapter.setEmptyView(R.layout.empty_huyou_list, binding.recyclerView); 82 weekAdapter.setEmptyView(R.layout.empty_huyou_list, binding.recyclerView);
83 stageAdapter.setEmptyView(R.layout.empty_huyou_stage, binding.recyclerView); 83 stageAdapter.setEmptyView(R.layout.empty_huyou_stage, binding.recyclerView);
84 binding.recyclerView.setAdapter(homeworkAdapter); 84 binding.recyclerView.setAdapter(homeworkAdapter);
85 85
86 deleteDialog = new MsgConfirmDialog.Builder(this) 86 deleteDialog = new MsgConfirmDialog.Builder(this)
87 .setMessage("确认要删除吗?一旦删除不可恢复") 87 .setMessage("确认要删除吗?一旦删除不可恢复")
88 .setPositive("暂不删除") 88 .setPositive("暂不删除")
89 .setNegative("确定删除") 89 .setNegative("确定删除")
90 .build(); 90 .build();
91 91
92 binding.ftSubject.setOnClickListener(v -> showSubjectFilter()); 92 binding.ftSubject.setOnClickListener(v -> showSubjectFilter());
93 binding.ftGrade.setOnClickListener(v -> showGradeFilter()); 93 binding.ftGrade.setOnClickListener(v -> showGradeFilter());
94 binding.ftTerm.setOnClickListener(v -> showTermFilter()); 94 binding.ftTerm.setOnClickListener(v -> showTermFilter());
95 binding.ftFeedback.setOnClickListener(v -> showFeedbackFilter()); 95 binding.ftFeedback.setOnClickListener(v -> showFeedbackFilter());
96 homeworkAdapter.deleteCall = data -> { 96 homeworkAdapter.deleteCall = data -> {
97 deleteDialog.show(null, () -> { 97 deleteDialog.show(null, () -> {
98 deleteHomework(data); 98 deleteHomework(data);
99 return true; 99 return true;
100 }); 100 });
101 }; 101 };
102 homeworkAdapter.detailCall = data -> { 102 homeworkAdapter.detailCall = data -> {
103 if (data.getRight() == null) { 103 if (data.getRight() == null) {
104 Intent intent = new Intent(this, HomeworkDetailActivity.class); 104 Intent intent = new Intent(this, HomeworkDetailActivity.class);
105 intent.putExtra("data", data); 105 intent.putExtra("data", data);
106 intent.putExtra("student", state.student); 106 intent.putExtra("student", state.student);
107 startActivity(intent); 107 startActivity(intent);
108 } else { 108 } else {
109 Intent intent = new Intent(this, HomeworkShareActivity.class); 109 Intent intent = new Intent(this, HomeworkShareActivity.class);
110 intent.putExtra("student", state.student); 110 intent.putExtra("student", state.student);
111 intent.putExtra("id", data.getId()); 111 intent.putExtra("id", data.getId());
112 intent.putExtra("grade", data.getGrade()); 112 intent.putExtra("grade", data.getGrade());
113 intent.putExtra("subject", data.getSubject()); 113 intent.putExtra("subject", data.getSubject());
114 String name = new SimpleDateFormat("yyyy年M月d日作业", Locale.CHINA).format(data.uploadTime); 114 String name = new SimpleDateFormat("yyyy年M月d日作业", Locale.CHINA).format(data.uploadTime);
115 intent.putExtra("name", name); 115 intent.putExtra("name", name);
116 startActivity(intent); 116 startActivity(intent);
117 } 117 }
118 }; 118 };
119 119
120 binding.btnChangeStudent.setOnClickListener(v -> { 120 binding.btnChangeStudent.setOnClickListener(v -> {
121 Intent intent = new Intent(this, TeacherChooseActivity.class); 121 Intent intent = new Intent(this, TeacherChooseActivity.class);
122 intent.putExtra("needBack", true); 122 intent.putExtra("needBack", true);
123 startActivityForResult(intent, 0xA01); 123 startActivityForResult(intent, 0xA01);
124 }); 124 });
125 125
126 binding.btnGeneralHuyou.setOnClickListener(v -> generalWeek()); 126 binding.btnGeneralHuyou.setOnClickListener(v -> generalWeek());
127 binding.btnStageHuyou.setOnClickListener(v -> { 127 binding.btnStageHuyou.setOnClickListener(v -> {
128 if (stageHuyouDialog == null) stageHuyouDialog = new StageHuyouDialog(this); 128 if (stageHuyouDialog == null) stageHuyouDialog = new StageHuyouDialog(this);
129 stageHuyouDialog.show(this::generalStage); 129 stageHuyouDialog.show(this::generalStage);
130 }); 130 });
131 131
132 weekAdapter.detailCall = data -> goHuyou(data, 0); 132 weekAdapter.detailCall = data -> goHuyou(data, 0);
133 stageAdapter.detailCall = data -> goHuyou(data, 1); 133 stageAdapter.detailCall = data -> goHuyou(data, 1);
134 weekAdapter.deleteCall = data -> { 134 weekAdapter.deleteCall = data -> {
135 deleteDialog.show(null, () -> { 135 deleteDialog.show(null, () -> {
136 deleteHuyou(data); 136 deleteHuyou(data);
137 return true; 137 return true;
138 }); 138 });
139 }; 139 };
140 stageAdapter.deleteCall = weekAdapter.deleteCall; 140 stageAdapter.deleteCall = weekAdapter.deleteCall;
141 141
142 getWeekHuyou(); 142 getWeekHuyou();
143 getStageHuyou(); 143 getStageHuyou();
144 } 144 }
145 145
146 private void goHuyou(StDetail data, int type) { 146 private void goHuyou(StDetail data, int type) {
147 Intent intent = new Intent(this, HuyouDetailActivity.class); 147 Intent intent = new Intent(this, HuyouDetailActivity.class);
148 intent.putExtra("id", data.id); 148 intent.putExtra("id", data.id);
149 intent.putExtra("type", type); 149 intent.putExtra("type", type);
150 intent.putExtra("student", state.student); 150 intent.putExtra("student", state.student);
151 startActivity(intent); 151 startActivity(intent);
152 } 152 }
153 153
154 @Override 154 @Override
155 protected void onStart() { 155 protected void onStart() {
156 super.onStart(); 156 super.onStart();
157 getHomework(); 157 getHomework();
158 } 158 }
159 159
160 @SuppressLint("SetTextI18n") 160 @SuppressLint("SetTextI18n")
161 @Override 161 @Override
162 protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { 162 protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
163 super.onActivityResult(requestCode, resultCode, data); 163 super.onActivityResult(requestCode, resultCode, data);
164 if (requestCode == 0xA01 && resultCode == RESULT_OK) { 164 if (requestCode == 0xA01 && resultCode == RESULT_OK) {
165 String json = (String) SharedPreferencesUtil.getData("student", ""); 165 String json = (String) SharedPreferencesUtil.getData("student", "");
166 try { 166 try {
167 state.student = new Gson().fromJson(json, Student.class); 167 state.student = new Gson().fromJson(json, Student.class);
168 binding.tvTitle.setText(state.student.stuName + "的全部作业"); 168 binding.tvTitle.setText(state.student.stuName + "的全部作业");
169 getHomework(); 169 getHomework();
170 getWeekHuyou(); 170 getWeekHuyou();
171 getStageHuyou(); 171 getStageHuyou();
172 } 172 }
173 catch (Throwable t) { t.printStackTrace(); } 173 catch (Throwable t) { t.printStackTrace(); }
174 } 174 }
175 } 175 }
176 176
177 private void setupTab() { 177 private void setupTab() {
178 binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每日作业")); 178 binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每日作业"));
179 binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每周总结")); 179 binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每周总结"));
180 binding.tabLayout.addTab(binding.tabLayout.newTab().setText("阶段性总结")); 180 binding.tabLayout.addTab(binding.tabLayout.newTab().setText("阶段性总结"));
181 binding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { 181 binding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
182 @Override 182 @Override
183 public void onTabSelected(TabLayout.Tab tab) { 183 public void onTabSelected(TabLayout.Tab tab) {
184 binding.filterBar.setVisibility(View.GONE); 184 binding.filterBar.setVisibility(View.GONE);
185 binding.weekBar.setVisibility(View.GONE); 185 binding.weekBar.setVisibility(View.GONE);
186 binding.stageBar.setVisibility(View.GONE); 186 binding.stageBar.setVisibility(View.GONE);
187 if (tab.getPosition() == 0) { //每日 187 if (tab.getPosition() == 0) { //每日
188 binding.filterBar.setVisibility(View.VISIBLE); 188 binding.filterBar.setVisibility(View.VISIBLE);
189 binding.recyclerView.setAdapter(homeworkAdapter); 189 binding.recyclerView.setAdapter(homeworkAdapter);
190 } else if (tab.getPosition() == 1) { //每周 190 } else if (tab.getPosition() == 1) { //每周
191 binding.weekBar.setVisibility(View.VISIBLE); 191 binding.weekBar.setVisibility(View.VISIBLE);
192 binding.recyclerView.setAdapter(weekAdapter); 192 binding.recyclerView.setAdapter(weekAdapter);
193 } else if (tab.getPosition() == 2) { //阶段 193 } else if (tab.getPosition() == 2) { //阶段
194 binding.stageBar.setVisibility(View.VISIBLE); 194 binding.stageBar.setVisibility(View.VISIBLE);
195 binding.recyclerView.setAdapter(stageAdapter); 195 binding.recyclerView.setAdapter(stageAdapter);
196 } 196 }
197 } 197 }
198 @Override 198 @Override
199 public void onTabUnselected(TabLayout.Tab tab) { 199 public void onTabUnselected(TabLayout.Tab tab) {
200 } 200 }
201 @Override 201 @Override
202 public void onTabReselected(TabLayout.Tab tab) { 202 public void onTabReselected(TabLayout.Tab tab) {
203 } 203 }
204 }); 204 });
205 } 205 }
206 206
207 @SuppressLint("CheckResult") 207 @SuppressLint("CheckResult")
208 protected void deleteHomework(HomeworkList data) { 208 protected void deleteHomework(HomeworkList data) {
209 NetWorks.service_url.deleteHomework(NetWorks.getHeader(), data.getId()) 209 NetWorks.service_url.deleteHomework(NetWorks.getHeader(), data.getId())
210 .subscribeOn(Schedulers.io()) 210 .subscribeOn(Schedulers.io())
211 .observeOn(AndroidSchedulers.mainThread()) 211 .observeOn(AndroidSchedulers.mainThread())
212 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) 212 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle()))
213 .subscribe((response, th) -> { 213 .subscribe((response, th) -> {
214 if (th != null) th.printStackTrace(); 214 if (th != null) th.printStackTrace();
215 if (response != null && response.getSuccess()) { 215 if (response != null && response.getSuccess()) {
216 getHomework(); 216 getHomework();
217 } 217 }
218 }); 218 });
219 219
220 } 220 }
221 221
222 @SuppressLint("CheckResult") 222 @SuppressLint("CheckResult")
223 protected void getHomework() { 223 protected void getHomework() {
224 NetWorks.service_url.getStudentHomework(NetWorks.getHeader(), state.student.stuId) 224 NetWorks.service_url.getStudentHomework(NetWorks.getHeader(), state.student.stuId)
225 .subscribeOn(Schedulers.io()) 225 .subscribeOn(Schedulers.io())
226 .observeOn(AndroidSchedulers.mainThread()) 226 .observeOn(AndroidSchedulers.mainThread())
227 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) 227 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle()))
228 .toObservable() 228 .toObservable()
229 .concatMap(response -> Observable.fromIterable(response.getData())) 229 .concatMap(response -> Observable.fromIterable(response.getData()))
230 // 过滤 230 // 过滤
231 .filter(data -> { // 学科 231 .filter(data -> { // 学科
232 String subject = state.subject.getValue(); 232 String subject = state.subject.getValue();
233 if (subject == null || subject.isEmpty()) return true; 233 if (subject == null || subject.isEmpty()) return true;
234 else return subject.equals(data.getSubject()); 234 else return subject.equals(data.getSubject());
235 }) 235 })
236 .filter(data -> { // 年级 236 .filter(data -> { // 年级
237 String grade = state.grade.getValue(); 237 String grade = state.grade.getValue();
238 if (grade == null || grade.isEmpty()) return true; 238 if (grade == null || grade.isEmpty()) return true;
239 else return grade.equals(data.getGrade()); 239 else return grade.equals(data.getGrade());
240 }) 240 })
241 .filter(data -> { // 学期 241 .filter(data -> { // 学期
242 String term = state.term.getValue(); 242 String term = state.term.getValue();
243 if (term == null || term.isEmpty()) return true; 243 if (term == null || term.isEmpty()) return true;
244 else return term.equals(data.getTerm()); 244 else return term.equals(data.getTerm());
245 }) 245 })
246 .filter(data -> { // 反馈 246 .filter(data -> { // 反馈
247 Integer feedback = state.feedback.getValue(); 247 Integer feedback = state.feedback.getValue();
248 if (feedback == null || feedback == 0) return true; 248 if (feedback == null || feedback == 0) return true;
249 else return (feedback == 1 && data.getRight() != null) || (feedback == 2 && data.getRight() == null); 249 else return (feedback == 1 && data.getRight() != null) || (feedback == 2 && data.getRight() == null);
250 }) 250 })
251 // 过滤完成, 收集 251 // 过滤完成, 收集
252 .toList() 252 .toList()
253 .subscribe((data, th) -> { 253 .subscribe((data, th) -> {
254 if (th != null) th.printStackTrace(); 254 if (th != null) th.printStackTrace();
255 homeworkAdapter.setNewData(data); 255 homeworkAdapter.setNewData(data);
256 }); 256 });
257 } 257 }
258 258
259 @SuppressLint({"CheckResult", "NotifyDataSetChanged"}) 259 @SuppressLint({"CheckResult", "NotifyDataSetChanged"})
260 private void getWeekHuyou() { 260 private void getWeekHuyou() {
261 NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 0) 261 NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 0)
262 .compose(transformSingle()) 262 .compose(transformSingle())
263 .map(ResponseResult::getData) 263 .map(ResponseResult::getData)
264 .subscribe((list, throwable) -> { 264 .subscribe((list, throwable) -> {
265 if (throwable != null) { 265 if (throwable != null) {
266 throwable.printStackTrace(); 266 throwable.printStackTrace();
267 return; 267 return;
268 } 268 }
269 if (list != null) { 269 if (list != null) {
270 mWeekList.clear(); 270 mWeekList.clear();
271 mWeekList.addAll(list); 271 mWeekList.addAll(list);
272 weekAdapter.notifyDataSetChanged(); 272 weekAdapter.notifyDataSetChanged();
273 273
274 boolean exist = false; 274 boolean exist = false;
275 int thisWeek = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR); 275 int thisWeek = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR);
276 for (StDetail bean: mWeekList) { 276 for (StDetail bean: mWeekList) {
277 Calendar other = Calendar.getInstance(); 277 Calendar other = Calendar.getInstance();
278 other.setTime(bean.endTime); 278 other.setTime(bean.endTime);
279 if (other.get(Calendar.WEEK_OF_YEAR) == thisWeek) { 279 if (other.get(Calendar.WEEK_OF_YEAR) == thisWeek) {
280 exist = true; 280 exist = true;
281 break; 281 break;
282 } 282 }
283 } 283 }
284 binding.btnGeneralHuyou.setVisibility(exist ? View.GONE : View.VISIBLE); 284 binding.btnGeneralHuyou.setVisibility(exist ? View.GONE : View.VISIBLE);
285 } 285 }
286 }); 286 });
287 } 287 }
288 288
289 @SuppressLint({"CheckResult", "NotifyDataSetChanged"}) 289 @SuppressLint({"CheckResult", "NotifyDataSetChanged"})
290 private void getStageHuyou() { 290 private void getStageHuyou() {
291 NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 1) 291 NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 1)
292 .compose(transformSingle()) 292 .compose(transformSingle())
293 .map(ResponseResult::getData) 293 .map(ResponseResult::getData)
294 .subscribe((list, throwable) -> { 294 .subscribe((list, throwable) -> {
295 if (throwable != null) { 295 if (throwable != null) {
296 throwable.printStackTrace(); 296 throwable.printStackTrace();
297 return; 297 return;
298 } 298 }
299 if (list != null) { 299 if (list != null) {
300 mStageList.clear(); 300 mStageList.clear();
301 mStageList.addAll(list); 301 mStageList.addAll(list);
302 stageAdapter.notifyDataSetChanged(); 302 stageAdapter.notifyDataSetChanged();
303 } 303 }
304 }); 304 });
305 } 305 }
306 306
307 @SuppressLint("CheckResult") 307 @SuppressLint("CheckResult")
308 private void generalWeek() { 308 private void generalWeek() {
309 showLoadingDialog("稍等..."); 309 showLoadingDialog("稍等...");
310 NetWorks.service_url.generalHuyou() 310 NetWorks.service_url.generalHuyou()
311 .compose(transformSingle()) 311 .compose(transformSingle())
312 .subscribe((response, throwable) -> { 312 .subscribe((response, throwable) -> {
313 cancelLoadingDialog(); 313 cancelLoadingDialog();
314 if (throwable != null) { 314 if (throwable != null) {
315 loadFail("失败"); 315 loadFail("失败");
316 throwable.printStackTrace(); 316 throwable.printStackTrace();
317 return; 317 return;
318 } 318 }
319 if (response != null && response.getSuccess()) { 319 if (response != null && response.getSuccess()) {
320 binding.btnGeneralHuyou.setVisibility(View.GONE); 320 binding.btnGeneralHuyou.setVisibility(View.GONE);
321 getWeekHuyou(); 321 getWeekHuyou();
322 } 322 }
323 }); 323 });
324 } 324 }
325 325
326 @SuppressLint("CheckResult") 326 @SuppressLint("CheckResult")
327 private void generalStage(Date startDate, Date endDate, String subject) { 327 private void generalStage(Date startDate, Date endDate, String subject) {
328 SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd HH:mm:ss", Locale.CHINA); 328 SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd HH:mm:ss", Locale.CHINA);
329 Map<String, Object> body = new HashMap<>(); 329 Map<String, Object> body = new HashMap<>();
330 body.put("stuId", state.student.stuId); 330 body.put("stuId", state.student.stuId);
331 body.put("startTime", format.format(startDate)); 331 body.put("startTime", format.format(startDate));
332 body.put("endTime", format.format(endDate)); 332 body.put("endTime", format.format(endDate));
333 body.put("subject", subject); 333 body.put("subject", subject);
334 showLoadingDialog("稍等..."); 334 showLoadingDialog("稍等...");
335 NetWorks.service_url.generalStageHuyou(NetWorks.getHeader(), body) 335 NetWorks.service_url.generalStageHuyou(NetWorks.getHeader(), body)
336 .subscribeOn(Schedulers.io()) 336 .subscribeOn(Schedulers.io())
337 .observeOn(AndroidSchedulers.mainThread()) 337 .observeOn(AndroidSchedulers.mainThread())
338 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) 338 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle()))
339 .subscribe((response, throwable) -> { 339 .subscribe((response, throwable) -> {
340 if (throwable != null) { 340 if (throwable != null) {
341 loadFail("失败"); 341 loadFail("失败");
342 throwable.printStackTrace(); 342 throwable.printStackTrace();
343 return; 343 return;
344 } 344 }
345 if (response.getSuccess()) { 345 if (response.getSuccess()) {
346 getStageHuyou(); 346 getStageHuyou();
347 cancelLoadingDialog(); 347 cancelLoadingDialog();
348 } else { 348 } else {
349 loadFail(response.getMsg()); 349 loadFail(response.getMsg());
350 } 350 }
351 }); 351 });
352 } 352 }
353 353
354 @SuppressLint("CheckResult") 354 @SuppressLint("CheckResult")
355 private void deleteHuyou(StDetail detail) { 355 private void deleteHuyou(StDetail detail) {
356 showLoadingDialog("稍等..."); 356 showLoadingDialog("稍等...");
357 NetWorks.service_url.deleteHuyou(NetWorks.getHeader(), detail.id) 357 NetWorks.service_url.deleteHuyou(NetWorks.getHeader(), detail.id)
358 .subscribeOn(Schedulers.io()) 358 .subscribeOn(Schedulers.io())
359 .observeOn(AndroidSchedulers.mainThread()) 359 .observeOn(AndroidSchedulers.mainThread())
360 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) 360 .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle()))
361 .subscribe((response, throwable) -> { 361 .subscribe((response, throwable) -> {
362 cancelLoadingDialog(); 362 cancelLoadingDialog();
363 if (throwable != null) { 363 if (throwable != null) {
364 loadFail("失败"); 364 loadFail("失败");
365 throwable.printStackTrace(); 365 throwable.printStackTrace();
366 return; 366 return;
367 } 367 }
368 if (detail.type == 0) { 368 if (detail.type == 0) {
369 getWeekHuyou(); 369 getWeekHuyou();
370 } else { 370 } else {
371 getStageHuyou(); 371 getStageHuyou();
372 } 372 }
373 }); 373 });
374 } 374 }
375 375
376 private void showSubjectFilter() { 376 private void showSubjectFilter() {
377 if (subjectFilter == null) { 377 if (subjectFilter == null) {
378 PopupFilterSubjectBinding db = PopupFilterSubjectBinding.inflate(getLayoutInflater()); 378 PopupFilterSubjectBinding db = PopupFilterSubjectBinding.inflate(getLayoutInflater());
379 db.setLifecycleOwner(this); 379 db.setLifecycleOwner(this);
380 db.setState(state); 380 db.setState(state);
381 db.bg.setOnClickListener(v -> subjectFilter.dismiss()); 381 db.bg.setOnClickListener(v -> subjectFilter.dismiss());
382 subjectFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); 382 subjectFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
383 subjectFilter.setOutsideTouchable(true); 383 subjectFilter.setOutsideTouchable(true);
384 } 384 }
385 subjectFilter.showAsDropDown(binding.anchorView); 385 subjectFilter.showAsDropDown(binding.anchorView);
386 state.onFilter = i -> { 386 state.onFilter = i -> {
387 subjectFilter.dismiss(); 387 subjectFilter.dismiss();
388 String subject = state.subject.getValue(); 388 String subject = state.subject.getValue();
389 binding.ftSubject.setActivated(subject != null && !subject.isEmpty()); 389 binding.ftSubject.setActivated(subject != null && !subject.isEmpty());
390 binding.ftSubject.setText(subject == null || subject.isEmpty() ? "学科" : subject); 390 binding.ftSubject.setText(subject == null || subject.isEmpty() ? "学科" : subject);
391 getHomework(); 391 getHomework();
392 }; 392 };
393 } 393 }
394 394
395 private void showGradeFilter() { 395 private void showGradeFilter() {
396 if (gradeFilter == null) { 396 if (gradeFilter == null) {
397 PopupFilterGradeBinding db = PopupFilterGradeBinding.inflate(getLayoutInflater()); 397 PopupFilterGradeBinding db = PopupFilterGradeBinding.inflate(getLayoutInflater());
398 db.setLifecycleOwner(this); 398 db.setLifecycleOwner(this);
399 db.setState(state); 399 db.setState(state);
400 db.bg.setOnClickListener(v -> gradeFilter.dismiss()); 400 db.bg.setOnClickListener(v -> gradeFilter.dismiss());
401 gradeFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); 401 gradeFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
402 gradeFilter.setOutsideTouchable(true); 402 gradeFilter.setOutsideTouchable(true);
403 } 403 }
404 gradeFilter.showAsDropDown(binding.anchorView); 404 gradeFilter.showAsDropDown(binding.anchorView);
405 state.onFilter = i -> { 405 state.onFilter = i -> {
406 gradeFilter.dismiss(); 406 gradeFilter.dismiss();
407 String grade = state.grade.getValue(); 407 String grade = state.grade.getValue();
408 binding.ftGrade.setActivated(grade != null && !grade.isEmpty()); 408 binding.ftGrade.setActivated(grade != null && !grade.isEmpty());
409 binding.ftGrade.setText(grade == null || grade.isEmpty() ? "年级" : grade); 409 binding.ftGrade.setText(grade == null || grade.isEmpty() ? "年级" : grade);
410 410
411 getHomework(); 411 getHomework();
412 }; 412 };
413 } 413 }
414 414
415 private void showTermFilter() { 415 private void showTermFilter() {
416 if (termFilter == null) { 416 if (termFilter == null) {
417 PopupFilterTermBinding db = PopupFilterTermBinding.inflate(getLayoutInflater()); 417 PopupFilterTermBinding db = PopupFilterTermBinding.inflate(getLayoutInflater());
418 db.setLifecycleOwner(this); 418 db.setLifecycleOwner(this);
419 db.setState(state); 419 db.setState(state);
420 db.bg.setOnClickListener(v -> termFilter.dismiss()); 420 db.bg.setOnClickListener(v -> termFilter.dismiss());
421 termFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); 421 termFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
422 termFilter.setOutsideTouchable(true); 422 termFilter.setOutsideTouchable(true);
423 } 423 }
424 termFilter.showAsDropDown(binding.anchorView); 424 termFilter.showAsDropDown(binding.anchorView);
425 state.onFilter = i -> { 425 state.onFilter = i -> {
426 termFilter.dismiss(); 426 termFilter.dismiss();
427 String term = state.term.getValue(); 427 String term = state.term.getValue();
428 binding.ftTerm.setActivated(term != null && !term.isEmpty()); 428 binding.ftTerm.setActivated(term != null && !term.isEmpty());
429 binding.ftTerm.setText(term == null || term.isEmpty() ? "学期" : term); 429 binding.ftTerm.setText(term == null || term.isEmpty() ? "学期" : term);
430 430
431 getHomework(); 431 getHomework();
432 }; 432 };
433 } 433 }
434 434
435 private void showFeedbackFilter() { 435 private void showFeedbackFilter() {
436 if (feedbackFilter == null) { 436 if (feedbackFilter == null) {
437 PopupFilterFeedbackBinding db = PopupFilterFeedbackBinding.inflate(getLayoutInflater()); 437 PopupFilterFeedbackBinding db = PopupFilterFeedbackBinding.inflate(getLayoutInflater());
438 db.setLifecycleOwner(this); 438 db.setLifecycleOwner(this);
439 db.setState(state); 439 db.setState(state);
440 db.bg.setOnClickListener(v -> feedbackFilter.dismiss()); 440 db.bg.setOnClickListener(v -> feedbackFilter.dismiss());
441 feedbackFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); 441 feedbackFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
442 feedbackFilter.setOutsideTouchable(true); 442 feedbackFilter.setOutsideTouchable(true);
443 } 443 }
444 feedbackFilter.showAsDropDown(binding.anchorView); 444 feedbackFilter.showAsDropDown(binding.anchorView);
445 state.onFilter = i -> { 445 state.onFilter = i -> {
446 feedbackFilter.dismiss(); 446 feedbackFilter.dismiss();
447 int feedback = state.feedback.getValue().intValue(); 447 int feedback = state.feedback.getValue().intValue();
448 binding.ftFeedback.setActivated(feedback != 0); 448 binding.ftFeedback.setActivated(feedback != 0);
449 binding.ftFeedback.setText(feedback == 0 ? "反馈状态" : feedback == 1 ? "已反馈" : "未反馈"); 449 binding.ftFeedback.setText(feedback == 0 ? "反馈状态" : feedback == 1 ? "已反馈" : "未反馈");
450 450
451 getHomework(); 451 getHomework();
452 }; 452 };
453 } 453 }
454 454
455 @Override 455 @Override
456 protected ActivityStudentHomeworkBinding getViewBinding() { 456 protected ActivityStudentHomeworkBinding getViewBinding() {
457 return ActivityStudentHomeworkBinding.inflate(getLayoutInflater()); 457 return ActivityStudentHomeworkBinding.inflate(getLayoutInflater());
458 } 458 }
459 459
460 public static class State { 460 public static class State {
461 public Student student; 461 public Student student;
462 462
463 public Function1<Integer> onFilter = i -> { }; 463 public Function1<Integer> onFilter = i -> { };
464 464
465 public MutableLiveData<String> subject = new MutableLiveData<>(""); 465 public MutableLiveData<String> subject = new MutableLiveData<>("");
466 public void setSubject(String value) { 466 public void setSubject(String value) {
467 subject.setValue(value); 467 subject.setValue(value);
468 onFilter.invoke(1); 468 onFilter.invoke(1);
469 } 469 }
470 470
471 public MutableLiveData<String> grade = new MutableLiveData<>(""); 471 public MutableLiveData<String> grade = new MutableLiveData<>("");
472 public void setGrade(String value) { 472 public void setGrade(String value) {
473 grade.setValue(value); 473 grade.setValue(value);
474 onFilter.invoke(2); 474 onFilter.invoke(2);
475 } 475 }
476 476
477 public MutableLiveData<String> term = new MutableLiveData<>(""); 477 public MutableLiveData<String> term = new MutableLiveData<>("");
478 public void setTerm(String value) { 478 public void setTerm(String value) {
479 term.setValue(value); 479 term.setValue(value);
480 onFilter.invoke(3); 480 onFilter.invoke(3);
481 } 481 }
482 482
483 //0:全部, 1: 已反馈, 2:未反馈 483 //0:全部, 1: 已反馈, 2:未反馈
484 public MutableLiveData<Integer> feedback = new MutableLiveData<>(0); 484 public MutableLiveData<Integer> feedback = new MutableLiveData<>(0);
485 public void setFeedback(int value) { 485 public void setFeedback(int value) {
486 feedback.setValue(value); 486 feedback.setValue(value);
487 onFilter.invoke(4); 487 onFilter.invoke(4);
488 } 488 }
489 } 489 }
490 490
491 static class HuyouAdapter extends BaseQuickAdapter<StDetail, BaseViewHolder> { 491 static class HuyouAdapter extends BaseQuickAdapter<StDetail, BaseViewHolder> {
492 public Function1<StDetail> deleteCall; 492 public Function1<StDetail> deleteCall;
493 public Function1<StDetail> detailCall; 493 public Function1<StDetail> detailCall;
494 public Student student; 494 public Student student;
495 495
496 public HuyouAdapter(@Nullable List<StDetail> data) { 496 public HuyouAdapter(@Nullable List<StDetail> data) {
497 super(R.layout.item_homework_list, data); 497 super(R.layout.item_homework_list, data);
498 } 498 }
499 499
500 @SuppressLint("SetTextI18n,SimpleDateFormat") 500 @SuppressLint("SetTextI18n,SimpleDateFormat")
501 @Override 501 @Override
502 protected void convert(@NonNull BaseViewHolder holder, StDetail data) { 502 protected void convert(@NonNull BaseViewHolder holder, StDetail data) {
503 holder.setGone(R.id.tvFlag, false); 503 holder.setGone(R.id.tvFlag, false);
504 int subjectImg; 504 int subjectImg;
505 switch (data.homeworkSubject) { 505 switch (data.homeworkSubject) {
506 case "语文": 506 case "语文":
507 subjectImg = R.drawable.png_cover_chinese; 507 subjectImg = R.drawable.png_cover_chinese;
508 break; 508 break;
509 case "英语": 509 case "英语":
510 subjectImg = R.drawable.png_cover_english; 510 subjectImg = R.drawable.png_cover_english;
511 break; 511 break;
512 case "物理": 512 case "物理":
513 subjectImg = R.drawable.png_cover_physics; 513 subjectImg = R.drawable.png_cover_physics;
514 break; 514 break;
515 case "化学": 515 case "化学":
516 subjectImg = R.drawable.png_cover_chemistry; 516 subjectImg = R.drawable.png_cover_chemistry;
517 break; 517 break;
518 case "数学": 518 case "数学":
519 default: 519 default:
520 subjectImg = R.drawable.png_cover_math; 520 subjectImg = R.drawable.png_cover_math;
521 } 521 }
522 holder.setImageResource(R.id.ivSubject, subjectImg); 522 holder.setImageResource(R.id.ivSubject, subjectImg);
523 Date endDate = new Date(data.endTime.getTime() - 1000); 523 Date endDate = new Date(data.endTime.getTime() - 1000);
524 String startStr = new SimpleDateFormat("yyyy.M.d").format(data.startTime); 524 String startStr = new SimpleDateFormat("yyyy.M.d").format(data.startTime);
525 String endStr = new SimpleDateFormat("-M.d").format(endDate); 525 String endStr = new SimpleDateFormat("-M.d").format(endDate);
526 String typeStr = data.type == 0 ? "作业周总结" : "作业阶段性总结"; 526 String typeStr = data.type == 0 ? "作业周总结" : "作业阶段性总结";
527 String title = startStr + endStr + data.homeworkSubject + typeStr; 527 String title = startStr + endStr + data.homeworkSubject + typeStr;
528 holder.setText(R.id.tvName, title); 528 holder.setText(R.id.tvName, title);
529 holder.setText(R.id.tvGrade, data.grade); 529 holder.setText(R.id.tvGrade, data.grade);
530 View btnDelete = holder.getView(R.id.btnDelete); 530 View btnDelete = holder.getView(R.id.btnDelete);
531 View btnDetail = holder.getView(R.id.btnDetail); 531 View btnDetail = holder.getView(R.id.btnDetail);
532 btnDelete.setOnClickListener(v -> { 532 btnDelete.setOnClickListener(v -> {
533 if (deleteCall != null) deleteCall.invoke(data); 533 if (deleteCall != null) deleteCall.invoke(data);
534 }); 534 });
535 btnDetail.setOnClickListener(v -> { 535 btnDetail.setOnClickListener(v -> {
536 if (detailCall != null) detailCall.invoke(data); 536 if (detailCall != null) detailCall.invoke(data);
537 }); 537 });
538 holder.itemView.setOnClickListener(v -> {
539 if (detailCall != null) detailCall.invoke(data);
540 });
538 holder.itemView.setOnClickListener(v -> { 541 }
539 if (detailCall != null) detailCall.invoke(data); 542
540 }); 543 private SimpleDateFormat getFormatWithGmt8(String pattern) {
541 } 544 SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.CHINA);
542 545 //format.setTimeZone(TimeZone.getTimeZone("GMT+16"));
543 private SimpleDateFormat getFormatWithGmt8(String pattern) { 546 return format;
544 SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.CHINA); 547 }
545 //format.setTimeZone(TimeZone.getTimeZone("GMT+16")); 548 }
546 return format; 549
547 } 550 }
548 } 551
app/src/main/java/com/hjx/parent/fragment/ErrorFragment.java
1 package com.hjx.parent.fragment; 1 package com.hjx.parent.fragment;
2 2
3 import static android.app.Activity.RESULT_OK; 3 import static android.app.Activity.RESULT_OK;
4 4
5 import android.annotation.SuppressLint; 5 import android.annotation.SuppressLint;
6 import android.content.Intent; 6 import android.content.Intent;
7 import android.graphics.Bitmap; 7 import android.graphics.Bitmap;
8 import android.graphics.BitmapFactory; 8 import android.graphics.BitmapFactory;
9 import android.net.Uri; 9 import android.net.Uri;
10 import android.os.Bundle; 10 import android.os.Bundle;
11 import android.provider.MediaStore; 11 import android.provider.MediaStore;
12 import android.text.TextUtils; 12 import android.text.TextUtils;
13 import android.util.Log; 13 import android.util.Log;
14 import android.view.LayoutInflater; 14 import android.view.LayoutInflater;
15 import android.view.View; 15 import android.view.View;
16 import android.view.ViewGroup; 16 import android.view.ViewGroup;
17 import android.widget.TextView; 17 import android.widget.TextView;
18 import android.widget.Toast; 18 import android.widget.Toast;
19 19
20 import androidx.annotation.NonNull; 20 import androidx.annotation.NonNull;
21 import androidx.annotation.Nullable; 21 import androidx.annotation.Nullable;
22 import androidx.core.content.FileProvider; 22 import androidx.core.content.FileProvider;
23 import androidx.recyclerview.widget.RecyclerView; 23 import androidx.recyclerview.widget.RecyclerView;
24 24
25 import com.bumptech.glide.Glide; 25 import com.bumptech.glide.Glide;
26 import com.bumptech.glide.load.resource.bitmap.RoundedCorners; 26 import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
27 import com.bumptech.glide.request.RequestOptions; 27 import com.bumptech.glide.request.RequestOptions;
28 import com.chad.library.adapter.base.BaseQuickAdapter; 28 import com.chad.library.adapter.base.BaseQuickAdapter;
29 import com.chad.library.adapter.base.BaseViewHolder; 29 import com.chad.library.adapter.base.BaseViewHolder;
30 import com.google.android.material.tabs.TabLayout; 30 import com.google.android.material.tabs.TabLayout;
31 import com.google.gson.Gson; 31 import com.google.gson.Gson;
32 import com.hjq.permissions.OnPermissionCallback; 32 import com.hjq.permissions.OnPermissionCallback;
33 import com.hjq.permissions.Permission; 33 import com.hjq.permissions.Permission;
34 import com.hjq.permissions.XXPermissions; 34 import com.hjq.permissions.XXPermissions;
35 import com.hjx.parent.ErrorListActivity; 35 import com.hjx.parent.ErrorListActivity;
36 import com.hjx.parent.HomeworkDetailActivity; 36 import com.hjx.parent.HomeworkDetailActivity;
37 import com.hjx.parent.HomeworkShareActivity; 37 import com.hjx.parent.HomeworkShareActivity;
38 import com.hjx.parent.ImageActivity; 38 import com.hjx.parent.ImageActivity;
39 import com.hjx.parent.R; 39 import com.hjx.parent.R;
40 import com.hjx.parent.StuHomeworkActivity; 40 import com.hjx.parent.StuHomeworkActivity;
41 import com.hjx.parent.TeacherChooseActivity; 41 import com.hjx.parent.TeacherChooseActivity;
42 import com.hjx.parent.adapter.ErrorAdapter; 42 import com.hjx.parent.adapter.ErrorAdapter;
43 import com.hjx.parent.adapter.HomeworkAdapter; 43 import com.hjx.parent.adapter.HomeworkAdapter;
44 import com.hjx.parent.bean.StudentBean; 44 import com.hjx.parent.bean.StudentBean;
45 import com.hjx.parent.databinding.FragmentErrorBookBinding; 45 import com.hjx.parent.databinding.FragmentErrorBookBinding;
46 import com.hjx.parent.rx.BaseRxFragment; 46 import com.hjx.parent.rx.BaseRxFragment;
47 import com.prws.common.bean.PageInfo; 47 import com.prws.common.bean.PageInfo;
48 import com.prws.common.bean.ResponseResult; 48 import com.prws.common.bean.ResponseResult;
49 import com.prws.common.bean.Student; 49 import com.prws.common.bean.Student;
50 import com.prws.common.bean.TopicBean; 50 import com.prws.common.bean.TopicBean;
51 import com.prws.common.bean.homework.HomeworkList; 51 import com.prws.common.bean.homework.HomeworkList;
52 import com.prws.common.net.NetWorks; 52 import com.prws.common.net.NetWorks;
53 import com.prws.common.utils.BitmapUtils; 53 import com.prws.common.utils.BitmapUtils;
54 import com.prws.common.utils.CommonUtil; 54 import com.prws.common.utils.CommonUtil;
55 import com.prws.common.utils.ScreenUtils; 55 import com.prws.common.utils.ScreenUtils;
56 import com.prws.common.utils.SharedPreferencesUtil; 56 import com.prws.common.utils.SharedPreferencesUtil;
57 import com.prws.common.utils.dialog.MyButtomDialog; 57 import com.prws.common.utils.dialog.MyButtomDialog;
58 import com.trello.rxlifecycle2.android.RxLifecycleAndroid; 58 import com.trello.rxlifecycle2.android.RxLifecycleAndroid;
59 import com.zhangteng.imagepicker.bean.ImageInfo; 59 import com.zhangteng.imagepicker.bean.ImageInfo;
60 import com.zhangteng.imagepicker.config.ImagePickerConfig; 60 import com.zhangteng.imagepicker.config.ImagePickerConfig;
61 import com.zhangteng.imagepicker.config.ImagePickerEnum; 61 import com.zhangteng.imagepicker.config.ImagePickerEnum;
62 import com.zhangteng.imagepicker.config.ImagePickerOpen; 62 import com.zhangteng.imagepicker.config.ImagePickerOpen;
63 import com.zhangteng.imagepicker.imageloader.GlideImageLoader; 63 import com.zhangteng.imagepicker.imageloader.GlideImageLoader;
64 import com.zhangteng.utils.IHandlerCallBack; 64 import com.zhangteng.utils.IHandlerCallBack;
65 65
66 import java.io.File; 66 import java.io.File;
67 import java.text.SimpleDateFormat; 67 import java.text.SimpleDateFormat;
68 import java.util.ArrayList; 68 import java.util.ArrayList;
69 import java.util.Arrays; 69 import java.util.Arrays;
70 import java.util.HashMap; 70 import java.util.HashMap;
71 import java.util.List; 71 import java.util.List;
72 import java.util.Locale; 72 import java.util.Locale;
73 import java.util.Map; 73 import java.util.Map;
74 74
75 import io.reactivex.Observable; 75 import io.reactivex.Observable;
76 import io.reactivex.Observer; 76 import io.reactivex.Observer;
77 import io.reactivex.android.schedulers.AndroidSchedulers; 77 import io.reactivex.android.schedulers.AndroidSchedulers;
78 import io.reactivex.disposables.Disposable; 78 import io.reactivex.disposables.Disposable;
79 import io.reactivex.schedulers.Schedulers; 79 import io.reactivex.schedulers.Schedulers;
80 80
81 public class ErrorFragment extends BaseRxFragment<FragmentErrorBookBinding> { 81 public class ErrorFragment extends BaseRxFragment<FragmentErrorBookBinding> {
82 StudentBean studentBean; 82 StudentBean studentBean;
83 private int subject; 83 private int subject;
84 private ErrorAdapter errorAdapter; 84 private ErrorAdapter errorAdapter;
85 private HomeworkAdapter homeworkAdapter; 85 private HomeworkAdapter homeworkAdapter;
86 private String filePath; 86 private String filePath;
87 87
88 @Override 88 @Override
89 protected FragmentErrorBookBinding onCreateViewBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent) { 89 protected FragmentErrorBookBinding onCreateViewBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent) {
90 return FragmentErrorBookBinding.inflate(inflater, parent, false); 90 return FragmentErrorBookBinding.inflate(inflater, parent, false);
91 } 91 }
92 92
93 public void refreshStudent() { 93 public void refreshStudent() {
94 String student = (String) SharedPreferencesUtil.getData("student", ""); 94 String student = (String) SharedPreferencesUtil.getData("student", "");
95 try { 95 try {
96 studentBean = new Gson().fromJson(student, StudentBean.class); 96 studentBean = new Gson().fromJson(student, StudentBean.class);
97 getBinding().tvChoose.setText(studentBean.getStuName()); 97 getBinding().tvChoose.setText(studentBean.getStuName());
98 } catch (Exception e) { 98 } catch (Exception e) {
99 e.printStackTrace(); 99 e.printStackTrace();
100 } 100 }
101 } 101 }
102 102
103 @Override 103 @Override
104 public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { 104 public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
105 super.onViewCreated(view, savedInstanceState); 105 super.onViewCreated(view, savedInstanceState);
106 String photo = (String) SharedPreferencesUtil.getData("photo", ""); 106 String photo = (String) SharedPreferencesUtil.getData("photo", "");
107 if (!TextUtils.isEmpty(photo)) { 107 if (!TextUtils.isEmpty(photo)) {
108 RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(getContext(), 45)); 108 RoundedCorners roundedCorners = new RoundedCorners(ScreenUtils.dpToPx(getContext(), 45));
109 RequestOptions options = RequestOptions.bitmapTransform(roundedCorners); 109 RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
110 Glide.with(getContext()).load(photo).apply(options).into(getBinding().ivStudent); 110 Glide.with(getContext()).load(photo).apply(options).into(getBinding().ivStudent);
111 } 111 }
112 String name = (String) SharedPreferencesUtil.getData("name", ""); 112 String name = (String) SharedPreferencesUtil.getData("name", "");
113 getBinding().tvName.setText(name); 113 getBinding().tvName.setText(name);
114 refreshStudent(); 114 refreshStudent();
115 getBinding().tvChoose.setOnClickListener(v -> startActivity(new Intent(getContext(), TeacherChooseActivity.class))); 115 getBinding().tvChoose.setOnClickListener(v -> startActivity(new Intent(getContext(), TeacherChooseActivity.class)));
116 getBinding().rlTakePhoto.setOnClickListener(v -> takePhoto(0)); 116 getBinding().rlTakePhoto.setOnClickListener(v -> takePhoto(0));
117 getBinding().flEntryHomework.setOnClickListener(v -> takePhoto(1)); 117 getBinding().flEntryHomework.setOnClickListener(v -> takePhoto(1));
118 BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_subject, Arrays.asList(getResources().getStringArray(R.array.filter_subject))) { 118 BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_subject, Arrays.asList(getResources().getStringArray(R.array.filter_subject))) {
119 @Override 119 @Override
120 public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { 120 public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
121 121
122 } 122 }
123 123
124 @Override 124 @Override
125 protected void convert(@NonNull BaseViewHolder item, Object o) { 125 protected void convert(@NonNull BaseViewHolder item, Object o) {
126 int position = item.getBindingAdapterPosition(); 126 int position = item.getBindingAdapterPosition();
127 String name = getResources().getStringArray(R.array.filter_subject)[position]; 127 String name = getResources().getStringArray(R.array.filter_subject)[position];
128 item.setText(R.id.tv_subject, name); 128 item.setText(R.id.tv_subject, name);
129 switch (name) { 129 switch (name) {
130 case "语文": 130 case "语文":
131 item.setImageResource(R.id.iv_subject, R.drawable.state_ic_chinese); 131 item.setImageResource(R.id.iv_subject, R.drawable.state_ic_chinese);
132 break; 132 break;
133 case "数学": 133 case "数学":
134 item.setImageResource(R.id.iv_subject, R.drawable.state_ic_math); 134 item.setImageResource(R.id.iv_subject, R.drawable.state_ic_math);
135 break; 135 break;
136 case "英语": 136 case "英语":
137 item.setImageResource(R.id.iv_subject, R.drawable.state_ic_english); 137 item.setImageResource(R.id.iv_subject, R.drawable.state_ic_english);
138 break; 138 break;
139 case "物理": 139 case "物理":
140 item.setImageResource(R.id.iv_subject, R.drawable.state_ic_physics); 140 item.setImageResource(R.id.iv_subject, R.drawable.state_ic_physics);
141 break; 141 break;
142 case "化学": 142 case "化学":
143 item.setImageResource(R.id.iv_subject, R.drawable.state_ic_chemistry); 143 item.setImageResource(R.id.iv_subject, R.drawable.state_ic_chemistry);
144 break; 144 break;
145 } 145 }
146 item.itemView.setActivated(subject == position); 146 item.itemView.setActivated(subject == position);
147 ViewGroup.LayoutParams layoutParams = item.getView(R.id.rl_subject).getLayoutParams(); 147 ViewGroup.LayoutParams layoutParams = item.getView(R.id.rl_subject).getLayoutParams();
148 layoutParams.width = (CommonUtil.getScreenWidth(mContext) - CommonUtil.dpToPx(mContext, 30)) / 4; 148 layoutParams.width = (CommonUtil.getScreenWidth(mContext) - CommonUtil.dpToPx(mContext, 30)) / 4;
149 item.getView(R.id.rl_subject).setLayoutParams(layoutParams); 149 item.getView(R.id.rl_subject).setLayoutParams(layoutParams);
150 item.itemView.setOnClickListener(v -> { 150 item.itemView.setOnClickListener(v -> {
151 if (subject != position) { 151 if (subject != position) {
152 subject = position; 152 subject = position;
153 String subStr = getResources().getStringArray(R.array.filter_subject)[subject]; 153 String subStr = getResources().getStringArray(R.array.filter_subject)[subject];
154 getError(subStr); 154 getError(subStr);
155 getHomework(subStr); 155 getHomework(subStr);
156 notifyDataSetChanged(); 156 notifyDataSetChanged();
157 } 157 }
158 }); 158 });
159 } 159 }
160 }; 160 };
161 getBinding().rvSubject.setAdapter(adapter); 161 getBinding().rvSubject.setAdapter(adapter);
162 subject = 0; 162 subject = 0;
163 getError(getResources().getStringArray(R.array.filter_subject)[subject]); 163 getError(getResources().getStringArray(R.array.filter_subject)[subject]);
164 getBinding().llAll.setOnClickListener(v -> { 164 getBinding().llAll.setOnClickListener(v -> {
165 if (binding.tabLayout.getSelectedTabPosition() == 0) { 165 if (binding.tabLayout.getSelectedTabPosition() == 0) {
166 Intent intent = new Intent(getContext(), ErrorListActivity.class); 166 Intent intent = new Intent(getContext(), ErrorListActivity.class);
167 startActivity(intent); 167 startActivity(intent);
168 } else { 168 } else {
169 Intent intent = new Intent(getContext(), StuHomeworkActivity.class); 169 Intent intent = new Intent(getContext(), StuHomeworkActivity.class);
170 startActivity(intent); 170 startActivity(intent);
171 } 171 }
172 }); 172 });
173 173
174 errorAdapter = new ErrorAdapter(getActivity(), new ArrayList<>(), false); 174 errorAdapter = new ErrorAdapter(getActivity(), new ArrayList<>(), false);
175 homeworkAdapter = new HomeworkAdapter(); 175 homeworkAdapter = new HomeworkAdapter();
176 homeworkAdapter.setOnItemClickListener((baseQuickAdapter, view1, i) -> { 176 homeworkAdapter.setOnItemClickListener((baseQuickAdapter, view1, i) -> {
177 HomeworkList data = homeworkAdapter.getData().get(i); 177 HomeworkList data = homeworkAdapter.getData().get(i);
178 Gson gson = new Gson(); 178 Gson gson = new Gson();
179 String json = gson.toJson(studentBean); 179 String json = gson.toJson(studentBean);
180 Student s = gson.fromJson(json, Student.class); 180 Student s = gson.fromJson(json, Student.class);
181 if (data.getRight() == null) { 181 if (data.getRight() == null) {
182 Intent intent = new Intent(requireContext(), HomeworkDetailActivity.class); 182 Intent intent = new Intent(requireContext(), HomeworkDetailActivity.class);
183 intent.putExtra("student", s); 183 intent.putExtra("student", s);
184 intent.putExtra("data", data); 184 intent.putExtra("data", data);
185 startActivity(intent); 185 startActivity(intent);
186 } else { 186 } else {
187 Intent intent = new Intent(requireContext(), HomeworkShareActivity.class); 187 Intent intent = new Intent(requireContext(), HomeworkShareActivity.class);
188 intent.putExtra("student", s); 188 intent.putExtra("student", s);
189 intent.putExtra("id", data.getId()); 189 intent.putExtra("id", data.getId());
190 intent.putExtra("grade", data.getGrade()); 190 intent.putExtra("grade", data.getGrade());
191 intent.putExtra("subject", data.getSubject()); 191 intent.putExtra("subject", data.getSubject());
192 String name1 = new SimpleDateFormat("yyyy年M月d日作业", Locale.CHINA).format(data.uploadTime); 192 String name1 = new SimpleDateFormat("yyyy年M月d日作业", Locale.CHINA).format(data.uploadTime);
193 intent.putExtra("name", name1); 193 intent.putExtra("name", name1);
194 startActivity(intent); 194 startActivity(intent);
195 } 195 }
196 }); 196 });
197 binding.rvMain.setAdapter(errorAdapter); 197 binding.rvMain.setAdapter(errorAdapter);
198 // binding.tabLayout.addTab(binding.tabLayout.newTab().setText("最近错题")); 198 // binding.tabLayout.addTab(binding.tabLayout.newTab().setText("最近错题"));
199 // binding.tabLayout.addTab(binding.tabLayout.newTab().setText("最近作业")); 199 // binding.tabLayout.addTab(binding.tabLayout.newTab().setText("最近作业"));
200 binding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { 200 binding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
201 @Override 201 @Override
202 public void onTabSelected(TabLayout.Tab tab) { 202 public void onTabSelected(TabLayout.Tab tab) {
203 if (tab.getPosition() == 0) { 203 if (tab.getPosition() == 0) {
204 binding.rvMain.setAdapter(errorAdapter); 204 binding.rvMain.setAdapter(errorAdapter);
205 binding.rvMain.setVisibility(errorAdapter.list.isEmpty() ? View.GONE : View.VISIBLE); 205 binding.rvMain.setVisibility(errorAdapter.list.isEmpty() ? View.GONE : View.VISIBLE);
206 binding.llEmpty.setVisibility(errorAdapter.list.isEmpty() ? View.VISIBLE : View.GONE); 206 binding.llEmpty.setVisibility(errorAdapter.list.isEmpty() ? View.VISIBLE : View.GONE);
207 binding.tvListTitle.setText("最近错题"); 207 binding.tvListTitle.setText("最近错题");
208 binding.tvEmpty.setText("暂无错题~"); 208 binding.tvEmpty.setText("暂无错题~");
209 } else { 209 } else {
210 binding.rvMain.setAdapter(homeworkAdapter); 210 binding.rvMain.setAdapter(homeworkAdapter);
211 binding.rvMain.setVisibility(homeworkAdapter.getData().isEmpty() ? View.GONE : View.VISIBLE); 211 binding.rvMain.setVisibility(homeworkAdapter.getData().isEmpty() ? View.GONE : View.VISIBLE);
212 binding.llEmpty.setVisibility(homeworkAdapter.getData().isEmpty() ? View.VISIBLE : View.GONE); 212 binding.llEmpty.setVisibility(homeworkAdapter.getData().isEmpty() ? View.VISIBLE : View.GONE);
213 binding.tvListTitle.setText("最近作业"); 213 binding.tvListTitle.setText("最近作业");
214 binding.tvEmpty.setText("暂无作业~"); 214 binding.tvEmpty.setText("暂无作业~");
215 } 215 }
216 } 216 }
217 @Override 217 @Override
218 public void onTabUnselected(TabLayout.Tab tab) { 218 public void onTabUnselected(TabLayout.Tab tab) {
219 } 219 }
220 @Override 220 @Override
221 public void onTabReselected(TabLayout.Tab tab) { 221 public void onTabReselected(TabLayout.Tab tab) {
222 } 222 }
223 }); 223 });
224 } 224 }
225 225
226 private void takePhoto(int type) { 226 private void takePhoto(int type) {
227 if (!XXPermissions.isGranted(getContext(), Permission.CAMERA, Permission.WRITE_EXTERNAL_STORAGE)) { 227 if (!XXPermissions.isGranted(getContext(), Permission.CAMERA, Permission.WRITE_EXTERNAL_STORAGE)) {
228 XXPermissions.with(getContext()) 228 XXPermissions.with(getContext())
229 // 申请多个权限 229 // 申请多个权限
230 .permission(Permission.CAMERA).request(new OnPermissionCallback() { 230 .permission(Permission.CAMERA).request(new OnPermissionCallback() {
231 @Override 231 @Override
232 public void onGranted(List<String> permissions, boolean all) { 232 public void onGranted(List<String> permissions, boolean all) {
233 if (all) { 233 if (all) {
234 //开启扫码界面 234 //开启扫码界面
235 showButtonDialog(type); 235 showButtonDialog(type);
236 } else { 236 } else {
237 Toast.makeText(getContext(), "需要权限", Toast.LENGTH_SHORT).show(); 237 Toast.makeText(getContext(), "需要权限", Toast.LENGTH_SHORT).show();
238 } 238 }
239 } 239 }
240 240
241 @Override 241 @Override
242 public void onDenied(List<String> permissions, boolean never) { 242 public void onDenied(List<String> permissions, boolean never) {
243 XXPermissions.startPermissionActivity(getContext(), permissions); 243 XXPermissions.startPermissionActivity(getContext(), permissions);
244 } 244 }
245 }); 245 });
246 } else { 246 } else {
247 showButtonDialog(type); 247 showButtonDialog(type);
248 } 248 }
249 } 249 }
250 250
251 private void showButtonDialog(int type) { 251 private void showButtonDialog(int type) {
252 MyButtomDialog dialog = new MyButtomDialog(getActivity(), R.style.BottomSheetDialog); 252 MyButtomDialog dialog = new MyButtomDialog(getActivity(), R.style.BottomSheetDialog);
253 View bottomView = LayoutInflater.from(getActivity()).inflate(R.layout.bottom_sheet_layout, null); 253 View bottomView = LayoutInflater.from(getActivity()).inflate(R.layout.bottom_sheet_layout, null);
254 dialog.setContentView(bottomView); 254 dialog.setContentView(bottomView);
255 bottomView.findViewById(R.id.take_photo).setOnClickListener(new View.OnClickListener() { 255 bottomView.findViewById(R.id.take_photo).setOnClickListener(new View.OnClickListener() {
256 @Override 256 @Override
257 public void onClick(View view) { 257 public void onClick(View view) {
258 dialog.dismiss(); 258 dialog.dismiss();
259 Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 259 Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
260 //确保有相机来处理Intent 260 //确保有相机来处理Intent
261 filePath = requireActivity().getExternalFilesDir("images").getPath() + "/" + System.currentTimeMillis() + CommonUtil.getStr() + ".jpg"; 261 filePath = requireActivity().getExternalFilesDir("images").getPath() + "/" + System.currentTimeMillis() + CommonUtil.getStr() + ".jpg";
262 File photoFile = new File(filePath); 262 File photoFile = new File(filePath);
263 263
264 //适配Android 7.0文件权限,通过FileProvider创建一个content类型的Uri 264 //适配Android 7.0文件权限,通过FileProvider创建一个content类型的Uri
265 Uri photoUri = FileProvider.getUriForFile(requireActivity(), "com.hjx.parent.fileprovider", photoFile); 265 Uri photoUri = FileProvider.getUriForFile(requireActivity(), "com.hjx.parent.fileprovider", photoFile);
266 takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); 266 takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
267 takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri); 267 takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
268 startActivityForResult(takePictureIntent, type == 0 ? 0xA01 : 0xA02); 268 startActivityForResult(takePictureIntent, type == 0 ? 0xA01 : 0xA02);
269 } 269 }
270 }); 270 });
271 bottomView.findViewById(R.id.choose_photo).setOnClickListener(new View.OnClickListener() { 271 bottomView.findViewById(R.id.choose_photo).setOnClickListener(new View.OnClickListener() {
272 @Override 272 @Override
273 public void onClick(View view) { 273 public void onClick(View view) {
274 dialog.dismiss(); 274 dialog.dismiss();
275 ImagePickerConfig imagePickerConfig = new ImagePickerConfig.Builder().provider(getActivity().getPackageName() + ".fileprovider").imageLoader(new GlideImageLoader()) //图片加载器 275 ImagePickerConfig imagePickerConfig = new ImagePickerConfig.Builder().provider(getActivity().getPackageName() + ".fileprovider").imageLoader(new GlideImageLoader()) //图片加载器
276 .iHandlerCallBack(new HandlerCallBack(type)) //图片选择器生命周期监听(直接打开摄像头时无效) 276 .iHandlerCallBack(new HandlerCallBack(type)) //图片选择器生命周期监听(直接打开摄像头时无效)
277 .multiSelect(true) //是否多选 277 .multiSelect(true) //是否多选
278 .isShowCamera(false).isVideoPicker(false) //是否选择视频 默认false 278 .isShowCamera(false).isVideoPicker(false) //是否选择视频 默认false
279 .isImagePicker(true).imagePickerType(ImagePickerEnum.PHOTO_PICKER) //选择器打开类型 279 .isImagePicker(true).imagePickerType(ImagePickerEnum.PHOTO_PICKER) //选择器打开类型
280 .maxImageSelectable(5) //图片可选择数 280 .maxImageSelectable(5) //图片可选择数
281 .maxHeight(1920) //图片最大高度 281 .maxHeight(1920) //图片最大高度
282 .maxWidth(1920) //图片最大宽度 282 .maxWidth(1920) //图片最大宽度
283 .maxImageSize(3) //图片最大大小Mb 283 .maxImageSize(3) //图片最大大小Mb
284 .isCrop(false).pathList(new ArrayList<>()).pickerThemeColorRes(R.color.image_picker_white).pickerTitleColorRes(R.color.image_picker_text_black).cropThemeColorRes(R.color.image_picker_white).cropTitleColorRes(R.color.image_picker_text_black).pickerBackRes(R.mipmap.image_picker_back_black).pickerFolderRes(R.mipmap.image_picker_folder_black).build(); 284 .isCrop(false).pathList(new ArrayList<>()).pickerThemeColorRes(R.color.image_picker_white).pickerTitleColorRes(R.color.image_picker_text_black).cropThemeColorRes(R.color.image_picker_white).cropTitleColorRes(R.color.image_picker_text_black).pickerBackRes(R.mipmap.image_picker_back_black).pickerFolderRes(R.mipmap.image_picker_folder_black).build();
285 ImagePickerOpen.getInstance().setImagePickerConfig(imagePickerConfig).pathList(new ArrayList<>()).open(getActivity()); 285 ImagePickerOpen.getInstance().setImagePickerConfig(imagePickerConfig).pathList(new ArrayList<>()).open(getActivity());
286 286
287 } 287 }
288 }); 288 });
289 bottomView.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() { 289 bottomView.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
290 @Override 290 @Override
291 public void onClick(View view) { 291 public void onClick(View view) {
292 dialog.dismiss(); 292 dialog.dismiss();
293 } 293 }
294 }); 294 });
295 dialog.show(); 295 dialog.show();
296 } 296 }
297 297
298 @SuppressLint("CheckResult") 298 @SuppressLint("CheckResult")
299 protected void getHomework(String subject) { 299 protected void getHomework(String subject) {
300 if (studentBean == null) return; 300 if (studentBean == null) return;
301 NetWorks.service_url.getStudentHomework(NetWorks.getHeader(), studentBean.getStuId()) 301 NetWorks.service_url.getStudentHomework(NetWorks.getHeader(), studentBean.getStuId())
302 .subscribeOn(Schedulers.io()) 302 .subscribeOn(Schedulers.io())
303 .observeOn(AndroidSchedulers.mainThread()) 303 .observeOn(AndroidSchedulers.mainThread())
304 .compose(RxLifecycleAndroid.bindFragment(getRxLifecycle())) 304 .compose(RxLifecycleAndroid.bindFragment(getRxLifecycle()))
305 .map(ResponseResult::getData) 305 .map(ResponseResult::getData)
306 .toObservable() 306 .toObservable()
307 .concatMap(Observable::fromIterable) 307 .concatMap(Observable::fromIterable)
308 .filter(data -> subject.equals(data.getSubject())) 308 .filter(data -> subject.equals(data.getSubject()))
309 //.filter(data -> data.getRight() == null) 309 //.filter(data -> data.getRight() == null)
310 .take(5) 310 .take(5)
311 .toList() 311 .toList()
312 .subscribe((data, th) -> { 312 .subscribe((data, th) -> {
313 if (th != null) th.printStackTrace(); 313 if (th != null) th.printStackTrace();
314 homeworkAdapter.setNewData(data); 314 homeworkAdapter.setNewData(data);
315 if (binding.tabLayout.getSelectedTabPosition() == 1) { 315 if (binding.tabLayout.getSelectedTabPosition() == 1) {
316 binding.rvMain.setVisibility(data == null || data.isEmpty() ? View.GONE : View.VISIBLE); 316 binding.rvMain.setVisibility(data == null || data.isEmpty() ? View.GONE : View.VISIBLE);
317 binding.llEmpty.setVisibility(data == null || data.isEmpty() ? View.VISIBLE : View.GONE); 317 binding.llEmpty.setVisibility(data == null || data.isEmpty() ? View.VISIBLE : View.GONE);
318 } 318 }
319 }); 319 });
320 } 320 }
321 321
322 private void getError(String subject) { 322 private void getError(String subject) {
323 if (studentBean == null) { 323 if (studentBean == null) {
324 return; 324 return;
325 } 325 }
326 Map<String, Object> map = new HashMap<>(); 326 Map<String, Object> map = new HashMap<>();
327 map.put("subject", subject); 327 map.put("subject", subject);
328 map.put("stuId", studentBean.getStuId()); 328 map.put("stuId", studentBean.getStuId());
329 map.put("pageSize", 5); 329 map.put("pageSize", 5);
330 map.put("pageNum", 1); 330 map.put("pageNum", 1);
331 NetWorks.getError(map, new Observer<ResponseResult<PageInfo<TopicBean>>>() { 331 NetWorks.getError(map, new Observer<ResponseResult<PageInfo<TopicBean>>>() {
332 @Override 332 @Override
333 public void onSubscribe(Disposable d) { 333 public void onSubscribe(Disposable d) {
334 } 334 }
335 @Override 335 @Override
336 public void onNext(ResponseResult<PageInfo<TopicBean>> result) { 336 public void onNext(ResponseResult<PageInfo<TopicBean>> result) {
337 if (result.getData() != null && result.getCode() == 200) { 337 if (result.getData() != null && result.getCode() == 200) {
338 List<TopicBean> topicBeans = result.getData().getList(); 338 List<TopicBean> topicBeans = result.getData().getList();
339 errorAdapter.refresh(topicBeans); 339 errorAdapter.refresh(topicBeans);
340 if (binding.tabLayout.getSelectedTabPosition() == 0) { 340 if (binding.tabLayout.getSelectedTabPosition() == 0) {
341 if (topicBeans.size() > 0) { 341 if (topicBeans.size() > 0) {
342 getBinding().rvMain.setVisibility(View.VISIBLE); 342 getBinding().rvMain.setVisibility(View.VISIBLE);
343 getBinding().llEmpty.setVisibility(View.GONE); 343 getBinding().llEmpty.setVisibility(View.GONE);
344 } else { 344 } else {
345 getBinding().rvMain.setVisibility(View.GONE); 345 getBinding().rvMain.setVisibility(View.GONE);
346 getBinding().llEmpty.setVisibility(View.VISIBLE); 346 getBinding().llEmpty.setVisibility(View.VISIBLE);
347 } 347 }
348 } 348 }
349 } 349 }
350 } 350 }
351 @Override 351 @Override
352 public void onError(Throwable e) { 352 public void onError(Throwable e) {
353 e.printStackTrace(); 353 e.printStackTrace();
354 } 354 }
355 @Override 355 @Override
356 public void onComplete() { 356 public void onComplete() {
357 } 357 }
358 }); 358 });
359 } 359 }
360 360
361 @Override 361 @Override
362 public void onResume() { 362 public void onResume() {
363 super.onResume(); 363 super.onResume();
364 String subStr = getResources().getStringArray(R.array.filter_subject)[subject]; 364 String subStr = getResources().getStringArray(R.array.filter_subject)[subject];
365 getError(subStr); 365 getError(subStr);
366 getHomework(subStr); 366 getHomework(subStr);
367 } 367 }
368 368
369 public class HandlerCallBack implements IHandlerCallBack<ImageInfo> { 369 public class HandlerCallBack implements IHandlerCallBack<ImageInfo> {
370 int type; 370 int type;
371 public HandlerCallBack(int type) { 371 public HandlerCallBack(int type) {
372 this.type = type; 372 this.type = type;
373 } 373 }
374 374
375 private String TAG = "---ImagePicker---"; 375 private String TAG = "---ImagePicker---";
376 List<ImageInfo> photoList = new ArrayList<>(); 376 List<ImageInfo> photoList = new ArrayList<>();
377 377
378 @Override 378 @Override
379 public void onStart() { 379 public void onStart() {
380 Log.i(TAG, "onStart: 开启"); 380 Log.i(TAG, "onStart: 开启");
381 } 381 }
382 382
383 @Override 383 @Override
384 public void onSuccess(List<ImageInfo> photoList) { 384 public void onSuccess(List<ImageInfo> photoList) {
385 this.photoList = photoList; 385 this.photoList = photoList;
386 Log.i(TAG, "onSuccess: 返回数据"); 386 Log.i(TAG, "onSuccess: 返回数据");
387 } 387 }
388 388
389 @Override 389 @Override
390 public void onCancel() { 390 public void onCancel() {
391 Log.i(TAG, "onCancel: 取消"); 391 Log.i(TAG, "onCancel: 取消");
392 } 392 }
393 393
394 @Override 394 @Override
395 public void onFinish(List<ImageInfo> selectImage) { 395 public void onFinish(List<ImageInfo> selectImage) {
396 if (selectImage.size() == photoList.size()) { 396 if (selectImage.size() == photoList.size()) {
397 ArrayList<String> strings = new ArrayList<>(); 397 ArrayList<String> strings = new ArrayList<>();
398 Intent intent = new Intent(getActivity(), ImageActivity.class); 398 Intent intent = new Intent(getActivity(), ImageActivity.class);
399 for (ImageInfo imageInfo : selectImage) { 399 for (ImageInfo imageInfo : selectImage) {
400 strings.add(imageInfo.getPath()); 400 strings.add(imageInfo.getPath());
401 } 401 }
402 intent.putStringArrayListExtra("images", strings); 402 intent.putStringArrayListExtra("images", strings);
403 intent.putExtra("type", type); 403 intent.putExtra("type", type);
404 startActivity(intent); 404 startActivity(intent);
405 } 405 }
406 } 406 }
407 407
408 @Override 408 @Override
409 public void onError() { 409 public void onError() {
410 Log.i(TAG, "onError: 出错"); 410 Log.i(TAG, "onError: 出错");
411 } 411 }
412 } 412 }
413 413
414 @Override 414 @Override
415 public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { 415 public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
416 super.onActivityResult(requestCode, resultCode, data); 416 super.onActivityResult(requestCode, resultCode, data);
417 if (resultCode != RESULT_OK) return; 417 if (resultCode != RESULT_OK) return;
418 if (requestCode == 0xA01 || requestCode == 0xA02 && !TextUtils.isEmpty(filePath)) { 418 if (requestCode == 0xA01 || requestCode == 0xA02 && !TextUtils.isEmpty(filePath)) {
419 Bitmap b = BitmapUtils.compress(BitmapFactory.decodeFile(filePath)); 419 Bitmap b = BitmapUtils.compress(BitmapFactory.decodeFile(filePath));
420 String path = getContext().getExternalFilesDir("images").getPath() + "/" + System.currentTimeMillis() + CommonUtil.getStr() + ".jpg"; 420 String path = getContext().getExternalFilesDir("images").getPath() + "/" + System.currentTimeMillis() + CommonUtil.getStr() + ".jpg";
421 CommonUtil.saveBitmapToUri(b, path); 421 CommonUtil.saveBitmapToUri(b, path);
422 ArrayList<String> strings = new ArrayList<>(); 422 ArrayList<String> strings = new ArrayList<>();
423 Intent intent = new Intent(getContext(), ImageActivity.class); 423 Intent intent = new Intent(getContext(), ImageActivity.class);
424 strings.add(path); 424 strings.add(path);
425 intent.putStringArrayListExtra("images", strings); 425 intent.putStringArrayListExtra("images", strings);
426 intent.putExtra("type", requestCode == 0xA01 ? 0 : 1); 426 intent.putExtra("type", requestCode == 0xA01 ? 0 : 1);
427 startActivity(intent); 427 startActivity(intent);
428 } 428 }
429 } 429 }
430 } 430 }
431 431
app/src/main/res/layout/activity_homework_detail.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout 2 <LinearLayout
3 xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:android="http://schemas.android.com/apk/res/android"
4 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:app="http://schemas.android.com/apk/res-auto"
5 xmlns:tools="http://schemas.android.com/tools" 5 xmlns:tools="http://schemas.android.com/tools"
6 android:orientation="vertical" 6 android:orientation="vertical"
7 android:layout_width="match_parent" 7 android:layout_width="match_parent"
8 android:layout_height="match_parent" 8 android:layout_height="match_parent"
9 tools:ignore="HardcodedText,SpUsage"> 9 tools:ignore="HardcodedText,SpUsage">
10 10
11 <androidx.appcompat.widget.Toolbar 11 <androidx.appcompat.widget.Toolbar
12 android:id="@+id/toolbar" 12 android:id="@+id/toolbar"
13 app:navigationIcon="@drawable/svg_back" 13 app:navigationIcon="@drawable/svg_back"
14 app:contentInsetStart="0dp" 14 app:contentInsetStart="0dp"
15 app:contentInsetStartWithNavigation="0dp"
15 app:contentInsetStartWithNavigation="0dp" 16 android:paddingStart="-8dp"
16 android:paddingStart="-8dp" 17 android:paddingEnd="-8dp"
17 android:paddingEnd="-8dp" 18 android:background="@color/white"
18 android:background="@color/white" 19 android:layout_width="match_parent"
19 android:layout_width="match_parent" 20 android:layout_height="40dp">
20 android:layout_height="40dp"> 21 <TextView
21 <TextView 22 android:id="@+id/tvTitle"
22 android:id="@+id/tvTitle" 23 tools:text="2024年10月12日数学作业"
23 tools:text="2024年10月12日数学作业" 24 android:singleLine="true"
24 android:singleLine="true" 25 android:maxEms="10"
25 android:maxEms="10" 26 android:ellipsize="end"
26 android:ellipsize="end" 27 android:textSize="16dp"
27 android:textSize="16dp" 28 android:textColor="#333"
28 android:textColor="#333" 29 android:textStyle="bold"
29 android:textStyle="bold" 30 android:layout_width="wrap_content"
30 android:layout_width="wrap_content" 31 android:layout_height="wrap_content" />
31 android:layout_height="wrap_content" /> 32 <androidx.appcompat.widget.AppCompatImageView
32 <androidx.appcompat.widget.AppCompatImageView 33 android:id="@+id/btnEdit"
33 android:id="@+id/btnEdit" 34 android:src="@drawable/svg_homework_edit"
34 android:src="@drawable/svg_homework_edit" 35 android:layout_marginStart="5dp"
35 android:layout_marginStart="5dp" 36 android:layout_width="18dp"
36 android:layout_width="18dp" 37 android:layout_height="18dp"/>
37 android:layout_height="18dp"/> 38 <TextView
38 <TextView 39 android:id="@+id/btnFeedback"
39 android:id="@+id/btnFeedback" 40 android:text="反馈作业"
40 android:text="反馈作业" 41 android:textSize="13dp"
41 android:textSize="13dp" 42 android:textColor="#1C90F3"
42 android:textColor="#1C90F3" 43 android:textStyle="bold"
43 android:textStyle="bold" 44 android:layout_gravity="end|center_vertical"
44 android:layout_gravity="end|center_vertical" 45 android:layout_marginEnd="24dp"
45 android:layout_marginEnd="24dp" 46 android:layout_width="wrap_content"
46 android:layout_width="wrap_content" 47 android:layout_height="wrap_content"/>
47 android:layout_height="wrap_content"/> 48 </androidx.appcompat.widget.Toolbar>
48 </androidx.appcompat.widget.Toolbar> 49
49 50 <androidx.recyclerview.widget.RecyclerView
50 <androidx.recyclerview.widget.RecyclerView 51 android:id="@+id/recyclerView"
51 android:id="@+id/recyclerView" 52 android:orientation="vertical"
52 android:orientation="vertical" 53 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
53 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" 54 android:layout_width="match_parent"
54 android:layout_width="match_parent" 55 android:layout_height="match_parent"/>
55 android:layout_height="match_parent"/> 56
56 57 </LinearLayout>
app/src/main/res/layout/activity_homework_feedback.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout 2 <LinearLayout
3 xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:android="http://schemas.android.com/apk/res/android"
4 xmlns:app="http://schemas.android.com/apk/res-auto" 4 xmlns:app="http://schemas.android.com/apk/res-auto"
5 xmlns:tools="http://schemas.android.com/tools" 5 xmlns:tools="http://schemas.android.com/tools"
6 android:orientation="vertical" 6 android:orientation="vertical"
7 android:layout_width="match_parent" 7 android:layout_width="match_parent"
8 android:layout_height="match_parent" 8 android:layout_height="match_parent"
9 tools:ignore="UseCompoundDrawables,HardcodedText,SmallSp,ContentDescription"> 9 tools:ignore="UseCompoundDrawables,HardcodedText,SmallSp,ContentDescription">
10 10
11 <androidx.appcompat.widget.Toolbar 11 <androidx.appcompat.widget.Toolbar
12 android:id="@+id/toolbar" 12 android:id="@+id/toolbar"
13 app:navigationIcon="@drawable/svg_back" 13 app:navigationIcon="@drawable/svg_back"
14 app:contentInsetStartWithNavigation="14dp" 14 app:contentInsetStartWithNavigation="14dp"
15 android:paddingStart="-8dp" 15 android:paddingStart="-8dp"
16 android:paddingEnd="-8dp" 16 android:paddingEnd="-8dp"
17 android:background="@color/white" 17 android:background="@color/white"
18 android:layout_width="match_parent" 18 android:layout_width="match_parent"
19 android:layout_height="40dp"> 19 android:layout_height="40dp">
20 <TextView 20 <TextView
21 android:text="第二步:教师评语" 21 android:text="第二步:教师评语"
22 android:textSize="18sp" 22 android:textSize="18sp"
23 android:textColor="#333" 23 android:textColor="#333"
24 android:textStyle="bold" 24 android:textStyle="bold"
25 android:layout_gravity="center" 25 android:layout_gravity="center"
26 android:layout_width="wrap_content" 26 android:layout_width="wrap_content"
27 android:layout_height="wrap_content"/> 27 android:layout_height="wrap_content"/>
28 <TextView 28 <TextView
29 android:id="@+id/btnPublish" 29 android:id="@+id/btnPublish"
30 android:text="发布" 30 android:text="发布"
31 android:textSize="13sp" 31 android:textSize="13sp"
32 android:textColor="#1C90F3" 32 android:textColor="#1C90F3"
33 android:textStyle="bold" 33 android:textStyle="bold"
34 android:layout_gravity="end|center_vertical" 34 android:layout_gravity="end|center_vertical"
35 android:layout_marginEnd="24dp" 35 android:layout_marginEnd="24dp"
36 android:layout_width="wrap_content" 36 android:layout_width="wrap_content"
37 android:layout_height="wrap_content"/> 37 android:layout_height="wrap_content"/>
38 </androidx.appcompat.widget.Toolbar> 38 </androidx.appcompat.widget.Toolbar>
39 39
40 <androidx.core.widget.NestedScrollView 40 <androidx.core.widget.NestedScrollView
41 android:layout_width="match_parent" 41 android:layout_width="match_parent"
42 android:layout_height="match_parent"> 42 android:layout_height="match_parent">
43 <LinearLayout 43 <LinearLayout
44 android:orientation="vertical" 44 android:orientation="vertical"
45 android:paddingHorizontal="15dp" 45 android:paddingHorizontal="15dp"
46 android:paddingBottom="20dp" 46 android:paddingBottom="20dp"
47 android:layout_width="match_parent" 47 android:layout_width="match_parent"
48 android:layout_height="wrap_content"> 48 android:layout_height="wrap_content">
49 49
50 <LinearLayout 50 <LinearLayout
51 android:orientation="vertical" 51 android:orientation="vertical"
52 android:background="@drawable/shape_radius_10" 52 android:background="@drawable/shape_radius_10"
53 android:backgroundTint="@color/white" 53 android:backgroundTint="@color/white"
54 android:layout_marginTop="15dp" 54 android:layout_marginTop="15dp"
55 android:layout_width="match_parent" 55 android:layout_width="match_parent"
56 android:layout_height="wrap_content"> 56 android:layout_height="wrap_content">
57 <androidx.appcompat.widget.AppCompatTextView 57 <androidx.appcompat.widget.AppCompatTextView
58 android:text="学生信息" 58 android:text="学生信息"
59 android:textSize="16sp" 59 android:textSize="16sp"
60 android:textColor="#333" 60 android:textColor="#333"
61 android:textStyle="bold" 61 android:textStyle="bold"
62 android:gravity="center_vertical" 62 android:gravity="center_vertical"
63 android:paddingHorizontal="15dp" 63 android:paddingHorizontal="15dp"
64 android:drawablePadding="5dp" 64 android:drawablePadding="5dp"
65 android:drawableStart="@drawable/svg_ic_stu_info" 65 android:drawableStart="@drawable/svg_ic_stu_info"
66 android:background="@drawable/shape_radius_top_10" 66 android:background="@drawable/shape_radius_top_10"
67 android:backgroundTint="#DAEBFE" 67 android:backgroundTint="#DAEBFE"
68 android:layout_width="match_parent" 68 android:layout_width="match_parent"
69 android:layout_height="40dp"/> 69 android:layout_height="40dp"/>
70 <LinearLayout 70 <LinearLayout
71 android:orientation="horizontal" 71 android:orientation="horizontal"
72 android:layout_marginHorizontal="15dp" 72 android:layout_marginHorizontal="15dp"
73 android:layout_marginVertical="18dp" 73 android:layout_marginVertical="18dp"
74 android:layout_width="match_parent" 74 android:layout_width="match_parent"
75 android:layout_height="wrap_content"> 75 android:layout_height="wrap_content">
76 <TextView 76 <TextView
77 android:text="学生姓名:" 77 android:text="学生姓名:"
78 android:textSize="14sp" 78 android:textSize="14sp"
79 android:textColor="#333" 79 android:textColor="#333"
80 android:layout_width="wrap_content" 80 android:layout_width="wrap_content"
81 android:layout_height="wrap_content"/> 81 android:layout_height="wrap_content"/>
82 <TextView 82 <TextView
83 android:id="@+id/tvStuName" 83 android:id="@+id/tvStuName"
84 tools:text="杨小凯" 84 tools:text="杨小凯"
85 android:textSize="14sp" 85 android:textSize="14sp"
86 android:textColor="#333" 86 android:textColor="#333"
87 android:layout_width="wrap_content" 87 android:layout_width="wrap_content"
88 android:layout_height="wrap_content"/> 88 android:layout_height="wrap_content"/>
89 <Space style="@style/empty_space"/> 89 <Space style="@style/empty_space"/>
90 <TextView 90 <TextView
91 android:text="年级:" 91 android:text="年级:"
92 android:textSize="14sp" 92 android:textSize="14sp"
93 android:textColor="#333" 93 android:textColor="#333"
94 android:layout_width="wrap_content" 94 android:layout_width="wrap_content"
95 android:layout_height="wrap_content"/> 95 android:layout_height="wrap_content"/>
96 <TextView 96 <TextView
97 android:id="@+id/tvGrade" 97 android:id="@+id/tvGrade"
98 tools:text="六年级" 98 tools:text="六年级"
99 android:textSize="14sp" 99 android:textSize="14sp"
100 android:textColor="#333" 100 android:textColor="#333"
101 android:layout_width="96dp" 101 android:layout_width="96dp"
102 android:layout_height="wrap_content"/> 102 android:layout_height="wrap_content"/>
103 </LinearLayout> 103 </LinearLayout>
104 </LinearLayout> 104 </LinearLayout>
105 105
106 <LinearLayout 106 <LinearLayout
107 android:orientation="vertical" 107 android:orientation="vertical"
108 android:background="@drawable/shape_radius_10" 108 android:background="@drawable/shape_radius_10"
109 android:backgroundTint="@color/white" 109 android:backgroundTint="@color/white"
110 android:paddingBottom="15dp" 110 android:paddingBottom="15dp"
111 android:layout_marginTop="15dp" 111 android:layout_marginTop="15dp"
112 android:layout_width="match_parent" 112 android:layout_width="match_parent"
113 android:layout_height="wrap_content"> 113 android:layout_height="wrap_content">
114 <androidx.appcompat.widget.AppCompatTextView 114 <androidx.appcompat.widget.AppCompatTextView
115 android:text="作业详情" 115 android:text="作业详情"
116 android:textSize="16sp" 116 android:textSize="16sp"
117 android:textColor="#333" 117 android:textColor="#333"
118 android:textStyle="bold" 118 android:textStyle="bold"
119 android:gravity="center_vertical" 119 android:gravity="center_vertical"
120 android:paddingHorizontal="15dp" 120 android:paddingHorizontal="15dp"
121 android:drawablePadding="5dp" 121 android:drawablePadding="5dp"
122 android:drawableStart="@drawable/svg_ic_correct" 122 android:drawableStart="@drawable/svg_ic_correct"
123 android:background="@drawable/shape_radius_top_10" 123 android:background="@drawable/shape_radius_top_10"
124 android:backgroundTint="#DAEBFE" 124 android:backgroundTint="#DAEBFE"
125 android:layout_width="match_parent" 125 android:layout_width="match_parent"
126 android:layout_height="40dp"/> 126 android:layout_height="40dp"/>
127 <LinearLayout 127 <LinearLayout
128 android:orientation="horizontal" 128 android:orientation="horizontal"
129 android:layout_marginHorizontal="15dp" 129 android:layout_marginHorizontal="15dp"
130 android:layout_marginTop="15dp" 130 android:layout_marginTop="15dp"
131 android:layout_width="match_parent" 131 android:layout_width="match_parent"
132 android:layout_height="wrap_content"> 132 android:layout_height="wrap_content">
133 <TextView 133 <TextView
134 android:text="正确率:" 134 android:text="正确率:"
135 android:textSize="14sp" 135 android:textSize="14sp"
136 android:textColor="#333" 136 android:textColor="#333"
137 android:layout_width="wrap_content" 137 android:layout_width="wrap_content"
138 android:layout_height="wrap_content"/> 138 android:layout_height="wrap_content"/>
139 <TextView 139 <TextView
140 android:id="@+id/tvPercent" 140 android:id="@+id/tvPercent"
141 tools:text="60%" 141 tools:text="60%"
142 android:textSize="14sp" 142 android:textSize="14sp"
143 android:textColor="#333" 143 android:textColor="#333"
144 android:layout_width="wrap_content" 144 android:layout_width="wrap_content"
145 android:layout_height="wrap_content"/> 145 android:layout_height="wrap_content"/>
146 <Space style="@style/empty_space"/> 146 </LinearLayout>
147 <LinearLayout
148 android:orientation="horizontal"
149 android:layout_marginHorizontal="15dp"
150 android:layout_marginTop="15dp"
151 android:layout_width="match_parent"
152 android:layout_height="wrap_content">
147 <TextView 153 <TextView
148 android:text="答题结果" 154 android:text="答题结果"
149 android:textSize="14sp" 155 android:textSize="14sp"
150 android:textColor="#333" 156 android:textColor="#333"
151 android:layout_width="wrap_content" 157 android:layout_width="wrap_content"
152 android:layout_height="wrap_content"/> 158 android:layout_height="wrap_content"/>
153 <TextView 159 <TextView
154 android:id="@+id/btnDetail" 160 android:id="@+id/btnDetail"
155 android:text="(点击查看题目详情)" 161 android:text="(点击查看题目详情)"
156 android:textSize="14sp" 162 android:textSize="14sp"
157 android:textColor="#1C90F3" 163 android:textColor="#1C90F3"
158 android:layout_width="wrap_content" 164 android:layout_width="wrap_content"
159 android:layout_height="wrap_content"/> 165 android:layout_height="wrap_content"/>
160 </LinearLayout> 166 </LinearLayout>
161 167
162 <androidx.recyclerview.widget.RecyclerView 168 <androidx.recyclerview.widget.RecyclerView
163 android:id="@+id/rvCorrect" 169 android:id="@+id/rvCorrect"
164 tools:listitem="@layout/item_feedback_num" 170 tools:listitem="@layout/item_feedback_num"
165 tools:itemCount="1" 171 tools:itemCount="1"
166 android:layout_marginTop="15dp" 172 android:layout_marginTop="15dp"
167 android:layout_marginHorizontal="15dp" 173 android:layout_marginHorizontal="15dp"
168 android:layout_width="match_parent" 174 android:layout_width="match_parent"
169 android:layout_height="wrap_content"/> 175 android:layout_height="wrap_content"/>
170 <TextView 176 <TextView
171 android:text="错题已经加入到错题本,到错题本查看详情" 177 android:text="错题已经加入到错题本,到错题本查看详情"
172 android:textSize="12sp" 178 android:textSize="12sp"
173 android:textColor="#666" 179 android:textColor="#666"
174 android:layout_marginHorizontal="15dp" 180 android:layout_marginHorizontal="15dp"
175 android:layout_width="wrap_content" 181 android:layout_width="wrap_content"
176 android:layout_height="wrap_content"/> 182 android:layout_height="wrap_content"/>
177 </LinearLayout> 183 </LinearLayout>
178 184
179 <LinearLayout 185 <LinearLayout
180 android:id="@+id/flEval" 186 android:id="@+id/flEval"
181 android:orientation="vertical" 187 android:orientation="vertical"
182 android:background="@drawable/shape_radius_10" 188 android:background="@drawable/shape_radius_10"
183 android:backgroundTint="@color/white" 189 android:backgroundTint="@color/white"
184 android:layout_marginTop="15dp" 190 android:layout_marginTop="15dp"
191 android:paddingBottom="16dp"
185 android:layout_width="match_parent" 192 android:layout_width="match_parent"
186 android:layout_height="wrap_content"> 193 android:layout_height="wrap_content">
187 <androidx.appcompat.widget.AppCompatTextView 194 <androidx.appcompat.widget.AppCompatTextView
188 android:text="辅导后错题掌握评估" 195 android:text="辅导后错题掌握评估"
189 android:textSize="16sp" 196 android:textSize="16sp"
190 android:textColor="#333" 197 android:textColor="#333"
191 android:textStyle="bold" 198 android:textStyle="bold"
192 android:gravity="center_vertical" 199 android:gravity="center_vertical"
193 android:paddingHorizontal="15dp" 200 android:paddingHorizontal="15dp"
194 android:drawablePadding="5dp" 201 android:drawablePadding="5dp"
195 android:drawableStart="@drawable/svg_ic_paper" 202 android:drawableStart="@drawable/svg_ic_paper"
196 android:background="@drawable/shape_radius_top_10" 203 android:background="@drawable/shape_radius_top_10"
197 android:backgroundTint="#DAEBFE" 204 android:backgroundTint="#DAEBFE"
198 android:layout_width="match_parent" 205 android:layout_width="match_parent"
199 android:layout_height="40dp"/> 206 android:layout_height="40dp"/>
200 <androidx.recyclerview.widget.RecyclerView 207 <androidx.recyclerview.widget.RecyclerView
201 android:id="@+id/rvError" 208 android:id="@+id/rvError"
202 android:orientation="vertical" 209 android:orientation="vertical"
203 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" 210 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
204 android:layout_width="match_parent" 211 android:layout_width="match_parent"
205 android:layout_height="wrap_content"/> 212 android:layout_height="wrap_content"/>
206 </LinearLayout> 213 </LinearLayout>
207 214
208 <LinearLayout 215 <LinearLayout
209 android:orientation="vertical" 216 android:orientation="vertical"
210 android:background="@drawable/shape_radius_10" 217 android:background="@drawable/shape_radius_10"
211 android:backgroundTint="@color/white" 218 android:backgroundTint="@color/white"
212 android:layout_marginTop="15dp" 219 android:layout_marginTop="15dp"
213 android:layout_width="match_parent" 220 android:layout_width="match_parent"
214 android:layout_height="wrap_content"> 221 android:layout_height="wrap_content">
215 <androidx.appcompat.widget.AppCompatTextView 222 <androidx.appcompat.widget.AppCompatTextView
216 android:text="教师评语" 223 android:text="教师评语"
217 android:textSize="16sp" 224 android:textSize="16sp"
218 android:textColor="#333" 225 android:textColor="#333"
219 android:textStyle="bold" 226 android:textStyle="bold"
220 android:gravity="center_vertical" 227 android:gravity="center_vertical"
221 android:paddingHorizontal="15dp" 228 android:paddingHorizontal="15dp"
222 android:drawablePadding="5dp" 229 android:drawablePadding="5dp"
223 android:drawableStart="@drawable/svg_ic_comment" 230 android:drawableStart="@drawable/svg_ic_comment"
224 android:background="@drawable/shape_radius_top_10" 231 android:background="@drawable/shape_radius_top_10"
225 android:backgroundTint="#DAEBFE" 232 android:backgroundTint="#DAEBFE"
226 android:layout_width="match_parent" 233 android:layout_width="match_parent"
227 android:layout_height="40dp"/> 234 android:layout_height="40dp"/>
228 <EditText 235 <EditText
229 android:id="@+id/etComment" 236 android:id="@+id/etComment"
230 android:hint="非必填, 不超过300字" 237 android:hint="非必填, 不超过300字"
231 android:maxLength="300" 238 android:maxLength="300"
232 android:textSize="13sp" 239 android:textSize="13sp"
233 android:textColor="#333" 240 android:textColor="#333"
234 android:textColorHint="#999" 241 android:textColorHint="#999"
235 android:gravity="start" 242 android:gravity="start"
236 android:background="@null" 243 android:background="@null"
237 android:layout_margin="14dp" 244 android:layout_margin="14dp"
238 android:layout_width="match_parent" 245 android:layout_width="match_parent"
239 android:layout_height="wrap_content" 246 android:layout_height="wrap_content"
240 tools:ignore="Autofill,LabelFor,TextFields" /> 247 tools:ignore="Autofill,LabelFor,TextFields" />
241 </LinearLayout> 248 </LinearLayout>
242 249
243 250
244 </LinearLayout> 251 </LinearLayout>
245 </androidx.core.widget.NestedScrollView> 252 </androidx.core.widget.NestedScrollView>
246 </LinearLayout> 253 </LinearLayout>
app/src/main/res/layout/activity_student_homework.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto" 3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 xmlns:tools="http://schemas.android.com/tools" 4 xmlns:tools="http://schemas.android.com/tools"
5 android:orientation="vertical" 5 android:orientation="vertical"
6 android:layout_width="match_parent" 6 android:layout_width="match_parent"
7 android:layout_height="match_parent" 7 android:layout_height="match_parent"
8 tools:ignore="HardcodedText"> 8 tools:ignore="HardcodedText">
9 9
10 <androidx.appcompat.widget.Toolbar 10 <androidx.appcompat.widget.Toolbar
11 android:id="@+id/toolbar" 11 android:id="@+id/toolbar"
12 app:navigationIcon="@drawable/svg_back" 12 app:navigationIcon="@drawable/svg_back"
13 android:paddingStart="-8dp" 13 android:paddingStart="-8dp"
14 android:paddingEnd="-8dp" 14 android:paddingEnd="-8dp"
15 android:background="@color/white" 15 android:background="@color/white"
16 android:layout_width="match_parent" 16 android:layout_width="match_parent"
17 android:layout_height="40dp"> 17 android:layout_height="40dp">
18 <TextView 18 <TextView
19 android:id="@+id/tvTitle" 19 android:id="@+id/tvTitle"
20 tools:text="小明的全部作业" 20 tools:text="小明的全部作业"
21 android:textSize="18sp" 21 android:textSize="18sp"
22 android:textColor="#333" 22 android:textColor="#333"
23 android:textStyle="bold" 23 android:textStyle="bold"
24 android:layout_marginEnd="6dp" 24 android:layout_marginEnd="6dp"
25 android:layout_gravity="center" 25 android:layout_gravity="center"
26 android:layout_width="wrap_content" 26 android:layout_width="wrap_content"
27 android:layout_height="wrap_content"/> 27 android:layout_height="wrap_content"/>
28 <ImageView 28 <ImageView
29 android:id="@+id/btnChangeStudent" 29 android:id="@+id/btnChangeStudent"
30 android:src="@drawable/png_ic_change_student" 30 android:src="@drawable/png_ic_change_student"
31 android:layout_gravity="center" 31 android:layout_gravity="center"
32 android:layout_width="20dp" 32 android:layout_width="20dp"
33 android:layout_height="20dp"/> 33 android:layout_height="20dp"/>
34 </androidx.appcompat.widget.Toolbar> 34 </androidx.appcompat.widget.Toolbar>
35 <com.google.android.material.tabs.TabLayout 35 <com.google.android.material.tabs.TabLayout
36 android:id="@+id/tabLayout" 36 android:id="@+id/tabLayout"
37 app:tabMode="scrollable" 37 app:tabMode="scrollable"
38 app:tabGravity="start" 38 app:tabGravity="start"
39 android:paddingHorizontal="8dp"
39 android:paddingHorizontal="8dp" 40 app:tabTextColor="#333333"
40 app:tabTextColor="#333333" 41 app:tabSelectedTextColor="#1C90F3"
41 app:tabSelectedTextColor="#1C90F3" 42 app:tabIndicatorColor="#1C90F3"
42 app:tabIndicatorColor="#1C90F3" 43 app:tabIndicatorHeight="2dp"
43 app:tabIndicatorHeight="2dp" 44 app:tabIndicatorFullWidth="false"
44 app:tabIndicatorFullWidth="false" 45 app:tabTextAppearance="@style/tab_homework"
45 app:tabTextAppearance="@style/tab_homework" 46 app:tabRippleColor="@color/transparent"
46 app:tabRippleColor="@color/transparent" 47 android:background="@color/white"
47 android:background="@color/white" 48 android:layout_width="match_parent"
48 android:layout_width="match_parent" 49 android:layout_height="45dp"/>
49 android:layout_height="45dp"/> 50 <LinearLayout
50 <LinearLayout 51 android:id="@+id/filterBar"
51 android:id="@+id/filterBar" 52 android:orientation="horizontal"
52 android:orientation="horizontal" 53 android:background="@color/white"
53 android:background="@color/white" 54 android:paddingHorizontal="15dp"
54 android:paddingHorizontal="15dp" 55 android:paddingVertical="11dp"
55 android:paddingVertical="11dp" 56 android:layout_width="match_parent"
56 android:layout_width="match_parent" 57 android:layout_height="wrap_content">
57 android:layout_height="wrap_content"> 58 <androidx.appcompat.widget.AppCompatTextView
58 <androidx.appcompat.widget.AppCompatTextView 59 android:id="@+id/ftSubject"
59 android:id="@+id/ftSubject" 60 android:text="学科"
60 android:text="学科" 61 style="@style/tv_StudentHomeworkFilter"/>
61 style="@style/tv_StudentHomeworkFilter"/> 62 <Space style="@style/empty_space"/>
62 <Space style="@style/empty_space"/> 63 <androidx.appcompat.widget.AppCompatTextView
63 <androidx.appcompat.widget.AppCompatTextView 64 android:id="@+id/ftGrade"
64 android:id="@+id/ftGrade" 65 android:text="年级"
65 android:text="年级" 66 style="@style/tv_StudentHomeworkFilter"/>
66 style="@style/tv_StudentHomeworkFilter"/> 67 <Space style="@style/empty_space"/>
67 <Space style="@style/empty_space"/> 68 <androidx.appcompat.widget.AppCompatTextView
68 <androidx.appcompat.widget.AppCompatTextView 69 android:id="@+id/ftTerm"
69 android:id="@+id/ftTerm" 70 android:text="学期"
70 android:text="学期" 71 style="@style/tv_StudentHomeworkFilter"/>
71 style="@style/tv_StudentHomeworkFilter"/> 72 <Space style="@style/empty_space"/>
72 <Space style="@style/empty_space"/> 73 <androidx.appcompat.widget.AppCompatTextView
73 <androidx.appcompat.widget.AppCompatTextView 74 android:id="@+id/ftFeedback"
74 android:id="@+id/ftFeedback" 75 android:text="反馈状态"
75 android:text="反馈状态" 76 style="@style/tv_StudentHomeworkFilter"/>
76 style="@style/tv_StudentHomeworkFilter"/> 77 </LinearLayout>
77 </LinearLayout> 78 <androidx.legacy.widget.Space
78 <androidx.legacy.widget.Space 79 android:id="@+id/anchorView"
79 android:id="@+id/anchorView" 80 android:layout_width="0dp"
80 android:layout_width="0dp" 81 android:layout_height="0dp"/>
81 android:layout_height="0dp"/> 82
82 83 <FrameLayout
83 <FrameLayout 84 android:id="@+id/weekBar"
84 android:id="@+id/weekBar" 85 android:visibility="gone"
85 android:visibility="gone" 86 android:layout_width="match_parent"
86 android:layout_width="match_parent" 87 android:layout_height="wrap_content">
87 android:layout_height="wrap_content"> 88 <TextView
88 <TextView 89 android:id="@+id/btnGeneralHuyou"
89 android:id="@+id/btnGeneralHuyou" 90 android:visibility="gone"
90 android:visibility="gone" 91 tools:visibility="visible"
91 tools:visibility="visible" 92 android:text="生成本周作业总结"
92 android:text="生成本周作业总结" 93 android:textSize="13sp"
93 android:textSize="13sp" 94 android:textColor="#1C90F3"
94 android:textColor="#1C90F3" 95 android:gravity="center"
95 android:gravity="center" 96 android:textStyle="bold"
96 android:textStyle="bold" 97 android:background="@drawable/btn_general_huyou"
97 android:background="@drawable/btn_general_huyou" 98 android:layout_marginTop="16dp"
99 android:layout_marginBottom="8dp"
98 android:layout_marginTop="16dp" 100 android:layout_marginHorizontal="30dp"
99 android:layout_marginBottom="8dp" 101 android:layout_width="match_parent"
100 android:layout_marginHorizontal="30dp" 102 android:layout_height="35dp"
101 android:layout_width="match_parent" 103 tools:ignore="HardcodedText" />
102 android:layout_height="35dp" 104 </FrameLayout>
103 tools:ignore="HardcodedText" /> 105
104 </FrameLayout> 106 <FrameLayout
105 107 android:id="@+id/stageBar"
106 <FrameLayout 108 android:visibility="gone"
107 android:id="@+id/stageBar" 109 android:layout_width="match_parent"
108 android:visibility="gone" 110 android:layout_height="wrap_content">
109 android:layout_width="match_parent" 111 <TextView
110 android:layout_height="wrap_content"> 112 android:id="@+id/btnStageHuyou"
111 <TextView 113 android:text="生成阶段性作业总结"
112 android:id="@+id/btnStageHuyou" 114 android:textSize="13sp"
113 android:text="生成阶段性作业总结" 115 android:textColor="#1C90F3"
114 android:textSize="13sp" 116 android:gravity="center"
115 android:textColor="#1C90F3" 117 android:textStyle="bold"
116 android:gravity="center" 118 android:background="@drawable/btn_general_huyou"
117 android:textStyle="bold" 119 android:layout_marginTop="16dp"
120 android:layout_marginBottom="8dp"
118 android:background="@drawable/btn_general_huyou" 121 android:layout_marginHorizontal="30dp"
119 android:layout_marginTop="16dp" 122 android:layout_width="match_parent"
120 android:layout_marginBottom="8dp" 123 android:layout_height="35dp"
121 android:layout_marginHorizontal="30dp" 124 tools:ignore="HardcodedText" />
122 android:layout_width="match_parent" 125 </FrameLayout>
123 android:layout_height="35dp" 126
124 tools:ignore="HardcodedText" /> 127 <androidx.recyclerview.widget.RecyclerView
125 </FrameLayout> 128 android:id="@+id/recyclerView"
126 129 android:background="#F8F8F8"
127 <androidx.recyclerview.widget.RecyclerView 130 android:orientation="vertical"
128 android:id="@+id/recyclerView" 131 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
129 android:background="#F8F8F8" 132 android:layout_width="match_parent"
130 android:orientation="vertical" 133 android:layout_height="match_parent"/>
131 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" 134 </LinearLayout>
app/src/main/res/layout/dialog_add_homework.xml
1 <FrameLayout 1 <FrameLayout
2 xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto" 3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 xmlns:tools="http://schemas.android.com/tools" 4 xmlns:tools="http://schemas.android.com/tools"
5 android:layout_width="match_parent" 5 android:layout_width="match_parent"
6 android:layout_height="match_parent" 6 android:layout_height="match_parent"
7 tools:ignore="HardcodedText,ContentDescription,UselessParent" > 7 tools:ignore="HardcodedText,ContentDescription,UselessParent" >
8 8
9 <LinearLayout 9 <LinearLayout
10 android:orientation="vertical" 10 android:orientation="vertical"
11 android:background="@drawable/shape_radius_top_10" 11 android:background="@drawable/shape_radius_top_10"
12 android:layout_gravity="bottom" 12 android:layout_gravity="bottom"
13 android:layout_width="match_parent" 13 android:layout_width="match_parent"
14 android:layout_height="wrap_content"> 14 android:layout_height="wrap_content">
15 15
16 <FrameLayout 16 <FrameLayout
17 android:layout_marginTop="8dp" 17 android:layout_marginTop="8dp"
18 android:layout_marginBottom="8dp" 18 android:layout_marginBottom="8dp"
19 android:layout_width="match_parent" 19 android:layout_width="match_parent"
20 android:layout_height="wrap_content"> 20 android:layout_height="wrap_content">
21 21
22 <TextView 22 <TextView
23 android:id="@+id/tvTitle" 23 android:id="@+id/tvTitle"
24 android:text="录入作业" 24 android:text="录入作业"
25 android:textSize="17sp" 25 android:textSize="17sp"
26 android:textStyle="bold" 26 android:textStyle="bold"
27 android:layout_gravity="center" 27 android:layout_gravity="center"
28 android:textColor="@color/text_title" 28 android:textColor="@color/text_title"
29 android:layout_width="wrap_content" 29 android:layout_width="wrap_content"
30 android:layout_height="wrap_content" /> 30 android:layout_height="wrap_content" />
31 31
32 <ImageView 32 <ImageView
33 android:id="@+id/btnClose" 33 android:id="@+id/btnClose"
34 android:padding="12dp" 34 android:padding="12dp"
35 android:src="@mipmap/ic_close" 35 android:src="@mipmap/ic_close"
36 android:layout_gravity="end|center_vertical" 36 android:layout_gravity="end|center_vertical"
37 android:layout_width="35dp" 37 android:layout_width="35dp"
38 android:layout_height="35dp" /> 38 android:layout_height="35dp" />
39 </FrameLayout> 39 </FrameLayout>
40 40
41 <androidx.core.widget.NestedScrollView 41 <androidx.core.widget.NestedScrollView
42 android:layout_width="match_parent" 42 android:layout_width="match_parent"
43 android:layout_height="match_parent"> 43 android:layout_height="match_parent">
44 <LinearLayout 44 <LinearLayout
45 android:orientation="vertical" 45 android:orientation="vertical"
46 android:layout_marginTop="-20dp" 46 android:layout_marginTop="-20dp"
47 android:layout_width="match_parent" 47 android:layout_width="match_parent"
48 android:layout_height="wrap_content"> 48 android:layout_height="wrap_content">
49 49
50 <TextView 50 <TextView
51 android:id="@+id/tvStu" 51 android:id="@+id/tvStu"
52 android:layout_marginTop="20dp" 52 android:layout_marginTop="20dp"
53 android:layout_width="wrap_content" 53 android:layout_width="wrap_content"
54 android:layout_height="wrap_content" 54 android:layout_height="wrap_content"
55 android:layout_marginHorizontal="15dp" 55 android:layout_marginHorizontal="15dp"
56 android:text="学生" 56 android:text="学生"
57 android:textColor="@color/text_title" 57 android:textColor="@color/text_title"
58 android:textSize="14sp" 58 android:textSize="14sp"
59 android:textStyle="bold" /> 59 android:textStyle="bold" />
60 60
61 <androidx.appcompat.widget.AppCompatSpinner 61 <androidx.appcompat.widget.AppCompatSpinner
62 android:id="@+id/spStudent" 62 android:id="@+id/spStudent"
63 style="@style/customSpinnerStyle" 63 style="@style/customSpinnerStyle"
64 android:layout_width="match_parent" 64 android:layout_width="match_parent"
65 android:layout_height="40dp" 65 android:layout_height="40dp"
66 android:layout_marginTop="10dp" 66 android:layout_marginTop="10dp"
67 android:layout_marginHorizontal="15dp" 67 android:layout_marginHorizontal="15dp"
68 android:background="@drawable/selector_for_input_spinner" 68 android:background="@drawable/selector_for_input_spinner"
69 android:popupBackground="@drawable/shape_for_input_spinner" 69 android:popupBackground="@drawable/shape_for_input_spinner"
70 android:scrollbars="none" /> 70 android:scrollbars="none" />
71 71
72 <TextView 72 <TextView
73 android:layout_width="wrap_content" 73 android:layout_width="wrap_content"
74 android:layout_height="wrap_content" 74 android:layout_height="wrap_content"
75 android:layout_marginHorizontal="15dp" 75 android:layout_marginHorizontal="15dp"
76 android:layout_marginTop="20dp" 76 android:layout_marginTop="20dp"
77 android:text="年级" 77 android:text="年级"
78 android:textColor="@color/text_title" 78 android:textColor="@color/text_title"
79 android:textSize="14sp" 79 android:textSize="14sp"
80 android:textStyle="bold" /> 80 android:textStyle="bold" />
81 81
82 <androidx.appcompat.widget.AppCompatSpinner 82 <androidx.appcompat.widget.AppCompatSpinner
83 android:id="@+id/spGrade" 83 android:id="@+id/spGrade"
84 style="@style/customSpinnerStyle" 84 style="@style/customSpinnerStyle"
85 android:layout_width="match_parent" 85 android:layout_width="match_parent"
86 android:layout_height="40dp" 86 android:layout_height="40dp"
87 android:layout_marginTop="10dp" 87 android:layout_marginTop="10dp"
88 android:layout_marginHorizontal="15dp" 88 android:layout_marginHorizontal="15dp"
89 android:background="@drawable/selector_for_input_spinner" 89 android:background="@drawable/selector_for_input_spinner"
90 android:popupBackground="@drawable/shape_for_input_spinner" 90 android:popupBackground="@drawable/shape_for_input_spinner"
91 android:scrollbars="none" /> 91 android:scrollbars="none" />
92 92
93 <TextView 93 <TextView
94 android:layout_width="wrap_content" 94 android:layout_width="wrap_content"
95 android:layout_height="wrap_content" 95 android:layout_height="wrap_content"
96 android:layout_marginHorizontal="15dp" 96 android:layout_marginHorizontal="15dp"
97 android:layout_marginTop="20dp" 97 android:layout_marginTop="20dp"
98 android:text="学期" 98 android:text="学期"
99 android:textColor="@color/text_title" 99 android:textColor="@color/text_title"
100 android:textSize="14sp" 100 android:textSize="14sp"
101 android:textStyle="bold" /> 101 android:textStyle="bold" />
102 102
103 <androidx.appcompat.widget.AppCompatSpinner 103 <androidx.appcompat.widget.AppCompatSpinner
104 android:id="@+id/spTerm" 104 android:id="@+id/spTerm"
105 style="@style/customSpinnerStyle" 105 style="@style/customSpinnerStyle"
106 android:layout_width="match_parent" 106 android:layout_width="match_parent"
107 android:layout_height="40dp" 107 android:layout_height="40dp"
108 android:layout_marginTop="10dp" 108 android:layout_marginTop="10dp"
109 android:layout_marginHorizontal="15dp" 109 android:layout_marginHorizontal="15dp"
110 android:background="@drawable/selector_for_input_spinner" 110 android:background="@drawable/selector_for_input_spinner"
111 android:entries="@array/grade_array" 111 android:entries="@array/grade_array"
112 android:popupBackground="@drawable/shape_for_input_spinner" 112 android:popupBackground="@drawable/shape_for_input_spinner"
113 android:scrollbars="none" /> 113 android:scrollbars="none" />
114 114
115 <TextView 115 <TextView
116 android:layout_width="wrap_content" 116 android:layout_width="wrap_content"
117 android:layout_height="wrap_content" 117 android:layout_height="wrap_content"
118 android:layout_marginHorizontal="15dp" 118 android:layout_marginHorizontal="15dp"
119 android:layout_marginTop="20dp" 119 android:layout_marginTop="20dp"
120 android:text="科目" 120 android:text="科目"
121 android:textColor="@color/text_title" 121 android:textColor="@color/text_title"
122 android:textSize="14sp" 122 android:textSize="14sp"
123 android:textStyle="bold" /> 123 android:textStyle="bold" />
124 124
125 <androidx.appcompat.widget.AppCompatSpinner 125 <androidx.appcompat.widget.AppCompatSpinner
126 android:id="@+id/spSubject" 126 android:id="@+id/spSubject"
127 style="@style/customSpinnerStyle" 127 style="@style/customSpinnerStyle"
128 android:layout_width="match_parent" 128 android:layout_width="match_parent"
129 android:layout_height="40dp" 129 android:layout_height="40dp"
130 android:layout_marginTop="10dp" 130 android:layout_marginTop="10dp"
131 android:layout_marginHorizontal="15dp" 131 android:layout_marginHorizontal="15dp"
132 android:background="@drawable/selector_for_input_spinner" 132 android:background="@drawable/selector_for_input_spinner"
133 android:popupBackground="@drawable/shape_for_input_spinner" 133 android:popupBackground="@drawable/shape_for_input_spinner"
134 android:scrollbars="none" /> 134 android:scrollbars="none" />
135 135
136 <TextView 136 <TextView
137 android:layout_width="wrap_content" 137 android:layout_width="wrap_content"
138 android:layout_height="wrap_content" 138 android:layout_height="wrap_content"
139 android:layout_marginHorizontal="15dp" 139 android:layout_marginHorizontal="15dp"
140 android:layout_marginTop="20dp" 140 android:layout_marginTop="20dp"
141 android:text="日期" 141 android:text="日期"
142 android:textColor="@color/text_title" 142 android:textColor="@color/text_title"
143 android:textSize="14sp" 143 android:textSize="14sp"
144 android:textStyle="bold" /> 144 android:textStyle="bold" />
145 145
146 <TextView 146 <TextView
147 android:id="@+id/tvDate" 147 android:id="@+id/tvDate"
148 tools:text="2024-09-18" 148 tools:text="2024-09-18"
149 android:textSize="13sp" 149 android:textSize="13sp"
150 android:textColor="#333" 150 android:textColor="#333"
151 android:gravity="center_vertical" 151 android:gravity="center_vertical"
152 android:paddingHorizontal="16dp" 152 android:paddingHorizontal="16dp"
153 android:layout_width="match_parent" 153 android:layout_width="match_parent"
154 android:layout_height="40dp" 154 android:layout_height="40dp"
155 android:layout_marginTop="10dp" 155 android:layout_marginTop="10dp"
156 android:layout_marginHorizontal="15dp" 156 android:layout_marginHorizontal="15dp"
157 android:background="@drawable/selector_for_input_spinner" /> 157 android:background="@drawable/selector_for_input_spinner" />
158 158
159 <TextView 159 <TextView
160 android:layout_width="wrap_content" 160 android:layout_width="wrap_content"
161 android:layout_height="wrap_content" 161 android:layout_height="wrap_content"
162 android:layout_marginHorizontal="15dp" 162 android:layout_marginHorizontal="15dp"
163 android:layout_marginTop="20dp" 163 android:layout_marginTop="20dp"
164 android:text="作业名称" 164 android:text="作业名称"
165 android:textColor="@color/text_title" 165 android:textColor="@color/text_title"
166 android:textSize="14sp" 166 android:textSize="14sp"
167 android:textStyle="bold" /> 167 android:textStyle="bold" />
168 168
169 <EditText 169 <EditText
170 android:id="@+id/etName" 170 android:id="@+id/etName"
171 android:layout_width="match_parent" 171 android:layout_width="match_parent"
172 android:layout_height="40dp" 172 android:layout_height="40dp"
173 android:layout_marginTop="10dp" 173 android:layout_marginTop="10dp"
174 android:layout_marginHorizontal="15dp" 174 android:layout_marginHorizontal="15dp"
175 android:background="@drawable/shape_for_input_spinner" 175 android:background="@drawable/shape_for_input_spinner"
176 android:fillViewport="true" 176 android:fillViewport="true"
177 android:gravity="center_vertical" 177 android:gravity="center_vertical"
178 android:maxLength="50" 178 android:maxLength="50"
179 android:paddingHorizontal="16dp" 179 android:paddingHorizontal="16dp"
180 android:textColor="@color/text_title" 180 android:textColor="@color/text_title"
181 android:textSize="13sp" 181 android:textSize="13sp"
182 android:inputType="text" 182 android:inputType="text"
183 tools:ignore="Autofill,LabelFor" /> 183 tools:ignore="Autofill,LabelFor" />
184 184
185 <TextView 185 <TextView
186 android:id="@+id/btnConfirm" 186 android:id="@+id/btnConfirm"
187 android:text="确认录入" 187 android:text="确认录入"
188 android:gravity="center" 188 android:gravity="center"
189 android:textSize="16sp" 189 android:textSize="16sp"
190 android:textColor="@color/white" 190 android:textColor="@color/white"
191 android:background="@drawable/shape_radius_5" 191 android:background="@drawable/shape_radius_5"
192 android:backgroundTint="#1C90F3" 192 android:backgroundTint="#1C90F3"
193 android:layout_gravity="center_horizontal" 193 android:layout_gravity="center_horizontal"
194 android:layout_marginVertical="24dp" 194 android:layout_marginVertical="24dp"
195 android:layout_width="224dp" 195 android:layout_width="224dp"
196 android:layout_height="36dp"/> 196 android:layout_height="36dp"/>
197 </LinearLayout> 197 </LinearLayout>
198 </androidx.core.widget.NestedScrollView> 198 </androidx.core.widget.NestedScrollView>
199 199
200 </LinearLayout> 200 </LinearLayout>
201 </FrameLayout> 201 </FrameLayout>
app/src/main/res/layout/fragment_error_book.xml
1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:tools="http://schemas.android.com/tools" 2 xmlns:tools="http://schemas.android.com/tools"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 xmlns:app="http://schemas.android.com/apk/res-auto" 5 xmlns:app="http://schemas.android.com/apk/res-auto"
6 android:orientation="vertical" 6 android:orientation="vertical"
7 tools:ignore="HardcodedText,ContentDescription,UseCompoundDrawables"> 7 tools:ignore="HardcodedText,ContentDescription,UseCompoundDrawables">
8 8
9 <RelativeLayout 9 <RelativeLayout
10 android:layout_width="match_parent" 10 android:layout_width="match_parent"
11 android:layout_height="40dp" 11 android:layout_height="40dp"
12 android:layout_marginTop="30dp"> 12 android:layout_marginTop="30dp">
13 13
14 <ImageView 14 <ImageView
15 android:id="@+id/iv_student" 15 android:id="@+id/iv_student"
16 android:layout_width="35dp" 16 android:layout_width="35dp"
17 android:layout_height="35dp" 17 android:layout_height="35dp"
18 android:layout_centerVertical="true" 18 android:layout_centerVertical="true"
19 android:layout_marginStart="15dp" /> 19 android:layout_marginStart="15dp" />
20 20
21 <TextView 21 <TextView
22 android:id="@+id/tv_name" 22 android:id="@+id/tv_name"
23 android:layout_width="wrap_content" 23 android:layout_width="wrap_content"
24 android:layout_height="wrap_content" 24 android:layout_height="wrap_content"
25 android:layout_centerVertical="true" 25 android:layout_centerVertical="true"
26 android:layout_marginStart="10dp" 26 android:layout_marginStart="10dp"
27 android:layout_toEndOf="@+id/iv_student" 27 android:layout_toEndOf="@+id/iv_student"
28 android:textColor="#333333" 28 android:textColor="#333333"
29 android:textSize="16sp" 29 android:textSize="16sp"
30 tools:ignore="RelativeOverlap" /> 30 tools:ignore="RelativeOverlap" />
31 31
32 <androidx.appcompat.widget.AppCompatTextView 32 <androidx.appcompat.widget.AppCompatTextView
33 android:id="@+id/tv_choose" 33 android:id="@+id/tv_choose"
34 android:layout_width="wrap_content" 34 android:layout_width="wrap_content"
35 android:layout_height="wrap_content" 35 android:layout_height="wrap_content"
36 android:layout_alignParentEnd="true" 36 android:layout_alignParentEnd="true"
37 android:layout_centerVertical="true" 37 android:layout_centerVertical="true"
38 android:layout_marginEnd="15dp" 38 android:layout_marginEnd="15dp"
39 android:drawableEnd="@drawable/ic_filter_black" 39 android:drawableEnd="@drawable/ic_filter_black"
40 android:drawablePadding="5dp" 40 android:drawablePadding="5dp"
41 android:text="选择学生" 41 android:text="选择学生"
42 android:textColor="#333333" 42 android:textColor="#333333"
43 android:textSize="14sp" /> 43 android:textSize="14sp" />
44 44
45 </RelativeLayout> 45 </RelativeLayout>
46 46
47 <LinearLayout 47 <LinearLayout
48 android:orientation="horizontal" 48 android:orientation="horizontal"
49 android:weightSum="2" 49 android:weightSum="2"
50 android:layout_width="match_parent" 50 android:layout_width="match_parent"
51 android:layout_height="wrap_content" 51 android:layout_height="wrap_content"
52 android:baselineAligned="false"> 52 android:baselineAligned="false">
53 <FrameLayout 53 <FrameLayout
54 android:id="@+id/rl_take_photo" 54 android:id="@+id/rl_take_photo"
55 android:layout_width="0dp" 55 android:layout_width="0dp"
56 android:layout_weight="1" 56 android:layout_weight="1"
57 android:layout_height="wrap_content"> 57 android:layout_height="wrap_content">
58 <ImageView 58 <ImageView
59 android:src="@drawable/png_entry_error" 59 android:src="@drawable/png_entry_error"
60 android:adjustViewBounds="true" 60 android:adjustViewBounds="true"
61 android:layout_width="match_parent" 61 android:layout_width="match_parent"
62 android:layout_height="wrap_content"/> 62 android:layout_height="wrap_content"/>
63 </FrameLayout> 63 </FrameLayout>
64 64
65 <FrameLayout 65 <FrameLayout
66 android:id="@+id/flEntryHomework" 66 android:id="@+id/flEntryHomework"
67 android:layout_width="0dp" 67 android:layout_width="0dp"
68 android:layout_weight="1" 68 android:layout_weight="1"
69 android:layout_height="wrap_content"> 69 android:layout_height="wrap_content">
70 <ImageView 70 <ImageView
71 android:src="@drawable/png_entry_homework" 71 android:src="@drawable/png_entry_homework"
72 android:adjustViewBounds="true" 72 android:adjustViewBounds="true"
73 android:layout_width="match_parent" 73 android:layout_width="match_parent"
74 android:layout_height="wrap_content"/> 74 android:layout_height="wrap_content"/>
75 75
76 </FrameLayout> 76 </FrameLayout>
77 </LinearLayout> 77 </LinearLayout>
78 78
79 <LinearLayout 79 <LinearLayout
80 android:orientation="vertical" 80 android:orientation="vertical"
81 android:background="@drawable/shape_radius_10" 81 android:background="@drawable/shape_radius_10"
82 android:backgroundTint="@color/white" 82 android:backgroundTint="@color/white"
83 android:layout_marginHorizontal="15dp" 83 android:layout_marginHorizontal="15dp"
84 android:layout_marginTop="10dp" 84 android:layout_marginTop="10dp"
85 android:layout_marginBottom="15dp" 85 android:layout_marginBottom="15dp"
86 android:layout_width="match_parent" 86 android:layout_width="match_parent"
87 android:layout_height="match_parent"> 87 android:layout_height="match_parent">
88 88
89 <com.google.android.material.tabs.TabLayout 89 <com.google.android.material.tabs.TabLayout
90 android:id="@+id/tabLayout" 90 android:id="@+id/tabLayout"
91 app:tabMode="fixed" 91 app:tabMode="fixed"
92 app:tabGravity="fill" 92 app:tabGravity="fill"
93 app:tabIndicatorFullWidth="false" 93 app:tabIndicatorFullWidth="false"
94 app:tabIndicatorColor="#1C90F3" 94 app:tabIndicatorColor="#1C90F3"
95 app:tabTextColor="#333" 95 app:tabTextColor="#333"
96 app:tabSelectedTextColor="#1C90F3" 96 app:tabSelectedTextColor="#1C90F3"
97 app:tabTextAppearance="@style/tab_home_item" 97 app:tabTextAppearance="@style/tab_home_item"
98 app:tabRippleColor="@color/transparent" 98 app:tabRippleColor="@color/transparent"
99 android:background="@drawable/bg_tab_home" 99 android:background="@drawable/bg_tab_home"
100 app:tabIndicatorHeight="2dp" 100 app:tabIndicatorHeight="2dp"
101 android:paddingVertical="8dp" 101 android:paddingVertical="8dp"
102 android:layout_width="match_parent" 102 android:layout_width="match_parent"
103 android:layout_height="48dp"> 103 android:layout_height="48dp">
104 <com.google.android.material.tabs.TabItem
105 android:text="最近错题"
106 android:layout_width="wrap_content"
107 android:layout_height="wrap_content"/>
108 <com.google.android.material.tabs.TabItem
109 android:text="最近作业"
110 android:layout_width="wrap_content"
111 android:layout_height="wrap_content"/>
112 </com.google.android.material.tabs.TabLayout>
104 <com.google.android.material.tabs.TabItem 113
105 android:text="最近错题" 114 <androidx.core.widget.NestedScrollView
106 android:layout_width="wrap_content" 115 android:layout_width="match_parent"
107 android:layout_height="wrap_content"/> 116 android:layout_height="match_parent">
108 <com.google.android.material.tabs.TabItem 117 <LinearLayout
109 android:text="最近作业" 118 android:orientation="vertical"
110 android:layout_width="wrap_content" 119 android:layout_width="match_parent"
111 android:layout_height="wrap_content"/> 120 android:layout_height="wrap_content">
112 </com.google.android.material.tabs.TabLayout> 121
113 122 <androidx.recyclerview.widget.RecyclerView
114 <androidx.core.widget.NestedScrollView 123 android:id="@+id/rvSubject"
115 android:layout_width="match_parent" 124 android:orientation="horizontal"
116 android:layout_height="match_parent"> 125 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
117 <LinearLayout 126 android:layout_marginTop="15dp"
118 android:orientation="vertical" 127 android:layout_width="match_parent"
119 android:layout_width="match_parent" 128 android:layout_height="wrap_content" />
120 android:layout_height="wrap_content"> 129
121 130 <LinearLayout
122 <androidx.recyclerview.widget.RecyclerView 131 android:layout_marginTop="16dp"
123 android:id="@+id/rvSubject" 132 android:layout_marginHorizontal="10dp"
124 android:orientation="horizontal" 133 android:layout_width="match_parent"
125 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" 134 android:layout_height="25dp">
126 android:layout_marginTop="15dp" 135 <TextView
127 android:layout_width="match_parent" 136 android:id="@+id/tvListTitle"
128 android:layout_height="wrap_content" /> 137 android:layout_width="wrap_content"
129 138 android:layout_height="wrap_content"
130 <LinearLayout 139 android:text="最近错题"
131 android:layout_marginTop="16dp" 140 android:textColor="#333333"
132 android:layout_marginHorizontal="10dp" 141 android:textSize="16sp"
133 android:layout_width="match_parent" 142 android:textStyle="bold" />
134 android:layout_height="25dp"> 143
135 <TextView 144 <Space style="@style/empty_space"/>
136 android:id="@+id/tvListTitle" 145
137 android:layout_width="wrap_content" 146 <LinearLayout
138 android:layout_height="wrap_content" 147 android:id="@+id/ll_all"
139 android:text="最近错题" 148 android:layout_width="wrap_content"
140 android:textColor="#333333" 149 android:layout_height="wrap_content"
141 android:textSize="16sp" 150 android:layout_gravity="center_vertical">
142 android:textStyle="bold" /> 151
143 152 <TextView
144 <Space style="@style/empty_space"/> 153 android:layout_width="wrap_content"
145 154 android:layout_height="wrap_content"
146 <LinearLayout 155 android:layout_gravity="center_vertical"
147 android:id="@+id/ll_all" 156 android:text="查看全部"
148 android:layout_width="wrap_content" 157 android:textColor="#666666"
149 android:layout_height="wrap_content" 158 android:textSize="12sp" />
150 android:layout_gravity="center_vertical"> 159
151 160 <ImageView
152 <TextView 161 android:layout_width="9dp"
153 android:layout_width="wrap_content" 162 android:layout_height="10dp"
154 android:layout_height="wrap_content" 163 android:layout_gravity="center_vertical"
155 android:layout_gravity="center_vertical" 164 android:layout_marginStart="5dp"
156 android:text="查看全部" 165 android:src="@mipmap/ic_arrow_right" />
157 android:textColor="#666666" 166 </LinearLayout>
158 android:textSize="12sp" /> 167 </LinearLayout>
159 168
160 <ImageView 169 <androidx.recyclerview.widget.RecyclerView
161 android:layout_width="9dp" 170 android:id="@+id/rvMain"
162 android:layout_height="10dp" 171 android:orientation="vertical"
163 android:layout_gravity="center_vertical" 172 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
164 android:layout_marginStart="5dp" 173 android:layout_width="match_parent"
165 android:src="@mipmap/ic_arrow_right" /> 174 android:layout_height="wrap_content"
166 </LinearLayout> 175 android:layout_marginTop="15dp" />
167 </LinearLayout> 176
168 177 <LinearLayout
169 <androidx.recyclerview.widget.RecyclerView 178 android:id="@+id/ll_empty"
170 android:id="@+id/rvMain" 179 android:layout_width="wrap_content"
171 android:orientation="vertical" 180 android:layout_height="wrap_content"
172 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" 181 android:layout_gravity="center_horizontal"
173 android:layout_width="match_parent" 182 android:layout_marginTop="30dp"
174 android:layout_height="wrap_content" 183 android:orientation="vertical"
175 android:layout_marginTop="15dp" /> 184 android:visibility="gone">
176 185
177 <LinearLayout 186 <ImageView
178 android:id="@+id/ll_empty" 187 android:layout_width="155dp"
179 android:layout_width="wrap_content" 188 android:layout_height="130dp"
180 android:layout_height="wrap_content" 189 android:src="@mipmap/ic_empty" />
181 android:layout_gravity="center_horizontal" 190
182 android:layout_marginTop="30dp" 191 <TextView
183 android:orientation="vertical" 192 android:id="@+id/tvEmpty"
184 android:visibility="gone"> 193 android:layout_width="wrap_content"
185 194 android:layout_height="wrap_content"
186 <ImageView 195 android:layout_gravity="center_horizontal"
187 android:layout_width="155dp" 196 android:text="暂无错题~" />
188 android:layout_height="130dp" 197 </LinearLayout>
189 android:src="@mipmap/ic_empty" /> 198
190 199 </LinearLayout>
191 <TextView 200 </androidx.core.widget.NestedScrollView>
192 android:id="@+id/tvEmpty" 201 </LinearLayout>
193 android:layout_width="wrap_content" 202 </LinearLayout>
app/src/main/res/values/appearance.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <resources> 2 <resources>
3 3
4 <style name="tab_home_item"> 4 <style name="tab_home_item">
5 <item name="android:textSize">16sp</item> 5 <item name="android:textSize">16sp</item>
6 <item name="android:textStyle">bold</item> 6 <item name="android:textStyle">bold</item>
7 </style> 7 </style>
8 8
9 <style name="tab_homework"> 9 <style name="tab_homework">
10 <item name="android:textSize">15sp</item> 10 <item name="android:textSize">15sp</item>
11 </style> 11 </style>
12 12
13 </resources> 13 </resources>
app/src/main/res/values/styles.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <resources> 2 <resources>
3 <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
4 <!-- 全局应用的 Spinner 样式 -->
5 <item name="android:spinnerItemStyle">@style/CustomSpinnerItemStyle</item>
6 </style>
3 <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 7
8 <style name="CustomSpinnerItemStyle" parent="@style/Widget.AppCompat.TextView.SpinnerItem">
9 <item name="android:textSize">13sp</item>
10 </style>
4 <!-- 全局应用的 Spinner 样式 --> 11
5 <item name="android:spinnerItemStyle">@style/CustomSpinnerItemStyle</item> 12
13 <style name="ThemeSplash" parent="AppTheme">
6 </style> 14 <item name="android:windowBackground">@drawable/welcome_bg</item>
7 15 <item name="colorPrimaryDark">@android:color/transparent</item>
8 <style name="CustomSpinnerItemStyle" parent="@style/Widget.AppCompat.TextView.SpinnerItem"> 16 <item name="windowActionBar">false</item>
9 <item name="android:textSize">13sp</item> 17 <item name="windowNoTitle">true</item>
10 </style> 18 <item name="android:windowFullscreen">true</item>
11 19 </style>
12 20
13 <style name="ThemeSplash" parent="AppTheme"> 21 <style name="main_bottom_navigaton_menu_item">
14 <item name="android:windowBackground">@drawable/welcome_bg</item> 22 <item name="android:layout_width">0dp</item>
15 <item name="colorPrimaryDark">@android:color/transparent</item> 23 <item name="android:layout_weight">1</item>
16 <item name="windowActionBar">false</item> 24 <item name="android:layout_height">match_parent</item>
17 <item name="windowNoTitle">true</item> 25 <item name="android:background">@android:color/transparent</item>
18 <item name="android:windowFullscreen">true</item> 26 <item name="android:button">@null</item>
19 </style> 27 <item name="android:gravity">center</item>
20 28 <item name="android:textSize">11dp</item>
21 <style name="main_bottom_navigaton_menu_item"> 29 <item name="android:drawablePadding">2dp</item>
22 <item name="android:layout_width">0dp</item> 30 </style>
23 <item name="android:layout_weight">1</item> 31 <!--实现BottomSheetDialog圆角效果-->
24 <item name="android:layout_height">match_parent</item> 32 <style name="BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog">
25 <item name="android:background">@android:color/transparent</item> 33 <item name="bottomSheetStyle">@style/bottomSheetStyleWrapper</item>
26 <item name="android:button">@null</item> 34 </style>
27 <item name="android:gravity">center</item> 35
28 <item name="android:textSize">11dp</item> 36 <style name="bottomSheetStyleWrapper" parent="Widget.Design.BottomSheet.Modal">
29 <item name="android:drawablePadding">2dp</item> 37 <item name="android:background">@android:color/transparent</item>
30 </style> 38 <item name="android:navigationBarColor">@android:color/transparent</item>
31 <!--实现BottomSheetDialog圆角效果--> 39 <item name="behavior_peekHeight">500dp</item>
32 <style name="BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> 40 </style>
33 <item name="bottomSheetStyle">@style/bottomSheetStyleWrapper</item> 41
34 </style> 42 <style name="MyAlertDialog" parent="android:Theme.Material.Dialog.Alert">
35 43 <!--背景颜色及和透明程度-->
36 <style name="bottomSheetStyleWrapper" parent="Widget.Design.BottomSheet.Modal"> 44 <item name="android:windowBackground">@null</item>
37 <item name="android:background">@android:color/transparent</item> 45 <!--是否去除标题 -->
38 <item name="android:navigationBarColor">@android:color/transparent</item> 46 <item name="android:windowNoTitle">true</item>
39 <item name="behavior_peekHeight">500dp</item> 47 <!--是否去除边框-->
40 </style> 48 <item name="android:windowFrame">@null</item>
41 49 <!--是否浮现在activity之上-->
42 <style name="MyAlertDialog" parent="android:Theme.Material.Dialog.Alert"> 50 <item name="android:windowIsFloating">true</item>
43 <!--背景颜色及和透明程度--> 51 <!--是否模糊-->
44 <item name="android:windowBackground">@null</item> 52 <item name="android:backgroundDimEnabled">true</item>
45 <!--是否去除标题 --> 53 <item name="android:windowIsTranslucent">true</item><!--半透明-->
46 <item name="android:windowNoTitle">true</item> 54 <item name="android:windowSoftInputMode">stateVisible|adjustPan</item>
47 <!--是否去除边框--> 55 </style>
48 <item name="android:windowFrame">@null</item> 56
49 <!--是否浮现在activity之上--> 57 <style name="customSpinnerStyle" parent="android:Widget.ListView.DropDown">
50 <item name="android:windowIsFloating">true</item> 58 <item name="divider">@color/border</item>
51 <!--是否模糊--> 59 <item name="android:scrollbars">none</item>
52 <item name="android:backgroundDimEnabled">true</item> 60 <item name="android:dividerHeight">1dp</item>
53 <item name="android:windowIsTranslucent">true</item><!--半透明--> 61 <item name="android:textSize">13sp</item>
54 <item name="android:windowSoftInputMode">stateVisible|adjustPan</item> 62 </style>
55 </style> 63
56 64 <style name="empty_space">
57 <style name="customSpinnerStyle" parent="android:Widget.ListView.DropDown"> 65 <item name="android:layout_width">0dp</item>
58 <item name="divider">@color/border</item> 66 <item name="android:layout_height">0dp</item>
59 <item name="android:scrollbars">none</item> 67 <item name="android:layout_weight">1</item>
60 <item name="android:dividerHeight">1dp</item> 68 </style>
61 <item name="android:textSize">13sp</item> 69
62 </style> 70
63 71 <style name="BaseDialog">
64 <style name="empty_space"> 72 <item name="android:background">@android:color/transparent</item>
65 <item name="android:layout_width">0dp</item> 73 <item name="android:windowBackground">@android:color/transparent</item>
66 <item name="android:layout_height">0dp</item> 74 <item name="android:windowIsFloating">true</item>
67 <item name="android:layout_weight">1</item> 75 </style>
68 </style> 76
69 77 <style name="BaseDialog.FullScreen">
70 78 <item name="android:windowFullscreen">true</item>
71 <style name="BaseDialog"> 79 <item name="android:windowIsTranslucent">true</item>
72 <item name="android:background">@android:color/transparent</item> 80 <item name="android:statusBarColor">@android:color/transparent</item>
73 <item name="android:windowBackground">@android:color/transparent</item> 81 </style>
74 <item name="android:windowIsFloating">true</item> 82
75 </style> 83 <style name="tv_StudentHomeworkFilter">
76 84 <item name="android:textSize">13sp</item>
77 <style name="BaseDialog.FullScreen"> 85 <item name="android:textColor">@color/color_filter_state</item>
78 <item name="android:windowFullscreen">true</item> 86 <item name="android:drawableTint">@color/color_filter_state</item>
79 <item name="android:windowIsTranslucent">true</item> 87 <item name="android:drawableEnd">@drawable/svg_filter_drop_down</item>
80 <item name="android:statusBarColor">@android:color/transparent</item> 88 <item name="android:drawablePadding">8dp</item>
81 </style> 89 <item name="android:layout_width">wrap_content</item>
82 90 <item name="android:layout_height">wrap_content</item>
83 <style name="tv_StudentHomeworkFilter"> 91 </style>
84 <item name="android:textSize">13sp</item> 92
85 <item name="android:textColor">@color/color_filter_state</item> 93 <style name="chk_HomeworkFilterItem">
86 <item name="android:drawableTint">@color/color_filter_state</item> 94 <item name="android:textSize">13sp</item>
87 <item name="android:drawableEnd">@drawable/svg_filter_drop_down</item> 95 <item name="android:textColor">@color/color_filter_item</item>
88 <item name="android:drawablePadding">8dp</item> 96 <item name="android:gravity">center</item>
89 <item name="android:layout_width">wrap_content</item> 97 <item name="android:button">@null</item>
90 <item name="android:layout_height">wrap_content</item> 98 <item name="android:background">@drawable/btn_homework_filter_item</item>
91 </style> 99 <item name="android:layout_margin">8dp</item>
92 100 <item name="android:layout_weight">1</item>
93 <style name="chk_HomeworkFilterItem"> 101 <item name="android:layout_width">0dp</item>
94 <item name="android:textSize">13sp</item> 102 <item name="android:layout_height">26dp</item>
95 <item name="android:textColor">@color/color_filter_item</item> 103 </style>
96 <item name="android:gravity">center</item> 104
97 <item name="android:button">@null</item> 105 </resources>