Commit e845f252e0101e1ee1ff7a73e350090d952f6bf8
1 parent
831fc93537
Exists in
master
框选迁移
Showing
18 changed files
with
401 additions
and
21 deletions
Show diff stats
.idea/inspectionProfiles/Project_Default.xml
... | ... | @@ -6,5 +6,9 @@ |
6 | 6 | <option name="m_reportAllNonLibraryCalls" value="false" /> |
7 | 7 | <option name="callCheckString" value="java.io.File,.*,java.io.InputStream,read|skip|available|markSupported,java.io.Reader,read|skip|ready|markSupported,java.lang.AbstractStringBuilder,capacity|codePointAt|codePointBefore|codePointCount|indexOf|lastIndexOf|offsetByCodePoints|substring|subSequence,java.lang.Boolean,.*,java.lang.Byte,.*,java.lang.Character,.*,java.lang.Double,.*,java.lang.Float,.*,java.lang.Integer,.*,java.lang.Long,.*,java.lang.Math,.*,java.lang.Object,equals|hashCode|toString,java.lang.Short,.*,java.lang.StrictMath,.*,java.lang.String,.*,java.lang.Thread,interrupted,java.math.BigDecimal,.*,java.math.BigInteger,.*,java.net.InetAddress,.*,java.net.URI,.*,java.nio.channels.AsynchronousChannelGroup,.*,java.nio.channels.Channel,isOpen,java.nio.channels.FileChannel,open|map|lock|tryLock|write,java.nio.channels.ScatteringByteChannel,read,java.nio.channels.SocketChannel,open|socket|isConnected|isConnectionPending,java.util.Arrays,.*,java.util.Collections,(?!addAll).*,java.util.List,of,java.util.Map,of|ofEntries|entry,java.util.Set,of,java.util.UUID,.*,java.util.concurrent.BlockingQueue,offer|remove,java.util.concurrent.CountDownLatch,await|getCount,java.util.concurrent.ExecutorService,awaitTermination|isShutdown|isTerminated,java.util.concurrent.ForkJoinPool,awaitQuiescence,java.util.concurrent.Semaphore,tryAcquire|availablePermits|isFair|hasQueuedThreads|getQueueLength|getQueuedThreads,java.util.concurrent.locks.Condition,await|awaitNanos|awaitUntil,java.util.concurrent.locks.Lock,tryLock|newCondition,java.util.regex.Matcher,pattern|toMatchResult|start|end|group|groupCount|matches|find|lookingAt|quoteReplacement|replaceAll|replaceFirst|regionStart|regionEnd|hasTransparentBounds|hasAnchoringBounds|hitEnd|requireEnd,java.util.regex.Pattern,.*,java.util.stream.BaseStream,.*,java.util.stream.DoubleStream,.*,java.util.stream.IntStream,.*,java.util.stream.LongStream,.*,java.util.stream.Stream,.*" /> |
8 | 8 | </inspection_tool> |
9 | + <inspection_tool class="UnnecessaryLocalVariable" enabled="false" level="WARNING" enabled_by_default="false"> | |
10 | + <option name="m_ignoreImmediatelyReturnedVariables" value="false" /> | |
11 | + <option name="m_ignoreAnnotatedVariables" value="false" /> | |
12 | + </inspection_tool> | |
9 | 13 | </profile> |
10 | 14 | </component> |
11 | 15 | \ No newline at end of file | ... | ... |
app/build.gradle
... | ... | @@ -97,4 +97,9 @@ dependencies { |
97 | 97 | |
98 | 98 | implementation 'com.jakewharton:butterknife:10.2.3' |
99 | 99 | annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3' |
100 | + | |
101 | + | |
102 | + /** 鲁班压缩 */ | |
103 | + implementation 'top.zibin:Luban:1.1.8' | |
104 | + | |
100 | 105 | } |
101 | 106 | \ No newline at end of file | ... | ... |
app/src/main/AndroidManifest.xml
app/src/main/java/com/hjx/parent/ImageActivity.java
... | ... | @@ -24,11 +24,13 @@ import com.google.gson.Gson; |
24 | 24 | import com.google.gson.JsonObject; |
25 | 25 | import com.hjx.parent.adapter.ImageAdapter; |
26 | 26 | import com.hjx.parent.databinding.ActivityImageBinding; |
27 | +import com.hjx.parent.databinding.ItemImageBinding; | |
27 | 28 | import com.hjx.parent.dialog.AddHomeworkDialog; |
28 | 29 | import com.hjx.parent.dialog.ErrorInputDialog; |
29 | 30 | import com.hjx.parent.dialog.PhotoViewDialog; |
30 | 31 | import com.hjx.parent.dialog.TipDialog; |
31 | 32 | import com.hjx.parent.rx.BaseRxActivity; |
33 | +import com.hjx.parent.utils.CutUtil; | |
32 | 34 | import com.prws.common.bean.CutPicBean; |
33 | 35 | import com.prws.common.bean.ImageBean; |
34 | 36 | import com.prws.common.bean.TopicBean; |
... | ... | @@ -116,6 +118,62 @@ public class ImageActivity extends BaseRxActivity<ActivityImageBinding> implemen |
116 | 118 | ImageBean data = list.get(binding.viewPager.getCurrentItem()); |
117 | 119 | new PhotoViewDialog(this).show(data.source); |
118 | 120 | }); |
121 | + | |
122 | + binding.btnJudge.setVisibility(type == 0 ? View.VISIBLE : View.GONE); | |
123 | + binding.btnJudge.setOnClickListener(v -> { | |
124 | + goJudge(); | |
125 | + }); | |
126 | + } | |
127 | + | |
128 | + private void goJudge() { | |
129 | + if (list.isEmpty()) return; | |
130 | + int position = binding.viewPager.getCurrentItem(); | |
131 | + ImageBean imageBean = list.get(position); | |
132 | + Bitmap bitmap = BitmapFactory.decodeFile(imageBean.getPath()); | |
133 | + if (bitmap == null || imageBean.getCuts() == null) { | |
134 | + showToast("请先框选题目"); | |
135 | + return; | |
136 | + } | |
137 | + ItemImageBinding ib = imageAdapter.viewArray.get(position); | |
138 | + if (ib == null) { | |
139 | + showToast("出错"); | |
140 | + return; | |
141 | + } | |
142 | + View view = ib.ivPic; | |
143 | + float[] size = CutUtil.measureBitmap(view, bitmap); | |
144 | + | |
145 | + ArrayList<Rect> rects = new ArrayList<>(); | |
146 | + for (ImageBean.Cut cut: imageBean.getCuts()) { | |
147 | + if (cut.getRect1() == null) continue; | |
148 | + Rect rectV = cut.getRect1(); | |
149 | + rects.add(getRectB(rectV, bitmap, size)); | |
150 | + } | |
151 | + if (list.isEmpty()) { | |
152 | + showToast("请先框选题目"); | |
153 | + return; | |
154 | + } | |
155 | + | |
156 | + Intent intent = new Intent(this, JudgeActivity.class); | |
157 | + intent.putExtra("path", imageBean.getPath()); | |
158 | + intent.putParcelableArrayListExtra("rects", rects); | |
159 | + | |
160 | + startActivity(intent); | |
161 | + } | |
162 | + | |
163 | + private Rect getRectB(Rect rectV, Bitmap bitmap, float[] measuredSize) { | |
164 | + float realW = measuredSize[0]; | |
165 | + float realH = measuredSize[1]; | |
166 | + float offsetX = measuredSize[2]; | |
167 | + float offsetY = measuredSize[3]; | |
168 | + float percentX = bitmap.getWidth() / realW; | |
169 | + float percentY = bitmap.getHeight() / realH; | |
170 | + | |
171 | + float left = (rectV.left - offsetX) * percentX; | |
172 | + float right = (rectV.right - offsetX) * percentX; | |
173 | + float top = (rectV.top - offsetY) * percentY; | |
174 | + float bottom = (rectV.bottom - offsetY) * percentY; | |
175 | + Rect rectB = new Rect((int) left, (int) top, (int) right, (int) bottom); | |
176 | + return rectB; | |
119 | 177 | } |
120 | 178 | |
121 | 179 | public void clearText() { | ... | ... |
app/src/main/java/com/hjx/parent/JudgeActivity.java
... | ... | @@ -0,0 +1,123 @@ |
1 | +package com.hjx.parent; | |
2 | + | |
3 | +import android.annotation.SuppressLint; | |
4 | +import android.graphics.Bitmap; | |
5 | +import android.graphics.Rect; | |
6 | +import android.os.Bundle; | |
7 | + | |
8 | +import com.bumptech.glide.Glide; | |
9 | +import com.hjx.parent.databinding.ActivityJudgeBinding; | |
10 | +import com.hjx.parent.databinding.LayoutJudgeRectBinding; | |
11 | +import com.hjx.parent.rx.BaseRxActivity; | |
12 | +import com.hjx.parent.utils.CutUtil; | |
13 | + | |
14 | +import java.io.File; | |
15 | +import java.util.ArrayList; | |
16 | +import java.util.List; | |
17 | + | |
18 | +import io.reactivex.Single; | |
19 | +import top.zibin.luban.Luban; | |
20 | + | |
21 | +public class JudgeActivity extends BaseRxActivity<ActivityJudgeBinding> { | |
22 | + | |
23 | + private Bitmap bitmap; | |
24 | + | |
25 | + private final List<JudgeCut> mList = new ArrayList<>(); | |
26 | + | |
27 | + @SuppressLint("CheckResult") | |
28 | + @Override | |
29 | + public void initView(Bundle savedInstanceState) { | |
30 | + binding.ivBack.setOnClickListener(v -> { | |
31 | + onBackPressed(); | |
32 | + }); | |
33 | + String path = getIntent().getStringExtra("path"); | |
34 | + if (path == null) return; | |
35 | + final ArrayList<Rect> rects = getIntent().getParcelableArrayListExtra("rects"); | |
36 | + if (rects == null) return; | |
37 | + | |
38 | + Single.just(path) | |
39 | + .map(origin -> Luban.with(this).load(origin).ignoreBy(300).get().get(0)) | |
40 | + .map(file -> Glide.with(this).asBitmap().load(file).submit().get()) | |
41 | + .compose(transformSingle()) | |
42 | + .subscribe((bitmap, th) -> { | |
43 | + if (th != null) th.printStackTrace(); | |
44 | + if (bitmap == null) return; | |
45 | + this.bitmap = bitmap; | |
46 | + | |
47 | + binding.ivPic.setImageBitmap(bitmap); | |
48 | + CutUtil.onLayoutReady(binding.ivPic, v -> { | |
49 | + prepareRects(rects); | |
50 | + }); | |
51 | + }); | |
52 | + } | |
53 | + | |
54 | + private void prepareRects(List<Rect> rects) { | |
55 | + mList.clear(); | |
56 | + binding.flRects.removeAllViews(); | |
57 | + float[] measuredSize = CutUtil.measureBitmap(binding.ivPic, bitmap); | |
58 | + for (int i = 0; i < rects.size(); i++) { | |
59 | + Rect it = rects.get(i); | |
60 | + Bitmap bitmap = CutUtil.cut(this.bitmap, it.left, it.top, it.width(), it.height(), this); | |
61 | + Rect rect = measureRect(it, measuredSize); | |
62 | + LayoutJudgeRectBinding vb = showRect(rect); | |
63 | + mList.add(new JudgeCut(i, bitmap, rect, vb)); | |
64 | + } | |
65 | + } | |
66 | + | |
67 | + private LayoutJudgeRectBinding showRect(Rect rect) { | |
68 | + LayoutJudgeRectBinding vb = LayoutJudgeRectBinding.inflate(getLayoutInflater(), binding.flRects, false); | |
69 | + | |
70 | + vb.getRoot().setMinimumWidth(rect.width()); | |
71 | + vb.getRoot().setMinimumHeight(rect.height()); | |
72 | + vb.getRoot().setTranslationX((float) rect.left); | |
73 | + vb.getRoot().setTranslationY((float) rect.top); | |
74 | + vb.getRoot().setOnClickListener(v -> { | |
75 | + v.setSelected(!v.isSelected()); | |
76 | + checkCount(); | |
77 | + }); | |
78 | + binding.flRects.addView(vb.getRoot()); | |
79 | + | |
80 | + return vb; | |
81 | + } | |
82 | + | |
83 | + private void checkCount() { | |
84 | + // | |
85 | + } | |
86 | + | |
87 | + /** bitmapRect 转换为 viewRect */ | |
88 | + private Rect measureRect(Rect rect, float[] measuredSize) { | |
89 | + float realW = measuredSize[0]; | |
90 | + float realH = measuredSize[1]; | |
91 | + float offsetX = measuredSize[2]; | |
92 | + float offsetY = measuredSize[3]; | |
93 | + float percentX = realW / bitmap.getWidth(); | |
94 | + float percentY = realH / bitmap.getHeight(); | |
95 | + | |
96 | + float left = rect.left * percentX + offsetX; | |
97 | + float right = rect.right * percentX + offsetX; | |
98 | + float top = rect.top * percentY + offsetY; | |
99 | + float bottom = rect.bottom * percentY + offsetY; | |
100 | + return new Rect((int) left, (int) top, (int) right, (int) bottom); | |
101 | + } | |
102 | + | |
103 | + @Override | |
104 | + protected ActivityJudgeBinding getViewBinding() { | |
105 | + return ActivityJudgeBinding.inflate(getLayoutInflater()); | |
106 | + } | |
107 | + | |
108 | + static class JudgeCut { | |
109 | + final int index; | |
110 | + final Bitmap bitmap; | |
111 | + final Rect rect; | |
112 | + final LayoutJudgeRectBinding vb; | |
113 | + | |
114 | + int correctResult = 0; | |
115 | + | |
116 | + public JudgeCut(int index, Bitmap bitmap, Rect rect, LayoutJudgeRectBinding vb) { | |
117 | + this.index = index; | |
118 | + this.bitmap = bitmap; | |
119 | + this.rect = rect; | |
120 | + this.vb = vb; | |
121 | + } | |
122 | + } | |
123 | +} | ... | ... |
app/src/main/java/com/hjx/parent/adapter/ImageAdapter.java
... | ... | @@ -7,6 +7,7 @@ import android.graphics.BitmapFactory; |
7 | 7 | import android.graphics.Rect; |
8 | 8 | import android.graphics.RectF; |
9 | 9 | import android.util.Log; |
10 | +import android.util.SparseArray; | |
10 | 11 | import android.view.LayoutInflater; |
11 | 12 | import android.view.View; |
12 | 13 | import android.view.ViewGroup; |
... | ... | @@ -27,9 +28,12 @@ import com.prws.common.utils.CommonUtil; |
27 | 28 | import java.util.List; |
28 | 29 | |
29 | 30 | public class ImageAdapter extends RecyclerView.Adapter<ImageAdapter.ImageHolder> { |
31 | + public SparseArray<ItemImageBinding> viewArray = new SparseArray<>(); | |
32 | + | |
30 | 33 | private List<ImageBean> list; |
31 | 34 | private ImageActivity context; |
32 | 35 | |
36 | + | |
33 | 37 | public ImageAdapter(ImageActivity context, List<ImageBean> list) { |
34 | 38 | this.context = context; |
35 | 39 | this.list = list; |
... | ... | @@ -44,6 +48,8 @@ public class ImageAdapter extends RecyclerView.Adapter<ImageAdapter.ImageHolder> |
44 | 48 | |
45 | 49 | @Override |
46 | 50 | public void onBindViewHolder(@NonNull ImageHolder holder, int position) { |
51 | + viewArray.put(position, holder.binding); | |
52 | + | |
47 | 53 | ImageBean imageBean = list.get(position); |
48 | 54 | Bitmap bitmap = BitmapFactory.decodeFile(imageBean.getPath()); |
49 | 55 | float imageHeight = bitmap.getHeight(); | ... | ... |
app/src/main/java/com/hjx/parent/utils/CutUtil.java
... | ... | @@ -0,0 +1,75 @@ |
1 | +package com.hjx.parent.utils; | |
2 | + | |
3 | +import android.content.Context; | |
4 | +import android.graphics.Bitmap; | |
5 | +import android.graphics.Canvas; | |
6 | +import android.graphics.Color; | |
7 | +import android.graphics.Paint; | |
8 | +import android.view.View; | |
9 | +import android.view.ViewTreeObserver; | |
10 | + | |
11 | +import com.bumptech.glide.Glide; | |
12 | +import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; | |
13 | +import com.hjx.parent.function.Function1; | |
14 | + | |
15 | +public class CutUtil { | |
16 | + | |
17 | + public static float[] measureBitmap(View view, Bitmap bitmap) { | |
18 | + float realW; | |
19 | + float realH; | |
20 | + float offsetX; | |
21 | + float offsetY; | |
22 | + | |
23 | + float vp = 1f * view.getWidth() / view.getHeight(); | |
24 | + float bp = 1f * bitmap.getWidth() / bitmap.getHeight(); | |
25 | + | |
26 | + if (vp > bp) { | |
27 | + realW = view.getHeight() * bp; | |
28 | + realH = (float) view.getHeight(); | |
29 | + offsetY = 0f; | |
30 | + offsetX = (view.getWidth() - realW) * 0.5f; | |
31 | + } else if (vp < bp) { | |
32 | + realW = (float) view.getWidth(); | |
33 | + realH = view.getWidth() * (1f / bp); | |
34 | + offsetX = 0f; | |
35 | + offsetY = (view.getHeight() - realH) * 0.5f; | |
36 | + } else { | |
37 | + realW = (float) view.getWidth(); | |
38 | + realH = (float) view.getHeight(); | |
39 | + offsetX = 0f; | |
40 | + offsetY = 0f; | |
41 | + } | |
42 | + | |
43 | + return new float[]{realW, realH, offsetX, offsetY}; | |
44 | + } | |
45 | + | |
46 | + public static Bitmap cut(Bitmap source, float x, float y, int w, int h, Context context) { | |
47 | + // 获取 Glide 的 BitmapPool | |
48 | + BitmapPool bitmapPool = Glide.get(context).getBitmapPool(); | |
49 | + | |
50 | + // 从 BitmapPool 中获取可复用的 Bitmap | |
51 | + Bitmap result = bitmapPool.get(w, h, source.getConfig() != null ? source.getConfig() : Bitmap.Config.ARGB_8888); | |
52 | + | |
53 | + // 填充白色背景 | |
54 | + result.eraseColor(Color.WHITE); | |
55 | + | |
56 | + // 创建画布并绘制 | |
57 | + Canvas canvas = new Canvas(result); | |
58 | + Paint paint = new Paint(); | |
59 | + canvas.drawBitmap(source, -x, -y, paint); | |
60 | + | |
61 | + return result; | |
62 | + } | |
63 | + | |
64 | + public static void onLayoutReady(final View view, final Function1<View> action) { | |
65 | + view.getViewTreeObserver().addOnGlobalLayoutListener( | |
66 | + new ViewTreeObserver.OnGlobalLayoutListener() { | |
67 | + @Override | |
68 | + public void onGlobalLayout() { | |
69 | + view.getViewTreeObserver().removeOnGlobalLayoutListener(this); | |
70 | + action.invoke(view); | |
71 | + } | |
72 | + } | |
73 | + ); | |
74 | + } | |
75 | +} | ... | ... |
app/src/main/res/drawable/bg_judge_cut.xml
... | ... | @@ -0,0 +1,15 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
3 | + <item android:state_selected="true"> | |
4 | + <shape> | |
5 | + <solid android:color="#1A1C90F3"/> | |
6 | + <stroke android:color="#1C90F3" android:width="1px"/> | |
7 | + </shape> | |
8 | + </item> | |
9 | + <item> | |
10 | + <shape> | |
11 | + <solid android:color="#33000000"/> | |
12 | + <stroke android:color="#666666" android:width="1px"/> | |
13 | + </shape> | |
14 | + </item> | |
15 | +</selector> | |
0 | 16 | \ No newline at end of file | ... | ... |
app/src/main/res/drawable/ic_add.png
1.12 KB
app/src/main/res/drawable/ic_judge_rect_select.xml
... | ... | @@ -0,0 +1,5 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
3 | + <item android:drawable="@drawable/png_rect_selected" android:state_selected="true"/> | |
4 | + <item android:drawable="@drawable/png_rect_add"/> | |
5 | +</selector> | |
0 | 6 | \ No newline at end of file | ... | ... |
app/src/main/res/drawable/ic_rect_20.xml
app/src/main/res/drawable/png_ic_judge_correct.png
1.09 KB
app/src/main/res/drawable/png_ic_rect.png
1.72 KB
app/src/main/res/drawable/png_rect_add.png
1.12 KB
app/src/main/res/drawable/png_rect_selected.png
902 Bytes
app/src/main/res/layout/activity_image.xml
1 | 1 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
2 | + xmlns:tools="http://schemas.android.com/tools" | |
2 | 3 | android:layout_width="match_parent" |
3 | 4 | android:layout_height="match_parent" |
4 | - android:orientation="vertical"> | |
5 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
6 | + android:orientation="vertical" | |
7 | + tools:ignore="HardcodedText"> | |
5 | 8 | |
6 | 9 | <RelativeLayout |
7 | 10 | android:layout_width="match_parent" |
... | ... | @@ -102,8 +105,10 @@ |
102 | 105 | android:src="@mipmap/ic_next_gray" /> |
103 | 106 | </RelativeLayout> |
104 | 107 | |
105 | - <RelativeLayout | |
108 | + <LinearLayout | |
106 | 109 | android:id="@+id/rl_bottom" |
110 | + android:orientation="horizontal" | |
111 | + android:gravity="center_vertical" | |
107 | 112 | android:layout_width="match_parent" |
108 | 113 | android:layout_height="70dp" |
109 | 114 | android:layout_alignParentBottom="true" |
... | ... | @@ -113,13 +118,12 @@ |
113 | 118 | android:id="@+id/ll_edit" |
114 | 119 | android:layout_width="wrap_content" |
115 | 120 | android:layout_height="wrap_content" |
116 | - android:layout_centerVertical="true" | |
117 | - android:layout_marginLeft="15dp" | |
121 | + android:layout_marginStart="15dp" | |
118 | 122 | android:orientation="vertical"> |
119 | 123 | |
120 | 124 | <ImageView |
121 | - android:layout_width="25dp" | |
122 | - android:layout_height="25dp" | |
125 | + android:layout_width="20dp" | |
126 | + android:layout_height="20dp" | |
123 | 127 | android:layout_gravity="center_horizontal" |
124 | 128 | android:src="@mipmap/ic_pic_edit" /> |
125 | 129 | |
... | ... | @@ -128,35 +132,45 @@ |
128 | 132 | android:layout_height="wrap_content" |
129 | 133 | android:layout_marginTop="5dp" |
130 | 134 | android:text="图片编辑" |
135 | + android:textColor="#333" | |
131 | 136 | android:textSize="11sp" /> |
132 | 137 | </LinearLayout> |
133 | 138 | |
134 | - <TextView | |
139 | + <androidx.appcompat.widget.AppCompatTextView | |
135 | 140 | android:id="@+id/tv_add" |
136 | - android:layout_width="140dp" | |
137 | - android:layout_height="40dp" | |
138 | - android:layout_centerVertical="true" | |
139 | - android:layout_marginRight="15dp" | |
140 | - android:layout_toLeftOf="@+id/tv_save" | |
141 | + android:text="手动框选" | |
142 | + android:textSize="11sp" | |
143 | + android:textColor="#333" | |
144 | + android:gravity="center_horizontal" | |
145 | + android:drawableTop="@drawable/ic_rect_20" | |
146 | + android:drawablePadding="5dp" | |
147 | + android:layout_marginStart="12dp" | |
148 | + android:layout_width="wrap_content" | |
149 | + android:layout_height="wrap_content" /> | |
150 | + | |
151 | + <Space style="@style/empty_space"/> | |
152 | + | |
153 | + <TextView | |
154 | + android:id="@+id/btnJudge" | |
155 | + android:layout_width="112dp" | |
156 | + android:layout_height="36dp" | |
141 | 157 | android:background="@drawable/bg_soild_orange_5" |
142 | 158 | android:gravity="center" |
143 | - android:text="手动框选" | |
159 | + android:text="去批改" | |
144 | 160 | android:textColor="@color/white" |
145 | - android:textSize="18sp" /> | |
161 | + android:textSize="16sp" /> | |
146 | 162 | |
147 | 163 | <TextView |
148 | 164 | android:id="@+id/tv_save" |
149 | - android:layout_width="140dp" | |
150 | - android:layout_height="40dp" | |
151 | - android:layout_alignParentRight="true" | |
152 | - android:layout_centerVertical="true" | |
153 | - android:layout_marginRight="15dp" | |
165 | + android:layout_width="112dp" | |
166 | + android:layout_height="36dp" | |
167 | + android:layout_marginHorizontal="15dp" | |
154 | 168 | android:background="@drawable/bg_soild_blue_light_5" |
155 | 169 | android:enabled="false" |
156 | 170 | android:gravity="center" |
157 | 171 | android:text="保存错题" |
158 | 172 | android:textColor="@color/white" |
159 | - android:textSize="18sp" /> | |
160 | - </RelativeLayout> | |
173 | + android:textSize="16sp" /> | |
174 | + </LinearLayout> | |
161 | 175 | </RelativeLayout> |
162 | 176 | </LinearLayout> |
163 | 177 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/activity_judge.xml
... | ... | @@ -0,0 +1,42 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | |
4 | + xmlns:tools="http://schemas.android.com/tools" | |
5 | + android:orientation="vertical" | |
6 | + android:layout_width="match_parent" | |
7 | + android:layout_height="match_parent" | |
8 | + tools:ignore="UseCompoundDrawables,HardcodedText,SmallSp,ContentDescription"> | |
9 | + | |
10 | + <androidx.appcompat.widget.Toolbar | |
11 | + android:background="@color/white" | |
12 | + app:contentInsetStart="0dp" | |
13 | + android:layout_width="match_parent" | |
14 | + android:layout_height="40dp"> | |
15 | + <ImageView | |
16 | + android:id="@+id/ivBack" | |
17 | + android:layout_width="30dp" | |
18 | + android:layout_height="36dp" | |
19 | + android:layout_centerVertical="true" | |
20 | + android:layout_marginStart="5dp" | |
21 | + android:padding="10dp" | |
22 | + android:src="@mipmap/icon_back" /> | |
23 | + </androidx.appcompat.widget.Toolbar> | |
24 | + | |
25 | + <FrameLayout | |
26 | + android:background="@color/white" | |
27 | + android:padding="8dp" | |
28 | + android:layout_margin="16dp" | |
29 | + android:layout_width="match_parent" | |
30 | + android:layout_height="0px" | |
31 | + android:layout_weight="1"> | |
32 | + <ImageView | |
33 | + android:id="@+id/ivPic" | |
34 | + android:layout_width="match_parent" | |
35 | + android:layout_height="match_parent"/> | |
36 | + <FrameLayout | |
37 | + android:id="@+id/flRects" | |
38 | + android:layout_width="match_parent" | |
39 | + android:layout_height="match_parent" /> | |
40 | + </FrameLayout> | |
41 | + | |
42 | +</LinearLayout> | |
0 | 43 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/layout_judge_rect.xml
... | ... | @@ -0,0 +1,27 @@ |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<FrameLayout 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_judge_cut" | |
7 | + android:minWidth="160dp" | |
8 | + android:minHeight="48dp" | |
9 | + android:layout_width="wrap_content" | |
10 | + android:layout_height="wrap_content" | |
11 | + tools:ignore="UseCompoundDrawables,HardcodedText,SmallSp,ContentDescription"> | |
12 | + | |
13 | + <ImageView | |
14 | + android:id="@+id/ivResult" | |
15 | + tools:src="@drawable/png_ic_judge_correct" | |
16 | + android:layout_gravity="end" | |
17 | + android:layout_margin="8dp" | |
18 | + android:layout_width="12dp" | |
19 | + android:layout_height="12dp"/> | |
20 | + | |
21 | + <ImageView | |
22 | + android:src="@drawable/ic_judge_rect_select" | |
23 | + android:layout_gravity="center" | |
24 | + android:layout_width="12dp" | |
25 | + android:layout_height="12dp"/> | |
26 | + | |
27 | +</FrameLayout> | |
0 | 28 | \ No newline at end of file | ... | ... |