Commit d34cc18f6a8cca56b51a2627648451176f55548a
1 parent
7d8ce5d272
Exists in
master
作业列表与筛选
Showing
18 changed files
with
640 additions
and
7 deletions
Show diff stats
app/build.gradle
app/src/main/AndroidManifest.xml
... | ... | @@ -38,7 +38,7 @@ |
38 | 38 | android:label="@string/app_name" |
39 | 39 | android:networkSecurityConfig="@xml/network_security_config" |
40 | 40 | android:supportsRtl="true" |
41 | - android:theme="@style/Theme.Parent"> | |
41 | + android:theme="@style/Theme.AppCompat.Light.NoActionBar"> | |
42 | 42 | <activity |
43 | 43 | android:name=".LoginActivity" |
44 | 44 | android:exported="true" |
... | ... | @@ -151,6 +151,7 @@ |
151 | 151 | android:name=".TeacherMainActivity" |
152 | 152 | android:screenOrientation="portrait" |
153 | 153 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
154 | + <activity android:name=".StuHomeworkActivity" /> | |
154 | 155 | |
155 | 156 | <provider |
156 | 157 | android:name="androidx.core.content.FileProvider" | ... | ... |
app/src/main/java/com/hjx/parent/AddSuccessActivity.java
... | ... | @@ -34,12 +34,12 @@ public class AddSuccessActivity extends BaseActivity<ActivityAddSuccessBinding> |
34 | 34 | private String filePath; |
35 | 35 | |
36 | 36 | private int type; |
37 | - private String stuId; | |
37 | + private String studentJson; | |
38 | 38 | |
39 | 39 | @Override |
40 | 40 | public void initView(Bundle savedInstanceState) { |
41 | 41 | type = getIntent().getIntExtra("type", 0); |
42 | - stuId = getIntent().getStringExtra("stuId"); | |
42 | + studentJson = getIntent().getStringExtra("studentJson"); | |
43 | 43 | if (type == 1) { |
44 | 44 | binding.tvMsg.setText("作业录入成功!"); |
45 | 45 | binding.tvAdd.setText("继续录入作业"); |
... | ... | @@ -108,7 +108,9 @@ public class AddSuccessActivity extends BaseActivity<ActivityAddSuccessBinding> |
108 | 108 | if (type == 0) { |
109 | 109 | startActivity(new Intent(context, ErrorListActivity.class)); |
110 | 110 | } else { |
111 | - // TODO | |
111 | + Intent intent = new Intent(context, StuHomeworkActivity.class); | |
112 | + intent.putExtra("studentJson", studentJson); | |
113 | + startActivity(intent); | |
112 | 114 | } |
113 | 115 | } |
114 | 116 | }); | ... | ... |
app/src/main/java/com/hjx/parent/ImageActivity.java
... | ... | @@ -357,7 +357,7 @@ public class ImageActivity extends BaseRxActivity<ActivityImageBinding> implemen |
357 | 357 | addHomeworkDialog.show(paths, student -> { |
358 | 358 | Intent intent = new Intent(context, AddSuccessActivity.class); |
359 | 359 | intent.putExtra("type", type); |
360 | - intent.putExtra("stuId", student.stuId); | |
360 | + intent.putExtra("studentJson", new Gson().toJson(student)); | |
361 | 361 | startActivity(intent); |
362 | 362 | finish(); |
363 | 363 | }); | ... | ... |
app/src/main/java/com/hjx/parent/StuHomeworkActivity.java
... | ... | @@ -0,0 +1,183 @@ |
1 | +package com.hjx.parent; | |
2 | + | |
3 | +import android.annotation.SuppressLint; | |
4 | +import android.os.Bundle; | |
5 | +import android.widget.LinearLayout; | |
6 | +import android.widget.PopupWindow; | |
7 | + | |
8 | +import androidx.lifecycle.MutableLiveData; | |
9 | + | |
10 | +import com.google.gson.Gson; | |
11 | +import com.hjx.parent.adapter.HomeworkAdapter; | |
12 | +import com.hjx.parent.databinding.ActivityStudentHomeworkBinding; | |
13 | +import com.hjx.parent.databinding.PopupFilterFeedbackBinding; | |
14 | +import com.hjx.parent.databinding.PopupFilterGradeBinding; | |
15 | +import com.hjx.parent.databinding.PopupFilterSubjectBinding; | |
16 | +import com.hjx.parent.databinding.PopupFilterTermBinding; | |
17 | +import com.hjx.parent.rx.BaseRxActivity; | |
18 | +import com.prws.common.bean.Student; | |
19 | +import com.prws.common.net.NetWorks; | |
20 | +import com.prws.common.utils.SharedPreferencesUtil; | |
21 | +import com.trello.rxlifecycle2.android.RxLifecycleAndroid; | |
22 | + | |
23 | +import java.util.Collections; | |
24 | + | |
25 | +import io.reactivex.Observable; | |
26 | +import io.reactivex.android.schedulers.AndroidSchedulers; | |
27 | +import io.reactivex.schedulers.Schedulers; | |
28 | + | |
29 | +public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkBinding> { | |
30 | + | |
31 | + private final HomeworkAdapter homeworkAdapter = new HomeworkAdapter(); | |
32 | + | |
33 | + PopupWindow subjectFilter, gradeFilter, termFilter, feedbackFilter; | |
34 | + State state = new State(); | |
35 | + | |
36 | + private void handlerIntent() { | |
37 | + String json = getIntent().getStringExtra("studentJson"); | |
38 | + if (json == null) json = (String) SharedPreferencesUtil.getData("student", ""); | |
39 | + try { state.student = new Gson().fromJson(json, Student.class); } | |
40 | + catch (Throwable t) { t.printStackTrace(); } | |
41 | + } | |
42 | + | |
43 | + @SuppressLint("SetTextI18n") | |
44 | + @Override | |
45 | + public void initView(Bundle savedInstanceState) { | |
46 | + handlerIntent(); | |
47 | + if (state.student == null) { | |
48 | + finish(); | |
49 | + return; | |
50 | + } | |
51 | + binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); | |
52 | + binding.tvTitle.setText(state.student.stuName + "的全部作业"); | |
53 | + | |
54 | + binding.recyclerView.setAdapter(homeworkAdapter); | |
55 | + getHomework(); | |
56 | + | |
57 | + binding.ftSubject.setOnClickListener(v -> showSubjectFilter()); | |
58 | + binding.ftGrade.setOnClickListener(v -> showGradeFilter()); | |
59 | + binding.ftTerm.setOnClickListener(v -> showTermFilter()); | |
60 | + binding.ftFeedback.setOnClickListener(v -> showFeedbackFilter()); | |
61 | + } | |
62 | + | |
63 | + | |
64 | + @SuppressLint("CheckResult") | |
65 | + protected void getHomework() { | |
66 | + NetWorks.service_url.getStudentHomework(NetWorks.getHeader(), state.student.stuId) | |
67 | + .subscribeOn(Schedulers.io()) | |
68 | + .observeOn(AndroidSchedulers.mainThread()) | |
69 | + .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) | |
70 | + .toObservable() | |
71 | + .flatMap(response -> Observable.fromIterable(response.getData())) | |
72 | + // 过滤 | |
73 | + .filter(data -> { // 学科 | |
74 | + String subject = state.subject.getValue(); | |
75 | + if (subject == null || subject.isEmpty()) return true; | |
76 | + else return subject.equals(data.getSubject()); | |
77 | + }) | |
78 | + .filter(data -> { // 年级 | |
79 | + String grade = state.grade.getValue(); | |
80 | + if (grade == null || grade.isEmpty()) return true; | |
81 | + else return grade.equals(data.getGrade()); | |
82 | + }) | |
83 | + .filter(data -> { // 学期 | |
84 | + String term = state.term.getValue(); | |
85 | + if (term == null || term.isEmpty()) return true; | |
86 | + else return term.equals(data.getTerm()); | |
87 | + }) | |
88 | + .filter(data -> { // 反馈 | |
89 | + Integer feedback = state.feedback.getValue(); | |
90 | + if (feedback == null || feedback == 0) return true; | |
91 | + else return (feedback == 1 && data.getRight() != null) || (feedback == 2 && data.getRight() == null); | |
92 | + }) | |
93 | + // 过滤完成, 收集 | |
94 | + .toList() | |
95 | + .subscribe((data, th) -> { | |
96 | + if (th != null) th.printStackTrace(); | |
97 | + Collections.sort(data); | |
98 | + homeworkAdapter.setNewData(data); | |
99 | + }); | |
100 | + } | |
101 | + | |
102 | + private void showSubjectFilter() { | |
103 | + if (subjectFilter == null) { | |
104 | + PopupFilterSubjectBinding db = PopupFilterSubjectBinding.inflate(getLayoutInflater()); | |
105 | + db.setLifecycleOwner(this); | |
106 | + db.setState(state); | |
107 | + db.bg.setOnClickListener(v -> subjectFilter.dismiss()); | |
108 | + subjectFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); | |
109 | + subjectFilter.setOutsideTouchable(true); | |
110 | + subjectFilter.setOnDismissListener(this::getHomework); | |
111 | + } | |
112 | + subjectFilter.showAsDropDown(binding.anchorView); | |
113 | + } | |
114 | + | |
115 | + private void showGradeFilter() { | |
116 | + if (gradeFilter == null) { | |
117 | + PopupFilterGradeBinding db = PopupFilterGradeBinding.inflate(getLayoutInflater()); | |
118 | + db.setLifecycleOwner(this); | |
119 | + db.setState(state); | |
120 | + db.bg.setOnClickListener(v -> gradeFilter.dismiss()); | |
121 | + gradeFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); | |
122 | + gradeFilter.setOutsideTouchable(true); | |
123 | + gradeFilter.setOnDismissListener(this::getHomework); | |
124 | + } | |
125 | + gradeFilter.showAsDropDown(binding.anchorView); | |
126 | + } | |
127 | + | |
128 | + private void showTermFilter() { | |
129 | + if (termFilter == null) { | |
130 | + PopupFilterTermBinding db = PopupFilterTermBinding.inflate(getLayoutInflater()); | |
131 | + db.setLifecycleOwner(this); | |
132 | + db.setState(state); | |
133 | + db.bg.setOnClickListener(v -> termFilter.dismiss()); | |
134 | + termFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); | |
135 | + termFilter.setOutsideTouchable(true); | |
136 | + termFilter.setOnDismissListener(this::getHomework); | |
137 | + } | |
138 | + termFilter.showAsDropDown(binding.anchorView); | |
139 | + } | |
140 | + | |
141 | + private void showFeedbackFilter() { | |
142 | + if (feedbackFilter == null) { | |
143 | + PopupFilterFeedbackBinding db = PopupFilterFeedbackBinding.inflate(getLayoutInflater()); | |
144 | + db.setLifecycleOwner(this); | |
145 | + db.setState(state); | |
146 | + db.bg.setOnClickListener(v -> feedbackFilter.dismiss()); | |
147 | + feedbackFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); | |
148 | + feedbackFilter.setOutsideTouchable(true); | |
149 | + feedbackFilter.setOnDismissListener(this::getHomework); | |
150 | + } | |
151 | + feedbackFilter.showAsDropDown(binding.anchorView); | |
152 | + } | |
153 | + | |
154 | + @Override | |
155 | + protected ActivityStudentHomeworkBinding getViewBinding() { | |
156 | + return ActivityStudentHomeworkBinding.inflate(getLayoutInflater()); | |
157 | + } | |
158 | + | |
159 | + public static class State { | |
160 | + public Student student; | |
161 | + | |
162 | + public MutableLiveData<String> subject = new MutableLiveData<>(""); | |
163 | + public void setSubject(String value) { | |
164 | + subject.setValue(value); | |
165 | + } | |
166 | + | |
167 | + public MutableLiveData<String> grade = new MutableLiveData<>(""); | |
168 | + public void setGrade(String value) { | |
169 | + grade.setValue(value); | |
170 | + } | |
171 | + | |
172 | + public MutableLiveData<String> term = new MutableLiveData<>(""); | |
173 | + public void setTerm(String value) { | |
174 | + term.setValue(value); | |
175 | + } | |
176 | + | |
177 | + //0:全部, 1: 已反馈, 2:未反馈 | |
178 | + public MutableLiveData<Integer> feedback = new MutableLiveData<>(0); | |
179 | + public void setFeedback(int value) { | |
180 | + feedback.setValue(value); | |
181 | + } | |
182 | + } | |
183 | +} | ... | ... |
app/src/main/java/com/hjx/parent/fragment/ErrorFragment.java
... | ... | @@ -34,6 +34,7 @@ import com.hjq.permissions.XXPermissions; |
34 | 34 | import com.hjx.parent.ErrorListActivity; |
35 | 35 | import com.hjx.parent.ImageActivity; |
36 | 36 | import com.hjx.parent.R; |
37 | +import com.hjx.parent.StuHomeworkActivity; | |
37 | 38 | import com.hjx.parent.TeacherChooseActivity; |
38 | 39 | import com.hjx.parent.adapter.ErrorAdapter; |
39 | 40 | import com.hjx.parent.adapter.HomeworkAdapter; |
... | ... | @@ -153,8 +154,13 @@ public class ErrorFragment extends BaseRxFragment<FragmentErrorBookBinding> { |
153 | 154 | subject = 0; |
154 | 155 | getError(getResources().getStringArray(R.array.filter_subject)[subject]); |
155 | 156 | getBinding().llAll.setOnClickListener(v -> { |
156 | - Intent intent = new Intent(getContext(), ErrorListActivity.class); | |
157 | - startActivity(intent); | |
157 | + if (binding.tabLayout.getSelectedTabPosition() == 0) { | |
158 | + Intent intent = new Intent(getContext(), ErrorListActivity.class); | |
159 | + startActivity(intent); | |
160 | + } else { | |
161 | + Intent intent = new Intent(getContext(), StuHomeworkActivity.class); | |
162 | + startActivity(intent); | |
163 | + } | |
158 | 164 | }); |
159 | 165 | |
160 | 166 | errorAdapter = new ErrorAdapter(getActivity(), new ArrayList<>(), false); | ... | ... |
app/src/main/res/color/color_filter_item.xml
app/src/main/res/color/color_filter_state.xml
app/src/main/res/drawable/btn_homework_filter_item.xml
... | ... | @@ -0,0 +1,16 @@ |
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="888dp"/> | |
7 | + <solid android:color="#1C90F3"/> | |
8 | + </shape> | |
9 | + </item> | |
10 | + <item> | |
11 | + <shape> | |
12 | + <corners android:radius="888dp"/> | |
13 | + <solid android:color="#F5F5F5"/> | |
14 | + </shape> | |
15 | + </item> | |
16 | +</selector> | |
0 | 17 | \ No newline at end of file | ... | ... |
app/src/main/res/drawable/shape_radius_bottom_10dp.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:bottomLeftRadius="10dp" android:bottomRightRadius="10dp"/> | |
4 | + <solid android:color="@color/white"/> | |
5 | +</shape> | |
0 | 6 | \ No newline at end of file | ... | ... |
app/src/main/res/drawable/svg_back.xml
... | ... | @@ -0,0 +1,14 @@ |
1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
2 | + android:width="13dp" | |
3 | + android:height="19dp" | |
4 | + android:viewportWidth="26" | |
5 | + android:viewportHeight="38"> | |
6 | + <path | |
7 | + android:pathData="M20.839,5.679L7.87,17.825L20.839,29.971" | |
8 | + android:strokeLineJoin="miter" | |
9 | + android:strokeWidth="4" | |
10 | + android:fillColor="#00000000" | |
11 | + android:fillType="evenOdd" | |
12 | + android:strokeColor="#333333" | |
13 | + android:strokeLineCap="round"/> | |
14 | +</vector> | ... | ... |
app/src/main/res/drawable/svg_filter_drop_down.xml
... | ... | @@ -0,0 +1,10 @@ |
1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
2 | + android:width="8dp" | |
3 | + android:height="4dp" | |
4 | + android:viewportWidth="14" | |
5 | + android:viewportHeight="7"> | |
6 | + <path | |
7 | + android:pathData="M13.071,0L7,6.071L0.929,0" | |
8 | + android:fillColor="#999999" | |
9 | + android:fillType="evenOdd"/> | |
10 | +</vector> | ... | ... |
app/src/main/res/layout/activity_student_homework.xml
... | ... | @@ -0,0 +1,67 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
4 | + xmlns:tools="http://schemas.android.com/tools" | |
5 | + android:orientation="vertical" | |
6 | + android:layout_width="match_parent" | |
7 | + android:layout_height="match_parent" | |
8 | + tools:ignore="HardcodedText"> | |
9 | + | |
10 | + <androidx.appcompat.widget.Toolbar | |
11 | + android:id="@+id/toolbar" | |
12 | + app:navigationIcon="@drawable/svg_back" | |
13 | + android:paddingStart="-8dp" | |
14 | + android:paddingEnd="-8dp" | |
15 | + android:background="@color/white" | |
16 | + android:layout_width="match_parent" | |
17 | + android:layout_height="40dp"> | |
18 | + <TextView | |
19 | + android:id="@+id/tvTitle" | |
20 | + tools:text="小明的全部作业" | |
21 | + android:textSize="18sp" | |
22 | + android:textColor="#333" | |
23 | + android:textStyle="bold" | |
24 | + android:layout_gravity="center" | |
25 | + android:layout_width="wrap_content" | |
26 | + android:layout_height="wrap_content"/> | |
27 | + </androidx.appcompat.widget.Toolbar> | |
28 | + <LinearLayout | |
29 | + android:orientation="horizontal" | |
30 | + android:background="@color/white" | |
31 | + android:paddingHorizontal="15dp" | |
32 | + android:paddingVertical="11dp" | |
33 | + android:layout_width="match_parent" | |
34 | + android:layout_height="wrap_content"> | |
35 | + <androidx.appcompat.widget.AppCompatTextView | |
36 | + android:id="@+id/ftSubject" | |
37 | + android:text="学科" | |
38 | + style="@style/tv_StudentHomeworkFilter"/> | |
39 | + <Space style="@style/empty_space"/> | |
40 | + <androidx.appcompat.widget.AppCompatTextView | |
41 | + android:id="@+id/ftGrade" | |
42 | + android:text="年级" | |
43 | + style="@style/tv_StudentHomeworkFilter"/> | |
44 | + <Space style="@style/empty_space"/> | |
45 | + <androidx.appcompat.widget.AppCompatTextView | |
46 | + android:id="@+id/ftTerm" | |
47 | + android:text="学期" | |
48 | + style="@style/tv_StudentHomeworkFilter"/> | |
49 | + <Space style="@style/empty_space"/> | |
50 | + <androidx.appcompat.widget.AppCompatTextView | |
51 | + android:id="@+id/ftFeedback" | |
52 | + android:text="反馈状态" | |
53 | + style="@style/tv_StudentHomeworkFilter"/> | |
54 | + </LinearLayout> | |
55 | + <androidx.legacy.widget.Space | |
56 | + android:id="@+id/anchorView" | |
57 | + android:layout_width="0dp" | |
58 | + android:layout_height="0dp"/> | |
59 | + | |
60 | + <androidx.recyclerview.widget.RecyclerView | |
61 | + android:id="@+id/recyclerView" | |
62 | + android:background="#F8F8F8" | |
63 | + android:orientation="vertical" | |
64 | + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | |
65 | + android:layout_width="match_parent" | |
66 | + android:layout_height="match_parent"/> | |
67 | +</LinearLayout> | |
0 | 68 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/popup_filter_feedback.xml
... | ... | @@ -0,0 +1,56 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<layout xmlns:tools="http://schemas.android.com/tools" | |
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
4 | + tools:ignore="HardcodedText"> | |
5 | + | |
6 | + <data> | |
7 | + <import type="com.hjx.parent.StuHomeworkActivity.State"/> | |
8 | + <variable | |
9 | + name="state" | |
10 | + type="State" /> | |
11 | + </data> | |
12 | + | |
13 | + <LinearLayout | |
14 | + android:orientation="vertical" | |
15 | + android:background="#80000000" | |
16 | + android:layout_width="match_parent" | |
17 | + android:layout_height="wrap_content"> | |
18 | + <LinearLayout | |
19 | + android:orientation="vertical" | |
20 | + android:padding="8dp" | |
21 | + android:background="@drawable/shape_radius_bottom_10dp" | |
22 | + android:layout_width="match_parent" | |
23 | + android:layout_height="wrap_content"> | |
24 | + <LinearLayout | |
25 | + android:orientation="horizontal" | |
26 | + android:weightSum="4" | |
27 | + android:layout_width="match_parent" | |
28 | + android:layout_height="wrap_content" | |
29 | + tools:ignore="UselessParent"> | |
30 | + <RadioButton | |
31 | + android:text="全部" | |
32 | + android:checked="@{state.feedback == 0}" | |
33 | + android:onClick='@{() -> state.setFeedback(0)}' | |
34 | + style="@style/chk_HomeworkFilterItem"/> | |
35 | + <RadioButton | |
36 | + android:text="已反馈" | |
37 | + android:checked='@{state.feedback == 1}' | |
38 | + android:onClick='@{() -> state.setFeedback(1)}' | |
39 | + style="@style/chk_HomeworkFilterItem"/> | |
40 | + <RadioButton | |
41 | + android:text="未反馈" | |
42 | + android:checked='@{state.feedback == 2}' | |
43 | + android:onClick='@{() -> state.setFeedback(2)}' | |
44 | + style="@style/chk_HomeworkFilterItem"/> | |
45 | + <RadioButton | |
46 | + android:visibility="invisible" | |
47 | + style="@style/chk_HomeworkFilterItem"/> | |
48 | + </LinearLayout> | |
49 | + </LinearLayout> | |
50 | + | |
51 | + <View | |
52 | + android:id="@+id/bg" | |
53 | + android:layout_width="match_parent" | |
54 | + android:layout_height="match_parent"/> | |
55 | + </LinearLayout> | |
56 | +</layout> | |
0 | 57 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/popup_filter_grade.xml
... | ... | @@ -0,0 +1,105 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<layout xmlns:tools="http://schemas.android.com/tools" | |
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
4 | + tools:ignore="HardcodedText"> | |
5 | + | |
6 | + <data> | |
7 | + <import type="com.hjx.parent.StuHomeworkActivity.State"/> | |
8 | + <variable | |
9 | + name="state" | |
10 | + type="State" /> | |
11 | + </data> | |
12 | + | |
13 | + <LinearLayout | |
14 | + android:orientation="vertical" | |
15 | + android:background="#80000000" | |
16 | + android:layout_width="match_parent" | |
17 | + android:layout_height="wrap_content"> | |
18 | + <LinearLayout | |
19 | + android:orientation="vertical" | |
20 | + android:padding="8dp" | |
21 | + android:background="@drawable/shape_radius_bottom_10dp" | |
22 | + android:layout_width="match_parent" | |
23 | + android:layout_height="wrap_content"> | |
24 | + <LinearLayout | |
25 | + android:orientation="horizontal" | |
26 | + android:weightSum="4" | |
27 | + android:layout_width="match_parent" | |
28 | + android:layout_height="wrap_content"> | |
29 | + <RadioButton | |
30 | + android:text="全部" | |
31 | + android:checked="@{state.grade.empty}" | |
32 | + android:onClick='@{() -> state.setGrade("")}' | |
33 | + style="@style/chk_HomeworkFilterItem"/> | |
34 | + <RadioButton | |
35 | + android:text="七年级" | |
36 | + android:checked='@{state.grade.equals("七年级")}' | |
37 | + android:onClick='@{() -> state.setGrade("七年级")}' | |
38 | + style="@style/chk_HomeworkFilterItem"/> | |
39 | + <RadioButton | |
40 | + android:text="八年级" | |
41 | + android:checked='@{state.grade.equals("八年级")}' | |
42 | + android:onClick='@{() -> state.setGrade("八年级")}' | |
43 | + style="@style/chk_HomeworkFilterItem"/> | |
44 | + <RadioButton | |
45 | + android:text="九年级" | |
46 | + android:checked='@{state.grade.equals("九年级")}' | |
47 | + android:onClick='@{() -> state.setGrade("九年级")}' | |
48 | + style="@style/chk_HomeworkFilterItem"/> | |
49 | + </LinearLayout> | |
50 | + <LinearLayout | |
51 | + android:orientation="horizontal" | |
52 | + android:weightSum="4" | |
53 | + android:layout_width="match_parent" | |
54 | + android:layout_height="wrap_content"> | |
55 | + <RadioButton | |
56 | + android:text="一年级" | |
57 | + android:checked='@{state.grade.equals("一年级")}' | |
58 | + android:onClick='@{() -> state.setGrade("一年级")}' | |
59 | + style="@style/chk_HomeworkFilterItem"/> | |
60 | + <RadioButton | |
61 | + android:text="二年级" | |
62 | + android:checked='@{state.grade.equals("二年级")}' | |
63 | + android:onClick='@{() -> state.setGrade("二年级")}' | |
64 | + style="@style/chk_HomeworkFilterItem"/> | |
65 | + <RadioButton | |
66 | + android:text="三年级" | |
67 | + android:checked='@{state.grade.equals("三年级")}' | |
68 | + android:onClick='@{() -> state.setGrade("三年级")}' | |
69 | + style="@style/chk_HomeworkFilterItem"/> | |
70 | + <RadioButton | |
71 | + android:text="四年级" | |
72 | + android:checked='@{state.grade.equals("四年级")}' | |
73 | + android:onClick='@{() -> state.setGrade("四年级")}' | |
74 | + style="@style/chk_HomeworkFilterItem"/> | |
75 | + </LinearLayout> | |
76 | + <LinearLayout | |
77 | + android:orientation="horizontal" | |
78 | + android:weightSum="4" | |
79 | + android:layout_width="match_parent" | |
80 | + android:layout_height="wrap_content"> | |
81 | + <RadioButton | |
82 | + android:text="五年级" | |
83 | + android:checked='@{state.grade.equals("五年级")}' | |
84 | + android:onClick='@{() -> state.setGrade("五年级")}' | |
85 | + style="@style/chk_HomeworkFilterItem"/> | |
86 | + <RadioButton | |
87 | + android:text="六年级" | |
88 | + android:checked='@{state.grade.equals("六年级")}' | |
89 | + android:onClick='@{() -> state.setGrade("六年级")}' | |
90 | + style="@style/chk_HomeworkFilterItem"/> | |
91 | + <RadioButton | |
92 | + android:visibility="invisible" | |
93 | + style="@style/chk_HomeworkFilterItem"/> | |
94 | + <RadioButton | |
95 | + android:visibility="invisible" | |
96 | + style="@style/chk_HomeworkFilterItem"/> | |
97 | + </LinearLayout> | |
98 | + </LinearLayout> | |
99 | + | |
100 | + <View | |
101 | + android:id="@+id/bg" | |
102 | + android:layout_width="match_parent" | |
103 | + android:layout_height="match_parent"/> | |
104 | + </LinearLayout> | |
105 | +</layout> | |
0 | 106 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/popup_filter_subject.xml
... | ... | @@ -0,0 +1,79 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<layout xmlns:tools="http://schemas.android.com/tools" | |
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
4 | + tools:ignore="HardcodedText"> | |
5 | + | |
6 | + <data> | |
7 | + <import type="com.hjx.parent.StuHomeworkActivity.State"/> | |
8 | + <variable | |
9 | + name="state" | |
10 | + type="State" /> | |
11 | + </data> | |
12 | + | |
13 | + <LinearLayout | |
14 | + android:orientation="vertical" | |
15 | + android:background="#80000000" | |
16 | + android:layout_width="match_parent" | |
17 | + android:layout_height="wrap_content"> | |
18 | + <LinearLayout | |
19 | + android:orientation="vertical" | |
20 | + android:padding="8dp" | |
21 | + android:background="@drawable/shape_radius_bottom_10dp" | |
22 | + android:layout_width="match_parent" | |
23 | + android:layout_height="wrap_content"> | |
24 | + <LinearLayout | |
25 | + android:orientation="horizontal" | |
26 | + android:weightSum="4" | |
27 | + android:layout_width="match_parent" | |
28 | + android:layout_height="wrap_content"> | |
29 | + <RadioButton | |
30 | + android:text="全部" | |
31 | + android:checked="@{state.subject.empty}" | |
32 | + android:onClick='@{() -> state.setSubject("")}' | |
33 | + style="@style/chk_HomeworkFilterItem"/> | |
34 | + <RadioButton | |
35 | + android:text="语文" | |
36 | + android:checked='@{state.subject.equals("语文")}' | |
37 | + android:onClick='@{() -> state.setSubject("语文")}' | |
38 | + style="@style/chk_HomeworkFilterItem"/> | |
39 | + <RadioButton | |
40 | + android:text="数学" | |
41 | + android:checked='@{state.subject.equals("数学")}' | |
42 | + android:onClick='@{() -> state.setSubject("数学")}' | |
43 | + style="@style/chk_HomeworkFilterItem"/> | |
44 | + <RadioButton | |
45 | + android:text="英语" | |
46 | + android:checked='@{state.subject.equals("英语")}' | |
47 | + android:onClick='@{() -> state.setSubject("英语")}' | |
48 | + style="@style/chk_HomeworkFilterItem"/> | |
49 | + </LinearLayout> | |
50 | + <LinearLayout | |
51 | + android:orientation="horizontal" | |
52 | + android:weightSum="4" | |
53 | + android:layout_width="match_parent" | |
54 | + android:layout_height="wrap_content"> | |
55 | + <RadioButton | |
56 | + android:text="物理" | |
57 | + android:checked='@{state.subject.equals("物理")}' | |
58 | + android:onClick='@{() -> state.setSubject("物理")}' | |
59 | + style="@style/chk_HomeworkFilterItem"/> | |
60 | + <RadioButton | |
61 | + android:text="化学" | |
62 | + android:checked='@{state.subject.equals("化学")}' | |
63 | + android:onClick='@{() -> state.setSubject("化学")}' | |
64 | + style="@style/chk_HomeworkFilterItem"/> | |
65 | + <RadioButton | |
66 | + android:visibility="invisible" | |
67 | + style="@style/chk_HomeworkFilterItem"/> | |
68 | + <RadioButton | |
69 | + android:visibility="invisible" | |
70 | + style="@style/chk_HomeworkFilterItem"/> | |
71 | + </LinearLayout> | |
72 | + </LinearLayout> | |
73 | + | |
74 | + <View | |
75 | + android:id="@+id/bg" | |
76 | + android:layout_width="match_parent" | |
77 | + android:layout_height="match_parent"/> | |
78 | + </LinearLayout> | |
79 | +</layout> | |
0 | 80 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/popup_filter_term.xml
... | ... | @@ -0,0 +1,56 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<layout xmlns:tools="http://schemas.android.com/tools" | |
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
4 | + tools:ignore="HardcodedText"> | |
5 | + | |
6 | + <data> | |
7 | + <import type="com.hjx.parent.StuHomeworkActivity.State"/> | |
8 | + <variable | |
9 | + name="state" | |
10 | + type="State" /> | |
11 | + </data> | |
12 | + | |
13 | + <LinearLayout | |
14 | + android:orientation="vertical" | |
15 | + android:background="#80000000" | |
16 | + android:layout_width="match_parent" | |
17 | + android:layout_height="wrap_content"> | |
18 | + <LinearLayout | |
19 | + android:orientation="vertical" | |
20 | + android:padding="8dp" | |
21 | + android:background="@drawable/shape_radius_bottom_10dp" | |
22 | + android:layout_width="match_parent" | |
23 | + android:layout_height="wrap_content"> | |
24 | + <LinearLayout | |
25 | + android:orientation="horizontal" | |
26 | + android:weightSum="4" | |
27 | + android:layout_width="match_parent" | |
28 | + android:layout_height="wrap_content" | |
29 | + tools:ignore="UselessParent"> | |
30 | + <RadioButton | |
31 | + android:text="全部" | |
32 | + android:checked="@{state.term.empty}" | |
33 | + android:onClick='@{() -> state.setTerm("")}' | |
34 | + style="@style/chk_HomeworkFilterItem"/> | |
35 | + <RadioButton | |
36 | + android:text="上学期" | |
37 | + android:checked='@{state.term.equals("上学期")}' | |
38 | + android:onClick='@{() -> state.setTerm("上学期")}' | |
39 | + style="@style/chk_HomeworkFilterItem"/> | |
40 | + <RadioButton | |
41 | + android:text="下学期" | |
42 | + android:checked='@{state.term.equals("下学期")}' | |
43 | + android:onClick='@{() -> state.setTerm("下学期")}' | |
44 | + style="@style/chk_HomeworkFilterItem"/> | |
45 | + <RadioButton | |
46 | + android:visibility="invisible" | |
47 | + style="@style/chk_HomeworkFilterItem"/> | |
48 | + </LinearLayout> | |
49 | + </LinearLayout> | |
50 | + | |
51 | + <View | |
52 | + android:id="@+id/bg" | |
53 | + android:layout_width="match_parent" | |
54 | + android:layout_height="match_parent"/> | |
55 | + </LinearLayout> | |
56 | +</layout> | |
0 | 57 | \ No newline at end of file | ... | ... |
app/src/main/res/values/styles.xml
... | ... | @@ -66,4 +66,26 @@ |
66 | 66 | <item name="android:windowIsFloating">true</item> |
67 | 67 | </style> |
68 | 68 | |
69 | + <style name="tv_StudentHomeworkFilter"> | |
70 | + <item name="android:textSize">13sp</item> | |
71 | + <item name="android:textColor">@color/color_filter_state</item> | |
72 | + <item name="android:drawableTint">@color/color_filter_state</item> | |
73 | + <item name="android:drawableEnd">@drawable/svg_filter_drop_down</item> | |
74 | + <item name="android:drawablePadding">8dp</item> | |
75 | + <item name="android:layout_width">wrap_content</item> | |
76 | + <item name="android:layout_height">wrap_content</item> | |
77 | + </style> | |
78 | + | |
79 | + <style name="chk_HomeworkFilterItem"> | |
80 | + <item name="android:textSize">13sp</item> | |
81 | + <item name="android:textColor">@color/color_filter_item</item> | |
82 | + <item name="android:gravity">center</item> | |
83 | + <item name="android:button">@null</item> | |
84 | + <item name="android:background">@drawable/btn_homework_filter_item</item> | |
85 | + <item name="android:layout_margin">8dp</item> | |
86 | + <item name="android:layout_weight">1</item> | |
87 | + <item name="android:layout_width">0dp</item> | |
88 | + <item name="android:layout_height">26dp</item> | |
89 | + </style> | |
90 | + | |
69 | 91 | </resources> |
70 | 92 | \ No newline at end of file | ... | ... |