Commit 7083c3e3a1e467b3e5bacb2de649f61a9acce234
1 parent
07abc9da63
Exists in
master
作业分享页面添加未做题
Showing
3 changed files
with
126 additions
and
4 deletions
Show diff stats
app/src/main/java/com/hjx/parent/HomeworkShareActivity.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.graphics.Bitmap; | 5 | import android.graphics.Bitmap; |
| 6 | import android.net.Uri; | 6 | import android.net.Uri; |
| 7 | import android.os.Bundle; | 7 | import android.os.Bundle; |
| 8 | import android.text.Html; | 8 | import android.text.Html; |
| 9 | import android.view.View; | 9 | import android.view.View; |
| 10 | import android.widget.ImageView; | 10 | import android.widget.ImageView; |
| 11 | import android.widget.LinearLayout; | 11 | import android.widget.LinearLayout; |
| 12 | import android.widget.TextView; | 12 | import android.widget.TextView; |
| 13 | 13 | ||
| 14 | import androidx.annotation.NonNull; | 14 | import androidx.annotation.NonNull; |
| 15 | import androidx.annotation.Nullable; | ||
| 15 | 16 | ||
| 16 | import com.bumptech.glide.Glide; | 17 | import com.bumptech.glide.Glide; |
| 17 | import com.chad.library.adapter.base.BaseQuickAdapter; | 18 | import com.chad.library.adapter.base.BaseQuickAdapter; |
| 18 | import com.chad.library.adapter.base.BaseViewHolder; | 19 | import com.chad.library.adapter.base.BaseViewHolder; |
| 19 | import com.google.gson.Gson; | 20 | import com.google.gson.Gson; |
| 20 | import com.gyf.immersionbar.ImmersionBar; | 21 | import com.gyf.immersionbar.ImmersionBar; |
| 21 | import com.hjx.parent.databinding.ActivityHomeworkShareBinding; | 22 | import com.hjx.parent.databinding.ActivityHomeworkShareBinding; |
| 22 | import com.hjx.parent.dialog.PhotoViewDialog; | 23 | import com.hjx.parent.dialog.PhotoViewDialog; |
| 23 | import com.hjx.parent.rx.BaseRxActivity; | 24 | import com.hjx.parent.rx.BaseRxActivity; |
| 24 | import com.prws.common.bean.ResponseResult; | 25 | import com.prws.common.bean.ResponseResult; |
| 25 | import com.prws.common.bean.Student; | 26 | import com.prws.common.bean.Student; |
| 26 | import com.prws.common.bean.homework.HomeWork; | 27 | import com.prws.common.bean.homework.HomeWork; |
| 27 | import com.prws.common.bean.homework.HomeworkDetail; | 28 | import com.prws.common.bean.homework.HomeworkDetail; |
| 28 | import com.prws.common.bean.homework.KeyValue; | 29 | import com.prws.common.bean.homework.KeyValue; |
| 29 | import com.prws.common.net.NetWorks; | 30 | import com.prws.common.net.NetWorks; |
| 30 | import com.prws.common.utils.BitmapUtils; | 31 | import com.prws.common.utils.BitmapUtils; |
| 31 | import com.prws.common.utils.CommonUtil; | 32 | import com.prws.common.utils.CommonUtil; |
| 32 | import com.prws.common.utils.ContentUtil; | 33 | import com.prws.common.utils.ContentUtil; |
| 33 | 34 | ||
| 34 | import java.text.DecimalFormat; | 35 | import java.text.DecimalFormat; |
| 35 | import java.text.SimpleDateFormat; | 36 | import java.text.SimpleDateFormat; |
| 36 | import java.util.ArrayList; | 37 | import java.util.ArrayList; |
| 37 | import java.util.HashSet; | 38 | import java.util.HashSet; |
| 38 | import java.util.List; | 39 | import java.util.List; |
| 39 | import java.util.Locale; | 40 | import java.util.Locale; |
| 40 | import java.util.Set; | 41 | import java.util.Set; |
| 41 | 42 | ||
| 42 | import io.reactivex.Single; | 43 | import io.reactivex.Single; |
| 43 | import io.reactivex.android.schedulers.AndroidSchedulers; | 44 | import io.reactivex.android.schedulers.AndroidSchedulers; |
| 44 | import io.reactivex.schedulers.Schedulers; | 45 | import io.reactivex.schedulers.Schedulers; |
| 45 | 46 | ||
| 46 | public class HomeworkShareActivity extends BaseRxActivity<ActivityHomeworkShareBinding> { | 47 | public class HomeworkShareActivity extends BaseRxActivity<ActivityHomeworkShareBinding> { |
| 47 | private String id; | 48 | private String id; |
| 48 | 49 | ||
| 49 | String indent = " "; | 50 | String indent = " "; |
| 50 | 51 | ||
| 51 | private String title; | 52 | private String title; |
| 52 | private Student student; | 53 | private Student student; |
| 53 | private ErrorAdapter mAdapter = new ErrorAdapter(); | 54 | private ErrorAdapter mAdapter = new ErrorAdapter(); |
| 54 | 55 | ||
| 55 | private Uri shareUri; | 56 | private Uri shareUri; |
| 56 | 57 | ||
| 57 | @SuppressLint("SetTextI18n") | 58 | @SuppressLint("SetTextI18n") |
| 58 | @Override | 59 | @Override |
| 59 | public void initView(Bundle savedInstanceState) { | 60 | public void initView(Bundle savedInstanceState) { |
| 60 | ImmersionBar.with(this).init(); | 61 | ImmersionBar.with(this).init(); |
| 61 | binding.btnBack.setOnClickListener(v -> onBackPressed()); | 62 | binding.btnBack.setOnClickListener(v -> onBackPressed()); |
| 62 | binding.rvWrong.setAdapter(mAdapter); | 63 | binding.rvWrong.setAdapter(mAdapter); |
| 63 | mAdapter.setEmptyView(R.layout.empty_statistical_no_error, binding.rvWrong); | 64 | mAdapter.setEmptyView(R.layout.empty_statistical_no_error, binding.rvWrong); |
| 64 | 65 | ||
| 65 | id = getIntent().getStringExtra("id"); | 66 | id = getIntent().getStringExtra("id"); |
| 66 | title = getIntent().getStringExtra("name"); | 67 | title = getIntent().getStringExtra("name"); |
| 67 | binding.tvTitle.setText(title); | 68 | binding.tvTitle.setText(title); |
| 68 | student = (Student) getIntent().getSerializableExtra("student"); | 69 | student = (Student) getIntent().getSerializableExtra("student"); |
| 69 | assert student != null; | 70 | assert student != null; |
| 70 | binding.tvStuName.setText(student.stuName); | 71 | binding.tvStuName.setText(student.stuName); |
| 71 | Glide.with(this).load(student.photo).centerCrop().error(R.mipmap.ic_avatar_male).into(binding.ivAvatar); | 72 | Glide.with(this).load(student.photo).centerCrop().error(R.mipmap.ic_avatar_male).into(binding.ivAvatar); |
| 72 | binding.tvGrade.setText(getIntent().getStringExtra("grade")); | 73 | binding.tvGrade.setText(getIntent().getStringExtra("grade")); |
| 73 | binding.tvSubject.setText(getIntent().getStringExtra("subject")); | 74 | binding.tvSubject.setText(getIntent().getStringExtra("subject")); |
| 74 | 75 | ||
| 75 | binding.btnShare.setOnClickListener(v -> { | 76 | binding.btnShare.setOnClickListener(v -> { |
| 76 | if (shareUri == null) shareUri = saveBitmap(); | 77 | if (shareUri == null) shareUri = saveBitmap(); |
| 77 | if (shareUri != null) { | 78 | if (shareUri != null) { |
| 78 | Intent shareIntent = new Intent(Intent.ACTION_SEND); | 79 | Intent shareIntent = new Intent(Intent.ACTION_SEND); |
| 79 | shareIntent.setType("image/jpeg"); | 80 | shareIntent.setType("image/jpeg"); |
| 80 | shareIntent.putExtra(Intent.EXTRA_STREAM, shareUri); | 81 | shareIntent.putExtra(Intent.EXTRA_STREAM, shareUri); |
| 81 | shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | 82 | shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| 82 | 83 | ||
| 83 | startActivity(shareIntent); | 84 | startActivity(shareIntent); |
| 84 | } | 85 | } |
| 85 | }); | 86 | }); |
| 86 | 87 | ||
| 87 | loadHomework(); | 88 | loadHomework(); |
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | @SuppressLint("CheckResult") | 91 | @SuppressLint("CheckResult") |
| 91 | private void loadHomework() { | 92 | private void loadHomework() { |
| 92 | NetWorks.service_url.getHomeworkCompleteDetail(NetWorks.getHeader(), student.stuId, id, true) | 93 | NetWorks.service_url.getHomeworkCompleteDetail(NetWorks.getHeader(), student.stuId, id, true) |
| 93 | .compose(transformSingle()) | 94 | .compose(transformSingle()) |
| 94 | .map(ResponseResult::getData) | 95 | .map(ResponseResult::getData) |
| 95 | .map(data -> { | 96 | .map(data -> { |
| 96 | if (data.getHomeworkList() == null) return data; | 97 | if (data.getHomeworkList() == null) return data; |
| 97 | for (HomeWork homeWork: data.getHomeworkList()){ | 98 | for (HomeWork homeWork: data.getHomeworkList()){ |
| 98 | homeWork.formatPoints(new Gson()); | 99 | homeWork.formatPoints(new Gson()); |
| 99 | } | 100 | } |
| 100 | return data; | 101 | return data; |
| 101 | }) | 102 | }) |
| 102 | .subscribe((data, th) -> { | 103 | .subscribe((data, th) -> { |
| 103 | if (th != null) th.printStackTrace(); | 104 | if (th != null) th.printStackTrace(); |
| 104 | if (data != null) showHomework(data); | 105 | if (data != null) showHomework(data); |
| 105 | }); | 106 | }); |
| 106 | } | 107 | } |
| 107 | @SuppressLint({"SetTextI18n", "DefaultLocale"}) | 108 | @SuppressLint({"SetTextI18n", "DefaultLocale"}) |
| 108 | private void showHomework(HomeworkDetail detail) { | 109 | private void showHomework(HomeworkDetail detail) { |
| 109 | SimpleDateFormat format = new SimpleDateFormat("yyyy.M.d", Locale.CHINA); | 110 | SimpleDateFormat format = new SimpleDateFormat("yyyy.M.d", Locale.CHINA); |
| 110 | binding.tvDate.setText(format.format(detail.getDate())); | 111 | binding.tvDate.setText(format.format(detail.getDate())); |
| 111 | binding.flComment.setVisibility(detail.getComment() == null || detail.getComment().isEmpty() ? View.INVISIBLE : View.VISIBLE); | 112 | binding.flComment.setVisibility(detail.getComment() == null || detail.getComment().isEmpty() ? View.INVISIBLE : View.VISIBLE); |
| 112 | binding.tvComment.setText(ifEmpty(detail.getComment(), "-")); | 113 | binding.tvComment.setText(ifEmpty(detail.getComment(), "-")); |
| 113 | binding.tvRating.setText("-"); | 114 | binding.tvRating.setText("-"); |
| 114 | 115 | ||
| 115 | String temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好;答错题目有 %s 道,错题涵盖的知识点主要有%s,这部分还要再加强学习。错题老师已经帮你收录到错题本中,要记得复习整理错题,及时消灭薄弱知识点。"; | 116 | String temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好;答错题目有 %s 道,错题涵盖的知识点主要有%s,这部分还要再加强学习。错题老师已经帮你收录到错题本中,要记得复习整理错题,及时消灭薄弱知识点。"; |
| 116 | List<HomeWork> errorList = new ArrayList<>(); | 117 | List<HomeWork> errorList = new ArrayList<>(); |
| 118 | List<HomeWork> blankList = new ArrayList<>(); | ||
| 117 | if (detail.getHomeworkList() != null && detail.getHomeworkList().size() != 0) { | 119 | if (detail.getHomeworkList() != null && detail.getHomeworkList().size() != 0) { |
| 118 | int total = detail.getHomeworkList().size(); | 120 | int total = detail.getHomeworkList().size(); |
| 119 | int correctNum = 0; | 121 | int correctNum = 0, blankNumber = 0; |
| 120 | Set<KeyValue> correctSet = new HashSet<>(); | 122 | Set<KeyValue> correctSet = new HashSet<>(); |
| 121 | Set<KeyValue> errorSet = new HashSet<>(); | 123 | Set<KeyValue> errorSet = new HashSet<>(); |
| 122 | for (HomeWork homeWork: detail.getHomeworkList()) { | 124 | for (HomeWork homeWork: detail.getHomeworkList()) { |
| 123 | if (homeWork.correction == 0) { | 125 | if (homeWork.correction == 0) { |
| 124 | correctNum ++; | 126 | correctNum ++; |
| 125 | correctSet.addAll(homeWork.pointsObj); | 127 | correctSet.addAll(homeWork.pointsObj); |
| 126 | } else { | 128 | } else if (homeWork.correction == 1){ |
| 127 | errorList.add(homeWork); | 129 | errorList.add(homeWork); |
| 128 | errorSet.addAll(homeWork.pointsObj); | 130 | errorSet.addAll(homeWork.pointsObj); |
| 131 | } else if (homeWork.correction == 2) { | ||
| 132 | blankList.add(homeWork); | ||
| 133 | blankNumber ++; | ||
| 129 | } | 134 | } |
| 130 | } | 135 | } |
| 131 | StringBuilder correctPoint = new StringBuilder(); | 136 | StringBuilder correctPoint = new StringBuilder(); |
| 132 | StringBuilder errorPoint = new StringBuilder(); | 137 | StringBuilder errorPoint = new StringBuilder(); |
| 133 | for (KeyValue point: correctSet) { | 138 | for (KeyValue point: correctSet) { |
| 134 | correctPoint.append("、").append(point.Value); | 139 | correctPoint.append("、").append(point.Value); |
| 135 | } | 140 | } |
| 136 | for (KeyValue point: errorSet) { | 141 | for (KeyValue point: errorSet) { |
| 137 | errorPoint.append("、").append(point.Value); | 142 | errorPoint.append("、").append(point.Value); |
| 138 | } | 143 | } |
| 139 | float rate = 100f * correctNum / total; | 144 | float rate = 100f * correctNum / Math.max(total - blankNumber, 1); |
| 140 | int errorNum = total - correctNum; | 145 | int errorNum = total - correctNum; |
| 141 | binding.tvPercent.setText(new DecimalFormat("0").format(rate)); | 146 | binding.tvPercent.setText(new DecimalFormat("0").format(rate)); |
| 142 | binding.tvCorrect.setText(String.valueOf(correctNum)); | 147 | binding.tvCorrect.setText(String.valueOf(correctNum)); |
| 143 | binding.tvWrong.setText(String.valueOf(errorNum)); | 148 | binding.tvWrong.setText(String.valueOf(errorNum)); |
| 149 | binding.tvBlank.setText(String.valueOf(blankNumber)); | ||
| 144 | 150 | ||
| 145 | String correct = "-", error = "-"; | 151 | String correct = "-", error = "-"; |
| 146 | if (correctPoint.length() != 0) correct = correctPoint.substring(1); | 152 | if (correctPoint.length() != 0) correct = correctPoint.substring(1); |
| 147 | if (errorPoint.length() != 0) error = errorPoint.substring(1); | 153 | if (errorPoint.length() != 0) error = errorPoint.substring(1); |
| 148 | if (errorNum == 0) { | 154 | if (errorNum == 0) { |
| 149 | temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好。"; | 155 | temp = indent + "在本次作业中,答对题目有 %s 道,%s掌握的很好。"; |
| 150 | String s = String.format(temp, | 156 | String s = String.format(temp, |
| 151 | fromColor(String.valueOf(correctNum), "#489afa"), | 157 | fromColor(String.valueOf(correctNum), "#489afa"), |
| 152 | fromColor(correct, "#489afa") | 158 | fromColor(correct, "#489afa") |
| 153 | ); | 159 | ); |
| 154 | binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); | 160 | binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); |
| 155 | } else { | 161 | } else { |
| 156 | String s = String.format(temp, | 162 | String s = String.format(temp, |
| 157 | fromColor(String.valueOf(correctNum), "#489afa"), | 163 | fromColor(String.valueOf(correctNum), "#489afa"), |
| 158 | fromColor(correct, "#489afa"), | 164 | fromColor(correct, "#489afa"), |
| 159 | fromColor(String.valueOf(errorNum), "#ff4134"), | 165 | fromColor(String.valueOf(errorNum), "#ff4134"), |
| 160 | fromColor(error, "#ff4134") | 166 | fromColor(error, "#ff4134") |
| 161 | ); | 167 | ); |
| 162 | binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); | 168 | binding.tvRating.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_COMPACT)); |
| 163 | } | 169 | } |
| 164 | } | 170 | } |
| 165 | 171 | ||
| 166 | mAdapter.setNewData(errorList); | 172 | mAdapter.setNewData(errorList); |
| 173 | binding.rvBlank.setAdapter(new BlankAdapter(blankList)); | ||
| 174 | binding.viewBlank.setVisibility(blankList.isEmpty() ? View.GONE : View.VISIBLE); | ||
| 167 | } | 175 | } |
| 168 | 176 | ||
| 169 | private String fromColor(String str, String color) { | 177 | private String fromColor(String str, String color) { |
| 170 | return String.format("<font color='%s'>%s</font>", color, str); | 178 | return String.format("<font color='%s'>%s</font>", color, str); |
| 171 | } | 179 | } |
| 172 | 180 | ||
| 173 | @Override | 181 | @Override |
| 174 | protected ActivityHomeworkShareBinding getViewBinding() { | 182 | protected ActivityHomeworkShareBinding getViewBinding() { |
| 175 | return ActivityHomeworkShareBinding.inflate(getLayoutInflater()); | 183 | return ActivityHomeworkShareBinding.inflate(getLayoutInflater()); |
| 176 | } | 184 | } |
| 177 | 185 | ||
| 178 | private Uri saveBitmap() { | 186 | private Uri saveBitmap() { |
| 179 | try { | 187 | try { |
| 180 | binding.btnShare.setVisibility(View.GONE); | 188 | binding.btnShare.setVisibility(View.GONE); |
| 181 | binding.btnBack.setVisibility(View.GONE); | 189 | binding.btnBack.setVisibility(View.GONE); |
| 182 | Bitmap bitmap = BitmapUtils.shotView(binding.viewRoot); | 190 | Bitmap bitmap = BitmapUtils.shotView(binding.viewRoot); |
| 183 | binding.btnShare.setVisibility(View.VISIBLE); | 191 | binding.btnShare.setVisibility(View.VISIBLE); |
| 184 | binding.btnBack.setVisibility(View.VISIBLE); | 192 | binding.btnBack.setVisibility(View.VISIBLE); |
| 185 | 193 | ||
| 186 | String fileName = student.stuName + "_" + title; | 194 | String fileName = student.stuName + "_" + title; |
| 187 | return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); | 195 | return ContentUtil.saveBitmapToGallery(this, bitmap, fileName); |
| 188 | } catch (Exception e) { | 196 | } catch (Exception e) { |
| 189 | e.printStackTrace(); | 197 | e.printStackTrace(); |
| 190 | } | 198 | } |
| 191 | return null; | 199 | return null; |
| 192 | } | 200 | } |
| 193 | 201 | ||
| 194 | private static String ifEmpty(String s, String placeholder) { | 202 | private static String ifEmpty(String s, String placeholder) { |
| 195 | if (s == null || s.isEmpty()) return placeholder; | 203 | if (s == null || s.isEmpty()) return placeholder; |
| 196 | return s; | 204 | return s; |
| 197 | } | 205 | } |
| 198 | 206 | ||
| 207 | public static class BlankAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { | ||
| 208 | |||
| 209 | public BlankAdapter(@Nullable List<HomeWork> data) { | ||
| 210 | super(R.layout.item_huyou_daily_blank, data); | ||
| 211 | } | ||
| 212 | |||
| 213 | @Override | ||
| 214 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { | ||
| 215 | ImageView imageView = holder.getView(R.id.imageView); | ||
| 216 | Glide.with(mContext).load(homeWork.url).into(imageView); | ||
| 217 | } | ||
| 218 | } | ||
| 219 | |||
| 199 | public static class ErrorAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { | 220 | public static class ErrorAdapter extends BaseQuickAdapter<HomeWork, BaseViewHolder> { |
| 200 | 221 | ||
| 201 | public ErrorAdapter() { | 222 | public ErrorAdapter() { |
| 202 | super(R.layout.item_homework_error); | 223 | super(R.layout.item_homework_error); |
| 203 | } | 224 | } |
| 204 | 225 | ||
| 205 | @Override | 226 | @Override |
| 206 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { | 227 | protected void convert(@NonNull BaseViewHolder holder, HomeWork homeWork) { |
| 207 | ImageView ivTopic = holder.getView(R.id.ivTopic); | 228 | ImageView ivTopic = holder.getView(R.id.ivTopic); |
| 208 | TextView tvPoints = holder.getView(R.id.tvPoints); | 229 | TextView tvPoints = holder.getView(R.id.tvPoints); |
| 209 | ImageView ivAnalyze = holder.getView(R.id.ivAnalyze); | 230 | ImageView ivAnalyze = holder.getView(R.id.ivAnalyze); |
| 210 | 231 | ||
| 211 | showImage(ivTopic, homeWork.url); | 232 | showImage(ivTopic, homeWork.url); |
| 212 | showImage(ivAnalyze, homeWork.analyseUrl); | 233 | showImage(ivAnalyze, homeWork.analyseUrl); |
| 213 | tvPoints.setText("-"); | 234 | tvPoints.setText("-"); |
| 214 | if (homeWork.pointsObj == null || homeWork.pointsObj.isEmpty()) return; | 235 | if (homeWork.pointsObj == null || homeWork.pointsObj.isEmpty()) return; |
| 215 | StringBuilder builder = new StringBuilder(); | 236 | StringBuilder builder = new StringBuilder(); |
| 216 | for (KeyValue pair: homeWork.pointsObj) { | 237 | for (KeyValue pair: homeWork.pointsObj) { |
| 217 | builder.append(pair.Value).append("\n"); | 238 | builder.append(pair.Value).append("\n"); |
| 218 | } | 239 | } |
| 219 | tvPoints.setText(ifEmpty(builder.toString().trim(), "-")); | 240 | tvPoints.setText(ifEmpty(builder.toString().trim(), "-")); |
| 220 | } | 241 | } |
| 221 | 242 | ||
| 222 | @SuppressLint("CheckResult") | 243 | @SuppressLint("CheckResult") |
| 223 | private void showImage(ImageView view, String url) { | 244 | private void showImage(ImageView view, String url) { |
| 224 | view.setVisibility(View.GONE); | 245 | view.setVisibility(View.GONE); |
| 225 | view.setImageBitmap(null); | 246 | view.setImageBitmap(null); |
| 226 | if (url == null) { | 247 | if (url == null) { |
| 227 | return; | 248 | return; |
| 228 | } | 249 | } |
| 229 | view.setOnClickListener(v -> { | 250 | view.setOnClickListener(v -> { |
| 230 | new PhotoViewDialog(mContext).show(url); | 251 | new PhotoViewDialog(mContext).show(url); |
| 231 | }); | 252 | }); |
| 232 | Single.just(url) | 253 | Single.just(url) |
| 233 | .subscribeOn(Schedulers.io()) | 254 | .subscribeOn(Schedulers.io()) |
| 234 | .map(u -> Glide.with(mContext).asBitmap().load(url).submit().get()) | 255 | .map(u -> Glide.with(mContext).asBitmap().load(url).submit().get()) |
| 235 | .observeOn(AndroidSchedulers.mainThread()) | 256 | .observeOn(AndroidSchedulers.mainThread()) |
| 236 | .subscribe((bitmap, th) -> { | 257 | .subscribe((bitmap, th) -> { |
| 237 | if (bitmap == null) return; | 258 | if (bitmap == null) return; |
| 238 | 259 | ||
| 239 | float imageHeight = bitmap.getHeight(); | 260 | float imageHeight = bitmap.getHeight(); |
| 240 | float imageWidth = bitmap.getWidth(); | 261 | float imageWidth = bitmap.getWidth(); |
| 241 | int viewHeight = (int) (CommonUtil.getScreenHeight(mContext) * 0.75f); | 262 | int viewHeight = (int) (CommonUtil.getScreenHeight(mContext) * 0.75f); |
| 242 | int viewWidth = (int) (CommonUtil.getScreenWidth(mContext) * 0.75f); | 263 | int viewWidth = (int) (CommonUtil.getScreenWidth(mContext) * 0.75f); |
| 243 | LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(view.getLayoutParams()); | 264 | LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(view.getLayoutParams()); |
| 244 | if (imageHeight > imageWidth) { | 265 | if (imageHeight > imageWidth) { |
| 245 | if (viewHeight > imageHeight) { | 266 | if (viewHeight > imageHeight) { |
| 246 | layoutParams.height = (int) imageHeight; | 267 | layoutParams.height = (int) imageHeight; |
| 247 | layoutParams.width = (int) imageWidth; | 268 | layoutParams.width = (int) imageWidth; |
| 248 | } else { | 269 | } else { |
| 249 | layoutParams.height = viewHeight; | 270 | layoutParams.height = viewHeight; |
| 250 | layoutParams.width = (int) (imageWidth / imageHeight * viewHeight); | 271 | layoutParams.width = (int) (imageWidth / imageHeight * viewHeight); |
| 251 | } | 272 | } |
| 252 | } else { | 273 | } else { |
| 253 | if (viewWidth > imageWidth) { | 274 | if (viewWidth > imageWidth) { |
| 254 | layoutParams.height = (int) imageHeight; | 275 | layoutParams.height = (int) imageHeight; |
| 255 | layoutParams.width = (int) imageWidth; | 276 | layoutParams.width = (int) imageWidth; |
| 256 | } else { | 277 | } else { |
| 257 | layoutParams.height = (int) (imageHeight / imageWidth * viewWidth); | 278 | layoutParams.height = (int) (imageHeight / imageWidth * viewWidth); |
| 258 | layoutParams.width = viewWidth; | 279 | layoutParams.width = viewWidth; |
| 259 | } | 280 | } |
| 260 | } | 281 | } |
| 261 | 282 | ||
| 262 | layoutParams.setMargins(CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5)); | 283 | layoutParams.setMargins(CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5), CommonUtil.dpToPx(mContext, 5)); |
| 263 | view.setLayoutParams(layoutParams); | 284 | view.setLayoutParams(layoutParams); |
| 264 | view.setImageBitmap(bitmap); | 285 | view.setImageBitmap(bitmap); |
| 265 | view.setVisibility(View.VISIBLE); | 286 | view.setVisibility(View.VISIBLE); |
| 266 | }); | 287 | }); |
| 267 | } | 288 | } |
| 268 | } | 289 | } |
| 269 | } | 290 | } |
| 270 | 291 |
app/src/main/res/layout/activity_homework_share.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:background="#489AFA" | 7 | android:background="#489AFA" |
| 8 | android:layout_width="match_parent" | 8 | android:layout_width="match_parent" |
| 9 | android:layout_height="match_parent" | 9 | android:layout_height="match_parent" |
| 10 | tools:ignore="HardcodedText,ContentDescription"> | 10 | tools:ignore="HardcodedText,ContentDescription,SmallSp"> |
| 11 | 11 | ||
| 12 | <androidx.core.widget.NestedScrollView | 12 | <androidx.core.widget.NestedScrollView |
| 13 | android:layout_width="match_parent" | 13 | android:layout_width="match_parent" |
| 14 | android:layout_height="match_parent"> | 14 | android:layout_height="match_parent"> |
| 15 | <LinearLayout | 15 | <LinearLayout |
| 16 | android:id="@+id/viewRoot" | 16 | android:id="@+id/viewRoot" |
| 17 | android:orientation="vertical" | 17 | android:orientation="vertical" |
| 18 | android:paddingHorizontal="16dp" | 18 | android:paddingHorizontal="16dp" |
| 19 | android:paddingVertical="16dp" | 19 | android:paddingVertical="16dp" |
| 20 | android:background="#489AFA" | 20 | android:background="#489AFA" |
| 21 | android:layout_width="match_parent" | 21 | android:layout_width="match_parent" |
| 22 | android:layout_height="wrap_content"> | 22 | android:layout_height="wrap_content"> |
| 23 | 23 | ||
| 24 | <androidx.appcompat.widget.Toolbar | 24 | <androidx.appcompat.widget.Toolbar |
| 25 | android:id="@+id/toolbar" | 25 | android:id="@+id/toolbar" |
| 26 | app:contentInsetStart="0px" | 26 | app:contentInsetStart="0px" |
| 27 | android:layout_width="match_parent" | 27 | android:layout_width="match_parent" |
| 28 | android:layout_height="56dp"> | 28 | android:layout_height="56dp"> |
| 29 | <androidx.appcompat.widget.AppCompatImageView | 29 | <androidx.appcompat.widget.AppCompatImageView |
| 30 | android:id="@+id/btnBack" | 30 | android:id="@+id/btnBack" |
| 31 | android:tint="@color/white" | 31 | android:tint="@color/white" |
| 32 | android:src="@drawable/svg_arrow_head_start_black" | 32 | android:src="@drawable/svg_arrow_head_start_black" |
| 33 | android:paddingEnd="16dp" | 33 | android:paddingEnd="16dp" |
| 34 | android:paddingStart="0px" | ||
| 34 | android:layout_width="wrap_content" | 35 | android:layout_width="wrap_content" |
| 35 | android:layout_height="wrap_content"/> | 36 | android:layout_height="wrap_content"/> |
| 36 | 37 | ||
| 37 | <TextView | 38 | <TextView |
| 38 | android:id="@+id/tvTitle" | 39 | android:id="@+id/tvTitle" |
| 39 | android:text="-" | 40 | android:text="-" |
| 40 | android:textSize="18sp" | 41 | android:textSize="18sp" |
| 41 | android:singleLine="true" | 42 | android:singleLine="true" |
| 42 | android:ellipsize="middle" | 43 | android:ellipsize="middle" |
| 43 | android:textColor="@color/white" | 44 | android:textColor="@color/white" |
| 44 | android:textStyle="bold" | 45 | android:textStyle="bold" |
| 45 | android:layout_gravity="center" | 46 | android:layout_gravity="center" |
| 46 | android:layout_width="wrap_content" | 47 | android:layout_width="wrap_content" |
| 47 | android:layout_height="wrap_content"/> | 48 | android:layout_height="wrap_content"/> |
| 48 | 49 | ||
| 49 | <TextView | 50 | <TextView |
| 50 | android:id="@+id/btnShare" | 51 | android:id="@+id/btnShare" |
| 51 | android:text="分享" | 52 | android:text="分享" |
| 52 | android:textSize="15sp" | 53 | android:textSize="15sp" |
| 53 | android:textColor="@color/black" | 54 | android:textColor="@color/black" |
| 54 | android:paddingHorizontal="15dp" | 55 | android:paddingHorizontal="15dp" |
| 55 | android:paddingVertical="5dp" | 56 | android:paddingVertical="5dp" |
| 56 | android:background="@drawable/shape_circle" | 57 | android:background="@drawable/shape_circle" |
| 57 | android:backgroundTint="#FCDC28" | 58 | android:backgroundTint="#FCDC28" |
| 58 | android:layout_width="wrap_content" | 59 | android:layout_width="wrap_content" |
| 59 | android:layout_height="wrap_content" | 60 | android:layout_height="wrap_content" |
| 60 | android:layout_gravity="end|center_vertical" /> | 61 | android:layout_gravity="end|center_vertical" /> |
| 61 | </androidx.appcompat.widget.Toolbar> | 62 | </androidx.appcompat.widget.Toolbar> |
| 62 | 63 | ||
| 63 | <ImageView | 64 | <ImageView |
| 64 | android:src="@drawable/png_share_top" | 65 | android:src="@drawable/png_share_top" |
| 65 | android:elevation="1dp" | 66 | android:elevation="1dp" |
| 66 | android:layout_gravity="end" | 67 | android:layout_gravity="end" |
| 67 | android:layout_marginEnd="5dp" | 68 | android:layout_marginEnd="5dp" |
| 68 | android:layout_width="90dp" | 69 | android:layout_width="90dp" |
| 69 | android:layout_height="80dp"/> | 70 | android:layout_height="80dp"/> |
| 70 | 71 | ||
| 71 | <LinearLayout | 72 | <LinearLayout |
| 72 | android:orientation="vertical" | 73 | android:orientation="vertical" |
| 73 | android:background="@drawable/png_info_bg" | 74 | android:background="@drawable/png_info_bg" |
| 74 | android:paddingHorizontal="16dp" | 75 | android:paddingHorizontal="16dp" |
| 75 | android:paddingVertical="16dp" | 76 | android:paddingVertical="16dp" |
| 76 | android:layout_marginTop="-70dp" | 77 | android:layout_marginTop="-70dp" |
| 77 | android:layout_width="match_parent" | 78 | android:layout_width="match_parent" |
| 78 | android:layout_height="144dp"> | 79 | android:layout_height="144dp"> |
| 79 | <LinearLayout | 80 | <LinearLayout |
| 80 | android:orientation="horizontal" | 81 | android:orientation="horizontal" |
| 81 | android:layout_width="match_parent" | 82 | android:layout_width="match_parent" |
| 82 | android:layout_height="wrap_content"> | 83 | android:layout_height="wrap_content"> |
| 83 | <androidx.constraintlayout.utils.widget.ImageFilterView | 84 | <androidx.constraintlayout.utils.widget.ImageFilterView |
| 84 | android:id="@+id/ivAvatar" | 85 | android:id="@+id/ivAvatar" |
| 85 | tools:background="#2491FF" | 86 | tools:background="#2491FF" |
| 86 | app:round="40dp" | 87 | app:round="40dp" |
| 87 | android:layout_width="40dp" | 88 | android:layout_width="40dp" |
| 88 | android:layout_height="40dp"/> | 89 | android:layout_height="40dp"/> |
| 89 | <TextView | 90 | <TextView |
| 90 | android:id="@+id/tvStuName" | 91 | android:id="@+id/tvStuName" |
| 91 | tools:text="杨同学 " | 92 | tools:text="杨同学 " |
| 92 | android:textSize="14sp" | 93 | android:textSize="14sp" |
| 93 | android:textColor="#333" | 94 | android:textColor="#333" |
| 94 | android:textStyle="bold" | 95 | android:textStyle="bold" |
| 95 | android:layout_marginStart="8dp" | 96 | android:layout_marginStart="8dp" |
| 96 | android:layout_gravity="center_vertical" | 97 | android:layout_gravity="center_vertical" |
| 97 | android:layout_width="wrap_content" | 98 | android:layout_width="wrap_content" |
| 98 | android:layout_height="wrap_content"/> | 99 | android:layout_height="wrap_content"/> |
| 99 | </LinearLayout> | 100 | </LinearLayout> |
| 100 | <LinearLayout | 101 | <LinearLayout |
| 101 | android:orientation="horizontal" | 102 | android:orientation="horizontal" |
| 102 | android:background="@drawable/shape_radius_10" | 103 | android:background="@drawable/shape_radius_10" |
| 103 | android:backgroundTint="#F4FAFF" | 104 | android:backgroundTint="#F4FAFF" |
| 104 | android:layout_marginTop="12dp" | 105 | android:layout_marginTop="12dp" |
| 105 | android:layout_width="match_parent" | 106 | android:layout_width="match_parent" |
| 106 | android:layout_height="60dp"> | 107 | android:layout_height="60dp"> |
| 107 | <LinearLayout | 108 | <LinearLayout |
| 108 | android:orientation="vertical" | 109 | android:orientation="vertical" |
| 109 | android:gravity="center" | 110 | android:gravity="center" |
| 110 | android:layout_width="0dp" | 111 | android:layout_width="0dp" |
| 111 | android:layout_height="match_parent" | 112 | android:layout_height="match_parent" |
| 112 | android:layout_weight="1"> | 113 | android:layout_weight="1"> |
| 113 | <LinearLayout | 114 | <LinearLayout |
| 114 | android:paddingEnd="20dp" | 115 | android:paddingEnd="20dp" |
| 116 | android:paddingStart="0px" | ||
| 115 | android:gravity="center_vertical" | 117 | android:gravity="center_vertical" |
| 116 | android:layout_width="wrap_content" | 118 | android:layout_width="wrap_content" |
| 117 | android:layout_height="wrap_content"> | 119 | android:layout_height="wrap_content"> |
| 118 | <ImageView | 120 | <ImageView |
| 119 | android:src="@drawable/png_iv_grade" | 121 | android:src="@drawable/png_iv_grade" |
| 120 | android:layout_marginEnd="5dp" | 122 | android:layout_marginEnd="5dp" |
| 121 | android:layout_width="16dp" | 123 | android:layout_width="16dp" |
| 122 | android:layout_height="14dp"/> | 124 | android:layout_height="14dp"/> |
| 123 | <TextView | 125 | <TextView |
| 124 | android:text="年级" | 126 | android:text="年级" |
| 125 | android:textSize="12sp" | 127 | android:textSize="12sp" |
| 126 | android:textColor="#333" | 128 | android:textColor="#333" |
| 127 | android:textStyle="bold" | 129 | android:textStyle="bold" |
| 128 | android:layout_width="wrap_content" | 130 | android:layout_width="wrap_content" |
| 129 | android:layout_height="wrap_content"/> | 131 | android:layout_height="wrap_content"/> |
| 130 | </LinearLayout> | 132 | </LinearLayout> |
| 131 | <TextView | 133 | <TextView |
| 132 | android:id="@+id/tvGrade" | 134 | android:id="@+id/tvGrade" |
| 133 | tools:text="七年级" | 135 | tools:text="七年级" |
| 134 | android:textSize="12sp" | 136 | android:textSize="12sp" |
| 135 | android:textColor="#489AFA" | 137 | android:textColor="#489AFA" |
| 136 | android:textStyle="bold" | 138 | android:textStyle="bold" |
| 137 | android:layout_marginTop="8dp" | 139 | android:layout_marginTop="8dp" |
| 138 | android:layout_width="wrap_content" | 140 | android:layout_width="wrap_content" |
| 139 | android:layout_height="wrap_content"/> | 141 | android:layout_height="wrap_content"/> |
| 140 | </LinearLayout> | 142 | </LinearLayout> |
| 141 | <LinearLayout | 143 | <LinearLayout |
| 142 | android:orientation="vertical" | 144 | android:orientation="vertical" |
| 143 | android:gravity="center" | 145 | android:gravity="center" |
| 144 | android:layout_width="0dp" | 146 | android:layout_width="0dp" |
| 145 | android:layout_height="match_parent" | 147 | android:layout_height="match_parent" |
| 146 | android:layout_weight="1"> | 148 | android:layout_weight="1"> |
| 147 | <LinearLayout | 149 | <LinearLayout |
| 148 | android:paddingEnd="20dp" | 150 | android:paddingEnd="20dp" |
| 151 | android:paddingStart="0px" | ||
| 149 | android:gravity="center_vertical" | 152 | android:gravity="center_vertical" |
| 150 | android:layout_width="wrap_content" | 153 | android:layout_width="wrap_content" |
| 151 | android:layout_height="wrap_content"> | 154 | android:layout_height="wrap_content"> |
| 152 | <ImageView | 155 | <ImageView |
| 153 | android:src="@drawable/png_iv_subject" | 156 | android:src="@drawable/png_iv_subject" |
| 154 | android:layout_marginEnd="5dp" | 157 | android:layout_marginEnd="5dp" |
| 155 | android:layout_width="16dp" | 158 | android:layout_width="16dp" |
| 156 | android:layout_height="14dp"/> | 159 | android:layout_height="14dp"/> |
| 157 | <TextView | 160 | <TextView |
| 158 | android:text="学科" | 161 | android:text="学科" |
| 159 | android:textSize="12sp" | 162 | android:textSize="12sp" |
| 160 | android:textColor="#333" | 163 | android:textColor="#333" |
| 161 | android:textStyle="bold" | 164 | android:textStyle="bold" |
| 162 | android:layout_width="wrap_content" | 165 | android:layout_width="wrap_content" |
| 163 | android:layout_height="wrap_content"/> | 166 | android:layout_height="wrap_content"/> |
| 164 | </LinearLayout> | 167 | </LinearLayout> |
| 165 | <TextView | 168 | <TextView |
| 166 | android:id="@+id/tvSubject" | 169 | android:id="@+id/tvSubject" |
| 167 | tools:text="数学" | 170 | tools:text="数学" |
| 168 | android:textSize="12sp" | 171 | android:textSize="12sp" |
| 169 | android:textColor="#489AFA" | 172 | android:textColor="#489AFA" |
| 170 | android:textStyle="bold" | 173 | android:textStyle="bold" |
| 171 | android:layout_marginTop="8dp" | 174 | android:layout_marginTop="8dp" |
| 172 | android:layout_width="wrap_content" | 175 | android:layout_width="wrap_content" |
| 173 | android:layout_height="wrap_content"/> | 176 | android:layout_height="wrap_content"/> |
| 174 | </LinearLayout> | 177 | </LinearLayout> |
| 175 | <LinearLayout | 178 | <LinearLayout |
| 176 | android:orientation="vertical" | 179 | android:orientation="vertical" |
| 177 | android:gravity="center" | 180 | android:gravity="center" |
| 178 | android:layout_width="0dp" | 181 | android:layout_width="0dp" |
| 179 | android:layout_height="match_parent" | 182 | android:layout_height="match_parent" |
| 180 | android:layout_weight="1"> | 183 | android:layout_weight="1"> |
| 181 | <LinearLayout | 184 | <LinearLayout |
| 182 | android:paddingEnd="20dp" | 185 | android:paddingEnd="20dp" |
| 186 | android:paddingStart="0px" | ||
| 183 | android:gravity="center_vertical" | 187 | android:gravity="center_vertical" |
| 184 | android:layout_width="wrap_content" | 188 | android:layout_width="wrap_content" |
| 185 | android:layout_height="wrap_content"> | 189 | android:layout_height="wrap_content"> |
| 186 | <ImageView | 190 | <ImageView |
| 187 | android:src="@drawable/png_ic_during" | 191 | android:src="@drawable/png_ic_during" |
| 188 | android:layout_marginEnd="5dp" | 192 | android:layout_marginEnd="5dp" |
| 189 | android:layout_width="14dp" | 193 | android:layout_width="14dp" |
| 190 | android:layout_height="13dp"/> | 194 | android:layout_height="13dp"/> |
| 191 | <TextView | 195 | <TextView |
| 192 | android:text="周期" | 196 | android:text="周期" |
| 193 | android:textSize="12sp" | 197 | android:textSize="12sp" |
| 194 | android:textColor="#333" | 198 | android:textColor="#333" |
| 195 | android:textStyle="bold" | 199 | android:textStyle="bold" |
| 196 | android:layout_width="wrap_content" | 200 | android:layout_width="wrap_content" |
| 197 | android:layout_height="wrap_content"/> | 201 | android:layout_height="wrap_content"/> |
| 198 | </LinearLayout> | 202 | </LinearLayout> |
| 199 | <TextView | 203 | <TextView |
| 200 | android:id="@+id/tvDate" | 204 | android:id="@+id/tvDate" |
| 201 | tools:text="2024.09.01" | 205 | tools:text="2024.09.01" |
| 202 | android:textSize="12sp" | 206 | android:textSize="12sp" |
| 203 | android:textColor="#489AFA" | 207 | android:textColor="#489AFA" |
| 204 | android:textStyle="bold" | 208 | android:textStyle="bold" |
| 205 | android:layout_marginTop="8dp" | 209 | android:layout_marginTop="8dp" |
| 206 | android:layout_width="wrap_content" | 210 | android:layout_width="wrap_content" |
| 207 | android:layout_height="wrap_content"/> | 211 | android:layout_height="wrap_content"/> |
| 208 | </LinearLayout> | 212 | </LinearLayout> |
| 209 | </LinearLayout> | 213 | </LinearLayout> |
| 210 | </LinearLayout> | 214 | </LinearLayout> |
| 211 | 215 | ||
| 212 | <LinearLayout | 216 | <LinearLayout |
| 213 | android:orientation="vertical" | 217 | android:orientation="vertical" |
| 214 | android:background="@drawable/shape_radius_10" | 218 | android:background="@drawable/shape_radius_10" |
| 215 | android:backgroundTint="@color/white" | 219 | android:backgroundTint="@color/white" |
| 216 | android:paddingHorizontal="16dp" | 220 | android:paddingHorizontal="16dp" |
| 217 | android:paddingBottom="16dp" | 221 | android:paddingBottom="16dp" |
| 218 | android:layout_marginTop="12dp" | 222 | android:layout_marginTop="12dp" |
| 219 | android:layout_width="match_parent" | 223 | android:layout_width="match_parent" |
| 220 | android:layout_height="wrap_content"> | 224 | android:layout_height="wrap_content"> |
| 221 | <TextView | 225 | <TextView |
| 222 | android:text="作业总评" | 226 | android:text="作业总评" |
| 223 | android:textSize="16sp" | 227 | android:textSize="16sp" |
| 224 | android:textStyle="bold" | 228 | android:textStyle="bold" |
| 225 | android:textColor="#333" | 229 | android:textColor="#333" |
| 226 | android:paddingStart="24dp" | 230 | android:paddingStart="24dp" |
| 227 | android:paddingEnd="4dp" | 231 | android:paddingEnd="4dp" |
| 228 | android:paddingTop="4dp" | 232 | android:paddingTop="4dp" |
| 229 | android:background="@drawable/bg_homework_eval" | 233 | android:background="@drawable/bg_homework_eval" |
| 230 | android:layout_gravity="center_horizontal" | 234 | android:layout_gravity="center_horizontal" |
| 231 | android:layout_marginTop="12dp" | 235 | android:layout_marginTop="12dp" |
| 232 | android:layout_width="wrap_content" | 236 | android:layout_width="wrap_content" |
| 233 | android:layout_height="wrap_content"/> | 237 | android:layout_height="wrap_content"/> |
| 234 | 238 | ||
| 235 | <LinearLayout | 239 | <LinearLayout |
| 236 | android:orientation="horizontal" | 240 | android:orientation="horizontal" |
| 237 | android:background="@drawable/shape_radius_5" | 241 | android:background="@drawable/shape_radius_5" |
| 238 | android:backgroundTint="#F4FAFF" | 242 | android:backgroundTint="#F4FAFF" |
| 239 | android:layout_width="match_parent" | 243 | android:layout_width="match_parent" |
| 240 | android:layout_height="80dp" | 244 | android:layout_height="80dp" |
| 241 | android:layout_marginTop="12dp"> | 245 | android:layout_marginTop="12dp"> |
| 242 | <LinearLayout | 246 | <LinearLayout |
| 243 | android:orientation="vertical" | 247 | android:orientation="vertical" |
| 244 | android:gravity="center" | 248 | android:gravity="center" |
| 245 | android:layout_width="0dp" | 249 | android:layout_width="0dp" |
| 246 | android:layout_height="match_parent" | 250 | android:layout_height="match_parent" |
| 247 | android:layout_weight="1"> | 251 | android:layout_weight="1"> |
| 248 | <LinearLayout | 252 | <LinearLayout |
| 249 | android:orientation="horizontal" | 253 | android:orientation="horizontal" |
| 250 | android:gravity="center_vertical" | 254 | android:gravity="center_vertical" |
| 251 | android:layout_width="wrap_content" | 255 | android:layout_width="wrap_content" |
| 252 | android:layout_height="wrap_content"> | 256 | android:layout_height="wrap_content"> |
| 253 | <ImageView | 257 | <ImageView |
| 254 | android:src="@drawable/png_icon_statistical_accuracy" | 258 | android:src="@drawable/png_icon_statistical_accuracy" |
| 255 | android:layout_width="12dp" | 259 | android:layout_width="12dp" |
| 256 | android:layout_height="13dp"/> | 260 | android:layout_height="13dp"/> |
| 257 | <TextView | 261 | <TextView |
| 258 | android:text="作业正确率" | 262 | android:text="作业正确率" |
| 259 | android:textSize="11sp" | 263 | android:textSize="11sp" |
| 260 | android:textColor="#333" | 264 | android:textColor="#333" |
| 261 | android:textStyle="bold" | 265 | android:textStyle="bold" |
| 262 | android:layout_marginStart="5dp" | 266 | android:layout_marginStart="5dp" |
| 263 | android:layout_width="wrap_content" | 267 | android:layout_width="wrap_content" |
| 264 | android:layout_height="wrap_content"/> | 268 | android:layout_height="wrap_content"/> |
| 265 | </LinearLayout> | 269 | </LinearLayout> |
| 266 | <LinearLayout | 270 | <LinearLayout |
| 267 | android:orientation="horizontal" | 271 | android:orientation="horizontal" |
| 268 | android:layout_marginTop="8dp" | 272 | android:layout_marginTop="8dp" |
| 269 | android:layout_width="wrap_content" | 273 | android:layout_width="wrap_content" |
| 270 | android:layout_height="wrap_content"> | 274 | android:layout_height="wrap_content"> |
| 271 | <TextView | 275 | <TextView |
| 272 | android:id="@+id/tvPercent" | 276 | android:id="@+id/tvPercent" |
| 273 | tools:text="88" | 277 | tools:text="88" |
| 274 | android:textSize="14sp" | 278 | android:textSize="14sp" |
| 275 | android:textColor="#489AFA" | 279 | android:textColor="#489AFA" |
| 276 | android:textStyle="bold" | 280 | android:textStyle="bold" |
| 277 | android:layout_width="wrap_content" | 281 | android:layout_width="wrap_content" |
| 278 | android:layout_height="wrap_content"/> | 282 | android:layout_height="wrap_content"/> |
| 279 | <TextView | 283 | <TextView |
| 280 | android:text="%" | 284 | android:text="%" |
| 281 | android:textSize="9sp" | 285 | android:textSize="9sp" |
| 282 | android:textColor="#489AFA" | 286 | android:textColor="#489AFA" |
| 283 | android:textStyle="bold" | 287 | android:textStyle="bold" |
| 284 | android:layout_width="wrap_content" | 288 | android:layout_width="wrap_content" |
| 285 | android:layout_height="wrap_content"/> | 289 | android:layout_height="wrap_content"/> |
| 286 | </LinearLayout> | 290 | </LinearLayout> |
| 287 | </LinearLayout> | 291 | </LinearLayout> |
| 288 | <LinearLayout | 292 | <LinearLayout |
| 289 | android:orientation="vertical" | 293 | android:orientation="vertical" |
| 290 | android:gravity="center" | 294 | android:gravity="center" |
| 291 | android:layout_width="0dp" | 295 | android:layout_width="0dp" |
| 292 | android:layout_height="match_parent" | 296 | android:layout_height="match_parent" |
| 293 | android:layout_weight="1"> | 297 | android:layout_weight="1"> |
| 294 | <LinearLayout | 298 | <LinearLayout |
| 295 | android:orientation="horizontal" | 299 | android:orientation="horizontal" |
| 296 | android:gravity="center_vertical" | 300 | android:gravity="center_vertical" |
| 297 | android:layout_width="wrap_content" | 301 | android:layout_width="wrap_content" |
| 298 | android:layout_height="wrap_content"> | 302 | android:layout_height="wrap_content"> |
| 299 | <ImageView | 303 | <ImageView |
| 300 | android:src="@drawable/png_icon_statistical_accuracy" | 304 | android:src="@drawable/png_icon_statistical_accuracy" |
| 301 | android:layout_width="12dp" | 305 | android:layout_width="12dp" |
| 302 | android:layout_height="13dp"/> | 306 | android:layout_height="13dp"/> |
| 303 | <TextView | 307 | <TextView |
| 304 | android:text="答对题数" | 308 | android:text="答对题数" |
| 305 | android:textSize="11sp" | 309 | android:textSize="11sp" |
| 306 | android:textColor="#333" | 310 | android:textColor="#333" |
| 307 | android:textStyle="bold" | 311 | android:textStyle="bold" |
| 308 | android:layout_marginStart="5dp" | 312 | android:layout_marginStart="5dp" |
| 309 | android:layout_width="wrap_content" | 313 | android:layout_width="wrap_content" |
| 310 | android:layout_height="wrap_content"/> | 314 | android:layout_height="wrap_content"/> |
| 311 | </LinearLayout> | 315 | </LinearLayout> |
| 312 | <LinearLayout | 316 | <LinearLayout |
| 313 | android:orientation="horizontal" | 317 | android:orientation="horizontal" |
| 314 | android:layout_marginTop="8dp" | 318 | android:layout_marginTop="8dp" |
| 315 | android:layout_width="wrap_content" | 319 | android:layout_width="wrap_content" |
| 316 | android:layout_height="wrap_content"> | 320 | android:layout_height="wrap_content"> |
| 317 | <TextView | 321 | <TextView |
| 318 | android:id="@+id/tvCorrect" | 322 | android:id="@+id/tvCorrect" |
| 319 | tools:text="88" | 323 | tools:text="88" |
| 320 | android:textSize="14sp" | 324 | android:textSize="14sp" |
| 321 | android:textColor="#489AFA" | 325 | android:textColor="#489AFA" |
| 322 | android:textStyle="bold" | 326 | android:textStyle="bold" |
| 323 | android:layout_width="wrap_content" | 327 | android:layout_width="wrap_content" |
| 324 | android:layout_height="wrap_content"/> | 328 | android:layout_height="wrap_content"/> |
| 325 | <TextView | 329 | <TextView |
| 326 | android:text="道" | 330 | android:text="道" |
| 327 | android:textSize="9sp" | 331 | android:textSize="9sp" |
| 328 | android:textColor="#489AFA" | 332 | android:textColor="#489AFA" |
| 329 | android:textStyle="bold" | 333 | android:textStyle="bold" |
| 330 | android:layout_width="wrap_content" | 334 | android:layout_width="wrap_content" |
| 331 | android:layout_height="wrap_content"/> | 335 | android:layout_height="wrap_content"/> |
| 332 | </LinearLayout> | 336 | </LinearLayout> |
| 333 | </LinearLayout> | 337 | </LinearLayout> |
| 334 | <LinearLayout | 338 | <LinearLayout |
| 335 | android:orientation="vertical" | 339 | android:orientation="vertical" |
| 336 | android:gravity="center" | 340 | android:gravity="center" |
| 337 | android:layout_width="0dp" | 341 | android:layout_width="0dp" |
| 338 | android:layout_height="match_parent" | 342 | android:layout_height="match_parent" |
| 339 | android:layout_weight="1"> | 343 | android:layout_weight="1"> |
| 340 | <LinearLayout | 344 | <LinearLayout |
| 341 | android:orientation="horizontal" | 345 | android:orientation="horizontal" |
| 342 | android:gravity="center_vertical" | 346 | android:gravity="center_vertical" |
| 343 | android:layout_width="wrap_content" | 347 | android:layout_width="wrap_content" |
| 344 | android:layout_height="wrap_content"> | 348 | android:layout_height="wrap_content"> |
| 345 | <ImageView | 349 | <ImageView |
| 346 | android:src="@drawable/png_icon_statistical_accuracy" | 350 | android:src="@drawable/png_icon_statistical_accuracy" |
| 347 | android:layout_width="12dp" | 351 | android:layout_width="12dp" |
| 348 | android:layout_height="13dp"/> | 352 | android:layout_height="13dp"/> |
| 349 | <TextView | 353 | <TextView |
| 350 | android:text="答错题数" | 354 | android:text="答错题数" |
| 351 | android:textSize="11sp" | 355 | android:textSize="11sp" |
| 352 | android:textColor="#333" | 356 | android:textColor="#333" |
| 353 | android:textStyle="bold" | 357 | android:textStyle="bold" |
| 354 | android:layout_marginStart="5dp" | 358 | android:layout_marginStart="5dp" |
| 355 | android:layout_width="wrap_content" | 359 | android:layout_width="wrap_content" |
| 356 | android:layout_height="wrap_content"/> | 360 | android:layout_height="wrap_content"/> |
| 357 | </LinearLayout> | 361 | </LinearLayout> |
| 358 | <LinearLayout | 362 | <LinearLayout |
| 359 | android:orientation="horizontal" | 363 | android:orientation="horizontal" |
| 360 | android:layout_marginTop="8dp" | 364 | android:layout_marginTop="8dp" |
| 361 | android:layout_width="wrap_content" | 365 | android:layout_width="wrap_content" |
| 362 | android:layout_height="wrap_content"> | 366 | android:layout_height="wrap_content"> |
| 363 | <TextView | 367 | <TextView |
| 364 | android:id="@+id/tvWrong" | 368 | android:id="@+id/tvWrong" |
| 365 | tools:text="88" | 369 | tools:text="88" |
| 366 | android:textSize="14sp" | 370 | android:textSize="14sp" |
| 367 | android:textColor="#489AFA" | 371 | android:textColor="#489AFA" |
| 368 | android:textStyle="bold" | 372 | android:textStyle="bold" |
| 369 | android:layout_width="wrap_content" | 373 | android:layout_width="wrap_content" |
| 370 | android:layout_height="wrap_content"/> | 374 | android:layout_height="wrap_content"/> |
| 371 | <TextView | 375 | <TextView |
| 372 | android:text="道" | 376 | android:text="道" |
| 373 | android:textSize="9sp" | 377 | android:textSize="9sp" |
| 374 | android:textColor="#489AFA" | 378 | android:textColor="#489AFA" |
| 375 | android:textStyle="bold" | 379 | android:textStyle="bold" |
| 376 | android:layout_width="wrap_content" | 380 | android:layout_width="wrap_content" |
| 377 | android:layout_height="wrap_content"/> | 381 | android:layout_height="wrap_content"/> |
| 378 | </LinearLayout> | 382 | </LinearLayout> |
| 379 | </LinearLayout> | 383 | </LinearLayout> |
| 384 | <LinearLayout | ||
| 385 | android:orientation="vertical" | ||
| 386 | android:gravity="center" | ||
| 387 | android:layout_width="0dp" | ||
| 388 | android:layout_height="match_parent" | ||
| 389 | android:layout_weight="1"> | ||
| 390 | <LinearLayout | ||
| 391 | android:orientation="horizontal" | ||
| 392 | android:gravity="center_vertical" | ||
| 393 | android:layout_width="wrap_content" | ||
| 394 | android:layout_height="wrap_content"> | ||
| 395 | <ImageView | ||
| 396 | android:src="@drawable/png_icon_statistical_accuracy" | ||
| 397 | android:layout_width="12dp" | ||
| 398 | android:layout_height="13dp"/> | ||
| 399 | <TextView | ||
| 400 | android:text="未做题数" | ||
| 401 | android:textSize="11sp" | ||
| 402 | android:textColor="#333" | ||
| 403 | android:textStyle="bold" | ||
| 404 | android:layout_marginStart="5dp" | ||
| 405 | android:layout_width="wrap_content" | ||
| 406 | android:layout_height="wrap_content"/> | ||
| 407 | </LinearLayout> | ||
| 408 | <LinearLayout | ||
| 409 | android:orientation="horizontal" | ||
| 410 | android:layout_marginTop="8dp" | ||
| 411 | android:layout_width="wrap_content" | ||
| 412 | android:layout_height="wrap_content"> | ||
| 413 | <TextView | ||
| 414 | android:id="@+id/tvBlank" | ||
| 415 | tools:text="88" | ||
| 416 | android:textSize="14sp" | ||
| 417 | android:textColor="#489AFA" | ||
| 418 | android:textStyle="bold" | ||
| 419 | android:layout_width="wrap_content" | ||
| 420 | android:layout_height="wrap_content"/> | ||
| 421 | <TextView | ||
| 422 | android:text="道" | ||
| 423 | android:textSize="9sp" | ||
| 424 | android:textColor="#489AFA" | ||
| 425 | android:textStyle="bold" | ||
| 426 | android:layout_width="wrap_content" | ||
| 427 | android:layout_height="wrap_content" /> | ||
| 428 | </LinearLayout> | ||
| 429 | </LinearLayout> | ||
| 380 | </LinearLayout> | 430 | </LinearLayout> |
| 381 | <TextView | 431 | <TextView |
| 382 | android:id="@+id/tvRating" | 432 | android:id="@+id/tvRating" |
| 383 | android:text="-" | 433 | android:text="-" |
| 384 | android:textSize="12sp" | 434 | android:textSize="12sp" |
| 385 | android:textColor="#333" | 435 | android:textColor="#333" |
| 386 | android:lineSpacingMultiplier="1.3" | 436 | android:lineSpacingMultiplier="1.3" |
| 387 | android:layout_width="match_parent" | 437 | android:layout_width="match_parent" |
| 388 | android:layout_height="wrap_content" | 438 | android:layout_height="wrap_content" |
| 389 | android:layout_marginTop="16dp"/> | 439 | android:layout_marginTop="16dp"/> |
| 390 | </LinearLayout> | 440 | </LinearLayout> |
| 391 | 441 | ||
| 392 | <LinearLayout | 442 | <LinearLayout |
| 393 | android:orientation="vertical" | 443 | android:orientation="vertical" |
| 394 | android:background="@drawable/shape_radius_10" | 444 | android:background="@drawable/shape_radius_10" |
| 395 | android:backgroundTint="@color/white" | 445 | android:backgroundTint="@color/white" |
| 396 | android:paddingHorizontal="16dp" | 446 | android:paddingHorizontal="16dp" |
| 397 | android:paddingBottom="16dp" | 447 | android:paddingBottom="16dp" |
| 398 | android:layout_marginTop="12dp" | 448 | android:layout_marginTop="12dp" |
| 399 | android:layout_width="match_parent" | 449 | android:layout_width="match_parent" |
| 400 | android:layout_height="wrap_content"> | 450 | android:layout_height="wrap_content"> |
| 401 | 451 | ||
| 402 | <TextView | 452 | <TextView |
| 403 | android:text="作业错题" | 453 | android:text="作业错题" |
| 404 | android:textSize="16sp" | 454 | android:textSize="16sp" |
| 405 | android:textStyle="bold" | 455 | android:textStyle="bold" |
| 406 | android:textColor="#333" | 456 | android:textColor="#333" |
| 407 | android:paddingStart="24dp" | 457 | android:paddingStart="24dp" |
| 408 | android:paddingEnd="4dp" | 458 | android:paddingEnd="4dp" |
| 409 | android:paddingTop="4dp" | 459 | android:paddingTop="4dp" |
| 410 | android:background="@drawable/bg_homework_error" | 460 | android:background="@drawable/bg_homework_error" |
| 411 | android:layout_gravity="center_horizontal" | 461 | android:layout_gravity="center_horizontal" |
| 412 | android:layout_marginTop="12dp" | 462 | android:layout_marginTop="12dp" |
| 413 | android:layout_width="wrap_content" | 463 | android:layout_width="wrap_content" |
| 414 | android:layout_height="wrap_content"/> | 464 | android:layout_height="wrap_content"/> |
| 415 | 465 | ||
| 416 | <androidx.recyclerview.widget.RecyclerView | 466 | <androidx.recyclerview.widget.RecyclerView |
| 417 | android:id="@+id/rvWrong" | 467 | android:id="@+id/rvWrong" |
| 418 | android:orientation="vertical" | 468 | android:orientation="vertical" |
| 419 | app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | 469 | app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" |
| 420 | android:layout_marginTop="12dp" | 470 | android:layout_marginTop="12dp" |
| 421 | tools:listitem="@layout/item_homework_error" | 471 | tools:listitem="@layout/item_homework_error" |
| 422 | tools:itemCount="1" | 472 | tools:itemCount="1" |
| 423 | android:layout_width="match_parent" | 473 | android:layout_width="match_parent" |
| 424 | android:layout_height="wrap_content"/> | 474 | android:layout_height="wrap_content"/> |
| 425 | 475 | ||
| 426 | </LinearLayout> | 476 | </LinearLayout> |
| 427 | 477 | ||
| 428 | <LinearLayout | 478 | <LinearLayout |
| 479 | android:id="@+id/viewBlank" | ||
| 480 | android:orientation="vertical" | ||
| 481 | android:background="@drawable/shape_radius_10" | ||
| 482 | android:backgroundTint="@color/white" | ||
| 483 | android:paddingHorizontal="16dp" | ||
| 484 | android:paddingBottom="16dp" | ||
| 485 | android:layout_marginTop="12dp" | ||
| 486 | android:layout_width="match_parent" | ||
| 487 | android:layout_height="wrap_content"> | ||
| 488 | <TextView | ||
| 489 | android:text="未做题目" | ||
| 490 | android:textSize="16sp" | ||
| 491 | android:textStyle="bold" | ||
| 492 | android:textColor="#333" | ||
| 493 | android:paddingStart="24dp" | ||
| 494 | android:paddingEnd="4dp" | ||
| 495 | android:paddingTop="4dp" | ||
| 496 | android:background="@drawable/bg_homework_error" | ||
| 497 | android:layout_gravity="center_horizontal" | ||
| 498 | android:layout_marginTop="12dp" | ||
| 499 | android:layout_width="wrap_content" | ||
| 500 | android:layout_height="wrap_content"/> | ||
| 501 | |||
| 502 | <androidx.recyclerview.widget.RecyclerView | ||
| 503 | android:id="@+id/rvBlank" | ||
| 504 | android:orientation="vertical" | ||
| 505 | app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | ||
| 506 | android:layout_marginTop="12dp" | ||
| 507 | android:layout_width="match_parent" | ||
| 508 | android:layout_height="wrap_content"/> | ||
| 509 | </LinearLayout> | ||
| 510 | |||
| 511 | <LinearLayout | ||
| 429 | android:id="@+id/flComment" | 512 | android:id="@+id/flComment" |
| 430 | android:orientation="vertical" | 513 | android:orientation="vertical" |
| 431 | android:background="@drawable/shape_radius_10" | 514 | android:background="@drawable/shape_radius_10" |
| 432 | android:backgroundTint="@color/white" | 515 | android:backgroundTint="@color/white" |
| 433 | android:layout_marginTop="12dp" | 516 | android:layout_marginTop="12dp" |
| 434 | android:layout_width="match_parent" | 517 | android:layout_width="match_parent" |
| 435 | android:layout_height="wrap_content"> | 518 | android:layout_height="wrap_content"> |
| 436 | 519 | ||
| 437 | <TextView | 520 | <TextView |
| 438 | android:text="教师评语" | 521 | android:text="教师评语" |
| 439 | android:textSize="16sp" | 522 | android:textSize="16sp" |
| 440 | android:textStyle="bold" | 523 | android:textStyle="bold" |
| 441 | android:textColor="#333" | 524 | android:textColor="#333" |
| 442 | android:paddingStart="24dp" | 525 | android:paddingStart="24dp" |
| 443 | android:paddingEnd="4dp" | 526 | android:paddingEnd="4dp" |
| 444 | android:paddingTop="4dp" | 527 | android:paddingTop="4dp" |
| 445 | android:background="@drawable/bg_homework_comment" | 528 | android:background="@drawable/bg_homework_comment" |
| 446 | android:layout_gravity="center_horizontal" | 529 | android:layout_gravity="center_horizontal" |
| 447 | android:layout_width="wrap_content" | 530 | android:layout_width="wrap_content" |
| 448 | android:layout_height="wrap_content" | 531 | android:layout_height="wrap_content" |
| 449 | android:layout_marginTop="12dp"/> | 532 | android:layout_marginTop="12dp"/> |
| 450 | 533 | ||
| 451 | <TextView | 534 | <TextView |
| 452 | android:id="@+id/tvComment" | 535 | android:id="@+id/tvComment" |
| 453 | android:text="-" | 536 | android:text="-" |
| 454 | android:textSize="12sp" | 537 | android:textSize="12sp" |
| 455 | android:textColor="#333" | 538 | android:textColor="#333" |
| 456 | android:lineSpacingMultiplier="1.3" | 539 | android:lineSpacingMultiplier="1.3" |
| 457 | android:layout_marginHorizontal="16dp" | 540 | android:layout_marginHorizontal="16dp" |
| 458 | android:layout_marginTop="12dp" | 541 | android:layout_marginTop="12dp" |
| 459 | android:layout_marginBottom="16dp" | 542 | android:layout_marginBottom="16dp" |
| 460 | android:layout_width="match_parent" | 543 | android:layout_width="match_parent" |
| 461 | android:layout_height="wrap_content"/> | 544 | android:layout_height="wrap_content"/> |
| 462 | 545 | ||
| 463 | </LinearLayout> | 546 | </LinearLayout> |
| 464 | </LinearLayout> | 547 | </LinearLayout> |
| 465 | </androidx.core.widget.NestedScrollView> | 548 | </androidx.core.widget.NestedScrollView> |
| 466 | 549 | ||
| 467 | </LinearLayout> | 550 | </LinearLayout> |
app/src/main/res/layout/item_huyou_daily_blank.xml
| File was created | 1 | <?xml version="1.0" encoding="utf-8"?> | |
| 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 4 | xmlns:tools="http://schemas.android.com/tools" | ||
| 5 | android:orientation="vertical" | ||
| 6 | android:background="@drawable/bg_feedback_blank" | ||
| 7 | android:layout_width="match_parent" | ||
| 8 | android:layout_height="wrap_content" | ||
| 9 | tools:ignore="UseCompoundDrawables,HardcodedText,SmallSp,ContentDescription"> | ||
| 10 | |||
| 11 | <ImageView | ||
| 12 | android:id="@+id/imageView" | ||
| 13 | android:adjustViewBounds="true" | ||
| 14 | android:layout_margin="10dp" | ||
| 15 | android:layout_width="match_parent" | ||
| 16 | android:layout_height="wrap_content"/> | ||
| 17 | |||
| 18 | </LinearLayout> |