fixed take photo for activties that do not get destroyed

This commit is contained in:
Daniel Gultsch 2018-03-01 11:34:42 +01:00
parent 71beb92dd3
commit 363c39a873
2 changed files with 9 additions and 6 deletions

View file

@ -432,8 +432,8 @@ public class ConversationActivity extends XmppActivity implements OnConversation
@Override @Override
public void onSaveInstanceState(Bundle savedInstanceState) { public void onSaveInstanceState(Bundle savedInstanceState) {
Intent pendingIntent = pendingViewIntent.pop(); Intent pendingIntent = pendingViewIntent.peek();
savedInstanceState.putParcelable("intent", pendingIntent == null ? pendingIntent : getIntent()); savedInstanceState.putParcelable("intent", pendingIntent != null ? pendingIntent : getIntent());
super.onSaveInstanceState(savedInstanceState); super.onSaveInstanceState(savedInstanceState);
} }

View file

@ -1584,7 +1584,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
if (conversation != null) { if (conversation != null) {
outState.putString(STATE_CONVERSATION_UUID, conversation.getUuid()); outState.putString(STATE_CONVERSATION_UUID, conversation.getUuid());
final Uri uri = pendingTakePhotoUri.pop(); final Uri uri = pendingTakePhotoUri.peek();
if (uri != null) { if (uri != null) {
outState.putString(STATE_PHOTO_URI, uri.toString()); outState.putString(STATE_PHOTO_URI, uri.toString());
} }
@ -2361,14 +2361,17 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (activityResult != null) { if (activityResult != null) {
handleActivityResult(activityResult); handleActivityResult(activityResult);
} }
clearPending();
} }
public void clearPending() { private void clearPending() {
if (postponedActivityResult.pop() != null) { if (postponedActivityResult.pop() != null) {
Log.d(Config.LOGTAG, "cleared pending intent with unhandled result left"); Log.e(Config.LOGTAG, "cleared pending intent with unhandled result left");
} }
pendingScrollState.pop(); pendingScrollState.pop();
pendingTakePhotoUri.pop(); if (pendingTakePhotoUri.pop() != null) {
Log.e(Config.LOGTAG,"cleared pending photo uri");
}
} }
public Conversation getConversation() { public Conversation getConversation() {