Commit 9ec5407bef2f8afe1650caf1ed075e8ce0257d26

Authored by shixianjie
1 parent 216ca52fec
Exists in master

查看原图功能

.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="951f9ace" />
14 </Key>
15 </deviceKey>
16 </Target>
17 </runningDeviceTargetSelectedWithDropDown>
18 <timeTargetWasSelectedWithDropDown value="2024-10-11T05:46:18.103982900Z" />
19 </State>
7 </entry> 20 </entry>
8 </value> 21 </value>
9 </component> 22 </component>
10 </project> 23 </project>
app/src/main/java/com/hjx/parent/ImageActivity.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.app.Dialog; 4 import android.app.Dialog;
5 import android.content.Intent; 5 import android.content.Intent;
6 import android.graphics.Bitmap; 6 import android.graphics.Bitmap;
7 import android.graphics.BitmapFactory; 7 import android.graphics.BitmapFactory;
8 import android.graphics.Rect; 8 import android.graphics.Rect;
9 import android.net.Uri; 9 import android.net.Uri;
10 import android.os.Bundle; 10 import android.os.Bundle;
11 import android.os.Handler; 11 import android.os.Handler;
12 import android.provider.MediaStore; 12 import android.provider.MediaStore;
13 import android.text.TextUtils; 13 import android.text.TextUtils;
14 import android.util.Log; 14 import android.util.Log;
15 import android.view.KeyEvent; 15 import android.view.KeyEvent;
16 import android.view.View; 16 import android.view.View;
17 17
18 18
19 import androidx.annotation.Nullable; 19 import androidx.annotation.Nullable;
20 import androidx.core.content.FileProvider; 20 import androidx.core.content.FileProvider;
21 import androidx.viewpager2.widget.ViewPager2; 21 import androidx.viewpager2.widget.ViewPager2;
22 22
23 import com.google.gson.Gson; 23 import com.google.gson.Gson;
24 import com.google.gson.JsonObject; 24 import com.google.gson.JsonObject;
25 import com.hjx.parent.adapter.ImageAdapter; 25 import com.hjx.parent.adapter.ImageAdapter;
26 import com.hjx.parent.databinding.ActivityImageBinding; 26 import com.hjx.parent.databinding.ActivityImageBinding;
27 import com.hjx.parent.dialog.AddHomeworkDialog; 27 import com.hjx.parent.dialog.AddHomeworkDialog;
28 import com.hjx.parent.dialog.ErrorInputDialog; 28 import com.hjx.parent.dialog.ErrorInputDialog;
29 import com.hjx.parent.dialog.PhotoViewDialog;
29 import com.hjx.parent.dialog.TipDialog; 30 import com.hjx.parent.dialog.TipDialog;
30 import com.hjx.parent.rx.BaseRxActivity; 31 import com.hjx.parent.rx.BaseRxActivity;
31 import com.prws.common.bean.CutPicBean; 32 import com.prws.common.bean.CutPicBean;
32 import com.prws.common.bean.ImageBean; 33 import com.prws.common.bean.ImageBean;
33 import com.prws.common.bean.TopicBean; 34 import com.prws.common.bean.TopicBean;
34 import com.prws.common.net.NetWorks; 35 import com.prws.common.net.NetWorks;
35 import com.prws.common.utils.BitmapUtils; 36 import com.prws.common.utils.BitmapUtils;
36 import com.prws.common.utils.CommonUtil; 37 import com.prws.common.utils.CommonUtil;
37 import com.xiasuhuei321.loadingdialog.view.LoadingDialog; 38 import com.xiasuhuei321.loadingdialog.view.LoadingDialog;
38 39
39 import java.io.File; 40 import java.io.File;
40 import java.util.ArrayList; 41 import java.util.ArrayList;
41 import java.util.List; 42 import java.util.List;
42 43
43 import io.reactivex.Observer; 44 import io.reactivex.Observer;
44 import io.reactivex.disposables.Disposable; 45 import io.reactivex.disposables.Disposable;
45 import retrofit2.Call; 46 import retrofit2.Call;
46 import retrofit2.Callback; 47 import retrofit2.Callback;
47 import retrofit2.Response; 48 import retrofit2.Response;
48 49
49 public class ImageActivity extends BaseRxActivity<ActivityImageBinding> implements View.OnClickListener { 50 public class ImageActivity extends BaseRxActivity<ActivityImageBinding> implements View.OnClickListener {
50 51
51 private List<String> images = new ArrayList<>(); 52 private List<String> images = new ArrayList<>();
52 private ImageAdapter imageAdapter; 53 private ImageAdapter imageAdapter;
53 private List<ImageBean> list = new ArrayList<>(); 54 private List<ImageBean> list = new ArrayList<>();
54 private String filePath; 55 private String filePath;
55 56
56 private int type = 0; 57 private int type = 0;
57 private AddHomeworkDialog addHomeworkDialog; 58 private AddHomeworkDialog addHomeworkDialog;
58 59
59 @Override 60 @Override
60 public void initView(Bundle savedInstanceState) { 61 public void initView(Bundle savedInstanceState) {
61 type = getIntent().getIntExtra("type", 0); 62 type = getIntent().getIntExtra("type", 0);
62 binding.tvSave.setText(type == 0 ? "保存错题" : "录入题目"); 63 binding.tvSave.setText(type == 0 ? "保存错题" : "录入题目");
63 64
64 images = getIntent().getStringArrayListExtra("images"); 65 images = getIntent().getStringArrayListExtra("images");
65 for (String s : images) { 66 for (String s : images) {
66 String filepath = context.getExternalFilesDir("images").getPath() + "/" + System.currentTimeMillis() + CommonUtil.getStr() + ".jpg"; 67 String filepath = context.getExternalFilesDir("images").getPath() + "/" + System.currentTimeMillis() + CommonUtil.getStr() + ".jpg";
67 ImageBean imageBean = new ImageBean(); 68 ImageBean imageBean = new ImageBean();
68 Bitmap bitmap = BitmapUtils.getimage(s); 69 Bitmap bitmap = BitmapUtils.getimage(s);
69 CommonUtil.saveBitmapToUri(bitmap, filepath); 70 CommonUtil.saveBitmapToUri(bitmap, filepath);
70 imageBean.setPath(filepath); 71 imageBean.setPath(filepath);
72 imageBean.source = filepath;
71 list.add(imageBean); 73 list.add(imageBean);
72 } 74 }
73 imageAdapter = new ImageAdapter(this, list); 75 imageAdapter = new ImageAdapter(this, list);
74 binding.viewPager.setAdapter(imageAdapter); 76 binding.viewPager.setAdapter(imageAdapter);
75 binding.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { 77 binding.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
76 @Override 78 @Override
77 public void onPageSelected(int position) { 79 public void onPageSelected(int position) {
78 if (list.get(position).getCuts() == null) { 80 if (list.get(position).getCuts() == null) {
79 // binding.ivPrevious.setEnabled(false); 81 // binding.ivPrevious.setEnabled(false);
80 // binding.ivNext.setEnabled(false); 82 // binding.ivNext.setEnabled(false);
81 clearText(); 83 clearText();
82 } 84 }
83 binding.tvTitle.setText((binding.viewPager.getCurrentItem() + 1) + "/" + list.size()); 85 binding.tvTitle.setText((binding.viewPager.getCurrentItem() + 1) + "/" + list.size());
84 if (position == 0) { 86 if (position == 0) {
85 binding.ivPrevious.setImageResource(R.mipmap.ic_previous_gray); 87 binding.ivPrevious.setImageResource(R.mipmap.ic_previous_gray);
86 // binding.ivPrevious.setEnabled(true); 88 // binding.ivPrevious.setEnabled(true);
87 } else { 89 } else {
88 binding.ivPrevious.setImageResource(R.mipmap.ic_previous); 90 binding.ivPrevious.setImageResource(R.mipmap.ic_previous);
89 // binding.ivPrevious.setEnabled(false); 91 // binding.ivPrevious.setEnabled(false);
90 } 92 }
91 if (position == list.size() - 1) { 93 if (position == list.size() - 1) {
92 binding.ivNext.setImageResource(R.mipmap.ic_next_gray); 94 binding.ivNext.setImageResource(R.mipmap.ic_next_gray);
93 // binding.ivNext.setEnabled(true); 95 // binding.ivNext.setEnabled(true);
94 } else { 96 } else {
95 binding.ivNext.setImageResource(R.mipmap.ic_next); 97 binding.ivNext.setImageResource(R.mipmap.ic_next);
96 // binding.ivNext.setEnabled(false); 98 // binding.ivNext.setEnabled(false);
97 } 99 }
98 super.onPageSelected(position); 100 super.onPageSelected(position);
99 } 101 }
100 }); 102 });
101 binding.rlNext.setOnClickListener(this); 103 binding.rlNext.setOnClickListener(this);
102 binding.rlPrevious.setOnClickListener(this); 104 binding.rlPrevious.setOnClickListener(this);
103 binding.ivBack.setOnClickListener(this); 105 binding.ivBack.setOnClickListener(this);
104 binding.tvPhoto.setOnClickListener(this); 106 binding.tvPhoto.setOnClickListener(this);
105 binding.tvAdd.setOnClickListener(this); 107 binding.tvAdd.setOnClickListener(this);
106 binding.llEdit.setOnClickListener(this); 108 binding.llEdit.setOnClickListener(this);
107 binding.tvSave.setOnClickListener(this); 109 binding.tvSave.setOnClickListener(this);
110 binding.btnShowSource.setOnClickListener(v -> {
111 if (list.isEmpty()) return;
112 ImageBean data = list.get(binding.viewPager.getCurrentItem());
113 new PhotoViewDialog(this).show(data.source);
114 });
108 } 115 }
109 116
110 public void clearText() { 117 public void clearText() {
111 int index = binding.viewPager.getCurrentItem(); 118 int index = binding.viewPager.getCurrentItem();
112 showLoadingDialog(getString(R.string.loading_text), new LoadingDialog.DismissListener() { 119 showLoadingDialog(getString(R.string.loading_text), new LoadingDialog.DismissListener() {
113 @Override 120 @Override
114 public void dimiss() { 121 public void dimiss() {
115 // binding.ivPrevious.setEnabled(index != 0); 122 // binding.ivPrevious.setEnabled(index != 0);
116 // binding.ivNext.setEnabled(index != list.size() - 1); 123 // binding.ivNext.setEnabled(index != list.size() - 1);
117 } 124 }
118 }); 125 });
119 Log.i("clearText", list.get(index).getPath()); 126 Log.i("clearText", list.get(index).getPath());
120 String base64 = BitmapUtils.imageToBase64(list.get(index).getPath()); 127 String base64 = BitmapUtils.imageToBase64(list.get(index).getPath());
121 NetWorks.removeWriting(base64, new Observer<JsonObject>() { 128 NetWorks.removeWriting(base64, new Observer<JsonObject>() {
122 @Override 129 @Override
123 public void onSubscribe(Disposable d) { 130 public void onSubscribe(Disposable d) {
124 131
125 } 132 }
126 133
127 @Override 134 @Override
128 public void onNext(JsonObject jsonObject) { 135 public void onNext(JsonObject jsonObject) {
129 if (jsonObject != null && jsonObject.get("image_processed") != null) { 136 if (jsonObject != null && jsonObject.get("image_processed") != null) {
130 String image = jsonObject.get("image_processed").getAsString(); 137 String image = jsonObject.get("image_processed").getAsString();
131 if (image != null) { 138 if (image != null) {
132 String filepath = context.getExternalFilesDir("images").getPath() + "/" + String.valueOf(System.currentTimeMillis()) + CommonUtil.getStr() + ".jpg"; 139 String filepath = context.getExternalFilesDir("images").getPath() + "/" + String.valueOf(System.currentTimeMillis()) + CommonUtil.getStr() + ".jpg";
133 CommonUtil.saveBitmapToUri(BitmapUtils.stringToBitmap(image), filepath); 140 CommonUtil.saveBitmapToUri(BitmapUtils.stringToBitmap(image), filepath);
134 list.get(index).setPath(filepath); 141 list.get(index).setPath(filepath);
135 if (list.get(index).getCuts() == null) { 142 if (list.get(index).getCuts() == null) {
136 list.get(index).setCuts(new ArrayList<>()); 143 list.get(index).setCuts(new ArrayList<>());
137 } 144 }
138 imageAdapter.notifyItemChanged(index); 145 imageAdapter.notifyItemChanged(index);
139 cut(filepath); 146 cut(filepath);
140 } else { 147 } else {
141 loadFail("去除字迹失败"); 148 loadFail("去除字迹失败");
142 } 149 }
143 } else { 150 } else {
144 loadFail("去除字迹失败"); 151 loadFail("去除字迹失败");
145 } 152 }
146 } 153 }
147 154
148 @Override 155 @Override
149 public void onError(Throwable e) { 156 public void onError(Throwable e) {
150 loadFail("去除字迹失败"); 157 loadFail("去除字迹失败");
151 } 158 }
152 159
153 @Override 160 @Override
154 public void onComplete() { 161 public void onComplete() {
155 162
156 } 163 }
157 }); 164 });
158 } 165 }
159 166
160 public void cut(String path) { 167 public void cut(String path) {
161 String base64 = BitmapUtils.imageToBase64(path); 168 String base64 = BitmapUtils.imageToBase64(path);
162 Log.i("figLoaction", path); 169 Log.i("figLoaction", path);
163 NetWorks.cut(base64, new Observer<CutPicBean>() { 170 NetWorks.cut(base64, new Observer<CutPicBean>() {
164 @Override 171 @Override
165 public void onSubscribe(Disposable d) { 172 public void onSubscribe(Disposable d) {
166 173
167 } 174 }
168 175
169 @Override 176 @Override
170 public void onNext(CutPicBean cutPicBean) { 177 public void onNext(CutPicBean cutPicBean) {
171 if (cutPicBean != null) { 178 if (cutPicBean != null) {
172 if (cutPicBean.getDirection() != 0) { 179 if (cutPicBean.getDirection() != 0) {
173 rotatingImage(cutPicBean); 180 rotatingImage(cutPicBean);
174 } else { 181 } else {
175 if (cutPicBean.getQus_figure() != null && cutPicBean.getQus_figure().size() > 0) { 182 if (cutPicBean.getQus_figure() != null && cutPicBean.getQus_figure().size() > 0) {
176 List<CutPicBean.FigLoaction> figLoactions = new ArrayList<>(); 183 List<CutPicBean.FigLoaction> figLoactions = new ArrayList<>();
177 for (CutPicBean.CutLocation cutLocation : cutPicBean.getQus_figure()) { 184 for (CutPicBean.CutLocation cutLocation : cutPicBean.getQus_figure()) {
178 figLoactions.add(cutLocation.getFig_location()); 185 figLoactions.add(cutLocation.getFig_location());
179 } 186 }
180 new Handler().postDelayed(new Runnable() { 187 new Handler().postDelayed(new Runnable() {
181 @Override 188 @Override
182 public void run() { 189 public void run() {
183 getRects(figLoactions); 190 getRects(figLoactions);
184 } 191 }
185 }, 1000); 192 }, 1000);
186 } else { 193 } else {
187 cancelLoadingDialog(); 194 cancelLoadingDialog();
188 } 195 }
189 } 196 }
190 } else { 197 } else {
191 loadFail("自动切题失败"); 198 loadFail("自动切题失败");
192 } 199 }
193 } 200 }
194 201
195 @Override 202 @Override
196 public void onError(Throwable e) { 203 public void onError(Throwable e) {
197 loadFail("自动切题失败"); 204 loadFail("自动切题失败");
198 } 205 }
199 206
200 @Override 207 @Override
201 public void onComplete() { 208 public void onComplete() {
202 209
203 } 210 }
204 }); 211 });
205 } 212 }
206 213
207 private void getRects(List<CutPicBean.FigLoaction> figLoactions) { 214 private void getRects(List<CutPicBean.FigLoaction> figLoactions) {
208 Log.i("figLoaction", new Gson().toJson(figLoactions)); 215 Log.i("figLoaction", new Gson().toJson(figLoactions));
209 int index = binding.viewPager.getCurrentItem(); 216 int index = binding.viewPager.getCurrentItem();
210 List<ImageBean.Cut> cuts = new ArrayList<>(); 217 List<ImageBean.Cut> cuts = new ArrayList<>();
211 for (CutPicBean.FigLoaction figLoaction : figLoactions) { 218 for (CutPicBean.FigLoaction figLoaction : figLoactions) {
212 ImageBean.Cut cut = new ImageBean.Cut(); 219 ImageBean.Cut cut = new ImageBean.Cut();
213 cut.setRect(figLoaction); 220 cut.setRect(figLoaction);
214 cut.setSelect(false); 221 cut.setSelect(false);
215 cuts.add(cut); 222 cuts.add(cut);
216 } 223 }
217 list.get(index).setCuts(cuts); 224 list.get(index).setCuts(cuts);
218 imageAdapter.notifyItemChanged(index); 225 imageAdapter.notifyItemChanged(index);
219 cancelLoadingDialog(); 226 cancelLoadingDialog();
220 } 227 }
221 228
222 private void rotatingImage(CutPicBean cutPicBean) { 229 private void rotatingImage(CutPicBean cutPicBean) {
223 int index = binding.viewPager.getCurrentItem(); 230 int index = binding.viewPager.getCurrentItem();
224 Bitmap bitmap = BitmapFactory.decodeFile(list.get(index).getPath()); 231 Bitmap bitmap = BitmapFactory.decodeFile(list.get(index).getPath());
225 int angle = 0; 232 int angle = 0;
226 switch (cutPicBean.getDirection()) { 233 switch (cutPicBean.getDirection()) {
227 case 1: 234 case 1:
228 angle = 90; 235 angle = 90;
229 break; 236 break;
230 case 2: 237 case 2:
231 angle = 180; 238 angle = 180;
232 break; 239 break;
233 case 3: 240 case 3:
234 angle = 270; 241 angle = 270;
235 break; 242 break;
236 } 243 }
237 if (cutPicBean.getQus_figure() != null && cutPicBean.getQus_figure().size() > 0) { 244 if (cutPicBean.getQus_figure() != null && cutPicBean.getQus_figure().size() > 0) {
238 List<CutPicBean.FigLoaction> figLoactions = new ArrayList<>(); 245 List<CutPicBean.FigLoaction> figLoactions = new ArrayList<>();
239 for (CutPicBean.CutLocation cutLocation : cutPicBean.getQus_figure()) { 246 for (CutPicBean.CutLocation cutLocation : cutPicBean.getQus_figure()) {
240 figLoactions.add(cutLocation.getFig_location()); 247 figLoactions.add(cutLocation.getFig_location());
241 } 248 }
242 figLoactions = CommonUtil.rotaingLocation(angle, figLoactions, bitmap.getWidth(), bitmap.getHeight()); 249 figLoactions = CommonUtil.rotaingLocation(angle, figLoactions, bitmap.getWidth(), bitmap.getHeight());
243 bitmap = CommonUtil.rotaingImageView(angle, bitmap); 250 bitmap = CommonUtil.rotaingImageView(angle, bitmap);
244 String filepath = context.getExternalFilesDir("images").getPath() + "/" + String.valueOf(System.currentTimeMillis()) + CommonUtil.getStr() + ".jpg"; 251 String filepath = context.getExternalFilesDir("images").getPath() + "/" + String.valueOf(System.currentTimeMillis()) + CommonUtil.getStr() + ".jpg";
245 CommonUtil.saveBitmapToUri(bitmap, filepath); 252 CommonUtil.saveBitmapToUri(bitmap, filepath);
246 list.get(index).setPath(filepath); 253 list.get(index).setPath(filepath);
247 imageAdapter.notifyItemChanged(index); 254 imageAdapter.notifyItemChanged(index);
248 List<CutPicBean.FigLoaction> finalFigLoactions = figLoactions; 255 List<CutPicBean.FigLoaction> finalFigLoactions = figLoactions;
249 new Handler().postDelayed(new Runnable() { 256 new Handler().postDelayed(new Runnable() {
250 @Override 257 @Override
251 public void run() { 258 public void run() {
252 getRects(finalFigLoactions); 259 getRects(finalFigLoactions);
253 } 260 }
254 }, 500); 261 }, 500);
255 } else { 262 } else {
256 cancelLoadingDialog(); 263 cancelLoadingDialog();
257 } 264 }
258 } 265 }
259 266
260 @Override 267 @Override
261 protected ActivityImageBinding getViewBinding() { 268 protected ActivityImageBinding getViewBinding() {
262 return ActivityImageBinding.inflate(getLayoutInflater()); 269 return ActivityImageBinding.inflate(getLayoutInflater());
263 } 270 }
264 271
265 @SuppressLint("SetTextI18n") 272 @SuppressLint("SetTextI18n")
266 public void refreshNum() { 273 public void refreshNum() {
267 int num = 0; 274 int num = 0;
268 for (ImageBean imageBean : list) { 275 for (ImageBean imageBean : list) {
269 if (imageBean.getCuts() != null && imageBean.getCuts().size() > 0) { 276 if (imageBean.getCuts() != null && imageBean.getCuts().size() > 0) {
270 for (ImageBean.Cut cut : imageBean.getCuts()) { 277 for (ImageBean.Cut cut : imageBean.getCuts()) {
271 if (cut.isSelect()) { 278 if (cut.isSelect()) {
272 num++; 279 num++;
273 } 280 }
274 } 281 }
275 } 282 }
276 } 283 }
277 String btnText = type == 0 ? "保存错题" : "录入题目"; 284 String btnText = type == 0 ? "保存错题" : "录入题目";
278 if (num > 0) { 285 if (num > 0) {
279 binding.tvSave.setEnabled(true); 286 binding.tvSave.setEnabled(true);
280 binding.tvSave.setBackgroundResource(R.drawable.bg_soild_blue_5); 287 binding.tvSave.setBackgroundResource(R.drawable.bg_soild_blue_5);
281 binding.tvSave.setText(btnText + "(" + num + ")"); 288 binding.tvSave.setText(btnText + "(" + num + ")");
282 } else { 289 } else {
283 binding.tvSave.setEnabled(false); 290 binding.tvSave.setEnabled(false);
284 binding.tvSave.setBackgroundResource(R.drawable.bg_soild_blue_light_5); 291 binding.tvSave.setBackgroundResource(R.drawable.bg_soild_blue_light_5);
285 binding.tvSave.setText(btnText); 292 binding.tvSave.setText(btnText);
286 } 293 }
287 } 294 }
288 295
289 @Override 296 @Override
290 public void onClick(View v) { 297 public void onClick(View v) {
291 switch (v.getId()) { 298 switch (v.getId()) {
292 case R.id.iv_back: 299 case R.id.iv_back:
293 back(); 300 back();
294 break; 301 break;
295 case R.id.rl_next: 302 case R.id.rl_next:
296 if (binding.viewPager.getCurrentItem() + 1 < list.size()) { 303 if (binding.viewPager.getCurrentItem() + 1 < list.size()) {
297 binding.viewPager.setCurrentItem(binding.viewPager.getCurrentItem() + 1); 304 binding.viewPager.setCurrentItem(binding.viewPager.getCurrentItem() + 1);
298 } 305 }
299 break; 306 break;
300 case R.id.rl_previous: 307 case R.id.rl_previous:
301 if (binding.viewPager.getCurrentItem() != 0) { 308 if (binding.viewPager.getCurrentItem() != 0) {
302 binding.viewPager.setCurrentItem(binding.viewPager.getCurrentItem() - 1); 309 binding.viewPager.setCurrentItem(binding.viewPager.getCurrentItem() - 1);
303 } 310 }
304 break; 311 break;
305 case R.id.ll_edit: 312 case R.id.ll_edit:
306 Intent intent = new Intent(context, ImageEditActivity.class); 313 Intent intent = new Intent(context, ImageEditActivity.class);
307 intent.putExtra("path", list.get(binding.viewPager.getCurrentItem()).getPath()); 314 intent.putExtra("path", list.get(binding.viewPager.getCurrentItem()).getPath());
308 startActivityForResult(intent, 1001); 315 startActivityForResult(intent, 1001);
309 break; 316 break;
310 case R.id.tv_photo: 317 case R.id.tv_photo:
311 Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 318 Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
312 //确保有相机来处理Intent 319 //确保有相机来处理Intent
313 filePath = context.getExternalFilesDir("images").getPath() + "/" + String.valueOf(System.currentTimeMillis()) + CommonUtil.getStr() + ".jpg"; 320 filePath = context.getExternalFilesDir("images").getPath() + "/" + String.valueOf(System.currentTimeMillis()) + CommonUtil.getStr() + ".jpg";
314 File photoFile = new File(filePath); 321 File photoFile = new File(filePath);
315 if (photoFile != null) { 322 if (photoFile != null) {
316 //适配Android 7.0文件权限,通过FileProvider创建一个content类型的Uri 323 //适配Android 7.0文件权限,通过FileProvider创建一个content类型的Uri
317 Uri photoUri = FileProvider.getUriForFile(activity, "com.hjx.parent.fileprovider", photoFile); 324 Uri photoUri = FileProvider.getUriForFile(activity, "com.hjx.parent.fileprovider", photoFile);
318 takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); 325 takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
319 takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri); 326 takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
320 activity.startActivityForResult(takePictureIntent, 1002); 327 activity.startActivityForResult(takePictureIntent, 1002);
321 } 328 }
322 break; 329 break;
323 case R.id.tv_add: 330 case R.id.tv_add:
324 Intent intent1 = new Intent(context, ImageSelectActivity.class); 331 Intent intent1 = new Intent(context, ImageSelectActivity.class);
325 intent1.putExtra("path", list.get(binding.viewPager.getCurrentItem()).getPath()); 332 intent1.putExtra("path", list.get(binding.viewPager.getCurrentItem()).getPath());
326 startActivityForResult(intent1, 1001); 333 startActivityForResult(intent1, 1001);
327 break; 334 break;
328 case R.id.tv_save: 335 case R.id.tv_save:
329 List<TopicBean> topicBeans = new ArrayList<>(); 336 List<TopicBean> topicBeans = new ArrayList<>();
330 for (ImageBean imageBean : list) { 337 for (ImageBean imageBean : list) {
331 if (imageBean.getCuts() != null && imageBean.getCuts().size() > 0) { 338 if (imageBean.getCuts() != null && imageBean.getCuts().size() > 0) {
332 for (ImageBean.Cut cut : imageBean.getCuts()) { 339 for (ImageBean.Cut cut : imageBean.getCuts()) {
333 if (cut.isSelect()) { 340 if (cut.isSelect()) {
334 TopicBean bean = new TopicBean(); 341 TopicBean bean = new TopicBean();
335 String path = context.getExternalFilesDir("images").getPath() + "/" + String.valueOf(System.currentTimeMillis()) + CommonUtil.getStr() + ".jpg"; 342 String path = context.getExternalFilesDir("images").getPath() + "/" + String.valueOf(System.currentTimeMillis()) + CommonUtil.getStr() + ".jpg";
336 BitmapUtils.saveBitmap(cut.getBitmap(), path); 343 BitmapUtils.saveBitmap(cut.getBitmap(), path);
337 bean.setPath(path); 344 bean.setPath(path);
338 topicBeans.add(bean); 345 topicBeans.add(bean);
339 } 346 }
340 } 347 }
341 } 348 }
342 } 349 }
343 save(topicBeans); 350 save(topicBeans);
344 break; 351 break;
345 } 352 }
346 } 353 }
347 354
348 private void save(List<TopicBean> topicBeans) { 355 private void save(List<TopicBean> topicBeans) {
349 if (type == 0) { 356 if (type == 0) {
350 ErrorInputDialog dialog = new ErrorInputDialog(this, topicBeans); 357 ErrorInputDialog dialog = new ErrorInputDialog(this, topicBeans);
351 dialog.show(); 358 dialog.show();
352 } else { 359 } else {
353 List<String> paths = new ArrayList<>(); 360 List<String> paths = new ArrayList<>();
354 for (TopicBean it: topicBeans) { 361 for (TopicBean it: topicBeans) {
355 paths.add(it.getPath()); 362 paths.add(it.getPath());
356 } 363 }
357 if (addHomeworkDialog == null) { 364 if (addHomeworkDialog == null) {
358 addHomeworkDialog = new AddHomeworkDialog(this); 365 addHomeworkDialog = new AddHomeworkDialog(this);
359 } 366 }
360 addHomeworkDialog.show(paths, student -> { 367 addHomeworkDialog.show(paths, student -> {
361 Intent intent = new Intent(context, AddSuccessActivity.class); 368 Intent intent = new Intent(context, AddSuccessActivity.class);
362 intent.putExtra("type", type); 369 intent.putExtra("type", type);
363 intent.putExtra("studentJson", new Gson().toJson(student)); 370 intent.putExtra("studentJson", new Gson().toJson(student));
364 startActivity(intent); 371 startActivity(intent);
365 finish(); 372 finish();
366 }); 373 });
367 } 374 }
368 } 375 }
369 376
370 @Override 377 @Override
371 protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { 378 protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
372 super.onActivityResult(requestCode, resultCode, data); 379 super.onActivityResult(requestCode, resultCode, data);
373 if (requestCode == 1001) { 380 if (requestCode == 1001) {
374 if (resultCode == 1002) { 381 if (resultCode == 1002) {
375 if (list.size() > 1) { 382 if (list.size() > 1) {
376 list.remove(binding.viewPager.getCurrentItem()); 383 list.remove(binding.viewPager.getCurrentItem());
377 imageAdapter.notifyItemRemoved(binding.viewPager.getCurrentItem()); 384 imageAdapter.notifyItemRemoved(binding.viewPager.getCurrentItem());
378 binding.tvTitle.setText((binding.viewPager.getCurrentItem() + 1) + "/" + list.size()); 385 binding.tvTitle.setText((binding.viewPager.getCurrentItem() + 1) + "/" + list.size());
379 refreshNum(); 386 refreshNum();
380 } else { 387 } else {
381 finish(); 388 finish();
382 } 389 }
383 } else if (resultCode == 1003) { 390 } else if (resultCode == 1003) {
384 int position = binding.viewPager.getCurrentItem(); 391 int position = binding.viewPager.getCurrentItem();
392 String src = list.get(position).source;
385 list.remove(position); 393 list.remove(position);
386 String path = data.getStringExtra("path"); 394 String path = data.getStringExtra("path");
387 ImageBean imageBean = new ImageBean(); 395 ImageBean imageBean = new ImageBean();
388 imageBean.setPath(path); 396 imageBean.setPath(path);
397 imageBean.source = src;
389 list.add(position, imageBean); 398 list.add(position, imageBean);
390 imageAdapter.notifyItemChanged(position); 399 imageAdapter.notifyItemChanged(position);
391 clearText(); 400 clearText();
392 refreshNum(); 401 refreshNum();
393 } else if (resultCode == 1004) { 402 } else if (resultCode == 1004) {
394 Rect rect = data.getParcelableExtra("cut"); 403 Rect rect = data.getParcelableExtra("cut");
395 if (rect != null) { 404 if (rect != null) {
396 int position = binding.viewPager.getCurrentItem(); 405 int position = binding.viewPager.getCurrentItem();
397 ImageBean.Cut cut = new ImageBean.Cut(); 406 ImageBean.Cut cut = new ImageBean.Cut();
398 cut.setRect1(rect); 407 cut.setRect1(rect);
399 cut.setSelect(false); 408 cut.setSelect(false);
400 if (list.get(position).getCuts() != null) { 409 if (list.get(position).getCuts() != null) {
401 list.get(position).getCuts().add(cut); 410 list.get(position).getCuts().add(cut);
402 } else { 411 } else {
403 List<ImageBean.Cut> cuts =new ArrayList<>(); 412 List<ImageBean.Cut> cuts =new ArrayList<>();
404 cuts.add(cut); 413 cuts.add(cut);
405 list.get(position).setCuts(cuts); 414 list.get(position).setCuts(cuts);
406 } 415 }
407 imageAdapter.notifyItemChanged(position); 416 imageAdapter.notifyItemChanged(position);
408 refreshNum(); 417 refreshNum();
409 } 418 }
410 } else if (resultCode == 1005) { 419 } else if (resultCode == 1005) {
411 int i = data.getIntExtra("position", 0); 420 int i = data.getIntExtra("position", 0);
412 int position = binding.viewPager.getCurrentItem(); 421 int position = binding.viewPager.getCurrentItem();
413 Rect rect = data.getParcelableExtra("cut"); 422 Rect rect = data.getParcelableExtra("cut");
414 if (rect != null) { 423 if (rect != null) {
415 ImageBean.Cut cut = new ImageBean.Cut(); 424 ImageBean.Cut cut = new ImageBean.Cut();
416 cut.setRect1(rect); 425 cut.setRect1(rect);
417 cut.setSelect(false); 426 cut.setSelect(false);
418 list.get(position).getCuts().remove(i); 427 list.get(position).getCuts().remove(i);
419 list.get(position).getCuts().add(i, cut); 428 list.get(position).getCuts().add(i, cut);
420 imageAdapter.notifyItemChanged(position); 429 imageAdapter.notifyItemChanged(position);
421 refreshNum(); 430 refreshNum();
422 } else { 431 } else {
423 list.get(position).getCuts().remove(i); 432 list.get(position).getCuts().remove(i);
424 imageAdapter.notifyItemChanged(position); 433 imageAdapter.notifyItemChanged(position);
425 refreshNum(); 434 refreshNum();
426 } 435 }
427 } 436 }
428 } else if (requestCode == 1002 && resultCode == RESULT_OK && !TextUtils.isEmpty(filePath)) { 437 } else if (requestCode == 1002 && resultCode == RESULT_OK && !TextUtils.isEmpty(filePath)) {
429 Bitmap b = BitmapUtils.compress(BitmapFactory.decodeFile(filePath)); 438 Bitmap b = BitmapUtils.compress(BitmapFactory.decodeFile(filePath));
430 String path = context.getExternalFilesDir("images").getPath() + "/" + String.valueOf(System.currentTimeMillis()) + CommonUtil.getStr() + ".jpg"; 439 String path = context.getExternalFilesDir("images").getPath() + "/" + String.valueOf(System.currentTimeMillis()) + CommonUtil.getStr() + ".jpg";
431 CommonUtil.saveBitmapToUri(b, path); 440 CommonUtil.saveBitmapToUri(b, path);
432 int position = binding.viewPager.getCurrentItem(); 441 int position = binding.viewPager.getCurrentItem();
433 list.remove(position); 442 list.remove(position);
434 ImageBean imageBean = new ImageBean(); 443 ImageBean imageBean = new ImageBean();
435 imageBean.setPath(path); 444 imageBean.setPath(path);
445 imageBean.source = path;
436 list.add(position, imageBean); 446 list.add(position, imageBean);
437 imageAdapter.notifyItemChanged(position); 447 imageAdapter.notifyItemChanged(position);
438 clearText(); 448 clearText();
439 refreshNum(); 449 refreshNum();
440 } 450 }
441 } 451 }
442 452
443 private void back() { 453 private void back() {
444 showTipDialog("温馨提示", "是否确认退出?", "取消", "确定", new TipDialog.TipDialogInterface() { 454 showTipDialog("温馨提示", "是否确认退出?", "取消", "确定", new TipDialog.TipDialogInterface() {
445 @Override 455 @Override
446 public void onConfirm(Dialog dialog) { 456 public void onConfirm(Dialog dialog) {
447 dialog.dismiss(); 457 dialog.dismiss();
448 finish(); 458 finish();
449 } 459 }
450 460
451 @Override 461 @Override
452 public void onCancel(Dialog dialog) { 462 public void onCancel(Dialog dialog) {
453 dialog.dismiss(); 463 dialog.dismiss();
454 } 464 }
455 }); 465 });
456 } 466 }
457 467
458 @Override 468 @Override
459 public boolean onKeyDown(int keyCode, KeyEvent event) { 469 public boolean onKeyDown(int keyCode, KeyEvent event) {
460 if (keyCode == KeyEvent.KEYCODE_BACK) { 470 if (keyCode == KeyEvent.KEYCODE_BACK) {
461 back(); 471 back();
462 return true; 472 return true;
463 } 473 }
464 return super.onKeyDown(keyCode, event); 474 return super.onKeyDown(keyCode, event);
465 } 475 }
466 } 476 }
467 477
app/src/main/res/layout/activity_image.xml
1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 android:layout_width="match_parent" 2 android:layout_width="match_parent"
3 android:layout_height="match_parent" 3 android:layout_height="match_parent"
4 android:orientation="vertical"> 4 android:orientation="vertical">
5 5
6 <RelativeLayout 6 <RelativeLayout
7 android:layout_width="match_parent" 7 android:layout_width="match_parent"
8 android:layout_height="40dp" 8 android:layout_height="40dp"
9 android:background="@color/white"> 9 android:background="@color/white">
10 10
11 <TextView 11 <TextView
12 android:id="@+id/tv_title" 12 android:id="@+id/tv_title"
13 android:layout_width="wrap_content" 13 android:layout_width="wrap_content"
14 android:layout_height="wrap_content" 14 android:layout_height="wrap_content"
15 android:layout_centerInParent="true" 15 android:layout_centerInParent="true"
16 android:textColor="#333333" 16 android:textColor="#333333"
17 android:textSize="18sp" /> 17 android:textSize="18sp" />
18 18
19 <ImageView 19 <ImageView
20 android:id="@+id/iv_back" 20 android:id="@+id/iv_back"
21 android:layout_width="30dp" 21 android:layout_width="30dp"
22 android:layout_height="36dp" 22 android:layout_height="36dp"
23 android:layout_centerVertical="true" 23 android:layout_centerVertical="true"
24 android:layout_marginLeft="5dp" 24 android:layout_marginLeft="5dp"
25 android:padding="10dp" 25 android:padding="10dp"
26 android:src="@mipmap/icon_back" /> 26 android:src="@mipmap/icon_back" />
27 27
28 <TextView 28 <TextView
29 android:id="@+id/tv_photo" 29 android:id="@+id/tv_photo"
30 android:layout_width="wrap_content" 30 android:layout_width="wrap_content"
31 android:layout_height="wrap_content" 31 android:layout_height="wrap_content"
32 android:layout_centerVertical="true" 32 android:layout_centerVertical="true"
33 android:layout_toRightOf="@+id/iv_back" 33 android:layout_toRightOf="@+id/iv_back"
34 android:text="重拍" 34 android:text="重拍"
35 android:textColor="#333333" 35 android:textColor="#333333"
36 android:textSize="14sp" /> 36 android:textSize="14sp" />
37 37
38 <TextView 38 <TextView
39 android:id="@+id/btnShowSource"
39 android:layout_width="wrap_content" 40 android:layout_width="wrap_content"
40 android:layout_height="wrap_content" 41 android:layout_height="wrap_content"
41 android:layout_alignParentRight="true" 42 android:layout_alignParentRight="true"
42 android:layout_centerVertical="true" 43 android:layout_centerVertical="true"
43 android:layout_marginRight="15dp" 44 android:layout_marginRight="15dp"
44 android:text="查看原图" 45 android:text="查看原图"
45 android:textColor="#333333" 46 android:textColor="#333333"
46 android:textSize="14sp" 47 android:textSize="14sp" />
47 android:visibility="gone" />
48 </RelativeLayout> 48 </RelativeLayout>
49 49
50 <TextView 50 <TextView
51 android:layout_width="match_parent" 51 android:layout_width="match_parent"
52 android:layout_height="35dp" 52 android:layout_height="35dp"
53 android:background="#C7DFF5" 53 android:background="#C7DFF5"
54 android:gravity="center" 54 android:gravity="center"
55 android:text="已为您自动框选题目,点击“+”添加题目" 55 android:text="已为您自动框选题目,点击“+”添加题目"
56 android:textColor="#1C90F3" 56 android:textColor="#1C90F3"
57 android:textSize="13sp" /> 57 android:textSize="13sp" />
58 58
59 <RelativeLayout 59 <RelativeLayout
60 android:layout_width="match_parent" 60 android:layout_width="match_parent"
61 android:layout_height="match_parent" 61 android:layout_height="match_parent"
62 android:background="#F8F8F8"> 62 android:background="#F8F8F8">
63 63
64 <androidx.viewpager2.widget.ViewPager2 64 <androidx.viewpager2.widget.ViewPager2
65 android:id="@+id/viewPager" 65 android:id="@+id/viewPager"
66 android:layout_width="match_parent" 66 android:layout_width="match_parent"
67 android:layout_height="match_parent" 67 android:layout_height="match_parent"
68 android:layout_above="@+id/rl_previous" /> 68 android:layout_above="@+id/rl_previous" />
69 69
70 <RelativeLayout 70 <RelativeLayout
71 android:id="@+id/rl_previous" 71 android:id="@+id/rl_previous"
72 android:layout_width="30dp" 72 android:layout_width="30dp"
73 android:layout_height="30dp" 73 android:layout_height="30dp"
74 android:layout_above="@+id/rl_bottom" 74 android:layout_above="@+id/rl_bottom"
75 android:layout_marginLeft="15dp" 75 android:layout_marginLeft="15dp"
76 android:layout_marginBottom="15dp" 76 android:layout_marginBottom="15dp"
77 android:background="@drawable/bg_solid_white"> 77 android:background="@drawable/bg_solid_white">
78 78
79 <ImageView 79 <ImageView
80 android:id="@+id/iv_previous" 80 android:id="@+id/iv_previous"
81 android:layout_width="10dp" 81 android:layout_width="10dp"
82 android:layout_height="18dp" 82 android:layout_height="18dp"
83 android:layout_centerInParent="true" 83 android:layout_centerInParent="true"
84 android:src="@mipmap/ic_previous_gray" /> 84 android:src="@mipmap/ic_previous_gray" />
85 </RelativeLayout> 85 </RelativeLayout>
86 86
87 <RelativeLayout 87 <RelativeLayout
88 android:id="@+id/rl_next" 88 android:id="@+id/rl_next"
89 android:layout_width="30dp" 89 android:layout_width="30dp"
90 android:layout_height="30dp" 90 android:layout_height="30dp"
91 android:layout_above="@+id/rl_bottom" 91 android:layout_above="@+id/rl_bottom"
92 android:layout_alignParentRight="true" 92 android:layout_alignParentRight="true"
93 android:layout_marginRight="15dp" 93 android:layout_marginRight="15dp"
94 android:layout_marginBottom="15dp" 94 android:layout_marginBottom="15dp"
95 android:background="@drawable/bg_solid_white"> 95 android:background="@drawable/bg_solid_white">
96 96
97 <ImageView 97 <ImageView
98 android:id="@+id/iv_next" 98 android:id="@+id/iv_next"
99 android:layout_width="10dp" 99 android:layout_width="10dp"
100 android:layout_height="18dp" 100 android:layout_height="18dp"
101 android:layout_centerInParent="true" 101 android:layout_centerInParent="true"
102 android:src="@mipmap/ic_next_gray" /> 102 android:src="@mipmap/ic_next_gray" />
103 </RelativeLayout> 103 </RelativeLayout>
104 104
105 <RelativeLayout 105 <RelativeLayout
106 android:id="@+id/rl_bottom" 106 android:id="@+id/rl_bottom"
107 android:layout_width="match_parent" 107 android:layout_width="match_parent"
108 android:layout_height="70dp" 108 android:layout_height="70dp"
109 android:layout_alignParentBottom="true" 109 android:layout_alignParentBottom="true"
110 android:background="@color/white"> 110 android:background="@color/white">
111 111
112 <LinearLayout 112 <LinearLayout
113 android:id="@+id/ll_edit" 113 android:id="@+id/ll_edit"
114 android:layout_width="wrap_content" 114 android:layout_width="wrap_content"
115 android:layout_height="wrap_content" 115 android:layout_height="wrap_content"
116 android:layout_centerVertical="true" 116 android:layout_centerVertical="true"
117 android:layout_marginLeft="15dp" 117 android:layout_marginLeft="15dp"
118 android:orientation="vertical"> 118 android:orientation="vertical">
119 119
120 <ImageView 120 <ImageView
121 android:layout_width="25dp" 121 android:layout_width="25dp"
122 android:layout_height="25dp" 122 android:layout_height="25dp"
123 android:layout_gravity="center_horizontal" 123 android:layout_gravity="center_horizontal"
124 android:src="@mipmap/ic_pic_edit" /> 124 android:src="@mipmap/ic_pic_edit" />
125 125
126 <TextView 126 <TextView
127 android:layout_width="wrap_content" 127 android:layout_width="wrap_content"
128 android:layout_height="wrap_content" 128 android:layout_height="wrap_content"
129 android:layout_marginTop="5dp" 129 android:layout_marginTop="5dp"
130 android:text="图片编辑" 130 android:text="图片编辑"
131 android:textSize="11sp" /> 131 android:textSize="11sp" />
132 </LinearLayout> 132 </LinearLayout>
133 133
134 <TextView 134 <TextView
135 android:id="@+id/tv_add" 135 android:id="@+id/tv_add"
136 android:layout_width="140dp" 136 android:layout_width="140dp"
137 android:layout_height="40dp" 137 android:layout_height="40dp"
138 android:layout_centerVertical="true" 138 android:layout_centerVertical="true"
139 android:layout_marginRight="15dp" 139 android:layout_marginRight="15dp"
140 android:layout_toLeftOf="@+id/tv_save" 140 android:layout_toLeftOf="@+id/tv_save"
141 android:background="@drawable/bg_soild_orange_5" 141 android:background="@drawable/bg_soild_orange_5"
142 android:gravity="center" 142 android:gravity="center"
143 android:text="手动框选" 143 android:text="手动框选"
144 android:textColor="@color/white" 144 android:textColor="@color/white"
145 android:textSize="18sp" /> 145 android:textSize="18sp" />
146 146
147 <TextView 147 <TextView
148 android:id="@+id/tv_save" 148 android:id="@+id/tv_save"
149 android:layout_width="140dp" 149 android:layout_width="140dp"
150 android:layout_height="40dp" 150 android:layout_height="40dp"
151 android:layout_alignParentRight="true" 151 android:layout_alignParentRight="true"
152 android:layout_centerVertical="true" 152 android:layout_centerVertical="true"
153 android:layout_marginRight="15dp" 153 android:layout_marginRight="15dp"
154 android:background="@drawable/bg_soild_blue_light_5" 154 android:background="@drawable/bg_soild_blue_light_5"
155 android:enabled="false" 155 android:enabled="false"
156 android:gravity="center" 156 android:gravity="center"
157 android:text="保存错题" 157 android:text="保存错题"
158 android:textColor="@color/white" 158 android:textColor="@color/white"
159 android:textSize="18sp" /> 159 android:textSize="18sp" />
160 </RelativeLayout> 160 </RelativeLayout>
161 </RelativeLayout> 161 </RelativeLayout>
libs/common/src/main/java/com/prws/common/bean/ImageBean.java
1 package com.prws.common.bean; 1 package com.prws.common.bean;
2 2
3 import android.graphics.Bitmap; 3 import android.graphics.Bitmap;
4 import android.graphics.Rect; 4 import android.graphics.Rect;
5 5
6 import java.io.Serializable; 6 import java.io.Serializable;
7 import java.util.List; 7 import java.util.List;
8 8
9 public class ImageBean implements Serializable { 9 public class ImageBean implements Serializable {
10 public transient String source;
11
10 private String path; 12 private String path;
11 private List<Cut> cuts; 13 private List<Cut> cuts;
12 14
13 public static class Cut implements Serializable { 15 public static class Cut implements Serializable {
14 private CutPicBean.FigLoaction rect; 16 private CutPicBean.FigLoaction rect;
15 private boolean select; 17 private boolean select;
16 private Bitmap bitmap; 18 private Bitmap bitmap;
17 19
18 private Rect rect1; 20 private Rect rect1;
19 21
20 public void setRect1(Rect rect1) { 22 public void setRect1(Rect rect1) {
21 this.rect1 = rect1; 23 this.rect1 = rect1;
22 } 24 }
23 25
24 public Rect getRect1() { 26 public Rect getRect1() {
25 return rect1; 27 return rect1;
26 } 28 }
27 29
28 public void setBitmap(Bitmap bitmap) { 30 public void setBitmap(Bitmap bitmap) {
29 this.bitmap = bitmap; 31 this.bitmap = bitmap;
30 } 32 }
31 33
32 public Bitmap getBitmap() { 34 public Bitmap getBitmap() {
33 return bitmap; 35 return bitmap;
34 } 36 }
35 37
36 public void setRect(CutPicBean.FigLoaction rect) { 38 public void setRect(CutPicBean.FigLoaction rect) {
37 this.rect = rect; 39 this.rect = rect;
38 } 40 }
39 41
40 public void setSelect(boolean select) { 42 public void setSelect(boolean select) {
41 this.select = select; 43 this.select = select;
42 } 44 }
43 45
44 public CutPicBean.FigLoaction getRect() { 46 public CutPicBean.FigLoaction getRect() {
45 return rect; 47 return rect;
46 } 48 }
47 49
48 public boolean isSelect() { 50 public boolean isSelect() {
49 return select; 51 return select;
50 } 52 }
51 } 53 }
52 54
53 public void setPath(String path) { 55 public void setPath(String path) {
54 this.path = path; 56 this.path = path;
55 } 57 }
56 58
57 public String getPath() { 59 public String getPath() {
58 return path; 60 return path;
59 } 61 }
60 62
61 public void setCuts(List<Cut> cuts) { 63 public void setCuts(List<Cut> cuts) {
62 this.cuts = cuts; 64 this.cuts = cuts;
63 } 65 }
64 66
65 public List<Cut> getCuts() { 67 public List<Cut> getCuts() {
66 return cuts; 68 return cuts;
67 } 69 }
68 } 70 }
69 71