Started outgoing calls

This commit is contained in:
Sylvain Berfini 2023-08-09 14:56:26 +02:00
parent c2292fdadc
commit 68c132b003
94 changed files with 875 additions and 182 deletions

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="SERIAL_NUMBER" />
<value value="1A051FDEE005XG" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-08-09T11:27:31.853441068Z" />
</component>
</project>

View file

@ -18,7 +18,7 @@
tools:targetApi="34">
<activity
android:name=".ui.MainActivity"
android:name=".ui.main.MainActivity"
android:windowSoftInputMode="adjustResize"
android:exported="true"
android:label="@string/app_name">
@ -30,6 +30,14 @@
</activity>
<activity
android:name=".ui.voip.VoipActivity"
android:launchMode="singleTask"
android:turnScreenOn="true"
android:showWhenLocked="true"
android:resizeableActivity="true"
android:supportsPictureInPicture="true" />
<!-- Services -->
<service android:name="org.linphone.core.tools.firebase.FirebaseMessaging"

View file

@ -81,8 +81,8 @@ class ContactLoader : LoaderManager.LoaderCallbacks<Cursor> {
}
Log.i("[Contacts Loader] Load finished, found ${cursor.count} entries in cursor")
val core = coreContext.core
if (core.globalState == GlobalState.Shutdown || core.globalState == GlobalState.Off) {
val state = coreContext.core.globalState
if (state == GlobalState.Shutdown || state == GlobalState.Off) {
Log.w("[Contacts Loader] Core is being stopped or already destroyed, abort")
return
}

View file

@ -22,7 +22,7 @@ package org.linphone.contacts
import androidx.loader.app.LoaderManager
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.core.Friend
import org.linphone.ui.MainActivity
import org.linphone.ui.main.MainActivity
class ContactsManager {
private val listeners = arrayListOf<ContactsListener>()

View file

@ -21,6 +21,7 @@ package org.linphone.core
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.os.Handler
import android.os.HandlerThread
import android.os.Looper
@ -30,6 +31,7 @@ import org.linphone.BuildConfig
import org.linphone.LinphoneApplication.Companion.corePreferences
import org.linphone.contacts.ContactsManager
import org.linphone.core.tools.Log
import org.linphone.ui.voip.VoipActivity
class CoreContext(val context: Context) : HandlerThread("Core Thread") {
lateinit var core: Core
@ -47,6 +49,18 @@ class CoreContext(val context: Context) : HandlerThread("Core Thread") {
override fun onGlobalStateChanged(core: Core, state: GlobalState, message: String) {
Log.i("[Context] Global state changed: $state")
}
override fun onCallStateChanged(
core: Core,
call: Call,
state: Call.State?,
message: String
) {
Log.i("[Context] Call state changed [$state]")
if (state == Call.State.OutgoingProgress) {
showCallActivity()
}
}
}
init {
@ -109,6 +123,67 @@ class CoreContext(val context: Context) : HandlerThread("Core Thread") {
}
}
fun startCall(
address: Address,
callParams: CallParams? = null,
forceZRTP: Boolean = false,
localAddress: Address? = null
) {
if (!core.isNetworkReachable) {
Log.e("[Context] Network unreachable, abort outgoing call")
return
}
val params = callParams ?: core.createCallParams(null)
if (params == null) {
val call = core.inviteAddress(address)
Log.w("[Context] Starting call $call without params")
return
}
if (forceZRTP) {
params.mediaEncryption = MediaEncryption.ZRTP
}
/*if (LinphoneUtils.checkIfNetworkHasLowBandwidth(context)) {
Log.w("[Context] Enabling low bandwidth mode!")
params.isLowBandwidthEnabled = true
}
params.recordFile = LinphoneUtils.getRecordingFilePathForAddress(address)*/
if (localAddress != null) {
val account = core.accountList.find { account ->
account.params.identityAddress?.weakEqual(localAddress) ?: false
}
if (account != null) {
params.account = account
Log.i(
"[Context] Using account matching address ${localAddress.asStringUriOnly()} as From"
)
} else {
Log.e(
"[Context] Failed to find account matching address ${localAddress.asStringUriOnly()}"
)
}
}
/*if (corePreferences.sendEarlyMedia) {
params.isEarlyMediaSendingEnabled = true
}*/
val call = core.inviteAddressWithParams(address, params)
Log.i("[Context] Starting call $call")
}
private fun showCallActivity() {
Log.i("[Context] Starting VoIP activity")
val intent = Intent(context, VoipActivity::class.java)
// This flag is required to start an Activity from a Service context
intent.addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
)
context.startActivity(intent)
}
private fun computeUserAgent() {
// TODO FIXME
val deviceName: String = "Linphone6"

View file

@ -17,7 +17,7 @@
* 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
package org.linphone.ui.main
import android.Manifest
import android.content.pm.PackageManager

View file

@ -17,7 +17,7 @@
* 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.calls.fragment
package org.linphone.ui.main.calls.fragment
import android.os.Bundle
import android.view.LayoutInflater
@ -29,7 +29,7 @@ import androidx.navigation.fragment.findNavController
import androidx.slidingpanelayout.widget.SlidingPaneLayout
import org.linphone.R
import org.linphone.databinding.CallsFragmentBinding
import org.linphone.ui.fragment.GenericFragment
import org.linphone.ui.main.fragment.GenericFragment
import org.linphone.utils.SlidingPaneBackPressedCallback
class CallsFragment : GenericFragment() {

View file

@ -17,7 +17,7 @@
* 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.calls.fragment
package org.linphone.ui.main.calls.fragment
import android.content.res.Configuration
import android.os.Bundle
@ -30,9 +30,9 @@ import androidx.navigation.fragment.findNavController
import androidx.navigation.navGraphViewModels
import org.linphone.R
import org.linphone.databinding.CallsListFragmentBinding
import org.linphone.ui.MainActivity
import org.linphone.ui.calls.viewmodel.CallsListViewModel
import org.linphone.ui.fragment.GenericFragment
import org.linphone.ui.main.MainActivity
import org.linphone.ui.main.calls.viewmodel.CallsListViewModel
import org.linphone.ui.main.fragment.GenericFragment
import org.linphone.utils.setKeyboardInsetListener
class CallsListFragment : GenericFragment() {

View file

@ -17,7 +17,7 @@
* 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.calls.fragment
package org.linphone.ui.main.calls.fragment
import com.google.android.material.bottomsheet.BottomSheetDialogFragment

View file

@ -17,7 +17,7 @@
* 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.calls.fragment
package org.linphone.ui.main.calls.fragment
import androidx.fragment.app.Fragment

View file

@ -17,9 +17,9 @@
* 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.calls.viewmodel
package org.linphone.ui.main.calls.viewmodel
import org.linphone.ui.viewmodel.TopBarViewModel
import org.linphone.ui.main.viewmodel.TopBarViewModel
class CallsListViewModel : TopBarViewModel() {
init {

View file

@ -1,4 +1,4 @@
package org.linphone.ui.contacts.adapter
package org.linphone.ui.main.contacts.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
@ -11,7 +11,7 @@ import androidx.recyclerview.widget.RecyclerView
import org.linphone.R
import org.linphone.databinding.ContactFavouriteListCellBinding
import org.linphone.databinding.ContactListCellBinding
import org.linphone.ui.contacts.model.ContactModel
import org.linphone.ui.main.contacts.model.ContactModel
import org.linphone.utils.Event
class ContactsListAdapter(

View file

@ -17,7 +17,7 @@
* 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.contacts.fragment
package org.linphone.ui.main.contacts.fragment
import android.os.Bundle
import android.view.LayoutInflater
@ -29,9 +29,9 @@ import androidx.navigation.fragment.navArgs
import androidx.transition.ChangeBounds
import org.linphone.core.tools.Log
import org.linphone.databinding.ContactFragmentBinding
import org.linphone.ui.contacts.model.NumberOrAddressPickerDialogModel
import org.linphone.ui.contacts.viewmodel.ContactViewModel
import org.linphone.ui.fragment.GenericFragment
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

View file

@ -17,7 +17,7 @@
* 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.contacts.fragment
package org.linphone.ui.main.contacts.fragment
import android.content.DialogInterface
import android.os.Bundle

View file

@ -17,7 +17,7 @@
* 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.contacts.fragment
package org.linphone.ui.main.contacts.fragment
import android.os.Bundle
import android.view.LayoutInflater
@ -30,7 +30,7 @@ import androidx.slidingpanelayout.widget.SlidingPaneLayout
import org.linphone.R
import org.linphone.core.tools.Log
import org.linphone.databinding.ContactsFragmentBinding
import org.linphone.ui.fragment.GenericFragment
import org.linphone.ui.main.fragment.GenericFragment
import org.linphone.utils.SlidingPaneBackPressedCallback
class ContactsFragment : GenericFragment() {

View file

@ -17,7 +17,7 @@
* 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.contacts.fragment
package org.linphone.ui.main.contacts.fragment
import android.content.res.Configuration
import android.os.Bundle
@ -32,10 +32,10 @@ import androidx.navigation.navGraphViewModels
import androidx.recyclerview.widget.LinearLayoutManager
import org.linphone.R
import org.linphone.databinding.ContactsListFragmentBinding
import org.linphone.ui.MainActivity
import org.linphone.ui.contacts.adapter.ContactsListAdapter
import org.linphone.ui.contacts.viewmodel.ContactsListViewModel
import org.linphone.ui.fragment.GenericFragment
import org.linphone.ui.main.MainActivity
import org.linphone.ui.main.contacts.adapter.ContactsListAdapter
import org.linphone.ui.main.contacts.viewmodel.ContactsListViewModel
import org.linphone.ui.main.fragment.GenericFragment
import org.linphone.utils.Event
import org.linphone.utils.hideKeyboard
import org.linphone.utils.setKeyboardInsetListener

View file

@ -17,7 +17,7 @@
* 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.contacts.fragment
package org.linphone.ui.main.contacts.fragment
import android.content.DialogInterface
import android.os.Bundle

View file

@ -17,7 +17,7 @@
* 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.contacts.fragment
package org.linphone.ui.main.contacts.fragment
import android.os.Bundle
import android.view.LayoutInflater
@ -25,7 +25,7 @@ import android.view.View
import android.view.ViewGroup
import androidx.navigation.fragment.findNavController
import org.linphone.databinding.NewContactFragmentBinding
import org.linphone.ui.fragment.GenericFragment
import org.linphone.ui.main.fragment.GenericFragment
class NewContactFragment : GenericFragment() {
private lateinit var binding: NewContactFragmentBinding

View file

@ -17,7 +17,7 @@
* 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.contacts.model
package org.linphone.ui.main.contacts.model
class ContactDeviceModel(
val name: String,

View file

@ -17,7 +17,7 @@
* 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.contacts.model
package org.linphone.ui.main.contacts.model
import android.content.ContentUris
import android.net.Uri

View file

@ -17,7 +17,7 @@
* 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.contacts.model
package org.linphone.ui.main.contacts.model
import androidx.lifecycle.MutableLiveData
import org.linphone.core.Address
@ -31,19 +31,8 @@ class ContactNumberOrAddressModel(
) {
val selected = MutableLiveData<Boolean>()
fun startCall() {
address ?: return
listener.onCall(address)
}
fun startVideoCall() {
address ?: return
listener.onVideoCall(address)
}
fun startChat(secured: Boolean) {
address ?: return
listener.onChat(address)
fun onClicked() {
listener.onClicked(address)
}
fun onLongPress(): Boolean {
@ -54,11 +43,7 @@ class ContactNumberOrAddressModel(
}
interface ContactNumberOrAddressClickListener {
fun onCall(address: Address)
fun onVideoCall(address: Address)
fun onChat(address: Address)
fun onClicked(address: Address?)
fun onLongPress(model: ContactNumberOrAddressModel)
}

View file

@ -17,11 +17,11 @@
* 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.contacts.model
package org.linphone.ui.main.contacts.model
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import org.linphone.ui.contacts.viewmodel.ContactViewModel
import org.linphone.ui.main.contacts.viewmodel.ContactViewModel
import org.linphone.utils.Event
class NumberOrAddressPickerDialogModel(viewModel: ContactViewModel) : ViewModel() {
@ -31,6 +31,7 @@ class NumberOrAddressPickerDialogModel(viewModel: ContactViewModel) : ViewModel(
init {
sipAddressesAndPhoneNumbers.value = viewModel.sipAddressesAndPhoneNumbers.value
// TODO: set listener
}
fun dismiss() {

View file

@ -17,16 +17,16 @@
* 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.contacts.viewmodel
package org.linphone.ui.main.contacts.viewmodel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.core.Address
import org.linphone.ui.contacts.model.ContactDeviceModel
import org.linphone.ui.contacts.model.ContactModel
import org.linphone.ui.contacts.model.ContactNumberOrAddressClickListener
import org.linphone.ui.contacts.model.ContactNumberOrAddressModel
import org.linphone.ui.main.contacts.model.ContactDeviceModel
import org.linphone.ui.main.contacts.model.ContactModel
import org.linphone.ui.main.contacts.model.ContactNumberOrAddressClickListener
import org.linphone.ui.main.contacts.model.ContactNumberOrAddressModel
import org.linphone.utils.Event
class ContactViewModel : ViewModel() {
@ -57,16 +57,13 @@ class ContactViewModel : ViewModel() {
}
val listener = object : ContactNumberOrAddressClickListener {
override fun onCall(address: Address) {
// UI thread
}
override fun onVideoCall(address: Address) {
// UI thread
}
override fun onChat(address: Address) {
override fun onClicked(address: Address?) {
// UI thread
if (address != null) {
coreContext.postOnCoreThread {
coreContext.startCall(address)
}
}
}
override fun onLongPress(model: ContactNumberOrAddressModel) {
@ -138,16 +135,32 @@ class ContactViewModel : ViewModel() {
}
fun startAudioCall() {
if (sipAddressesAndPhoneNumbers.value.orEmpty().size == 1) {
// TODO
val numbersAndAddresses = sipAddressesAndPhoneNumbers.value.orEmpty()
if (numbersAndAddresses.size == 1) {
val address = numbersAndAddresses.first().address
if (address != null) {
coreContext.postOnCoreThread { core ->
val params = core.createCallParams(null)
params?.isVideoEnabled = false
coreContext.startCall(address, params)
}
}
} else {
showNumberOrAddressPickerDialogEvent.value = Event(true)
}
}
fun startVideoCall() {
if (sipAddressesAndPhoneNumbers.value.orEmpty().size == 1) {
// TODO
val numbersAndAddresses = sipAddressesAndPhoneNumbers.value.orEmpty()
if (numbersAndAddresses.size == 1) {
val address = numbersAndAddresses.first().address
if (address != null) {
coreContext.postOnCoreThread { core ->
val params = core.createCallParams(null)
params?.isVideoEnabled = true
coreContext.startCall(address, params)
}
}
} else {
showNumberOrAddressPickerDialogEvent.value = Event(true)
}

View file

@ -17,7 +17,7 @@
* 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.contacts.viewmodel
package org.linphone.ui.main.contacts.viewmodel
import androidx.lifecycle.MutableLiveData
import java.util.ArrayList
@ -28,8 +28,8 @@ 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.contacts.model.ContactModel
import org.linphone.ui.viewmodel.TopBarViewModel
import org.linphone.ui.main.contacts.model.ContactModel
import org.linphone.ui.main.viewmodel.TopBarViewModel
class ContactsListViewModel : TopBarViewModel() {
val contactsList = MutableLiveData<ArrayList<ContactModel>>()

View file

@ -17,7 +17,7 @@
* 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.conversations
package org.linphone.ui.main.conversations
import android.os.Bundle
import android.view.LayoutInflater
@ -29,8 +29,8 @@ import androidx.navigation.navGraphViewModels
import androidx.recyclerview.widget.LinearLayoutManager
import org.linphone.R
import org.linphone.databinding.ConversationFragmentBinding
import org.linphone.ui.conversations.adapter.ChatEventLogsListAdapter
import org.linphone.ui.conversations.viewmodel.ConversationViewModel
import org.linphone.ui.main.conversations.adapter.ChatEventLogsListAdapter
import org.linphone.ui.main.conversations.viewmodel.ConversationViewModel
class ConversationFragment : Fragment() {
private lateinit var binding: ConversationFragmentBinding

View file

@ -17,7 +17,7 @@
* 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.conversations
package org.linphone.ui.main.conversations
import android.content.DialogInterface
import android.os.Bundle

View file

@ -17,7 +17,7 @@
* 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.conversations
package org.linphone.ui.main.conversations
import android.os.Bundle
import android.view.LayoutInflater
@ -35,8 +35,8 @@ import androidx.recyclerview.widget.RecyclerView
import androidx.transition.AutoTransition
import org.linphone.R
import org.linphone.databinding.ConversationsFragmentBinding
import org.linphone.ui.conversations.adapter.ConversationsListAdapter
import org.linphone.ui.conversations.viewmodel.ConversationsListViewModel
import org.linphone.ui.main.conversations.adapter.ConversationsListAdapter
import org.linphone.ui.main.conversations.viewmodel.ConversationsListViewModel
import org.linphone.utils.hideKeyboard
import org.linphone.utils.showKeyboard

View file

@ -17,7 +17,7 @@
* 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.conversations
package org.linphone.ui.main.conversations
import android.os.Bundle
import android.view.LayoutInflater
@ -34,7 +34,7 @@ import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.R
import org.linphone.contacts.ContactsSelectionAdapter
import org.linphone.databinding.NewConversationFragmentBinding
import org.linphone.ui.conversations.viewmodel.NewConversationViewModel
import org.linphone.ui.main.conversations.viewmodel.NewConversationViewModel
class NewConversationFragment : Fragment() {
private lateinit var binding: NewConversationFragmentBinding

View file

@ -1,4 +1,4 @@
package org.linphone.ui.conversations.adapter
package org.linphone.ui.main.conversations.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
@ -12,9 +12,9 @@ import org.linphone.core.ChatMessage
import org.linphone.databinding.ChatBubbleIncomingBinding
import org.linphone.databinding.ChatBubbleOutgoingBinding
import org.linphone.databinding.ChatEventBinding
import org.linphone.ui.conversations.data.ChatMessageData
import org.linphone.ui.conversations.data.EventData
import org.linphone.ui.conversations.data.EventLogData
import org.linphone.ui.main.conversations.data.ChatMessageData
import org.linphone.ui.main.conversations.data.EventData
import org.linphone.ui.main.conversations.data.EventLogData
class ChatEventLogsListAdapter(
private val viewLifecycleOwner: LifecycleOwner

View file

@ -1,4 +1,4 @@
package org.linphone.ui.conversations.adapter
package org.linphone.ui.main.conversations.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
@ -10,8 +10,8 @@ import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import org.linphone.R
import org.linphone.databinding.ChatRoomListCellBinding
import org.linphone.ui.conversations.data.ChatRoomData
import org.linphone.ui.conversations.data.ChatRoomDataListener
import org.linphone.ui.main.conversations.data.ChatRoomData
import org.linphone.ui.main.conversations.data.ChatRoomDataListener
import org.linphone.utils.Event
class ConversationsListAdapter(

View file

@ -17,7 +17,7 @@
* 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.conversations.data
package org.linphone.ui.main.conversations.data
import androidx.lifecycle.MutableLiveData
import org.linphone.R

View file

@ -17,7 +17,7 @@
* 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.conversations.data
package org.linphone.ui.main.conversations.data
import androidx.lifecycle.MutableLiveData
import java.lang.StringBuilder

View file

@ -17,7 +17,7 @@
* 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.conversations.data
package org.linphone.ui.main.conversations.data
import org.linphone.core.EventLog

View file

@ -17,7 +17,7 @@
* 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.conversations.data
package org.linphone.ui.main.conversations.data
import org.linphone.core.EventLog

View file

@ -17,7 +17,7 @@
* 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.conversations.view
package org.linphone.ui.main.conversations.view
import android.content.Context
import android.text.Layout

View file

@ -17,7 +17,7 @@
* 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.conversations.viewmodel
package org.linphone.ui.main.conversations.viewmodel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
@ -30,7 +30,7 @@ import org.linphone.core.ChatRoomListenerStub
import org.linphone.core.EventLog
import org.linphone.core.Factory
import org.linphone.core.tools.Log
import org.linphone.ui.conversations.data.EventLogData
import org.linphone.ui.main.conversations.data.EventLogData
import org.linphone.utils.LinphoneUtils
class ConversationViewModel : ViewModel() {

View file

@ -17,7 +17,7 @@
* 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.conversations.viewmodel
package org.linphone.ui.main.conversations.viewmodel
import androidx.lifecycle.MutableLiveData
import java.util.ArrayList
@ -28,8 +28,8 @@ import org.linphone.core.ChatRoom
import org.linphone.core.Core
import org.linphone.core.CoreListenerStub
import org.linphone.core.tools.Log
import org.linphone.ui.conversations.data.ChatRoomData
import org.linphone.ui.viewmodel.TopBarViewModel
import org.linphone.ui.main.conversations.data.ChatRoomData
import org.linphone.ui.main.viewmodel.TopBarViewModel
import org.linphone.utils.Event
import org.linphone.utils.LinphoneUtils

View file

@ -17,7 +17,7 @@
* 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.conversations.viewmodel
package org.linphone.ui.main.conversations.viewmodel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

View file

@ -17,7 +17,7 @@
* 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.fragment
package org.linphone.ui.main.fragment
import android.os.Bundle
import android.view.LayoutInflater
@ -27,7 +27,7 @@ import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import org.linphone.R
import org.linphone.databinding.BottomNavBarBinding
import org.linphone.ui.viewmodel.SharedMainViewModel
import org.linphone.ui.main.viewmodel.SharedMainViewModel
import org.linphone.utils.Event
class BottomNavBarFragment : Fragment() {

View file

@ -17,7 +17,7 @@
* 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.fragment
package org.linphone.ui.main.fragment
import android.os.Bundle
import android.view.LayoutInflater

View file

@ -17,7 +17,7 @@
* 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.fragment
package org.linphone.ui.main.fragment
import android.os.Bundle
import android.view.View
@ -28,7 +28,7 @@ import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import org.linphone.R
import org.linphone.core.tools.Log
import org.linphone.ui.viewmodel.SharedMainViewModel
import org.linphone.ui.main.viewmodel.SharedMainViewModel
abstract class GenericFragment : Fragment() {
protected lateinit var sharedViewModel: SharedMainViewModel

View file

@ -17,7 +17,7 @@
* 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.viewmodel
package org.linphone.ui.main.viewmodel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

View file

@ -17,7 +17,7 @@
* 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.viewmodel
package org.linphone.ui.main.viewmodel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

View file

@ -0,0 +1,66 @@
/*
* 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.voip
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.WindowCompat
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ViewModelProvider
import org.linphone.LinphoneApplication
import org.linphone.R
import org.linphone.databinding.VoipActivityBinding
import org.linphone.ui.voip.viewmodel.CallsViewModel
class VoipActivity : AppCompatActivity() {
private lateinit var binding: VoipActivityBinding
private lateinit var callViewModel: CallsViewModel
override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, true)
super.onCreate(savedInstanceState)
val inCallBlackColor = ContextCompat.getColor(
this,
R.color.in_call_black
)
window.statusBarColor = inCallBlackColor
window.navigationBarColor = inCallBlackColor
while (!LinphoneApplication.coreContext.isReady()) {
Thread.sleep(20)
}
binding = DataBindingUtil.setContentView(this, R.layout.voip_activity)
binding.lifecycleOwner = this
callViewModel = run {
ViewModelProvider(this)[CallsViewModel::class.java]
}
callViewModel.noMoreCallEvent.observe(this) {
it.consume {
finish()
}
}
}
}

View file

@ -0,0 +1,57 @@
/*
* 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.voip.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.ViewModelProvider
import org.linphone.databinding.VoipOutgoingCallFragmentBinding
import org.linphone.ui.main.fragment.GenericFragment
import org.linphone.ui.voip.viewmodel.CallViewModel
class OutgoingCallFragment : GenericFragment() {
private lateinit var binding: VoipOutgoingCallFragmentBinding
private lateinit var callViewModel: CallViewModel
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
binding = VoipOutgoingCallFragmentBinding.inflate(layoutInflater)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
callViewModel = requireActivity().run {
ViewModelProvider(this)[CallViewModel::class.java]
}
binding.lifecycleOwner = viewLifecycleOwner
binding.viewModel = callViewModel
binding.chronometer.start()
}
}

View file

@ -0,0 +1,65 @@
/*
* 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.voip.viewmodel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.core.Call
import org.linphone.core.tools.Log
class CallViewModel() : ViewModel() {
companion object {
const val TAG = "[Call ViewModel]"
}
val videoEnabled = MutableLiveData<Boolean>()
private lateinit var call: Call
init {
videoEnabled.value = false
coreContext.postOnCoreThread { core ->
val currentCall = core.currentCall ?: core.calls.firstOrNull()
if (currentCall != null) {
call = currentCall
Log.i("$TAG Found call [$call]")
if (call.state == Call.State.StreamsRunning) {
videoEnabled.postValue(call.currentParams.isVideoEnabled)
} else {
videoEnabled.postValue(call.params.isVideoEnabled)
}
} else {
Log.e("$TAG Failed to find outgoing call!")
}
}
}
fun hangUp() {
// UI thread
coreContext.postOnCoreThread {
Log.i("$TAG Terminating call [$call]")
call.terminate()
}
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.voip.viewmodel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.core.Core
import org.linphone.core.CoreListenerStub
import org.linphone.core.tools.Log
import org.linphone.utils.Event
class CallsViewModel : ViewModel() {
val noMoreCallEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
private val coreListener = object : CoreListenerStub() {
override fun onLastCallEnded(core: Core) {
// Core thread
Log.i("[Calls ViewModel] No more call, leaving VoIP activity")
noMoreCallEvent.postValue(Event(true))
}
}
init {
coreContext.postOnCoreThread { core ->
core.addListener(coreListener)
}
}
override fun onCleared() {
super.onCleared()
coreContext.postOnCoreThread { core ->
core.removeListener(coreListener)
}
}
}

View file

@ -42,8 +42,8 @@ import org.linphone.BR
import org.linphone.R
import org.linphone.contacts.ContactData
import org.linphone.core.ConsolidatedPresence
import org.linphone.ui.MainActivity
import org.linphone.ui.contacts.model.ContactModel
import org.linphone.ui.main.MainActivity
import org.linphone.ui.main.contacts.model.ContactModel
/**
* This file contains all the data binding necessary for the app

View file

@ -30,7 +30,7 @@ import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil
import org.linphone.R
import org.linphone.databinding.DialogPickNumberOrAddressBinding
import org.linphone.ui.contacts.model.NumberOrAddressPickerDialogModel
import org.linphone.ui.main.contacts.model.NumberOrAddressPickerDialogModel
class DialogUtils {
companion object {

View file

@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="vector"
android:width="33dp"
android:height="33dp"
android:viewportWidth="33"
android:viewportHeight="33">
<path
android:name="path_1"
android:pathData="M 13.585 12.878 L 11.181 10.475 L 6.194 5.5 L 4.5 7.194 L 7.781 10.475 L 6.903 10.475 C 6.242 10.475 5.702 11.016 5.702 11.677 L 5.702 23.693 C 5.702 24.354 6.242 24.895 6.903 24.895 L 21.323 24.895 C 21.576 24.895 21.792 24.799 21.984 24.679 L 25.806 28.5 L 27.5 26.806 L 16.853 16.159 L 13.585 12.878 Z M 8.105 22.492 L 8.105 12.878 L 10.184 12.878 L 19.797 22.492 L 8.105 22.492 Z M 20.122 12.878 L 20.122 16.015 L 27.332 23.225 L 27.332 11.076 L 22.525 15.882 L 22.525 11.677 C 22.525 11.016 21.984 10.475 21.323 10.475 L 14.582 10.475 L 16.985 12.878 L 20.122 12.878 Z"
android:fillColor="#4e4e4e"
android:strokeWidth="1"/>
</vector>

View file

@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="vector"
android:width="33dp"
android:height="33dp"
android:viewportWidth="33"
android:viewportHeight="33">
<path
android:name="path"
android:pathData="M 20.5 11.167 L 20.5 21.833 L 7.167 21.833 L 7.167 11.167 L 20.5 11.167 Z M 21.833 8.5 L 5.833 8.5 C 5.1 8.5 4.5 9.1 4.5 9.833 L 4.5 23.167 C 4.5 23.9 5.1 24.5 5.833 24.5 L 21.833 24.5 C 22.567 24.5 23.167 23.9 23.167 23.167 L 23.167 18.5 L 28.5 23.833 L 28.5 9.167 L 23.167 14.5 L 23.167 9.833 C 23.167 9.1 22.567 8.5 21.833 8.5 Z"
android:fillColor="#ffffff"
android:strokeWidth="1"/>
</vector>

View file

@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="vector"
android:width="33dp"
android:height="33dp"
android:viewportWidth="33"
android:viewportHeight="33">
<path
android:name="path_1"
android:pathData="M 25.287 15.86 C 26.687 16.54 28.007 17.394 29.233 18.407 L 27.807 19.834 C 27.033 19.207 26.193 18.647 25.3 18.14 L 25.3 15.86 M 7.7 15.86 L 7.7 18.127 C 6.833 18.62 5.993 19.18 5.207 19.82 L 3.78 18.394 C 4.993 17.394 6.313 16.554 7.7 15.86 Z M 16.5 11.167 C 10.447 11.167 4.953 13.54 0.887 17.394 C 0.647 17.634 0.5 17.967 0.5 18.34 C 0.5 18.714 0.647 19.047 0.887 19.274 L 4.193 22.58 C 4.433 22.82 4.767 22.967 5.14 22.967 C 5.5 22.967 5.833 22.834 6.073 22.594 C 7.127 21.62 8.313 20.78 9.62 20.127 C 10.06 19.914 10.367 19.447 10.367 18.927 L 10.367 14.794 C 12.3 14.167 14.367 13.834 16.5 13.834 C 18.633 13.834 20.7 14.167 22.62 14.807 L 22.62 18.94 C 22.62 19.474 22.927 19.927 23.367 20.14 C 24.673 20.794 25.873 21.62 26.927 22.607 C 27.167 22.834 27.5 22.98 27.86 22.98 C 28.233 22.98 28.567 22.834 28.807 22.594 L 32.113 19.287 C 32.353 19.047 32.5 18.714 32.5 18.34 C 32.5 17.967 32.353 17.634 32.113 17.394 C 28.047 13.54 22.553 11.167 16.5 11.167 Z"
android:fillColor="#ffffff"
android:strokeWidth="1"/>
</vector>

View file

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

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:state_enabled="false"
android:drawable="@drawable/camera_disabled"
app:tint="@color/gray_5" />
<item
android:drawable="@drawable/camera_enabled"
app:tint="@color/white" />
</selector>

View file

@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="vector"
android:width="33dp"
android:height="33dp"
android:viewportWidth="33"
android:viewportHeight="33">
<path
android:name="path_1"
android:pathData="M 16.5 19.167 C 18.713 19.167 20.5 17.38 20.5 15.167 L 20.5 7.167 C 20.5 4.954 18.713 3.167 16.5 3.167 C 14.287 3.167 12.5 4.954 12.5 7.167 L 12.5 15.167 C 12.5 17.38 14.287 19.167 16.5 19.167 Z M 15.167 7.167 C 15.167 6.434 15.767 5.834 16.5 5.834 C 17.233 5.834 17.833 6.434 17.833 7.167 L 17.833 15.167 C 17.833 15.9 17.233 16.5 16.5 16.5 C 15.767 16.5 15.167 15.9 15.167 15.167 L 15.167 7.167 Z M 23.167 15.167 C 23.167 18.847 20.18 21.834 16.5 21.834 C 12.82 21.834 9.833 18.847 9.833 15.167 L 7.167 15.167 C 7.167 19.874 10.647 23.74 15.167 24.394 L 15.167 28.5 L 17.833 28.5 L 17.833 24.394 C 22.353 23.74 25.833 19.874 25.833 15.167 L 23.167 15.167 Z"
android:fillColor="#fafeff"
android:strokeWidth="1"/>
</vector>

View file

@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="vector"
android:width="18dp"
android:height="18dp"
android:viewportWidth="18"
android:viewportHeight="18">
<path
android:name="path"
android:pathData="M 1.5 0 C 0.672 0 0 0.672 0 1.5 C 0 2.328 0.672 3 1.5 3 L 12.879 3 L 0.439 15.439 C -0.146 16.025 -0.146 16.975 0.439 17.561 C 1.025 18.146 1.975 18.146 2.561 17.561 L 15 5.121 L 15 16.5 C 15 17.328 15.672 18 16.5 18 C 17.328 18 18 17.328 18 16.5 L 18 1.5 C 18 0.672 17.328 0 16.5 0 L 1.5 0 Z"
android:fillColor="#4aa8ff"
android:strokeWidth="1"/>
</vector>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="71dp" />
<solid android:color="@color/red_danger"/>
</shape>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<size android:width="55dp" android:height="55dp" />
<solid android:color="@color/in_call_button_background_gray"/>
</shape>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<size android:width="55dp" android:height="55dp" />
<solid android:color="@color/white"/>
</shape>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="20dp" />
<solid android:color="@color/in_call_gray"/>
</shape>

View file

@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="vector"
android:width="33dp"
android:height="33dp"
android:viewportWidth="33"
android:viewportHeight="33">
<path
android:name="path"
android:pathData="M 4.5 12.193 L 4.5 20.193 L 9.833 20.193 L 16.5 26.86 L 16.5 5.527 L 9.833 12.193 L 4.5 12.193 Z M 13.833 11.967 L 13.833 20.42 L 10.94 17.527 L 7.167 17.527 L 7.167 14.86 L 10.94 14.86 L 13.833 11.967 Z M 22.5 16.193 C 22.5 13.833 21.14 11.807 19.167 10.82 L 19.167 21.553 C 21.14 20.58 22.5 18.553 22.5 16.193 Z M 19.167 4.5 L 19.167 7.247 C 23.02 8.393 25.833 11.967 25.833 16.193 C 25.833 20.42 23.02 23.993 19.167 25.14 L 19.167 27.887 C 24.513 26.673 28.5 21.9 28.5 16.193 C 28.5 10.487 24.513 5.713 19.167 4.5 Z"
android:fillColor="#ffffff"
android:strokeWidth="1"/>
</vector>

View file

@ -0,0 +1,20 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="vector"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group android:name="group">
<path
android:name="path"
android:pathData="M 16 7 L 15 7 L 14 6 L 10 6 L 9 7 L 8 7 C 6.9 7 6 7.9 6 9 L 6 15 C 6 16.1 6.9 17 8 17 L 16 17 C 17.1 17 18 16.1 18 15 L 18 9 C 18 7.9 17.1 7 16 7 Z M 16 15 L 8 15 L 8 9 L 9.83 9 L 10.83 8 L 13.17 8 L 14.17 9 L 16 9 L 16 15 Z"
android:fillColor="#000"
android:strokeWidth="1"/>
<path
android:name="path_2"
android:pathData="M 12 13.999 C 13.105 13.999 14 13.104 14 11.999 C 14 10.895 13.105 9.999 12 9.999 C 10.896 9.999 10 10.895 10 11.999 C 10 13.104 10.896 13.999 12 13.999 Z M 8.57 0.519 L 13.05 4.999 L 14.46 3.589 L 12.92 2.049 C 17.7 2.459 21.53 6.239 22 10.999 L 24 10.999 C 23.36 3.299 15.79 -1.671 8.57 0.519 Z M 9.54 20.409 L 11.08 21.949 C 6.3 21.539 2.47 17.759 2 12.999 L 0 12.999 C 0.64 20.699 8.21 25.669 15.43 23.479 L 10.95 18.999 L 9.54 20.409 Z"
android:fillColor="#000"
android:strokeWidth="1"/>
</group>
</vector>

View file

@ -16,7 +16,7 @@
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.calls.viewmodel.CallsListViewModel" />
type="org.linphone.ui.main.calls.viewmodel.CallsListViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
@ -47,7 +47,7 @@
<androidx.fragment.app.FragmentContainerView
android:id="@+id/bottom_nav_bar"
android:name="org.linphone.ui.fragment.BottomNavBarFragment"
android:name="org.linphone.ui.main.fragment.BottomNavBarFragment"
android:layout_width="75dp"
android:layout_height="0dp"
android:visibility="@{viewModel.bottomNavBarVisible ? View.VISIBLE : View.GONE}"

View file

@ -19,7 +19,7 @@
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.contacts.viewmodel.ContactsListViewModel" />
type="org.linphone.ui.main.contacts.viewmodel.ContactsListViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
@ -35,7 +35,7 @@
<androidx.fragment.app.FragmentContainerView
android:id="@+id/bottom_nav_bar"
android:name="org.linphone.ui.fragment.BottomNavBarFragment"
android:name="org.linphone.ui.main.fragment.BottomNavBarFragment"
android:layout_width="75dp"
android:layout_height="0dp"
android:visibility="@{viewModel.bottomNavBarVisible ? View.VISIBLE : View.GONE}"

View file

@ -16,7 +16,7 @@
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.calls.viewmodel.CallsListViewModel" />
type="org.linphone.ui.main.calls.viewmodel.CallsListViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
@ -42,7 +42,7 @@
<androidx.fragment.app.FragmentContainerView
android:id="@+id/bottom_nav_bar"
android:name="org.linphone.ui.fragment.BottomNavBarFragment"
android:name="org.linphone.ui.main.fragment.BottomNavBarFragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="@{viewModel.bottomNavBarVisible ? View.VISIBLE : View.GONE}"

View file

@ -7,7 +7,7 @@
<import type="android.view.View" />
<variable
name="data"
type="org.linphone.ui.conversations.data.ChatMessageData" />
type="org.linphone.ui.main.conversations.data.ChatMessageData" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
@ -43,7 +43,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<org.linphone.ui.conversations.view.MultiLineWrapContentWidthTextView
<org.linphone.ui.main.conversations.view.MultiLineWrapContentWidthTextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="wrap_content"

View file

@ -7,7 +7,7 @@
<import type="android.view.View" />
<variable
name="data"
type="org.linphone.ui.conversations.data.ChatMessageData" />
type="org.linphone.ui.main.conversations.data.ChatMessageData" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
@ -32,7 +32,7 @@
app:constraint_referenced_ids="text, imdn_status"
app:barrierDirection="left" />
<org.linphone.ui.conversations.view.MultiLineWrapContentWidthTextView
<org.linphone.ui.main.conversations.view.MultiLineWrapContentWidthTextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View file

@ -7,7 +7,7 @@
<import type="android.view.View" />
<variable
name="data"
type="org.linphone.ui.conversations.data.EventData" />
type="org.linphone.ui.main.conversations.data.EventData" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout

View file

@ -8,7 +8,7 @@
<import type="android.graphics.Typeface" />
<variable
name="data"
type="org.linphone.ui.conversations.data.ChatRoomData" />
type="org.linphone.ui.main.conversations.data.ChatRoomData" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout

View file

@ -8,7 +8,7 @@
<import type="android.graphics.Typeface" />
<variable
name="model"
type="org.linphone.ui.contacts.model.ContactDeviceModel" />
type="org.linphone.ui.main.contacts.model.ContactDeviceModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout

View file

@ -7,7 +7,7 @@
<import type="android.view.View" />
<variable
name="model"
type="org.linphone.ui.contacts.model.ContactModel" />
type="org.linphone.ui.main.contacts.model.ContactModel" />
<variable
name="onClickListener"
type="View.OnClickListener" />

View file

@ -11,7 +11,7 @@
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.contacts.viewmodel.ContactViewModel" />
type="org.linphone.ui.main.contacts.viewmodel.ContactViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout

View file

@ -8,7 +8,7 @@
<import type="android.graphics.Typeface" />
<variable
name="model"
type="org.linphone.ui.contacts.model.ContactModel" />
type="org.linphone.ui.main.contacts.model.ContactModel" />
<variable
name="onClickListener"
type="View.OnClickListener" />

View file

@ -8,10 +8,11 @@
<import type="android.graphics.Typeface" />
<variable
name="model"
type="org.linphone.ui.contacts.model.ContactNumberOrAddressModel" />
type="org.linphone.ui.main.contacts.model.ContactNumberOrAddressModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:onClick="@{() -> model.onClicked()}"
android:onLongClick="@{() -> model.onLongPress()}"
android:selected="@{model.selected}"
android:layout_width="match_parent"

View file

@ -19,7 +19,7 @@
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.contacts.viewmodel.ContactsListViewModel" />
type="org.linphone.ui.main.contacts.viewmodel.ContactsListViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
@ -135,7 +135,7 @@
<androidx.fragment.app.FragmentContainerView
android:id="@+id/bottom_nav_bar"
android:name="org.linphone.ui.fragment.BottomNavBarFragment"
android:name="org.linphone.ui.main.fragment.BottomNavBarFragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="@{viewModel.bottomNavBarVisible ? View.VISIBLE : View.GONE}"

View file

@ -10,7 +10,7 @@
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.conversations.viewmodel.ConversationViewModel" />
type="org.linphone.ui.main.conversations.viewmodel.ConversationViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout

View file

@ -13,7 +13,7 @@
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.conversations.viewmodel.ConversationsListViewModel" />
type="org.linphone.ui.main.conversations.viewmodel.ConversationsListViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout

View file

@ -8,11 +8,11 @@
<import type="android.graphics.Typeface" />
<variable
name="model"
type="org.linphone.ui.contacts.model.ContactNumberOrAddressModel" />
type="org.linphone.ui.main.contacts.model.ContactNumberOrAddressModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:onLongClick="@{() -> model.onLongPress()}"
android:onClick="@{() -> model.onClicked()}"
android:selected="@{model.selected}"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -8,7 +8,7 @@
<import type="android.graphics.Typeface" />
<variable
name="viewModel"
type="org.linphone.ui.contacts.model.NumberOrAddressPickerDialogModel" />
type="org.linphone.ui.main.contacts.model.NumberOrAddressPickerDialogModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout

View file

@ -5,21 +5,12 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="android.view.View" />
<variable
name="avatarClickListener"
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.viewmodel.TopBarViewModel" />
</data>
<!-- Background color here is mandatory for transparency effect on child views -->
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/primary_color"
tools:context=".ui.MainActivity">
tools:context=".ui.main.MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@ -46,7 +37,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:layout_gravity="left">
android:layout_gravity="start">
<!-- TODO -->

View file

@ -47,13 +47,12 @@
<ImageView
android:id="@+id/save"
android:layout_width="wrap_content"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginEnd="10dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:src="@drawable/check"
android:drawableTint="@color/primary_color"
app:tint="@color/primary_color"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@id/title"
app:layout_constraintTop_toTopOf="@id/title" />

View file

@ -10,7 +10,7 @@
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.conversations.viewmodel.NewConversationViewModel" />
type="org.linphone.ui.main.conversations.viewmodel.NewConversationViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout

View file

@ -10,7 +10,7 @@
type="View.OnClickListener" />
<variable
name="viewModel"
type="org.linphone.ui.viewmodel.TopBarViewModel" />
type="org.linphone.ui.main.viewmodel.TopBarViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
</data>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.voip.VoipActivity">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/voip_nav_container"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:navGraph="@navigation/voip_nav_graph"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="android.view.View" />
<variable
name="viewModel"
type="org.linphone.ui.voip.viewmodel.CallViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:background="@color/in_call_black">
<ImageView
android:onClick="@{() -> viewModel.hangUp()}"
android:id="@+id/hang_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:paddingStart="30dp"
android:paddingEnd="30dp"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:src="@drawable/hang_up"
android:background="@drawable/shape_hang_up_button_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/toggle_video"
android:enabled="@{viewModel.videoEnabled}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:padding="15dp"
android:src="@drawable/in_call_camera_button"
android:background="@drawable/in_call_button_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/toggle_mute_mic" />
<ImageView
android:id="@+id/toggle_mute_mic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:padding="15dp"
android:src="@drawable/microphone"
android:background="@drawable/in_call_button_background"
app:tint="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/change_audio_output" />
<ImageView
android:id="@+id/change_audio_output"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="30dp"
android:padding="15dp"
android:src="@drawable/speaker"
android:background="@drawable/in_call_button_background"
app:tint="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bind="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="android.view.View" />
<variable
name="viewModel"
type="org.linphone.ui.voip.viewmodel.CallViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/in_call_black">
<ImageView
android:id="@+id/call_direction_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="10dp"
android:adjustViewBounds="true"
android:src="@drawable/outgoing_call"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/call_direction_label"
app:layout_constraintBottom_toBottomOf="@id/call_direction_label"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_800"
android:id="@+id/call_direction_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
android:text="Outgoing call"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintStart_toEndOf="@id/call_direction_icon"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="@+id/switch_camera"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="7dp"
android:adjustViewBounds="true"
android:src="@drawable/switch_camera"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:tint="@color/white" />
<ImageView
android:id="@+id/background"
android:src="@drawable/shape_round_in_call_gray_background"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="17dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
app:layout_constraintTop_toBottomOf="@id/call_direction_label"
app:layout_constraintBottom_toTopOf="@id/bottom_bar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<io.getstream.avatarview.AvatarView
android:id="@+id/avatar"
android:layout_width="120dp"
android:layout_height="120dp"
app:avatarViewBorderWidth="0dp"
app:avatarViewInitials="SB"
app:avatarViewInitialsBackgroundColor="@color/blue_outgoing_message"
app:avatarViewInitialsTextColor="@color/gray_9"
app:avatarViewInitialsTextSize="36sp"
app:avatarViewInitialsTextStyle="bold"
app:avatarViewPlaceholder="@drawable/contact_avatar"
app:avatarViewShape="circle"
app:layout_constraintEnd_toEndOf="@id/background"
app:layout_constraintStart_toStartOf="@id/background"
app:layout_constraintTop_toTopOf="@id/background"
app:layout_constraintBottom_toBottomOf="@id/background"/>
<com.google.android.material.progressindicator.CircularProgressIndicator
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:indeterminate="true"
app:indicatorColor="@color/white"
app:layout_constraintBottom_toTopOf="@id/chronometer"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<Chronometer
style="@style/default_text_style_300"
android:id="@+id/chronometer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="30sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/background"
app:layout_constraintBottom_toTopOf="@id/avatar" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style_300"
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Sylvain Berfini"
android:textColor="@color/white"
android:textSize="22sp"
app:layout_constraintTop_toBottomOf="@id/avatar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="sip:sberfini@sip.linphone.org"
android:textColor="@color/white"
android:textSize="14sp"
app:layout_constraintTop_toBottomOf="@id/name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<include
bind:viewModel="@{viewModel}"
android:id="@+id/bottom_bar"
layout="@layout/voip_call_bottom_bar"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -7,7 +7,7 @@
<fragment
android:id="@+id/callsListFragment"
android:name="org.linphone.ui.calls.fragment.CallsListFragment"
android:name="org.linphone.ui.main.calls.fragment.CallsListFragment"
android:label="CallsListFragment"
tools:layout="@layout/calls_list_fragment"/>

View file

@ -7,7 +7,7 @@
<fragment
android:id="@+id/emptyFragment"
android:name="org.linphone.ui.fragment.EmptyFragment"
android:name="org.linphone.ui.main.fragment.EmptyFragment"
android:label="EmptyFragment"
tools:layout="@layout/empty_fragment"/>

View file

@ -8,14 +8,14 @@
<fragment
android:id="@+id/contactsListFragment"
android:name="org.linphone.ui.contacts.fragment.ContactsListFragment"
android:name="org.linphone.ui.main.contacts.fragment.ContactsListFragment"
android:label="ContactsListFragment"
tools:layout="@layout/contacts_list_fragment">
</fragment>
<fragment
android:id="@+id/newContactFragment"
android:name="org.linphone.ui.contacts.fragment.NewContactFragment"
android:name="org.linphone.ui.main.contacts.fragment.NewContactFragment"
android:label="NewContactFragment"
tools:layout="@layout/new_contact_fragment"/>
<action

View file

@ -7,13 +7,13 @@
<fragment
android:id="@+id/emptyFragment"
android:name="org.linphone.ui.fragment.EmptyFragment"
android:name="org.linphone.ui.main.fragment.EmptyFragment"
android:label="EmptyFragment"
tools:layout="@layout/empty_fragment" />
<fragment
android:id="@+id/contactFragment"
android:name="org.linphone.ui.contacts.fragment.ContactFragment"
android:name="org.linphone.ui.main.contacts.fragment.ContactFragment"
android:label="ContactFragment"
tools:layout="@layout/contact_fragment" >
<argument

View file

@ -7,7 +7,7 @@
<fragment
android:id="@+id/conversationsFragment"
android:name="org.linphone.ui.conversations.ConversationsFragment"
android:name="org.linphone.ui.main.conversations.ConversationsFragment"
android:label="ConversationsFragment"
tools:layout="@layout/conversations_fragment">
<action
@ -34,7 +34,7 @@
<fragment
android:id="@+id/newConversationFragment"
android:name="org.linphone.ui.conversations.NewConversationFragment"
android:name="org.linphone.ui.main.conversations.NewConversationFragment"
android:label="NewConversationFragment"
tools:layout="@layout/new_conversation_fragment" >
<action
@ -47,7 +47,7 @@
<fragment
android:id="@+id/conversationFragment"
android:name="org.linphone.ui.conversations.ConversationFragment"
android:name="org.linphone.ui.main.conversations.ConversationFragment"
android:label="ConversationFragment"
tools:layout="@layout/conversation_fragment" >
<argument
@ -60,7 +60,7 @@
<fragment
android:id="@+id/contactsFragment"
android:name="org.linphone.ui.contacts.fragment.ContactsFragment"
android:name="org.linphone.ui.main.contacts.fragment.ContactsFragment"
android:label="ContactsFragment"
tools:layout="@layout/contacts_fragment">
<action
@ -76,7 +76,7 @@
<fragment
android:id="@+id/callsFragment"
android:name="org.linphone.ui.calls.fragment.CallsFragment"
android:name="org.linphone.ui.main.calls.fragment.CallsFragment"
android:label="CallsFragment"
tools:layout="@layout/calls_fragment">
<action

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/voip_nav_graph"
app:startDestination="@id/outgoingCallFragment">
<fragment
android:id="@+id/outgoingCallFragment"
android:name="org.linphone.ui.voip.fragment.OutgoingCallFragment"
android:label="OutgoingCallFragment"
tools:layout="@layout/voip_outgoing_call_fragment"/>
</navigation>

View file

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Linphone" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<style name="Theme.Linphone" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/primary_color</item>
<!-- Status bar color. -->

View file

@ -24,4 +24,8 @@
<color name="gray_9">#4E6074</color>
<color name="gray_10">#9AABB5</color>
<color name="separator">#E5E5EA</color>
<color name="in_call_black">#070707</color>
<color name="in_call_gray">#2E3030</color>
<color name="in_call_button_background_gray">#4E4E4E</color>
</resources>