|
@@ -5,10 +5,12 @@
|
|
|
* @author Andy Scherzinger
|
|
|
* @author Marcel Hibbe
|
|
|
* @author Mario Danic
|
|
|
+ * @author Ezhil Shanmugham
|
|
|
* Copyright (C) 2022 Álvaro Brey <alvaro.brey@nextcloud.com>
|
|
|
* Copyright (C) 2022 Andy Scherzinger (info@andy-scherzinger.de)
|
|
|
* Copyright (C) 2022 Marcel Hibbe (dev@mhibbe.de)
|
|
|
* Copyright (C) 2017-2020 Mario Danic (mario@lovelyhq.com)
|
|
|
+ * Copyright (C) 2023 Ezhil Shanmugham <ezhil56x.contact@gmail.com>
|
|
|
*
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
@@ -47,6 +49,7 @@ import android.view.View
|
|
|
import android.view.inputmethod.EditorInfo
|
|
|
import android.view.inputmethod.InputMethodManager
|
|
|
import android.widget.Toast
|
|
|
+import androidx.activity.OnBackPressedCallback
|
|
|
import androidx.appcompat.app.AlertDialog
|
|
|
import androidx.appcompat.widget.SearchView
|
|
|
import androidx.core.view.MenuItemCompat
|
|
@@ -143,6 +146,12 @@ class ConversationsListActivity :
|
|
|
|
|
|
private lateinit var binding: ControllerConversationsRvBinding
|
|
|
|
|
|
+ private val callback = object : OnBackPressedCallback(true) {
|
|
|
+ override fun handleOnBackPressed() {
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Inject
|
|
|
lateinit var userManager: UserManager
|
|
|
|
|
@@ -244,7 +253,7 @@ class ConversationsListActivity :
|
|
|
private fun setupActionBar() {
|
|
|
setSupportActionBar(binding.conversationListToolbar)
|
|
|
binding.conversationListToolbar.setNavigationOnClickListener {
|
|
|
- onBackPressed()
|
|
|
+ onBackPressedDispatcher.addCallback(this, callback)
|
|
|
}
|
|
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
|
|
supportActionBar?.setDisplayShowHomeEnabled(true)
|
|
@@ -1358,13 +1367,24 @@ class ConversationsListActivity :
|
|
|
showErrorDialog()
|
|
|
}
|
|
|
|
|
|
+
|
|
|
override fun onBackPressed() {
|
|
|
- super.onBackPressed()
|
|
|
+ val callback = object : OnBackPressedCallback(true) {
|
|
|
+ override fun handleOnBackPressed() {
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ onBackPressedDispatcher.addCallback(this, callback)
|
|
|
+
|
|
|
+ // TODO: replace this when conductor is removed. For now it avoids loading the MainActivity which has no UI.
|
|
|
+ callback.isEnabled = true
|
|
|
+ callback.handleOnBackPressed()
|
|
|
|
|
|
- // TODO: replace this when conductor is removed. For now it avoids to load the MainActiviy which has no UI.
|
|
|
finishAffinity()
|
|
|
}
|
|
|
|
|
|
+
|
|
|
companion object {
|
|
|
const val TAG = "ConvListController"
|
|
|
const val UNREAD_BUBBLE_DELAY = 2500
|