From e173e402c297c35868709c1c39cc323e66211c1d Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 3 Dec 2025 10:27:21 +0100 Subject: [PATCH] Added answer/decline keyboard shortcuts to CallActivity --- CHANGELOG.md | 6 +++ .../java/org/linphone/ui/call/CallActivity.kt | 51 ++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0c565cb4..69119f8aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Group changes to describe their impact on the project, as follows: ### Added - Added the ability to edit/delete chat messages sent less than 24 hours ago. +- Added keyboard shortcuts on IncomingCallFragment: Ctrl + Shift + A to answer the call, Ctrl + Shift + D to decline it - Added PDF preview in conversation (message bubble & documents list) - Added hover effect when using a mouse (useful for tablets or devices with desktop mode) - Support right click on some items to open bottom sheet/menu @@ -35,6 +36,7 @@ Group changes to describe their impact on the project, as follows: - Removing an account will also remove all related data in the local database (auth info, call logs, conversations, meetings, etc...) - Hide SIP address/phone number picker dialog if contact has exactly one SIP address matching both the app default domain & the currently selected account domain - Improved UI on tablets with screen sw600dp and higher, will look more like our desktop app +- Improved navigation within app when using a keyboard - Now loading media/documents contents in conversation by chunks (instead of all of them at once) - Simplified audio device name in settings - Reworked some settings (moved calls related ones from advanced settings to advanced calls settings) @@ -43,6 +45,10 @@ Group changes to describe their impact on the project, as follows: - Made numpad buttons larger by changing their shape - All LDAP fields are mandatory now - Permission fragment will only show missing ones +- Added more info into StartupListener logs + +### Fixed +- No audio focus & wrong audio manager mode when TelecomManager isn't supported by device ## [6.0.20] - 2025-11-21 diff --git a/app/src/main/java/org/linphone/ui/call/CallActivity.kt b/app/src/main/java/org/linphone/ui/call/CallActivity.kt index 4a0ff2b28..3dc732406 100644 --- a/app/src/main/java/org/linphone/ui/call/CallActivity.kt +++ b/app/src/main/java/org/linphone/ui/call/CallActivity.kt @@ -25,6 +25,10 @@ import android.content.pm.PackageManager import android.content.res.Resources import android.graphics.Color import android.os.Bundle +import android.view.KeyEvent +import android.view.KeyboardShortcutGroup +import android.view.KeyboardShortcutInfo +import android.view.Menu import androidx.activity.SystemBarStyle import androidx.activity.enableEdgeToEdge import androidx.activity.result.contract.ActivityResultContracts @@ -66,6 +70,7 @@ import org.linphone.ui.call.viewmodel.CallsViewModel import org.linphone.ui.call.viewmodel.CurrentCallViewModel import org.linphone.ui.call.viewmodel.SharedCallViewModel import org.linphone.ui.main.MainActivity +import org.linphone.utils.AppUtils @UiThread class CallActivity : GenericActivity() { @@ -408,7 +413,51 @@ class CallActivity : GenericActivity() { } } - @UiThread + override fun onProvideKeyboardShortcuts( + data: MutableList?, + menu: Menu?, + deviceId: Int + ) { + super.onProvideKeyboardShortcuts(data, menu, deviceId) + + val keyboardShortcutGroup = KeyboardShortcutGroup( + "Answer/Decline incoming call", + listOf( + KeyboardShortcutInfo( + AppUtils.getString(R.string.call_action_answer), + KeyEvent.KEYCODE_A, + KeyEvent.META_CTRL_ON or KeyEvent.META_SHIFT_ON + ), + KeyboardShortcutInfo( + AppUtils.getString(R.string.call_action_decline), + KeyEvent.KEYCODE_D, + KeyEvent.META_CTRL_ON or KeyEvent.META_SHIFT_ON + ) + ) + ) + data?.add(keyboardShortcutGroup) + Log.i("$TAG Incoming call answer/decline shortcuts added") + } + + override fun onKeyShortcut(keyCode: Int, event: KeyEvent?): Boolean { + if (event?.isCtrlPressed == true && event.isShiftPressed) { + val navController = findNavController(R.id.call_nav_container) + if (navController.currentDestination?.id == R.id.incomingCallFragment) { + when (keyCode) { + KeyEvent.KEYCODE_A -> { + Log.i("$TAG Answer incoming call shortcut triggered") + callViewModel.answer() + } + KeyEvent.KEYCODE_D -> { + Log.i("$TAG Decline incoming call shortcut triggered") + callViewModel.hangUp() + } + } + } + } + return true + } + fun goToMainActivity() { if (isPipSupported && callViewModel.isVideoEnabled.value == true) { Log.i("$TAG User is going back to MainActivity, try entering PiP mode")