mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Started contact editor
This commit is contained in:
parent
79ca1523ef
commit
faa4309ece
12 changed files with 538 additions and 90 deletions
|
|
@ -52,10 +52,11 @@ class ContactLoader : LoaderManager.LoaderCallbacks<Cursor> {
|
|||
|
||||
override fun onCreateLoader(id: Int, args: Bundle?): Loader<Cursor> {
|
||||
val mimeType = ContactsContract.Data.MIMETYPE
|
||||
val mimeSelection = "$mimeType = ? OR $mimeType = ? OR $mimeType = ?"
|
||||
val mimeSelection = "$mimeType = ? OR $mimeType = ? OR $mimeType = ? OR $mimeType = ?"
|
||||
|
||||
val selection = ContactsContract.Data.IN_DEFAULT_DIRECTORY + " == 1 AND ($mimeSelection)"
|
||||
val selectionArgs = arrayOf(
|
||||
ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE,
|
||||
ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE,
|
||||
ContactsContract.CommonDataKinds.SipAddress.CONTENT_ITEM_TYPE,
|
||||
ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE
|
||||
|
|
@ -247,6 +248,30 @@ class ContactLoader : LoaderManager.LoaderCallbacks<Cursor> {
|
|||
friend.jobTitle = job
|
||||
}
|
||||
}
|
||||
ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE -> {
|
||||
val vCard = friend.vcard
|
||||
if (vCard != null) {
|
||||
val givenName: String? =
|
||||
cursor.getString(
|
||||
cursor.getColumnIndexOrThrow(
|
||||
ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME
|
||||
)
|
||||
)
|
||||
if (!givenName.isNullOrEmpty()) {
|
||||
vCard.givenName = givenName
|
||||
}
|
||||
|
||||
val familyName: String? =
|
||||
cursor.getString(
|
||||
cursor.getColumnIndexOrThrow(
|
||||
ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME
|
||||
)
|
||||
)
|
||||
if (!familyName.isNullOrEmpty()) {
|
||||
vCard.familyName = familyName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
friends[id] = friend
|
||||
|
|
|
|||
|
|
@ -28,11 +28,13 @@ class ContactsManager {
|
|||
private val listeners = arrayListOf<ContactsListener>()
|
||||
|
||||
fun loadContacts(activity: MainActivity) {
|
||||
// UI thread
|
||||
val manager = LoaderManager.getInstance(activity)
|
||||
manager.restartLoader(0, null, ContactLoader())
|
||||
}
|
||||
|
||||
fun addListener(listener: ContactsListener) {
|
||||
// UI thread
|
||||
if (coreContext.isReady()) {
|
||||
coreContext.postOnCoreThread {
|
||||
listeners.add(listener)
|
||||
|
|
@ -41,6 +43,7 @@ class ContactsManager {
|
|||
}
|
||||
|
||||
fun removeListener(listener: ContactsListener) {
|
||||
// UI thread
|
||||
if (coreContext.isReady()) {
|
||||
coreContext.postOnCoreThread {
|
||||
listeners.remove(listener)
|
||||
|
|
@ -49,6 +52,7 @@ class ContactsManager {
|
|||
}
|
||||
|
||||
fun onContactsLoaded() {
|
||||
// UI thread
|
||||
coreContext.postOnCoreThread {
|
||||
for (listener in listeners) {
|
||||
listener.onContactsLoaded()
|
||||
|
|
@ -57,13 +61,16 @@ class ContactsManager {
|
|||
}
|
||||
|
||||
fun findContactById(id: String): Friend? {
|
||||
// Core thread
|
||||
return coreContext.core.defaultFriendList?.findFriendByRefKey(id)
|
||||
}
|
||||
|
||||
fun onCoreStarted() {
|
||||
// Core thread
|
||||
}
|
||||
|
||||
fun onCoreStopped() {
|
||||
// Core thread
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ import android.view.ViewGroup
|
|||
import androidx.core.view.doOnPreDraw
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import org.linphone.R
|
||||
import org.linphone.core.tools.Log
|
||||
|
|
@ -135,8 +137,11 @@ class ContactFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
viewModel.openLinphoneContactEditor.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
// TODO
|
||||
it.consume { refKey ->
|
||||
val action = ContactFragmentDirections.actionContactFragmentToEditContactFragment(
|
||||
refKey
|
||||
)
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* 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.contacts.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import androidx.navigation.navGraphViewModels
|
||||
import org.linphone.R
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.ContactNewOrEditFragmentBinding
|
||||
import org.linphone.ui.main.contacts.viewmodel.ContactNewOrEditViewModel
|
||||
import org.linphone.ui.main.fragment.GenericFragment
|
||||
|
||||
class EditContactFragment : GenericFragment() {
|
||||
companion object {
|
||||
const val TAG = "[Contact Edit Fragment]"
|
||||
}
|
||||
|
||||
private lateinit var binding: ContactNewOrEditFragmentBinding
|
||||
|
||||
private val viewModel: ContactNewOrEditViewModel by navGraphViewModels(
|
||||
R.id.editContactFragment
|
||||
)
|
||||
|
||||
private val args: EditContactFragmentArgs by navArgs()
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
binding = ContactNewOrEditFragmentBinding.inflate(layoutInflater)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun goBack() {
|
||||
findNavController().popBackStack()
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
binding.viewModel = viewModel
|
||||
|
||||
postponeEnterTransition()
|
||||
|
||||
val refKey = args.contactRefKey
|
||||
Log.i("[Contact Edit Fragment] Looking up for contact with ref key [$refKey]")
|
||||
viewModel.findFriendByRefKey(refKey)
|
||||
|
||||
binding.setCancelClickListener {
|
||||
goBack()
|
||||
}
|
||||
|
||||
viewModel.saveChangesEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { ok ->
|
||||
if (ok) {
|
||||
Log.i("$TAG Changes were applied, going back to details page")
|
||||
goBack()
|
||||
} else {
|
||||
Log.e("$TAG Changes couldn't be applied!")
|
||||
// TODO FIXME : show error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.friendFoundEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
startPostponedEnterTransition()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -24,18 +24,25 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import org.linphone.databinding.NewContactFragmentBinding
|
||||
import androidx.navigation.navGraphViewModels
|
||||
import org.linphone.R
|
||||
import org.linphone.databinding.ContactNewOrEditFragmentBinding
|
||||
import org.linphone.ui.main.contacts.viewmodel.ContactNewOrEditViewModel
|
||||
import org.linphone.ui.main.fragment.GenericFragment
|
||||
|
||||
class NewContactFragment : GenericFragment() {
|
||||
private lateinit var binding: NewContactFragmentBinding
|
||||
private lateinit var binding: ContactNewOrEditFragmentBinding
|
||||
|
||||
private val viewModel: ContactNewOrEditViewModel by navGraphViewModels(
|
||||
R.id.newContactFragment
|
||||
)
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
binding = NewContactFragmentBinding.inflate(layoutInflater)
|
||||
binding = ContactNewOrEditFragmentBinding.inflate(layoutInflater)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
|
|
@ -47,9 +54,16 @@ class NewContactFragment : GenericFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
binding.viewModel = viewModel
|
||||
|
||||
binding.setCancelClickListener {
|
||||
goBack()
|
||||
}
|
||||
|
||||
viewModel.saveChangesEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
goBack() // TODO FIXME : go to contact detail view
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* 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.contacts.viewmodel
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.core.Friend
|
||||
import org.linphone.core.FriendList.Status
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.utils.Event
|
||||
|
||||
class ContactNewOrEditViewModel() : ViewModel() {
|
||||
companion object {
|
||||
const val TAG = "[Contact New/Edit View Model]"
|
||||
}
|
||||
|
||||
private lateinit var friend: Friend
|
||||
|
||||
val isEdit = MutableLiveData<Boolean>()
|
||||
|
||||
val firstName = MutableLiveData<String>()
|
||||
|
||||
val lastName = MutableLiveData<String>()
|
||||
|
||||
val company = MutableLiveData<String>()
|
||||
|
||||
val jobTitle = MutableLiveData<String>()
|
||||
|
||||
val saveChangesEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
val friendFoundEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
fun findFriendByRefKey(refKey: String?) {
|
||||
// UI thread
|
||||
coreContext.postOnCoreThread { core ->
|
||||
friend = if (refKey.isNullOrEmpty()) {
|
||||
core.createFriend()
|
||||
} else {
|
||||
coreContext.contactsManager.findContactById(refKey) ?: core.createFriend()
|
||||
}
|
||||
val exists = !friend.refKey.isNullOrEmpty()
|
||||
isEdit.postValue(exists)
|
||||
|
||||
if (exists) {
|
||||
Log.i("$TAG Found friend [$friend] using ref key [$refKey]")
|
||||
val vCard = friend.vcard
|
||||
if (vCard != null) {
|
||||
firstName.postValue(vCard.givenName)
|
||||
lastName.postValue(vCard.familyName)
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
|
||||
company.postValue(friend.organization)
|
||||
jobTitle.postValue(friend.jobTitle)
|
||||
|
||||
friendFoundEvent.postValue(Event(true))
|
||||
} else {
|
||||
Log.e("$TAG No friend found using ref key [$refKey]")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun saveChanges() {
|
||||
// UI thread
|
||||
coreContext.postOnCoreThread { core ->
|
||||
var status = Status.OK
|
||||
|
||||
if (::friend.isInitialized) {
|
||||
friend.name = "${firstName.value.orEmpty()} ${lastName.value.orEmpty()}"
|
||||
|
||||
val vCard = friend.vcard
|
||||
if (vCard != null) {
|
||||
vCard.familyName = lastName.value
|
||||
vCard.givenName = firstName.value
|
||||
}
|
||||
|
||||
friend.organization = company.value.orEmpty()
|
||||
friend.jobTitle = jobTitle.value.orEmpty()
|
||||
|
||||
if (isEdit.value == false) {
|
||||
status = core.defaultFriendList?.addFriend(friend) ?: Status.InvalidFriend
|
||||
}
|
||||
} else {
|
||||
status = Status.NonExistentFriend
|
||||
}
|
||||
|
||||
saveChangesEvent.postValue(Event(status == Status.OK))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -169,7 +169,8 @@ class ContactViewModel : ViewModel() {
|
|||
// UI thread
|
||||
val uri = contact.value?.friend?.nativeUri
|
||||
if (uri != null) {
|
||||
openNativeContactEditor.value = Event(uri)
|
||||
openLinphoneContactEditor.value = Event(contact.value?.id.orEmpty())
|
||||
// TODO FIXME : openNativeContactEditor.value = Event(uri)
|
||||
} else {
|
||||
openLinphoneContactEditor.value = Event(contact.value?.id.orEmpty())
|
||||
}
|
||||
|
|
|
|||
13
app/src/main/res/drawable/pick_picture.xml
Normal file
13
app/src/main/res/drawable/pick_picture.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:name="vector"
|
||||
android:width="60dp"
|
||||
android:height="60dp"
|
||||
android:viewportWidth="60"
|
||||
android:viewportHeight="60">
|
||||
<path
|
||||
android:name="path"
|
||||
android:pathData="M 35.3 12.5 L 39.875 17.5 L 50 17.5 L 50 47.5 L 10 47.5 L 10 17.5 L 20.125 17.5 L 24.7 12.5 L 35.3 12.5 Z M 37.5 7.5 L 22.5 7.5 L 17.925 12.5 L 10 12.5 C 7.25 12.5 5 14.75 5 17.5 L 5 47.5 C 5 50.25 7.25 52.5 10 52.5 L 50 52.5 C 52.75 52.5 55 50.25 55 47.5 L 55 17.5 C 55 14.75 52.75 12.5 50 12.5 L 42.075 12.5 L 37.5 7.5 Z M 30 25 C 34.125 25 37.5 28.375 37.5 32.5 C 37.5 36.625 34.125 40 30 40 C 25.875 40 22.5 36.625 22.5 32.5 C 22.5 28.375 25.875 25 30 25 Z M 30 20 C 23.1 20 17.5 25.6 17.5 32.5 C 17.5 39.4 23.1 45 30 45 C 36.9 45 42.5 39.4 42.5 32.5 C 42.5 25.6 36.9 20 30 20 Z"
|
||||
android:fillColor="#4e6074"
|
||||
android:strokeWidth="1"/>
|
||||
</vector>
|
||||
241
app/src/main/res/layout/contact_new_or_edit_fragment.xml
Normal file
241
app/src/main/res/layout/contact_new_or_edit_fragment.xml
Normal file
|
|
@ -0,0 +1,241 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="cancelClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.contacts.viewmodel.ContactNewOrEditViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:onClick="@{cancelClickListener}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:padding="5dp"
|
||||
android:src="@drawable/back"
|
||||
android:drawableTint="@color/primary_color"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/title" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_800"
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@{viewModel.isEdit ? `Edit contact` : `New contact`, default=`New contact`}"
|
||||
android:textColor="@color/primary_color"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toStartOf="@id/save"
|
||||
app:layout_constraintStart_toEndOf="@id/back"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:onClick="@{() -> viewModel.saveChanges()}"
|
||||
android:id="@+id/save"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:padding="5dp"
|
||||
android:src="@drawable/check"
|
||||
app:tint="@color/primary_color"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintTop_toTopOf="@id/title" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@color/gray_7"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_big_size"
|
||||
android:layout_height="@dimen/avatar_big_size"
|
||||
android:layout_marginTop="8dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:padding="20dp"
|
||||
android:src="@drawable/pick_picture"
|
||||
android:background="@drawable/shape_button_round"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/add_picture_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="Add a picture"
|
||||
android:textSize="14sp"
|
||||
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_700"
|
||||
android:id="@+id/first_name_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="First Name"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/add_picture_label"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/first_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@={viewModel.firstName, default=`John`}"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray_9"
|
||||
android:background="@drawable/shape_edit_text_background"
|
||||
app:layout_constraintTop_toBottomOf="@id/first_name_label"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_700"
|
||||
android:id="@+id/last_name_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="Last Name"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/first_name"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/last_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@={viewModel.lastName, default=`Doe`}"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray_9"
|
||||
android:background="@drawable/shape_edit_text_background"
|
||||
app:layout_constraintTop_toBottomOf="@id/last_name_label"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<!-- TODO SIP address & phone numbers -->
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_700"
|
||||
android:id="@+id/company_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="Company"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/last_name"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/company"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@={viewModel.company, default=`Belledonne Comm`}"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray_9"
|
||||
android:background="@drawable/shape_edit_text_background"
|
||||
app:layout_constraintTop_toBottomOf="@id/company_label"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_700"
|
||||
android:id="@+id/job_title_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="Job"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/company"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/job_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@={viewModel.jobTitle, default=`Android dev`}"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray_9"
|
||||
android:background="@drawable/shape_edit_text_background"
|
||||
app:layout_constraintTop_toBottomOf="@id/job_title_label"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="cancelClickListener"
|
||||
type="View.OnClickListener" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:onClick="@{cancelClickListener}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:padding="5dp"
|
||||
android:src="@drawable/back"
|
||||
android:drawableTint="@color/primary_color"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/title" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_800"
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="New contact"
|
||||
android:textColor="@color/primary_color"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toStartOf="@id/save"
|
||||
app:layout_constraintStart_toEndOf="@id/back"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/save"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:padding="5dp"
|
||||
android:src="@drawable/check"
|
||||
app:tint="@color/primary_color"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintTop_toTopOf="@id/title" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@color/gray_7"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
android:id="@+id/newContactFragment"
|
||||
android:name="org.linphone.ui.main.contacts.fragment.NewContactFragment"
|
||||
android:label="NewContactFragment"
|
||||
tools:layout="@layout/new_contact_fragment"/>
|
||||
tools:layout="@layout/contact_new_or_edit_fragment"/>
|
||||
<action
|
||||
android:id="@+id/action_global_newContactFragment"
|
||||
app:destination="@id/newContactFragment"
|
||||
|
|
|
|||
|
|
@ -19,6 +19,14 @@
|
|||
<argument
|
||||
android:name="contactRefKey"
|
||||
app:argType="string" />
|
||||
<action
|
||||
android:id="@+id/action_contactFragment_to_editContactFragment"
|
||||
app:destination="@id/editContactFragment"
|
||||
app:enterAnim="@anim/slide_in_right"
|
||||
app:exitAnim="@anim/slide_out_left"
|
||||
app:popEnterAnim="@anim/slide_in_left"
|
||||
app:popExitAnim="@anim/slide_out_right"
|
||||
app:launchSingleTop="true" />
|
||||
</fragment>
|
||||
|
||||
<action
|
||||
|
|
@ -26,4 +34,14 @@
|
|||
app:destination="@id/contactFragment"
|
||||
app:launchSingleTop="true" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/editContactFragment"
|
||||
android:name="org.linphone.ui.main.contacts.fragment.EditContactFragment"
|
||||
android:label="EditContactFragment"
|
||||
tools:layout="@layout/contact_new_or_edit_fragment" >
|
||||
<argument
|
||||
android:name="contactRefKey"
|
||||
app:argType="string" />
|
||||
</fragment>
|
||||
|
||||
</navigation>
|
||||
Loading…
Add table
Reference in a new issue