Commit b49795b72f73aba8822f002ab66242c91cf053cd
1 parent
6c927b5aa1
Exists in
master
作业反馈
Showing
11 changed files
with
86 additions
and
28 deletions
Show diff stats
.idea/deploymentTargetDropDown.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <project version="4"> | 2 | <project version="4"> |
| 3 | <component name="deploymentTargetDropDown"> | 3 | <component name="deploymentTargetDropDown"> |
| 4 | <value> | 4 | <value> |
| 5 | <entry key="app"> | 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:39671" /> | ||
| 14 | </Key> | ||
| 15 | </deviceKey> | ||
| 16 | </Target> | ||
| 17 | </runningDeviceTargetSelectedWithDropDown> | ||
| 18 | <timeTargetWasSelectedWithDropDown value="2024-09-29T02:03:12.057655600Z" /> | ||
| 19 | </State> | ||
| 20 | </entry> | 7 | </entry> |
| 21 | </value> | 8 | </value> |
| 22 | </component> | 9 | </component> |
| 23 | </project> | 10 | </project> |
app/src/main/AndroidManifest.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:tools="http://schemas.android.com/tools" | 3 | xmlns:tools="http://schemas.android.com/tools" |
| 4 | package="com.hjx.parent"> | 4 | package="com.hjx.parent"> |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> | 7 | <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> |
| 8 | <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <!-- 允许程序改变网络链接状态 --> | 8 | <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <!-- 允许程序改变网络链接状态 --> |
| 9 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 允许程序访问访问WIFI网络状态信息 --> | 9 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 允许程序访问访问WIFI网络状态信息 --> |
| 10 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 允许程序改变WIFI链接状态 --> | 10 | <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 允许程序改变WIFI链接状态 --> |
| 11 | <!-- 6.0系统需要添加权限才能获得wifi列表 --> | 11 | <!-- 6.0系统需要添加权限才能获得wifi列表 --> |
| 12 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | 12 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> |
| 13 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | 13 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
| 14 | <uses-permission android:name="android.permission.INTERNET" /> | 14 | <uses-permission android:name="android.permission.INTERNET" /> |
| 15 | <uses-permission android:name="android.permission.RECORD_AUDIO" /> | 15 | <uses-permission android:name="android.permission.RECORD_AUDIO" /> |
| 16 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 16 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
| 17 | 17 | ||
| 18 | <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> | 18 | <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> |
| 19 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 19 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
| 20 | <uses-permission android:name="android.permission.WAKE_LOCK" /> | 20 | <uses-permission android:name="android.permission.WAKE_LOCK" /> |
| 21 | <uses-permission android:name="android.permission.CAMERA" /> | 21 | <uses-permission android:name="android.permission.CAMERA" /> |
| 22 | <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | 22 | <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> |
| 23 | <uses-permission android:name="android.permission.VIBRATE" /> | 23 | <uses-permission android:name="android.permission.VIBRATE" /> |
| 24 | <uses-permission | 24 | <uses-permission |
| 25 | android:name="android.permission.WRITE_EXTERNAL_STORAGE" | 25 | android:name="android.permission.WRITE_EXTERNAL_STORAGE" |
| 26 | tools:ignore="ScopedStorage" /> | 26 | tools:ignore="ScopedStorage" /> |
| 27 | <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> | 27 | <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> |
| 28 | <uses-permission android:name="android.permission.GET_PACKAGE_SIZE" /> | 28 | <uses-permission android:name="android.permission.GET_PACKAGE_SIZE" /> |
| 29 | 29 | ||
| 30 | <uses-permission | 30 | <uses-permission |
| 31 | android:name="android.permission.MANAGE_EXTERNAL_STORAGE" | 31 | android:name="android.permission.MANAGE_EXTERNAL_STORAGE" |
| 32 | tools:ignore="ScopedStorage" /> | 32 | tools:ignore="ScopedStorage" /> |
| 33 | 33 | ||
| 34 | <application | 34 | <application |
| 35 | android:name=".App" | 35 | android:name=".App" |
| 36 | android:allowBackup="true" | 36 | android:allowBackup="true" |
| 37 | android:icon="@mipmap/icon" | 37 | android:icon="@mipmap/icon" |
| 38 | android:label="@string/app_name" | 38 | android:label="@string/app_name" |
| 39 | android:networkSecurityConfig="@xml/network_security_config" | 39 | android:networkSecurityConfig="@xml/network_security_config" |
| 40 | android:supportsRtl="true" | 40 | android:supportsRtl="true" |
| 41 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> | 41 | android:theme="@style/Theme.AppCompat.Light.NoActionBar"> |
| 42 | <activity | 42 | <activity |
| 43 | android:name=".LoginActivity" | 43 | android:name=".LoginActivity" |
| 44 | android:exported="true" | 44 | android:exported="true" |
| 45 | android:screenOrientation="portrait" | 45 | android:screenOrientation="portrait" |
| 46 | android:theme="@style/ThemeSplash"> | 46 | android:theme="@style/ThemeSplash"> |
| 47 | <intent-filter> | 47 | <intent-filter> |
| 48 | <action android:name="android.intent.action.MAIN" /> | 48 | <action android:name="android.intent.action.MAIN" /> |
| 49 | <category android:name="android.intent.category.LAUNCHER" /> | 49 | <category android:name="android.intent.category.LAUNCHER" /> |
| 50 | </intent-filter> | 50 | </intent-filter> |
| 51 | </activity> | 51 | </activity> |
| 52 | <activity | 52 | <activity |
| 53 | android:name=".MainActivity" | 53 | android:name=".MainActivity" |
| 54 | android:launchMode="singleTask" | 54 | android:launchMode="singleTask" |
| 55 | android:screenOrientation="portrait" | 55 | android:screenOrientation="portrait" |
| 56 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 56 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 57 | <activity | 57 | <activity |
| 58 | android:name=".RegisterActivity" | 58 | android:name=".RegisterActivity" |
| 59 | android:screenOrientation="portrait" | 59 | android:screenOrientation="portrait" |
| 60 | android:theme="@style/ThemeSplash" /> | 60 | android:theme="@style/ThemeSplash" /> |
| 61 | <activity | 61 | <activity |
| 62 | android:name=".UserActivity" | 62 | android:name=".UserActivity" |
| 63 | android:screenOrientation="portrait" | 63 | android:screenOrientation="portrait" |
| 64 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 64 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 65 | <activity | 65 | <activity |
| 66 | android:name=".YinsiActivity" | 66 | android:name=".YinsiActivity" |
| 67 | android:screenOrientation="portrait" | 67 | android:screenOrientation="portrait" |
| 68 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 68 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 69 | <activity | 69 | <activity |
| 70 | android:name=".QRActivity" | 70 | android:name=".QRActivity" |
| 71 | android:screenOrientation="portrait" | 71 | android:screenOrientation="portrait" |
| 72 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 72 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 73 | <activity | 73 | <activity |
| 74 | android:name=".AddStudentActivity" | 74 | android:name=".AddStudentActivity" |
| 75 | android:screenOrientation="portrait" | 75 | android:screenOrientation="portrait" |
| 76 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 76 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 77 | <activity | 77 | <activity |
| 78 | android:name=".NickActivity" | 78 | android:name=".NickActivity" |
| 79 | android:screenOrientation="portrait" | 79 | android:screenOrientation="portrait" |
| 80 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 80 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 81 | <activity | 81 | <activity |
| 82 | android:name=".SexActivity" | 82 | android:name=".SexActivity" |
| 83 | android:screenOrientation="portrait" | 83 | android:screenOrientation="portrait" |
| 84 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 84 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 85 | <activity | 85 | <activity |
| 86 | android:name=".NianActivity" | 86 | android:name=".NianActivity" |
| 87 | android:screenOrientation="portrait" | 87 | android:screenOrientation="portrait" |
| 88 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 88 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 89 | <activity | 89 | <activity |
| 90 | android:name=".ShenActivity" | 90 | android:name=".ShenActivity" |
| 91 | android:screenOrientation="portrait" | 91 | android:screenOrientation="portrait" |
| 92 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 92 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 93 | <activity | 93 | <activity |
| 94 | android:name=".UserAgreementActivity" | 94 | android:name=".UserAgreementActivity" |
| 95 | android:screenOrientation="portrait" | 95 | android:screenOrientation="portrait" |
| 96 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 96 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 97 | <activity | 97 | <activity |
| 98 | android:name=".AccountActivity" | 98 | android:name=".AccountActivity" |
| 99 | android:screenOrientation="portrait" | 99 | android:screenOrientation="portrait" |
| 100 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 100 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 101 | 101 | ||
| 102 | <activity | 102 | <activity |
| 103 | android:name=".ChangePwdActivity" | 103 | android:name=".ChangePwdActivity" |
| 104 | android:screenOrientation="portrait" | 104 | android:screenOrientation="portrait" |
| 105 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 105 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 106 | <activity | 106 | <activity |
| 107 | android:name=".EditStudentActivity" | 107 | android:name=".EditStudentActivity" |
| 108 | android:screenOrientation="portrait" | 108 | android:screenOrientation="portrait" |
| 109 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 109 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 110 | <activity | 110 | <activity |
| 111 | android:name=".ChooseActivity" | 111 | android:name=".ChooseActivity" |
| 112 | android:screenOrientation="portrait" | 112 | android:screenOrientation="portrait" |
| 113 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 113 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 114 | <activity | 114 | <activity |
| 115 | android:name=".AddTeacherActivity" | 115 | android:name=".AddTeacherActivity" |
| 116 | android:screenOrientation="portrait" | 116 | android:screenOrientation="portrait" |
| 117 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 117 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 118 | <activity | 118 | <activity |
| 119 | android:name=".ErrorBookActivity" | 119 | android:name=".ErrorBookActivity" |
| 120 | android:screenOrientation="portrait" | 120 | android:screenOrientation="portrait" |
| 121 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 121 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 122 | <activity | 122 | <activity |
| 123 | android:name=".ImageActivity" | 123 | android:name=".ImageActivity" |
| 124 | android:screenOrientation="portrait" | 124 | android:screenOrientation="portrait" |
| 125 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 125 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 126 | <activity | 126 | <activity |
| 127 | android:name=".ImageEditActivity" | 127 | android:name=".ImageEditActivity" |
| 128 | android:screenOrientation="portrait" | 128 | android:screenOrientation="portrait" |
| 129 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 129 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 130 | <activity | 130 | <activity |
| 131 | android:name=".ImageSelectActivity" | 131 | android:name=".ImageSelectActivity" |
| 132 | android:screenOrientation="portrait" | 132 | android:screenOrientation="portrait" |
| 133 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 133 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 134 | <activity | 134 | <activity |
| 135 | android:name=".AddSuccessActivity" | 135 | android:name=".AddSuccessActivity" |
| 136 | android:screenOrientation="portrait" | 136 | android:screenOrientation="portrait" |
| 137 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 137 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 138 | <activity | 138 | <activity |
| 139 | android:name=".ErrorListActivity" | 139 | android:name=".ErrorListActivity" |
| 140 | android:screenOrientation="portrait" | 140 | android:screenOrientation="portrait" |
| 141 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 141 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 142 | <activity | 142 | <activity |
| 143 | android:name=".ErrorDetailActivity" | 143 | android:name=".ErrorDetailActivity" |
| 144 | android:screenOrientation="portrait" | 144 | android:screenOrientation="portrait" |
| 145 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 145 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 146 | <activity | 146 | <activity |
| 147 | android:name=".TeacherChooseActivity" | 147 | android:name=".TeacherChooseActivity" |
| 148 | android:screenOrientation="portrait" | 148 | android:screenOrientation="portrait" |
| 149 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 149 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 150 | <activity | 150 | <activity |
| 151 | android:name=".TeacherMainActivity" | 151 | android:name=".TeacherMainActivity" |
| 152 | android:screenOrientation="portrait" | 152 | android:screenOrientation="portrait" |
| 153 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 153 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 154 | <activity android:name=".StuHomeworkActivity" /> | 154 | <activity android:name=".StuHomeworkActivity" /> |
| 155 | <activity android:name=".HomeworkDetailActivity" /> | 155 | <activity android:name=".HomeworkDetailActivity" /> |
| 156 | <activity android:name=".HomeworkSelectActivity" /> | 156 | <activity android:name=".HomeworkSelectActivity" /> |
| 157 | <activity android:name=".HomeworkFeedbackActivity" /> | ||
| 157 | 158 | ||
| 158 | <provider | 159 | <provider |
| 159 | android:name="androidx.core.content.FileProvider" | 160 | android:name="androidx.core.content.FileProvider" |
| 160 | android:authorities="com.hjx.parent.fileprovider" | 161 | android:authorities="com.hjx.parent.fileprovider" |
| 161 | android:exported="false" | 162 | android:exported="false" |
| 162 | android:grantUriPermissions="true" | 163 | android:grantUriPermissions="true" |
| 163 | tools:replace="android:authorities"> | 164 | tools:replace="android:authorities"> |
| 164 | <meta-data | 165 | <meta-data |
| 165 | android:name="android.support.FILE_PROVIDER_PATHS" | 166 | android:name="android.support.FILE_PROVIDER_PATHS" |
| 166 | android:resource="@xml/file_provider_paths" | 167 | android:resource="@xml/file_provider_paths" |
| 167 | tools:replace="android:resource" /> | 168 | tools:replace="android:resource" /> |
| 168 | </provider> | 169 | </provider> |
| 169 | </application> | 170 | </application> |
| 170 | 171 | ||
| 171 | </manifest> | 172 | </manifest> |
app/src/main/java/com/hjx/parent/HomeworkDetailActivity.java
| 1 | package com.hjx.parent; | 1 | package com.hjx.parent; |
| 2 | 2 | ||
| 3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
| 4 | import android.content.Intent; | 4 | import android.content.Intent; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.widget.ImageView; | 6 | import android.widget.ImageView; |
| 7 | import android.widget.TextView; | 7 | import android.widget.TextView; |
| 8 | 8 | ||
| 9 | import androidx.annotation.NonNull; | 9 | import androidx.annotation.NonNull; |
| 10 | 10 | ||
| 11 | import com.bumptech.glide.Glide; | 11 | import com.bumptech.glide.Glide; |
| 12 | import com.chad.library.adapter.base.BaseQuickAdapter; | 12 | import com.chad.library.adapter.base.BaseQuickAdapter; |
| 13 | import com.chad.library.adapter.base.BaseViewHolder; | 13 | import com.chad.library.adapter.base.BaseViewHolder; |
| 14 | import com.google.gson.Gson; | ||
| 15 | import com.hjx.parent.databinding.ActivityHomeworkDetailBinding; | 14 | import com.hjx.parent.databinding.ActivityHomeworkDetailBinding; |
| 16 | import com.hjx.parent.rx.BaseRxActivity; | 15 | import com.hjx.parent.rx.BaseRxActivity; |
| 17 | import com.prws.common.bean.ResponseResult; | 16 | import com.prws.common.bean.ResponseResult; |
| 17 | import com.prws.common.bean.Student; | ||
| 18 | import com.prws.common.bean.homework.HomeWork; | 18 | import com.prws.common.bean.homework.HomeWork; |
| 19 | import com.prws.common.bean.homework.HomeworkList; | 19 | import com.prws.common.bean.homework.HomeworkList; |
| 20 | import com.prws.common.net.NetWorks; | 20 | import com.prws.common.net.NetWorks; |
| 21 | 21 | ||
| 22 | import java.util.ArrayList; | 22 | import java.util.ArrayList; |
| 23 | 23 | ||
| 24 | public class HomeworkDetailActivity extends BaseRxActivity<ActivityHomeworkDetailBinding> { | 24 | public class HomeworkDetailActivity extends BaseRxActivity<ActivityHomeworkDetailBinding> { |
| 25 | 25 | ||
| 26 | private HomeworkList mData; | 26 | private HomeworkList mData; |
| 27 | private Student student; | ||
| 27 | 28 | ||
| 28 | private Adapter mAdapter = new Adapter(); | 29 | private Adapter mAdapter = new Adapter(); |
| 29 | 30 | ||
| 30 | @Override | 31 | @Override |
| 31 | public void initView(Bundle savedInstanceState) { | 32 | public void initView(Bundle savedInstanceState) { |
| 32 | binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); | 33 | binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); |
| 33 | String json = getIntent().getStringExtra("data"); | 34 | mData = (HomeworkList) getIntent().getSerializableExtra("data"); |
| 34 | mData = new Gson().fromJson(json, HomeworkList.class); | 35 | student = (Student) getIntent().getSerializableExtra("student"); |
| 35 | binding.tvTitle.setText(mData.getName()); | 36 | binding.tvTitle.setText(mData.getName()); |
| 36 | 37 | ||
| 37 | binding.recyclerView.setAdapter(mAdapter); | 38 | binding.recyclerView.setAdapter(mAdapter); |
| 38 | getDetail(); | 39 | getDetail(); |
| 39 | 40 | ||
| 40 | binding.btnFeedback.setOnClickListener(v -> { | 41 | binding.btnFeedback.setOnClickListener(v -> { |
| 42 | if (mAdapter.getData().size() == 0) return; | ||
| 41 | Intent intent = new Intent(this, HomeworkSelectActivity.class); | 43 | Intent intent = new Intent(this, HomeworkSelectActivity.class); |
| 42 | intent.putExtra("data", mData); | 44 | intent.putExtra("data", mData); |
| 45 | intent.putExtra("student", student); | ||
| 43 | intent.putExtra("list", new ArrayList<>(mAdapter.getData())); | 46 | intent.putExtra("list", new ArrayList<>(mAdapter.getData())); |
| 44 | startActivity(intent); | 47 | startActivity(intent); |
| 45 | }); | 48 | }); |
| 46 | } | 49 | } |
| 47 | 50 | ||
| 48 | @SuppressLint("CheckResult") | 51 | @SuppressLint("CheckResult") |
| 49 | private void getDetail() { | 52 | private void getDetail() { |
| 50 | NetWorks.service_url.getHomeworkDetail(NetWorks.getHeader(), mData.getId()) | 53 | NetWorks.service_url.getHomeworkDetail(NetWorks.getHeader(), mData.getId()) |
| 51 | .compose(transformSingle()) | 54 | .compose(transformSingle()) |
| 52 | .map(ResponseResult::getData) | 55 | .map(ResponseResult::getData) |
| 53 | .subscribe((list, th) -> { | 56 | .subscribe((list, th) -> { |
| 54 | if (th != null) th.printStackTrace(); | 57 | if (th != null) th.printStackTrace(); |
| 55 | mAdapter.setNewData(list); | 58 | mAdapter.setNewData(list); |
| 56 | }); | 59 | }); |
| 57 | } | 60 | } |
| 58 | 61 | ||
| 59 | @Override | 62 | @Override |
| 60 | protected ActivityHomeworkDetailBinding getViewBinding() { | 63 | protected ActivityHomeworkDetailBinding getViewBinding() { |
| 61 | return ActivityHomeworkDetailBinding.inflate(getLayoutInflater()); | 64 | return ActivityHomeworkDetailBinding.inflate(getLayoutInflater()); |
| 62 | } | 65 | } |
| 63 | 66 | ||
| 64 | static class Adapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { | 67 | static class Adapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { |
| 65 | 68 | ||
| 66 | public Adapter() { | 69 | public Adapter() { |
| 67 | super(R.layout.item_homework_detail); | 70 | super(R.layout.item_homework_detail); |
| 68 | } | 71 | } |
| 69 | 72 | ||
| 70 | @SuppressLint("SetTextI18n") | 73 | @SuppressLint("SetTextI18n") |
| 71 | @Override | 74 | @Override |
| 72 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { | 75 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { |
| 73 | TextView tvNumber = holder.getView(R.id.tvNumber); | 76 | TextView tvNumber = holder.getView(R.id.tvNumber); |
| 74 | ImageView imageView = holder.getView(R.id.ivTopic); | 77 | ImageView imageView = holder.getView(R.id.ivTopic); |
| 75 | int number = getData().indexOf(homeWork) + 1; | 78 | int number = getData().indexOf(homeWork) + 1; |
| 76 | tvNumber.setText("第" + number + "题"); | 79 | tvNumber.setText("第" + number + "题"); |
| 77 | Glide.with(mContext).load(homeWork.url).into(imageView); | 80 | Glide.with(mContext).load(homeWork.url).into(imageView); |
| 78 | } | 81 | } |
| 79 | } | 82 | } |
| 80 | } | 83 | } |
app/src/main/java/com/hjx/parent/HomeworkFeedbackActivity.java
| File was created | 1 | package com.hjx.parent; | |
| 2 | |||
| 3 | import android.os.Bundle; | ||
| 4 | |||
| 5 | import com.hjx.parent.databinding.ActivityHomeworkFeedbackBinding; | ||
| 6 | import com.hjx.parent.rx.BaseRxActivity; | ||
| 7 | import com.prws.common.bean.Student; | ||
| 8 | import com.prws.common.bean.homework.HomeWork; | ||
| 9 | import com.prws.common.bean.homework.HomeworkList; | ||
| 10 | |||
| 11 | import java.text.DecimalFormat; | ||
| 12 | import java.util.ArrayList; | ||
| 13 | |||
| 14 | public class HomeworkFeedbackActivity extends BaseRxActivity<ActivityHomeworkFeedbackBinding> { | ||
| 15 | private Student student; | ||
| 16 | private HomeworkList mData; | ||
| 17 | private ArrayList<HomeWork> mList; | ||
| 18 | |||
| 19 | @SuppressWarnings("unchecked") | ||
| 20 | @Override | ||
| 21 | public void initView(Bundle savedInstanceState) { | ||
| 22 | binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); | ||
| 23 | student = (Student) getIntent().getSerializableExtra("student"); | ||
| 24 | mData = (HomeworkList) getIntent().getSerializableExtra("data"); | ||
| 25 | mList = (ArrayList<HomeWork>) getIntent().getSerializableExtra("list"); | ||
| 26 | |||
| 27 | binding.tvStuName.setText(student.stuName); | ||
| 28 | binding.tvGrade.setText(student.grade); | ||
| 29 | |||
| 30 | int correctNo = 0; | ||
| 31 | for (HomeWork homeWork: mList) { | ||
| 32 | homeWork.homeworkId = mData.getId(); | ||
| 33 | if (!homeWork.check) correctNo ++; | ||
| 34 | } | ||
| 35 | binding.tvPercent.setText(new DecimalFormat("0%").format(1f * correctNo / mList.size())); | ||
| 36 | } | ||
| 37 | |||
| 38 | @Override | ||
| 39 | protected ActivityHomeworkFeedbackBinding getViewBinding() { | ||
| 40 | return ActivityHomeworkFeedbackBinding.inflate(getLayoutInflater()); | ||
| 41 | } | ||
| 42 | } | ||
| 43 |
app/src/main/java/com/hjx/parent/HomeworkSelectActivity.java
| 1 | package com.hjx.parent; | 1 | package com.hjx.parent; |
| 2 | 2 | ||
| 3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
| 4 | import android.content.Intent; | ||
| 4 | import android.content.res.ColorStateList; | 5 | import android.content.res.ColorStateList; |
| 5 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 6 | import android.view.View; | 7 | import android.view.View; |
| 7 | import android.widget.CheckBox; | 8 | import android.widget.CheckBox; |
| 8 | import android.widget.ImageView; | 9 | import android.widget.ImageView; |
| 9 | import android.widget.TextView; | 10 | import android.widget.TextView; |
| 10 | 11 | ||
| 11 | import androidx.annotation.NonNull; | 12 | import androidx.annotation.NonNull; |
| 12 | import androidx.lifecycle.MutableLiveData; | 13 | import androidx.lifecycle.MutableLiveData; |
| 13 | 14 | ||
| 14 | import com.bumptech.glide.Glide; | 15 | import com.bumptech.glide.Glide; |
| 15 | import com.chad.library.adapter.base.BaseQuickAdapter; | 16 | import com.chad.library.adapter.base.BaseQuickAdapter; |
| 16 | import com.chad.library.adapter.base.BaseViewHolder; | 17 | import com.chad.library.adapter.base.BaseViewHolder; |
| 17 | import com.hjx.parent.databinding.ActivityHomeworkSelectBinding; | 18 | import com.hjx.parent.databinding.ActivityHomeworkSelectBinding; |
| 18 | import com.hjx.parent.function.Function1; | 19 | import com.hjx.parent.function.Function1; |
| 19 | import com.hjx.parent.rx.BaseRxActivity; | 20 | import com.hjx.parent.rx.BaseRxActivity; |
| 21 | import com.prws.common.bean.Student; | ||
| 20 | import com.prws.common.bean.homework.HomeWork; | 22 | import com.prws.common.bean.homework.HomeWork; |
| 21 | import com.prws.common.bean.homework.HomeworkList; | 23 | import com.prws.common.bean.homework.HomeworkList; |
| 22 | 24 | ||
| 23 | import java.util.ArrayList; | 25 | import java.util.ArrayList; |
| 24 | 26 | ||
| 25 | public class HomeworkSelectActivity extends BaseRxActivity<ActivityHomeworkSelectBinding> { | 27 | public class HomeworkSelectActivity extends BaseRxActivity<ActivityHomeworkSelectBinding> { |
| 26 | 28 | ||
| 29 | private Student student; | ||
| 27 | private HomeworkList mData; | 30 | private HomeworkList mData; |
| 28 | private ArrayList<HomeWork> mList; | 31 | private ArrayList<HomeWork> mList; |
| 29 | private Adapter mAdapter = new Adapter(); | 32 | private Adapter mAdapter = new Adapter(); |
| 30 | 33 | ||
| 31 | MutableLiveData<Integer> selectNum = new MutableLiveData<>(0); | 34 | MutableLiveData<Integer> selectNum = new MutableLiveData<>(0); |
| 32 | 35 | ||
| 33 | @SuppressLint("NotifyDataSetChanged") | 36 | @SuppressLint("NotifyDataSetChanged") |
| 34 | @SuppressWarnings("unchecked,ConstantConditions") | 37 | @SuppressWarnings("unchecked,ConstantConditions") |
| 35 | @Override | 38 | @Override |
| 36 | public void initView(Bundle savedInstanceState) { | 39 | public void initView(Bundle savedInstanceState) { |
| 37 | binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); | 40 | binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); |
| 41 | student = (Student) getIntent().getSerializableExtra("student"); | ||
| 38 | mData = (HomeworkList) getIntent().getSerializableExtra("data"); | 42 | mData = (HomeworkList) getIntent().getSerializableExtra("data"); |
| 39 | mList = (ArrayList<HomeWork>) getIntent().getSerializableExtra("list"); | 43 | mList = (ArrayList<HomeWork>) getIntent().getSerializableExtra("list"); |
| 40 | 44 | ||
| 41 | mAdapter.setNewData(mList); | 45 | mAdapter.setNewData(mList); |
| 42 | binding.recyclerView.setAdapter(mAdapter); | 46 | binding.recyclerView.setAdapter(mAdapter); |
| 43 | 47 | ||
| 44 | mAdapter.selectCall = i -> selectNum.setValue(selectNum.getValue() + i); | 48 | mAdapter.selectCall = i -> selectNum.setValue(selectNum.getValue() + i); |
| 45 | selectNum.observe(this, i -> { | 49 | selectNum.observe(this, i -> { |
| 46 | binding.tvNumber.setText(String.valueOf(i)); | 50 | binding.tvNumber.setText(String.valueOf(i)); |
| 47 | if (i == 0) { | 51 | if (i == 0) { |
| 48 | binding.btnConfirm.setText("作业全对"); | 52 | binding.btnConfirm.setText("作业全对"); |
| 49 | binding.btnConfirm.setBackgroundTintList(ColorStateList.valueOf(0xFF4ABC78)); | 53 | binding.btnConfirm.setBackgroundTintList(ColorStateList.valueOf(0xFF4ABC78)); |
| 50 | } else { | 54 | } else { |
| 51 | binding.btnConfirm.setText("下一步"); | 55 | binding.btnConfirm.setText("下一步"); |
| 52 | binding.btnConfirm.setBackgroundTintList(ColorStateList.valueOf(0xFF1C90F3)); | 56 | binding.btnConfirm.setBackgroundTintList(ColorStateList.valueOf(0xFF1C90F3)); |
| 53 | } | 57 | } |
| 54 | binding.chkAll.setChecked(i == mList.size() && i != 0); | 58 | binding.chkAll.setChecked(i == mList.size() && i != 0); |
| 55 | }); | 59 | }); |
| 56 | 60 | ||
| 57 | binding.chkAll.setOnClickListener(v -> { | 61 | binding.chkAll.setOnClickListener(v -> { |
| 58 | if (mList.size() == 0) return; | 62 | if (mList.size() == 0) return; |
| 59 | boolean b = binding.chkAll.isChecked(); | 63 | boolean b = binding.chkAll.isChecked(); |
| 60 | for (HomeWork item: mList) { | 64 | for (HomeWork item: mList) { |
| 61 | item.check = b; | 65 | item.check = b; |
| 62 | } | 66 | } |
| 63 | selectNum.setValue(b ? mList.size() : 0); | 67 | selectNum.setValue(b ? mList.size() : 0); |
| 64 | mAdapter.notifyDataSetChanged(); | 68 | mAdapter.notifyDataSetChanged(); |
| 65 | }); | 69 | }); |
| 70 | |||
| 71 | binding.btnConfirm.setOnClickListener(v -> { | ||
| 72 | Intent intent = new Intent(this, HomeworkFeedbackActivity.class); | ||
| 73 | intent.putExtra("data", mData); | ||
| 74 | intent.putExtra("list", mList); | ||
| 75 | intent.putExtra("student", student); | ||
| 76 | startActivity(intent); | ||
| 77 | }); | ||
| 66 | } | 78 | } |
| 67 | 79 | ||
| 68 | @Override | 80 | @Override |
| 69 | protected ActivityHomeworkSelectBinding getViewBinding() { | 81 | protected ActivityHomeworkSelectBinding getViewBinding() { |
| 70 | return ActivityHomeworkSelectBinding.inflate(getLayoutInflater()); | 82 | return ActivityHomeworkSelectBinding.inflate(getLayoutInflater()); |
| 71 | } | 83 | } |
| 72 | 84 | ||
| 73 | 85 | ||
| 74 | static class Adapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { | 86 | static class Adapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { |
| 75 | public Adapter() { | 87 | public Adapter() { |
| 76 | super(R.layout.item_homework_detail); | 88 | super(R.layout.item_homework_detail); |
| 77 | } | 89 | } |
| 78 | public Function1<Integer> selectCall; | 90 | public Function1<Integer> selectCall; |
| 79 | 91 | ||
| 80 | @SuppressLint("SetTextI18n") | 92 | @SuppressLint("SetTextI18n") |
| 81 | @Override | 93 | @Override |
| 82 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { | 94 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { |
| 83 | TextView tvNumber = holder.getView(R.id.tvNumber); | 95 | TextView tvNumber = holder.getView(R.id.tvNumber); |
| 84 | ImageView imageView = holder.getView(R.id.ivTopic); | 96 | ImageView imageView = holder.getView(R.id.ivTopic); |
| 85 | int number = getData().indexOf(homeWork) + 1; | 97 | int number = getData().indexOf(homeWork) + 1; |
| 86 | tvNumber.setText("第" + number + "题"); | 98 | tvNumber.setText("第" + number + "题"); |
| 87 | Glide.with(mContext).load(homeWork.url).into(imageView); | 99 | Glide.with(mContext).load(homeWork.url).into(imageView); |
| 88 | 100 | ||
| 89 | CheckBox checkBox = holder.getView(R.id.checkbox); | 101 | CheckBox checkBox = holder.getView(R.id.checkbox); |
| 90 | checkBox.setVisibility(View.VISIBLE); | 102 | checkBox.setVisibility(View.VISIBLE); |
| 91 | checkBox.setOnCheckedChangeListener(null); | 103 | checkBox.setOnCheckedChangeListener(null); |
| 92 | checkBox.setChecked(homeWork.check); | 104 | checkBox.setChecked(homeWork.check); |
| 93 | 105 | ||
| 94 | holder.itemView.setOnClickListener(v -> checkBox.performClick()); | 106 | holder.itemView.setOnClickListener(v -> checkBox.performClick()); |
| 95 | checkBox.setOnCheckedChangeListener((v, b) -> { | 107 | checkBox.setOnCheckedChangeListener((v, b) -> { |
| 96 | homeWork.check = b; | 108 | homeWork.check = b; |
| 97 | if (selectCall != null) { | 109 | if (selectCall != null) { |
| 98 | selectCall.invoke(b ? 1 : -1); | 110 | selectCall.invoke(b ? 1 : -1); |
| 99 | } | 111 | } |
| 100 | }); | 112 | }); |
| 101 | } | 113 | } |
| 102 | } | 114 | } |
| 103 | } | 115 | } |
| 104 | 116 |
app/src/main/java/com/hjx/parent/StuHomeworkActivity.java
| 1 | package com.hjx.parent; | 1 | package com.hjx.parent; |
| 2 | 2 | ||
| 3 | import android.annotation.SuppressLint; | 3 | import android.annotation.SuppressLint; |
| 4 | import android.content.Intent; | ||
| 4 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 5 | import android.widget.LinearLayout; | 6 | import android.widget.LinearLayout; |
| 6 | import android.widget.PopupWindow; | 7 | import android.widget.PopupWindow; |
| 7 | 8 | ||
| 8 | import androidx.lifecycle.MutableLiveData; | 9 | import androidx.lifecycle.MutableLiveData; |
| 9 | 10 | ||
| 10 | import com.google.gson.Gson; | 11 | import com.google.gson.Gson; |
| 11 | import com.hjx.parent.adapter.HomeworkListAdapter; | 12 | import com.hjx.parent.adapter.HomeworkListAdapter; |
| 12 | import com.hjx.parent.databinding.ActivityStudentHomeworkBinding; | 13 | import com.hjx.parent.databinding.ActivityStudentHomeworkBinding; |
| 13 | import com.hjx.parent.databinding.PopupFilterFeedbackBinding; | 14 | import com.hjx.parent.databinding.PopupFilterFeedbackBinding; |
| 14 | import com.hjx.parent.databinding.PopupFilterGradeBinding; | 15 | import com.hjx.parent.databinding.PopupFilterGradeBinding; |
| 15 | import com.hjx.parent.databinding.PopupFilterSubjectBinding; | 16 | import com.hjx.parent.databinding.PopupFilterSubjectBinding; |
| 16 | import com.hjx.parent.databinding.PopupFilterTermBinding; | 17 | import com.hjx.parent.databinding.PopupFilterTermBinding; |
| 17 | import com.hjx.parent.dialog.MsgConfirmDialog; | 18 | import com.hjx.parent.dialog.MsgConfirmDialog; |
| 18 | import com.hjx.parent.rx.BaseRxActivity; | 19 | import com.hjx.parent.rx.BaseRxActivity; |
| 19 | import com.prws.common.bean.Student; | 20 | import com.prws.common.bean.Student; |
| 20 | import com.prws.common.bean.homework.HomeworkList; | 21 | import com.prws.common.bean.homework.HomeworkList; |
| 21 | import com.prws.common.net.NetWorks; | 22 | import com.prws.common.net.NetWorks; |
| 22 | import com.prws.common.utils.SharedPreferencesUtil; | 23 | import com.prws.common.utils.SharedPreferencesUtil; |
| 23 | import com.trello.rxlifecycle2.android.RxLifecycleAndroid; | 24 | import com.trello.rxlifecycle2.android.RxLifecycleAndroid; |
| 24 | 25 | ||
| 25 | import java.util.Collections; | 26 | import java.util.Collections; |
| 26 | 27 | ||
| 27 | import io.reactivex.Observable; | 28 | import io.reactivex.Observable; |
| 28 | import io.reactivex.android.schedulers.AndroidSchedulers; | 29 | import io.reactivex.android.schedulers.AndroidSchedulers; |
| 29 | import io.reactivex.schedulers.Schedulers; | 30 | import io.reactivex.schedulers.Schedulers; |
| 30 | 31 | ||
| 31 | public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkBinding> { | 32 | public class StuHomeworkActivity extends BaseRxActivity<ActivityStudentHomeworkBinding> { |
| 32 | 33 | ||
| 33 | private final HomeworkListAdapter homeworkAdapter = new HomeworkListAdapter(); | 34 | private final HomeworkListAdapter homeworkAdapter = new HomeworkListAdapter(); |
| 34 | 35 | ||
| 35 | PopupWindow subjectFilter, gradeFilter, termFilter, feedbackFilter; | 36 | PopupWindow subjectFilter, gradeFilter, termFilter, feedbackFilter; |
| 36 | MsgConfirmDialog deleteDialog; | 37 | MsgConfirmDialog deleteDialog; |
| 37 | State state = new State(); | 38 | State state = new State(); |
| 38 | 39 | ||
| 39 | private void handlerIntent() { | 40 | private void handlerIntent() { |
| 40 | String json = getIntent().getStringExtra("studentJson"); | 41 | String json = getIntent().getStringExtra("studentJson"); |
| 41 | if (json == null) json = (String) SharedPreferencesUtil.getData("student", ""); | 42 | if (json == null) json = (String) SharedPreferencesUtil.getData("student", ""); |
| 42 | try { state.student = new Gson().fromJson(json, Student.class); } | 43 | try { state.student = new Gson().fromJson(json, Student.class); } |
| 43 | catch (Throwable t) { t.printStackTrace(); } | 44 | catch (Throwable t) { t.printStackTrace(); } |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | @SuppressLint("SetTextI18n") | 47 | @SuppressLint("SetTextI18n") |
| 47 | @Override | 48 | @Override |
| 48 | public void initView(Bundle savedInstanceState) { | 49 | public void initView(Bundle savedInstanceState) { |
| 49 | handlerIntent(); | 50 | handlerIntent(); |
| 50 | if (state.student == null) { | 51 | if (state.student == null) { |
| 51 | finish(); | 52 | finish(); |
| 52 | return; | 53 | return; |
| 53 | } | 54 | } |
| 54 | binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); | 55 | binding.toolbar.setNavigationOnClickListener(v -> onBackPressed()); |
| 55 | binding.tvTitle.setText(state.student.stuName + "的全部作业"); | 56 | binding.tvTitle.setText(state.student.stuName + "的全部作业"); |
| 56 | 57 | ||
| 57 | binding.recyclerView.setAdapter(homeworkAdapter); | 58 | binding.recyclerView.setAdapter(homeworkAdapter); |
| 58 | getHomework(); | 59 | getHomework(); |
| 59 | 60 | ||
| 60 | binding.ftSubject.setOnClickListener(v -> showSubjectFilter()); | 61 | binding.ftSubject.setOnClickListener(v -> showSubjectFilter()); |
| 61 | binding.ftGrade.setOnClickListener(v -> showGradeFilter()); | 62 | binding.ftGrade.setOnClickListener(v -> showGradeFilter()); |
| 62 | binding.ftTerm.setOnClickListener(v -> showTermFilter()); | 63 | binding.ftTerm.setOnClickListener(v -> showTermFilter()); |
| 63 | binding.ftFeedback.setOnClickListener(v -> showFeedbackFilter()); | 64 | binding.ftFeedback.setOnClickListener(v -> showFeedbackFilter()); |
| 64 | homeworkAdapter.deleteCall = data -> { | 65 | homeworkAdapter.deleteCall = data -> { |
| 65 | if (deleteDialog == null) { | 66 | if (deleteDialog == null) { |
| 66 | deleteDialog = new MsgConfirmDialog.Builder(this) | 67 | deleteDialog = new MsgConfirmDialog.Builder(this) |
| 67 | .setMessage("确认要删除吗?一旦删除不可恢复") | 68 | .setMessage("确认要删除吗?一旦删除不可恢复") |
| 68 | .setPositive("暂不删除") | 69 | .setPositive("暂不删除") |
| 69 | .setNegative("确定删除") | 70 | .setNegative("确定删除") |
| 70 | .build(); | 71 | .build(); |
| 71 | } | 72 | } |
| 72 | deleteDialog.show(() -> { | 73 | deleteDialog.show(() -> { |
| 73 | deleteHomework(data); | 74 | deleteHomework(data); |
| 74 | return true; | 75 | return true; |
| 75 | }, null); | 76 | }, null); |
| 76 | }; | 77 | }; |
| 78 | homeworkAdapter.detailCall = data -> { | ||
| 79 | Intent intent = new Intent(this, HomeworkDetailActivity.class); | ||
| 80 | intent.putExtra("data", data); | ||
| 81 | intent.putExtra("student", state.student); | ||
| 82 | startActivity(intent); | ||
| 83 | }; | ||
| 77 | } | 84 | } |
| 78 | 85 | ||
| 79 | @SuppressLint("CheckResult") | 86 | @SuppressLint("CheckResult") |
| 80 | protected void deleteHomework(HomeworkList data) { | 87 | protected void deleteHomework(HomeworkList data) { |
| 81 | NetWorks.service_url.deleteHomework(NetWorks.getHeader(), data.getId()) | 88 | NetWorks.service_url.deleteHomework(NetWorks.getHeader(), data.getId()) |
| 82 | .subscribeOn(Schedulers.io()) | 89 | .subscribeOn(Schedulers.io()) |
| 83 | .observeOn(AndroidSchedulers.mainThread()) | 90 | .observeOn(AndroidSchedulers.mainThread()) |
| 84 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) | 91 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) |
| 85 | .subscribe((response, th) -> { | 92 | .subscribe((response, th) -> { |
| 86 | if (th != null) th.printStackTrace(); | 93 | if (th != null) th.printStackTrace(); |
| 87 | if (response != null && response.getSuccess()) { | 94 | if (response != null && response.getSuccess()) { |
| 88 | getHomework(); | 95 | getHomework(); |
| 89 | } | 96 | } |
| 90 | }); | 97 | }); |
| 91 | 98 | ||
| 92 | } | 99 | } |
| 93 | 100 | ||
| 94 | @SuppressLint("CheckResult") | 101 | @SuppressLint("CheckResult") |
| 95 | protected void getHomework() { | 102 | protected void getHomework() { |
| 96 | NetWorks.service_url.getStudentHomework(NetWorks.getHeader(), state.student.stuId) | 103 | NetWorks.service_url.getStudentHomework(NetWorks.getHeader(), state.student.stuId) |
| 97 | .subscribeOn(Schedulers.io()) | 104 | .subscribeOn(Schedulers.io()) |
| 98 | .observeOn(AndroidSchedulers.mainThread()) | 105 | .observeOn(AndroidSchedulers.mainThread()) |
| 99 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) | 106 | .compose(RxLifecycleAndroid.bindActivity(getRxLifecycle())) |
| 100 | .toObservable() | 107 | .toObservable() |
| 101 | .flatMap(response -> Observable.fromIterable(response.getData())) | 108 | .flatMap(response -> Observable.fromIterable(response.getData())) |
| 102 | // 过滤 | 109 | // 过滤 |
| 103 | .filter(data -> { // 学科 | 110 | .filter(data -> { // 学科 |
| 104 | String subject = state.subject.getValue(); | 111 | String subject = state.subject.getValue(); |
| 105 | if (subject == null || subject.isEmpty()) return true; | 112 | if (subject == null || subject.isEmpty()) return true; |
| 106 | else return subject.equals(data.getSubject()); | 113 | else return subject.equals(data.getSubject()); |
| 107 | }) | 114 | }) |
| 108 | .filter(data -> { // 年级 | 115 | .filter(data -> { // 年级 |
| 109 | String grade = state.grade.getValue(); | 116 | String grade = state.grade.getValue(); |
| 110 | if (grade == null || grade.isEmpty()) return true; | 117 | if (grade == null || grade.isEmpty()) return true; |
| 111 | else return grade.equals(data.getGrade()); | 118 | else return grade.equals(data.getGrade()); |
| 112 | }) | 119 | }) |
| 113 | .filter(data -> { // 学期 | 120 | .filter(data -> { // 学期 |
| 114 | String term = state.term.getValue(); | 121 | String term = state.term.getValue(); |
| 115 | if (term == null || term.isEmpty()) return true; | 122 | if (term == null || term.isEmpty()) return true; |
| 116 | else return term.equals(data.getTerm()); | 123 | else return term.equals(data.getTerm()); |
| 117 | }) | 124 | }) |
| 118 | .filter(data -> { // 反馈 | 125 | .filter(data -> { // 反馈 |
| 119 | Integer feedback = state.feedback.getValue(); | 126 | Integer feedback = state.feedback.getValue(); |
| 120 | if (feedback == null || feedback == 0) return true; | 127 | if (feedback == null || feedback == 0) return true; |
| 121 | else return (feedback == 1 && data.getRight() != null) || (feedback == 2 && data.getRight() == null); | 128 | else return (feedback == 1 && data.getRight() != null) || (feedback == 2 && data.getRight() == null); |
| 122 | }) | 129 | }) |
| 123 | // 过滤完成, 收集 | 130 | // 过滤完成, 收集 |
| 124 | .toList() | 131 | .toList() |
| 125 | .subscribe((data, th) -> { | 132 | .subscribe((data, th) -> { |
| 126 | if (th != null) th.printStackTrace(); | 133 | if (th != null) th.printStackTrace(); |
| 127 | if (data != null) { | 134 | if (data != null) { |
| 128 | Collections.sort(data); | 135 | Collections.sort(data); |
| 129 | } | 136 | } |
| 130 | homeworkAdapter.setNewData(data); | 137 | homeworkAdapter.setNewData(data); |
| 131 | }); | 138 | }); |
| 132 | } | 139 | } |
| 133 | 140 | ||
| 134 | private void showSubjectFilter() { | 141 | private void showSubjectFilter() { |
| 135 | if (subjectFilter == null) { | 142 | if (subjectFilter == null) { |
| 136 | PopupFilterSubjectBinding db = PopupFilterSubjectBinding.inflate(getLayoutInflater()); | 143 | PopupFilterSubjectBinding db = PopupFilterSubjectBinding.inflate(getLayoutInflater()); |
| 137 | db.setLifecycleOwner(this); | 144 | db.setLifecycleOwner(this); |
| 138 | db.setState(state); | 145 | db.setState(state); |
| 139 | db.bg.setOnClickListener(v -> subjectFilter.dismiss()); | 146 | db.bg.setOnClickListener(v -> subjectFilter.dismiss()); |
| 140 | subjectFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); | 147 | subjectFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); |
| 141 | subjectFilter.setOutsideTouchable(true); | 148 | subjectFilter.setOutsideTouchable(true); |
| 142 | subjectFilter.setOnDismissListener(this::getHomework); | 149 | subjectFilter.setOnDismissListener(this::getHomework); |
| 143 | } | 150 | } |
| 144 | subjectFilter.showAsDropDown(binding.anchorView); | 151 | subjectFilter.showAsDropDown(binding.anchorView); |
| 145 | } | 152 | } |
| 146 | 153 | ||
| 147 | private void showGradeFilter() { | 154 | private void showGradeFilter() { |
| 148 | if (gradeFilter == null) { | 155 | if (gradeFilter == null) { |
| 149 | PopupFilterGradeBinding db = PopupFilterGradeBinding.inflate(getLayoutInflater()); | 156 | PopupFilterGradeBinding db = PopupFilterGradeBinding.inflate(getLayoutInflater()); |
| 150 | db.setLifecycleOwner(this); | 157 | db.setLifecycleOwner(this); |
| 151 | db.setState(state); | 158 | db.setState(state); |
| 152 | db.bg.setOnClickListener(v -> gradeFilter.dismiss()); | 159 | db.bg.setOnClickListener(v -> gradeFilter.dismiss()); |
| 153 | gradeFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); | 160 | gradeFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); |
| 154 | gradeFilter.setOutsideTouchable(true); | 161 | gradeFilter.setOutsideTouchable(true); |
| 155 | gradeFilter.setOnDismissListener(this::getHomework); | 162 | gradeFilter.setOnDismissListener(this::getHomework); |
| 156 | } | 163 | } |
| 157 | gradeFilter.showAsDropDown(binding.anchorView); | 164 | gradeFilter.showAsDropDown(binding.anchorView); |
| 158 | } | 165 | } |
| 159 | 166 | ||
| 160 | private void showTermFilter() { | 167 | private void showTermFilter() { |
| 161 | if (termFilter == null) { | 168 | if (termFilter == null) { |
| 162 | PopupFilterTermBinding db = PopupFilterTermBinding.inflate(getLayoutInflater()); | 169 | PopupFilterTermBinding db = PopupFilterTermBinding.inflate(getLayoutInflater()); |
| 163 | db.setLifecycleOwner(this); | 170 | db.setLifecycleOwner(this); |
| 164 | db.setState(state); | 171 | db.setState(state); |
| 165 | db.bg.setOnClickListener(v -> termFilter.dismiss()); | 172 | db.bg.setOnClickListener(v -> termFilter.dismiss()); |
| 166 | termFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); | 173 | termFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); |
| 167 | termFilter.setOutsideTouchable(true); | 174 | termFilter.setOutsideTouchable(true); |
| 168 | termFilter.setOnDismissListener(this::getHomework); | 175 | termFilter.setOnDismissListener(this::getHomework); |
| 169 | } | 176 | } |
| 170 | termFilter.showAsDropDown(binding.anchorView); | 177 | termFilter.showAsDropDown(binding.anchorView); |
| 171 | } | 178 | } |
| 172 | 179 | ||
| 173 | private void showFeedbackFilter() { | 180 | private void showFeedbackFilter() { |
| 174 | if (feedbackFilter == null) { | 181 | if (feedbackFilter == null) { |
| 175 | PopupFilterFeedbackBinding db = PopupFilterFeedbackBinding.inflate(getLayoutInflater()); | 182 | PopupFilterFeedbackBinding db = PopupFilterFeedbackBinding.inflate(getLayoutInflater()); |
| 176 | db.setLifecycleOwner(this); | 183 | db.setLifecycleOwner(this); |
| 177 | db.setState(state); | 184 | db.setState(state); |
| 178 | db.bg.setOnClickListener(v -> feedbackFilter.dismiss()); | 185 | db.bg.setOnClickListener(v -> feedbackFilter.dismiss()); |
| 179 | feedbackFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); | 186 | feedbackFilter = new PopupWindow(db.getRoot(), LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); |
| 180 | feedbackFilter.setOutsideTouchable(true); | 187 | feedbackFilter.setOutsideTouchable(true); |
| 181 | feedbackFilter.setOnDismissListener(this::getHomework); | 188 | feedbackFilter.setOnDismissListener(this::getHomework); |
| 182 | } | 189 | } |
| 183 | feedbackFilter.showAsDropDown(binding.anchorView); | 190 | feedbackFilter.showAsDropDown(binding.anchorView); |
| 184 | } | 191 | } |
| 185 | 192 | ||
| 186 | @Override | 193 | @Override |
| 187 | protected ActivityStudentHomeworkBinding getViewBinding() { | 194 | protected ActivityStudentHomeworkBinding getViewBinding() { |
| 188 | return ActivityStudentHomeworkBinding.inflate(getLayoutInflater()); | 195 | return ActivityStudentHomeworkBinding.inflate(getLayoutInflater()); |
| 189 | } | 196 | } |
| 190 | 197 | ||
| 191 | public static class State { | 198 | public static class State { |
| 192 | public Student student; | 199 | public Student student; |
| 193 | 200 | ||
| 194 | public MutableLiveData<String> subject = new MutableLiveData<>(""); | 201 | public MutableLiveData<String> subject = new MutableLiveData<>(""); |
| 195 | public void setSubject(String value) { | 202 | public void setSubject(String value) { |
| 196 | subject.setValue(value); | 203 | subject.setValue(value); |
| 197 | } | 204 | } |
| 198 | 205 | ||
| 199 | public MutableLiveData<String> grade = new MutableLiveData<>(""); | 206 | public MutableLiveData<String> grade = new MutableLiveData<>(""); |
| 200 | public void setGrade(String value) { | 207 | public void setGrade(String value) { |
| 201 | grade.setValue(value); | 208 | grade.setValue(value); |
| 202 | } | 209 | } |
| 203 | 210 | ||
| 204 | public MutableLiveData<String> term = new MutableLiveData<>(""); | 211 | public MutableLiveData<String> term = new MutableLiveData<>(""); |
| 205 | public void setTerm(String value) { | 212 | public void setTerm(String value) { |
| 206 | term.setValue(value); | 213 | term.setValue(value); |
| 207 | } | 214 | } |
| 208 | 215 | ||
| 209 | //0:全部, 1: 已反馈, 2:未反馈 | 216 | //0:全部, 1: 已反馈, 2:未反馈 |
| 210 | public MutableLiveData<Integer> feedback = new MutableLiveData<>(0); | 217 | public MutableLiveData<Integer> feedback = new MutableLiveData<>(0); |
| 211 | public void setFeedback(int value) { | 218 | public void setFeedback(int value) { |
| 212 | feedback.setValue(value); | 219 | feedback.setValue(value); |
| 213 | } | 220 | } |
| 214 | } | 221 | } |
| 215 | } | 222 | } |
| 216 | 223 |
app/src/main/java/com/hjx/parent/adapter/HomeworkListAdapter.java
| 1 | package com.hjx.parent.adapter; | 1 | package com.hjx.parent.adapter; |
| 2 | 2 | ||
| 3 | import android.content.Intent; | 3 | import android.content.Intent; |
| 4 | import android.view.View; | 4 | import android.view.View; |
| 5 | import android.widget.TextView; | 5 | import android.widget.TextView; |
| 6 | 6 | ||
| 7 | import androidx.annotation.NonNull; | 7 | import androidx.annotation.NonNull; |
| 8 | 8 | ||
| 9 | import com.chad.library.adapter.base.BaseQuickAdapter; | 9 | import com.chad.library.adapter.base.BaseQuickAdapter; |
| 10 | import com.chad.library.adapter.base.BaseViewHolder; | 10 | import com.chad.library.adapter.base.BaseViewHolder; |
| 11 | import com.google.gson.Gson; | 11 | import com.google.gson.Gson; |
| 12 | import com.hjx.parent.HomeworkDetailActivity; | 12 | import com.hjx.parent.HomeworkDetailActivity; |
| 13 | import com.hjx.parent.R; | 13 | import com.hjx.parent.R; |
| 14 | import com.hjx.parent.function.Function0; | 14 | import com.hjx.parent.function.Function0; |
| 15 | import com.hjx.parent.function.Function1; | 15 | import com.hjx.parent.function.Function1; |
| 16 | import com.prws.common.bean.homework.HomeworkList; | 16 | import com.prws.common.bean.homework.HomeworkList; |
| 17 | 17 | ||
| 18 | public class HomeworkListAdapter extends BaseQuickAdapter<HomeworkList, BaseViewHolder> { | 18 | public class HomeworkListAdapter extends BaseQuickAdapter<HomeworkList, BaseViewHolder> { |
| 19 | 19 | ||
| 20 | public Function1<HomeworkList> deleteCall; | 20 | public Function1<HomeworkList> deleteCall; |
| 21 | public Function1<HomeworkList> detailCall; | ||
| 21 | 22 | ||
| 22 | public HomeworkListAdapter() { | 23 | public HomeworkListAdapter() { |
| 23 | super(R.layout.item_homework_list); | 24 | super(R.layout.item_homework_list); |
| 24 | } | 25 | } |
| 25 | 26 | ||
| 26 | @Override | 27 | @Override |
| 27 | protected void convert(@NonNull BaseViewHolder helper, HomeworkList homework) { | 28 | protected void convert(@NonNull BaseViewHolder helper, HomeworkList homework) { |
| 28 | helper.setGone(R.id.tvFlag, homework.getRight() != null); | 29 | helper.setGone(R.id.tvFlag, homework.getRight() != null); |
| 29 | helper.setText(R.id.tvName, homework.getName()); | 30 | helper.setText(R.id.tvName, homework.getName()); |
| 30 | helper.setText(R.id.tvGrade, homework.getGrade() + "-" + homework.getTerm()); | 31 | helper.setText(R.id.tvGrade, homework.getGrade() + "-" + homework.getTerm()); |
| 31 | int subjectImg; | 32 | int subjectImg; |
| 32 | switch (homework.getSubject()) { | 33 | switch (homework.getSubject()) { |
| 33 | case "语文": | 34 | case "语文": |
| 34 | subjectImg = R.drawable.ic_chinese; | 35 | subjectImg = R.drawable.ic_chinese; |
| 35 | break; | 36 | break; |
| 36 | case "英语": | 37 | case "英语": |
| 37 | subjectImg = R.drawable.ic_english; | 38 | subjectImg = R.drawable.ic_english; |
| 38 | break; | 39 | break; |
| 39 | case "物理": | 40 | case "物理": |
| 40 | subjectImg = R.drawable.ic_physics; | 41 | subjectImg = R.drawable.ic_physics; |
| 41 | break; | 42 | break; |
| 42 | case "化学": | 43 | case "化学": |
| 43 | subjectImg = R.drawable.ic_chemistry; | 44 | subjectImg = R.drawable.ic_chemistry; |
| 44 | break; | 45 | break; |
| 45 | case "数学": | 46 | case "数学": |
| 46 | default: | 47 | default: |
| 47 | subjectImg = R.drawable.ic_math; | 48 | subjectImg = R.drawable.ic_math; |
| 48 | } | 49 | } |
| 49 | helper.setImageResource(R.id.ivSubject, subjectImg); | 50 | helper.setImageResource(R.id.ivSubject, subjectImg); |
| 50 | 51 | ||
| 51 | TextView tvDate = helper.getView(R.id.tvDate); | 52 | TextView tvDate = helper.getView(R.id.tvDate); |
| 52 | int index = getData().indexOf(homework); | 53 | int index = getData().indexOf(homework); |
| 53 | if (index == 0) { | 54 | if (index == 0) { |
| 54 | tvDate.setVisibility(View.VISIBLE); | 55 | tvDate.setVisibility(View.VISIBLE); |
| 55 | } else if (!homework.getFormatTime().equals(getData().get(index - 1).getFormatTime())) { | 56 | } else if (!homework.getFormatTime().equals(getData().get(index - 1).getFormatTime())) { |
| 56 | tvDate.setVisibility(View.VISIBLE); | 57 | tvDate.setVisibility(View.VISIBLE); |
| 57 | } else { | 58 | } else { |
| 58 | tvDate.setVisibility(View.GONE); | 59 | tvDate.setVisibility(View.GONE); |
| 59 | } | 60 | } |
| 60 | tvDate.setText(homework.getFormatTime()); | 61 | tvDate.setText(homework.getFormatTime()); |
| 61 | 62 | ||
| 62 | View btnDelete = helper.getView(R.id.btnDelete); | 63 | View btnDelete = helper.getView(R.id.btnDelete); |
| 63 | btnDelete.setOnClickListener(v -> { | 64 | btnDelete.setOnClickListener(v -> { |
| 64 | if (deleteCall != null) deleteCall.invoke(homework); | 65 | if (deleteCall != null) deleteCall.invoke(homework); |
| 65 | }); | 66 | }); |
| 66 | 67 | ||
| 67 | View btnDetail = helper.getView(R.id.btnDetail); | 68 | View btnDetail = helper.getView(R.id.btnDetail); |
| 68 | btnDetail.setOnClickListener(v -> { | 69 | btnDetail.setOnClickListener(v -> { |
| 69 | Intent intent = new Intent(mContext, HomeworkDetailActivity.class); | 70 | if (detailCall != null) { |
| 70 | intent.putExtra("data", new Gson().toJson(homework)); | 71 | detailCall.invoke(homework); |
| 71 | mContext.startActivity(intent); | 72 | } |
| 72 | }); | 73 | }); |
| 73 | } | 74 | } |
| 74 | } | 75 | } |
| 75 | 76 |
app/src/main/res/drawable/svg_ic_comment.xml
| 1 | <vector xmlns:android="http://schemas.android.com/apk/res/android" | 1 | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| 2 | android:width="34dp" | 2 | android:width="17dp" |
| 3 | android:height="34dp" | 3 | android:height="17dp" |
| 4 | android:viewportWidth="34" | 4 | android:viewportWidth="34" |
| 5 | android:viewportHeight="34"> | 5 | android:viewportHeight="34"> |
| 6 | <path | 6 | <path |
| 7 | android:pathData="M14,0L28,0C31.314,0 34,2.686 34,6L34,28C34,31.314 31.314,34 28,34L6,34C2.686,34 0,31.314 0,28L0,14C0,6.268 6.268,0 14,0Z" | 7 | android:pathData="M14,0L28,0C31.314,0 34,2.686 34,6L34,28C34,31.314 31.314,34 28,34L6,34C2.686,34 0,31.314 0,28L0,14C0,6.268 6.268,0 14,0Z" |
| 8 | android:fillColor="#F9C027" | 8 | android:fillColor="#F9C027" |
| 9 | android:fillType="evenOdd"/> | 9 | android:fillType="evenOdd"/> |
| 10 | <path | 10 | <path |
| 11 | android:pathData="M27.283,10.431C26.963,10.859 19.398,17.174 18.86,17.585C18.536,17.833 17.814,18.812 17.577,19.166C16.713,20.453 16.323,19.485 15.931,19.108C15.539,18.732 14.189,18.529 15.592,17.505C15.858,17.311 16.906,16.658 17.24,16.314C17.684,15.855 24.631,8.045 25.045,7.672C26.128,6.697 27.27,6.973 27.716,7.279C28.135,7.566 28.185,9.224 27.283,10.431ZM13.911,25.89C11.844,27.908 6.527,26.848 6.078,25.252C5.547,23.37 8.256,24.627 9.206,21.756C10.381,18.21 13.374,18.401 14.921,19.934C16.467,21.466 15.952,23.897 13.911,25.89Z" | 11 | android:pathData="M27.283,10.431C26.963,10.859 19.398,17.174 18.86,17.585C18.536,17.833 17.814,18.812 17.577,19.166C16.713,20.453 16.323,19.485 15.931,19.108C15.539,18.732 14.189,18.529 15.592,17.505C15.858,17.311 16.906,16.658 17.24,16.314C17.684,15.855 24.631,8.045 25.045,7.672C26.128,6.697 27.27,6.973 27.716,7.279C28.135,7.566 28.185,9.224 27.283,10.431ZM13.911,25.89C11.844,27.908 6.527,26.848 6.078,25.252C5.547,23.37 8.256,24.627 9.206,21.756C10.381,18.21 13.374,18.401 14.921,19.934C16.467,21.466 15.952,23.897 13.911,25.89Z" |
| 12 | android:fillColor="#FFFFFF" | 12 | android:fillColor="#FFFFFF" |
| 13 | android:fillType="evenOdd"/> | 13 | android:fillType="evenOdd"/> |
| 14 | </vector> | 14 | </vector> |
| 15 | 15 |
app/src/main/res/layout/activity_homework_feedback.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <LinearLayout | 2 | <LinearLayout |
| 3 | xmlns:android="http://schemas.android.com/apk/res/android" | 3 | xmlns:android="http://schemas.android.com/apk/res/android" |
| 4 | xmlns:app="http://schemas.android.com/apk/res-auto" | 4 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 5 | xmlns:tools="http://schemas.android.com/tools" | 5 | xmlns:tools="http://schemas.android.com/tools" |
| 6 | android:orientation="vertical" | 6 | android:orientation="vertical" |
| 7 | android:layout_width="match_parent" | 7 | android:layout_width="match_parent" |
| 8 | android:layout_height="match_parent" | 8 | android:layout_height="match_parent" |
| 9 | tools:ignore="UseCompoundDrawables,HardcodedText,SmallSp,ContentDescription"> | 9 | tools:ignore="UseCompoundDrawables,HardcodedText,SmallSp,ContentDescription"> |
| 10 | 10 | ||
| 11 | <androidx.appcompat.widget.Toolbar | 11 | <androidx.appcompat.widget.Toolbar |
| 12 | android:id="@+id/toolbar" | 12 | android:id="@+id/toolbar" |
| 13 | app:navigationIcon="@drawable/svg_back" | 13 | app:navigationIcon="@drawable/svg_back" |
| 14 | app:contentInsetStartWithNavigation="14dp" | 14 | app:contentInsetStartWithNavigation="14dp" |
| 15 | android:paddingStart="-8dp" | 15 | android:paddingStart="-8dp" |
| 16 | android:paddingEnd="-8dp" | 16 | android:paddingEnd="-8dp" |
| 17 | android:background="@color/white" | 17 | android:background="@color/white" |
| 18 | android:layout_width="match_parent" | 18 | android:layout_width="match_parent" |
| 19 | android:layout_height="40dp"> | 19 | android:layout_height="40dp"> |
| 20 | <TextView | 20 | <TextView |
| 21 | android:text="第二步:教师评语" | 21 | android:text="第二步:教师评语" |
| 22 | android:textSize="18sp" | 22 | android:textSize="18sp" |
| 23 | android:textColor="#333" | 23 | android:textColor="#333" |
| 24 | android:textStyle="bold" | 24 | android:textStyle="bold" |
| 25 | android:layout_gravity="center" | 25 | android:layout_gravity="center" |
| 26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
| 27 | android:layout_height="wrap_content"/> | 27 | android:layout_height="wrap_content"/> |
| 28 | <TextView | 28 | <TextView |
| 29 | android:id="@+id/btnPublish" | 29 | android:id="@+id/btnPublish" |
| 30 | android:text="发布" | 30 | android:text="发布" |
| 31 | android:textSize="13sp" | 31 | android:textSize="13sp" |
| 32 | android:textColor="#1C90F3" | 32 | android:textColor="#1C90F3" |
| 33 | android:textStyle="bold" | 33 | android:textStyle="bold" |
| 34 | android:layout_gravity="end|center_vertical" | 34 | android:layout_gravity="end|center_vertical" |
| 35 | android:layout_marginEnd="24dp" | 35 | android:layout_marginEnd="24dp" |
| 36 | android:layout_width="wrap_content" | 36 | android:layout_width="wrap_content" |
| 37 | android:layout_height="wrap_content"/> | 37 | android:layout_height="wrap_content"/> |
| 38 | </androidx.appcompat.widget.Toolbar> | 38 | </androidx.appcompat.widget.Toolbar> |
| 39 | 39 | ||
| 40 | <androidx.core.widget.NestedScrollView | 40 | <androidx.core.widget.NestedScrollView |
| 41 | android:layout_width="match_parent" | 41 | android:layout_width="match_parent" |
| 42 | android:layout_height="match_parent"> | 42 | android:layout_height="match_parent"> |
| 43 | <LinearLayout | 43 | <LinearLayout |
| 44 | android:orientation="vertical" | 44 | android:orientation="vertical" |
| 45 | android:paddingHorizontal="15dp" | 45 | android:paddingHorizontal="15dp" |
| 46 | android:paddingBottom="20dp" | 46 | android:paddingBottom="20dp" |
| 47 | android:layout_width="match_parent" | 47 | android:layout_width="match_parent" |
| 48 | android:layout_height="wrap_content"> | 48 | android:layout_height="wrap_content"> |
| 49 | 49 | ||
| 50 | <LinearLayout | 50 | <LinearLayout |
| 51 | android:orientation="vertical" | 51 | android:orientation="vertical" |
| 52 | android:background="@drawable/shape_radius_10" | 52 | android:background="@drawable/shape_radius_10" |
| 53 | android:backgroundTint="@color/white" | 53 | android:backgroundTint="@color/white" |
| 54 | android:layout_marginTop="15dp" | 54 | android:layout_marginTop="15dp" |
| 55 | android:layout_width="match_parent" | 55 | android:layout_width="match_parent" |
| 56 | android:layout_height="wrap_content"> | 56 | android:layout_height="wrap_content"> |
| 57 | <androidx.appcompat.widget.AppCompatTextView | 57 | <androidx.appcompat.widget.AppCompatTextView |
| 58 | android:text="学生信息" | 58 | android:text="学生信息" |
| 59 | android:textSize="16sp" | 59 | android:textSize="16sp" |
| 60 | android:textColor="#333" | 60 | android:textColor="#333" |
| 61 | android:textStyle="bold" | 61 | android:textStyle="bold" |
| 62 | android:gravity="center_vertical" | 62 | android:gravity="center_vertical" |
| 63 | android:paddingHorizontal="15dp" | 63 | android:paddingHorizontal="15dp" |
| 64 | android:drawablePadding="5dp" | 64 | android:drawablePadding="5dp" |
| 65 | android:drawableStart="@drawable/svg_ic_stu_info" | 65 | android:drawableStart="@drawable/svg_ic_stu_info" |
| 66 | android:background="@drawable/shape_radius_top_10" | 66 | android:background="@drawable/shape_radius_top_10" |
| 67 | android:backgroundTint="#DAEBFE" | 67 | android:backgroundTint="#DAEBFE" |
| 68 | android:layout_width="match_parent" | 68 | android:layout_width="match_parent" |
| 69 | android:layout_height="40dp"/> | 69 | android:layout_height="40dp"/> |
| 70 | <LinearLayout | 70 | <LinearLayout |
| 71 | android:orientation="horizontal" | 71 | android:orientation="horizontal" |
| 72 | android:layout_marginHorizontal="15dp" | 72 | android:layout_marginHorizontal="15dp" |
| 73 | android:layout_marginVertical="18dp" | 73 | android:layout_marginVertical="18dp" |
| 74 | android:layout_width="match_parent" | 74 | android:layout_width="match_parent" |
| 75 | android:layout_height="wrap_content"> | 75 | android:layout_height="wrap_content"> |
| 76 | <TextView | 76 | <TextView |
| 77 | android:text="学生姓名:" | 77 | android:text="学生姓名:" |
| 78 | android:textSize="14sp" | 78 | android:textSize="14sp" |
| 79 | android:textColor="#333" | 79 | android:textColor="#333" |
| 80 | android:layout_width="wrap_content" | 80 | android:layout_width="wrap_content" |
| 81 | android:layout_height="wrap_content"/> | 81 | android:layout_height="wrap_content"/> |
| 82 | <TextView | 82 | <TextView |
| 83 | android:text="杨小凯" | 83 | android:id="@+id/tvStuName" |
| 84 | tools:text="杨小凯" | ||
| 84 | android:textSize="14sp" | 85 | android:textSize="14sp" |
| 85 | android:textColor="#333" | 86 | android:textColor="#333" |
| 86 | android:layout_width="wrap_content" | 87 | android:layout_width="wrap_content" |
| 87 | android:layout_height="wrap_content"/> | 88 | android:layout_height="wrap_content"/> |
| 88 | <Space style="@style/empty_space"/> | 89 | <Space style="@style/empty_space"/> |
| 89 | <TextView | 90 | <TextView |
| 90 | android:text="年级:" | 91 | android:text="年级:" |
| 91 | android:textSize="14sp" | 92 | android:textSize="14sp" |
| 92 | android:textColor="#333" | 93 | android:textColor="#333" |
| 93 | android:layout_width="wrap_content" | 94 | android:layout_width="wrap_content" |
| 94 | android:layout_height="wrap_content"/> | 95 | android:layout_height="wrap_content"/> |
| 95 | <TextView | 96 | <TextView |
| 96 | android:text="六年级" | 97 | android:id="@+id/tvGrade" |
| 98 | tools:text="六年级" | ||
| 97 | android:textSize="14sp" | 99 | android:textSize="14sp" |
| 98 | android:textColor="#333" | 100 | android:textColor="#333" |
| 99 | android:layout_width="96dp" | 101 | android:layout_width="96dp" |
| 100 | android:layout_height="wrap_content"/> | 102 | android:layout_height="wrap_content"/> |
| 101 | </LinearLayout> | 103 | </LinearLayout> |
| 102 | </LinearLayout> | 104 | </LinearLayout> |
| 103 | 105 | ||
| 104 | <LinearLayout | 106 | <LinearLayout |
| 105 | android:orientation="vertical" | 107 | android:orientation="vertical" |
| 106 | android:background="@drawable/shape_radius_10" | 108 | android:background="@drawable/shape_radius_10" |
| 107 | android:backgroundTint="@color/white" | 109 | android:backgroundTint="@color/white" |
| 108 | android:paddingBottom="15dp" | 110 | android:paddingBottom="15dp" |
| 109 | android:layout_marginTop="15dp" | 111 | android:layout_marginTop="15dp" |
| 110 | android:layout_width="match_parent" | 112 | android:layout_width="match_parent" |
| 111 | android:layout_height="wrap_content"> | 113 | android:layout_height="wrap_content"> |
| 112 | <androidx.appcompat.widget.AppCompatTextView | 114 | <androidx.appcompat.widget.AppCompatTextView |
| 113 | android:text="作业详情" | 115 | android:text="作业详情" |
| 114 | android:textSize="16sp" | 116 | android:textSize="16sp" |
| 115 | android:textColor="#333" | 117 | android:textColor="#333" |
| 116 | android:textStyle="bold" | 118 | android:textStyle="bold" |
| 117 | android:gravity="center_vertical" | 119 | android:gravity="center_vertical" |
| 118 | android:paddingHorizontal="15dp" | 120 | android:paddingHorizontal="15dp" |
| 119 | android:drawablePadding="5dp" | 121 | android:drawablePadding="5dp" |
| 120 | android:drawableStart="@drawable/svg_ic_correct" | 122 | android:drawableStart="@drawable/svg_ic_correct" |
| 121 | android:background="@drawable/shape_radius_top_10" | 123 | android:background="@drawable/shape_radius_top_10" |
| 122 | android:backgroundTint="#DAEBFE" | 124 | android:backgroundTint="#DAEBFE" |
| 123 | android:layout_width="match_parent" | 125 | android:layout_width="match_parent" |
| 124 | android:layout_height="40dp"/> | 126 | android:layout_height="40dp"/> |
| 125 | <LinearLayout | 127 | <LinearLayout |
| 126 | android:orientation="horizontal" | 128 | android:orientation="horizontal" |
| 127 | android:layout_marginHorizontal="15dp" | 129 | android:layout_marginHorizontal="15dp" |
| 128 | android:layout_marginTop="15dp" | 130 | android:layout_marginTop="15dp" |
| 129 | android:layout_width="match_parent" | 131 | android:layout_width="match_parent" |
| 130 | android:layout_height="wrap_content"> | 132 | android:layout_height="wrap_content"> |
| 131 | <TextView | 133 | <TextView |
| 132 | android:text="学生姓名:" | 134 | android:text="正确率:" |
| 133 | android:textSize="14sp" | 135 | android:textSize="14sp" |
| 134 | android:textColor="#333" | 136 | android:textColor="#333" |
| 135 | android:layout_width="wrap_content" | 137 | android:layout_width="wrap_content" |
| 136 | android:layout_height="wrap_content"/> | 138 | android:layout_height="wrap_content"/> |
| 137 | <TextView | 139 | <TextView |
| 140 | android:id="@+id/tvPercent" | ||
| 138 | tools:text="60%" | 141 | tools:text="60%" |
| 139 | android:textSize="14sp" | 142 | android:textSize="14sp" |
| 140 | android:textColor="#333" | 143 | android:textColor="#333" |
| 141 | android:layout_width="wrap_content" | 144 | android:layout_width="wrap_content" |
| 142 | android:layout_height="wrap_content"/> | 145 | android:layout_height="wrap_content"/> |
| 143 | <Space style="@style/empty_space"/> | 146 | <Space style="@style/empty_space"/> |
| 144 | <TextView | 147 | <TextView |
| 145 | android:text="答题结果" | 148 | android:text="答题结果" |
| 146 | android:textSize="14sp" | 149 | android:textSize="14sp" |
| 147 | android:textColor="#333" | 150 | android:textColor="#333" |
| 148 | android:layout_width="wrap_content" | 151 | android:layout_width="wrap_content" |
| 149 | android:layout_height="wrap_content"/> | 152 | android:layout_height="wrap_content"/> |
| 150 | <TextView | 153 | <TextView |
| 151 | android:text="(点击查看题目详情)" | 154 | android:text="(点击查看题目详情)" |
| 152 | android:textSize="14sp" | 155 | android:textSize="14sp" |
| 153 | android:textColor="#1C90F3" | 156 | android:textColor="#1C90F3" |
| 154 | android:layout_width="wrap_content" | 157 | android:layout_width="wrap_content" |
| 155 | android:layout_height="wrap_content"/> | 158 | android:layout_height="wrap_content"/> |
| 156 | </LinearLayout> | 159 | </LinearLayout> |
| 157 | 160 | ||
| 158 | <androidx.recyclerview.widget.RecyclerView | 161 | <androidx.recyclerview.widget.RecyclerView |
| 159 | android:id="@+id/rvCorrect" | 162 | android:id="@+id/rvCorrect" |
| 160 | tools:itemCount="1" | 163 | tools:itemCount="1" |
| 161 | android:layout_marginTop="15dp" | 164 | android:layout_marginTop="15dp" |
| 162 | android:layout_marginHorizontal="15dp" | 165 | android:layout_marginHorizontal="15dp" |
| 163 | android:layout_width="match_parent" | 166 | android:layout_width="match_parent" |
| 164 | android:layout_height="wrap_content"/> | 167 | android:layout_height="wrap_content"/> |
| 165 | <TextView | 168 | <TextView |
| 166 | android:text="错题已经加入到错题本,到错题本查看详情" | 169 | android:text="错题已经加入到错题本,到错题本查看详情" |
| 167 | android:textSize="12sp" | 170 | android:textSize="12sp" |
| 168 | android:textColor="#666" | 171 | android:textColor="#666" |
| 169 | android:layout_marginTop="15dp" | 172 | android:layout_marginTop="15dp" |
| 170 | android:layout_marginHorizontal="15dp" | 173 | android:layout_marginHorizontal="15dp" |
| 171 | android:layout_width="wrap_content" | 174 | android:layout_width="wrap_content" |
| 172 | android:layout_height="wrap_content"/> | 175 | android:layout_height="wrap_content"/> |
| 173 | </LinearLayout> | 176 | </LinearLayout> |
| 174 | 177 | ||
| 175 | <LinearLayout | 178 | <LinearLayout |
| 176 | android:orientation="vertical" | 179 | android:orientation="vertical" |
| 177 | android:background="@drawable/shape_radius_10" | 180 | android:background="@drawable/shape_radius_10" |
| 178 | android:backgroundTint="@color/white" | 181 | android:backgroundTint="@color/white" |
| 179 | android:layout_marginTop="15dp" | 182 | android:layout_marginTop="15dp" |
| 180 | android:layout_width="match_parent" | 183 | android:layout_width="match_parent" |
| 181 | android:layout_height="wrap_content"> | 184 | android:layout_height="wrap_content"> |
| 182 | <androidx.appcompat.widget.AppCompatTextView | 185 | <androidx.appcompat.widget.AppCompatTextView |
| 183 | android:text="作业详情" | 186 | android:text="作业详情" |
| 184 | android:textSize="16sp" | 187 | android:textSize="16sp" |
| 185 | android:textColor="#333" | 188 | android:textColor="#333" |
| 186 | android:textStyle="bold" | 189 | android:textStyle="bold" |
| 187 | android:gravity="center_vertical" | 190 | android:gravity="center_vertical" |
| 188 | android:paddingHorizontal="15dp" | 191 | android:paddingHorizontal="15dp" |
| 189 | android:drawablePadding="5dp" | 192 | android:drawablePadding="5dp" |
| 190 | android:drawableStart="@drawable/svg_ic_paper" | 193 | android:drawableStart="@drawable/svg_ic_paper" |
| 191 | android:background="@drawable/shape_radius_top_10" | 194 | android:background="@drawable/shape_radius_top_10" |
| 192 | android:backgroundTint="#DAEBFE" | 195 | android:backgroundTint="#DAEBFE" |
| 193 | android:layout_width="match_parent" | 196 | android:layout_width="match_parent" |
| 194 | android:layout_height="40dp"/> | 197 | android:layout_height="40dp"/> |
| 195 | <androidx.recyclerview.widget.RecyclerView | 198 | <androidx.recyclerview.widget.RecyclerView |
| 196 | android:id="@+id/rvError" | 199 | android:id="@+id/rvError" |
| 197 | android:orientation="vertical" | 200 | android:orientation="vertical" |
| 198 | app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | 201 | app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" |
| 199 | android:layout_width="match_parent" | 202 | android:layout_width="match_parent" |
| 200 | android:layout_height="wrap_content"/> | 203 | android:layout_height="wrap_content"/> |
| 201 | </LinearLayout> | 204 | </LinearLayout> |
| 202 | 205 | ||
| 203 | <LinearLayout | 206 | <LinearLayout |
| 204 | android:orientation="vertical" | 207 | android:orientation="vertical" |
| 205 | android:background="@drawable/shape_radius_10" | 208 | android:background="@drawable/shape_radius_10" |
| 206 | android:backgroundTint="@color/white" | 209 | android:backgroundTint="@color/white" |
| 207 | android:layout_marginTop="15dp" | 210 | android:layout_marginTop="15dp" |
| 208 | android:layout_width="match_parent" | 211 | android:layout_width="match_parent" |
| 209 | android:layout_height="wrap_content"> | 212 | android:layout_height="wrap_content"> |
| 210 | <androidx.appcompat.widget.AppCompatTextView | 213 | <androidx.appcompat.widget.AppCompatTextView |
| 211 | android:text="教师评语" | 214 | android:text="教师评语" |
| 212 | android:textSize="16sp" | 215 | android:textSize="16sp" |
| 213 | android:textColor="#333" | 216 | android:textColor="#333" |
| 214 | android:textStyle="bold" | 217 | android:textStyle="bold" |
| 215 | android:gravity="center_vertical" | 218 | android:gravity="center_vertical" |
| 216 | android:paddingHorizontal="15dp" | 219 | android:paddingHorizontal="15dp" |
| 217 | android:drawablePadding="5dp" | 220 | android:drawablePadding="5dp" |
| 218 | android:drawableStart="@drawable/svg_ic_paper" | 221 | android:drawableStart="@drawable/svg_ic_comment" |
| 219 | android:background="@drawable/shape_radius_top_10" | 222 | android:background="@drawable/shape_radius_top_10" |
| 220 | android:backgroundTint="#DAEBFE" | 223 | android:backgroundTint="#DAEBFE" |
| 221 | android:layout_width="match_parent" | 224 | android:layout_width="match_parent" |
| 222 | android:layout_height="40dp"/> | 225 | android:layout_height="40dp"/> |
| 223 | <EditText | 226 | <EditText |
| 224 | android:id="@+id/etComment" | 227 | android:id="@+id/etComment" |
| 225 | android:hint="非必填" | 228 | android:hint="非必填" |
| 226 | android:textSize="13sp" | 229 | android:textSize="13sp" |
| 227 | android:textColor="#333" | 230 | android:textColor="#333" |
| 228 | android:textColorHint="#999" | 231 | android:textColorHint="#999" |
| 229 | android:gravity="start" | 232 | android:gravity="start" |
| 230 | android:background="@null" | 233 | android:background="@null" |
| 231 | android:layout_margin="14dp" | 234 | android:layout_margin="14dp" |
| 232 | android:layout_width="match_parent" | 235 | android:layout_width="match_parent" |
| 233 | android:layout_height="wrap_content" | 236 | android:layout_height="wrap_content" |
| 234 | tools:ignore="Autofill,LabelFor,TextFields" /> | 237 | tools:ignore="Autofill,LabelFor,TextFields" /> |
| 235 | </LinearLayout> | 238 | </LinearLayout> |
| 236 | 239 | ||
| 237 | 240 | ||
| 238 | </LinearLayout> | 241 | </LinearLayout> |
| 239 | </androidx.core.widget.NestedScrollView> | 242 | </androidx.core.widget.NestedScrollView> |
| 240 | </LinearLayout> | 243 | </LinearLayout> |
libs/common/src/main/java/com/prws/common/bean/Student.java
| 1 | package com.prws.common.bean; | 1 | package com.prws.common.bean; |
| 2 | 2 | ||
| 3 | import androidx.annotation.NonNull; | 3 | import androidx.annotation.NonNull; |
| 4 | 4 | ||
| 5 | public class Student { | 5 | import java.io.Serializable; |
| 6 | |||
| 7 | public class Student implements Serializable { | ||
| 6 | 8 | ||
| 7 | public String stuId; | 9 | public String stuId; |
| 8 | public String stuName; | 10 | public String stuName; |
| 9 | public int gender; | 11 | public int gender; |
| 10 | public String term; | 12 | public String term; |
| 11 | public String account; | 13 | public String account; |
| 12 | public String nickName; | 14 | public String nickName; |
| 13 | public String address; | 15 | public String address; |
| 14 | public String phone; | 16 | public String phone; |
| 15 | public String photo; | 17 | public String photo; |
| 16 | public int fromType; | 18 | public int fromType; |
| 17 | public int gradeId; | 19 | public int gradeId; |
| 18 | public String oriSchool; | 20 | public String oriSchool; |
| 19 | public String parentPhone; | 21 | public String parentPhone; |
| 20 | public String parentIdentity; | 22 | public String parentIdentity; |
| 21 | public String teacherName; | 23 | public String teacherName; |
| 22 | public int teacherId; | 24 | public int teacherId; |
| 23 | public String teacherAvatar; | 25 | public String teacherAvatar; |
| 24 | public String grade; | 26 | public String grade; |
| 25 | public String teacherIdentity; | 27 | public String teacherIdentity; |
| 26 | public int sex; | 28 | public int sex; |
| 27 | public Integer state; | 29 | public Integer state; |
| 28 | 30 | ||
| 29 | @NonNull | 31 | @NonNull |
| 30 | @Override | 32 | @Override |
| 31 | public String toString() { | 33 | public String toString() { |
| 32 | return stuName; | 34 | return stuName; |
| 33 | } | 35 | } |
| 34 | } | 36 | } |
| 35 | 37 |
libs/common/src/main/java/com/prws/common/bean/homework/HomeWork.java
| 1 | package com.prws.common.bean.homework; | 1 | package com.prws.common.bean.homework; |
| 2 | 2 | ||
| 3 | import com.google.gson.annotations.SerializedName; | 3 | import com.google.gson.annotations.SerializedName; |
| 4 | 4 | ||
| 5 | import java.io.Serializable; | 5 | import java.io.Serializable; |
| 6 | 6 | ||
| 7 | public class HomeWork implements Serializable { | 7 | public class HomeWork implements Serializable { |
| 8 | 8 | ||
| 9 | @SerializedName(value = "homeworkId", alternate = "id") | 9 | @SerializedName(value = "homeworkId", alternate = "id") |
| 10 | public Integer homeworkId; | 10 | public String homeworkId; |
| 11 | public String brief; | 11 | public String brief; |
| 12 | public String url; | 12 | public String url; |
| 13 | public String analyseUrl; | 13 | public String analyseUrl; |
| 14 | public String analyseVideoUrl; | 14 | public String analyseVideoUrl; |
| 15 | public Integer correction; | 15 | public Integer correction; |
| 16 | public String answer; | 16 | public String answer; |
| 17 | public String points; | 17 | public String points; |
| 18 | 18 | ||
| 19 | public boolean check = false; | 19 | public boolean check = false; |
| 20 | 20 | ||
| 21 | } | 21 | } |
| 22 | 22 |