UI changes when you have left a chat room

This commit is contained in:
Sylvain Berfini 2021-08-27 14:24:52 +02:00
parent 7791050039
commit 23c6171ca5
5 changed files with 24 additions and 10 deletions

View file

@ -229,6 +229,10 @@ class ChatMessagesListAdapter(
popupView.addToContactsHidden = true
totalSize -= itemSize
}
if (chatMessage.chatRoom.hasBeenLeft()) {
popupView.replyHidden = true
totalSize -= itemSize
}
// When using WRAP_CONTENT instead of real size, fails to place the
// popup window above if not enough space is available below

View file

@ -45,6 +45,13 @@ class EventData(private val eventLog: EventLog) : GenericContactData(
}
}
val isGroupLeft: Boolean by lazy {
when (eventLog.type) {
EventLog.Type.ConferenceTerminated -> true
else -> false
}
}
init {
updateEventText()
}

View file

@ -42,7 +42,7 @@
android:layout_marginBottom="5dp"
android:layout_toLeftOf="@id/select"
android:gravity="center"
android:background="@{data.security ? @drawable/event_decoration_red : @drawable/event_decoration_gray, default=@drawable/event_decoration_gray}"
android:background="@{data.security || data.groupLeft ? @drawable/event_decoration_red : @drawable/event_decoration_gray, default=@drawable/event_decoration_gray}"
android:orientation="horizontal">
<!-- Ugly hack to prevent last character to be missing half of it, don't know why yet -->
@ -52,7 +52,7 @@
android:fontFamily="sans-serif"
android:lineSpacingExtra="0sp"
android:textStyle="italic"
android:textColor="@{data.security ? @color/red_color : @color/light_grey_color}"
android:textColor="@{data.security || data.groupLeft ? @color/red_color : @color/light_grey_color}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="5dp"

View file

@ -36,6 +36,9 @@
<variable
name="addToContactsHidden"
type="Boolean" />
<variable
name="replyHidden"
type="Boolean" />
</data>
<LinearLayout
@ -79,6 +82,7 @@
android:background="@drawable/menu_background"
android:onClick="@{replyClickListener}"
android:drawableRight="@drawable/menu_reply"
android:visibility="@{replyHidden ? View.GONE : View.VISIBLE}"
style="@style/popup_item_font"
android:text="@string/chat_message_context_menu_reply" />

View file

@ -110,7 +110,7 @@
<ImageView
android:id="@+id/menu"
android:visibility="@{viewModel.basicChatRoom ? View.GONE : View.VISIBLE}"
android:visibility="@{viewModel.basicChatRoom || chatSendingViewModel.isReadOnly ? View.GONE : View.VISIBLE}"
android:onClick="@{menuClickListener}"
android:contentDescription="@string/content_description_show_chat_room_menu"
android:layout_width="0dp"
@ -122,7 +122,7 @@
<ImageView
android:onClick="@{editClickListener}"
android:visibility="@{viewModel.basicChatRoom ? View.VISIBLE : View.GONE}"
android:visibility="@{viewModel.basicChatRoom || chatSendingViewModel.isReadOnly ? View.VISIBLE : View.GONE}"
android:contentDescription="@string/content_description_enter_edition_mode"
android:layout_width="0dp"
android:layout_height="match_parent"
@ -184,13 +184,14 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="@{chatSendingViewModel.isReadOnly ? View.GONE : View.VISIBLE}"
android:gravity="center_vertical"
android:background="?attr/lightToolbarBackgroundColor"
android:orientation="horizontal">
<ImageView
android:onClick="@{attachFileClickListener}"
android:enabled="@{chatSendingViewModel.attachFileEnabled &amp;&amp; !chatSendingViewModel.isReadOnly}"
android:enabled="@{chatSendingViewModel.attachFileEnabled}"
android:contentDescription="@string/content_description_attach_file"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -201,7 +202,6 @@
android:id="@+id/voice_record"
android:onTouch="@{voiceRecordingTouchListener}"
android:onClick="@{() -> chatSendingViewModel.toggleVoiceRecording()}"
android:enabled="@{!chatSendingViewModel.isReadOnly}"
android:selected="@{chatSendingViewModel.isVoiceRecording}"
android:contentDescription="@string/content_description_voice_recording"
android:layout_width="wrap_content"
@ -213,7 +213,6 @@
<org.linphone.activities.main.chat.views.RichEditText
android:id="@+id/message"
android:enabled="@{!chatSendingViewModel.isReadOnly}"
android:text="@={chatSendingViewModel.textToSend}"
android:hint="@{chatSendingViewModel.isPendingAnswer ? @string/chat_room_sending_reply_hint : @string/chat_room_sending_message_hint}"
android:layout_width="0dp"
@ -237,7 +236,7 @@
<ImageView
android:id="@+id/send_message"
android:onClick="@{() -> chatSendingViewModel.sendMessage()}"
android:enabled="@{chatSendingViewModel.sendMessageEnabled &amp;&amp; !chatSendingViewModel.isReadOnly}"
android:enabled="@{chatSendingViewModel.sendMessageEnabled}"
android:contentDescription="@string/content_description_send_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -246,7 +245,7 @@
<ImageView
android:visibility="@{viewModel.chatRoom.ephemeralEnabled() ? View.VISIBLE : View.GONE, default=gone}"
android:enabled="@{chatSendingViewModel.sendMessageEnabled &amp;&amp; !chatSendingViewModel.isReadOnly}"
android:enabled="@{chatSendingViewModel.sendMessageEnabled}"
android:contentDescription="@string/content_description_ephemeral_message"
android:clickable="false"
android:layout_width="20dp"
@ -266,7 +265,7 @@
<TextView
android:id="@+id/remote_composing"
android:text="@{viewModel.composingList, default=@string/chat_remote_is_composing}"
android:visibility="@{viewModel.remoteIsComposing ? View.VISIBLE : View.INVISIBLE}"
android:visibility="@{viewModel.remoteIsComposing ? View.VISIBLE : chatSendingViewModel.isReadOnly ? View.GONE : View.INVISIBLE}"
android:layout_marginLeft="5dp"
style="@style/standard_small_text_font"
android:layout_width="match_parent"