mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
Started conversation layout
This commit is contained in:
parent
a481b5c6cd
commit
c12ddf43a2
16 changed files with 532 additions and 93 deletions
|
|
@ -96,7 +96,7 @@ class ActiveCallFragment : GenericCallFragment() {
|
|||
// Holds fragment in place while new contact fragment slides over it
|
||||
return AnimationUtils.loadAnimation(activity, R.anim.hold)
|
||||
}
|
||||
return AnimationUtils.loadAnimation(activity, R.anim.hold)
|
||||
return super.onCreateAnimation(transit, enter, nextAnim)
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-android
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.ui.main.chat.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.ChatConversationFragmentBinding
|
||||
import org.linphone.ui.main.chat.viewmodel.ConversationViewModel
|
||||
import org.linphone.ui.main.fragment.GenericFragment
|
||||
import org.linphone.utils.Event
|
||||
|
||||
class ConversationFragment : GenericFragment() {
|
||||
companion object {
|
||||
private const val TAG = "[Conversation Fragment]"
|
||||
}
|
||||
|
||||
private lateinit var binding: ChatConversationFragmentBinding
|
||||
|
||||
private lateinit var viewModel: ConversationViewModel
|
||||
|
||||
private val args: ConversationFragmentArgs by navArgs()
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
binding = ChatConversationFragmentBinding.inflate(layoutInflater)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun goBack(): Boolean {
|
||||
sharedViewModel.closeSlidingPaneEvent.value = Event(true)
|
||||
// If not done, when going back to ConversationsFragment this fragment will be created again
|
||||
return findNavController().popBackStack()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
postponeEnterTransition()
|
||||
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
viewModel = ViewModelProvider(this)[ConversationViewModel::class.java]
|
||||
binding.viewModel = viewModel
|
||||
|
||||
val localSipUri = args.localSipUri
|
||||
val remoteSipUri = args.remoteSipUri
|
||||
Log.i(
|
||||
"$TAG Looking up for conversation with local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]"
|
||||
)
|
||||
viewModel.findChatRoom(localSipUri, remoteSipUri)
|
||||
|
||||
binding.setBackClickListener {
|
||||
goBack()
|
||||
}
|
||||
|
||||
viewModel.chatRoomFoundEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { found ->
|
||||
if (found) {
|
||||
Log.i(
|
||||
"$TAG Found matching chat room for local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]"
|
||||
)
|
||||
startPostponedEnterTransition()
|
||||
sharedViewModel.openSlidingPaneEvent.value = Event(true)
|
||||
} else {
|
||||
Log.e("$TAG Failed to find chat room, going back")
|
||||
goBack()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sharedViewModel.isSlidingPaneSlideable.observe(viewLifecycleOwner) { slideable ->
|
||||
viewModel.showBackButton.value = slideable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -101,6 +101,21 @@ class ConversationsFragment : GenericFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
sharedViewModel.showConversationEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { pair ->
|
||||
val localSipUri = pair.first
|
||||
val remoteSipUri = pair.second
|
||||
Log.i(
|
||||
"$TAG Navigating to conversation fragment with local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]"
|
||||
)
|
||||
val action = ConversationFragmentDirections.actionGlobalConversationFragment(
|
||||
localSipUri,
|
||||
remoteSipUri
|
||||
)
|
||||
binding.chatNavContainer.findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
|
||||
sharedViewModel.navigateToContactsEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
if (findNavController().currentDestination?.id == R.id.conversationsFragment) {
|
||||
|
|
|
|||
|
|
@ -65,10 +65,6 @@ class ConversationsListFragment : AbstractTopBarFragment() {
|
|||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
binding.viewModel = listViewModel
|
||||
|
||||
binding.setOnNewConversationClicked {
|
||||
// TODO: open start conversation fragment
|
||||
}
|
||||
|
||||
adapter = ConversationsListAdapter(viewLifecycleOwner)
|
||||
binding.conversationsList.setHasFixedSize(true)
|
||||
binding.conversationsList.adapter = adapter
|
||||
|
|
@ -113,7 +109,9 @@ class ConversationsListFragment : AbstractTopBarFragment() {
|
|||
adapter.conversationClickedEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { model ->
|
||||
Log.i("$TAG Show conversation with ID [${model.id}]")
|
||||
// TODO
|
||||
sharedViewModel.showConversationEvent.value = Event(
|
||||
Pair(model.localSipUri, model.remoteSipUri)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ class ConversationModel @WorkerThread constructor(private val chatRoom: ChatRoom
|
|||
|
||||
val id = LinphoneUtils.getChatRoomId(chatRoom)
|
||||
|
||||
val localSipUri = chatRoom.localAddress.asStringUriOnly()
|
||||
|
||||
val remoteSipUri = chatRoom.peerAddress.asStringUriOnly()
|
||||
|
||||
val isGroup = !chatRoom.hasCapability(Capabilities.OneToOne.toInt())
|
||||
|
||||
val lastUpdateTime = MutableLiveData<Long>()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-android
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.ui.main.chat.viewmodel
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.core.ChatRoom
|
||||
import org.linphone.core.Factory
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.ui.main.contacts.model.ContactAvatarModel
|
||||
import org.linphone.utils.Event
|
||||
|
||||
class ConversationViewModel @UiThread constructor() : ViewModel() {
|
||||
companion object {
|
||||
private const val TAG = "[Conversation ViewModel]"
|
||||
}
|
||||
|
||||
val showBackButton = MutableLiveData<Boolean>()
|
||||
|
||||
val avatarModel = MutableLiveData<ContactAvatarModel>()
|
||||
|
||||
val chatRoomFoundEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
private lateinit var chatRoom: ChatRoom
|
||||
|
||||
@UiThread
|
||||
fun findChatRoom(localSipUri: String, remoteSipUri: String) {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
Log.i(
|
||||
"$TAG Looking for chat room with local SIP URI [$localSipUri] and remote SIP URI [$remoteSipUri]"
|
||||
)
|
||||
|
||||
val localAddress = Factory.instance().createAddress(localSipUri)
|
||||
val remoteAddress = Factory.instance().createAddress(remoteSipUri)
|
||||
if (localAddress != null && remoteAddress != null) {
|
||||
val found = core.searchChatRoom(
|
||||
null,
|
||||
localAddress,
|
||||
remoteAddress,
|
||||
arrayOfNulls(
|
||||
0
|
||||
)
|
||||
)
|
||||
if (found != null) {
|
||||
chatRoom = found
|
||||
configureChatRoom()
|
||||
chatRoomFoundEvent.postValue(Event(true))
|
||||
} else {
|
||||
Log.e("Failed to find chat room given local & remote addresses!")
|
||||
chatRoomFoundEvent.postValue(Event(false))
|
||||
}
|
||||
} else {
|
||||
Log.e("Failed to parse local or remote SIP URI as Address!")
|
||||
chatRoomFoundEvent.postValue(Event(false))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun configureChatRoom() {
|
||||
val address = if (chatRoom.hasCapability(ChatRoom.Capabilities.Basic.toInt())) {
|
||||
chatRoom.peerAddress
|
||||
} else {
|
||||
val firstParticipant = chatRoom.participants.firstOrNull()
|
||||
firstParticipant?.address ?: chatRoom.peerAddress
|
||||
}
|
||||
|
||||
val friend = coreContext.contactsManager.findContactByAddress(address)
|
||||
if (friend != null) {
|
||||
avatarModel.postValue(ContactAvatarModel(friend))
|
||||
} else {
|
||||
val fakeFriend = coreContext.core.createFriend()
|
||||
fakeFriend.address = address
|
||||
avatarModel.postValue(ContactAvatarModel(fakeFriend))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ class HistoryFragment : GenericFragment() {
|
|||
// Holds fragment in place while new contact fragment slides over it
|
||||
return AnimationUtils.loadAnimation(activity, R.anim.hold)
|
||||
}
|
||||
return AnimationUtils.loadAnimation(activity, R.anim.hold)
|
||||
return super.onCreateAnimation(transit, enter, nextAnim)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
|
|
|||
|
|
@ -100,4 +100,8 @@ class SharedMainViewModel @UiThread constructor() : ViewModel() {
|
|||
val showStartConversationEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
val showConversationEvent: MutableLiveData<Event<Pair<String, String>>> by lazy {
|
||||
MutableLiveData<Event<Pair<String, String>>>()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
9
app/src/main/res/drawable/paperclip.xml
Normal file
9
app/src/main/res/drawable/paperclip.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="256"
|
||||
android:viewportHeight="256">
|
||||
<path
|
||||
android:pathData="M209.66,122.34a8,8 0,0 1,0 11.32l-82.05,82a56,56 0,0 1,-79.2 -79.21L147.67,35.73a40,40 0,1 1,56.61 56.55L105,193A24,24 0,1 1,71 159L154.3,74.38A8,8 0,1 1,165.7 85.6L82.39,170.31a8,8 0,1 0,11.27 11.36L192.93,81A24,24 0,1 0,159 47L59.76,147.68a40,40 0,1 0,56.53 56.62l82.06,-82A8,8 0,0 1,209.66 122.34Z"
|
||||
android:fillColor="#4e6074"/>
|
||||
</vector>
|
||||
|
|
@ -6,37 +6,27 @@
|
|||
<import type="android.view.View" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<androidx.slidingpanelayout.widget.SlidingPaneLayout
|
||||
android:id="@+id/sliding_pane_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.slidingpanelayout.widget.SlidingPaneLayout
|
||||
android:id="@+id/sliding_pane_layout"
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/conversations_list"
|
||||
android:name="org.linphone.ui.main.chat.fragment.ConversationsListFragment"
|
||||
android:layout_width="@dimen/sliding_pane_left_fragment_with_nav_width"
|
||||
android:layout_height="match_parent"
|
||||
app:layout="@layout/chat_list_fragment"/>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/chat_nav_container"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
app:defaultNavHost="false"
|
||||
app:navGraph="@navigation/chat_nav_graph"/>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/conversations_list"
|
||||
android:name="org.linphone.ui.main.chat.fragment.ConversationsListFragment"
|
||||
android:layout_width="@dimen/sliding_pane_left_fragment_with_nav_width"
|
||||
android:layout_height="match_parent"
|
||||
app:layout="@layout/chat_list_fragment"/>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/chat_nav_container"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
app:defaultNavHost="false"
|
||||
app:navGraph="@navigation/chat_nav_graph"/>
|
||||
|
||||
</androidx.slidingpanelayout.widget.SlidingPaneLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.slidingpanelayout.widget.SlidingPaneLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -6,37 +6,27 @@
|
|||
<import type="android.view.View" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<androidx.slidingpanelayout.widget.SlidingPaneLayout
|
||||
android:id="@+id/sliding_pane_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.slidingpanelayout.widget.SlidingPaneLayout
|
||||
android:id="@+id/sliding_pane_layout"
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/contacts_list"
|
||||
android:name="org.linphone.ui.main.contacts.fragment.ContactsListFragment"
|
||||
android:layout_width="@dimen/sliding_pane_left_fragment_with_nav_width"
|
||||
android:layout_height="match_parent"
|
||||
app:layout="@layout/contacts_list_fragment"/>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/contacts_nav_container"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
app:defaultNavHost="false"
|
||||
app:navGraph="@navigation/contacts_nav_graph"/>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/contacts_list"
|
||||
android:name="org.linphone.ui.main.contacts.fragment.ContactsListFragment"
|
||||
android:layout_width="@dimen/sliding_pane_left_fragment_with_nav_width"
|
||||
android:layout_height="match_parent"
|
||||
app:layout="@layout/contacts_list_fragment"/>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/contacts_nav_container"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
app:defaultNavHost="false"
|
||||
app:navGraph="@navigation/contacts_nav_graph"/>
|
||||
|
||||
</androidx.slidingpanelayout.widget.SlidingPaneLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.slidingpanelayout.widget.SlidingPaneLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -6,37 +6,27 @@
|
|||
<import type="android.view.View" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<androidx.slidingpanelayout.widget.SlidingPaneLayout
|
||||
android:id="@+id/sliding_pane_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.slidingpanelayout.widget.SlidingPaneLayout
|
||||
android:id="@+id/sliding_pane_layout"
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/history"
|
||||
android:name="org.linphone.ui.main.history.fragment.HistoryListFragment"
|
||||
android:layout_width="@dimen/sliding_pane_left_fragment_with_nav_width"
|
||||
android:layout_height="match_parent"
|
||||
app:layout="@layout/history_list_fragment"/>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/history_nav_container"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
app:defaultNavHost="false"
|
||||
app:navGraph="@navigation/history_nav_graph"/>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/history"
|
||||
android:name="org.linphone.ui.main.history.fragment.HistoryListFragment"
|
||||
android:layout_width="@dimen/sliding_pane_left_fragment_with_nav_width"
|
||||
android:layout_height="match_parent"
|
||||
app:layout="@layout/history_list_fragment"/>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/history_nav_container"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
app:defaultNavHost="false"
|
||||
app:navGraph="@navigation/history_nav_graph"/>
|
||||
|
||||
</androidx.slidingpanelayout.widget.SlidingPaneLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.slidingpanelayout.widget.SlidingPaneLayout>
|
||||
|
||||
</layout>
|
||||
228
app/src/main/res/layout/chat_conversation_fragment.xml
Normal file
228
app/src/main/res/layout/chat_conversation_fragment.xml
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<import type="org.linphone.core.ConsolidatedPresence" />
|
||||
<import type="org.linphone.core.ChatRoom.SecurityLevel" />
|
||||
<variable
|
||||
name="backClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="pickEmojiClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="attachFileClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="recordVoiceMessageClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.chat.viewmodel.ConversationViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:padding="15dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:onClick="@{backClickListener}"
|
||||
android:visibility="@{viewModel.showBackButton ? View.VISIBLE : View.GONE}"
|
||||
android:src="@drawable/caret_left"
|
||||
app:tint="@color/orange_main_500"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/title"/>
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_list_cell_size"
|
||||
android:layout_height="@dimen/avatar_list_cell_size"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/shape_circle_light_blue_background"
|
||||
contactAvatar="@{viewModel.avatarModel}"
|
||||
app:avatarViewPlaceholder="@drawable/user_circle"
|
||||
app:avatarViewInitialsBackgroundColor="@color/gray_main2_200"
|
||||
app:avatarViewInitialsTextColor="@color/gray_main2_600"
|
||||
app:avatarViewInitialsTextSize="16sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewShape="circle"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/back"
|
||||
app:layout_constraintStart_toEndOf="@id/back"
|
||||
app:layout_constraintTop_toTopOf="@id/back" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/trust_badge"
|
||||
android:layout_width="@dimen/avatar_presence_badge_size"
|
||||
android:layout_height="@dimen/avatar_presence_badge_size"
|
||||
android:src="@{viewModel.avatarModel.trust == SecurityLevel.Encrypted ? @drawable/trusted : @drawable/not_trusted, default=@drawable/trusted}"
|
||||
android:visibility="@{viewModel.avatarModel.trust == SecurityLevel.Encrypted || viewModel.avatarModel.trust == SecurityLevel.Unsafe ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintBottom_toBottomOf="@id/avatar"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/top_bar_height"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:text="@{viewModel.avatarModel.name, default=`John Doe`}"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/gray_main2_600"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintEnd_toStartOf="@id/call"
|
||||
app:layout_constraintStart_toEndOf="@id/avatar"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/info"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@drawable/info"
|
||||
app:layout_constraintTop_toTopOf="@id/title"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/video_call"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@drawable/video_camera"
|
||||
app:layout_constraintTop_toTopOf="@id/title"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintEnd_toStartOf="@id/info" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/call"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@drawable/phone"
|
||||
app:layout_constraintTop_toTopOf="@id/title"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintEnd_toStartOf="@id/video_call"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
app:layout_constraintBottom_toTopOf="@id/composing" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_300"
|
||||
android:id="@+id/composing"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/gray_main2_400"
|
||||
app:layout_constraintBottom_toTopOf="@id/send_area_background"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/send_area_background"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:background="@color/gray_100"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message_area_background"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/message_area_background" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/emoji_picker"
|
||||
android:onClick="@{pickEmojiClickListener}"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_marginStart="16dp"
|
||||
android:src="@drawable/smiley"
|
||||
app:layout_constraintTop_toTopOf="@id/message_area_background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message_area_background"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/attach_file"
|
||||
android:onClick="@{attachFileClickListener}"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@drawable/paperclip"
|
||||
app:layout_constraintTop_toTopOf="@id/message_area_background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message_area_background"
|
||||
app:layout_constraintStart_toEndOf="@id/emoji_picker"
|
||||
app:layout_constraintEnd_toStartOf="@id/message_area_background"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/message_area_background"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@drawable/edit_text_background"
|
||||
app:layout_constraintStart_toEndOf="@id/attach_file"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/message_to_send"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:background="@color/transparent_color"
|
||||
android:textSize="14sp"
|
||||
android:textColorHint="@color/gray_main2_400"
|
||||
android:hint="@string/conversation_text_field_hint"
|
||||
app:layout_constraintTop_toTopOf="@id/message_area_background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message_area_background"
|
||||
app:layout_constraintStart_toStartOf="@id/message_area_background"
|
||||
app:layout_constraintEnd_toStartOf="@id/voice_record" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/voice_record"
|
||||
android:onClick="@{recordVoiceMessageClickListener}"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:src="@drawable/microphone"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toTopOf="@id/message_area_background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message_area_background"
|
||||
app:layout_constraintEnd_toEndOf="@id/message_area_background" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/send_message"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:src="@drawable/paper_plane_tilt"
|
||||
app:tint="@color/orange_main_500"
|
||||
app:layout_constraintTop_toTopOf="@id/message_area_background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message_area_background"
|
||||
app:layout_constraintEnd_toEndOf="@id/message_area_background" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -118,7 +118,7 @@
|
|||
android:id="@+id/notifications_count"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/shape_red_round"
|
||||
android:text="@{String.valueOf(model.unreadMessageCount), default=`1`}"
|
||||
|
|
|
|||
|
|
@ -12,8 +12,21 @@
|
|||
tools:layout="@layout/empty_fragment"/>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/conversationsListFragment"
|
||||
android:name="org.linphone.ui.main.chat.fragment.ConversationsListFragment"
|
||||
android:label="ConversationsListFragment"
|
||||
tools:layout="@layout/chat_list_fragment"/>
|
||||
android:id="@+id/conversationFragment"
|
||||
android:name="org.linphone.ui.main.chat.fragment.ConversationFragment"
|
||||
android:label="ConversationFragment"
|
||||
tools:layout="@layout/chat_conversation_fragment">
|
||||
<argument
|
||||
android:name="localSipUri"
|
||||
app:argType="string" />
|
||||
<argument
|
||||
android:name="remoteSipUri"
|
||||
app:argType="string" />
|
||||
</fragment>
|
||||
|
||||
<action
|
||||
android:id="@+id/action_global_conversationFragment"
|
||||
app:destination="@id/conversationFragment"
|
||||
app:launchSingleTop="true" />
|
||||
|
||||
</navigation>
|
||||
|
|
@ -329,6 +329,7 @@
|
|||
<string name="new_conversation_search_bar_filter_hint">Search contact</string>
|
||||
<string name="new_conversation_create_group">Create a group conversation</string>
|
||||
<string name="new_conversation_no_contact">No contact for the moment…</string>
|
||||
<string name="conversation_text_field_hint">Say something…</string>
|
||||
|
||||
<string name="operation_in_progress_overlay">Operation in progress, please wait</string>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue