mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-05-01 03:06:20 +00:00
Updated meetings participants picker
This commit is contained in:
parent
b4d25b0e6e
commit
1719a57cdc
4 changed files with 24 additions and 37 deletions
|
|
@ -190,8 +190,7 @@ class EditMeetingFragment : SlidingPaneChildFragment() {
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG Found [${list.size}] new participants to add to the meeting, let's do it"
|
"$TAG Found [${list.size}] new participants to add to the meeting, let's do it"
|
||||||
)
|
)
|
||||||
// TODO FIXME: instead of adding them, replace current list with new one
|
viewModel.setParticipants(list)
|
||||||
viewModel.addParticipants(list)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class ScheduleMeetingFragment : GenericFragment() {
|
||||||
val participants = args.participants
|
val participants = args.participants
|
||||||
if (!participants.isNullOrEmpty()) {
|
if (!participants.isNullOrEmpty()) {
|
||||||
Log.i("$TAG Found pre-populated array of participants of size [${participants.size}]")
|
Log.i("$TAG Found pre-populated array of participants of size [${participants.size}]")
|
||||||
viewModel.addParticipants(participants.toList())
|
viewModel.setParticipants(participants.toList())
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.setBackClickListener {
|
binding.setBackClickListener {
|
||||||
|
|
@ -191,8 +191,7 @@ class ScheduleMeetingFragment : GenericFragment() {
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG Found [${list.size}] new participants to add to the meeting, let's do it"
|
"$TAG Found [${list.size}] new participants to add to the meeting, let's do it"
|
||||||
)
|
)
|
||||||
// TODO FIXME: instead of adding them, replace current list with new one
|
viewModel.setParticipants(list)
|
||||||
viewModel.addParticipants(list)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -309,24 +309,15 @@ class ScheduleMeetingViewModel @UiThread constructor() : ViewModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
fun addParticipants(toAdd: List<String>) {
|
fun setParticipants(toAdd: List<String>) {
|
||||||
coreContext.postOnCoreThread {
|
coreContext.postOnCoreThread {
|
||||||
val list = arrayListOf<SelectedAddressModel>()
|
val list = arrayListOf<SelectedAddressModel>()
|
||||||
list.addAll(participants.value.orEmpty())
|
|
||||||
|
|
||||||
for (participant in toAdd) {
|
for (participant in toAdd) {
|
||||||
val address = Factory.instance().createAddress(participant)
|
val address = Factory.instance().createAddress(participant)
|
||||||
if (address == null) {
|
if (address == null) {
|
||||||
Log.e("$TAG Failed to parse [$participant] as address!")
|
Log.e("$TAG Failed to parse [$participant] as address!")
|
||||||
} else {
|
} else {
|
||||||
val found = list.find { it.address.weakEqual(address) }
|
|
||||||
if (found != null) {
|
|
||||||
Log.i(
|
|
||||||
"$TAG Participant [${found.address.asStringUriOnly()}] already in list, skipping"
|
|
||||||
)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
val avatarModel = coreContext.contactsManager.getContactAvatarModelForAddress(
|
val avatarModel = coreContext.contactsManager.getContactAvatarModelForAddress(
|
||||||
address
|
address
|
||||||
)
|
)
|
||||||
|
|
@ -335,13 +326,11 @@ class ScheduleMeetingViewModel @UiThread constructor() : ViewModel() {
|
||||||
removeModelFromSelection(model)
|
removeModelFromSelection(model)
|
||||||
}
|
}
|
||||||
list.add(model)
|
list.add(model)
|
||||||
Log.i("$TAG Added participant [${address.asStringUriOnly()}]")
|
Log.i("$TAG Participant [${address.asStringUriOnly()}] added to list")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i(
|
Log.i("$TAG Now there are [${list.size}] participants in list")
|
||||||
"$TAG [${toAdd.size}] participants added, now there are [${list.size}] participants in list"
|
|
||||||
)
|
|
||||||
participants.postValue(list)
|
participants.postValue(list)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -475,22 +475,7 @@
|
||||||
android:src="@drawable/users"
|
android:src="@drawable/users"
|
||||||
android:visibility="@{viewModel.participants.size() > 0 ? View.VISIBLE : View.GONE, default=gone}"
|
android:visibility="@{viewModel.participants.size() > 0 ? View.VISIBLE : View.GONE, default=gone}"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/participants_list" />
|
app:layout_constraintTop_toTopOf="@id/add_more_participants" />
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/participants_list"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:visibility="@{viewModel.participants.size() > 0 ? View.VISIBLE : View.GONE, default=gone}"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/participants"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/participants_list_icon"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
entries="@{viewModel.participants}"
|
|
||||||
layout="@{@layout/meeting_schedule_participant_list_cell}"/>
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/default_text_style_300"
|
style="@style/default_text_style_300"
|
||||||
|
|
@ -502,9 +487,24 @@
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:text="@string/meeting_schedule_add_more_participants_title"
|
android:text="@string/meeting_schedule_add_more_participants_title"
|
||||||
android:visibility="@{viewModel.participants.size() > 0 ? View.VISIBLE : View.GONE, default=gone}"
|
android:visibility="@{viewModel.participants.size() > 0 ? View.VISIBLE : View.GONE, default=gone}"
|
||||||
app:layout_constraintTop_toBottomOf="@id/participants_list"
|
app:layout_constraintTop_toBottomOf="@id/participants"
|
||||||
app:layout_constraintStart_toEndOf="@id/participants_list_icon" />
|
app:layout_constraintStart_toEndOf="@id/participants_list_icon" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/participants_list"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:visibility="@{viewModel.participants.size() > 0 ? View.VISIBLE : View.GONE, default=gone}"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/add_more_participants"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/participants_list_icon"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
entries="@{viewModel.participants}"
|
||||||
|
layout="@{@layout/meeting_schedule_participant_list_cell}"/>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/separator_5"
|
android:id="@+id/separator_5"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
@ -512,7 +512,7 @@
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/add_more_participants"
|
app:layout_constraintTop_toBottomOf="@id/participants_list"
|
||||||
android:background="?attr/color_main2_200" />
|
android:background="?attr/color_main2_200" />
|
||||||
|
|
||||||
<com.google.android.material.materialswitch.MaterialSwitch
|
<com.google.android.material.materialswitch.MaterialSwitch
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue