Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save media capture path during orientation changes #16037

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
19.4
-----
* [*] Reader: nested comments with missing parent are now hidden from the comment list [https://github.com/wordpress-mobile/WordPress-Android/pull/15993]
* [*] Fixed an issue which prevented uploading of captured photos after an orientation change. [https://github.com/wordpress-mobile/WordPress-Android/pull/16037]

19.3
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ public class EditPostActivity extends LocaleAwareActivity implements
private static final String STATE_KEY_REVISION = "stateKeyRevision";
private static final String STATE_KEY_EDITOR_SESSION_DATA = "stateKeyEditorSessionData";
private static final String STATE_KEY_GUTENBERG_IS_SHOWN = "stateKeyGutenbergIsShown";
private static final String STATE_KEY_MEDIA_CAPTURE_PATH = "stateKeyMediaCapturePath";

private static final int PAGE_CONTENT = 0;
private static final int PAGE_SETTINGS = 1;
Expand Down Expand Up @@ -1047,6 +1048,10 @@ protected void onSaveInstanceState(Bundle outState) {
if (mEditorFragment != null) {
getSupportFragmentManager().putFragment(outState, STATE_KEY_EDITOR_FRAGMENT, mEditorFragment);
}

// We must save the media capture path when the activity is destroyed to handle orientation changes during
// photo capture (see: https://github.com/wordpress-mobile/WordPress-Android/issues/11296)
outState.putString(STATE_KEY_MEDIA_CAPTURE_PATH, mMediaCapturePath);
}

@Override
Expand All @@ -1057,6 +1062,9 @@ protected void onRestoreInstanceState(Bundle savedInstanceState) {
if (savedInstanceState.getBoolean(STATE_KEY_IS_PHOTO_PICKER_VISIBLE, false)) {
mEditorPhotoPicker.showPhotoPicker(mSite);
}

// Restore media capture path for orientation changes during photo capture
mMediaCapturePath = savedInstanceState.getString(STATE_KEY_MEDIA_CAPTURE_PATH, "");
}

@Override
Expand Down