Commit 7f42ea4db659d7a0993cfb0f0be92e248084af8d
1 parent
a516c951d2
Exists in
master
题目详情, 选择错题
Showing
15 changed files
with
492 additions
and
3 deletions
Show diff stats
app/src/main/AndroidManifest.xml
... | ... | @@ -152,6 +152,8 @@ |
152 | 152 | android:screenOrientation="portrait" |
153 | 153 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
154 | 154 | <activity android:name=".StuHomeworkActivity" /> |
155 | + <activity android:name=".HomeworkDetailActivity" /> | |
156 | + <activity android:name=".HomeworkSelectActivity" /> | |
155 | 157 | |
156 | 158 | <provider |
157 | 159 | android:name="androidx.core.content.FileProvider" | ... | ... |
app/src/main/java/com/hjx/parent/HomeworkDetailActivity.java
... | ... | @@ -0,0 +1,80 @@ |
1 | +package com.hjx.parent; | |
2 | + | |
3 | +import android.annotation.SuppressLint; | |
4 | +import android.content.Intent; | |
5 | +import android.os.Bundle; | |
6 | +import android.widget.ImageView; | |
7 | +import android.widget.TextView; | |
8 | + | |
9 | +import androidx.annotation.NonNull; | |
10 | + | |
11 | +import com.bumptech.glide.Glide; | |
12 | +import com.chad.library.adapter.base.BaseQuickAdapter; | |
13 | +import com.chad.library.adapter.base.BaseViewHolder; | |
14 | +import com.google.gson.Gson; | |
15 | +import com.hjx.parent.databinding.ActivityHomeworkDetailBinding; | |
16 | +import com.hjx.parent.rx.BaseRxActivity; | |
17 | +import com.prws.common.bean.ResponseResult; | |
18 | +import com.prws.common.bean.homework.HomeWork; | |
19 | +import com.prws.common.bean.homework.HomeworkList; | |
20 | +import com.prws.common.net.NetWorks; | |
21 | + | |
22 | +import java.util.ArrayList; | |
23 | + | |
24 | +public class HomeworkDetailActivity extends BaseRxActivity<ActivityHomeworkDetailBinding> { | |
25 | + | |
26 | + private HomeworkList mData; | |
27 | + | |
28 | + private Adapter mAdapter = new Adapter(); | |
29 | + | |
30 | + @Override | |
31 | + public void initView(Bundle savedInstanceState) { | |
32 | + binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); | |
33 | + String json = getIntent().getStringExtra("data"); | |
34 | + mData = new Gson().fromJson(json, HomeworkList.class); | |
35 | + binding.tvTitle.setText(mData.getName()); | |
36 | + | |
37 | + binding.recyclerView.setAdapter(mAdapter); | |
38 | + getDetail(); | |
39 | + | |
40 | + binding.btnFeedback.setOnClickListener(v -> { | |
41 | + Intent intent = new Intent(this, HomeworkSelectActivity.class); | |
42 | + intent.putExtra("data", mData); | |
43 | + intent.putExtra("list", new ArrayList<>(mAdapter.getData())); | |
44 | + startActivity(intent); | |
45 | + }); | |
46 | + } | |
47 | + | |
48 | + @SuppressLint("CheckResult") | |
49 | + private void getDetail() { | |
50 | + NetWorks.service_url.getHomeworkDetail(NetWorks.getHeader(), mData.getId()) | |
51 | + .compose(transformSingle()) | |
52 | + .map(ResponseResult::getData) | |
53 | + .subscribe((list, th) -> { | |
54 | + if (th != null) th.printStackTrace(); | |
55 | + mAdapter.setNewData(list); | |
56 | + }); | |
57 | + } | |
58 | + | |
59 | + @Override | |
60 | + protected ActivityHomeworkDetailBinding getViewBinding() { | |
61 | + return ActivityHomeworkDetailBinding.inflate(getLayoutInflater()); | |
62 | + } | |
63 | + | |
64 | + static class Adapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { | |
65 | + | |
66 | + public Adapter() { | |
67 | + super(R.layout.item_homework_detail); | |
68 | + } | |
69 | + | |
70 | + @SuppressLint("SetTextI18n") | |
71 | + @Override | |
72 | + protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { | |
73 | + TextView tvNumber = holder.getView(R.id.tvNumber); | |
74 | + ImageView imageView = holder.getView(R.id.ivTopic); | |
75 | + int number = getData().indexOf(homeWork) + 1; | |
76 | + tvNumber.setText("第" + number + "题"); | |
77 | + Glide.with(mContext).load(homeWork.url).into(imageView); | |
78 | + } | |
79 | + } | |
80 | +} | ... | ... |
app/src/main/java/com/hjx/parent/HomeworkSelectActivity.java
... | ... | @@ -0,0 +1,103 @@ |
1 | +package com.hjx.parent; | |
2 | + | |
3 | +import android.annotation.SuppressLint; | |
4 | +import android.content.res.ColorStateList; | |
5 | +import android.os.Bundle; | |
6 | +import android.view.View; | |
7 | +import android.widget.CheckBox; | |
8 | +import android.widget.ImageView; | |
9 | +import android.widget.TextView; | |
10 | + | |
11 | +import androidx.annotation.NonNull; | |
12 | +import androidx.lifecycle.MutableLiveData; | |
13 | + | |
14 | +import com.bumptech.glide.Glide; | |
15 | +import com.chad.library.adapter.base.BaseQuickAdapter; | |
16 | +import com.chad.library.adapter.base.BaseViewHolder; | |
17 | +import com.hjx.parent.databinding.ActivityHomeworkSelectBinding; | |
18 | +import com.hjx.parent.function.Function1; | |
19 | +import com.hjx.parent.rx.BaseRxActivity; | |
20 | +import com.prws.common.bean.homework.HomeWork; | |
21 | +import com.prws.common.bean.homework.HomeworkList; | |
22 | + | |
23 | +import java.util.ArrayList; | |
24 | + | |
25 | +public class HomeworkSelectActivity extends BaseRxActivity<ActivityHomeworkSelectBinding> { | |
26 | + | |
27 | + private HomeworkList mData; | |
28 | + private ArrayList<HomeWork> mList; | |
29 | + private Adapter mAdapter = new Adapter(); | |
30 | + | |
31 | + MutableLiveData<Integer> selectNum = new MutableLiveData<>(0); | |
32 | + | |
33 | + @SuppressLint("NotifyDataSetChanged") | |
34 | + @SuppressWarnings("unchecked,ConstantConditions") | |
35 | + @Override | |
36 | + public void initView(Bundle savedInstanceState) { | |
37 | + binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); | |
38 | + mData = (HomeworkList) getIntent().getSerializableExtra("data"); | |
39 | + mList = (ArrayList<HomeWork>) getIntent().getSerializableExtra("list"); | |
40 | + | |
41 | + mAdapter.setNewData(mList); | |
42 | + binding.recyclerView.setAdapter(mAdapter); | |
43 | + | |
44 | + mAdapter.selectCall = i -> selectNum.setValue(selectNum.getValue() + i); | |
45 | + selectNum.observe(this, i -> { | |
46 | + binding.tvNumber.setText(String.valueOf(i)); | |
47 | + if (i == 0) { | |
48 | + binding.btnConfirm.setText("作业全对"); | |
49 | + binding.btnConfirm.setBackgroundTintList(ColorStateList.valueOf(0xFF4ABC78)); | |
50 | + } else { | |
51 | + binding.btnConfirm.setText("下一步"); | |
52 | + binding.btnConfirm.setBackgroundTintList(ColorStateList.valueOf(0xFF1C90F3)); | |
53 | + } | |
54 | + binding.chkAll.setChecked(i == mList.size() && i != 0); | |
55 | + }); | |
56 | + | |
57 | + binding.chkAll.setOnClickListener(v -> { | |
58 | + if (mList.size() == 0) return; | |
59 | + boolean b = binding.chkAll.isChecked(); | |
60 | + for (HomeWork item: mList) { | |
61 | + item.check = b; | |
62 | + } | |
63 | + selectNum.setValue(b ? mList.size() : 0); | |
64 | + mAdapter.notifyDataSetChanged(); | |
65 | + }); | |
66 | + } | |
67 | + | |
68 | + @Override | |
69 | + protected ActivityHomeworkSelectBinding getViewBinding() { | |
70 | + return ActivityHomeworkSelectBinding.inflate(getLayoutInflater()); | |
71 | + } | |
72 | + | |
73 | + | |
74 | + static class Adapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { | |
75 | + public Adapter() { | |
76 | + super(R.layout.item_homework_detail); | |
77 | + } | |
78 | + public Function1<Integer> selectCall; | |
79 | + | |
80 | + @SuppressLint("SetTextI18n") | |
81 | + @Override | |
82 | + protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { | |
83 | + TextView tvNumber = holder.getView(R.id.tvNumber); | |
84 | + ImageView imageView = holder.getView(R.id.ivTopic); | |
85 | + int number = getData().indexOf(homeWork) + 1; | |
86 | + tvNumber.setText("第" + number + "题"); | |
87 | + Glide.with(mContext).load(homeWork.url).into(imageView); | |
88 | + | |
89 | + CheckBox checkBox = holder.getView(R.id.checkbox); | |
90 | + checkBox.setVisibility(View.VISIBLE); | |
91 | + checkBox.setOnCheckedChangeListener(null); | |
92 | + checkBox.setChecked(homeWork.check); | |
93 | + | |
94 | + holder.itemView.setOnClickListener(v -> checkBox.performClick()); | |
95 | + checkBox.setOnCheckedChangeListener((v, b) -> { | |
96 | + homeWork.check = b; | |
97 | + if (selectCall != null) { | |
98 | + selectCall.invoke(b ? 1 : -1); | |
99 | + } | |
100 | + }); | |
101 | + } | |
102 | + } | |
103 | +} | ... | ... |
app/src/main/java/com/hjx/parent/adapter/HomeworkListAdapter.java
1 | 1 | package com.hjx.parent.adapter; |
2 | 2 | |
3 | +import android.content.Intent; | |
3 | 4 | import android.view.View; |
4 | 5 | import android.widget.TextView; |
5 | 6 | |
... | ... | @@ -7,6 +8,8 @@ import androidx.annotation.NonNull; |
7 | 8 | |
8 | 9 | import com.chad.library.adapter.base.BaseQuickAdapter; |
9 | 10 | import com.chad.library.adapter.base.BaseViewHolder; |
11 | +import com.google.gson.Gson; | |
12 | +import com.hjx.parent.HomeworkDetailActivity; | |
10 | 13 | import com.hjx.parent.R; |
11 | 14 | import com.hjx.parent.function.Function0; |
12 | 15 | import com.hjx.parent.function.Function1; |
... | ... | @@ -63,7 +66,9 @@ public class HomeworkListAdapter extends BaseQuickAdapter<HomeworkList, BaseView |
63 | 66 | |
64 | 67 | View btnDetail = helper.getView(R.id.btnDetail); |
65 | 68 | btnDetail.setOnClickListener(v -> { |
66 | - // TODO | |
69 | + Intent intent = new Intent(mContext, HomeworkDetailActivity.class); | |
70 | + intent.putExtra("data", new Gson().toJson(homework)); | |
71 | + mContext.startActivity(intent); | |
67 | 72 | }); |
68 | 73 | } |
69 | 74 | } | ... | ... |
app/src/main/java/com/hjx/parent/rx/ILifecycleActivity.java
... | ... | @@ -4,9 +4,12 @@ import com.trello.rxlifecycle2.android.ActivityEvent; |
4 | 4 | import com.trello.rxlifecycle2.android.RxLifecycleAndroid; |
5 | 5 | |
6 | 6 | import io.reactivex.Observable; |
7 | +import io.reactivex.ObservableSource; | |
8 | +import io.reactivex.ObservableTransformer; | |
7 | 9 | import io.reactivex.Observer; |
8 | 10 | import io.reactivex.Single; |
9 | 11 | import io.reactivex.SingleObserver; |
12 | +import io.reactivex.SingleTransformer; | |
10 | 13 | import io.reactivex.android.schedulers.AndroidSchedulers; |
11 | 14 | import io.reactivex.disposables.Disposable; |
12 | 15 | import io.reactivex.functions.Consumer; |
... | ... | @@ -45,4 +48,17 @@ public interface ILifecycleActivity { |
45 | 48 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) |
46 | 49 | .subscribe(onNext); |
47 | 50 | } |
51 | + | |
52 | + default <T> ObservableTransformer<T, T> transform() { | |
53 | + return upstream -> upstream.subscribeOn(Schedulers.io()) | |
54 | + .observeOn(AndroidSchedulers.mainThread()) | |
55 | + .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())); | |
56 | + } | |
57 | + | |
58 | + default <T> SingleTransformer<T, T> transformSingle() { | |
59 | + return upstream -> upstream.subscribeOn(Schedulers.io()) | |
60 | + .observeOn(AndroidSchedulers.mainThread()) | |
61 | + .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())); | |
62 | + } | |
63 | + | |
48 | 64 | } | ... | ... |
app/src/main/res/drawable/chk_circle.xml
... | ... | @@ -0,0 +1,5 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
3 | + <item android:drawable="@drawable/svg_select_circle_on" android:state_checked="true"/> | |
4 | + <item android:drawable="@drawable/svg_select_circle_off"/> | |
5 | +</selector> | |
0 | 6 | \ No newline at end of file | ... | ... |
app/src/main/res/drawable/svg_homework_edit.xml
... | ... | @@ -0,0 +1,22 @@ |
1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
2 | + android:width="34dp" | |
3 | + android:height="34dp" | |
4 | + android:viewportWidth="34" | |
5 | + android:viewportHeight="34"> | |
6 | + <path | |
7 | + android:pathData="M8,0L26,0C30.418,0 34,3.582 34,8L34,26C34,30.418 30.418,34 26,34L8,34C3.582,34 0,30.418 0,26L0,8C0,3.582 3.582,0 8,0Z" | |
8 | + android:fillColor="#1C90F3" | |
9 | + android:fillType="evenOdd"/> | |
10 | + <path | |
11 | + android:pathData="M4,9L15,9C16.105,9 17,9.895 17,11C17,12.105 16.105,13 15,13L4,13C2.895,13 2,12.105 2,11C2,9.895 2.895,9 4,9Z" | |
12 | + android:fillColor="#FFFFFF" | |
13 | + android:fillType="evenOdd"/> | |
14 | + <path | |
15 | + android:pathData="M4,18L9,18C10.105,18 11,18.895 11,20C11,21.105 10.105,22 9,22L4,22C2.895,22 2,21.105 2,20C2,18.895 2.895,18 4,18Z" | |
16 | + android:fillColor="#FFFFFF" | |
17 | + android:fillType="evenOdd"/> | |
18 | + <path | |
19 | + android:pathData="M27.058,5.276L32.959,10.334L16.942,28.881L11.041,29.724L11.041,23.823L27.058,5.276Z" | |
20 | + android:fillColor="#FFFFFF" | |
21 | + android:fillType="evenOdd"/> | |
22 | +</vector> | ... | ... |
app/src/main/res/drawable/svg_select_circle_off.xml
... | ... | @@ -0,0 +1,14 @@ |
1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
2 | + android:width="15dp" | |
3 | + android:height="15dp" | |
4 | + android:viewportWidth="33" | |
5 | + android:viewportHeight="33"> | |
6 | + <path | |
7 | + android:pathData="M16,1C24.284,1 31,7.716 31,16C31,24.284 24.284,31 16,31C7.716,31 1,24.284 1,16C1,7.716 7.716,1 16,1Z" | |
8 | + android:strokeLineJoin="miter" | |
9 | + android:strokeWidth="2" | |
10 | + android:fillColor="#00000000" | |
11 | + android:fillType="evenOdd" | |
12 | + android:strokeColor="#CCCCCC" | |
13 | + android:strokeLineCap="butt"/> | |
14 | +</vector> | ... | ... |
app/src/main/res/drawable/svg_select_circle_on.xml
... | ... | @@ -0,0 +1,22 @@ |
1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
2 | + android:width="15dp" | |
3 | + android:height="15dp" | |
4 | + android:viewportWidth="33.5" | |
5 | + android:viewportHeight="33.5"> | |
6 | + <path | |
7 | + android:pathData="M16,1C24.284,1 31,7.716 31,16C31,24.284 24.284,31 16,31C7.716,31 1,24.284 1,16C1,7.716 7.716,1 16,1Z" | |
8 | + android:strokeLineJoin="miter" | |
9 | + android:strokeWidth="2" | |
10 | + android:fillColor="#00000000" | |
11 | + android:fillType="evenOdd" | |
12 | + android:strokeColor="#FF4837" | |
13 | + android:strokeLineCap="butt"/> | |
14 | + <path | |
15 | + android:pathData="M24.543,11.008L24.545,11.009L24.538,11.018C24.521,11.051 24.505,11.09 24.487,11.119C24.418,11.226 24.324,11.348 24.211,11.477L16.298,22.577C15.44,23.982 14.527,23.904 13.74,23.098L7.691,16.84" | |
16 | + android:strokeLineJoin="miter" | |
17 | + android:strokeWidth="3" | |
18 | + android:fillColor="#00000000" | |
19 | + android:fillType="evenOdd" | |
20 | + android:strokeColor="#FF4837" | |
21 | + android:strokeLineCap="round"/> | |
22 | +</vector> | ... | ... |
app/src/main/res/layout/activity_homework_detail.xml
... | ... | @@ -0,0 +1,47 @@ |
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:layout_width="match_parent" | |
8 | + android:layout_height="match_parent" | |
9 | + tools:ignore="HardcodedText"> | |
10 | + | |
11 | + <androidx.appcompat.widget.Toolbar | |
12 | + android:id="@+id/toolbar" | |
13 | + app:navigationIcon="@drawable/svg_back" | |
14 | + app:contentInsetStartWithNavigation="14dp" | |
15 | + android:paddingStart="-8dp" | |
16 | + android:paddingEnd="-8dp" | |
17 | + android:background="@color/white" | |
18 | + android:layout_width="match_parent" | |
19 | + android:layout_height="40dp"> | |
20 | + <TextView | |
21 | + android:id="@+id/tvTitle" | |
22 | + tools:text="作业名称" | |
23 | + android:textSize="18sp" | |
24 | + android:textColor="#333" | |
25 | + android:textStyle="bold" | |
26 | + android:layout_width="wrap_content" | |
27 | + android:layout_height="wrap_content"/> | |
28 | + <TextView | |
29 | + android:id="@+id/btnFeedback" | |
30 | + android:text="反馈作业" | |
31 | + android:textSize="13sp" | |
32 | + android:textColor="#1C90F3" | |
33 | + android:textStyle="bold" | |
34 | + android:layout_gravity="end|center_vertical" | |
35 | + android:layout_marginEnd="24dp" | |
36 | + android:layout_width="wrap_content" | |
37 | + android:layout_height="wrap_content"/> | |
38 | + </androidx.appcompat.widget.Toolbar> | |
39 | + | |
40 | + <androidx.recyclerview.widget.RecyclerView | |
41 | + android:id="@+id/recyclerView" | |
42 | + android:orientation="vertical" | |
43 | + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | |
44 | + android:layout_width="match_parent" | |
45 | + android:layout_height="match_parent"/> | |
46 | + | |
47 | +</LinearLayout> | |
0 | 48 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/activity_homework_select.xml
... | ... | @@ -0,0 +1,96 @@ |
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:layout_width="match_parent" | |
8 | + android:layout_height="match_parent" | |
9 | + tools:ignore="HardcodedText"> | |
10 | + | |
11 | + <androidx.appcompat.widget.Toolbar | |
12 | + android:id="@+id/toolbar" | |
13 | + app:navigationIcon="@drawable/svg_back" | |
14 | + app:contentInsetStartWithNavigation="14dp" | |
15 | + android:paddingStart="-8dp" | |
16 | + android:paddingEnd="-8dp" | |
17 | + android:background="@color/white" | |
18 | + android:layout_width="match_parent" | |
19 | + android:layout_height="40dp"> | |
20 | + <TextView | |
21 | + android:text="第一步:选择错题" | |
22 | + android:textSize="18sp" | |
23 | + android:textColor="#333" | |
24 | + android:textStyle="bold" | |
25 | + android:layout_gravity="center" | |
26 | + android:layout_width="wrap_content" | |
27 | + android:layout_height="wrap_content"/> | |
28 | + </androidx.appcompat.widget.Toolbar> | |
29 | + | |
30 | + <LinearLayout | |
31 | + android:orientation="horizontal" | |
32 | + android:layout_marginHorizontal="16dp" | |
33 | + android:layout_marginTop="16dp" | |
34 | + android:layout_marginBottom="8dp" | |
35 | + android:layout_width="match_parent" | |
36 | + android:layout_height="wrap_content"> | |
37 | + <CheckBox | |
38 | + android:id="@+id/chkAll" | |
39 | + android:text="全选" | |
40 | + android:textSize="13sp" | |
41 | + android:textColor="#333" | |
42 | + android:button="@drawable/chk_circle" | |
43 | + android:gravity="center_vertical" | |
44 | + android:paddingStart="8dp" | |
45 | + android:paddingEnd="0dp" | |
46 | + android:layout_width="wrap_content" | |
47 | + android:layout_height="wrap_content"/> | |
48 | + <Space style="@style/empty_space"/> | |
49 | + <TextView | |
50 | + android:text="已选择 " | |
51 | + android:textSize="13sp" | |
52 | + android:textColor="#333" | |
53 | + android:layout_width="wrap_content" | |
54 | + android:layout_height="wrap_content"/> | |
55 | + <TextView | |
56 | + android:id="@+id/tvNumber" | |
57 | + android:text="0" | |
58 | + android:textSize="13sp" | |
59 | + android:textColor="#1C90F3" | |
60 | + android:layout_width="wrap_content" | |
61 | + android:layout_height="wrap_content"/> | |
62 | + <TextView | |
63 | + android:text=" 道错题" | |
64 | + android:textSize="13sp" | |
65 | + android:textColor="#333" | |
66 | + android:layout_width="wrap_content" | |
67 | + android:layout_height="wrap_content"/> | |
68 | + </LinearLayout> | |
69 | + | |
70 | + <androidx.recyclerview.widget.RecyclerView | |
71 | + android:id="@+id/recyclerView" | |
72 | + android:orientation="vertical" | |
73 | + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | |
74 | + android:layout_width="match_parent" | |
75 | + android:layout_height="0px" | |
76 | + android:layout_weight="1"/> | |
77 | + | |
78 | + <FrameLayout | |
79 | + android:background="@color/white" | |
80 | + android:paddingTop="8dp" | |
81 | + android:paddingBottom="16dp" | |
82 | + android:layout_width="match_parent" | |
83 | + android:layout_height="wrap_content"> | |
84 | + <TextView | |
85 | + android:id="@+id/btnConfirm" | |
86 | + android:text="作业全对" | |
87 | + android:textSize="16sp" | |
88 | + android:textColor="@color/white" | |
89 | + android:gravity="center" | |
90 | + android:layout_gravity="center" | |
91 | + android:background="@drawable/shape_radius_5" | |
92 | + android:backgroundTint="#4ABC78" | |
93 | + android:layout_width="265dp" | |
94 | + android:layout_height="36dp"/> | |
95 | + </FrameLayout> | |
96 | +</LinearLayout> | |
0 | 97 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/item_homework_detail.xml
... | ... | @@ -0,0 +1,51 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<LinearLayout | |
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | |
4 | + xmlns:tools="http://schemas.android.com/tools" | |
5 | + android:orientation="vertical" | |
6 | + android:background="@drawable/shape_radius_10" | |
7 | + android:backgroundTint="@color/white" | |
8 | + android:paddingVertical="14dp" | |
9 | + android:layout_marginHorizontal="16dp" | |
10 | + android:layout_marginVertical="8dp" | |
11 | + android:layout_width="match_parent" | |
12 | + android:layout_height="wrap_content" | |
13 | + tools:ignore="SmallSp"> | |
14 | + | |
15 | + <LinearLayout | |
16 | + android:orientation="horizontal" | |
17 | + android:gravity="center_vertical" | |
18 | + android:layout_marginStart="16dp" | |
19 | + android:layout_width="match_parent" | |
20 | + android:layout_height="wrap_content"> | |
21 | + <CheckBox | |
22 | + android:id="@+id/checkbox" | |
23 | + android:visibility="gone" | |
24 | + tools:visibility="visible" | |
25 | + android:button="@drawable/chk_circle" | |
26 | + android:layout_marginEnd="5dp" | |
27 | + android:layout_width="16dp" | |
28 | + android:layout_height="16dp"/> | |
29 | + <TextView | |
30 | + android:id="@+id/tvNumber" | |
31 | + tools:text="第1题" | |
32 | + android:textSize="9sp" | |
33 | + android:textColor="#333" | |
34 | + android:paddingHorizontal="7dp" | |
35 | + android:paddingVertical="3dp" | |
36 | + android:background="@drawable/shape_radius_5" | |
37 | + android:backgroundTint="#F2F2F2" | |
38 | + android:layout_width="wrap_content" | |
39 | + android:layout_height="wrap_content" /> | |
40 | + </LinearLayout> | |
41 | + | |
42 | + <ImageView | |
43 | + android:id="@+id/ivTopic" | |
44 | + android:adjustViewBounds="true" | |
45 | + android:layout_marginStart="10dp" | |
46 | + android:layout_marginEnd="4dp" | |
47 | + android:layout_marginTop="14dp" | |
48 | + android:layout_width="match_parent" | |
49 | + android:layout_height="wrap_content" | |
50 | + android:importantForAccessibility="no" /> | |
51 | +</LinearLayout> | |
0 | 52 | \ No newline at end of file | ... | ... |
libs/common/src/main/java/com/prws/common/bean/homework/HomeWork.java
... | ... | @@ -0,0 +1,21 @@ |
1 | +package com.prws.common.bean.homework; | |
2 | + | |
3 | +import com.google.gson.annotations.SerializedName; | |
4 | + | |
5 | +import java.io.Serializable; | |
6 | + | |
7 | +public class HomeWork implements Serializable { | |
8 | + | |
9 | + @SerializedName(value = "homeworkId", alternate = "id") | |
10 | + public Integer homeworkId; | |
11 | + public String brief; | |
12 | + public String url; | |
13 | + public String analyseUrl; | |
14 | + public String analyseVideoUrl; | |
15 | + public Integer correction; | |
16 | + public String answer; | |
17 | + public String points; | |
18 | + | |
19 | + public boolean check = false; | |
20 | + | |
21 | +} | ... | ... |
libs/common/src/main/java/com/prws/common/bean/homework/HomeworkList.java
... | ... | @@ -2,11 +2,12 @@ package com.prws.common.bean.homework; |
2 | 2 | |
3 | 3 | import com.google.gson.annotations.SerializedName; |
4 | 4 | |
5 | +import java.io.Serializable; | |
5 | 6 | import java.text.SimpleDateFormat; |
6 | 7 | import java.util.Date; |
7 | 8 | import java.util.Locale; |
8 | 9 | |
9 | -public class HomeworkList implements Comparable<HomeworkList> { | |
10 | +public class HomeworkList implements Comparable<HomeworkList>, Serializable { | |
10 | 11 | |
11 | 12 | @SerializedName(value = "homeworkId", alternate = "id") |
12 | 13 | private String homeworkId; |
... | ... | @@ -97,10 +98,10 @@ public class HomeworkList implements Comparable<HomeworkList> { |
97 | 98 | } |
98 | 99 | |
99 | 100 | private String time; |
100 | - private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); | |
101 | 101 | public String getFormatTime() { |
102 | 102 | if (uploadTime == null) return ""; |
103 | 103 | if (time != null) return time; |
104 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); | |
104 | 105 | time = format.format(uploadTime); |
105 | 106 | return time; |
106 | 107 | } | ... | ... |
libs/common/src/main/java/com/prws/common/net/NetWorks.java
... | ... | @@ -14,6 +14,7 @@ import com.prws.common.bean.Teacher; |
14 | 14 | import com.prws.common.bean.TopicBean; |
15 | 15 | import com.prws.common.bean.UpdateBean; |
16 | 16 | import com.prws.common.bean.baidu.BaiduInput; |
17 | +import com.prws.common.bean.homework.HomeWork; | |
17 | 18 | import com.prws.common.bean.homework.HomeworkList; |
18 | 19 | import com.prws.common.utils.BitmapUtils; |
19 | 20 | import com.prws.common.utils.SharedPreferencesUtil; |
... | ... | @@ -198,6 +199,9 @@ public class NetWorks extends RetrofitUtils { |
198 | 199 | @Query("homeworkId") String homeworkId |
199 | 200 | ); |
200 | 201 | |
202 | + @GET("api/v1/homework/listHomeworkById") | |
203 | + Single<ResponseResult<List<HomeWork>>> getHomeworkDetail(@Header("Authorization") String token, @Query("homeworkId") String homeworkId); | |
204 | + | |
201 | 205 | } |
202 | 206 | |
203 | 207 | public static String getUserId() { | ... | ... |