Save photo URI

pull/162/head
M66B 5 years ago
parent 4f48fb417e
commit 94f3f05d0f

@ -683,6 +683,7 @@ public class FragmentCompose extends FragmentBase {
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
outState.putLong("fair:working", working); outState.putLong("fair:working", working);
outState.putBoolean("fair:show_images", show_images); outState.putBoolean("fair:show_images", show_images);
outState.putParcelable("fair:photo", photoURI);
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
} }
@ -730,6 +731,7 @@ public class FragmentCompose extends FragmentBase {
} else { } else {
working = savedInstanceState.getLong("fair:working"); working = savedInstanceState.getLong("fair:working");
show_images = savedInstanceState.getBoolean("fair:show_images"); show_images = savedInstanceState.getBoolean("fair:show_images");
photoURI = savedInstanceState.getParcelable("fair:photo");
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString("action", working < 0 ? "new" : "edit"); args.putString("action", working < 0 ? "new" : "edit");
@ -981,6 +983,7 @@ public class FragmentCompose extends FragmentBase {
dir.mkdir(); dir.mkdir();
File file = new File(dir, new Date().getTime() + ".jpg"); File file = new File(dir, new Date().getTime() + ".jpg");
// https://developer.android.com/training/camera/photobasics
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
photoURI = FileProvider.getUriForFile(getContext(), BuildConfig.APPLICATION_ID, file); photoURI = FileProvider.getUriForFile(getContext(), BuildConfig.APPLICATION_ID, file);
intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI); intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);

Loading…
Cancel
Save