From cce617b12fb148175e3ddd7ca4b2d268cdd90b1c Mon Sep 17 00:00:00 2001 From: Agnieszka C <85929121+Aga-C@users.noreply.github.com> Date: Sun, 26 Sep 2021 23:33:39 +0200 Subject: [PATCH] Changed back button behavior in thread (#187) --- .../smsmessenger/activities/ThreadActivity.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt index d40ac05d..d94bd05c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/ThreadActivity.kt @@ -159,6 +159,7 @@ class ThreadActivity : SimpleActivity() { R.id.delete -> askConfirmDelete() R.id.manage_people -> managePeople() R.id.mark_as_unread -> markAsUnread() + android.R.id.home -> onBackPressed() else -> return super.onOptionsItemSelected(item) } return true @@ -171,6 +172,13 @@ class ThreadActivity : SimpleActivity() { } } + override fun onBackPressed() { + super.onBackPressed() + val intent = Intent(this, MainActivity::class.java) + startActivity(intent) + finish() + } + private fun setupCachedMessages(callback: () -> Unit) { ensureBackgroundThread { messages = try {