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
This commit is contained in:
haffenloher 2015-12-01 01:38:37 +01:00 committed by Moxie Marlinspike
parent 8fb73a092d
commit eebe227a20
2 changed files with 5 additions and 1 deletions

View File

@ -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) {

View File

@ -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);