Various UI fixes

This commit is contained in:
Sylvain Berfini 2024-02-20 17:50:31 +01:00
parent 780c2f55dc
commit 625edfe33a
9 changed files with 63 additions and 15 deletions

View file

@ -30,6 +30,7 @@ import org.linphone.core.ConferenceListenerStub
import org.linphone.core.MediaDirection
import org.linphone.core.Participant
import org.linphone.core.ParticipantDevice
import org.linphone.core.StreamType
import org.linphone.core.tools.Log
import org.linphone.utils.AppUtils
import org.linphone.utils.Event
@ -59,6 +60,8 @@ class ConferenceModel {
val conferenceLayout = MutableLiveData<Int>()
val isMeParticipantSendingVideo = MutableLiveData<Boolean>()
val showLayoutMenuEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
@ -82,6 +85,18 @@ class ConferenceModel {
removeParticipant(participant)
}
override fun onParticipantDeviceMediaCapabilityChanged(
conference: Conference,
device: ParticipantDevice
) {
if (conference.isMe(device.address)) {
val direction = device.getStreamCapability(StreamType.Video)
isMeParticipantSendingVideo.postValue(
direction == MediaDirection.SendRecv || direction == MediaDirection.SendOnly
)
}
}
@WorkerThread
override fun onActiveSpeakerParticipantDevice(
conference: Conference,
@ -337,6 +352,11 @@ class ConferenceModel {
activeSpeaker.postValue(model)
activeSpeakerParticipantDeviceFound = true
}
val direction = device.getStreamCapability(StreamType.Video)
isMeParticipantSendingVideo.postValue(
direction == MediaDirection.SendRecv || direction == MediaDirection.SendOnly
)
}
if (!activeSpeakerParticipantDeviceFound) {

View file

@ -811,7 +811,7 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
canBePaused.postValue(canCallBePaused())
val address = call.remoteAddress
displayedAddress.postValue(address.asStringUriOnly())
displayedAddress.postValue(LinphoneUtils.getAddressAsCleanStringUriOnly(address))
val conferenceInfo = coreContext.core.findConferenceInformationFromUri(address)
val model = if (conferenceInfo != null) {

View file

@ -383,11 +383,6 @@ class ConversationFragment : SlidingPaneChildFragment() {
} else {
sendMessageViewModel.configureChatRoom(viewModel.chatRoom)
if (viewModel.isEndToEndEncrypted.value == true) {
binding.eventsList.addItemDecoration(headerItemDecoration)
binding.eventsList.addOnItemTouchListener(listItemTouchListener)
}
// Wait for chat room to be ready before trying to forward a message in it
sharedViewModel.messageToForwardEvent.observe(viewLifecycleOwner) { event ->
event.consume { toForward ->
@ -416,6 +411,13 @@ class ConversationFragment : SlidingPaneChildFragment() {
}
}
viewModel.isEndToEndEncrypted.observe(viewLifecycleOwner) { encrypted ->
if (encrypted) {
binding.eventsList.addItemDecoration(headerItemDecoration)
binding.eventsList.addOnItemTouchListener(listItemTouchListener)
}
}
binding.messageBottomSheet.bottomSheetList.setHasFixedSize(true)
val bottomSheetLayoutManager = LinearLayoutManager(requireContext())
binding.messageBottomSheet.bottomSheetList.layoutManager = bottomSheetLayoutManager
@ -511,6 +513,10 @@ class ConversationFragment : SlidingPaneChildFragment() {
scrollToFirstUnreadMessageOrBottom()
}
binding.setEndToEndEncryptedEventClickListener {
showEndToEndEncryptionDetailsBottomSheet()
}
sendMessageViewModel.emojiToAddEvent.observe(viewLifecycleOwner) {
it.consume { emoji ->
binding.sendArea.messageToSend.addCharacterAtPosition(emoji)

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/gray_500" />
<item
android:color="@color/white"/>
</selector>

View file

@ -127,7 +127,7 @@
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:src="@drawable/camera_rotate"
android:visibility="@{!viewModel.fullScreenMode &amp;&amp; !viewModel.pipMode &amp;&amp; viewModel.isVideoEnabled &amp;&amp; viewModel.showSwitchCamera &amp;&amp; conferenceViewModel.participantDevices.size() > 1 ? View.VISIBLE : View.GONE}"
android:visibility="@{!viewModel.fullScreenMode &amp;&amp; !viewModel.pipMode &amp;&amp; viewModel.showSwitchCamera &amp;&amp; conferenceViewModel.participantDevices.size() > 1 &amp;&amp; conferenceViewModel.isMeParticipantSendingVideo ? View.VISIBLE : View.GONE}"
app:tint="@color/white"
app:layout_constraintTop_toTopOf="@id/conference_subject"
app:layout_constraintBottom_toBottomOf="@id/conference_subject"

View file

@ -23,6 +23,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/call_all_actions_menu_height"
android:background="@drawable/shape_call_bottom_sheet_background"
android:visibility="@{viewModel.fullScreenMode || viewModel.pipMode ? View.INVISIBLE : View.VISIBLE}"
app:behavior_hideable="false"
app:behavior_peekHeight="@dimen/call_main_actions_menu_height"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

View file

@ -32,14 +32,15 @@
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/conference_layout_grid"
android:textColor="@color/white"
android:textColor="@color/in_call_label_color"
android:gravity="center_vertical"
android:layout_marginBottom="1dp"
android:drawableEnd="@drawable/squares_four"
android:drawableTint="@color/white"
android:drawableTint="@color/in_call_label_color"
android:enabled="@{viewModel.participantDevices.size() &lt; 7, default=false}"
android:checked="@{viewModel.conferenceLayout == 0}"
app:useMaterialThemeColors="false"
app:buttonTint="@color/white"/>
app:buttonTint="@color/in_call_label_color"/>
<com.google.android.material.radiobutton.MaterialRadioButton
style="@style/context_menu_action_label_style"

View file

@ -25,6 +25,9 @@
<variable
name="scrollToBottomClickListener"
type="View.OnClickListener" />
<variable
name="endToEndEncryptedEventClickListener"
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.main.chat.viewmodel.ConversationViewModel" />
@ -248,6 +251,17 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/composing"/>
<include
android:id="@+id/secured_event"
android:onClick="@{endToEndEncryptedEventClickListener}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="@{viewModel.events.size() == 0 &amp;&amp; viewModel.isEndToEndEncrypted ? View.VISIBLE : View.GONE}"
layout="@layout/chat_conversation_secured_first_event"
app:layout_constraintTop_toTopOf="@id/events_list"
app:layout_constraintStart_toStartOf="@id/events_list"
app:layout_constraintEnd_toEndOf="@id/events_list" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_800"
android:id="@+id/no_result"

View file

@ -35,12 +35,12 @@
<androidx.appcompat.widget.AppCompatTextView
android:onClick="@{addToContactsListener}"
android:visibility="@{contactExists || isConferenceCallLog ? View.GONE : View.VISIBLE}"
android:visibility="@{contactExists || isConferenceCallLog ? View.GONE : View.VISIBLE, default=gone}"
style="@style/default_text_style"
android:id="@+id/add_to_contact"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/popup_menu_item_top_margin"
android:layout_marginBottom="@dimen/popup_menu_item_top_margin"
android:gravity="start|center_vertical"
android:text="@string/menu_add_address_to_contacts"
android:textSize="14sp"
@ -56,12 +56,12 @@
<androidx.appcompat.widget.AppCompatTextView
android:onClick="@{goToContactListener}"
android:visibility="@{contactExists ? View.VISIBLE : View.GONE}"
android:visibility="@{contactExists &amp;&amp; !isConferenceCallLog ? View.VISIBLE : View.GONE}"
style="@style/default_text_style"
android:id="@+id/go_to_contact"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/popup_menu_item_top_margin"
android:layout_marginBottom="@dimen/popup_menu_item_top_margin"
android:gravity="start|center_vertical"
android:text="@string/menu_see_existing_contact"
android:textSize="14sp"
@ -80,7 +80,6 @@
android:id="@+id/copy_number"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/popup_menu_item_top_margin"
android:gravity="start|center_vertical"
android:text="@string/menu_copy_sip_address"
android:textSize="14sp"