Commit ea57c8d609700b40fa515a2d7c64cabd95c87ce9
1 parent
bd79e76cdd
Exists in
master
周总结和阶段性总结列表展示
Showing
13 changed files
with
704 additions
and
2 deletions
Show diff stats
.idea/deploymentTargetDropDown.xml
| ... | ... | @@ -3,7 +3,20 @@ |
| 3 | 3 | <component name="deploymentTargetDropDown"> |
| 4 | 4 | <value> |
| 5 | 5 | <entry key="app"> |
| 6 | - <State /> | |
| 6 | + <State> | |
| 7 | + <runningDeviceTargetSelectedWithDropDown> | |
| 8 | + <Target> | |
| 9 | + <type value="RUNNING_DEVICE_TARGET" /> | |
| 10 | + <deviceKey> | |
| 11 | + <Key> | |
| 12 | + <type value="SERIAL_NUMBER" /> | |
| 13 | + <value value="192.168.3.176:35119" /> | |
| 14 | + </Key> | |
| 15 | + </deviceKey> | |
| 16 | + </Target> | |
| 17 | + </runningDeviceTargetSelectedWithDropDown> | |
| 18 | + <timeTargetWasSelectedWithDropDown value="2024-10-09T03:21:59.277023400Z" /> | |
| 19 | + </State> | |
| 7 | 20 | </entry> |
| 8 | 21 | </value> |
| 9 | 22 | </component> | ... | ... |
app/src/main/java/com/hjx/parent/StuHomeworkActivity.java
| ... | ... | @@ -3,12 +3,21 @@ package com.hjx.parent; |
| 3 | 3 | import android.annotation.SuppressLint; |
| 4 | 4 | import android.content.Intent; |
| 5 | 5 | import android.os.Bundle; |
| 6 | +import android.view.Gravity; | |
| 7 | +import android.view.View; | |
| 8 | +import android.widget.ImageView; | |
| 6 | 9 | import android.widget.LinearLayout; |
| 10 | +import android.widget.PopupMenu; | |
| 7 | 11 | import android.widget.PopupWindow; |
| 12 | +import android.widget.TextView; | |
| 8 | 13 | |
| 14 | +import androidx.annotation.NonNull; | |
| 9 | 15 | import androidx.annotation.Nullable; |
| 10 | 16 | import androidx.lifecycle.MutableLiveData; |
| 11 | 17 | |
| 18 | +import com.chad.library.adapter.base.BaseQuickAdapter; | |
| 19 | +import com.chad.library.adapter.base.BaseViewHolder; | |
| 20 | +import com.google.android.material.tabs.TabLayout; | |
| 12 | 21 | import com.google.gson.Gson; |
| 13 | 22 | import com.hjx.parent.adapter.HomeworkListAdapter; |
| 14 | 23 | import com.hjx.parent.databinding.ActivityStudentHomeworkBinding; |
| ... | ... | @@ -17,14 +26,27 @@ import com.hjx.parent.databinding.PopupFilterGradeBinding; |
| 17 | 26 | import com.hjx.parent.databinding.PopupFilterSubjectBinding; |
| 18 | 27 | import com.hjx.parent.databinding.PopupFilterTermBinding; |
| 19 | 28 | import com.hjx.parent.dialog.MsgConfirmDialog; |
| 29 | +import com.hjx.parent.dialog.StageHuyouDialog; | |
| 30 | +import com.hjx.parent.function.Function1; | |
| 20 | 31 | import com.hjx.parent.rx.BaseRxActivity; |
| 32 | +import com.prws.common.bean.ResponseResult; | |
| 21 | 33 | import com.prws.common.bean.Student; |
| 22 | 34 | import com.prws.common.bean.homework.HomeworkList; |
| 35 | +import com.prws.common.bean.homework.StDetail; | |
| 23 | 36 | import com.prws.common.net.NetWorks; |
| 24 | 37 | import com.prws.common.utils.SharedPreferencesUtil; |
| 25 | 38 | import com.trello.rxlifecycle2.android.RxLifecycleAndroid; |
| 26 | 39 | |
| 40 | +import java.text.DecimalFormat; | |
| 41 | +import java.text.SimpleDateFormat; | |
| 42 | +import java.util.ArrayList; | |
| 43 | +import java.util.Calendar; | |
| 27 | 44 | import java.util.Collections; |
| 45 | +import java.util.Date; | |
| 46 | +import java.util.HashMap; | |
| 47 | +import java.util.List; | |
| 48 | +import java.util.Locale; | |
| 49 | +import java.util.Map; | |
| 28 | 50 | |
| 29 | 51 | import io.reactivex.Observable; |
| 30 | 52 | import io.reactivex.android.schedulers.AndroidSchedulers; |
| ... | ... | @@ -34,8 +56,14 @@ public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkB |
| 34 | 56 | |
| 35 | 57 | private final HomeworkListAdapter homeworkAdapter = new HomeworkListAdapter(); |
| 36 | 58 | |
| 59 | + private final List<StDetail> mWeekList = new ArrayList<>(); | |
| 60 | + private final List<StDetail> mStageList = new ArrayList<>(); | |
| 61 | + private final HuyouAdapter weekAdapter = new HuyouAdapter(mWeekList); | |
| 62 | + private final HuyouAdapter stageAdapter = new HuyouAdapter(mStageList); | |
| 63 | + | |
| 37 | 64 | PopupWindow subjectFilter, gradeFilter, termFilter, feedbackFilter; |
| 38 | 65 | MsgConfirmDialog deleteDialog; |
| 66 | + StageHuyouDialog stageHuyouDialog; | |
| 39 | 67 | State state = new State(); |
| 40 | 68 | |
| 41 | 69 | private void handlerIntent() { |
| ... | ... | @@ -55,7 +83,7 @@ public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkB |
| 55 | 83 | } |
| 56 | 84 | binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); |
| 57 | 85 | binding.tvTitle.setText(state.student.stuName + "的全部作业"); |
| 58 | - | |
| 86 | + setupTab(); | |
| 59 | 87 | binding.recyclerView.setAdapter(homeworkAdapter); |
| 60 | 88 | |
| 61 | 89 | binding.ftSubject.setOnClickListener(v -> showSubjectFilter()); |
| ... | ... | @@ -96,6 +124,15 @@ public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkB |
| 96 | 124 | intent.putExtra("needBack", true); |
| 97 | 125 | startActivityForResult(intent, 0xA01); |
| 98 | 126 | }); |
| 127 | + | |
| 128 | + binding.btnGeneralHuyou.setOnClickListener(v -> generalWeek()); | |
| 129 | + binding.btnStageHuyou.setOnClickListener(v -> { | |
| 130 | + if (stageHuyouDialog == null) stageHuyouDialog = new StageHuyouDialog(this); | |
| 131 | + stageHuyouDialog.show(this::generalStage); | |
| 132 | + }); | |
| 133 | + | |
| 134 | + getWeekHuyou(); | |
| 135 | + getStageHuyou(); | |
| 99 | 136 | } |
| 100 | 137 | |
| 101 | 138 | @Override |
| ... | ... | @@ -114,11 +151,43 @@ public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkB |
| 114 | 151 | state.student = new Gson().fromJson(json, Student.class); |
| 115 | 152 | binding.tvTitle.setText(state.student.stuName + "的全部作业"); |
| 116 | 153 | getHomework(); |
| 154 | + getWeekHuyou(); | |
| 155 | + getStageHuyou(); | |
| 117 | 156 | } |
| 118 | 157 | catch (Throwable t) { t.printStackTrace(); } |
| 119 | 158 | } |
| 120 | 159 | } |
| 121 | 160 | |
| 161 | + private void setupTab() { | |
| 162 | + binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每日作业")); | |
| 163 | + binding.tabLayout.addTab(binding.tabLayout.newTab().setText("每周总结")); | |
| 164 | + binding.tabLayout.addTab(binding.tabLayout.newTab().setText("阶段性总结")); | |
| 165 | + binding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { | |
| 166 | + @Override | |
| 167 | + public void onTabSelected(TabLayout.Tab tab) { | |
| 168 | + binding.filterBar.setVisibility(View.GONE); | |
| 169 | + binding.weekBar.setVisibility(View.GONE); | |
| 170 | + binding.stageBar.setVisibility(View.GONE); | |
| 171 | + if (tab.getPosition() == 0) { //每日 | |
| 172 | + binding.filterBar.setVisibility(View.VISIBLE); | |
| 173 | + binding.recyclerView.setAdapter(homeworkAdapter); | |
| 174 | + } else if (tab.getPosition() == 1) { //每周 | |
| 175 | + binding.weekBar.setVisibility(View.VISIBLE); | |
| 176 | + binding.recyclerView.setAdapter(weekAdapter); | |
| 177 | + } else if (tab.getPosition() == 2) { //阶段 | |
| 178 | + binding.stageBar.setVisibility(View.VISIBLE); | |
| 179 | + binding.recyclerView.setAdapter(stageAdapter); | |
| 180 | + } | |
| 181 | + } | |
| 182 | + @Override | |
| 183 | + public void onTabUnselected(TabLayout.Tab tab) { | |
| 184 | + } | |
| 185 | + @Override | |
| 186 | + public void onTabReselected(TabLayout.Tab tab) { | |
| 187 | + } | |
| 188 | + }); | |
| 189 | + } | |
| 190 | + | |
| 122 | 191 | @SuppressLint("CheckResult") |
| 123 | 192 | protected void deleteHomework(HomeworkList data) { |
| 124 | 193 | NetWorks.service_url.deleteHomework(NetWorks.getHeader(), data.getId()) |
| ... | ... | @@ -174,6 +243,101 @@ public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkB |
| 174 | 243 | }); |
| 175 | 244 | } |
| 176 | 245 | |
| 246 | + @SuppressLint({"CheckResult", "NotifyDataSetChanged"}) | |
| 247 | + private void getWeekHuyou() { | |
| 248 | + NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 0) | |
| 249 | + .compose(transformSingle()) | |
| 250 | + .map(ResponseResult::getData) | |
| 251 | + .subscribe((list, throwable) -> { | |
| 252 | + if (throwable != null) { | |
| 253 | + throwable.printStackTrace(); | |
| 254 | + return; | |
| 255 | + } | |
| 256 | + if (list != null) { | |
| 257 | + mWeekList.clear(); | |
| 258 | + mWeekList.addAll(list); | |
| 259 | + weekAdapter.notifyDataSetChanged(); | |
| 260 | + | |
| 261 | + boolean exist = false; | |
| 262 | + int thisWeek = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR); | |
| 263 | + for (StDetail bean: mWeekList) { | |
| 264 | + Calendar other = Calendar.getInstance(); | |
| 265 | + other.setTime(bean.endTime); | |
| 266 | + if (other.get(Calendar.WEEK_OF_YEAR) == thisWeek) { | |
| 267 | + exist = true; | |
| 268 | + break; | |
| 269 | + } | |
| 270 | + } | |
| 271 | + binding.btnGeneralHuyou.setVisibility(exist ? View.GONE : View.VISIBLE); | |
| 272 | + } | |
| 273 | + }); | |
| 274 | + } | |
| 275 | + | |
| 276 | + @SuppressLint({"CheckResult", "NotifyDataSetChanged"}) | |
| 277 | + private void getStageHuyou() { | |
| 278 | + NetWorks.service_url.getHuyouList(NetWorks.getHeader(), state.student.stuId, 1) | |
| 279 | + .compose(transformSingle()) | |
| 280 | + .map(ResponseResult::getData) | |
| 281 | + .subscribe((list, throwable) -> { | |
| 282 | + if (throwable != null) { | |
| 283 | + throwable.printStackTrace(); | |
| 284 | + return; | |
| 285 | + } | |
| 286 | + if (list != null) { | |
| 287 | + mStageList.clear(); | |
| 288 | + mStageList.addAll(list); | |
| 289 | + stageAdapter.notifyDataSetChanged(); | |
| 290 | + } | |
| 291 | + }); | |
| 292 | + } | |
| 293 | + | |
| 294 | + @SuppressLint("CheckResult") | |
| 295 | + private void generalWeek() { | |
| 296 | + showLoadingDialog("稍等..."); | |
| 297 | + NetWorks.service_url.generalHuyou() | |
| 298 | + .compose(transformSingle()) | |
| 299 | + .subscribe((response, throwable) -> { | |
| 300 | + cancelLoadingDialog(); | |
| 301 | + if (throwable != null) { | |
| 302 | + loadFail("失败"); | |
| 303 | + throwable.printStackTrace(); | |
| 304 | + return; | |
| 305 | + } | |
| 306 | + if (response != null && response.getSuccess()) { | |
| 307 | + binding.btnGeneralHuyou.setVisibility(View.GONE); | |
| 308 | + getWeekHuyou(); | |
| 309 | + } | |
| 310 | + }); | |
| 311 | + } | |
| 312 | + | |
| 313 | + @SuppressLint("CheckResult") | |
| 314 | + private void generalStage(Date startDate, Date endDate, String subject) { | |
| 315 | + SimpleDateFormat format = new SimpleDateFormat("yyy-MM-dd HH:mm:ss", Locale.CHINA); | |
| 316 | + Map<String, Object> body = new HashMap<>(); | |
| 317 | + body.put("stuId", state.student.stuId); | |
| 318 | + body.put("startTime", format.format(startDate)); | |
| 319 | + body.put("endTime", format.format(endDate)); | |
| 320 | + body.put("subject", subject); | |
| 321 | + showLoadingDialog("稍等..."); | |
| 322 | + NetWorks.service_url.generalStageHuyou(NetWorks.getHeader(), body) | |
| 323 | + .subscribeOn(Schedulers.io()) | |
| 324 | + .observeOn(AndroidSchedulers.mainThread()) | |
| 325 | + .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) | |
| 326 | + .subscribe((response, throwable) -> { | |
| 327 | + if (throwable != null) { | |
| 328 | + loadFail("失败"); | |
| 329 | + throwable.printStackTrace(); | |
| 330 | + return; | |
| 331 | + } | |
| 332 | + if (response.getSuccess()) { | |
| 333 | + getStageHuyou(); | |
| 334 | + cancelLoadingDialog(); | |
| 335 | + } else { | |
| 336 | + loadFail(response.getMsg()); | |
| 337 | + } | |
| 338 | + }); | |
| 339 | + } | |
| 340 | + | |
| 177 | 341 | private void showSubjectFilter() { |
| 178 | 342 | if (subjectFilter == null) { |
| 179 | 343 | PopupFilterSubjectBinding db = PopupFilterSubjectBinding.inflate(getLayoutInflater()); |
| ... | ... | @@ -255,4 +419,52 @@ public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkB |
| 255 | 419 | feedback.setValue(value); |
| 256 | 420 | } |
| 257 | 421 | } |
| 422 | + | |
| 423 | + static class HuyouAdapter extends BaseQuickAdapter<StDetail, BaseViewHolder> { | |
| 424 | + public Function1<StDetail> deleteCall; | |
| 425 | + public Student student; | |
| 426 | + | |
| 427 | + public HuyouAdapter(@Nullable List<StDetail> data) { | |
| 428 | + super(R.layout.item_homework_list, data); | |
| 429 | + } | |
| 430 | + | |
| 431 | + @SuppressLint("SetTextI18n,SimpleDateFormat") | |
| 432 | + @Override | |
| 433 | + protected void convert(@NonNull BaseViewHolder holder, StDetail data) { | |
| 434 | + holder.setGone(R.id.tvFlag, false); | |
| 435 | + int subjectImg; | |
| 436 | + switch (data.homeworkSubject) { | |
| 437 | + case "语文": | |
| 438 | + subjectImg = R.drawable.ic_chinese; | |
| 439 | + break; | |
| 440 | + case "英语": | |
| 441 | + subjectImg = R.drawable.ic_english; | |
| 442 | + break; | |
| 443 | + case "物理": | |
| 444 | + subjectImg = R.drawable.ic_physics; | |
| 445 | + break; | |
| 446 | + case "化学": | |
| 447 | + subjectImg = R.drawable.ic_chemistry; | |
| 448 | + break; | |
| 449 | + case "数学": | |
| 450 | + default: | |
| 451 | + subjectImg = R.drawable.ic_math; | |
| 452 | + } | |
| 453 | + holder.setImageResource(R.id.ivSubject, subjectImg); | |
| 454 | + Date endDate = new Date(data.endTime.getTime() - 1000); | |
| 455 | + String startStr = new SimpleDateFormat("yyyy.M.d").format(data.startTime); | |
| 456 | + String endStr = new SimpleDateFormat("-M.d").format(endDate); | |
| 457 | + String typeStr = data.type == 0 ? "作业周总结" : "作业阶段性总结"; | |
| 458 | + String title = startStr + endStr + data.homeworkSubject + typeStr; | |
| 459 | + holder.setText(R.id.tvName, title); | |
| 460 | + holder.setText(R.id.tvGrade, data.grade); | |
| 461 | + } | |
| 462 | + | |
| 463 | + private SimpleDateFormat getFormatWithGmt8(String pattern) { | |
| 464 | + SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.CHINA); | |
| 465 | + //format.setTimeZone(TimeZone.getTimeZone("GMT+16")); | |
| 466 | + return format; | |
| 467 | + } | |
| 468 | + } | |
| 469 | + | |
| 258 | 470 | } | ... | ... |
app/src/main/java/com/hjx/parent/dialog/StageHuyouDialog.java
| ... | ... | @@ -0,0 +1,96 @@ |
| 1 | +package com.hjx.parent.dialog; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.view.View; | |
| 5 | +import android.widget.RadioButton; | |
| 6 | +import android.widget.Toast; | |
| 7 | + | |
| 8 | +import androidx.annotation.NonNull; | |
| 9 | + | |
| 10 | +import com.bigkoo.pickerview.builder.TimePickerBuilder; | |
| 11 | +import com.bigkoo.pickerview.view.TimePickerView; | |
| 12 | +import com.hjx.parent.databinding.DialogStageHuyouBinding; | |
| 13 | +import com.hjx.parent.function.Function3; | |
| 14 | + | |
| 15 | +import java.text.SimpleDateFormat; | |
| 16 | +import java.util.Date; | |
| 17 | + | |
| 18 | +public class StageHuyouDialog extends BaseDialog<DialogStageHuyouBinding>{ | |
| 19 | + | |
| 20 | + Function3<Date, Date, String> callback; | |
| 21 | + Date startDate; | |
| 22 | + Date endDate; | |
| 23 | + | |
| 24 | + public StageHuyouDialog(Context context) { | |
| 25 | + super(context); | |
| 26 | + } | |
| 27 | + | |
| 28 | + @Override | |
| 29 | + public void initView() { | |
| 30 | + super.initView(); | |
| 31 | + RadioButton firstRb = (RadioButton) binding.rgSubject.getChildAt(0); | |
| 32 | + firstRb.setChecked(true); | |
| 33 | + binding.btnClose.setOnClickListener(v -> { | |
| 34 | + dismiss(); | |
| 35 | + }); | |
| 36 | + binding.tvStart.setOnClickListener(v -> { | |
| 37 | + TimePickerView pickerView = new TimePickerBuilder(getContext(), (date, p) -> { | |
| 38 | + long t = date.getTime(); | |
| 39 | + long day = 24 * 60 * 60 * 1000; | |
| 40 | + long h8 = 8 * 60 * 60 * 1000; | |
| 41 | + startDate = new Date(t / day * day - h8); | |
| 42 | + binding.tvStart.setText(new SimpleDateFormat("yyyy-MM-dd").format(startDate)); | |
| 43 | + }).setType(new boolean[] {true, true, true, false, false, false}).isDialog(true).build(); | |
| 44 | + pickerView.show(); | |
| 45 | + }); | |
| 46 | + binding.tvEnd.setOnClickListener(v -> { | |
| 47 | + TimePickerView pickerView = new TimePickerBuilder(getContext(), (date, p) -> { | |
| 48 | + long t = date.getTime(); | |
| 49 | + long day = 24 * 60 * 60 * 1000; | |
| 50 | + long h8 = 8 * 60 * 60 * 1000; | |
| 51 | + endDate = new Date(t / day * day - h8 + day - 1000); | |
| 52 | + binding.tvEnd.setText(new SimpleDateFormat("yyyy-MM-dd").format(endDate)); | |
| 53 | + }).setType(new boolean[] {true, true, true, false, false, false}).isDialog(true).build(); | |
| 54 | + pickerView.show(); | |
| 55 | + }); | |
| 56 | + binding.btnConfirm.setOnClickListener(v -> { | |
| 57 | + if (startDate == null) { | |
| 58 | + Toast.makeText(getContext(), "请先设置开始时间和截止时间。", Toast.LENGTH_SHORT).show(); | |
| 59 | + return; | |
| 60 | + } | |
| 61 | + if (endDate == null) { | |
| 62 | + Toast.makeText(getContext(), "请先设置开始时间和截止时间。", Toast.LENGTH_SHORT).show(); | |
| 63 | + return; | |
| 64 | + } | |
| 65 | + if (endDate.before(startDate)) { | |
| 66 | + Toast.makeText(getContext(), "结束时间不能早于开始时间", Toast.LENGTH_SHORT).show(); | |
| 67 | + return; | |
| 68 | + } | |
| 69 | + String subject = ""; | |
| 70 | + for (int i = 0; i < binding.rgSubject.getChildCount(); i++) { | |
| 71 | + View view = binding.rgSubject.getChildAt(i); | |
| 72 | + if (!(view instanceof RadioButton)) { | |
| 73 | + continue; | |
| 74 | + } | |
| 75 | + RadioButton rb = (RadioButton) view; | |
| 76 | + if (rb.isChecked()) { | |
| 77 | + subject = rb.getText().toString(); | |
| 78 | + break; | |
| 79 | + } | |
| 80 | + } | |
| 81 | + if (callback != null) callback.invoke(startDate, endDate, subject); | |
| 82 | + dismiss(); | |
| 83 | + }); | |
| 84 | + } | |
| 85 | + | |
| 86 | + public void show(Function3<Date, Date, String> callback) { | |
| 87 | + this.callback = callback; | |
| 88 | + super.show(); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @NonNull | |
| 92 | + @Override | |
| 93 | + public DialogStageHuyouBinding getBinding() { | |
| 94 | + return DialogStageHuyouBinding.inflate(getLayoutInflater()); | |
| 95 | + } | |
| 96 | +} | ... | ... |
app/src/main/res/color/color_huyou_subject_select.xml
app/src/main/res/drawable/bg_huyou_time_select.xml
app/src/main/res/drawable/btn_general_huyou.xml
| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + | |
| 4 | + <corners android:radius="12dp"/> | |
| 5 | + <stroke android:color="#1C90F3" android:width="1dp" android:dashWidth="6dp" android:dashGap="3dp"/> | |
| 6 | + | |
| 7 | +</shape> | |
| 0 | 8 | \ No newline at end of file | ... | ... |
app/src/main/res/drawable/btn_huyou_subject_select.xml
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + | |
| 4 | + <item android:state_checked="true"> | |
| 5 | + <shape> | |
| 6 | + <corners android:radius="88dp"/> | |
| 7 | + <solid android:color="#489AFA"/> | |
| 8 | + </shape> | |
| 9 | + </item> | |
| 10 | + | |
| 11 | + <item> | |
| 12 | + <shape> | |
| 13 | + <corners android:radius="88dp"/> | |
| 14 | + <solid android:color="#F5F5F5"/> | |
| 15 | + </shape> | |
| 16 | + </item> | |
| 17 | + | |
| 18 | +</selector> | |
| 0 | 19 | \ No newline at end of file | ... | ... |
app/src/main/res/drawable/svg_close_24.xml
| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | + android:width="24dp" | |
| 3 | + android:height="24dp" | |
| 4 | + android:viewportWidth="24" | |
| 5 | + android:viewportHeight="24"> | |
| 6 | + <path | |
| 7 | + android:pathData="M22.482,4.316L14.748,11.686L22.477,19.05C23.235,19.772 23.235,20.942 22.477,21.664L22.134,21.991C21.377,22.713 20.148,22.713 19.391,21.991L11.846,14.802L4.302,21.991C3.544,22.713 2.316,22.713 1.558,21.991L1.215,21.664C0.457,20.942 0.457,19.772 1.215,19.05L8.949,11.681L1.22,4.316C0.462,3.594 0.462,2.424 1.22,1.702L1.563,1.375C2.321,0.653 3.549,0.653 4.307,1.375L11.851,8.564L19.396,1.375C20.153,0.653 21.382,0.653 22.139,1.375L22.482,1.702C23.24,2.424 23.24,3.594 22.482,4.316Z" | |
| 8 | + android:fillColor="#333333" | |
| 9 | + android:fillType="evenOdd"/> | |
| 10 | +</vector> | ... | ... |
app/src/main/res/layout/activity_student_homework.xml
| ... | ... | @@ -32,7 +32,23 @@ |
| 32 | 32 | android:layout_width="20dp" |
| 33 | 33 | android:layout_height="20dp"/> |
| 34 | 34 | </androidx.appcompat.widget.Toolbar> |
| 35 | + <com.google.android.material.tabs.TabLayout | |
| 36 | + android:id="@+id/tabLayout" | |
| 37 | + app:tabMode="fixed" | |
| 38 | + app:tabGravity="fill" | |
| 39 | + app:tabTextColor="#333333" | |
| 40 | + app:tabSelectedTextColor="#1C90F3" | |
| 41 | + app:tabIndicatorColor="#1C90F3" | |
| 42 | + app:tabIndicatorHeight="2dp" | |
| 43 | + app:tabIndicatorFullWidth="false" | |
| 44 | + app:tabTextAppearance="@style/tab_homework" | |
| 45 | + app:tabRippleColor="@color/transparent" | |
| 46 | + android:background="@color/white" | |
| 47 | + android:layout_width="match_parent" | |
| 48 | + android:layout_height="45dp"/> | |
| 35 | 49 | <LinearLayout |
| 50 | + android:id="@+id/filterBar" | |
| 51 | + tools:visibility="gone" | |
| 36 | 52 | android:orientation="horizontal" |
| 37 | 53 | android:background="@color/white" |
| 38 | 54 | android:paddingHorizontal="15dp" |
| ... | ... | @@ -64,6 +80,48 @@ |
| 64 | 80 | android:layout_width="0dp" |
| 65 | 81 | android:layout_height="0dp"/> |
| 66 | 82 | |
| 83 | + <FrameLayout | |
| 84 | + android:id="@+id/weekBar" | |
| 85 | + android:visibility="gone" | |
| 86 | + android:layout_width="match_parent" | |
| 87 | + android:layout_height="wrap_content"> | |
| 88 | + <TextView | |
| 89 | + android:id="@+id/btnGeneralHuyou" | |
| 90 | + android:visibility="gone" | |
| 91 | + tools:visibility="visible" | |
| 92 | + android:text="生成本周作业总结" | |
| 93 | + android:textSize="13sp" | |
| 94 | + android:textColor="#1C90F3" | |
| 95 | + android:gravity="center" | |
| 96 | + android:textStyle="bold" | |
| 97 | + android:background="@drawable/btn_general_huyou" | |
| 98 | + android:layout_marginTop="16dp" | |
| 99 | + android:layout_marginHorizontal="30dp" | |
| 100 | + android:layout_width="match_parent" | |
| 101 | + android:layout_height="35dp" | |
| 102 | + tools:ignore="HardcodedText" /> | |
| 103 | + </FrameLayout> | |
| 104 | + | |
| 105 | + <FrameLayout | |
| 106 | + android:id="@+id/stageBar" | |
| 107 | + android:visibility="gone" | |
| 108 | + android:layout_width="match_parent" | |
| 109 | + android:layout_height="wrap_content"> | |
| 110 | + <TextView | |
| 111 | + android:id="@+id/btnStageHuyou" | |
| 112 | + android:text="生成阶段性作业总结" | |
| 113 | + android:textSize="13sp" | |
| 114 | + android:textColor="#1C90F3" | |
| 115 | + android:gravity="center" | |
| 116 | + android:textStyle="bold" | |
| 117 | + android:background="@drawable/btn_general_huyou" | |
| 118 | + android:layout_marginTop="16dp" | |
| 119 | + android:layout_marginHorizontal="30dp" | |
| 120 | + android:layout_width="match_parent" | |
| 121 | + android:layout_height="35dp" | |
| 122 | + tools:ignore="HardcodedText" /> | |
| 123 | + </FrameLayout> | |
| 124 | + | |
| 67 | 125 | <androidx.recyclerview.widget.RecyclerView |
| 68 | 126 | android:id="@+id/recyclerView" |
| 69 | 127 | android:background="#F8F8F8" | ... | ... |
app/src/main/res/layout/dialog_stage_huyou.xml
| ... | ... | @@ -0,0 +1,173 @@ |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<FrameLayout | |
| 3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
| 4 | + xmlns:tools="http://schemas.android.com/tools" | |
| 5 | + android:layout_width="match_parent" | |
| 6 | + android:layout_height="match_parent" | |
| 7 | + tools:ignore="UselessParent,HardcodedText,ContentDescription,SmallSp"> | |
| 8 | + | |
| 9 | + <LinearLayout | |
| 10 | + android:scaleX="0.72" | |
| 11 | + android:scaleY="0.72" | |
| 12 | + android:orientation="vertical" | |
| 13 | + android:paddingBottom="16dp" | |
| 14 | + android:background="@drawable/shape_radius_10" | |
| 15 | + android:backgroundTint="@color/white" | |
| 16 | + android:layout_gravity="center" | |
| 17 | + android:layout_width="416dp" | |
| 18 | + android:layout_height="wrap_content"> | |
| 19 | + <FrameLayout | |
| 20 | + android:paddingVertical="16dp" | |
| 21 | + android:layout_width="match_parent" | |
| 22 | + android:layout_height="wrap_content"> | |
| 23 | + <TextView | |
| 24 | + android:id="@+id/tvTitle" | |
| 25 | + android:text="设置阶段性总结" | |
| 26 | + android:textSize="20sp" | |
| 27 | + android:textColor="#333" | |
| 28 | + android:textStyle="bold" | |
| 29 | + android:layout_gravity="center" | |
| 30 | + android:layout_width="wrap_content" | |
| 31 | + android:layout_height="wrap_content"/> | |
| 32 | + <ImageView | |
| 33 | + android:id="@+id/btnClose" | |
| 34 | + android:src="@drawable/svg_close_24" | |
| 35 | + android:padding="8dp" | |
| 36 | + android:layout_marginEnd="8dp" | |
| 37 | + android:layout_gravity="end|center_vertical" | |
| 38 | + android:layout_width="32dp" | |
| 39 | + android:layout_height="32dp" /> | |
| 40 | + </FrameLayout> | |
| 41 | + | |
| 42 | + <TextView | |
| 43 | + android:text="选择时间:" | |
| 44 | + android:textSize="18sp" | |
| 45 | + android:textColor="#333" | |
| 46 | + android:textStyle="bold" | |
| 47 | + android:layout_marginHorizontal="16dp" | |
| 48 | + android:layout_marginTop="2dp" | |
| 49 | + android:layout_width="wrap_content" | |
| 50 | + android:layout_height="wrap_content"/> | |
| 51 | + | |
| 52 | + <LinearLayout | |
| 53 | + android:orientation="horizontal" | |
| 54 | + android:layout_marginHorizontal="16dp" | |
| 55 | + android:layout_marginTop="12dp" | |
| 56 | + android:layout_width="match_parent" | |
| 57 | + android:layout_height="wrap_content"> | |
| 58 | + <TextView | |
| 59 | + android:id="@+id/tvStart" | |
| 60 | + android:hint="开始时间" | |
| 61 | + android:textSize="18sp" | |
| 62 | + android:textColor="#333" | |
| 63 | + android:textColorHint="#999" | |
| 64 | + android:gravity="center_vertical" | |
| 65 | + android:paddingHorizontal="6dp" | |
| 66 | + android:background="@drawable/bg_huyou_time_select" | |
| 67 | + android:layout_weight="1" | |
| 68 | + android:layout_width="0dp" | |
| 69 | + android:layout_height="36dp"/> | |
| 70 | + <TextView | |
| 71 | + android:text="至" | |
| 72 | + android:textSize="18sp" | |
| 73 | + android:textColor="#333" | |
| 74 | + android:layout_marginHorizontal="8dp" | |
| 75 | + android:layout_width="wrap_content" | |
| 76 | + android:layout_height="wrap_content"/> | |
| 77 | + <TextView | |
| 78 | + android:id="@+id/tvEnd" | |
| 79 | + android:hint="截至时间" | |
| 80 | + android:textSize="18sp" | |
| 81 | + android:textColor="#333" | |
| 82 | + android:textColorHint="#999" | |
| 83 | + android:gravity="center_vertical" | |
| 84 | + android:paddingHorizontal="6dp" | |
| 85 | + android:background="@drawable/bg_huyou_time_select" | |
| 86 | + android:layout_weight="1" | |
| 87 | + android:layout_width="0dp" | |
| 88 | + android:layout_height="36dp"/> | |
| 89 | + </LinearLayout> | |
| 90 | + | |
| 91 | + <TextView | |
| 92 | + android:text="选择科目:" | |
| 93 | + android:textSize="18sp" | |
| 94 | + android:textColor="#333" | |
| 95 | + android:textStyle="bold" | |
| 96 | + android:layout_marginHorizontal="16dp" | |
| 97 | + android:layout_marginTop="24dp" | |
| 98 | + android:layout_width="wrap_content" | |
| 99 | + android:layout_height="wrap_content"/> | |
| 100 | + <RadioGroup | |
| 101 | + android:id="@+id/rgSubject" | |
| 102 | + android:orientation="horizontal" | |
| 103 | + android:layout_marginHorizontal="16dp" | |
| 104 | + android:layout_marginTop="12dp" | |
| 105 | + android:layout_width="match_parent" | |
| 106 | + android:layout_height="wrap_content"> | |
| 107 | + <RadioButton | |
| 108 | + android:text="数学" | |
| 109 | + android:button="@null" | |
| 110 | + android:textSize="14sp" | |
| 111 | + android:gravity="center" | |
| 112 | + android:textColor="@color/color_huyou_subject_select" | |
| 113 | + android:background="@drawable/btn_huyou_subject_select" | |
| 114 | + android:layout_width="64dp" | |
| 115 | + android:layout_height="32dp"/> | |
| 116 | + <Space style="@style/empty_space"/> | |
| 117 | + <RadioButton | |
| 118 | + android:text="语文" | |
| 119 | + android:button="@null" | |
| 120 | + android:textSize="14sp" | |
| 121 | + android:gravity="center" | |
| 122 | + android:textColor="@color/color_huyou_subject_select" | |
| 123 | + android:background="@drawable/btn_huyou_subject_select" | |
| 124 | + android:layout_width="64dp" | |
| 125 | + android:layout_height="32dp"/> | |
| 126 | + <Space style="@style/empty_space"/> | |
| 127 | + <RadioButton | |
| 128 | + android:text="英语" | |
| 129 | + android:button="@null" | |
| 130 | + android:textSize="14sp" | |
| 131 | + android:gravity="center" | |
| 132 | + android:textColor="@color/color_huyou_subject_select" | |
| 133 | + android:background="@drawable/btn_huyou_subject_select" | |
| 134 | + android:layout_width="64dp" | |
| 135 | + android:layout_height="32dp"/> | |
| 136 | + <Space style="@style/empty_space"/> | |
| 137 | + <RadioButton | |
| 138 | + android:text="物理" | |
| 139 | + android:button="@null" | |
| 140 | + android:textSize="14sp" | |
| 141 | + android:gravity="center" | |
| 142 | + android:textColor="@color/color_huyou_subject_select" | |
| 143 | + android:background="@drawable/btn_huyou_subject_select" | |
| 144 | + android:layout_width="64dp" | |
| 145 | + android:layout_height="32dp"/> | |
| 146 | + <Space style="@style/empty_space"/> | |
| 147 | + <RadioButton | |
| 148 | + android:text="化学" | |
| 149 | + android:button="@null" | |
| 150 | + android:textSize="14sp" | |
| 151 | + android:gravity="center" | |
| 152 | + android:textColor="@color/color_huyou_subject_select" | |
| 153 | + android:background="@drawable/btn_huyou_subject_select" | |
| 154 | + android:layout_width="64dp" | |
| 155 | + android:layout_height="32dp"/> | |
| 156 | + </RadioGroup> | |
| 157 | + | |
| 158 | + <TextView | |
| 159 | + android:id="@+id/btnConfirm" | |
| 160 | + android:text="确认生成" | |
| 161 | + android:textSize="18sp" | |
| 162 | + android:textColor="@color/white" | |
| 163 | + android:gravity="center" | |
| 164 | + android:background="@drawable/shape_circle" | |
| 165 | + android:backgroundTint="#489AFA" | |
| 166 | + android:layout_gravity="center_horizontal" | |
| 167 | + android:layout_marginTop="24dp" | |
| 168 | + android:layout_width="120dp" | |
| 169 | + android:layout_height="40dp"/> | |
| 170 | + | |
| 171 | + </LinearLayout> | |
| 172 | + | |
| 173 | +</FrameLayout> | |
| 0 | 174 | \ No newline at end of file | ... | ... |
app/src/main/res/values/appearance.xml
libs/common/src/main/java/com/prws/common/bean/homework/StDetail.java
| ... | ... | @@ -0,0 +1,70 @@ |
| 1 | +package com.prws.common.bean.homework; | |
| 2 | + | |
| 3 | +import com.google.gson.Gson; | |
| 4 | +import com.google.gson.GsonBuilder; | |
| 5 | +import com.google.gson.reflect.TypeToken; | |
| 6 | + | |
| 7 | +import java.util.ArrayList; | |
| 8 | +import java.util.Date; | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +public class StDetail { | |
| 12 | + | |
| 13 | + public String id; | |
| 14 | + | |
| 15 | + public String stuId; | |
| 16 | + public Date startTime; | |
| 17 | + public Date endTime; | |
| 18 | + public String homeworkSubject; | |
| 19 | + public String scId; | |
| 20 | + public String grade; | |
| 21 | + | |
| 22 | + public int total; | |
| 23 | + public int correct; | |
| 24 | + | |
| 25 | + public float mondayCorrection; | |
| 26 | + public float tuesdayCorrection; | |
| 27 | + public float wednesdayCorrection; | |
| 28 | + public float thursdayCorrection; | |
| 29 | + public float fridayCorrection; | |
| 30 | + | |
| 31 | + public String correction; | |
| 32 | + public transient List<Correction> correctionList; | |
| 33 | + | |
| 34 | + public List<Point> points; | |
| 35 | + | |
| 36 | + public int type; | |
| 37 | + | |
| 38 | + public void formatCollection() { | |
| 39 | + correctionList = new ArrayList<>(); | |
| 40 | + if (correction == null) { | |
| 41 | + return; | |
| 42 | + } | |
| 43 | + Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create(); | |
| 44 | + try { | |
| 45 | + List<Correction> list = gson.fromJson(correction, new TypeToken<List<Correction>>(){}.getType()); | |
| 46 | + for (Correction item: list) { | |
| 47 | + if (item != null && item.date != null) { | |
| 48 | + correctionList.add(item); | |
| 49 | + } | |
| 50 | + } | |
| 51 | + } catch (Exception e){ | |
| 52 | + e.printStackTrace(); | |
| 53 | + } | |
| 54 | + } | |
| 55 | + | |
| 56 | + public static class Point { | |
| 57 | + public String pointId; | |
| 58 | + public String pointName; | |
| 59 | + public float beforeState; | |
| 60 | + public float afterState; | |
| 61 | + public float gap; | |
| 62 | + public float correctness; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public static class Correction { | |
| 66 | + public float correction; | |
| 67 | + public Date date; | |
| 68 | + } | |
| 69 | + | |
| 70 | +} | ... | ... |
libs/common/src/main/java/com/prws/common/net/NetWorks.java
| ... | ... | @@ -17,6 +17,7 @@ import com.prws.common.bean.baidu.BaiduInput; |
| 17 | 17 | import com.prws.common.bean.homework.HomeWork; |
| 18 | 18 | import com.prws.common.bean.homework.HomeworkDetail; |
| 19 | 19 | import com.prws.common.bean.homework.HomeworkList; |
| 20 | +import com.prws.common.bean.homework.StDetail; | |
| 20 | 21 | import com.prws.common.utils.BitmapUtils; |
| 21 | 22 | import com.prws.common.utils.SharedPreferencesUtil; |
| 22 | 23 | |
| ... | ... | @@ -221,6 +222,34 @@ public class NetWorks extends RetrofitUtils { |
| 221 | 222 | @Query("type") boolean type |
| 222 | 223 | ); |
| 223 | 224 | |
| 225 | + @GET("api/v1/homework/listHomeworkStatistics") | |
| 226 | + Single<ResponseResult<List<StDetail>>> getHuyouList( | |
| 227 | + @Header("Authorization") String token, | |
| 228 | + @Query("stuId") String stuId, | |
| 229 | + @Query("type") int type //0: 周报, 1:阶段总结 | |
| 230 | + ); | |
| 231 | + | |
| 232 | + @GET("api/v1/homework/listHomeworkStatisticsDetailForStudent") | |
| 233 | + Single<ResponseResult<StDetail>> getHuyouDetail( | |
| 234 | + @Header("Authorization") String token, | |
| 235 | + @Query("homeworkStatisticsId") String homeworkId | |
| 236 | + ); | |
| 237 | + | |
| 238 | + @GET("api/v1/demo/generalStatisticsHomework") | |
| 239 | + Single<ResponseResult<Object>> generalHuyou(); | |
| 240 | + | |
| 241 | + @POST("api/v1/homework/generalHomeworkStageStatistics") | |
| 242 | + Single<ResponseResult<Boolean>> generalStageHuyou( | |
| 243 | + @Header("Authorization") String token, | |
| 244 | + @Body Object body | |
| 245 | + ); | |
| 246 | + | |
| 247 | + @GET("api/v1/homework/removeHomeworkStatistics") | |
| 248 | + Single<ResponseResult<Boolean>> deleteHuyou( | |
| 249 | + @Header("Authorization") String token, | |
| 250 | + @Query("homeworkStatisticsId") String homeworkId | |
| 251 | + ); | |
| 252 | + | |
| 224 | 253 | } |
| 225 | 254 | |
| 226 | 255 | public static String getUserId() { | ... | ... |