Updated colors & in-call header

This commit is contained in:
Sylvain Berfini 2023-09-29 15:35:10 +02:00
parent e6287631aa
commit 62fa5515e1
20 changed files with 232 additions and 195 deletions

View file

@ -39,7 +39,6 @@ import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat import androidx.core.app.NotificationManagerCompat
import androidx.core.app.Person import androidx.core.app.Person
import androidx.core.app.RemoteInput import androidx.core.app.RemoteInput
import androidx.core.content.ContextCompat
import androidx.core.content.LocusIdCompat import androidx.core.content.LocusIdCompat
import org.linphone.LinphoneApplication.Companion.coreContext import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.LinphoneApplication.Companion.corePreferences import org.linphone.LinphoneApplication.Companion.corePreferences
@ -703,7 +702,7 @@ class NotificationsManager @MainThread constructor(private val context: Context)
setAutoCancel(false) setAutoCancel(false)
setShowWhen(true) setShowWhen(true)
setOngoing(true) setOngoing(true)
color = ContextCompat.getColor(context, R.color.orange_main_500) color = AppUtils.getColor(R.color.orange_main_500)
setFullScreenIntent(pendingIntent, true) setFullScreenIntent(pendingIntent, true)
} }
@ -759,7 +758,7 @@ class NotificationsManager @MainThread constructor(private val context: Context)
.setSmallIcon(R.drawable.chat_text) .setSmallIcon(R.drawable.chat_text)
.setAutoCancel(true) .setAutoCancel(true)
.setLargeIcon(largeIcon) .setLargeIcon(largeIcon)
.setColor(ContextCompat.getColor(context, R.color.orange_main_500)) .setColor(AppUtils.getColor(R.color.orange_main_500))
.setCategory(NotificationCompat.CATEGORY_MESSAGE) .setCategory(NotificationCompat.CATEGORY_MESSAGE)
.setGroup(CHAT_NOTIFICATIONS_GROUP) .setGroup(CHAT_NOTIFICATIONS_GROUP)
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE) .setVisibility(NotificationCompat.VISIBILITY_PRIVATE)

View file

@ -252,6 +252,8 @@ class ActiveCallFragment : GenericCallFragment() {
override fun onSlide(bottomSheet: View, slideOffset: Float) {} override fun onSlide(bottomSheet: View, slideOffset: Float) {}
}) })
binding.bottomBar.chat.isEnabled = false // TODO FIXME : remove later when chat will be available
} }
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")

View file

@ -30,12 +30,14 @@ import androidx.annotation.UiThread
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.WindowCompat import androidx.core.view.WindowCompat
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavController import androidx.navigation.NavController
import androidx.navigation.findNavController import androidx.navigation.findNavController
import org.linphone.LinphoneApplication.Companion.coreContext import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R import org.linphone.R
import org.linphone.databinding.MainActivityBinding import org.linphone.databinding.MainActivityBinding
import org.linphone.ui.main.viewmodel.MainViewModel
import org.linphone.utils.AppUtils import org.linphone.utils.AppUtils
import org.linphone.utils.slideInToastFromTopForDuration import org.linphone.utils.slideInToastFromTopForDuration
@ -51,6 +53,8 @@ class MainActivity : AppCompatActivity() {
private lateinit var binding: MainActivityBinding private lateinit var binding: MainActivityBinding
private lateinit var viewModel: MainViewModel
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, true) WindowCompat.setDecorFitsSystemWindows(window, true)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -67,6 +71,28 @@ class MainActivity : AppCompatActivity() {
binding = DataBindingUtil.setContentView(this, R.layout.main_activity) binding = DataBindingUtil.setContentView(this, R.layout.main_activity)
binding.lifecycleOwner = this binding.lifecycleOwner = this
viewModel = run {
ViewModelProvider(this)[MainViewModel::class.java]
}
binding.viewModel = viewModel
viewModel.changeSystemTopBarColorToInCallEvent.observe(this) {
it.consume { useInCallColor ->
val color = if (useInCallColor) {
AppUtils.getColor(R.color.green_success_500)
} else {
AppUtils.getColor(R.color.orange_main_500)
}
window.statusBarColor = color
}
}
viewModel.goBackToCallEvent.observe(this) {
it.consume {
coreContext.showCallActivity()
}
}
} }
override fun onPostCreate(savedInstanceState: Bundle?) { override fun onPostCreate(savedInstanceState: Bundle?) {

View file

@ -20,9 +20,6 @@
package org.linphone.ui.main.fragment package org.linphone.ui.main.fragment
import androidx.annotation.UiThread import androidx.annotation.UiThread
import androidx.core.content.ContextCompat
import org.linphone.LinphoneApplication
import org.linphone.R
import org.linphone.ui.main.MainActivity import org.linphone.ui.main.MainActivity
import org.linphone.ui.main.viewmodel.AbstractTopBarViewModel import org.linphone.ui.main.viewmodel.AbstractTopBarViewModel
@ -36,28 +33,5 @@ abstract class AbstractTopBarFragment : GenericFragment() {
(requireActivity() as MainActivity).toggleDrawerMenu() (requireActivity() as MainActivity).toggleDrawerMenu()
} }
} }
viewModel.changeSystemTopBarColorToInCallEvent.observe(viewLifecycleOwner) {
it.consume { useInCallColor ->
val color = if (useInCallColor) {
ContextCompat.getColor(
requireContext(),
R.color.green_success_500
)
} else {
ContextCompat.getColor(
requireContext(),
R.color.orange_main_500
)
}
requireActivity().window.statusBarColor = color
}
}
viewModel.goBackToCallEvent.observe(viewLifecycleOwner) {
it.consume {
LinphoneApplication.coreContext.showCallActivity()
}
}
} }
} }

View file

@ -20,17 +20,12 @@
package org.linphone.ui.main.viewmodel package org.linphone.ui.main.viewmodel
import androidx.annotation.UiThread import androidx.annotation.UiThread
import androidx.annotation.WorkerThread
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import org.linphone.LinphoneApplication.Companion.coreContext import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.core.Call
import org.linphone.core.Core
import org.linphone.core.CoreListenerStub
import org.linphone.core.tools.Log import org.linphone.core.tools.Log
import org.linphone.ui.main.model.AccountModel import org.linphone.ui.main.model.AccountModel
import org.linphone.utils.Event import org.linphone.utils.Event
import org.linphone.utils.LinphoneUtils
open class AbstractTopBarViewModel @UiThread constructor() : ViewModel() { open class AbstractTopBarViewModel @UiThread constructor() : ViewModel() {
companion object { companion object {
@ -45,12 +40,6 @@ open class AbstractTopBarViewModel @UiThread constructor() : ViewModel() {
val searchFilter = MutableLiveData<String>() val searchFilter = MutableLiveData<String>()
val atLastOneCall = MutableLiveData<Boolean>()
val callDisplayName = MutableLiveData<String>()
val callStatus = MutableLiveData<String>()
val focusSearchBarEvent: MutableLiveData<Event<Boolean>> by lazy { val focusSearchBarEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>() MutableLiveData<Event<Boolean>>()
} }
@ -59,46 +48,9 @@ open class AbstractTopBarViewModel @UiThread constructor() : ViewModel() {
MutableLiveData<Event<Boolean>>() MutableLiveData<Event<Boolean>>()
} }
val changeSystemTopBarColorToInCallEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
val goBackToCallEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
private val coreListener = object : CoreListenerStub() {
@WorkerThread
override fun onLastCallEnded(core: Core) {
Log.i("$TAG Last call ended, asking fragment to change back status bar color")
changeSystemTopBarColorToInCallEvent.postValue(Event(false))
}
@WorkerThread
override fun onCallStateChanged(
core: Core,
call: Call,
state: Call.State?,
message: String
) {
if (core.callsNb > 0) {
updateCurrentCallInfo()
}
atLastOneCall.postValue(core.callsNb > 0)
}
}
init { init {
searchBarVisible.value = false searchBarVisible.value = false
coreContext.postOnCoreThread { core ->
core.addListener(coreListener)
if (core.callsNb > 0) {
updateCurrentCallInfo()
}
atLastOneCall.postValue(core.callsNb > 0)
}
update() update()
} }
@ -107,7 +59,6 @@ open class AbstractTopBarViewModel @UiThread constructor() : ViewModel() {
super.onCleared() super.onCleared()
coreContext.postOnCoreThread { core -> coreContext.postOnCoreThread { core ->
core.removeListener(coreListener)
account.value?.destroy() account.value?.destroy()
} }
} }
@ -143,44 +94,6 @@ open class AbstractTopBarViewModel @UiThread constructor() : ViewModel() {
val defaultAccount = core.defaultAccount ?: core.accountList.first() val defaultAccount = core.defaultAccount ?: core.accountList.first()
account.postValue(AccountModel(defaultAccount)) account.postValue(AccountModel(defaultAccount))
} }
if (core.callsNb > 0) {
updateCurrentCallInfo()
}
atLastOneCall.postValue(core.callsNb > 0)
} }
} }
@UiThread
fun goBackToCall() {
goBackToCallEvent.value = Event(true)
}
@WorkerThread
private fun updateCurrentCallInfo() {
val core = coreContext.core
val currentCall = core.currentCall
if (currentCall != null) {
val contact = coreContext.contactsManager.findContactByAddress(
currentCall.remoteAddress
)
callDisplayName.postValue(
contact?.name ?: LinphoneUtils.getDisplayName(currentCall.remoteAddress)
)
callStatus.postValue(LinphoneUtils.callStateToString(currentCall.state))
} else {
val firstCall = core.calls.firstOrNull()
if (firstCall != null) {
val contact = coreContext.contactsManager.findContactByAddress(
firstCall.remoteAddress
)
callDisplayName.postValue(
contact?.name ?: LinphoneUtils.getDisplayName(firstCall.remoteAddress)
)
callStatus.postValue(LinphoneUtils.callStateToString(firstCall.state))
}
}
Log.i("$TAG At least a call, asking fragment to change status bar color")
changeSystemTopBarColorToInCallEvent.postValue(Event(true))
}
} }

View file

@ -0,0 +1,126 @@
/*
* 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.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.Call
import org.linphone.core.Core
import org.linphone.core.CoreListenerStub
import org.linphone.core.tools.Log
import org.linphone.utils.Event
import org.linphone.utils.LinphoneUtils
class MainViewModel @UiThread constructor() : ViewModel() {
companion object {
private const val TAG = "[Main ViewModel]"
}
val atLastOneCall = MutableLiveData<Boolean>()
val callDisplayName = MutableLiveData<String>()
val callStatus = MutableLiveData<String>()
val changeSystemTopBarColorToInCallEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
val goBackToCallEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
private val coreListener = object : CoreListenerStub() {
@WorkerThread
override fun onLastCallEnded(core: Core) {
Log.i("$TAG Last call ended, asking fragment to change back status bar color")
changeSystemTopBarColorToInCallEvent.postValue(Event(false))
}
@WorkerThread
override fun onCallStateChanged(
core: Core,
call: Call,
state: Call.State?,
message: String
) {
if (core.callsNb > 0) {
updateCurrentCallInfo()
}
atLastOneCall.postValue(core.callsNb > 0)
}
}
init {
coreContext.postOnCoreThread { core ->
core.addListener(coreListener)
if (core.callsNb > 0) {
updateCurrentCallInfo()
}
atLastOneCall.postValue(core.callsNb > 0)
}
}
@UiThread
override fun onCleared() {
super.onCleared()
coreContext.postOnCoreThread { core ->
core.removeListener(coreListener)
}
}
@UiThread
fun goBackToCall() {
goBackToCallEvent.value = Event(true)
}
@WorkerThread
private fun updateCurrentCallInfo() {
val core = coreContext.core
val currentCall = core.currentCall
if (currentCall != null) {
val contact = coreContext.contactsManager.findContactByAddress(
currentCall.remoteAddress
)
callDisplayName.postValue(
contact?.name ?: LinphoneUtils.getDisplayName(currentCall.remoteAddress)
)
callStatus.postValue(LinphoneUtils.callStateToString(currentCall.state))
} else {
val firstCall = core.calls.firstOrNull()
if (firstCall != null) {
val contact = coreContext.contactsManager.findContactByAddress(
firstCall.remoteAddress
)
callDisplayName.postValue(
contact?.name ?: LinphoneUtils.getDisplayName(firstCall.remoteAddress)
)
callStatus.postValue(LinphoneUtils.callStateToString(firstCall.state))
}
}
Log.i("$TAG At least a call, asking fragment to change status bar color")
changeSystemTopBarColorToInCallEvent.postValue(Event(true))
}
}

View file

@ -34,11 +34,14 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.annotation.AnyThread import androidx.annotation.AnyThread
import androidx.annotation.ColorInt
import androidx.annotation.ColorRes
import androidx.annotation.DimenRes import androidx.annotation.DimenRes
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.annotation.MainThread import androidx.annotation.MainThread
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import androidx.emoji2.text.EmojiCompat import androidx.emoji2.text.EmojiCompat
import java.util.Locale import java.util.Locale
@ -66,6 +69,14 @@ class AppUtils {
return coreContext.context.getString(id, args) return coreContext.context.getString(id, args)
} }
@AnyThread @ColorInt
fun getColor(@ColorRes colorId: Int): Int {
return ContextCompat.getColor(
coreContext.context,
colorId
)
}
@MainThread @MainThread
fun getPipRatio( fun getPipRatio(
activity: Activity, activity: Activity,

View file

@ -37,7 +37,6 @@ import androidx.annotation.UiThread
import androidx.appcompat.widget.AppCompatEditText import androidx.appcompat.widget.AppCompatEditText
import androidx.appcompat.widget.AppCompatTextView import androidx.appcompat.widget.AppCompatTextView
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsCompat
@ -214,12 +213,12 @@ fun ImageView.setPresenceIcon(presence: ConsolidatedPresence?) {
@BindingAdapter("tint") @BindingAdapter("tint")
fun ImageView.setTintColor(@ColorRes color: Int) { fun ImageView.setTintColor(@ColorRes color: Int) {
setColorFilter(ContextCompat.getColor(context, color), PorterDuff.Mode.SRC_IN) setColorFilter(AppUtils.getColor(color), PorterDuff.Mode.SRC_IN)
} }
@BindingAdapter("textColor") @BindingAdapter("textColor")
fun AppCompatTextView.setColor(@ColorRes color: Int) { fun AppCompatTextView.setColor(@ColorRes color: Int) {
setTextColor(ContextCompat.getColor(context, color)) setTextColor(AppUtils.getColor(color))
} }
@UiThread @UiThread

View file

@ -28,7 +28,6 @@ import android.view.LayoutInflater
import android.view.Window import android.view.Window
import android.view.WindowManager import android.view.WindowManager
import androidx.annotation.UiThread import androidx.annotation.UiThread
import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding import androidx.databinding.ViewDataBinding
import org.linphone.R import org.linphone.R
@ -269,7 +268,7 @@ class DialogUtils {
dialog.setContentView(binding.root) dialog.setContentView(binding.root)
val d: Drawable = ColorDrawable( val d: Drawable = ColorDrawable(
ContextCompat.getColor(dialog.context, R.color.gray_main2_800_alpha_65) AppUtils.getColor(R.color.gray_main2_800_alpha_65)
) )
// d.alpha = 166 // d.alpha = 166
dialog.window dialog.window

View file

@ -0,0 +1,6 @@
<?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:state_pressed="true" android:color="@color/white" />
<item android:color="@color/white"/>
</selector>

View file

@ -14,6 +14,9 @@
<variable <variable
name="callsListClickListener" name="callsListClickListener"
type="View.OnClickListener" /> type="View.OnClickListener" />
<variable
name="chatClickListener"
type="View.OnClickListener" />
<variable <variable
name="viewModel" name="viewModel"
type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" /> type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" />
@ -53,7 +56,7 @@
app:layout_constraintEnd_toEndOf="@id/transfer_label" app:layout_constraintEnd_toEndOf="@id/transfer_label"
app:layout_constraintStart_toStartOf="@id/transfer_label" app:layout_constraintStart_toStartOf="@id/transfer_label"
app:layout_constraintTop_toBottomOf="@id/main_actions" app:layout_constraintTop_toBottomOf="@id/main_actions"
app:tint="@color/white" /> app:tint="@color/in_call_button_tint_color" />
<ImageView <ImageView
android:id="@+id/new_call" android:id="@+id/new_call"
@ -68,7 +71,7 @@
app:layout_constraintEnd_toEndOf="@id/new_call_label" app:layout_constraintEnd_toEndOf="@id/new_call_label"
app:layout_constraintStart_toStartOf="@id/new_call_label" app:layout_constraintStart_toStartOf="@id/new_call_label"
app:layout_constraintTop_toBottomOf="@id/main_actions" app:layout_constraintTop_toBottomOf="@id/main_actions"
app:tint="@color/white" /> app:tint="@color/in_call_button_tint_color" />
<ImageView <ImageView
android:id="@+id/calls_list" android:id="@+id/calls_list"
@ -83,7 +86,7 @@
app:layout_constraintEnd_toEndOf="@id/calls_list_label" app:layout_constraintEnd_toEndOf="@id/calls_list_label"
app:layout_constraintStart_toStartOf="@id/calls_list_label" app:layout_constraintStart_toStartOf="@id/calls_list_label"
app:layout_constraintTop_toBottomOf="@id/main_actions" app:layout_constraintTop_toBottomOf="@id/main_actions"
app:tint="@color/white" /> app:tint="@color/in_call_button_tint_color" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style" style="@style/default_text_style"
@ -115,10 +118,11 @@
app:layout_constraintEnd_toEndOf="@id/dialer_label" app:layout_constraintEnd_toEndOf="@id/dialer_label"
app:layout_constraintStart_toStartOf="@id/dialer_label" app:layout_constraintStart_toStartOf="@id/dialer_label"
app:layout_constraintTop_toBottomOf="@id/main_actions" app:layout_constraintTop_toBottomOf="@id/main_actions"
app:tint="@color/white" /> app:tint="@color/in_call_button_tint_color" />
<ImageView <ImageView
android:id="@+id/chat" android:id="@+id/chat"
android:onClick="@{chatClickListener}"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/call_button_size" android:layout_height="@dimen/call_button_size"
android:layout_marginTop="@dimen/call_extra_button_top_margin" android:layout_marginTop="@dimen/call_extra_button_top_margin"
@ -129,7 +133,7 @@
app:layout_constraintEnd_toEndOf="@id/chat_label" app:layout_constraintEnd_toEndOf="@id/chat_label"
app:layout_constraintStart_toStartOf="@id/chat_label" app:layout_constraintStart_toStartOf="@id/chat_label"
app:layout_constraintTop_toBottomOf="@id/main_actions" app:layout_constraintTop_toBottomOf="@id/main_actions"
app:tint="@color/white" /> app:tint="@color/in_call_button_tint_color" />
<ImageView <ImageView
android:id="@+id/pause_call" android:id="@+id/pause_call"
@ -143,7 +147,7 @@
app:layout_constraintEnd_toEndOf="@id/pause_call_label" app:layout_constraintEnd_toEndOf="@id/pause_call_label"
app:layout_constraintStart_toStartOf="@id/pause_call_label" app:layout_constraintStart_toStartOf="@id/pause_call_label"
app:layout_constraintTop_toBottomOf="@id/main_actions" app:layout_constraintTop_toBottomOf="@id/main_actions"
app:tint="@color/white" /> app:tint="@color/in_call_button_tint_color" />
<ImageView <ImageView
android:id="@+id/record_call" android:id="@+id/record_call"
@ -159,7 +163,7 @@
app:layout_constraintEnd_toEndOf="@id/record_call_label" app:layout_constraintEnd_toEndOf="@id/record_call_label"
app:layout_constraintStart_toStartOf="@id/record_call_label" app:layout_constraintStart_toStartOf="@id/record_call_label"
app:layout_constraintTop_toBottomOf="@id/main_actions" app:layout_constraintTop_toBottomOf="@id/main_actions"
app:tint="@color/white" /> app:tint="@color/in_call_button_tint_color" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
style="@style/in_call_extra_action_label_style" style="@style/in_call_extra_action_label_style"

View file

@ -43,7 +43,7 @@
<include <include
android:id="@+id/top_bar" android:id="@+id/top_bar"
layout="@layout/main_activity_top_bar" layout="@layout/top_bar"
bind:viewModel="@{viewModel}" bind:viewModel="@{viewModel}"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height" android:layout_height="@dimen/top_bar_height"
@ -65,17 +65,6 @@
app:layout_constraintTop_toTopOf="@id/top_bar" app:layout_constraintTop_toTopOf="@id/top_bar"
app:layout_constraintBottom_toBottomOf="@id/top_bar" /> app:layout_constraintBottom_toBottomOf="@id/top_bar" />
<include
android:id="@+id/in_call_top_bar"
layout="@layout/main_activity_in_call_top_bar"
bind:viewModel="@{viewModel}"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:visibility="@{viewModel.atLastOneCall ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/bottom_nav_bar"
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView <ImageView
android:id="@+id/background" android:id="@+id/background"
android:layout_width="0dp" android:layout_width="0dp"

View file

@ -39,7 +39,7 @@
<include <include
android:id="@+id/top_bar" android:id="@+id/top_bar"
layout="@layout/main_activity_top_bar" layout="@layout/top_bar"
bind:viewModel="@{viewModel}" bind:viewModel="@{viewModel}"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height" android:layout_height="@dimen/top_bar_height"
@ -61,17 +61,6 @@
app:layout_constraintTop_toTopOf="@id/top_bar" app:layout_constraintTop_toTopOf="@id/top_bar"
app:layout_constraintBottom_toBottomOf="@id/top_bar" /> app:layout_constraintBottom_toBottomOf="@id/top_bar" />
<include
android:id="@+id/in_call_top_bar"
layout="@layout/main_activity_in_call_top_bar"
bind:viewModel="@{viewModel}"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:visibility="@{viewModel.atLastOneCall ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/bottom_nav_bar"
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView <ImageView
android:id="@+id/background" android:id="@+id/background"
android:layout_width="0dp" android:layout_width="0dp"

View file

@ -14,6 +14,9 @@
<variable <variable
name="callsListClickListener" name="callsListClickListener"
type="View.OnClickListener" /> type="View.OnClickListener" />
<variable
name="chatClickListener"
type="View.OnClickListener" />
<variable <variable
name="viewModel" name="viewModel"
type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" /> type="org.linphone.ui.call.viewmodel.CurrentCallViewModel" />
@ -49,7 +52,7 @@
android:padding="@dimen/call_button_icon_padding" android:padding="@dimen/call_button_icon_padding"
android:background="@drawable/in_call_button_background" android:background="@drawable/in_call_button_background"
android:src="@drawable/transfer" android:src="@drawable/transfer"
app:tint="@color/white" app:tint="@color/in_call_button_tint_color"
app:layout_constraintDimensionRatio="1:1" app:layout_constraintDimensionRatio="1:1"
app:layout_constraintStart_toStartOf="@id/transfer_label" app:layout_constraintStart_toStartOf="@id/transfer_label"
app:layout_constraintEnd_toEndOf="@id/transfer_label" app:layout_constraintEnd_toEndOf="@id/transfer_label"
@ -64,7 +67,7 @@
android:padding="@dimen/call_button_icon_padding" android:padding="@dimen/call_button_icon_padding"
android:background="@drawable/in_call_button_background" android:background="@drawable/in_call_button_background"
android:src="@drawable/phone_plus" android:src="@drawable/phone_plus"
app:tint="@color/white" app:tint="@color/in_call_button_tint_color"
app:layout_constraintDimensionRatio="1:1" app:layout_constraintDimensionRatio="1:1"
app:layout_constraintStart_toStartOf="@id/new_call_label" app:layout_constraintStart_toStartOf="@id/new_call_label"
app:layout_constraintEnd_toEndOf="@id/new_call_label" app:layout_constraintEnd_toEndOf="@id/new_call_label"
@ -79,7 +82,7 @@
android:padding="@dimen/call_button_icon_padding" android:padding="@dimen/call_button_icon_padding"
android:background="@drawable/in_call_button_background" android:background="@drawable/in_call_button_background"
android:src="@drawable/calls_list" android:src="@drawable/calls_list"
app:tint="@color/white" app:tint="@color/in_call_button_tint_color"
app:layout_constraintDimensionRatio="1:1" app:layout_constraintDimensionRatio="1:1"
app:layout_constraintStart_toStartOf="@id/calls_list_label" app:layout_constraintStart_toStartOf="@id/calls_list_label"
app:layout_constraintEnd_toEndOf="@id/calls_list_label" app:layout_constraintEnd_toEndOf="@id/calls_list_label"
@ -111,7 +114,7 @@
android:padding="@dimen/call_button_icon_padding" android:padding="@dimen/call_button_icon_padding"
android:background="@drawable/in_call_button_background" android:background="@drawable/in_call_button_background"
android:src="@drawable/dialer" android:src="@drawable/dialer"
app:tint="@color/white" app:tint="@color/in_call_button_tint_color"
app:layout_constraintDimensionRatio="1:1" app:layout_constraintDimensionRatio="1:1"
app:layout_constraintStart_toStartOf="@id/dialer_label" app:layout_constraintStart_toStartOf="@id/dialer_label"
app:layout_constraintEnd_toEndOf="@id/dialer_label" app:layout_constraintEnd_toEndOf="@id/dialer_label"
@ -119,13 +122,14 @@
<ImageView <ImageView
android:id="@+id/chat" android:id="@+id/chat"
android:onClick="@{chatClickListener}"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/call_button_size" android:layout_height="@dimen/call_button_size"
android:layout_marginTop="@dimen/call_extra_button_top_margin" android:layout_marginTop="@dimen/call_extra_button_top_margin"
android:padding="@dimen/call_button_icon_padding" android:padding="@dimen/call_button_icon_padding"
android:background="@drawable/in_call_button_background" android:background="@drawable/in_call_button_background"
android:src="@drawable/chat_dots" android:src="@drawable/chat_dots"
app:tint="@color/white" app:tint="@color/in_call_button_tint_color"
app:layout_constraintDimensionRatio="1:1" app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/transfer_label" app:layout_constraintTop_toBottomOf="@id/transfer_label"
app:layout_constraintStart_toStartOf="@id/transfer" app:layout_constraintStart_toStartOf="@id/transfer"
@ -139,7 +143,7 @@
android:padding="@dimen/call_button_icon_padding" android:padding="@dimen/call_button_icon_padding"
android:background="@drawable/in_call_button_background" android:background="@drawable/in_call_button_background"
android:src="@drawable/pause_call" android:src="@drawable/pause_call"
app:tint="@color/white" app:tint="@color/in_call_button_tint_color"
app:layout_constraintDimensionRatio="1:1" app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/new_call_label" app:layout_constraintTop_toBottomOf="@id/new_call_label"
app:layout_constraintStart_toStartOf="@id/new_call" app:layout_constraintStart_toStartOf="@id/new_call"
@ -155,7 +159,7 @@
android:background="@drawable/in_call_button_background" android:background="@drawable/in_call_button_background"
android:src="@drawable/record" android:src="@drawable/record"
android:selected="@{viewModel.isRecording()}" android:selected="@{viewModel.isRecording()}"
app:tint="@color/white" app:tint="@color/in_call_button_tint_color"
app:layout_constraintDimensionRatio="1:1" app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@id/calls_list_label" app:layout_constraintTop_toBottomOf="@id/calls_list_label"
app:layout_constraintStart_toStartOf="@id/calls_list" app:layout_constraintStart_toStartOf="@id/calls_list"

View file

@ -55,7 +55,7 @@
android:padding="@dimen/call_button_icon_padding" android:padding="@dimen/call_button_icon_padding"
android:src="@{viewModel.isVideoEnabled() ? @drawable/video_camera : @drawable/video_camera_slash, default=@drawable/video_camera}" android:src="@{viewModel.isVideoEnabled() ? @drawable/video_camera : @drawable/video_camera_slash, default=@drawable/video_camera}"
android:background="@drawable/in_call_button_background" android:background="@drawable/in_call_button_background"
app:tint="@color/white" app:tint="@color/in_call_button_tint_color"
app:layout_constraintHorizontal_bias="1" app:layout_constraintHorizontal_bias="1"
app:layout_constraintHorizontal_chainStyle="packed" app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
@ -71,7 +71,7 @@
android:padding="@dimen/call_button_icon_padding" android:padding="@dimen/call_button_icon_padding"
android:src="@{viewModel.isMicrophoneMuted ? @drawable/microphone_slash : @drawable/microphone, default=@drawable/microphone}" android:src="@{viewModel.isMicrophoneMuted ? @drawable/microphone_slash : @drawable/microphone, default=@drawable/microphone}"
android:background="@drawable/in_call_button_background" android:background="@drawable/in_call_button_background"
app:tint="@color/white" app:tint="@color/in_call_button_tint_color"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/toggle_video" app:layout_constraintStart_toEndOf="@id/toggle_video"
app:layout_constraintEnd_toStartOf="@id/change_audio_output" /> app:layout_constraintEnd_toStartOf="@id/change_audio_output" />
@ -85,7 +85,7 @@
android:padding="@dimen/call_button_icon_padding" android:padding="@dimen/call_button_icon_padding"
android:src="@{viewModel.isHeadsetEnabled ? @drawable/headset : viewModel.isBluetoothEnabled ? @drawable/bluetooth : viewModel.isSpeakerEnabled ? @drawable/speaker_high : @drawable/speaker_slash, default=@drawable/speaker_slash}" android:src="@{viewModel.isHeadsetEnabled ? @drawable/headset : viewModel.isBluetoothEnabled ? @drawable/bluetooth : viewModel.isSpeakerEnabled ? @drawable/speaker_high : @drawable/speaker_slash, default=@drawable/speaker_slash}"
android:background="@drawable/in_call_button_background" android:background="@drawable/in_call_button_background"
app:tint="@color/white" app:tint="@color/in_call_button_tint_color"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/toggle_mute_mic" app:layout_constraintStart_toEndOf="@id/toggle_mute_mic"
app:layout_constraintEnd_toEndOf="parent" /> app:layout_constraintEnd_toEndOf="parent" />

View file

@ -33,7 +33,7 @@
<include <include
android:id="@+id/top_bar" android:id="@+id/top_bar"
layout="@layout/main_activity_top_bar" layout="@layout/top_bar"
bind:viewModel="@{viewModel}" bind:viewModel="@{viewModel}"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height" android:layout_height="@dimen/top_bar_height"
@ -55,17 +55,6 @@
app:layout_constraintTop_toTopOf="@id/top_bar" app:layout_constraintTop_toTopOf="@id/top_bar"
app:layout_constraintBottom_toBottomOf="@id/top_bar" /> app:layout_constraintBottom_toBottomOf="@id/top_bar" />
<include
android:id="@+id/in_call_top_bar"
layout="@layout/main_activity_in_call_top_bar"
bind:viewModel="@{viewModel}"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:visibility="@{viewModel.atLastOneCall ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView <ImageView
android:id="@+id/background" android:id="@+id/background"
android:layout_width="0dp" android:layout_width="0dp"

View file

@ -39,7 +39,7 @@
<include <include
android:id="@+id/top_bar" android:id="@+id/top_bar"
layout="@layout/main_activity_top_bar" layout="@layout/top_bar"
bind:viewModel="@{viewModel}" bind:viewModel="@{viewModel}"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height" android:layout_height="@dimen/top_bar_height"
@ -61,17 +61,6 @@
app:layout_constraintTop_toTopOf="@id/top_bar" app:layout_constraintTop_toTopOf="@id/top_bar"
app:layout_constraintBottom_toBottomOf="@id/top_bar" /> app:layout_constraintBottom_toBottomOf="@id/top_bar" />
<include
android:id="@+id/in_call_top_bar"
layout="@layout/main_activity_in_call_top_bar"
bind:viewModel="@{viewModel}"
android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height"
android:visibility="@{viewModel.atLastOneCall ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<ImageView <ImageView
android:id="@+id/background" android:id="@+id/background"
android:layout_width="0dp" android:layout_width="0dp"

View file

@ -5,6 +5,9 @@
<data> <data>
<import type="android.view.View" /> <import type="android.view.View" />
<variable
name="viewModel"
type="org.linphone.ui.main.viewmodel.MainViewModel" />
</data> </data>
<androidx.drawerlayout.widget.DrawerLayout <androidx.drawerlayout.widget.DrawerLayout
@ -19,6 +22,17 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<include
android:id="@+id/in_call_top_bar"
layout="@layout/main_activity_in_call_top_bar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="@{viewModel.atLastOneCall ? View.VISIBLE : View.GONE, default=gone}"
app:viewModel="@{viewModel}"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<androidx.fragment.app.FragmentContainerView <androidx.fragment.app.FragmentContainerView
android:id="@+id/main_nav_host_fragment" android:id="@+id/main_nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment" android:name="androidx.navigation.fragment.NavHostFragment"
@ -28,7 +42,7 @@
app:navGraph="@navigation/main_nav_graph" app:navGraph="@navigation/main_nav_graph"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toBottomOf="@id/in_call_top_bar"
app:layout_constraintBottom_toBottomOf="parent"/> app:layout_constraintBottom_toBottomOf="parent"/>
<LinearLayout <LinearLayout

View file

@ -7,12 +7,12 @@
<import type="android.view.View" /> <import type="android.view.View" />
<variable <variable
name="viewModel" name="viewModel"
type="org.linphone.ui.main.viewmodel.AbstractTopBarViewModel" /> type="org.linphone.ui.main.viewmodel.MainViewModel" />
</data> </data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/top_bar_height" android:layout_height="wrap_content"
android:background="@color/green_success_500" android:background="@color/green_success_500"
android:onClick="@{() -> viewModel.goBackToCall()}"> android:onClick="@{() -> viewModel.goBackToCall()}">
@ -20,9 +20,11 @@
style="@style/default_text_style_800" style="@style/default_text_style_800"
android:id="@+id/call_display_name" android:id="@+id/call_display_name"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/top_bar_height" android:layout_height="wrap_content"
android:layout_marginStart="20dp" android:layout_marginStart="16dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@{viewModel.callDisplayName, default=`John Doe`}" android:text="@{viewModel.callDisplayName, default=`John Doe`}"
android:textColor="@color/white" android:textColor="@color/white"
@ -32,21 +34,23 @@
android:drawableTint="@color/white" android:drawableTint="@color/white"
app:layout_constraintEnd_toStartOf="@id/call_time" app:layout_constraintEnd_toStartOf="@id/call_time"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style" style="@style/default_text_style"
android:id="@+id/call_time" android:id="@+id/call_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/top_bar_height" android:layout_height="wrap_content"
android:layout_marginEnd="10dp" android:layout_marginEnd="16dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@{viewModel.callStatus, default=`Paused`}" android:text="@{viewModel.callStatus, default=`Paused`}"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="14sp" android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/call_display_name" app:layout_constraintStart_toEndOf="@id/call_display_name"
app:layout_constraintTop_toTopOf="parent"/> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>