Various improvements

This commit is contained in:
Sylvain Berfini 2023-08-17 16:29:10 +02:00
parent 74a15cd0a1
commit e3b5f0cc77
34 changed files with 254 additions and 191 deletions

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_3a_API_34_extension_level_7_x86_64.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-08-13T08:18:53.498566591Z" />
</component>
</project>

View file

@ -21,7 +21,6 @@ package org.linphone.ui.assistant
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.WindowCompat
import androidx.databinding.DataBindingUtil
import org.linphone.LinphoneApplication
@ -35,11 +34,6 @@ class AssistantActivity : AppCompatActivity() {
WindowCompat.setDecorFitsSystemWindows(window, true)
super.onCreate(savedInstanceState)
window.statusBarColor = ContextCompat.getColor(
this,
R.color.primary_color
)
while (!LinphoneApplication.coreContext.isReady()) {
Thread.sleep(20)
}

View file

@ -117,6 +117,8 @@ class AssistantViewModel : ViewModel() {
accountParams.identityAddress = identityAddress
newlyCreatedAccount = core.createAccount(accountParams)
// TODO: set international prefix if detected
registrationInProgress.postValue(true)
core.addListener(coreListener)
core.addAccount(newlyCreatedAccount)

View file

@ -26,13 +26,15 @@ import android.os.Bundle
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.PopupWindow
import androidx.annotation.DrawableRes
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.WindowCompat
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.core.Account
@ -40,6 +42,7 @@ import org.linphone.databinding.AccountPopupMenuBinding
import org.linphone.databinding.MainActivityBinding
import org.linphone.ui.assistant.AssistantActivity
import org.linphone.ui.main.viewmodel.DrawerMenuViewModel
import org.linphone.utils.slideInToastFromTopForDuration
class MainActivity : AppCompatActivity() {
companion object {
@ -55,11 +58,6 @@ class MainActivity : AppCompatActivity() {
WindowCompat.setDecorFitsSystemWindows(window, true)
super.onCreate(savedInstanceState)
window.statusBarColor = ContextCompat.getColor(
this,
R.color.primary_color
)
while (!coreContext.isReady()) {
Thread.sleep(20)
}
@ -141,6 +139,14 @@ class MainActivity : AppCompatActivity() {
}
}
fun showGreenToast(message: String, @DrawableRes icon: Int) {
binding.greenToast.message = message
binding.greenToast.icon = icon
val target = binding.greenToast.root
target.slideInToastFromTopForDuration(binding.root as ViewGroup, lifecycleScope)
}
private fun loadContacts() {
coreContext.contactsManager.loadContacts(this)
@ -172,15 +178,19 @@ class MainActivity : AppCompatActivity() {
null,
false
)
popupView.setManageProfileClickListener {
// TODO: navigate to profile
}
val popupWindow = PopupWindow(
popupView.root,
WRAP_CONTENT,
WRAP_CONTENT,
true
)
popupView.setManageProfileClickListener {
// TODO: navigate to profile
popupWindow.dismiss()
}
// Elevation is for showing a shadow around the popup
popupWindow.elevation = 20f
popupWindow.showAsDropDown(view, 0, 0, Gravity.BOTTOM)

View file

@ -31,16 +31,15 @@ import android.widget.PopupWindow
import androidx.core.view.doOnPreDraw
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.navArgs
import org.linphone.R
import org.linphone.core.tools.Log
import org.linphone.databinding.CallFragmentBinding
import org.linphone.databinding.CallPopupMenuBinding
import org.linphone.ui.main.MainActivity
import org.linphone.ui.main.calls.viewmodel.CallLogViewModel
import org.linphone.ui.main.fragment.GenericFragment
import org.linphone.utils.Event
import org.linphone.utils.slideInToastFromTopForDuration
class CallFragment : GenericFragment() {
private lateinit var binding: CallFragmentBinding
@ -94,6 +93,18 @@ class CallFragment : GenericFragment() {
}
sharedViewModel.openSlidingPaneEvent.value = Event(true)
}
viewModel.historyDeletedEvent.observe(viewLifecycleOwner) {
it.consume {
sharedViewModel.forceRefreshCallLogsListEvent.value = Event(true)
(requireActivity() as MainActivity).showGreenToast(
"Historique supprimé",
R.drawable.check
)
goBack() // TODO FIXME : issue with tablet when pane can't be closed
}
}
}
private fun copyNumberOrAddressToClipboard(value: String) {
@ -101,11 +112,10 @@ class CallFragment : GenericFragment() {
val label = "SIP address"
clipboard.setPrimaryClip(ClipData.newPlainText(label, value))
binding.greenToast.message = "Numéro copié dans le presse-papier"
binding.greenToast.icon = R.drawable.check
val target = binding.greenToast.root
target.slideInToastFromTopForDuration(binding.root as ViewGroup, lifecycleScope)
(requireActivity() as MainActivity).showGreenToast(
"Numéro copié dans le presse-papier",
R.drawable.check
)
}
private fun showPopupMenu() {
@ -116,14 +126,6 @@ class CallFragment : GenericFragment() {
false
)
popupView.setDeleteAllHistoryClickListener {
viewModel.deleteHistory()
}
popupView.setCopyNumberClickListener {
copyNumberOrAddressToClipboard(viewModel.callLogModel.value?.displayedAddress.orEmpty())
}
val popupWindow = PopupWindow(
popupView.root,
ViewGroup.LayoutParams.WRAP_CONTENT,
@ -131,6 +133,26 @@ class CallFragment : GenericFragment() {
true
)
popupView.contactExists = viewModel.callLogModel.value?.friendExists == true
popupView.setAddToContactsListener {
// TODO: go to new contact fragment
}
popupView.setGoToContactListener {
// TODO: go to contact fragment
}
popupView.setDeleteAllHistoryClickListener {
viewModel.deleteHistory()
popupWindow.dismiss()
}
popupView.setCopyNumberClickListener {
popupWindow.dismiss()
copyNumberOrAddressToClipboard(viewModel.callLogModel.value?.displayedAddress.orEmpty())
}
// Elevation is for showing a shadow around the popup
popupWindow.elevation = 20f
popupWindow.showAsDropDown(binding.menu, 0, 0, Gravity.BOTTOM)

View file

@ -31,7 +31,6 @@ import android.view.animation.Animation
import android.view.animation.AnimationUtils
import android.widget.PopupWindow
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import androidx.navigation.navGraphViewModels
import androidx.recyclerview.widget.LinearLayoutManager
@ -39,13 +38,13 @@ import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.databinding.CallsListFragmentBinding
import org.linphone.databinding.CallsListPopupMenuBinding
import org.linphone.ui.main.MainActivity
import org.linphone.ui.main.calls.adapter.CallsListAdapter
import org.linphone.ui.main.calls.model.RemoveAllCallLogsDialogModel
import org.linphone.ui.main.calls.viewmodel.CallsListViewModel
import org.linphone.ui.main.fragment.GenericFragment
import org.linphone.utils.DialogUtils
import org.linphone.utils.Event
import org.linphone.utils.slideInToastFromTopForDuration
class CallsListFragment : GenericFragment() {
@ -124,6 +123,21 @@ class CallsListFragment : GenericFragment() {
startPostponedEnterTransition()
}
listViewModel.historyDeletedEvent.observe(viewLifecycleOwner) {
it.consume {
(requireActivity() as MainActivity).showGreenToast(
"Historique supprimé",
R.drawable.check
)
}
}
sharedViewModel.forceRefreshCallLogsListEvent.observe(viewLifecycleOwner) {
it.consume {
listViewModel.applyFilter()
}
}
sharedViewModel.searchFilter.observe(viewLifecycleOwner) {
it.consume { filter ->
listViewModel.applyFilter(filter)
@ -144,11 +158,10 @@ class CallsListFragment : GenericFragment() {
val label = "SIP address"
clipboard.setPrimaryClip(ClipData.newPlainText(label, value))
binding.greenToast.message = "Numéro copié dans le presse-papier"
binding.greenToast.icon = R.drawable.check
val target = binding.greenToast.root
target.slideInToastFromTopForDuration(binding.root as ViewGroup, lifecycleScope)
(requireActivity() as MainActivity).showGreenToast(
"Numéro copié dans le presse-papier",
R.drawable.check
)
}
private fun showPopupMenu() {

View file

@ -8,7 +8,7 @@ import org.linphone.core.CallLog
import org.linphone.utils.LinphoneUtils
import org.linphone.utils.TimestampUtils
class CallLogHistoryModel(callLog: CallLog) {
class CallLogHistoryModel(val callLog: CallLog) {
val isOutgoing = MutableLiveData<Boolean>()
val isSuccessful = MutableLiveData<Boolean>()

View file

@ -25,6 +25,8 @@ class CallLogModel(private val callLog: CallLog) {
val dateTime = MutableLiveData<String>()
var friendExists: Boolean = false
init {
// Core thread
isOutgoing.postValue(callLog.dir == Dir.Outgoing)
@ -42,10 +44,12 @@ class CallLogModel(private val callLog: CallLog) {
val friend = coreContext.core.findFriend(address)
if (friend != null) {
avatarModel = ContactAvatarModel(friend)
friendExists = true
} else {
val fakeFriend = coreContext.core.createFriend()
fakeFriend.address = address
avatarModel = ContactAvatarModel(fakeFriend)
friendExists = false
}
iconResId.postValue(LinphoneUtils.getIconResId(callLog.status, callLog.dir))

View file

@ -18,6 +18,10 @@ class CallLogViewModel : ViewModel() {
val callLogFoundEvent = MutableLiveData<Event<Boolean>>()
val historyDeletedEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
private lateinit var address: Address
fun findCallLogByCallId(callId: String) {
@ -45,7 +49,12 @@ class CallLogViewModel : ViewModel() {
fun deleteHistory() {
// UI thread
// TODO
coreContext.postOnCoreThread { core ->
for (model in historyCallLogs.value.orEmpty()) {
core.removeCallLog(model.callLog)
}
historyDeletedEvent.postValue(Event(true))
}
}
fun startAudioCall() {

View file

@ -26,10 +26,15 @@ import org.linphone.core.CallLog
import org.linphone.core.Core
import org.linphone.core.CoreListenerStub
import org.linphone.ui.main.calls.model.CallLogModel
import org.linphone.utils.Event
class CallsListViewModel : ViewModel() {
val callLogs = MutableLiveData<ArrayList<CallLogModel>>()
val historyDeletedEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
private var currentFilter = ""
private val coreListener = object : CoreListenerStub() {
@ -54,7 +59,7 @@ class CallsListViewModel : ViewModel() {
}
}
fun applyFilter(filter: String) {
fun applyFilter(filter: String = currentFilter) {
// UI thread
currentFilter = filter
@ -69,6 +74,7 @@ class CallsListViewModel : ViewModel() {
for (callLog in core.callLogs) {
core.removeCallLog(callLog)
}
historyDeletedEvent.postValue(Event(true))
computeCallLogsList(currentFilter)
}
}

View file

@ -31,19 +31,18 @@ import android.view.View
import android.view.ViewGroup
import androidx.core.view.doOnPreDraw
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.navigation.findNavController
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import org.linphone.R
import org.linphone.core.tools.Log
import org.linphone.databinding.ContactFragmentBinding
import org.linphone.ui.main.MainActivity
import org.linphone.ui.main.contacts.model.NumberOrAddressPickerDialogModel
import org.linphone.ui.main.contacts.viewmodel.ContactViewModel
import org.linphone.ui.main.fragment.GenericFragment
import org.linphone.utils.DialogUtils
import org.linphone.utils.Event
import org.linphone.utils.slideInToastFromTopForDuration
class ContactFragment : GenericFragment() {
private lateinit var binding: ContactFragmentBinding
@ -151,10 +150,9 @@ class ContactFragment : GenericFragment() {
val label = if (isSip) "SIP address" else "Phone number"
clipboard.setPrimaryClip(ClipData.newPlainText(label, value))
binding.greenToast.message = "Numéro copié dans le presse-papier"
binding.greenToast.icon = R.drawable.check
val target = binding.greenToast.root
target.slideInToastFromTopForDuration(binding.root as ViewGroup, lifecycleScope)
(requireActivity() as MainActivity).showGreenToast(
"Numéro copié dans le presse-papier",
R.drawable.check
)
}
}

View file

@ -28,27 +28,47 @@ class SharedMainViewModel : ViewModel() {
val isSlidingPaneSlideable = MutableLiveData<Boolean>()
val closeSlidingPaneEvent = MutableLiveData<Event<Boolean>>()
val closeSlidingPaneEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
val openSlidingPaneEvent = MutableLiveData<Event<Boolean>>()
val openSlidingPaneEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
val navigateToConversationsEvent = MutableLiveData<Event<Boolean>>()
val navigateToConversationsEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
val navigateToCallsEvent = MutableLiveData<Event<Boolean>>()
val navigateToCallsEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
val navigateToContactsEvent = MutableLiveData<Event<Boolean>>()
val navigateToContactsEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
var currentlyDisplayedFragment = MutableLiveData<Int>()
/* Top bar related */
val searchFilter = MutableLiveData<Event<String>>()
val searchFilter: MutableLiveData<Event<String>> by lazy {
MutableLiveData<Event<String>>()
}
/* Contacts related */
val showContactEvent = MutableLiveData<Event<String>>()
val showContactEvent: MutableLiveData<Event<String>> by lazy {
MutableLiveData<Event<String>>()
}
/* Call logs related */
val showCallLogEvent = MutableLiveData<Event<String>>()
val showCallLogEvent: MutableLiveData<Event<String>> by lazy {
MutableLiveData<Event<String>>()
}
val forceRefreshCallLogsListEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
}

View file

@ -48,7 +48,6 @@ class VoipActivity : AppCompatActivity() {
this,
R.color.in_call_black
)
// window.statusBarColor = inCallBlackColor
window.navigationBarColor = inCallBlackColor
while (!LinphoneApplication.coreContext.isReady()) {

View file

@ -1,19 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="vector"
android:width="36dp"
android:height="36dp"
android:viewportWidth="36"
android:viewportHeight="36">
android:width="52dp"
android:height="52dp"
android:viewportWidth="52"
android:viewportHeight="52">
<path
android:name="path"
android:pathData="M 18 0 C 13.228 0 8.646 1.898 5.272 5.272 C 1.898 8.646 0 13.228 0 18 C 0 22.772 1.898 27.354 5.272 30.728 C 8.646 34.102 13.228 36 18 36 C 22.772 36 27.354 34.102 30.728 30.728 C 34.102 27.354 36 22.772 36 18 C 36 13.228 34.102 8.646 30.728 5.272 C 27.354 1.898 22.772 0 18 0 Z"
android:fillColor="#6c7a87"
android:strokeWidth="1"/>
<path
android:name="path_1"
android:pathData="M 32 25.5 C 31.259 25.498 30.537 25.73 29.937 26.165 C 29.337 26.599 28.89 27.212 28.661 27.916 C 28.432 28.62 28.432 29.38 28.661 30.084 C 28.89 30.788 29.337 31.401 29.937 31.835 C 30.537 32.27 31.259 32.502 32 32.5 C 32.741 32.502 33.463 32.27 34.063 31.835 C 34.663 31.401 35.11 30.788 35.339 30.084 C 35.568 29.38 35.568 28.62 35.339 27.916 C 35.11 27.212 34.663 26.599 34.063 26.165 C 33.463 25.73 32.741 25.498 32 25.5 Z"
android:fillColor="#4fae80"
android:strokeColor="#ffffff"
android:pathData="M 25.978 4.333 C 14.018 4.333 4.333 14.04 4.333 26 C 4.333 37.96 14.018 47.666 25.978 47.666 C 37.96 47.666 47.667 37.96 47.667 26 C 47.667 14.04 37.96 4.333 25.978 4.333 Z M 26 43.333 C 16.423 43.333 8.667 35.576 8.667 26 C 8.667 16.423 16.423 8.666 26 8.666 C 35.577 8.666 43.333 16.423 43.333 26 C 43.333 35.576 35.577 43.333 26 43.333 Z M 33.583 23.833 C 35.382 23.833 36.833 22.381 36.833 20.583 C 36.833 18.785 35.382 17.333 33.583 17.333 C 31.785 17.333 30.333 18.785 30.333 20.583 C 30.333 22.381 31.785 23.833 33.583 23.833 Z M 18.417 23.833 C 20.215 23.833 21.667 22.381 21.667 20.583 C 21.667 18.785 20.215 17.333 18.417 17.333 C 16.618 17.333 15.167 18.785 15.167 20.583 C 15.167 22.381 16.618 23.833 18.417 23.833 Z M 26 37.916 C 31.048 37.916 35.338 34.753 37.072 30.333 L 14.928 30.333 C 16.662 34.753 20.952 37.916 26 37.916 Z"
android:fillColor="#4e6074"
android:strokeWidth="1"/>
</vector>

View file

@ -31,7 +31,7 @@
android:id="@+id/top_bar"
android:name="org.linphone.ui.main.fragment.TopBarFragment"
android:layout_width="0dp"
android:layout_height="@dimen/top_search_bar_height"
android:layout_height="@dimen/top_bar_height"
android:layout_marginEnd="9dp"
bind:layout="@layout/top_search_bar"
app:layout_constraintTop_toTopOf="parent"
@ -75,19 +75,6 @@
app:layout_constraintTop_toBottomOf="@id/top_bar"
app:layout_constraintBottom_toBottomOf="parent" />
<include
android:id="@+id/green_toast"
android:visibility="gone"
layout="@layout/toast_green"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
app:layout_constraintTop_toTopOf="@id/background"
app:layout_constraintStart_toEndOf="@id/bottom_nav_bar"
app:layout_constraintEnd_toEndOf="parent" />
<androidx.fragment.app.FragmentContainerView
android:id="@+id/bottom_nav_bar"
android:name="org.linphone.ui.main.fragment.BottomNavBarFragment"

View file

@ -44,7 +44,7 @@
android:id="@+id/top_bar"
android:name="org.linphone.ui.main.fragment.TopBarFragment"
android:layout_width="0dp"
android:layout_height="@dimen/top_search_bar_height"
android:layout_height="@dimen/top_bar_height"
bind:layout="@layout/top_search_bar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/bottom_nav_bar"

View file

@ -32,6 +32,7 @@
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:adjustViewBounds="true"
android:background="@drawable/shape_button_round"
contactAvatar="@{model.contact}"
app:avatarViewPlaceholder="@drawable/contact_avatar"
app:avatarViewInitialsBackgroundColor="@color/blue_outgoing_message"

View file

@ -33,15 +33,30 @@
android:onClick="@{backClickListener}"
android:visibility="@{viewModel.showBackButton ? View.VISIBLE : View.GONE}"
android:src="@drawable/back"
app:layout_constraintBottom_toBottomOf="@id/invisible_title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/menu"
app:layout_constraintBottom_toBottomOf="@id/menu"/>
app:layout_constraintTop_toTopOf="@id/invisible_title"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_800"
android:id="@+id/invisible_title"
android:visibility="invisible"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:gravity="center_vertical"
android:textColor="@color/primary_color"
android:textSize="16sp"
app:layout_constraintEnd_toStartOf="@id/menu"
app:layout_constraintStart_toEndOf="@id/back"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:onClick="@{menuClickListener}"
android:id="@+id/menu"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:paddingTop="4dp"
@ -50,14 +65,14 @@
android:paddingEnd="10dp"
android:src="@drawable/dot_menu"
app:tint="@color/primary_color"
app:layout_constraintBottom_toBottomOf="@id/invisible_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="@id/invisible_title" />
<ScrollView
android:id="@+id/scrollView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="@color/gray_7"
app:layout_constraintStart_toStartOf="parent"
@ -75,6 +90,7 @@
android:layout_height="@dimen/avatar_big_size"
android:layout_marginTop="8dp"
android:adjustViewBounds="true"
android:background="@drawable/shape_button_round"
contactAvatar="@{viewModel.callLogModel.avatarModel}"
app:avatarViewBorderWidth="0dp"
app:avatarViewInitialsBackgroundColor="@color/blue_outgoing_message"
@ -239,19 +255,6 @@
</ScrollView>
<include
android:id="@+id/green_toast"
android:visibility="gone"
layout="@layout/toast_green"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
app:layout_constraintTop_toTopOf="@id/scrollView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -36,6 +36,7 @@
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:adjustViewBounds="true"
android:background="@drawable/shape_button_round"
contactAvatar="@{model.avatarModel}"
app:avatarViewInitials="JD"
app:avatarViewPlaceholder="@drawable/contact_avatar"

View file

@ -6,12 +6,21 @@
<data>
<import type="android.view.View" />
<import type="android.graphics.Typeface" />
<variable
name="addToContactsListener"
type="View.OnClickListener" />
<variable
name="goToContactListener"
type="View.OnClickListener" />
<variable
name="copyNumberClickListener"
type="View.OnClickListener" />
<variable
name="deleteAllHistoryClickListener"
type="View.OnClickListener" />
<variable
name="contactExists"
type="Boolean" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
@ -20,6 +29,8 @@
android:background="@drawable/shape_round_popup_menu_background">
<androidx.appcompat.widget.AppCompatTextView
android:onClick="@{addToContactsListener}"
android:visibility="@{contactExists ? View.GONE : View.VISIBLE}"
style="@style/default_text_style"
android:id="@+id/add_to_contact"
android:layout_width="0dp"
@ -41,11 +52,13 @@
app:layout_constraintBottom_toTopOf="@id/go_to_contact"/>
<androidx.appcompat.widget.AppCompatTextView
android:onClick="@{goToContactListener}"
android:visibility="@{contactExists ? 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="15dp"
android:layout_marginTop="20dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:gravity="left|center_vertical"

View file

@ -33,10 +33,9 @@
style="@style/default_text_style_800"
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_height="@dimen/top_bar_height"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:text="New call"
android:textColor="@color/primary_color"
@ -49,7 +48,6 @@
android:id="@+id/scrollView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="@color/gray_7"
app:layout_constraintStart_toStartOf="parent"

View file

@ -31,7 +31,7 @@
android:id="@+id/top_bar"
android:name="org.linphone.ui.main.fragment.TopBarFragment"
android:layout_width="0dp"
android:layout_height="@dimen/top_search_bar_height"
android:layout_height="@dimen/top_bar_height"
android:layout_marginEnd="9dp"
bind:layout="@layout/top_search_bar"
app:layout_constraintTop_toTopOf="parent"
@ -75,19 +75,6 @@
app:layout_constraintTop_toBottomOf="@id/top_bar"
app:layout_constraintBottom_toTopOf="@id/bottom_nav_bar" />
<include
android:id="@+id/green_toast"
android:visibility="gone"
layout="@layout/toast_green"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
app:layout_constraintTop_toTopOf="@id/background"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<androidx.fragment.app.FragmentContainerView
android:id="@+id/bottom_nav_bar"
android:name="org.linphone.ui.main.fragment.BottomNavBarFragment"

View file

@ -31,6 +31,7 @@
android:layout_width="@dimen/avatar_favorite_list_cell_size"
android:layout_height="@dimen/avatar_favorite_list_cell_size"
android:adjustViewBounds="true"
android:background="@drawable/shape_button_round"
contactAvatar="@{model}"
app:avatarViewPlaceholder="@drawable/contact_avatar"
app:avatarViewInitialsBackgroundColor="@color/blue_outgoing_message"

View file

@ -30,9 +30,24 @@
android:onClick="@{backClickListener}"
android:visibility="@{viewModel.showBackButton ? View.VISIBLE : View.GONE}"
android:src="@drawable/back"
app:layout_constraintBottom_toBottomOf="@id/invisible_title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/edit"
app:layout_constraintBottom_toBottomOf="@id/edit"/>
app:layout_constraintTop_toTopOf="@id/invisible_title"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_800"
android:id="@+id/invisible_title"
android:visibility="invisible"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:gravity="center_vertical"
android:textColor="@color/primary_color"
android:textSize="16sp"
app:layout_constraintEnd_toStartOf="@id/edit"
app:layout_constraintStart_toEndOf="@id/back"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:onClick="@{() -> viewModel.editContact()}"
@ -41,17 +56,17 @@
android:layout_height="35dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:src="@drawable/edit"
app:layout_constraintBottom_toBottomOf="@id/invisible_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="@id/invisible_title" />
<ScrollView
android:id="@+id/scrollView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:background="@color/gray_7"
app:layout_constraintStart_toStartOf="parent"
@ -87,6 +102,7 @@
android:layout_height="@dimen/avatar_big_size"
android:layout_marginTop="8dp"
android:adjustViewBounds="true"
android:background="@drawable/shape_button_round"
contactAvatar="@{viewModel.contact}"
app:avatarViewBorderWidth="0dp"
app:avatarViewInitialsBackgroundColor="@color/blue_outgoing_message"
@ -553,19 +569,6 @@
</ScrollView>
<include
android:id="@+id/green_toast"
android:visibility="gone"
layout="@layout/toast_green"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
app:layout_constraintTop_toTopOf="@id/scrollView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -47,6 +47,7 @@
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:adjustViewBounds="true"
android:background="@drawable/shape_button_round"
contactAvatar="@{model}"
app:avatarViewInitials="SB"
app:avatarViewPlaceholder="@drawable/contact_avatar"

View file

@ -36,10 +36,9 @@
style="@style/default_text_style_800"
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_height="@dimen/top_bar_height"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:text="@{viewModel.isEdit ? `Edit contact` : `New contact`, default=`New contact`}"
android:textColor="@color/primary_color"
@ -65,7 +64,6 @@
android:id="@+id/scrollView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="@color/gray_7"
app:layout_constraintStart_toStartOf="parent"

View file

@ -34,7 +34,7 @@
android:id="@+id/top_bar"
android:name="org.linphone.ui.main.fragment.TopBarFragment"
android:layout_width="0dp"
android:layout_height="@dimen/top_search_bar_height"
android:layout_height="@dimen/top_bar_height"
bind:layout="@layout/top_search_bar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -25,7 +25,7 @@
android:id="@+id/top_bar"
android:name="org.linphone.ui.main.fragment.TopBarFragment"
android:layout_width="0dp"
android:layout_height="@dimen/top_search_bar_height"
android:layout_height="@dimen/top_bar_height"
bind:layout="@layout/top_search_bar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -9,48 +9,59 @@
type="org.linphone.ui.main.viewmodel.DrawerMenuViewModel" />
</data>
<androidx.coordinatorlayout.widget.CoordinatorLayout
<androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/drawer_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
tools:context=".ui.main.MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/drawer_menu"
android:layout_width="match_parent"
<androidx.fragment.app.FragmentContainerView
android:id="@+id/main_nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:navGraph="@navigation/main_nav_graph"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
app:layout_constraintBottom_toBottomOf="parent"/>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/main_nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:navGraph="@navigation/main_nav_graph"/>
<!-- Side Menu -->
<RelativeLayout
android:id="@+id/drawer_menu_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:layout_gravity="start">
<include
tools:viewModel="@{drawerMenuViewModel}"
layout="@layout/drawer_menu" />
</RelativeLayout>
</androidx.drawerlayout.widget.DrawerLayout>
<include
android:id="@+id/green_toast"
android:visibility="gone"
layout="@layout/toast_green"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/toast_top_margin"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<!-- Side Menu -->
<RelativeLayout
android:id="@+id/drawer_menu_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:layout_gravity="start">
<include
tools:viewModel="@{drawerMenuViewModel}"
layout="@layout/drawer_menu" />
</RelativeLayout>
</androidx.drawerlayout.widget.DrawerLayout>
</layout>

View file

@ -12,7 +12,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="@dimen/top_search_bar_height"
android:layout_height="@dimen/top_bar_height"
android:background="@color/primary_color">
<androidx.constraintlayout.widget.Group
@ -40,6 +40,7 @@
android:layout_width="@dimen/avatar_list_cell_size"
android:layout_height="@dimen/avatar_list_cell_size"
android:layout_marginStart="15dp"
android:background="@drawable/shape_button_round"
contactAvatar="@{viewModel.account.contact}"
app:avatarViewBorderColor="@color/trusted_blue"
app:avatarViewBorderWidth="2dp"

View file

@ -97,6 +97,7 @@
android:layout_width="@dimen/avatar_in_call_size"
android:layout_height="@dimen/avatar_in_call_size"
app:avatarViewBorderWidth="0dp"
android:background="@drawable/shape_button_round"
contactAvatar="@{viewModel.contact}"
app:avatarViewInitialsBackgroundColor="@color/blue_outgoing_message"
app:avatarViewInitialsTextColor="@color/gray_9"

View file

@ -57,6 +57,7 @@
android:layout_width="@dimen/avatar_in_call_size"
android:layout_height="@dimen/avatar_in_call_size"
app:avatarViewBorderWidth="0dp"
android:background="@drawable/shape_button_round"
contactAvatar="@{viewModel.contact}"
app:avatarViewInitialsBackgroundColor="@color/blue_outgoing_message"
app:avatarViewInitialsTextColor="@color/gray_9"

View file

@ -70,8 +70,9 @@
android:id="@+id/avatar"
android:layout_width="@dimen/avatar_in_call_size"
android:layout_height="@dimen/avatar_in_call_size"
app:avatarViewBorderWidth="0dp"
android:background="@drawable/shape_button_round"
contactAvatar="@{viewModel.contact}"
app:avatarViewBorderWidth="0dp"
app:avatarViewInitialsBackgroundColor="@color/blue_outgoing_message"
app:avatarViewInitialsTextColor="@color/gray_9"
app:avatarViewInitialsTextSize="36sp"

View file

@ -17,7 +17,8 @@
<dimen name="avatar_presence_badge_big_padding">3dp</dimen>
<dimen name="avatar_presence_badge_big_end_margin">5dp</dimen>
<dimen name="top_search_bar_height">55dp</dimen>
<dimen name="top_bar_height">55dp</dimen>
<dimen name="toast_top_margin">70dp</dimen> <!-- 15dp + top_bar_height -->
<dimen name="in_call_main_actions_menu_height">110dp</dimen>
<dimen name="in_call_extra_actions_menu_height">235dp</dimen>