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
public void onSaveInstanceState(Bundle savedInstanceState) {
Intent pendingIntent = pendingViewIntent.pop();
savedInstanceState.putParcelable("intent", pendingIntent == null ? pendingIntent : getIntent());
Intent pendingIntent = pendingViewIntent.peek();
savedInstanceState.putParcelable("intent", pendingIntent != null ? pendingIntent : getIntent());
super.onSaveInstanceState(savedInstanceState);
}

View File

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