File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
app/src/main/kotlin/org/fossify/phone/activities Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -108,18 +108,21 @@ class CallActivity : SimpleActivity() {
108108 }
109109 }
110110
111- override fun onBackPressed () {
111+ override fun onBackPressedCompat (): Boolean {
112112 if (binding.dialpadWrapper.isVisible()) {
113113 hideDialpad()
114- return
115- } else {
116- super .onBackPressed()
114+ return true
117115 }
118116
119117 val callState = CallManager .getState()
120118 if (callState == Call .STATE_CONNECTING || callState == Call .STATE_DIALING ) {
121119 toast(R .string.call_is_being_connected)
120+ // Allow user to go back but show toast - they can return to call via notification
121+ return false
122122 }
123+
124+ // Allow minimizing active call - user can return via notification
125+ return false
123126 }
124127
125128 private fun initButtons () = binding.apply {
Original file line number Diff line number Diff line change @@ -174,11 +174,12 @@ class MainActivity : SimpleActivity() {
174174 refreshItems()
175175 }
176176
177- override fun onBackPressed () {
178- if (binding.mainMenu.isSearchOpen) {
177+ override fun onBackPressedCompat (): Boolean {
178+ return if (binding.mainMenu.isSearchOpen) {
179179 binding.mainMenu.closeSearch()
180+ true
180181 } else {
181- super .onBackPressed()
182+ false
182183 }
183184 }
184185
You can’t perform that action at this time.
0 commit comments