Using contextClickListener to open bottom sheets/menus when mouse right button is clicked

This commit is contained in:
Sylvain Berfini 2025-06-17 14:18:03 +02:00
parent 4b631a19ef
commit 9ba2684f31
13 changed files with 39 additions and 4 deletions

View file

@ -14,15 +14,20 @@ Group changes to describe their impact on the project, as follows:
### Added
- 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
- Added toggle speaker action in active call notification
- Added back increased text size for chat messages that only contains emoji(s)
- Increased text size for chat messages that only contains emoji(s)
- Dedicated top bar when file(s) or text is waiting to be shared
- New settings:
- one for user to choose whether to sort contacts by first name or last name
- one to hide contacts that have neither a SIP address nor a phone number
- one to let app auto-answer call with video sending already enabled
- Added a vu meter for recording & playback volumes (disabled by default, must be enabled in CorePreferences)
- Added a setting for user to choose whether to sort contacts by first name or last name
- Added a setting to hide contacts that have neither a SIP address nor a phone number
- Added a setting to let app auto-answer call with video sending already enabled
### Changed
- 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
- Split alert top bar in two to be able to see both alerts and ongoing call(s)
- Reworked some settings (moved calls related ones from advanced settings to advanced calls settings)
## [6.0.9] - 2025-06-06

View file

@ -222,6 +222,25 @@ fun View.setKeyboardInsetListener(lambda: (visible: Boolean) -> Unit) {
}
}
@UiThread
@BindingAdapter("android:onContextClick")
fun View.setContextListener(longClickListener: View.OnLongClickListener?) {
longClickListener ?: return
this.setOnContextClickListener {
longClickListener.onLongClick(this)
}
}
@UiThread
@BindingAdapter("android:onContextClick")
fun View.setContextListener(lambda: () -> Unit) {
this.setOnContextClickListener {
lambda.invoke()
true
}
}
@UiThread
@BindingAdapter("android:src")
fun ImageView.setSourceImageResource(resource: Int) {

View file

@ -19,6 +19,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:onClick="@{onClickListener}"
android:onLongClick="@{onLongClickListener}"
android:onContextClick="@{onLongClickListener}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"

View file

@ -19,6 +19,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:onClick="@{onClickListener}"
android:onLongClick="@{onLongClickListener}"
android:onContextClick="@{onLongClickListener}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"

View file

@ -157,6 +157,7 @@
<LinearLayout
android:id="@+id/bubble"
android:onLongClick="@{onLongClickListener}"
android:onContextClick="@{onLongClickListener}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@{model.isFromGroup ? @dimen/chat_bubble_start_margin_when_avatar_displayed : @dimen/zero, default=@dimen/chat_bubble_start_margin_when_avatar_displayed}"

View file

@ -129,6 +129,7 @@
<LinearLayout
android:id="@+id/bubble"
android:onLongClick="@{onLongClickListener}"
android:onContextClick="@{onLongClickListener}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"

View file

@ -20,6 +20,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:onClick="@{onClickListener}"
android:onLongClickListener="@{onLongClickListener}"
android:onContextClick="@{onLongClickListener}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"

View file

@ -19,6 +19,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:onClick="@{onClickListener}"
android:onLongClick="@{onLongClickListener}"
android:onContextClick="@{onLongClickListener}"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"

View file

@ -22,6 +22,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:onClick="@{onClickListener}"
android:onLongClick="@{onLongClickListener}"
android:onContextClick="@{onLongClickListener}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"

View file

@ -13,6 +13,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:onClick="@{() -> model.onClicked()}"
android:onLongClick="@{() -> model.onLongPress()}"
android:onContextClick="@{() -> model.onLongPress()}"
android:selected="@{model.selected}"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -22,6 +22,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:onClick="@{onClickListener}"
android:onLongClickListener="@{onLongClickListener}"
android:onContextClick="@{onLongClickListener}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"

View file

@ -85,6 +85,7 @@
android:id="@+id/cardview"
android:onClick="@{onClickListener}"
android:onLongClick="@{onLongClickListener}"
android:onContextClick="@{onLongClickListener}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"

View file

@ -26,6 +26,7 @@
android:id="@+id/cardview"
android:onClick="@{onClickListener}"
android:onLongClick="@{onLongClickListener}"
android:onContextClick="@{onLongClickListener}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"