Commit 9ec5407bef2f8afe1650caf1ed075e8ce0257d26

Authored by shixianjie
1 parent 216ca52fec
Exists in master

查看原图功能

.idea/deploymentTargetDropDown.xml
... ... @@ -3,7 +3,20 @@
3 3 <component name="deploymentTargetDropDown">
4 4 <value>
5 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 20 </entry>
8 21 </value>
9 22 </component>
... ...
app/src/main/java/com/hjx/parent/ImageActivity.java
... ... @@ -26,6 +26,7 @@ import com.hjx.parent.adapter.ImageAdapter;
26 26 import com.hjx.parent.databinding.ActivityImageBinding;
27 27 import com.hjx.parent.dialog.AddHomeworkDialog;
28 28 import com.hjx.parent.dialog.ErrorInputDialog;
  29 +import com.hjx.parent.dialog.PhotoViewDialog;
29 30 import com.hjx.parent.dialog.TipDialog;
30 31 import com.hjx.parent.rx.BaseRxActivity;
31 32 import com.prws.common.bean.CutPicBean;
... ... @@ -68,6 +69,7 @@ public class ImageActivity extends BaseRxActivity&lt;ActivityImageBinding&gt; implemen
68 69 Bitmap bitmap = BitmapUtils.getimage(s);
69 70 CommonUtil.saveBitmapToUri(bitmap, filepath);
70 71 imageBean.setPath(filepath);
  72 + imageBean.source = filepath;
71 73 list.add(imageBean);
72 74 }
73 75 imageAdapter = new ImageAdapter(this, list);
... ... @@ -105,6 +107,11 @@ public class ImageActivity extends BaseRxActivity&lt;ActivityImageBinding&gt; implemen
105 107 binding.tvAdd.setOnClickListener(this);
106 108 binding.llEdit.setOnClickListener(this);
107 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 117 public void clearText() {
... ... @@ -382,10 +389,12 @@ public class ImageActivity extends BaseRxActivity&lt;ActivityImageBinding&gt; implemen
382 389 }
383 390 } else if (resultCode == 1003) {
384 391 int position = binding.viewPager.getCurrentItem();
  392 + String src = list.get(position).source;
385 393 list.remove(position);
386 394 String path = data.getStringExtra("path");
387 395 ImageBean imageBean = new ImageBean();
388 396 imageBean.setPath(path);
  397 + imageBean.source = src;
389 398 list.add(position, imageBean);
390 399 imageAdapter.notifyItemChanged(position);
391 400 clearText();
... ... @@ -433,6 +442,7 @@ public class ImageActivity extends BaseRxActivity&lt;ActivityImageBinding&gt; implemen
433 442 list.remove(position);
434 443 ImageBean imageBean = new ImageBean();
435 444 imageBean.setPath(path);
  445 + imageBean.source = path;
436 446 list.add(position, imageBean);
437 447 imageAdapter.notifyItemChanged(position);
438 448 clearText();
... ...
app/src/main/res/layout/activity_image.xml
... ... @@ -36,6 +36,7 @@
36 36 android:textSize="14sp" />
37 37  
38 38 <TextView
  39 + android:id="@+id/btnShowSource"
39 40 android:layout_width="wrap_content"
40 41 android:layout_height="wrap_content"
41 42 android:layout_alignParentRight="true"
... ... @@ -43,8 +44,7 @@
43 44 android:layout_marginRight="15dp"
44 45 android:text="查看原图"
45 46 android:textColor="#333333"
46   - android:textSize="14sp"
47   - android:visibility="gone" />
  47 + android:textSize="14sp" />
48 48 </RelativeLayout>
49 49  
50 50 <TextView
... ...
libs/common/src/main/java/com/prws/common/bean/ImageBean.java
... ... @@ -7,6 +7,8 @@ import java.io.Serializable;
7 7 import java.util.List;
8 8  
9 9 public class ImageBean implements Serializable {
  10 + public transient String source;
  11 +
10 12 private String path;
11 13 private List<Cut> cuts;
12 14  
... ...