Commit 1863fd36a12853cb392ea6dbffc1ede9f4fa31f9
1 parent
d34cc18f6a
Exists in
master
作业列表布局修改
Showing
6 changed files
with
194 additions
and
1 deletions
Show diff stats
app/src/main/java/com/hjx/parent/StuHomeworkActivity.java
| ... | ... | @@ -9,6 +9,7 @@ import androidx.lifecycle.MutableLiveData; |
| 9 | 9 | |
| 10 | 10 | import com.google.gson.Gson; |
| 11 | 11 | import com.hjx.parent.adapter.HomeworkAdapter; |
| 12 | +import com.hjx.parent.adapter.HomeworkListAdapter; | |
| 12 | 13 | import com.hjx.parent.databinding.ActivityStudentHomeworkBinding; |
| 13 | 14 | import com.hjx.parent.databinding.PopupFilterFeedbackBinding; |
| 14 | 15 | import com.hjx.parent.databinding.PopupFilterGradeBinding; |
| ... | ... | @@ -28,7 +29,7 @@ import io.reactivex.schedulers.Schedulers; |
| 28 | 29 | |
| 29 | 30 | public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkBinding> { |
| 30 | 31 | |
| 31 | - private final HomeworkAdapter homeworkAdapter = new HomeworkAdapter(); | |
| 32 | + private final HomeworkListAdapter homeworkAdapter = new HomeworkListAdapter(); | |
| 32 | 33 | |
| 33 | 34 | PopupWindow subjectFilter, gradeFilter, termFilter, feedbackFilter; |
| 34 | 35 | State state = new State(); | ... | ... |
app/src/main/java/com/hjx/parent/adapter/HomeworkListAdapter.java
| ... | ... | @@ -0,0 +1,55 @@ |
| 1 | +package com.hjx.parent.adapter; | |
| 2 | + | |
| 3 | +import android.view.View; | |
| 4 | +import android.widget.TextView; | |
| 5 | + | |
| 6 | +import androidx.annotation.NonNull; | |
| 7 | + | |
| 8 | +import com.chad.library.adapter.base.BaseQuickAdapter; | |
| 9 | +import com.chad.library.adapter.base.BaseViewHolder; | |
| 10 | +import com.hjx.parent.R; | |
| 11 | +import com.prws.common.bean.homework.HomeworkList; | |
| 12 | + | |
| 13 | +public class HomeworkListAdapter extends BaseQuickAdapter<HomeworkList, BaseViewHolder> { | |
| 14 | + | |
| 15 | + public HomeworkListAdapter() { | |
| 16 | + super(R.layout.item_homework_list); | |
| 17 | + } | |
| 18 | + | |
| 19 | + @Override | |
| 20 | + protected void convert(@NonNull BaseViewHolder helper, HomeworkList homework) { | |
| 21 | + helper.setGone(R.id.tvFlag, homework.getRight() != null); | |
| 22 | + helper.setText(R.id.tvName, homework.getName()); | |
| 23 | + helper.setText(R.id.tvGrade, homework.getGrade() + "-" + homework.getTerm()); | |
| 24 | + int subjectImg; | |
| 25 | + switch (homework.getSubject()) { | |
| 26 | + case "语文": | |
| 27 | + subjectImg = R.drawable.ic_chinese; | |
| 28 | + break; | |
| 29 | + case "英语": | |
| 30 | + subjectImg = R.drawable.ic_english; | |
| 31 | + break; | |
| 32 | + case "物理": | |
| 33 | + subjectImg = R.drawable.ic_physics; | |
| 34 | + break; | |
| 35 | + case "化学": | |
| 36 | + subjectImg = R.drawable.ic_chemistry; | |
| 37 | + break; | |
| 38 | + case "数学": | |
| 39 | + default: | |
| 40 | + subjectImg = R.drawable.ic_math; | |
| 41 | + } | |
| 42 | + helper.setImageResource(R.id.ivSubject, subjectImg); | |
| 43 | + | |
| 44 | + TextView tvDate = helper.getView(R.id.tvDate); | |
| 45 | + int index = getData().indexOf(homework); | |
| 46 | + if (index == 0) { | |
| 47 | + tvDate.setVisibility(View.VISIBLE); | |
| 48 | + } else if (!homework.getFormatTime().equals(getData().get(index - 1).getFormatTime())) { | |
| 49 | + tvDate.setVisibility(View.VISIBLE); | |
| 50 | + } else { | |
| 51 | + tvDate.setVisibility(View.GONE); | |
| 52 | + } | |
| 53 | + tvDate.setText(homework.getFormatTime()); | |
| 54 | + } | |
| 55 | +} | ... | ... |
app/src/main/res/drawable/bg_homework_feedback_flag.xml
| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + <corners android:topRightRadius="10dp" android:bottomLeftRadius="10dp"/> | |
| 4 | + <solid android:color="#1C90F3"/> | |
| 5 | +</shape> | |
| 0 | 6 | \ No newline at end of file | ... | ... |
app/src/main/res/drawable/svg_delete.xml
| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | + android:width="15dp" | |
| 3 | + android:height="15dp" | |
| 4 | + android:viewportWidth="1024" | |
| 5 | + android:viewportHeight="1024"> | |
| 6 | + <path | |
| 7 | + android:pathData="M693.5,231.7c33.9,4.8 69.3,-1.4 97,3.3 44.9,7.6 67.6,45.8 62.7,102 -18.1,0 -36.2,0 -54.3,0 -1.5,99.7 -0.8,198.4 -0.8,298.4 0,50.5 4.2,103.5 -0.8,148.8 -4.8,42.8 -36.1,68.8 -74.4,75.2 -37.8,6.3 -87.9,1.7 -129.6,1.7 -87.4,0 -176,1.7 -261.6,0 -41.7,-0.8 -72.5,-14.1 -91.1,-39.3 -18.7,-25.2 -16.7,-63.4 -16.7,-108.7 0,-126.1 0,-251.2 0,-376.2 -17.3,0 -34.6,0 -51.8,0 -8.4,-51.7 14,-88.8 51.8,-101.1 27.8,-9 64.9,-1.7 104.5,-4.2 -3.2,-55.6 -0.2,-97.9 47.6,-103.7 21.4,-2.6 49.9,0 76.1,0 47.1,0 101.7,0 152.1,0 29,0 58.7,-2.8 73.6,10C698.2,155.9 692.8,196.8 693.5,231.7zM380.1,183.3c0,16.7 0,33.4 0,50.2 87.2,0 174.4,0 261.6,0 0,-17.6 0,-35.1 0,-52.7 -86.9,0 -173.9,0 -260.8,0C379.9,180.9 380,182.1 380.1,183.3zM329.1,342.9c0,105.8 0,211.1 0,318.5 0,27.2 -6.3,85.2 10,97 6.5,4.7 23.2,5.4 30.9,0 16.8,-11.7 10.9,-68 10.9,-96.1 0,-108.7 0,-218.9 0,-321.8 -17,0 -34,0 -51,0C328.9,340.6 329,341.7 329.1,342.9zM484.5,342.9c0,95.2 0,206.4 0,308.4 0,24.3 -5.7,81.9 4.2,98.6 6.5,11 28.4,16 39.3,7.5 14.8,-11.5 8.4,-72.5 8.4,-97.8 0,-109 0,-213.6 0,-319.3 -17,0 -34,0 -51,0C484.4,340.6 484.5,341.7 484.5,342.9zM641.7,342.9c0,102.5 0,216.6 0,322.7 0,33 -6.4,83.7 15,92.8 9.4,3.9 26,0.9 30.1,-2.5 14,-11.5 7.5,-73.5 7.5,-97.8 0,-108.4 0,-212.4 0,-317.6 -17.3,0 -34.6,0 -51.8,0C641.6,340.6 641.6,341.7 641.7,342.9z" | |
| 8 | + android:fillColor="#272636"/> | |
| 9 | +</vector> | ... | ... |
app/src/main/res/drawable/svg_go_detail.xml
| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | + android:width="10dp" | |
| 3 | + android:height="10dp" | |
| 4 | + android:viewportWidth="20" | |
| 5 | + android:viewportHeight="20"> | |
| 6 | + <path | |
| 7 | + android:pathData="M10,0C15.523,0 20,4.477 20,10C20,15.523 15.523,20 10,20C4.477,20 0,15.523 0,10C0,4.477 4.477,0 10,0Z" | |
| 8 | + android:fillColor="#C5C5C5" | |
| 9 | + android:fillType="evenOdd"/> | |
| 10 | + <path | |
| 11 | + android:pathData="M7.156,3.832C7.625,3.363 8.387,3.363 8.856,3.832L13.572,8.607C13.596,8.627 13.627,8.635 13.649,8.658C13.888,8.896 14.003,9.21 13.999,9.522C14.003,9.834 13.888,10.148 13.649,10.386C13.627,10.409 13.596,10.417 13.572,10.437L8.896,15.172C8.426,15.641 7.665,15.641 7.195,15.172C6.726,14.702 6.726,13.941 7.195,13.471L11.095,9.522L7.156,5.533C6.686,5.064 6.686,4.302 7.156,3.832Z" | |
| 12 | + android:fillColor="#FFFFFF" | |
| 13 | + android:fillType="evenOdd"/> | |
| 14 | +</vector> | ... | ... |
app/src/main/res/layout/item_homework_list.xml
| ... | ... | @@ -0,0 +1,109 @@ |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<LinearLayout | |
| 3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
| 4 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
| 5 | + xmlns:tools="http://schemas.android.com/tools" | |
| 6 | + android:orientation="vertical" | |
| 7 | + android:paddingHorizontal="10dp" | |
| 8 | + android:layout_marginVertical="8dp" | |
| 9 | + android:layout_width="match_parent" | |
| 10 | + android:layout_height="wrap_content" | |
| 11 | + tools:ignore="SmallSp,HardcodedText"> | |
| 12 | + | |
| 13 | + <TextView | |
| 14 | + android:id="@+id/tvDate" | |
| 15 | + android:visibility="gone" | |
| 16 | + tools:visibility="visible" | |
| 17 | + tools:text="2024-09-25" | |
| 18 | + android:textSize="12sp" | |
| 19 | + android:textColor="#999" | |
| 20 | + android:layout_marginBottom="15dp" | |
| 21 | + android:layout_width="wrap_content" | |
| 22 | + android:layout_height="wrap_content"/> | |
| 23 | + | |
| 24 | + <FrameLayout | |
| 25 | + android:background="@drawable/shape_radius_10" | |
| 26 | + android:backgroundTint="@color/white" | |
| 27 | + android:layout_width="match_parent" | |
| 28 | + android:layout_height="75dp"> | |
| 29 | + <LinearLayout | |
| 30 | + android:orientation="horizontal" | |
| 31 | + android:gravity="center_vertical" | |
| 32 | + android:layout_width="match_parent" | |
| 33 | + android:layout_height="match_parent"> | |
| 34 | + <ImageView | |
| 35 | + android:id="@+id/ivSubject" | |
| 36 | + tools:src="@drawable/ic_math" | |
| 37 | + android:layout_marginStart="10dp" | |
| 38 | + android:layout_width="44dp" | |
| 39 | + android:layout_height="56dp" | |
| 40 | + android:importantForAccessibility="no" /> | |
| 41 | + <LinearLayout | |
| 42 | + android:orientation="vertical" | |
| 43 | + android:layout_marginStart="14dp" | |
| 44 | + android:layout_marginEnd="10dp" | |
| 45 | + android:layout_marginVertical="16dp" | |
| 46 | + android:layout_width="match_parent" | |
| 47 | + android:layout_height="match_parent"> | |
| 48 | + <TextView | |
| 49 | + android:id="@+id/tvName" | |
| 50 | + tools:text="作业名称" | |
| 51 | + android:textSize="13sp" | |
| 52 | + android:textColor="#333" | |
| 53 | + android:layout_width="wrap_content" | |
| 54 | + android:layout_height="wrap_content"/> | |
| 55 | + <Space style="@style/empty_space"/> | |
| 56 | + <LinearLayout | |
| 57 | + android:orientation="horizontal" | |
| 58 | + android:gravity="center_vertical" | |
| 59 | + android:layout_width="match_parent" | |
| 60 | + android:layout_height="wrap_content"> | |
| 61 | + <TextView | |
| 62 | + android:id="@+id/tvGrade" | |
| 63 | + tools:text="七年级-上学期" | |
| 64 | + android:textSize="10sp" | |
| 65 | + android:textColor="#666" | |
| 66 | + android:layout_width="wrap_content" | |
| 67 | + android:layout_height="wrap_content" /> | |
| 68 | + <Space style="@style/empty_space"/> | |
| 69 | + <androidx.appcompat.widget.AppCompatTextView | |
| 70 | + android:text="删除" | |
| 71 | + android:textSize="10sp" | |
| 72 | + android:textColor="#666" | |
| 73 | + android:gravity="center_vertical" | |
| 74 | + android:drawableStart="@drawable/svg_delete" | |
| 75 | + android:drawableTint="#C5C5C5" | |
| 76 | + android:drawablePadding="2dp" | |
| 77 | + android:layout_width="wrap_content" | |
| 78 | + android:layout_height="wrap_content"/> | |
| 79 | + <View | |
| 80 | + android:background="#F5F5F5" | |
| 81 | + android:layout_marginHorizontal="15dp" | |
| 82 | + android:layout_width="1dp" | |
| 83 | + android:layout_height="10dp"/> | |
| 84 | + <androidx.appcompat.widget.AppCompatTextView | |
| 85 | + android:text="详情" | |
| 86 | + android:textSize="10sp" | |
| 87 | + android:textColor="#666" | |
| 88 | + android:gravity="center_vertical" | |
| 89 | + android:drawableStart="@drawable/svg_go_detail" | |
| 90 | + android:drawablePadding="5dp" | |
| 91 | + android:layout_width="wrap_content" | |
| 92 | + android:layout_height="wrap_content"/> | |
| 93 | + </LinearLayout> | |
| 94 | + </LinearLayout> | |
| 95 | + </LinearLayout> | |
| 96 | + <TextView | |
| 97 | + android:id="@+id/tvFlag" | |
| 98 | + android:text="已反馈" | |
| 99 | + android:textSize="9sp" | |
| 100 | + android:textColor="@color/white" | |
| 101 | + android:background="@drawable/bg_homework_feedback_flag" | |
| 102 | + android:layout_gravity="end" | |
| 103 | + android:paddingHorizontal="7dp" | |
| 104 | + android:paddingVertical="2dp" | |
| 105 | + android:layout_width="wrap_content" | |
| 106 | + android:layout_height="wrap_content" /> | |
| 107 | + </FrameLayout> | |
| 108 | + | |
| 109 | +</LinearLayout> | |
| 0 | 110 | \ No newline at end of file | ... | ... |