|
@@ -95,6 +95,7 @@ public class UpdateActivity extends AppCompatActivity implements UpdateAdapter.U
|
|
|
private File photoFile = null;
|
|
private File photoFile = null;
|
|
|
|
|
|
|
|
private ProgressDialog mProgressDialog;
|
|
private ProgressDialog mProgressDialog;
|
|
|
|
|
+ private ArrayList<File> mPhotoArray = new ArrayList<>();// 用于直接返回后删除Photo文件
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@@ -178,9 +179,11 @@ public class UpdateActivity extends AppCompatActivity implements UpdateAdapter.U
|
|
|
@Override
|
|
@Override
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
switch (item.getItemId()) {
|
|
switch (item.getItemId()) {
|
|
|
- case android.R.id.home:
|
|
|
|
|
|
|
+ case android.R.id.home: {
|
|
|
|
|
+ clearPhotos();
|
|
|
this.finish(); // back button
|
|
this.finish(); // back button
|
|
|
return true;
|
|
return true;
|
|
|
|
|
+ }
|
|
|
case R.id.update_btn: {
|
|
case R.id.update_btn: {
|
|
|
update();
|
|
update();
|
|
|
return true;
|
|
return true;
|
|
@@ -229,6 +232,8 @@ public class UpdateActivity extends AppCompatActivity implements UpdateAdapter.U
|
|
|
mPhotoModel.setPhotoPath(photoFile.getAbsolutePath());
|
|
mPhotoModel.setPhotoPath(photoFile.getAbsolutePath());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ mPhotoArray.add(photoFile);
|
|
|
|
|
+
|
|
|
} else {
|
|
} else {
|
|
|
if (photoFile.exists()) {
|
|
if (photoFile.exists()) {
|
|
|
photoFile.delete(); // 没有拍照直接返回,需要将文件删除
|
|
photoFile.delete(); // 没有拍照直接返回,需要将文件删除
|
|
@@ -252,6 +257,17 @@ public class UpdateActivity extends AppCompatActivity implements UpdateAdapter.U
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void clearPhotos() {
|
|
|
|
|
+
|
|
|
|
|
+ for(File file : mPhotoArray) {
|
|
|
|
|
+ if (file.exists()) {
|
|
|
|
|
+ file.delete();
|
|
|
|
|
+ ImageUtil.updateGallery(mCtx,file.getAbsolutePath());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Camera Permission
|
|
* Camera Permission
|
|
|
* */
|
|
* */
|