mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-18 03:48:08 +00:00
Started new chat room fragment
This commit is contained in:
parent
95baa55472
commit
797418ce1a
9 changed files with 575 additions and 3 deletions
|
|
@ -48,10 +48,14 @@ class QrCodeViewModel @UiThread constructor() : ViewModel() {
|
|||
if (!isValidUrl) {
|
||||
Log.e("$TAG The content of the QR Code doesn't seem to be a valid web URL")
|
||||
} else {
|
||||
Log.i("$TAG QR code URL set, restarting the Core")
|
||||
Log.i(
|
||||
"$TAG QR code URL set, restarting the Core to apply configuration changes"
|
||||
)
|
||||
core.provisioningUri = result
|
||||
coreContext.core.stop()
|
||||
Log.i("$TAG Core has been stopped, restarting it")
|
||||
coreContext.core.start()
|
||||
Log.i("$TAG Core has been restarted")
|
||||
}
|
||||
qrCodeFoundEvent.postValue(Event(isValidUrl))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import androidx.core.view.doOnPreDraw
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
|
|
@ -51,10 +52,10 @@ class ConversationsFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
override fun onCreateAnimation(transit: Int, enter: Boolean, nextAnim: Int): Animation? {
|
||||
/*if (findNavController().currentDestination?.id == R.id.newConversationFragment) {
|
||||
if (findNavController().currentDestination?.id == R.id.startConversationFragment) {
|
||||
// Holds fragment in place while new contact fragment slides over it
|
||||
return AnimationUtils.loadAnimation(activity, R.anim.hold)
|
||||
}*/
|
||||
}
|
||||
return super.onCreateAnimation(transit, enter, nextAnim)
|
||||
}
|
||||
|
||||
|
|
@ -93,6 +94,13 @@ class ConversationsFragment : GenericFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
sharedViewModel.showStartConversationEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
Log.i("$TAG Navigating to start conversation fragment")
|
||||
findNavController().navigate(R.id.action_global_startConversationFragment)
|
||||
}
|
||||
}
|
||||
|
||||
sharedViewModel.navigateToContactsEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
if (findNavController().currentDestination?.id == R.id.conversationsFragment) {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.linphone.ui.main.chat.adapter.ConversationsListAdapter
|
|||
import org.linphone.ui.main.chat.viewmodel.ConversationsListViewModel
|
||||
import org.linphone.ui.main.fragment.AbstractTopBarFragment
|
||||
import org.linphone.ui.main.history.fragment.HistoryMenuDialogFragment
|
||||
import org.linphone.utils.Event
|
||||
import org.linphone.utils.hideKeyboard
|
||||
import org.linphone.utils.showKeyboard
|
||||
|
||||
|
|
@ -112,9 +113,14 @@ class ConversationsListFragment : AbstractTopBarFragment() {
|
|||
adapter.conversationClickedEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { model ->
|
||||
Log.i("$TAG Show conversation with ID [${model.id}]")
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
binding.setOnNewConversationClicked {
|
||||
sharedViewModel.showStartConversationEvent.value = Event(true)
|
||||
}
|
||||
|
||||
listViewModel.conversations.observe(viewLifecycleOwner) {
|
||||
val currentCount = adapter.itemCount
|
||||
adapter.submitList(it)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
* 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.app.Dialog
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.core.view.doOnPreDraw
|
||||
import androidx.navigation.navGraphViewModels
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.R
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.StartChatFragmentBinding
|
||||
import org.linphone.ui.main.chat.viewmodel.StartConversationViewModel
|
||||
import org.linphone.ui.main.contacts.model.ContactNumberOrAddressClickListener
|
||||
import org.linphone.ui.main.contacts.model.ContactNumberOrAddressModel
|
||||
import org.linphone.ui.main.fragment.GenericFragment
|
||||
import org.linphone.ui.main.history.adapter.ContactsAndSuggestionsListAdapter
|
||||
|
||||
@UiThread
|
||||
class StartConversationFragment : GenericFragment() {
|
||||
companion object {
|
||||
private const val TAG = "[Start Conversation Fragment]"
|
||||
}
|
||||
|
||||
private lateinit var binding: StartChatFragmentBinding
|
||||
|
||||
private val viewModel: StartConversationViewModel by navGraphViewModels(
|
||||
R.id.main_nav_graph
|
||||
)
|
||||
|
||||
private lateinit var adapter: ContactsAndSuggestionsListAdapter
|
||||
|
||||
private val listener = object : ContactNumberOrAddressClickListener {
|
||||
@UiThread
|
||||
override fun onClicked(model: ContactNumberOrAddressModel) {
|
||||
val address = model.address
|
||||
if (address != null) {
|
||||
coreContext.postOnCoreThread {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
override fun onLongPress(model: ContactNumberOrAddressModel) {
|
||||
}
|
||||
}
|
||||
|
||||
private var numberOrAddressPickerDialog: Dialog? = null
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
binding = StartChatFragmentBinding.inflate(layoutInflater)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
postponeEnterTransition()
|
||||
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
binding.viewModel = viewModel
|
||||
|
||||
binding.setBackClickListener {
|
||||
goBack()
|
||||
}
|
||||
|
||||
adapter = ContactsAndSuggestionsListAdapter(viewLifecycleOwner)
|
||||
binding.contactsList.setHasFixedSize(true)
|
||||
binding.contactsList.adapter = adapter
|
||||
|
||||
adapter.contactClickedEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { model ->
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
binding.contactsList.layoutManager = LinearLayoutManager(requireContext())
|
||||
|
||||
viewModel.contactsList.observe(
|
||||
viewLifecycleOwner
|
||||
) {
|
||||
Log.i("$TAG Contacts & suggestions list is ready with [${it.size}] items")
|
||||
val count = adapter.itemCount
|
||||
adapter.submitList(it)
|
||||
|
||||
if (count == 0 && it.isNotEmpty()) {
|
||||
(view.parent as? ViewGroup)?.doOnPreDraw {
|
||||
startPostponedEnterTransition()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.searchFilter.observe(viewLifecycleOwner) { filter ->
|
||||
val trimmed = filter.trim()
|
||||
viewModel.applyFilter(trimmed)
|
||||
}
|
||||
|
||||
sharedViewModel.defaultAccountChangedEvent.observe(viewLifecycleOwner) {
|
||||
// Do not consume it!
|
||||
viewModel.updateGroupChatButtonVisibility()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
|
||||
numberOrAddressPickerDialog?.dismiss()
|
||||
numberOrAddressPickerDialog = null
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
* 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 java.util.ArrayList
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.contacts.ContactsManager.ContactsListener
|
||||
import org.linphone.core.MagicSearch
|
||||
import org.linphone.core.MagicSearchListenerStub
|
||||
import org.linphone.core.SearchResult
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.ui.main.contacts.model.ContactAvatarModel
|
||||
import org.linphone.ui.main.history.model.ContactOrSuggestionModel
|
||||
import org.linphone.ui.main.model.isInSecureMode
|
||||
import org.linphone.utils.LinphoneUtils
|
||||
|
||||
class StartConversationViewModel @UiThread constructor() : ViewModel() {
|
||||
companion object {
|
||||
private const val TAG = "[Start Conversation ViewModel]"
|
||||
}
|
||||
|
||||
val searchFilter = MutableLiveData<String>()
|
||||
|
||||
val contactsList = MutableLiveData<ArrayList<ContactOrSuggestionModel>>()
|
||||
|
||||
val hideGroupChatButton = MutableLiveData<Boolean>()
|
||||
|
||||
val isGroupChatAvailable = MutableLiveData<Boolean>()
|
||||
|
||||
private var currentFilter = ""
|
||||
private var previousFilter = "NotSet"
|
||||
private var limitSearchToLinphoneAccounts = true
|
||||
|
||||
private lateinit var magicSearch: MagicSearch
|
||||
|
||||
private val magicSearchListener = object : MagicSearchListenerStub() {
|
||||
@WorkerThread
|
||||
override fun onSearchResultsReceived(magicSearch: MagicSearch) {
|
||||
Log.i("$TAG Magic search contacts available")
|
||||
processMagicSearchResults(magicSearch.lastSearch)
|
||||
}
|
||||
}
|
||||
|
||||
private val contactsListener = object : ContactsListener {
|
||||
@WorkerThread
|
||||
override fun onContactsLoaded() {
|
||||
Log.i("$TAG Contacts have been (re)loaded, updating list")
|
||||
applyFilter(
|
||||
currentFilter,
|
||||
if (limitSearchToLinphoneAccounts) corePreferences.defaultDomain else "",
|
||||
MagicSearch.Source.Friends.toInt(),
|
||||
MagicSearch.Aggregation.Friend
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
updateGroupChatButtonVisibility()
|
||||
|
||||
coreContext.postOnCoreThread { core ->
|
||||
val defaultAccount = core.defaultAccount
|
||||
limitSearchToLinphoneAccounts = defaultAccount?.isInSecureMode() ?: false
|
||||
|
||||
coreContext.contactsManager.addListener(contactsListener)
|
||||
magicSearch = core.createMagicSearch()
|
||||
magicSearch.limitedSearch = false
|
||||
magicSearch.addListener(magicSearchListener)
|
||||
}
|
||||
|
||||
applyFilter(currentFilter)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
override fun onCleared() {
|
||||
coreContext.postOnCoreThread {
|
||||
magicSearch.removeListener(magicSearchListener)
|
||||
coreContext.contactsManager.removeListener(contactsListener)
|
||||
}
|
||||
super.onCleared()
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun clearFilter() {
|
||||
searchFilter.value = ""
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun updateGroupChatButtonVisibility() {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
val hideGroupChat = !LinphoneUtils.isGroupChatAvailable(core)
|
||||
hideGroupChatButton.postValue(hideGroupChat)
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
fun processMagicSearchResults(results: Array<SearchResult>) {
|
||||
Log.i("$TAG Processing [${results.size}] results")
|
||||
|
||||
val contactsList = arrayListOf<ContactOrSuggestionModel>()
|
||||
var previousLetter = ""
|
||||
|
||||
for (result in results) {
|
||||
val address = result.address
|
||||
if (address != null) {
|
||||
val friend = coreContext.contactsManager.findContactByAddress(address)
|
||||
if (friend != null) {
|
||||
val model = ContactOrSuggestionModel(address, friend)
|
||||
model.contactAvatarModel = ContactAvatarModel(friend)
|
||||
|
||||
val currentLetter = friend.name?.get(0).toString()
|
||||
val displayLetter = previousLetter.isEmpty() || currentLetter != previousLetter
|
||||
if (currentLetter != previousLetter) {
|
||||
previousLetter = currentLetter
|
||||
}
|
||||
model.contactAvatarModel.firstContactStartingByThatLetter.postValue(
|
||||
displayLetter
|
||||
)
|
||||
|
||||
contactsList.add(model)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val list = arrayListOf<ContactOrSuggestionModel>()
|
||||
list.addAll(contactsList)
|
||||
this.contactsList.postValue(list)
|
||||
Log.i("$TAG Processed [${results.size}] results, extracted [${list.size}] suggestions")
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun applyFilter(filter: String) {
|
||||
coreContext.postOnCoreThread {
|
||||
applyFilter(
|
||||
filter,
|
||||
if (limitSearchToLinphoneAccounts) corePreferences.defaultDomain else "",
|
||||
MagicSearch.Source.Friends.toInt(),
|
||||
MagicSearch.Aggregation.Friend
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun applyFilter(
|
||||
filter: String,
|
||||
domain: String,
|
||||
sources: Int,
|
||||
aggregation: MagicSearch.Aggregation
|
||||
) {
|
||||
if (previousFilter.isNotEmpty() && (
|
||||
previousFilter.length > filter.length ||
|
||||
(previousFilter.length == filter.length && previousFilter != filter)
|
||||
)
|
||||
) {
|
||||
magicSearch.resetSearchCache()
|
||||
}
|
||||
currentFilter = filter
|
||||
previousFilter = filter
|
||||
|
||||
Log.i(
|
||||
"$TAG Asking Magic search for contacts matching filter [$filter], domain [$domain] and in sources [$sources]"
|
||||
)
|
||||
magicSearch.getContactsListAsync(
|
||||
filter,
|
||||
domain,
|
||||
sources,
|
||||
aggregation
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -94,4 +94,10 @@ class SharedMainViewModel @UiThread constructor() : ViewModel() {
|
|||
val resetMissedCallsCountEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
/* Conversation related */
|
||||
|
||||
val showStartConversationEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
203
app/src/main/res/layout/start_chat_fragment.xml
Normal file
203
app/src/main/res/layout/start_chat_fragment.xml
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
<?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"
|
||||
xmlns:bind="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="backClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.chat.viewmodel.StartConversationViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<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:adjustViewBounds="true"
|
||||
android:onClick="@{backClickListener}"
|
||||
android:padding="15dp"
|
||||
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" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/main_page_title_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:text="@string/new_conversation_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/back"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/background"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/search_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/edit_text_background"
|
||||
android:drawableStart="@drawable/magnifying_glass"
|
||||
android:drawablePadding="10dp"
|
||||
android:drawableTint="@color/gray_main2_600"
|
||||
android:hint="@string/new_conversation_search_bar_filter_hint"
|
||||
android:inputType="textPersonName|textNoSuggestions"
|
||||
android:paddingStart="15dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="15dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="@={viewModel.searchFilter}"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintHeight_min="48dp"
|
||||
app:layout_constraintWidth_max="@dimen/text_input_max_width"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/clear_field"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:onClick="@{() -> viewModel.clearFilter()}"
|
||||
android:src="@drawable/x"
|
||||
android:visibility="@{viewModel.searchFilter.length() > 0 ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintBottom_toBottomOf="@id/search_bar"
|
||||
app:layout_constraintEnd_toEndOf="@id/search_bar"
|
||||
app:layout_constraintTop_toTopOf="@id/search_bar"
|
||||
app:tint="@color/gray_main2_600" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_chat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="group_chat_icon, gradient_background, group_chat_label"
|
||||
android:visibility="@{viewModel.hideGroupChatButton || viewModel.searchFilter.length() > 0 ? View.GONE : View.VISIBLE}" />
|
||||
|
||||
<!-- margin start must be half the size of the group_call_icon below -->
|
||||
<View
|
||||
android:id="@+id/gradient_background"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="22dp"
|
||||
android:background="@drawable/shape_gradient"
|
||||
app:layout_constraintBottom_toBottomOf="@id/group_chat_icon"
|
||||
app:layout_constraintEnd_toEndOf="@id/group_chat_label"
|
||||
app:layout_constraintStart_toStartOf="@id/group_chat_icon"
|
||||
app:layout_constraintTop_toTopOf="@id/group_chat_icon" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/group_chat_icon"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:background="@drawable/shape_orange_round"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/users_three"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/search_bar"
|
||||
app:tint="@color/white" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_800"
|
||||
android:id="@+id/group_chat_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:drawableEnd="@drawable/caret_right"
|
||||
android:padding="5dp"
|
||||
android:text="@string/new_conversation_create_group"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/group_chat_icon"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/group_chat_icon"
|
||||
app:layout_constraintTop_toTopOf="@id/group_chat_icon" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/no_contact_image"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="10dp"
|
||||
android:src="@drawable/illu"
|
||||
android:visibility="@{viewModel.contactsList.size() == 0 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_max="200dp"
|
||||
app:layout_constraintVertical_bias="0.3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/group_chat_icon"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/section_header_style"
|
||||
android:id="@+id/no_contact_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/new_conversation_no_contact"
|
||||
android:gravity="center"
|
||||
android:visibility="@{viewModel.contactsList.size() == 0 ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/no_contact_image" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/section_header_style"
|
||||
android:id="@+id/contacts_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/history_call_start_contacts_list_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/group_chat_icon"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/contacts_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:visibility="@{viewModel.contactsList.size() == 0 ? View.GONE : View.VISIBLE}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/contacts_label"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -180,6 +180,7 @@
|
|||
android:name="accountIdentity"
|
||||
app:argType="string" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/conversationsFragment"
|
||||
android:name="org.linphone.ui.main.chat.fragment.ConversationsFragment"
|
||||
|
|
@ -199,4 +200,17 @@
|
|||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/startConversationFragment"
|
||||
android:name="org.linphone.ui.main.chat.fragment.StartConversationFragment"
|
||||
android:label="StartConversationFragment"
|
||||
tools:layout="@layout/start_chat_fragment"/>
|
||||
|
||||
<action
|
||||
android:id="@+id/action_global_startConversationFragment"
|
||||
app:destination="@id/startConversationFragment"
|
||||
app:enterAnim="@anim/slide_in"
|
||||
app:launchSingleTop="true"
|
||||
app:popExitAnim="@anim/slide_out" />
|
||||
|
||||
</navigation>
|
||||
|
|
@ -325,6 +325,10 @@
|
|||
<string name="conversation_action_delete">Delete conversation</string>
|
||||
<string name="conversation_action_leave_group">Leave the group</string>
|
||||
<string name="conversation_yesterday_timestamp">Yesterday at %s</string>
|
||||
<string name="new_conversation_title">New conversation</string>
|
||||
<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="operation_in_progress_overlay">Operation in progress, please wait</string>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue