From eebe227a2011f5b05c73548bc8ac95b3185352be Mon Sep 17 00:00:00 2001 From: haffenloher Date: Tue, 1 Dec 2015 01:38:37 +0100 Subject: [PATCH] Return to archive on back button press in archived convo When the back/up/home button in the action bar is pressed in an archived conversation, return to the archive instead of the inbox. Closes #4770 // FREEBIE --- src/org/thoughtcrime/securesms/ConversationActivity.java | 5 ++++- .../securesms/ConversationListArchiveActivity.java | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index 12bb463ad9..29717ac4e5 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -163,6 +163,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity public static final String RECIPIENTS_EXTRA = "recipients"; public static final String THREAD_ID_EXTRA = "thread_id"; + public static final String IS_ARCHIVED_EXTRA = "is_archived"; public static final String TEXT_EXTRA = "draft_text"; public static final String DISTRIBUTION_TYPE_EXTRA = "distribution_type"; @@ -199,6 +200,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity private Recipients recipients; private long threadId; private int distributionType; + private boolean archived; private boolean isSecureText; private boolean isSecureVoice; private boolean isMmsEnabled = true; @@ -426,7 +428,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity //////// Event Handlers private void handleReturnToConversationList() { - Intent intent = new Intent(this, ConversationListActivity.class); + Intent intent = new Intent(this, (archived ? ConversationListArchiveActivity.class : ConversationListActivity.class)); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); @@ -917,6 +919,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity recipients = RecipientFactory.getRecipientsForIds(this, getIntent().getLongArrayExtra(RECIPIENTS_EXTRA), true); threadId = getIntent().getLongExtra(THREAD_ID_EXTRA, -1); + archived = getIntent().getBooleanExtra(IS_ARCHIVED_EXTRA, false); distributionType = getIntent().getIntExtra(DISTRIBUTION_TYPE_EXTRA, ThreadDatabase.DistributionTypes.DEFAULT); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { diff --git a/src/org/thoughtcrime/securesms/ConversationListArchiveActivity.java b/src/org/thoughtcrime/securesms/ConversationListArchiveActivity.java index b208e298e8..08ad5eedea 100644 --- a/src/org/thoughtcrime/securesms/ConversationListArchiveActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationListArchiveActivity.java @@ -57,6 +57,7 @@ public class ConversationListArchiveActivity extends PassphraseRequiredActionBar Intent intent = new Intent(this, ConversationActivity.class); intent.putExtra(ConversationActivity.RECIPIENTS_EXTRA, recipients.getIds()); intent.putExtra(ConversationActivity.THREAD_ID_EXTRA, threadId); + intent.putExtra(ConversationActivity.IS_ARCHIVED_EXTRA, true); intent.putExtra(ConversationActivity.DISTRIBUTION_TYPE_EXTRA, distributionType); startActivity(intent);