Commit 9cfa01d01114fb529a161c0d67cf024cb46ace86
1 parent
af63de4898
Exists in
master
资源重命名
Showing
15 changed files
with
17 additions
and
22 deletions
Show diff stats
app/src/main/java/com/hjx/parent/StuHomeworkActivity.java
1 | package com.hjx.parent; | 1 | package com.hjx.parent; |
2 | 2 | ||
3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
4 | import android.content.Intent; | 4 | import android.content.Intent; |
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | import android.view.View; | 6 | import android.view.View; |
7 | import android.widget.LinearLayout; | 7 | import android.widget.LinearLayout; |
8 | import android.widget.PopupWindow; | 8 | import android.widget.PopupWindow; |
9 | 9 | ||
10 | import androidx.annotation.NonNull; | 10 | import androidx.annotation.NonNull; |
11 | import androidx.annotation.Nullable; | 11 | import androidx.annotation.Nullable; |
12 | import androidx.lifecycle.MutableLiveData; | 12 | import androidx.lifecycle.MutableLiveData; |
13 | 13 | ||
14 | import com.chad.library.adapter.base.BaseQuickAdapter; | 14 | import com.chad.library.adapter.base.BaseQuickAdapter; |
15 | import com.chad.library.adapter.base.BaseViewHolder; | 15 | import com.chad.library.adapter.base.BaseViewHolder; |
16 | import com.google.android.material.tabs.TabLayout; | 16 | import com.google.android.material.tabs.TabLayout; |
17 | import com.google.gson.Gson; | 17 | import com.google.gson.Gson; |
18 | import com.hjx.parent.adapter.HomeworkListAdapter; | 18 | import com.hjx.parent.adapter.HomeworkListAdapter; |
19 | import com.hjx.parent.databinding.ActivityStudentHomeworkBinding; | 19 | import com.hjx.parent.databinding.ActivityStudentHomeworkBinding; |
20 | import com.hjx.parent.databinding.PopupFilterFeedbackBinding; | 20 | import com.hjx.parent.databinding.PopupFilterFeedbackBinding; |
21 | import com.hjx.parent.databinding.PopupFilterGradeBinding; | 21 | import com.hjx.parent.databinding.PopupFilterGradeBinding; |
22 | import com.hjx.parent.databinding.PopupFilterSubjectBinding; | 22 | import com.hjx.parent.databinding.PopupFilterSubjectBinding; |
23 | import com.hjx.parent.databinding.PopupFilterTermBinding; | 23 | import com.hjx.parent.databinding.PopupFilterTermBinding; |
24 | import com.hjx.parent.dialog.MsgConfirmDialog; | 24 | import com.hjx.parent.dialog.MsgConfirmDialog; |
25 | import com.hjx.parent.dialog.StageHuyouDialog; | 25 | import com.hjx.parent.dialog.StageHuyouDialog; |
26 | import com.hjx.parent.function.Function1; | 26 | import com.hjx.parent.function.Function1; |
27 | import com.hjx.parent.rx.BaseRxActivity; | 27 | import com.hjx.parent.rx.BaseRxActivity; |
28 | import com.prws.common.bean.ResponseResult; | 28 | import com.prws.common.bean.ResponseResult; |
29 | import com.prws.common.bean.Student; | 29 | import com.prws.common.bean.Student; |
30 | import com.prws.common.bean.homework.HomeworkList; | 30 | import com.prws.common.bean.homework.HomeworkList; |
31 | import com.prws.common.bean.homework.StDetail; | 31 | import com.prws.common.bean.homework.StDetail; |
32 | import com.prws.common.net.NetWorks; | 32 | import com.prws.common.net.NetWorks; |
33 | import com.prws.common.utils.SharedPreferencesUtil; | 33 | import com.prws.common.utils.SharedPreferencesUtil; |
34 | import com.trello.rxlifecycle2.android.RxLifecycleAndroid; | 34 | import com.trello.rxlifecycle2.android.RxLifecycleAndroid; |
35 | 35 | ||
36 | import java.text.SimpleDateFormat; | 36 | import java.text.SimpleDateFormat; |
37 | import java.util.ArrayList; | 37 | import java.util.ArrayList; |
38 | import java.util.Calendar; | 38 | import java.util.Calendar; |
39 | import java.util.Collections; | ||
40 | import java.util.Date; | 39 | import java.util.Date; |
41 | import java.util.HashMap; | 40 | import java.util.HashMap; |
42 | import java.util.List; | 41 | import java.util.List; |
43 | import java.util.Locale; | 42 | import java.util.Locale; |
44 | import java.util.Map; | 43 | import java.util.Map; |
45 | 44 | ||
46 | import io.reactivex.Observable; | 45 | import io.reactivex.Observable; |
47 | import io.reactivex.android.schedulers.AndroidSchedulers; | 46 | import io.reactivex.android.schedulers.AndroidSchedulers; |
48 | import io.reactivex.schedulers.Schedulers; | 47 | import io.reactivex.schedulers.Schedulers; |
49 | 48 | ||
50 | public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkBinding> { | 49 | public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkBinding> { |
51 | 50 | ||
52 | private final HomeworkListAdapter homeworkAdapter = new HomeworkListAdapter(); | 51 | private final HomeworkListAdapter homeworkAdapter = new HomeworkListAdapter(); |
53 | 52 | ||
54 | private final List<StDetail> mWeekList = new ArrayList<>(); | 53 | private final List<StDetail> mWeekList = new ArrayList<>(); |
55 | private final List<StDetail> mStageList = new ArrayList<>(); | 54 | private final List<StDetail> mStageList = new ArrayList<>(); |
56 | private final HuyouAdapter weekAdapter = new HuyouAdapter(mWeekList); | 55 | private final HuyouAdapter weekAdapter = new HuyouAdapter(mWeekList); |
57 | private final HuyouAdapter stageAdapter = new HuyouAdapter(mStageList); | 56 | private final HuyouAdapter stageAdapter = new HuyouAdapter(mStageList); |
58 | 57 | ||
59 | PopupWindow subjectFilter, gradeFilter, termFilter, feedbackFilter; | 58 | PopupWindow subjectFilter, gradeFilter, termFilter, feedbackFilter; |
60 | MsgConfirmDialog deleteDialog; | 59 | MsgConfirmDialog deleteDialog; |
61 | StageHuyouDialog stageHuyouDialog; | 60 | StageHuyouDialog stageHuyouDialog; |
62 | State state = new State(); | 61 | State state = new State(); |
63 | 62 | ||
64 | private void handlerIntent() { | 63 | private void handlerIntent() { |
65 | String json = getIntent().getStringExtra("studentJson"); | 64 | String json = getIntent().getStringExtra("studentJson"); |
66 | if (json == null) json = (String) SharedPreferencesUtil.getData("student", ""); | 65 | if (json == null) json = (String) SharedPreferencesUtil.getData("student", ""); |
67 | try { state.student = new Gson().fromJson(json, Student.class); } | 66 | try { state.student = new Gson().fromJson(json, Student.class); } |
68 | catch (Throwable t) { t.printStackTrace(); } | 67 | catch (Throwable t) { t.printStackTrace(); } |
69 | } | 68 | } |
70 | 69 | ||
71 | @SuppressLint("SetTextI18n") | 70 | @SuppressLint("SetTextI18n") |
72 | @Override | 71 | @Override |
73 | public void initView(Bundle savedInstanceState) { | 72 | public void initView(Bundle savedInstanceState) { |
74 | handlerIntent(); | 73 | handlerIntent(); |
75 | if (state.student == null) { | 74 | if (state.student == null) { |
76 | finish(); | 75 | finish(); |
77 | return; | 76 | return; |
78 | } | 77 | } |
79 | binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); | 78 | binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); |
80 | binding.tvTitle.setText(state.student.stuName + "的全部作业"); | 79 | binding.tvTitle.setText(state.student.stuName + "的全部作业"); |
81 | setupTab(); | 80 | setupTab(); |
82 | homeworkAdapter.setEmptyView(R.layout.empty_list_homework, binding.recyclerView); | 81 | homeworkAdapter.setEmptyView(R.layout.empty_list_homework, binding.recyclerView); |
83 | weekAdapter.setEmptyView(R.layout.empty_huyou_list, binding.recyclerView); | 82 | weekAdapter.setEmptyView(R.layout.empty_huyou_list, binding.recyclerView); |
84 | stageAdapter.setEmptyView(R.layout.empty_huyou_stage, binding.recyclerView); | 83 | stageAdapter.setEmptyView(R.layout.empty_huyou_stage, binding.recyclerView); |
85 | binding.recyclerView.setAdapter(homeworkAdapter); | 84 | binding.recyclerView.setAdapter(homeworkAdapter); |
86 | 85 | ||
87 | deleteDialog = new MsgConfirmDialog.Builder(this) | 86 | deleteDialog = new MsgConfirmDialog.Builder(this) |
88 | .setMessage("确认要删除吗?一旦删除不可恢复") | 87 | .setMessage("确认要删除吗?一旦删除不可恢复") |
89 | .setPositive("暂不删除") | 88 | .setPositive("暂不删除") |
90 | .setNegative("确定删除") | 89 | .setNegative("确定删除") |
91 | .build(); | 90 | .build(); |
92 | 91 | ||
93 | binding.ftSubject.setOnClickListener(v -> showSubjectFilter()); | 92 | binding.ftSubject.setOnClickListener(v -> showSubjectFilter()); |
94 | binding.ftGrade.setOnClickListener(v -> showGradeFilter()); | 93 | binding.ftGrade.setOnClickListener(v -> showGradeFilter()); |
95 | binding.ftTerm.setOnClickListener(v -> showTermFilter()); | 94 | binding.ftTerm.setOnClickListener(v -> showTermFilter()); |
96 | binding.ftFeedback.setOnClickListener(v -> showFeedbackFilter()); | 95 | binding.ftFeedback.setOnClickListener(v -> showFeedbackFilter()); |
97 | homeworkAdapter.deleteCall = data -> { | 96 | homeworkAdapter.deleteCall = data -> { |
98 | deleteDialog.show(null, () -> { | 97 | deleteDialog.show(null, () -> { |
99 | deleteHomework(data); | 98 | deleteHomework(data); |
100 | return true; | 99 | return true; |
101 | }); | 100 | }); |
102 | }; | 101 | }; |
103 | homeworkAdapter.detailCall = data -> { | 102 | homeworkAdapter.detailCall = data -> { |
104 | if (data.getRight() == null) { | 103 | if (data.getRight() == null) { |
105 | Intent intent = new Intent(this, HomeworkDetailActivity.class); | 104 | Intent intent = new Intent(this, HomeworkDetailActivity.class); |
106 | intent.putExtra("data", data); | 105 | intent.putExtra("data", data); |
107 | intent.putExtra("student", state.student); | 106 | intent.putExtra("student", state.student); |
108 | startActivity(intent); | 107 | startActivity(intent); |
109 | } else { | 108 | } else { |
110 | Intent intent = new Intent(this, HomeworkShareActivity.class); | 109 | Intent intent = new Intent(this, HomeworkShareActivity.class); |
111 | intent.putExtra("student", state.student); | 110 | intent.putExtra("student", state.student); |
112 | intent.putExtra("id", data.getId()); | 111 | intent.putExtra("id", data.getId()); |
113 | intent.putExtra("grade", data.getGrade()); | 112 | intent.putExtra("grade", data.getGrade()); |
114 | intent.putExtra("subject", data.getSubject()); | 113 | intent.putExtra("subject", data.getSubject()); |
115 | 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); |
116 | intent.putExtra("name", name); | 115 | intent.putExtra("name", name); |
117 | startActivity(intent); | 116 | startActivity(intent); |
118 | } | 117 | } |
119 | }; | 118 | }; |
120 | 119 | ||
121 | binding.btnChangeStudent.setOnClickListener(v -> { | 120 | binding.btnChangeStudent.setOnClickListener(v -> { |
122 | Intent intent = new Intent(this, TeacherChooseActivity.class); | 121 | Intent intent = new Intent(this, TeacherChooseActivity.class); |
123 | intent.putExtra("needBack", true); | 122 | intent.putExtra("needBack", true); |
124 | startActivityForResult(intent, 0xA01); | 123 | startActivityForResult(intent, 0xA01); |
125 | }); | 124 | }); |
126 | 125 | ||
127 | binding.btnGeneralHuyou.setOnClickListener(v -> generalWeek()); | 126 | binding.btnGeneralHuyou.setOnClickListener(v -> generalWeek()); |
128 | binding.btnStageHuyou.setOnClickListener(v -> { | 127 | binding.btnStageHuyou.setOnClickListener(v -> { |
129 | if (stageHuyouDialog == null) stageHuyouDialog = new StageHuyouDialog(this); | 128 | if (stageHuyouDialog == null) stageHuyouDialog = new StageHuyouDialog(this); |
130 | stageHuyouDialog.show(this::generalStage); | 129 | stageHuyouDialog.show(this::generalStage); |
131 | }); | 130 | }); |
132 | 131 | ||
133 | weekAdapter.detailCall = data -> goHuyou(data, 0); | 132 | weekAdapter.detailCall = data -> goHuyou(data, 0); |
134 | stageAdapter.detailCall = data -> goHuyou(data, 1); | 133 | stageAdapter.detailCall = data -> goHuyou(data, 1); |
135 | weekAdapter.deleteCall = data -> { | 134 | weekAdapter.deleteCall = data -> { |
136 | deleteDialog.show(null, () -> { | 135 | deleteDialog.show(null, () -> { |
137 | deleteHuyou(data); | 136 | deleteHuyou(data); |
138 | return true; | 137 | return true; |
139 | }); | 138 | }); |
140 | }; | 139 | }; |
141 | stageAdapter.deleteCall = weekAdapter.deleteCall; | 140 | stageAdapter.deleteCall = weekAdapter.deleteCall; |
142 | 141 | ||
143 | getWeekHuyou(); | 142 | getWeekHuyou(); |
144 | getStageHuyou(); | 143 | getStageHuyou(); |
145 | } | 144 | } |
146 | 145 | ||
147 | private void goHuyou(StDetail data, int type) { | 146 | private void goHuyou(StDetail data, int type) { |
148 | Intent intent = new Intent(this, HuyouDetailActivity.class); | 147 | Intent intent = new Intent(this, HuyouDetailActivity.class); |
149 | intent.putExtra("id", data.id); | 148 | intent.putExtra("id", data.id); |
150 | intent.putExtra("type", type); | 149 | intent.putExtra("type", type); |
151 | intent.putExtra("student", state.student); | 150 | intent.putExtra("student", state.student); |
152 | startActivity(intent); | 151 | startActivity(intent); |
153 | } | 152 | } |
154 | 153 | ||
155 | @Override | 154 | @Override |
156 | protected void onStart() { | 155 | protected void onStart() { |
157 | super.onStart(); | 156 | super.onStart(); |
158 | getHomework(); | 157 | getHomework(); |
159 | } | 158 | } |
160 | 159 | ||
161 | @SuppressLint("SetTextI18n") | 160 | @SuppressLint("SetTextI18n") |
162 | @Override | 161 | @Override |
163 | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { | 162 | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { |
164 | super.onActivityResult(requestCode, resultCode, data); | 163 | super.onActivityResult(requestCode, resultCode, data); |
165 | if (requestCode == 0xA01 && resultCode == RESULT_OK) { | 164 | if (requestCode == 0xA01 && resultCode == RESULT_OK) { |
166 | String json = (String) SharedPreferencesUtil.getData("student", ""); | 165 | String json = (String) SharedPreferencesUtil.getData("student", ""); |
167 | try { | 166 | try { |
168 | state.student = new Gson().fromJson(json, Student.class); | 167 | state.student = new Gson().fromJson(json, Student.class); |
169 | binding.tvTitle.setText(state.student.stuName + "的全部作业"); | 168 | binding.tvTitle.setText(state.student.stuName + "的全部作业"); |
170 | getHomework(); | 169 | getHomework(); |
171 | getWeekHuyou(); | 170 | getWeekHuyou(); |
172 | getStageHuyou(); | 171 | getStageHuyou(); |
173 | } | 172 | } |
174 | catch (Throwable t) { t.printStackTrace(); } | 173 | catch (Throwable t) { t.printStackTrace(); } |
175 | } | 174 | } |
176 | } | 175 | } |
177 | 176 | ||
178 | private void setupTab() { | 177 | private void setupTab() { |
179 | binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每日作业")); | 178 | binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每日作业")); |
180 | binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每周总结")); | 179 | binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每周总结")); |
181 | binding.tabLayout.addTab(binding.tabLayout.newTab().setText("阶段性总结")); | 180 | binding.tabLayout.addTab(binding.tabLayout.newTab().setText("阶段性总结")); |
182 | binding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { | 181 | binding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { |
183 | @Override | 182 | @Override |
184 | public void onTabSelected(TabLayout.Tab tab) { | 183 | public void onTabSelected(TabLayout.Tab tab) { |
185 | binding.filterBar.setVisibility(View.GONE); | 184 | binding.filterBar.setVisibility(View.GONE); |
186 | binding.weekBar.setVisibility(View.GONE); | 185 | binding.weekBar.setVisibility(View.GONE); |
187 | binding.stageBar.setVisibility(View.GONE); | 186 | binding.stageBar.setVisibility(View.GONE); |
188 | if (tab.getPosition() == 0) { //每日 | 187 | if (tab.getPosition() == 0) { //每日 |
189 | binding.filterBar.setVisibility(View.VISIBLE); | 188 | binding.filterBar.setVisibility(View.VISIBLE); |
190 | binding.recyclerView.setAdapter(homeworkAdapter); | 189 | binding.recyclerView.setAdapter(homeworkAdapter); |
191 | } else if (tab.getPosition() == 1) { //每周 | 190 | } else if (tab.getPosition() == 1) { //每周 |
192 | binding.weekBar.setVisibility(View.VISIBLE); | 191 | binding.weekBar.setVisibility(View.VISIBLE); |
193 | binding.recyclerView.setAdapter(weekAdapter); | 192 | binding.recyclerView.setAdapter(weekAdapter); |
194 | } else if (tab.getPosition() == 2) { //阶段 | 193 | } else if (tab.getPosition() == 2) { //阶段 |
195 | binding.stageBar.setVisibility(View.VISIBLE); | 194 | binding.stageBar.setVisibility(View.VISIBLE); |
196 | binding.recyclerView.setAdapter(stageAdapter); | 195 | binding.recyclerView.setAdapter(stageAdapter); |
197 | } | 196 | } |
198 | } | 197 | } |
199 | @Override | 198 | @Override |
200 | public void onTabUnselected(TabLayout.Tab tab) { | 199 | public void onTabUnselected(TabLayout.Tab tab) { |
201 | } | 200 | } |
202 | @Override | 201 | @Override |
203 | public void onTabReselected(TabLayout.Tab tab) { | 202 | public void onTabReselected(TabLayout.Tab tab) { |
204 | } | 203 | } |
205 | }); | 204 | }); |
206 | } | 205 | } |
207 | 206 | ||
208 | @SuppressLint("CheckResult") | 207 | @SuppressLint("CheckResult") |
209 | protected void deleteHomework(HomeworkList data) { | 208 | protected void deleteHomework(HomeworkList data) { |
210 | NetWorks.service_url.deleteHomework(NetWorks.getHeader(), data.getId()) | 209 | NetWorks.service_url.deleteHomework(NetWorks.getHeader(), data.getId()) |
211 | .subscribeOn(Schedulers.io()) | 210 | .subscribeOn(Schedulers.io()) |
212 | .observeOn(AndroidSchedulers.mainThread()) | 211 | .observeOn(AndroidSchedulers.mainThread()) |
213 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) | 212 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) |
214 | .subscribe((response, th) -> { | 213 | .subscribe((response, th) -> { |
215 | if (th != null) th.printStackTrace(); | 214 | if (th != null) th.printStackTrace(); |
216 | if (response != null && response.getSuccess()) { | 215 | if (response != null && response.getSuccess()) { |
217 | getHomework(); | 216 | getHomework(); |
218 | } | 217 | } |
219 | }); | 218 | }); |
220 | 219 | ||
221 | } | 220 | } |
222 | 221 | ||
223 | @SuppressLint("CheckResult") | 222 | @SuppressLint("CheckResult") |
224 | protected void getHomework() { | 223 | protected void getHomework() { |
225 | NetWorks.service_url.getStudentHomework(NetWorks.getHeader(), state.student.stuId) | 224 | NetWorks.service_url.getStudentHomework(NetWorks.getHeader(), state.student.stuId) |
226 | .subscribeOn(Schedulers.io()) | 225 | .subscribeOn(Schedulers.io()) |
227 | .observeOn(AndroidSchedulers.mainThread()) | 226 | .observeOn(AndroidSchedulers.mainThread()) |
228 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) | 227 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) |
229 | .toObservable() | 228 | .toObservable() |
230 | .concatMap(response -> Observable.fromIterable(response.getData())) | 229 | .concatMap(response -> Observable.fromIterable(response.getData())) |
231 | // 过滤 | 230 | // 过滤 |
232 | .filter(data -> { // 学科 | 231 | .filter(data -> { // 学科 |
233 | String subject = state.subject.getValue(); | 232 | String subject = state.subject.getValue(); |
234 | if (subject == null || subject.isEmpty()) return true; | 233 | if (subject == null || subject.isEmpty()) return true; |
235 | else return subject.equals(data.getSubject()); | 234 | else return subject.equals(data.getSubject()); |
236 | }) | 235 | }) |
237 | .filter(data -> { // 年级 | 236 | .filter(data -> { // 年级 |
238 | String grade = state.grade.getValue(); | 237 | String grade = state.grade.getValue(); |
239 | if (grade == null || grade.isEmpty()) return true; | 238 | if (grade == null || grade.isEmpty()) return true; |
240 | else return grade.equals(data.getGrade()); | 239 | else return grade.equals(data.getGrade()); |
241 | }) | 240 | }) |
242 | .filter(data -> { // 学期 | 241 | .filter(data -> { // 学期 |
243 | String term = state.term.getValue(); | 242 | String term = state.term.getValue(); |
244 | if (term == null || term.isEmpty()) return true; | 243 | if (term == null || term.isEmpty()) return true; |
245 | else return term.equals(data.getTerm()); | 244 | else return term.equals(data.getTerm()); |
246 | }) | 245 | }) |
247 | .filter(data -> { // 反馈 | 246 | .filter(data -> { // 反馈 |
248 | Integer feedback = state.feedback.getValue(); | 247 | Integer feedback = state.feedback.getValue(); |
249 | if (feedback == null || feedback == 0) return true; | 248 | if (feedback == null || feedback == 0) return true; |
250 | 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); |
251 | }) | 250 | }) |
252 | // 过滤完成, 收集 | 251 | // 过滤完成, 收集 |
253 | .toList() | 252 | .toList() |
254 | .subscribe((data, th) -> { | 253 | .subscribe((data, th) -> { |
255 | if (th != null) th.printStackTrace(); | 254 | if (th != null) th.printStackTrace(); |
256 | homeworkAdapter.setNewData(data); | 255 | homeworkAdapter.setNewData(data); |
257 | }); | 256 | }); |
258 | } | 257 | } |
259 | 258 | ||
260 | @SuppressLint({"CheckResult", "NotifyDataSetChanged"}) | 259 | @SuppressLint({"CheckResult", "NotifyDataSetChanged"}) |
261 | private void getWeekHuyou() { | 260 | private void getWeekHuyou() { |
262 | NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 0) | 261 | NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 0) |
263 | .compose(transformSingle()) | 262 | .compose(transformSingle()) |
264 | .map(ResponseResult::getData) | 263 | .map(ResponseResult::getData) |
265 | .subscribe((list, throwable) -> { | 264 | .subscribe((list, throwable) -> { |
266 | if (throwable != null) { | 265 | if (throwable != null) { |
267 | throwable.printStackTrace(); | 266 | throwable.printStackTrace(); |
268 | return; | 267 | return; |
269 | } | 268 | } |
270 | if (list != null) { | 269 | if (list != null) { |
271 | mWeekList.clear(); | 270 | mWeekList.clear(); |
272 | mWeekList.addAll(list); | 271 | mWeekList.addAll(list); |
273 | weekAdapter.notifyDataSetChanged(); | 272 | weekAdapter.notifyDataSetChanged(); |
274 | 273 | ||
275 | boolean exist = false; | 274 | boolean exist = false; |
276 | int thisWeek = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR); | 275 | int thisWeek = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR); |
277 | for (StDetail bean: mWeekList) { | 276 | for (StDetail bean: mWeekList) { |
278 | Calendar other = Calendar.getInstance(); | 277 | Calendar other = Calendar.getInstance(); |
279 | other.setTime(bean.endTime); | 278 | other.setTime(bean.endTime); |
280 | if (other.get(Calendar.WEEK_OF_YEAR) == thisWeek) { | 279 | if (other.get(Calendar.WEEK_OF_YEAR) == thisWeek) { |
281 | exist = true; | 280 | exist = true; |
282 | break; | 281 | break; |
283 | } | 282 | } |
284 | } | 283 | } |
285 | binding.btnGeneralHuyou.setVisibility(exist ? View.GONE : View.VISIBLE); | 284 | binding.btnGeneralHuyou.setVisibility(exist ? View.GONE : View.VISIBLE); |
286 | } | 285 | } |
287 | }); | 286 | }); |
288 | } | 287 | } |
289 | 288 | ||
290 | @SuppressLint({"CheckResult", "NotifyDataSetChanged"}) | 289 | @SuppressLint({"CheckResult", "NotifyDataSetChanged"}) |
291 | private void getStageHuyou() { | 290 | private void getStageHuyou() { |
292 | NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 1) | 291 | NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 1) |
293 | .compose(transformSingle()) | 292 | .compose(transformSingle()) |
294 | .map(ResponseResult::getData) | 293 | .map(ResponseResult::getData) |
295 | .subscribe((list, throwable) -> { | 294 | .subscribe((list, throwable) -> { |
296 | if (throwable != null) { | 295 | if (throwable != null) { |
297 | throwable.printStackTrace(); | 296 | throwable.printStackTrace(); |
298 | return; | 297 | return; |
299 | } | 298 | } |
300 | if (list != null) { | 299 | if (list != null) { |
301 | mStageList.clear(); | 300 | mStageList.clear(); |
302 | mStageList.addAll(list); | 301 | mStageList.addAll(list); |
303 | stageAdapter.notifyDataSetChanged(); | 302 | stageAdapter.notifyDataSetChanged(); |
304 | } | 303 | } |
305 | }); | 304 | }); |
306 | } | 305 | } |
307 | 306 | ||
308 | @SuppressLint("CheckResult") | 307 | @SuppressLint("CheckResult") |
309 | private void generalWeek() { | 308 | private void generalWeek() { |
310 | showLoadingDialog("稍等..."); | 309 | showLoadingDialog("稍等..."); |
311 | NetWorks.service_url.generalHuyou() | 310 | NetWorks.service_url.generalHuyou() |
312 | .compose(transformSingle()) | 311 | .compose(transformSingle()) |
313 | .subscribe((response, throwable) -> { | 312 | .subscribe((response, throwable) -> { |
314 | cancelLoadingDialog(); | 313 | cancelLoadingDialog(); |
315 | if (throwable != null) { | 314 | if (throwable != null) { |
316 | loadFail("失败"); | 315 | loadFail("失败"); |
317 | throwable.printStackTrace(); | 316 | throwable.printStackTrace(); |
318 | return; | 317 | return; |
319 | } | 318 | } |
320 | if (response != null && response.getSuccess()) { | 319 | if (response != null && response.getSuccess()) { |
321 | binding.btnGeneralHuyou.setVisibility(View.GONE); | 320 | binding.btnGeneralHuyou.setVisibility(View.GONE); |
322 | getWeekHuyou(); | 321 | getWeekHuyou(); |
323 | } | 322 | } |
324 | }); | 323 | }); |
325 | } | 324 | } |
326 | 325 | ||
327 | @SuppressLint("CheckResult") | 326 | @SuppressLint("CheckResult") |
328 | private void generalStage(Date startDate, Date endDate, String subject) { | 327 | private void generalStage(Date startDate, Date endDate, String subject) { |
329 | 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); |
330 | Map<String, Object> body = new HashMap<>(); | 329 | Map<String, Object> body = new HashMap<>(); |
331 | body.put("stuId", state.student.stuId); | 330 | body.put("stuId", state.student.stuId); |
332 | body.put("startTime", format.format(startDate)); | 331 | body.put("startTime", format.format(startDate)); |
333 | body.put("endTime", format.format(endDate)); | 332 | body.put("endTime", format.format(endDate)); |
334 | body.put("subject", subject); | 333 | body.put("subject", subject); |
335 | showLoadingDialog("稍等..."); | 334 | showLoadingDialog("稍等..."); |
336 | NetWorks.service_url.generalStageHuyou(NetWorks.getHeader(), body) | 335 | NetWorks.service_url.generalStageHuyou(NetWorks.getHeader(), body) |
337 | .subscribeOn(Schedulers.io()) | 336 | .subscribeOn(Schedulers.io()) |
338 | .observeOn(AndroidSchedulers.mainThread()) | 337 | .observeOn(AndroidSchedulers.mainThread()) |
339 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) | 338 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) |
340 | .subscribe((response, throwable) -> { | 339 | .subscribe((response, throwable) -> { |
341 | if (throwable != null) { | 340 | if (throwable != null) { |
342 | loadFail("失败"); | 341 | loadFail("失败"); |
343 | throwable.printStackTrace(); | 342 | throwable.printStackTrace(); |
344 | return; | 343 | return; |
345 | } | 344 | } |
346 | if (response.getSuccess()) { | 345 | if (response.getSuccess()) { |
347 | getStageHuyou(); | 346 | getStageHuyou(); |
348 | cancelLoadingDialog(); | 347 | cancelLoadingDialog(); |
349 | } else { | 348 | } else { |
350 | loadFail(response.getMsg()); | 349 | loadFail(response.getMsg()); |
351 | } | 350 | } |
352 | }); | 351 | }); |
353 | } | 352 | } |
354 | 353 | ||
355 | @SuppressLint("CheckResult") | 354 | @SuppressLint("CheckResult") |
356 | private void deleteHuyou(StDetail detail) { | 355 | private void deleteHuyou(StDetail detail) { |
357 | showLoadingDialog("稍等..."); | 356 | showLoadingDialog("稍等..."); |
358 | NetWorks.service_url.deleteHuyou(NetWorks.getHeader(), detail.id) | 357 | NetWorks.service_url.deleteHuyou(NetWorks.getHeader(), detail.id) |
359 | .subscribeOn(Schedulers.io()) | 358 | .subscribeOn(Schedulers.io()) |
360 | .observeOn(AndroidSchedulers.mainThread()) | 359 | .observeOn(AndroidSchedulers.mainThread()) |
361 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) | 360 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) |
362 | .subscribe((response, throwable) -> { | 361 | .subscribe((response, throwable) -> { |
363 | cancelLoadingDialog(); | 362 | cancelLoadingDialog(); |
364 | if (throwable != null) { | 363 | if (throwable != null) { |
365 | loadFail("失败"); | 364 | loadFail("失败"); |
366 | throwable.printStackTrace(); | 365 | throwable.printStackTrace(); |
367 | return; | 366 | return; |
368 | } | 367 | } |
369 | if (detail.type == 0) { | 368 | if (detail.type == 0) { |
370 | getWeekHuyou(); | 369 | getWeekHuyou(); |
371 | } else { | 370 | } else { |
372 | getStageHuyou(); | 371 | getStageHuyou(); |
373 | } | 372 | } |
374 | }); | 373 | }); |
375 | } | 374 | } |
376 | 375 | ||
377 | private void showSubjectFilter() { | 376 | private void showSubjectFilter() { |
378 | if (subjectFilter == null) { | 377 | if (subjectFilter == null) { |
379 | PopupFilterSubjectBinding db = PopupFilterSubjectBinding.inflate(getLayoutInflater()); | 378 | PopupFilterSubjectBinding db = PopupFilterSubjectBinding.inflate(getLayoutInflater()); |
380 | db.setLifecycleOwner(this); | 379 | db.setLifecycleOwner(this); |
381 | db.setState(state); | 380 | db.setState(state); |
382 | db.bg.setOnClickListener(v -> subjectFilter.dismiss()); | 381 | db.bg.setOnClickListener(v -> subjectFilter.dismiss()); |
383 | 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); |
384 | subjectFilter.setOutsideTouchable(true); | 383 | subjectFilter.setOutsideTouchable(true); |
385 | } | 384 | } |
386 | subjectFilter.showAsDropDown(binding.anchorView); | 385 | subjectFilter.showAsDropDown(binding.anchorView); |
387 | state.onFilter = i -> { | 386 | state.onFilter = i -> { |
388 | subjectFilter.dismiss(); | 387 | subjectFilter.dismiss(); |
389 | String subject = state.subject.getValue(); | 388 | String subject = state.subject.getValue(); |
390 | binding.ftSubject.setActivated(subject != null && !subject.isEmpty()); | 389 | binding.ftSubject.setActivated(subject != null && !subject.isEmpty()); |
391 | binding.ftSubject.setText(subject == null || subject.isEmpty() ? "学科" : subject); | 390 | binding.ftSubject.setText(subject == null || subject.isEmpty() ? "学科" : subject); |
392 | getHomework(); | 391 | getHomework(); |
393 | }; | 392 | }; |
394 | } | 393 | } |
395 | 394 | ||
396 | private void showGradeFilter() { | 395 | private void showGradeFilter() { |
397 | if (gradeFilter == null) { | 396 | if (gradeFilter == null) { |
398 | PopupFilterGradeBinding db = PopupFilterGradeBinding.inflate(getLayoutInflater()); | 397 | PopupFilterGradeBinding db = PopupFilterGradeBinding.inflate(getLayoutInflater()); |
399 | db.setLifecycleOwner(this); | 398 | db.setLifecycleOwner(this); |
400 | db.setState(state); | 399 | db.setState(state); |
401 | db.bg.setOnClickListener(v -> gradeFilter.dismiss()); | 400 | db.bg.setOnClickListener(v -> gradeFilter.dismiss()); |
402 | 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); |
403 | gradeFilter.setOutsideTouchable(true); | 402 | gradeFilter.setOutsideTouchable(true); |
404 | } | 403 | } |
405 | gradeFilter.showAsDropDown(binding.anchorView); | 404 | gradeFilter.showAsDropDown(binding.anchorView); |
406 | state.onFilter = i -> { | 405 | state.onFilter = i -> { |
407 | gradeFilter.dismiss(); | 406 | gradeFilter.dismiss(); |
408 | String grade = state.grade.getValue(); | 407 | String grade = state.grade.getValue(); |
409 | binding.ftGrade.setActivated(grade != null && !grade.isEmpty()); | 408 | binding.ftGrade.setActivated(grade != null && !grade.isEmpty()); |
410 | binding.ftGrade.setText(grade == null || grade.isEmpty() ? "年级" : grade); | 409 | binding.ftGrade.setText(grade == null || grade.isEmpty() ? "年级" : grade); |
411 | 410 | ||
412 | getHomework(); | 411 | getHomework(); |
413 | }; | 412 | }; |
414 | } | 413 | } |
415 | 414 | ||
416 | private void showTermFilter() { | 415 | private void showTermFilter() { |
417 | if (termFilter == null) { | 416 | if (termFilter == null) { |
418 | PopupFilterTermBinding db = PopupFilterTermBinding.inflate(getLayoutInflater()); | 417 | PopupFilterTermBinding db = PopupFilterTermBinding.inflate(getLayoutInflater()); |
419 | db.setLifecycleOwner(this); | 418 | db.setLifecycleOwner(this); |
420 | db.setState(state); | 419 | db.setState(state); |
421 | db.bg.setOnClickListener(v -> termFilter.dismiss()); | 420 | db.bg.setOnClickListener(v -> termFilter.dismiss()); |
422 | 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); |
423 | termFilter.setOutsideTouchable(true); | 422 | termFilter.setOutsideTouchable(true); |
424 | } | 423 | } |
425 | termFilter.showAsDropDown(binding.anchorView); | 424 | termFilter.showAsDropDown(binding.anchorView); |
426 | state.onFilter = i -> { | 425 | state.onFilter = i -> { |
427 | termFilter.dismiss(); | 426 | termFilter.dismiss(); |
428 | String term = state.term.getValue(); | 427 | String term = state.term.getValue(); |
429 | binding.ftTerm.setActivated(term != null && !term.isEmpty()); | 428 | binding.ftTerm.setActivated(term != null && !term.isEmpty()); |
430 | binding.ftTerm.setText(term == null || term.isEmpty() ? "学期" : term); | 429 | binding.ftTerm.setText(term == null || term.isEmpty() ? "学期" : term); |
431 | 430 | ||
432 | getHomework(); | 431 | getHomework(); |
433 | }; | 432 | }; |
434 | } | 433 | } |
435 | 434 | ||
436 | private void showFeedbackFilter() { | 435 | private void showFeedbackFilter() { |
437 | if (feedbackFilter == null) { | 436 | if (feedbackFilter == null) { |
438 | PopupFilterFeedbackBinding db = PopupFilterFeedbackBinding.inflate(getLayoutInflater()); | 437 | PopupFilterFeedbackBinding db = PopupFilterFeedbackBinding.inflate(getLayoutInflater()); |
439 | db.setLifecycleOwner(this); | 438 | db.setLifecycleOwner(this); |
440 | db.setState(state); | 439 | db.setState(state); |
441 | db.bg.setOnClickListener(v -> feedbackFilter.dismiss()); | 440 | db.bg.setOnClickListener(v -> feedbackFilter.dismiss()); |
442 | 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); |
443 | feedbackFilter.setOutsideTouchable(true); | 442 | feedbackFilter.setOutsideTouchable(true); |
444 | } | 443 | } |
445 | feedbackFilter.showAsDropDown(binding.anchorView); | 444 | feedbackFilter.showAsDropDown(binding.anchorView); |
446 | state.onFilter = i -> { | 445 | state.onFilter = i -> { |
447 | feedbackFilter.dismiss(); | 446 | feedbackFilter.dismiss(); |
448 | int feedback = state.feedback.getValue().intValue(); | 447 | int feedback = state.feedback.getValue().intValue(); |
449 | binding.ftFeedback.setActivated(feedback != 0); | 448 | binding.ftFeedback.setActivated(feedback != 0); |
450 | binding.ftFeedback.setText(feedback == 0 ? "反馈状态" : feedback == 1 ? "已反馈" : "未反馈"); | 449 | binding.ftFeedback.setText(feedback == 0 ? "反馈状态" : feedback == 1 ? "已反馈" : "未反馈"); |
451 | 450 | ||
452 | getHomework(); | 451 | getHomework(); |
453 | }; | 452 | }; |
454 | } | 453 | } |
455 | 454 | ||
456 | @Override | 455 | @Override |
457 | protected ActivityStudentHomeworkBinding getViewBinding() { | 456 | protected ActivityStudentHomeworkBinding getViewBinding() { |
458 | return ActivityStudentHomeworkBinding.inflate(getLayoutInflater()); | 457 | return ActivityStudentHomeworkBinding.inflate(getLayoutInflater()); |
459 | } | 458 | } |
460 | 459 | ||
461 | public static class State { | 460 | public static class State { |
462 | public Student student; | 461 | public Student student; |
463 | 462 | ||
464 | public Function1<Integer> onFilter = i -> { }; | 463 | public Function1<Integer> onFilter = i -> { }; |
465 | 464 | ||
466 | public MutableLiveData<String> subject = new MutableLiveData<>(""); | 465 | public MutableLiveData<String> subject = new MutableLiveData<>(""); |
467 | public void setSubject(String value) { | 466 | public void setSubject(String value) { |
468 | subject.setValue(value); | 467 | subject.setValue(value); |
469 | onFilter.invoke(1); | 468 | onFilter.invoke(1); |
470 | } | 469 | } |
471 | 470 | ||
472 | public MutableLiveData<String> grade = new MutableLiveData<>(""); | 471 | public MutableLiveData<String> grade = new MutableLiveData<>(""); |
473 | public void setGrade(String value) { | 472 | public void setGrade(String value) { |
474 | grade.setValue(value); | 473 | grade.setValue(value); |
475 | onFilter.invoke(2); | 474 | onFilter.invoke(2); |
476 | } | 475 | } |
477 | 476 | ||
478 | public MutableLiveData<String> term = new MutableLiveData<>(""); | 477 | public MutableLiveData<String> term = new MutableLiveData<>(""); |
479 | public void setTerm(String value) { | 478 | public void setTerm(String value) { |
480 | term.setValue(value); | 479 | term.setValue(value); |
481 | onFilter.invoke(3); | 480 | onFilter.invoke(3); |
482 | } | 481 | } |
483 | 482 | ||
484 | //0:全部, 1: 已反馈, 2:未反馈 | 483 | //0:全部, 1: 已反馈, 2:未反馈 |
485 | public MutableLiveData<Integer> feedback = new MutableLiveData<>(0); | 484 | public MutableLiveData<Integer> feedback = new MutableLiveData<>(0); |
486 | public void setFeedback(int value) { | 485 | public void setFeedback(int value) { |
487 | feedback.setValue(value); | 486 | feedback.setValue(value); |
488 | onFilter.invoke(4); | 487 | onFilter.invoke(4); |
489 | } | 488 | } |
490 | } | 489 | } |
491 | 490 | ||
492 | static class HuyouAdapter extends BaseQuickAdapter<StDetail, BaseViewHolder> { | 491 | static class HuyouAdapter extends BaseQuickAdapter<StDetail, BaseViewHolder> { |
493 | public Function1<StDetail> deleteCall; | 492 | public Function1<StDetail> deleteCall; |
494 | public Function1<StDetail> detailCall; | 493 | public Function1<StDetail> detailCall; |
495 | public Student student; | 494 | public Student student; |
496 | 495 | ||
497 | public HuyouAdapter(@Nullable List<StDetail> data) { | 496 | public HuyouAdapter(@Nullable List<StDetail> data) { |
498 | super(R.layout.item_homework_list, data); | 497 | super(R.layout.item_homework_list, data); |
499 | } | 498 | } |
500 | 499 | ||
501 | @SuppressLint("SetTextI18n,SimpleDateFormat") | 500 | @SuppressLint("SetTextI18n,SimpleDateFormat") |
502 | @Override | 501 | @Override |
503 | protected void convert(@NonNull BaseViewHolder holder, StDetail data) { | 502 | protected void convert(@NonNull BaseViewHolder holder, StDetail data) { |
504 | holder.setGone(R.id.tvFlag, false); | 503 | holder.setGone(R.id.tvFlag, false); |
505 | int subjectImg; | 504 | int subjectImg; |
506 | switch (data.homeworkSubject) { | 505 | switch (data.homeworkSubject) { |
507 | case "语文": | 506 | case "语文": |
508 | subjectImg = R.drawable.ic_chinese; | 507 | subjectImg = R.drawable.png_cover_chinese; |
509 | break; | 508 | break; |
510 | case "英语": | 509 | case "英语": |
511 | subjectImg = R.drawable.ic_english; | 510 | subjectImg = R.drawable.png_cover_english; |
512 | break; | 511 | break; |
513 | case "物理": | 512 | case "物理": |
514 | subjectImg = R.drawable.ic_physics; | 513 | subjectImg = R.drawable.png_cover_physics; |
515 | break; | 514 | break; |
516 | case "化学": | 515 | case "化学": |
517 | subjectImg = R.drawable.ic_chemistry; | 516 | subjectImg = R.drawable.png_cover_chemistry; |
518 | break; | 517 | break; |
519 | case "数学": | 518 | case "数学": |
520 | default: | 519 | default: |
521 | subjectImg = R.drawable.ic_math; | 520 | subjectImg = R.drawable.png_cover_math; |
522 | } | 521 | } |
523 | holder.setImageResource(R.id.ivSubject, subjectImg); | 522 | holder.setImageResource(R.id.ivSubject, subjectImg); |
524 | Date endDate = new Date(data.endTime.getTime() - 1000); | 523 | Date endDate = new Date(data.endTime.getTime() - 1000); |
525 | String startStr = new SimpleDateFormat("yyyy.M.d").format(data.startTime); | 524 | String startStr = new SimpleDateFormat("yyyy.M.d").format(data.startTime); |
526 | String endStr = new SimpleDateFormat("-M.d").format(endDate); | 525 | String endStr = new SimpleDateFormat("-M.d").format(endDate); |
527 | String typeStr = data.type == 0 ? "作业周总结" : "作业阶段性总结"; | 526 | String typeStr = data.type == 0 ? "作业周总结" : "作业阶段性总结"; |
528 | String title = startStr + endStr + data.homeworkSubject + typeStr; | 527 | String title = startStr + endStr + data.homeworkSubject + typeStr; |
529 | holder.setText(R.id.tvName, title); | 528 | holder.setText(R.id.tvName, title); |
530 | holder.setText(R.id.tvGrade, data.grade); | 529 | holder.setText(R.id.tvGrade, data.grade); |
531 | View btnDelete = holder.getView(R.id.btnDelete); | 530 | View btnDelete = holder.getView(R.id.btnDelete); |
532 | View btnDetail = holder.getView(R.id.btnDetail); | 531 | View btnDetail = holder.getView(R.id.btnDetail); |
533 | btnDelete.setOnClickListener(v -> { | 532 | btnDelete.setOnClickListener(v -> { |
534 | if (deleteCall != null) deleteCall.invoke(data); | 533 | if (deleteCall != null) deleteCall.invoke(data); |
535 | }); | 534 | }); |
536 | btnDetail.setOnClickListener(v -> { | 535 | btnDetail.setOnClickListener(v -> { |
537 | if (detailCall != null) detailCall.invoke(data); | 536 | if (detailCall != null) detailCall.invoke(data); |
538 | }); | 537 | }); |
539 | } | 538 | } |
540 | 539 | ||
541 | private SimpleDateFormat getFormatWithGmt8(String pattern) { | 540 | private SimpleDateFormat getFormatWithGmt8(String pattern) { |
542 | SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.CHINA); | 541 | SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.CHINA); |
543 | //format.setTimeZone(TimeZone.getTimeZone("GMT+16")); | 542 | //format.setTimeZone(TimeZone.getTimeZone("GMT+16")); |
544 | return format; | 543 | return format; |
545 | } | 544 | } |
546 | } | 545 | } |
547 | 546 | ||
548 | } | 547 | } |
549 | 548 |
app/src/main/java/com/hjx/parent/adapter/HomeworkAdapter.java
1 | package com.hjx.parent.adapter; | 1 | package com.hjx.parent.adapter; |
2 | 2 | ||
3 | import android.view.View; | 3 | import android.view.View; |
4 | import android.widget.TextView; | 4 | import android.widget.TextView; |
5 | 5 | ||
6 | import androidx.annotation.NonNull; | 6 | import androidx.annotation.NonNull; |
7 | 7 | ||
8 | import com.chad.library.adapter.base.BaseQuickAdapter; | 8 | import com.chad.library.adapter.base.BaseQuickAdapter; |
9 | import com.chad.library.adapter.base.BaseViewHolder; | 9 | import com.chad.library.adapter.base.BaseViewHolder; |
10 | import com.hjx.parent.R; | 10 | import com.hjx.parent.R; |
11 | import com.prws.common.bean.homework.HomeworkList; | 11 | import com.prws.common.bean.homework.HomeworkList; |
12 | 12 | ||
13 | public class HomeworkAdapter extends BaseQuickAdapter<HomeworkList, BaseViewHolder> { | 13 | public class HomeworkAdapter extends BaseQuickAdapter<HomeworkList, BaseViewHolder> { |
14 | 14 | ||
15 | public HomeworkAdapter() { | 15 | public HomeworkAdapter() { |
16 | super(R.layout.item_homework); | 16 | super(R.layout.item_homework); |
17 | } | 17 | } |
18 | 18 | ||
19 | @Override | 19 | @Override |
20 | protected void convert(@NonNull BaseViewHolder helper, HomeworkList homework) { | 20 | protected void convert(@NonNull BaseViewHolder helper, HomeworkList homework) { |
21 | helper.setText(R.id.tvName, homework.getName()); | 21 | helper.setText(R.id.tvName, homework.getName()); |
22 | helper.setText(R.id.tvGrade, homework.getGrade() + "-" + homework.getTerm()); | 22 | helper.setText(R.id.tvGrade, homework.getGrade() + "-" + homework.getTerm()); |
23 | int subjectImg; | 23 | int subjectImg; |
24 | switch (homework.getSubject()) { | 24 | switch (homework.getSubject()) { |
25 | case "语文": | 25 | case "语文": |
26 | subjectImg = R.drawable.ic_chinese; | 26 | subjectImg = R.drawable.png_cover_chinese; |
27 | break; | 27 | break; |
28 | case "英语": | 28 | case "英语": |
29 | subjectImg = R.drawable.ic_english; | 29 | subjectImg = R.drawable.png_cover_english; |
30 | break; | 30 | break; |
31 | case "物理": | 31 | case "物理": |
32 | subjectImg = R.drawable.ic_physics; | 32 | subjectImg = R.drawable.png_cover_physics; |
33 | break; | 33 | break; |
34 | case "化学": | 34 | case "化学": |
35 | subjectImg = R.drawable.ic_chemistry; | 35 | subjectImg = R.drawable.png_cover_chemistry; |
36 | break; | 36 | break; |
37 | case "数学": | 37 | case "数学": |
38 | default: | 38 | default: |
39 | subjectImg = R.drawable.ic_math; | 39 | subjectImg = R.drawable.png_cover_math; |
40 | } | 40 | } |
41 | helper.setImageResource(R.id.ivSubject, subjectImg); | 41 | helper.setImageResource(R.id.ivSubject, subjectImg); |
42 | 42 | ||
43 | TextView tvDate = helper.getView(R.id.tvDate); | 43 | TextView tvDate = helper.getView(R.id.tvDate); |
44 | int index = getData().indexOf(homework); | 44 | int index = getData().indexOf(homework); |
45 | if (index == 0) { | 45 | if (index == 0) { |
46 | tvDate.setVisibility(View.VISIBLE); | 46 | tvDate.setVisibility(View.VISIBLE); |
47 | } else if (!homework.getFormatTime().equals(getData().get(index - 1).getFormatTime())) { | 47 | } else if (!homework.getFormatTime().equals(getData().get(index - 1).getFormatTime())) { |
48 | tvDate.setVisibility(View.VISIBLE); | 48 | tvDate.setVisibility(View.VISIBLE); |
49 | } else { | 49 | } else { |
50 | tvDate.setVisibility(View.GONE); | 50 | tvDate.setVisibility(View.GONE); |
51 | } | 51 | } |
52 | tvDate.setText(homework.getFormatTime()); | 52 | tvDate.setText(homework.getFormatTime()); |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 |
app/src/main/java/com/hjx/parent/adapter/HomeworkListAdapter.java
1 | package com.hjx.parent.adapter; | 1 | package com.hjx.parent.adapter; |
2 | 2 | ||
3 | import android.content.Intent; | ||
4 | import android.view.View; | 3 | import android.view.View; |
5 | import android.widget.TextView; | 4 | import android.widget.TextView; |
6 | 5 | ||
7 | import androidx.annotation.NonNull; | 6 | import androidx.annotation.NonNull; |
8 | 7 | ||
9 | import com.chad.library.adapter.base.BaseQuickAdapter; | 8 | import com.chad.library.adapter.base.BaseQuickAdapter; |
10 | import com.chad.library.adapter.base.BaseViewHolder; | 9 | import com.chad.library.adapter.base.BaseViewHolder; |
11 | import com.google.gson.Gson; | ||
12 | import com.hjx.parent.HomeworkDetailActivity; | ||
13 | import com.hjx.parent.R; | 10 | import com.hjx.parent.R; |
14 | import com.hjx.parent.function.Function0; | ||
15 | import com.hjx.parent.function.Function1; | 11 | import com.hjx.parent.function.Function1; |
16 | import com.prws.common.bean.homework.HomeworkList; | 12 | import com.prws.common.bean.homework.HomeworkList; |
17 | 13 | ||
18 | public class HomeworkListAdapter extends BaseQuickAdapter<HomeworkList, BaseViewHolder> { | 14 | public class HomeworkListAdapter extends BaseQuickAdapter<HomeworkList, BaseViewHolder> { |
19 | 15 | ||
20 | public Function1<HomeworkList> deleteCall; | 16 | public Function1<HomeworkList> deleteCall; |
21 | public Function1<HomeworkList> detailCall; | 17 | public Function1<HomeworkList> detailCall; |
22 | 18 | ||
23 | public HomeworkListAdapter() { | 19 | public HomeworkListAdapter() { |
24 | super(R.layout.item_homework_list); | 20 | super(R.layout.item_homework_list); |
25 | } | 21 | } |
26 | 22 | ||
27 | @Override | 23 | @Override |
28 | protected void convert(@NonNull BaseViewHolder holder, HomeworkList homework) { | 24 | protected void convert(@NonNull BaseViewHolder holder, HomeworkList homework) { |
29 | holder.setGone(R.id.tvFlag, homework.getRight() != null); | 25 | holder.setGone(R.id.tvFlag, homework.getRight() != null); |
30 | holder.setText(R.id.tvName, homework.getName()); | 26 | holder.setText(R.id.tvName, homework.getName()); |
31 | holder.setText(R.id.tvGrade, homework.getGrade() + "-" + homework.getTerm()); | 27 | holder.setText(R.id.tvGrade, homework.getGrade() + "-" + homework.getTerm()); |
32 | int subjectImg; | 28 | int subjectImg; |
33 | switch (homework.getSubject()) { | 29 | switch (homework.getSubject()) { |
34 | case "语文": | 30 | case "语文": |
35 | subjectImg = R.drawable.ic_chinese; | 31 | subjectImg = R.drawable.png_cover_chinese; |
36 | break; | 32 | break; |
37 | case "英语": | 33 | case "英语": |
38 | subjectImg = R.drawable.ic_english; | 34 | subjectImg = R.drawable.png_cover_english; |
39 | break; | 35 | break; |
40 | case "物理": | 36 | case "物理": |
41 | subjectImg = R.drawable.ic_physics; | 37 | subjectImg = R.drawable.png_cover_physics; |
42 | break; | 38 | break; |
43 | case "化学": | 39 | case "化学": |
44 | subjectImg = R.drawable.ic_chemistry; | 40 | subjectImg = R.drawable.png_cover_chemistry; |
45 | break; | 41 | break; |
46 | case "数学": | 42 | case "数学": |
47 | default: | 43 | default: |
48 | subjectImg = R.drawable.ic_math; | 44 | subjectImg = R.drawable.png_cover_math; |
49 | } | 45 | } |
50 | holder.setImageResource(R.id.ivSubject, subjectImg); | 46 | holder.setImageResource(R.id.ivSubject, subjectImg); |
51 | 47 | ||
52 | TextView tvDate = holder.getView(R.id.tvDate); | 48 | TextView tvDate = holder.getView(R.id.tvDate); |
53 | int index = getData().indexOf(homework); | 49 | int index = getData().indexOf(homework); |
54 | if (index == 0) { | 50 | if (index == 0) { |
55 | tvDate.setVisibility(View.VISIBLE); | 51 | tvDate.setVisibility(View.VISIBLE); |
56 | } else if (!homework.getFormatTime().equals(getData().get(index - 1).getFormatTime())) { | 52 | } else if (!homework.getFormatTime().equals(getData().get(index - 1).getFormatTime())) { |
57 | tvDate.setVisibility(View.VISIBLE); | 53 | tvDate.setVisibility(View.VISIBLE); |
58 | } else { | 54 | } else { |
59 | tvDate.setVisibility(View.GONE); | 55 | tvDate.setVisibility(View.GONE); |
60 | } | 56 | } |
61 | tvDate.setText(homework.getFormatTime()); | 57 | tvDate.setText(homework.getFormatTime()); |
62 | 58 | ||
63 | View btnDelete = holder.getView(R.id.btnDelete); | 59 | View btnDelete = holder.getView(R.id.btnDelete); |
64 | btnDelete.setOnClickListener(v -> { | 60 | btnDelete.setOnClickListener(v -> { |
65 | if (deleteCall != null) deleteCall.invoke(homework); | 61 | if (deleteCall != null) deleteCall.invoke(homework); |
66 | }); | 62 | }); |
67 | 63 | ||
68 | View btnDetail = holder.getView(R.id.btnDetail); | 64 | View btnDetail = holder.getView(R.id.btnDetail); |
69 | btnDetail.setOnClickListener(v -> { | 65 | btnDetail.setOnClickListener(v -> { |
70 | if (detailCall != null) { | 66 | if (detailCall != null) { |
71 | detailCall.invoke(homework); | 67 | detailCall.invoke(homework); |
72 | } | 68 | } |
73 | }); | 69 | }); |
74 | holder.itemView.setOnClickListener(v -> { | 70 | holder.itemView.setOnClickListener(v -> { |
75 | if (detailCall != null) { | 71 | if (detailCall != null) { |
76 | detailCall.invoke(homework); | 72 | detailCall.invoke(homework); |
77 | } | 73 | } |
78 | }); | 74 | }); |
79 | } | 75 | } |
80 | } | 76 | } |
81 | 77 |
app/src/main/res/drawable/ic_chemistry.png
74.3 KB
app/src/main/res/drawable/ic_chinese.png
73.7 KB
app/src/main/res/drawable/ic_english.png
79.7 KB
app/src/main/res/drawable/ic_math.png
73 KB
app/src/main/res/drawable/ic_physics.png
71 KB
app/src/main/res/drawable/png_cover_chemistry.png
74.3 KB
app/src/main/res/drawable/png_cover_chinese.png
73.7 KB
app/src/main/res/drawable/png_cover_english.png
79.7 KB
app/src/main/res/drawable/png_cover_math.png
73 KB
app/src/main/res/drawable/png_cover_physics.png
71 KB
app/src/main/res/layout/item_homework.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:paddingHorizontal="10dp" | 7 | android:paddingHorizontal="10dp" |
8 | android:layout_marginVertical="8dp" | 8 | android:layout_marginVertical="8dp" |
9 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
11 | tools:ignore="SmallSp"> | 11 | tools:ignore="SmallSp"> |
12 | 12 | ||
13 | <TextView | 13 | <TextView |
14 | android:id="@+id/tvDate" | 14 | android:id="@+id/tvDate" |
15 | android:visibility="gone" | 15 | android:visibility="gone" |
16 | tools:visibility="visible" | 16 | tools:visibility="visible" |
17 | tools:text="2024-09-25" | 17 | tools:text="2024-09-25" |
18 | android:textSize="12sp" | 18 | android:textSize="12sp" |
19 | android:textColor="#999" | 19 | android:textColor="#999" |
20 | android:layout_marginBottom="15dp" | 20 | android:layout_marginBottom="15dp" |
21 | android:layout_width="wrap_content" | 21 | android:layout_width="wrap_content" |
22 | android:layout_height="wrap_content"/> | 22 | android:layout_height="wrap_content"/> |
23 | 23 | ||
24 | <LinearLayout | 24 | <LinearLayout |
25 | android:orientation="horizontal" | 25 | android:orientation="horizontal" |
26 | android:gravity="center_vertical" | 26 | android:gravity="center_vertical" |
27 | android:background="@drawable/bg_homework" | 27 | android:background="@drawable/bg_homework" |
28 | android:layout_width="match_parent" | 28 | android:layout_width="match_parent" |
29 | android:layout_height="75dp"> | 29 | android:layout_height="75dp"> |
30 | <ImageView | 30 | <ImageView |
31 | android:id="@+id/ivSubject" | 31 | android:id="@+id/ivSubject" |
32 | tools:src="@drawable/ic_math" | 32 | tools:src="@drawable/png_cover_math" |
33 | android:layout_marginStart="10dp" | 33 | android:layout_marginStart="10dp" |
34 | android:layout_width="44dp" | 34 | android:layout_width="44dp" |
35 | android:layout_height="56dp" | 35 | android:layout_height="56dp" |
36 | android:importantForAccessibility="no" /> | 36 | android:importantForAccessibility="no" /> |
37 | <LinearLayout | 37 | <LinearLayout |
38 | android:orientation="vertical" | 38 | android:orientation="vertical" |
39 | android:layout_marginStart="14dp" | 39 | android:layout_marginStart="14dp" |
40 | android:layout_marginVertical="16dp" | 40 | android:layout_marginVertical="16dp" |
41 | android:layout_width="wrap_content" | 41 | android:layout_width="wrap_content" |
42 | android:layout_height="match_parent"> | 42 | android:layout_height="match_parent"> |
43 | <TextView | 43 | <TextView |
44 | android:id="@+id/tvName" | 44 | android:id="@+id/tvName" |
45 | tools:text="作业名称作业名称作业名称作业名称作业名称" | 45 | tools:text="作业名称作业名称作业名称作业名称作业名称" |
46 | android:singleLine="true" | 46 | android:singleLine="true" |
47 | android:maxEms="12" | 47 | android:maxEms="12" |
48 | android:textSize="13sp" | 48 | android:textSize="13sp" |
49 | android:textColor="#333" | 49 | android:textColor="#333" |
50 | android:layout_width="wrap_content" | 50 | android:layout_width="wrap_content" |
51 | android:layout_height="wrap_content"/> | 51 | android:layout_height="wrap_content"/> |
52 | <Space style="@style/empty_space"/> | 52 | <Space style="@style/empty_space"/> |
53 | <TextView | 53 | <TextView |
54 | android:id="@+id/tvGrade" | 54 | android:id="@+id/tvGrade" |
55 | tools:text="七年级-上学期" | 55 | tools:text="七年级-上学期" |
56 | android:textSize="10sp" | 56 | android:textSize="10sp" |
57 | android:textColor="#666" | 57 | android:textColor="#666" |
58 | android:layout_width="wrap_content" | 58 | android:layout_width="wrap_content" |
59 | android:layout_height="wrap_content" /> | 59 | android:layout_height="wrap_content" /> |
60 | </LinearLayout> | 60 | </LinearLayout> |
61 | <Space style="@style/empty_space"/> | 61 | <Space style="@style/empty_space"/> |
62 | <TextView | 62 | <TextView |
63 | android:text=">" | 63 | android:text=">" |
64 | android:textSize="20sp" | 64 | android:textSize="20sp" |
65 | android:textColor="#333" | 65 | android:textColor="#333" |
66 | android:layout_marginEnd="10dp" | 66 | android:layout_marginEnd="10dp" |
67 | android:layout_width="wrap_content" | 67 | android:layout_width="wrap_content" |
68 | android:layout_height="wrap_content" | 68 | android:layout_height="wrap_content" |
69 | tools:ignore="HardcodedText" /> | 69 | tools:ignore="HardcodedText" /> |
70 | </LinearLayout> | 70 | </LinearLayout> |
71 | 71 | ||
72 | </LinearLayout> | 72 | </LinearLayout> |
app/src/main/res/layout/item_homework_list.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:paddingHorizontal="10dp" | 7 | android:paddingHorizontal="10dp" |
8 | android:layout_marginVertical="8dp" | 8 | android:layout_marginVertical="8dp" |
9 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
11 | tools:ignore="SmallSp,HardcodedText"> | 11 | tools:ignore="SmallSp,HardcodedText"> |
12 | 12 | ||
13 | <TextView | 13 | <TextView |
14 | android:id="@+id/tvDate" | 14 | android:id="@+id/tvDate" |
15 | android:visibility="gone" | 15 | android:visibility="gone" |
16 | tools:visibility="visible" | 16 | tools:visibility="visible" |
17 | tools:text="2024-09-25" | 17 | tools:text="2024-09-25" |
18 | android:textSize="14sp" | 18 | android:textSize="14sp" |
19 | android:textColor="#999" | 19 | android:textColor="#999" |
20 | android:layout_marginBottom="12dp" | 20 | android:layout_marginBottom="12dp" |
21 | android:layout_width="wrap_content" | 21 | android:layout_width="wrap_content" |
22 | android:layout_height="wrap_content"/> | 22 | android:layout_height="wrap_content"/> |
23 | 23 | ||
24 | <FrameLayout | 24 | <FrameLayout |
25 | android:background="@drawable/shape_radius_10" | 25 | android:background="@drawable/shape_radius_10" |
26 | android:backgroundTint="@color/white" | 26 | android:backgroundTint="@color/white" |
27 | android:layout_width="match_parent" | 27 | android:layout_width="match_parent" |
28 | android:layout_height="80dp"> | 28 | android:layout_height="80dp"> |
29 | <LinearLayout | 29 | <LinearLayout |
30 | android:orientation="horizontal" | 30 | android:orientation="horizontal" |
31 | android:gravity="center_vertical" | 31 | android:gravity="center_vertical" |
32 | android:layout_width="match_parent" | 32 | android:layout_width="match_parent" |
33 | android:layout_height="match_parent"> | 33 | android:layout_height="match_parent"> |
34 | <ImageView | 34 | <ImageView |
35 | android:id="@+id/ivSubject" | 35 | android:id="@+id/ivSubject" |
36 | tools:src="@drawable/ic_math" | 36 | tools:src="@drawable/png_cover_math" |
37 | android:layout_marginStart="10dp" | 37 | android:layout_marginStart="10dp" |
38 | android:layout_width="50dp" | 38 | android:layout_width="50dp" |
39 | android:layout_height="64dp" | 39 | android:layout_height="64dp" |
40 | android:importantForAccessibility="no" /> | 40 | android:importantForAccessibility="no" /> |
41 | <LinearLayout | 41 | <LinearLayout |
42 | android:orientation="vertical" | 42 | android:orientation="vertical" |
43 | android:layout_marginStart="14dp" | 43 | android:layout_marginStart="14dp" |
44 | android:layout_marginEnd="10dp" | 44 | android:layout_marginEnd="10dp" |
45 | android:layout_marginVertical="12dp" | 45 | android:layout_marginVertical="12dp" |
46 | android:layout_width="match_parent" | 46 | android:layout_width="match_parent" |
47 | android:layout_height="match_parent"> | 47 | android:layout_height="match_parent"> |
48 | <TextView | 48 | <TextView |
49 | android:id="@+id/tvName" | 49 | android:id="@+id/tvName" |
50 | tools:text="作业名称作业名称作业名称作业名称作业名称作业名称作业名称" | 50 | tools:text="作业名称作业名称作业名称作业名称作业名称作业名称作业名称" |
51 | android:textSize="14sp" | 51 | android:textSize="14sp" |
52 | android:textColor="#333" | 52 | android:textColor="#333" |
53 | android:singleLine="true" | 53 | android:singleLine="true" |
54 | android:maxEms="12" | 54 | android:maxEms="12" |
55 | android:ellipsize="end" | 55 | android:ellipsize="end" |
56 | android:layout_width="wrap_content" | 56 | android:layout_width="wrap_content" |
57 | android:layout_height="wrap_content"/> | 57 | android:layout_height="wrap_content"/> |
58 | <Space style="@style/empty_space"/> | 58 | <Space style="@style/empty_space"/> |
59 | <LinearLayout | 59 | <LinearLayout |
60 | android:orientation="horizontal" | 60 | android:orientation="horizontal" |
61 | android:gravity="center_vertical" | 61 | android:gravity="center_vertical" |
62 | android:layout_width="match_parent" | 62 | android:layout_width="match_parent" |
63 | android:layout_height="wrap_content"> | 63 | android:layout_height="wrap_content"> |
64 | <TextView | 64 | <TextView |
65 | android:id="@+id/tvGrade" | 65 | android:id="@+id/tvGrade" |
66 | tools:text="七年级-上学期" | 66 | tools:text="七年级-上学期" |
67 | android:textSize="12sp" | 67 | android:textSize="12sp" |
68 | android:textColor="#666" | 68 | android:textColor="#666" |
69 | android:layout_width="wrap_content" | 69 | android:layout_width="wrap_content" |
70 | android:layout_height="wrap_content" /> | 70 | android:layout_height="wrap_content" /> |
71 | <Space style="@style/empty_space"/> | 71 | <Space style="@style/empty_space"/> |
72 | <androidx.appcompat.widget.AppCompatTextView | 72 | <androidx.appcompat.widget.AppCompatTextView |
73 | android:id="@+id/btnDelete" | 73 | android:id="@+id/btnDelete" |
74 | android:text="删除" | 74 | android:text="删除" |
75 | android:textSize="12sp" | 75 | android:textSize="12sp" |
76 | android:textColor="#666" | 76 | android:textColor="#666" |
77 | android:gravity="center_vertical" | 77 | android:gravity="center_vertical" |
78 | android:drawableStart="@drawable/svg_delete" | 78 | android:drawableStart="@drawable/svg_delete" |
79 | android:drawableTint="#C5C5C5" | 79 | android:drawableTint="#C5C5C5" |
80 | android:drawablePadding="2dp" | 80 | android:drawablePadding="2dp" |
81 | android:layout_width="wrap_content" | 81 | android:layout_width="wrap_content" |
82 | android:layout_height="wrap_content"/> | 82 | android:layout_height="wrap_content"/> |
83 | <View | 83 | <View |
84 | android:background="#F5F5F5" | 84 | android:background="#F5F5F5" |
85 | android:layout_marginHorizontal="15dp" | 85 | android:layout_marginHorizontal="15dp" |
86 | android:layout_width="1dp" | 86 | android:layout_width="1dp" |
87 | android:layout_height="10dp"/> | 87 | android:layout_height="10dp"/> |
88 | <androidx.appcompat.widget.AppCompatTextView | 88 | <androidx.appcompat.widget.AppCompatTextView |
89 | android:id="@+id/btnDetail" | 89 | android:id="@+id/btnDetail" |
90 | android:text="详情" | 90 | android:text="详情" |
91 | android:textSize="12sp" | 91 | android:textSize="12sp" |
92 | android:textColor="#666" | 92 | android:textColor="#666" |
93 | android:gravity="center_vertical" | 93 | android:gravity="center_vertical" |
94 | android:drawableStart="@drawable/svg_go_detail" | 94 | android:drawableStart="@drawable/svg_go_detail" |
95 | android:drawablePadding="5dp" | 95 | android:drawablePadding="5dp" |
96 | android:layout_width="wrap_content" | 96 | android:layout_width="wrap_content" |
97 | android:layout_height="wrap_content"/> | 97 | android:layout_height="wrap_content"/> |
98 | </LinearLayout> | 98 | </LinearLayout> |
99 | </LinearLayout> | 99 | </LinearLayout> |
100 | </LinearLayout> | 100 | </LinearLayout> |
101 | <TextView | 101 | <TextView |
102 | android:id="@+id/tvFlag" | 102 | android:id="@+id/tvFlag" |
103 | android:text="已反馈" | 103 | android:text="已反馈" |
104 | android:textSize="11sp" | 104 | android:textSize="11sp" |
105 | android:textColor="@color/white" | 105 | android:textColor="@color/white" |
106 | android:background="@drawable/bg_homework_feedback_flag" | 106 | android:background="@drawable/bg_homework_feedback_flag" |
107 | android:layout_gravity="end" | 107 | android:layout_gravity="end" |
108 | android:paddingHorizontal="7dp" | 108 | android:paddingHorizontal="7dp" |
109 | android:paddingVertical="2dp" | 109 | android:paddingVertical="2dp" |
110 | android:layout_width="wrap_content" | 110 | android:layout_width="wrap_content" |
111 | android:layout_height="wrap_content" /> | 111 | android:layout_height="wrap_content" /> |
112 | </FrameLayout> | 112 | </FrameLayout> |
113 | 113 | ||
114 | </LinearLayout> | 114 | </LinearLayout> |