Skip to content

Commit

Permalink
Bugfix issue 665 (#700)
Browse files Browse the repository at this point in the history
* GH-665 - store the imageFilePath when the app is paused (onSaveInstance) and restore it back.

* Update src/android/CameraLauncher.java whitespace layout

Co-authored-by: Tim Brust <github@timbrust.de>

Co-authored-by: Tim Brust <github@timbrust.de>
  • Loading branch information
PieterVanPoyer and timbru31 authored Feb 2, 2021
1 parent b43c78b commit f704689
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/android/CameraLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
private static final String GET_All = "Get All";
private static final String CROPPED_URI_KEY = "croppedUri";
private static final String IMAGE_URI_KEY = "imageUri";
private static final String IMAGE_FILE_PATH_KEY = "imageFilePath";

private static final String TAKE_PICTURE_ACTION = "takePicture";

Expand Down Expand Up @@ -1350,6 +1351,10 @@ public Bundle onSaveInstanceState() {
state.putString(IMAGE_URI_KEY, this.imageFilePath);
}

if (this.imageFilePath != null) {
state.putString(IMAGE_FILE_PATH_KEY, this.imageFilePath);
}

return state;
}

Expand All @@ -1375,6 +1380,10 @@ public void onRestoreStateForActivityResult(Bundle state, CallbackContext callba
this.imageUri = Uri.parse(state.getString(IMAGE_URI_KEY));
}

if (state.containsKey(IMAGE_FILE_PATH_KEY)) {
this.imageFilePath = state.getString(IMAGE_FILE_PATH_KEY);
}

this.callbackContext = callbackContext;
}
}

0 comments on commit f704689

Please sign in to comment.