Disable some actions when a chat room has been left

This commit is contained in:
Sylvain Berfini 2023-02-15 10:03:28 +01:00
parent 375f43cfa5
commit 890d217ab7
6 changed files with 29 additions and 1 deletions

View file

@ -936,6 +936,10 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
LayoutInflater.from(context), LayoutInflater.from(context),
R.layout.chat_room_menu, null, false R.layout.chat_room_menu, null, false
) )
val readOnly = chatRoom.isReadOnly
popupView.ephemeralEnabled = !readOnly
popupView.devicesEnabled = !readOnly
popupView.meetingEnabled = !readOnly
val itemSize = AppUtils.getDimension(R.dimen.chat_room_popup_item_height).toInt() val itemSize = AppUtils.getDimension(R.dimen.chat_room_popup_item_height).toInt()
var totalSize = itemSize * 8 var totalSize = itemSize * 8

View file

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false">
<bitmap android:src="@drawable/menu_security_default"
android:tint="?attr/drawableTintDisabledColor"/>
</item>
<item> <item>
<bitmap android:src="@drawable/menu_security_default" <bitmap android:src="@drawable/menu_security_default"
android:tint="?attr/drawableTintColor"/> android:tint="?attr/drawableTintColor"/>

View file

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false">
<bitmap android:src="@drawable/menu_ephemeral_messages_default"
android:tint="?attr/drawableTintDisabledColor"/>
</item>
<item> <item>
<bitmap android:src="@drawable/menu_ephemeral_messages_default" <bitmap android:src="@drawable/menu_ephemeral_messages_default"
android:tint="?attr/drawableTintColor"/> android:tint="?attr/drawableTintColor"/>

View file

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false">
<bitmap android:src="@drawable/menu_meeting_schedule"
android:tint="?attr/drawableTintDisabledColor"/>
</item>
<item> <item>
<bitmap android:src="@drawable/menu_meeting_schedule" <bitmap android:src="@drawable/menu_meeting_schedule"
android:tint="?attr/drawableTintColor"/> android:tint="?attr/drawableTintColor"/>

View file

@ -122,7 +122,7 @@
android:layout_weight="0.2" android:layout_weight="0.2"
android:background="?attr/button_background_drawable" android:background="?attr/button_background_drawable"
android:padding="7dp" android:padding="7dp"
android:enabled="@{viewModel.groupCallAvailable}" android:enabled="@{viewModel.groupCallAvailable &amp;&amp; !chatSendingViewModel.isReadOnly}"
android:visibility="@{viewModel.oneToOneChatRoom ? View.GONE : View.VISIBLE}" android:visibility="@{viewModel.oneToOneChatRoom ? View.GONE : View.VISIBLE}"
android:src="@drawable/icon_video_conf_new" /> android:src="@drawable/icon_video_conf_new" />

View file

@ -55,6 +55,15 @@
<variable <variable
name="goToContactHidden" name="goToContactHidden"
type="Boolean" /> type="Boolean" />
<variable
name="devicesEnabled"
type="Boolean" />
<variable
name="ephemeralEnabled"
type="Boolean" />
<variable
name="meetingEnabled"
type="Boolean" />
</data> </data>
<LinearLayout <LinearLayout
@ -99,6 +108,7 @@
android:visibility="@{devicesHidden ? View.GONE : View.VISIBLE}" android:visibility="@{devicesHidden ? View.GONE : View.VISIBLE}"
android:background="@drawable/menu_background" android:background="@drawable/menu_background"
android:onClick="@{devicesListener}" android:onClick="@{devicesListener}"
android:enabled="@{devicesEnabled}"
style="@style/popup_item_font" style="@style/popup_item_font"
android:text="@string/chat_room_context_menu_participants_devices" android:text="@string/chat_room_context_menu_participants_devices"
app:drawableRightCompat="@drawable/chat_room_menu_devices" /> app:drawableRightCompat="@drawable/chat_room_menu_devices" />
@ -109,6 +119,7 @@
android:visibility="@{ephemeralHidden ? View.GONE : View.VISIBLE}" android:visibility="@{ephemeralHidden ? View.GONE : View.VISIBLE}"
android:background="@drawable/menu_background" android:background="@drawable/menu_background"
android:onClick="@{ephemeralListener}" android:onClick="@{ephemeralListener}"
android:enabled="@{ephemeralEnabled}"
style="@style/popup_item_font" style="@style/popup_item_font"
android:text="@string/chat_message_context_menu_ephemeral_messages" android:text="@string/chat_message_context_menu_ephemeral_messages"
app:drawableRightCompat="@drawable/chat_room_menu_ephemeral" /> app:drawableRightCompat="@drawable/chat_room_menu_ephemeral" />
@ -119,6 +130,7 @@
android:visibility="@{meetingHidden ? View.GONE : View.VISIBLE}" android:visibility="@{meetingHidden ? View.GONE : View.VISIBLE}"
android:background="@drawable/menu_background" android:background="@drawable/menu_background"
android:onClick="@{meetingListener}" android:onClick="@{meetingListener}"
android:enabled="@{meetingEnabled}"
style="@style/popup_item_font" style="@style/popup_item_font"
android:text="@string/conference_schedule_title" android:text="@string/conference_schedule_title"
app:drawableRightCompat="@drawable/chat_room_menu_meeting" /> app:drawableRightCompat="@drawable/chat_room_menu_meeting" />