Commit 67fd5373bf77b6b1ed2b351cf057f79e8d383074

Authored by shixianjie
1 parent 25e17c06b1
Exists in master

bugfix; 布局优化; 交互逻辑调整;

app/src/main/java/com/hjx/parent/App.java
... ... @@ -5,6 +5,7 @@ import com.prws.common.bean.GradeAndSubject;
5 5 import com.prws.common.utils.SharedPreferencesUtil;
6 6 import com.uuzuche.lib_zxing.activity.ZXingLibrary;
7 7  
  8 +import java.util.ArrayList;
8 9 import java.util.List;
9 10  
10 11 public class App extends CommonApplication {
... ... @@ -24,13 +25,14 @@ public class App extends CommonApplication {
24 25 return baiduToken;
25 26 }
26 27  
27   - private static List<GradeAndSubject> gradeAndSubjects;
  28 + private static List<GradeAndSubject> gradeAndSubjects = new ArrayList<>();
28 29  
29 30 public void setGradeAndSubjects(List<GradeAndSubject> gradeAndSubjects) {
30   - App.gradeAndSubjects = gradeAndSubjects;
  31 + App.gradeAndSubjects = gradeAndSubjects == null ? App.gradeAndSubjects : gradeAndSubjects;
31 32 }
32 33  
33 34 public List<GradeAndSubject> getGradeAndSubjects() {
  35 + if (gradeAndSubjects == null) gradeAndSubjects = new ArrayList<>();
34 36 return gradeAndSubjects;
35 37 }
36 38  
... ...
app/src/main/java/com/hjx/parent/ImageActivity.java
... ... @@ -155,12 +155,12 @@ public class ImageActivity extends BaseRxActivity&lt;ActivityImageBinding&gt; implemen
155 155  
156 156 ArrayList<Rect> rects = new ArrayList<>();
157 157 for (ImageBean.Cut cut: imageBean.getCuts()) {
158   - if (cut.getRect1() == null) continue;
  158 + if (cut.getRect1() == null || !cut.isSelect()) continue;
159 159 Rect rectV = cut.getRect1();
160 160 rects.add(getRectB(rectV, bitmap, size));
161 161 }
162 162 if (list.isEmpty()) {
163   - showToast("请先框选题目");
  163 + showToast("请选择要批改的题目");
164 164 return;
165 165 }
166 166  
... ... @@ -292,7 +292,7 @@ public class ImageActivity extends BaseRxActivity&lt;ActivityImageBinding&gt; implemen
292 292 for (CutPicBean.FigLoaction figLoaction : figLoactions) {
293 293 ImageBean.Cut cut = new ImageBean.Cut();
294 294 cut.setRect(figLoaction);
295   - cut.setSelect(false);
  295 + cut.setSelect(true);
296 296 cuts.add(cut);
297 297 }
298 298 list.get(index).setCuts(cuts);
... ...
app/src/main/java/com/hjx/parent/JudgeActivity.java
... ... @@ -61,6 +61,11 @@ public class JudgeActivity extends BaseRxActivity&lt;ActivityJudgeBinding&gt; {
61 61 mList.forEach(it -> it.vb.getRoot().setSelected(true));
62 62 checkCount();
63 63 });
  64 + binding.btnSelectNone.setOnClickListener(v -> {
  65 + if (mList.isEmpty()) return;
  66 + mList.forEach(it -> it.vb.getRoot().setSelected(false));
  67 + checkCount();
  68 + });
64 69 binding.btnAdd.setOnClickListener(v -> {
65 70 if (mList.isEmpty()) return;
66 71 List<TopicBean> selected = mList.stream()
... ...
app/src/main/res/layout/activity_judge.xml
... ... @@ -56,6 +56,17 @@
56 56 android:paddingVertical="4dp"
57 57 android:layout_width="wrap_content"
58 58 android:layout_height="wrap_content"/>
  59 + <androidx.appcompat.widget.AppCompatTextView
  60 + android:id="@+id/btnSelectNone"
  61 + android:text="全不选"
  62 + android:textSize="16sp"
  63 + android:textColor="#333"
  64 + android:gravity="center_vertical"
  65 + android:paddingHorizontal="8dp"
  66 + android:paddingVertical="4dp"
  67 + android:layout_marginStart="8dp"
  68 + android:layout_width="wrap_content"
  69 + android:layout_height="wrap_content"/>
59 70  
60 71 <Space style="@style/empty_space"/>
61 72 <TextView
... ...
app/src/main/res/layout/dialog_add_error.xml
1 1 <androidx.core.widget.NestedScrollView
2 2 xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:tools="http://schemas.android.com/tools"
3 4 android:layout_width="match_parent"
4 5 android:layout_height="match_parent">
5 6 <LinearLayout
... ... @@ -230,36 +231,38 @@
230 231 </RadioGroup>
231 232  
232 233  
233   - <RelativeLayout
234   - android:layout_width="match_parent"
235   - android:layout_height="40dp"
236   - android:layout_marginLeft="20dp"
  234 + <LinearLayout
  235 + android:orientation="horizontal"
  236 + android:gravity="center_vertical"
  237 + android:layout_marginHorizontal="20dp"
237 238 android:layout_marginTop="20dp"
238   - android:layout_marginRight="20dp"
239   - android:layout_marginBottom="15dp">
240   -
241   - <TextView
242   - android:id="@+id/add_topic"
243   - android:layout_width="250dp"
244   - android:layout_height="match_parent"
245   - android:layout_alignParentRight="true"
246   - android:background="@drawable/bg_soild_blue_5"
247   - android:gravity="center"
248   - android:textColor="@color/white"
249   - android:textSize="17sp" />
250   -
  239 + android:layout_marginBottom="15dp"
  240 + android:layout_width="match_parent"
  241 + android:layout_height="40dp">
251 242 <CheckBox
252 243 android:id="@+id/checkbox"
253 244 android:layout_width="wrap_content"
254 245 android:layout_height="30dp"
255   - android:layout_centerVertical="true"
256 246 android:button="@drawable/checkbox_selector"
257 247 android:text="批量设置"
258   - android:paddingLeft="8dp"
  248 + android:paddingStart="8dp"
  249 + android:paddingEnd="0dp"
259 250 android:textColor="@color/text_title"
260   - android:textSize="14sp" />
  251 + android:textSize="14sp"
  252 + tools:ignore="HardcodedText" />
261 253  
262   - </RelativeLayout>
  254 + <Space style="@style/empty_space"/>
  255 +
  256 + <TextView
  257 + android:id="@+id/add_topic"
  258 + tools:text="全部加入错题"
  259 + android:layout_width="216dp"
  260 + android:layout_height="match_parent"
  261 + android:background="@drawable/bg_soild_blue_5"
  262 + android:gravity="center"
  263 + android:textColor="@color/white"
  264 + android:textSize="17sp" />
  265 + </LinearLayout>
263 266 </LinearLayout>
264 267 </androidx.core.widget.NestedScrollView>
265 268  
... ...