mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Improved meetings list design
This commit is contained in:
parent
d848622ace
commit
177eb186a5
7 changed files with 103 additions and 31 deletions
|
|
@ -32,6 +32,7 @@ import androidx.recyclerview.widget.ListAdapter
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.linphone.R
|
||||
import org.linphone.databinding.MeetingListCellBinding
|
||||
import org.linphone.databinding.MeetingListTodayIndicatorBinding
|
||||
import org.linphone.databinding.MeetingsListDecorationBinding
|
||||
import org.linphone.ui.main.meetings.model.MeetingListItemModel
|
||||
import org.linphone.ui.main.meetings.model.MeetingModel
|
||||
|
|
@ -91,6 +92,8 @@ class MeetingsListAdapter :
|
|||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
if (holder is MeetingViewHolder) {
|
||||
holder.bind(getItem(position).model as MeetingModel)
|
||||
} else if (holder is TodayIndicatorViewHolder) {
|
||||
holder.bind(getItem(position))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -125,13 +128,17 @@ class MeetingsListAdapter :
|
|||
}
|
||||
|
||||
private fun createTodayIndicatorViewHolder(parent: ViewGroup): TodayIndicatorViewHolder {
|
||||
return TodayIndicatorViewHolder(
|
||||
LayoutInflater.from(parent.context).inflate(
|
||||
R.layout.meeting_list_today_indicator,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
val binding: MeetingListTodayIndicatorBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
R.layout.meeting_list_today_indicator,
|
||||
parent,
|
||||
false
|
||||
)
|
||||
val viewHolder = TodayIndicatorViewHolder(binding)
|
||||
binding.apply {
|
||||
lifecycleOwner = parent.findViewTreeLifecycleOwner()
|
||||
}
|
||||
return viewHolder
|
||||
}
|
||||
|
||||
inner class MeetingViewHolder(
|
||||
|
|
@ -150,8 +157,16 @@ class MeetingsListAdapter :
|
|||
}
|
||||
|
||||
inner class TodayIndicatorViewHolder(
|
||||
val view: View
|
||||
) : RecyclerView.ViewHolder(view)
|
||||
val binding: MeetingListTodayIndicatorBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
@UiThread
|
||||
fun bind(meetingListModel: MeetingListItemModel) {
|
||||
with(binding) {
|
||||
model = meetingListModel
|
||||
executePendingBindings()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class MeetingDiffCallback : DiffUtil.ItemCallback<MeetingListItemModel>() {
|
||||
override fun areItemsTheSame(oldItem: MeetingListItemModel, newItem: MeetingListItemModel): Boolean {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,13 @@ class MeetingListItemModel @WorkerThread constructor(meetingModel: MeetingModel?
|
|||
|
||||
val month = meetingModel?.month ?: TimestampUtils.month(System.currentTimeMillis(), false)
|
||||
|
||||
val day = meetingModel?.day ?: TimestampUtils.dayOfWeek(System.currentTimeMillis(), false)
|
||||
|
||||
val dayNumber = meetingModel?.dayNumber ?: TimestampUtils.dayOfMonth(
|
||||
System.currentTimeMillis(),
|
||||
false
|
||||
)
|
||||
|
||||
val model = meetingModel ?: TodayModel()
|
||||
|
||||
class TodayModel
|
||||
|
|
|
|||
|
|
@ -118,9 +118,7 @@ class MeetingsListViewModel @UiThread constructor() : AbstractMainViewModel() {
|
|||
}
|
||||
model.firstMeetingOfTheDay.postValue(firstMeetingOfTheDay)
|
||||
|
||||
// Insert "Today" fake model before the first one of today
|
||||
if (firstMeetingOfTheDay && model.isToday) {
|
||||
list.add(MeetingListItemModel(null))
|
||||
if (model.isToday) {
|
||||
meetingForTodayFound = true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@{model.dayNumber, default=`19`}"
|
||||
android:visibility="@{model.firstMeetingOfTheDay ? View.VISIBLE : View.INVISIBLE}"
|
||||
android:textColor="@{model.isToday ? @color/main2_000 : @color/main2_500, default=@color/main2_500}"
|
||||
android:textColor="@{model.isToday ? @color/main2_000 : @color/main2_500, default=`#ffffff`}"
|
||||
android:textSize="20sp"
|
||||
android:paddingBottom="4dp"
|
||||
app:layout_constraintStart_toStartOf="@id/today_background"
|
||||
|
|
|
|||
|
|
@ -1,25 +1,75 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp">
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_300"
|
||||
android:id="@+id/today_indicator"
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="model"
|
||||
type="org.linphone.ui.main.meetings.model.MeetingListItemModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="@string/meetings_list_today_indicator"
|
||||
android:textSize="12sp"
|
||||
android:textColor="?attr/color_main1_500" />
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp">
|
||||
|
||||
<View
|
||||
android:id="@+id/today_separator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="?attr/color_main1_500" />
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/header_day"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:text="@{model.day, default=`Mon.`}"
|
||||
android:textColor="?attr/color_main2_500"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="@id/header_day_number"
|
||||
app:layout_constraintEnd_toEndOf="@id/header_day_number"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/today_background"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/shape_circle_primary_background"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/header_day" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_800"
|
||||
android:id="@+id/header_day_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{model.dayNumber, default=`19`}"
|
||||
android:textColor="@color/main2_000"
|
||||
android:textSize="20sp"
|
||||
android:paddingBottom="4dp"
|
||||
app:layout_constraintStart_toStartOf="@id/today_background"
|
||||
app:layout_constraintEnd_toEndOf="@id/today_background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/today_background"
|
||||
app:layout_constraintTop_toBottomOf="@id/header_day"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_700"
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:text="@string/meetings_list_no_meeting_for_today"
|
||||
android:textSize="13sp"
|
||||
android:textColor="?attr/color_main2_600"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintStart_toEndOf="@id/header_day"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/header_day_number"
|
||||
app:layout_constraintBottom_toBottomOf="@id/header_day_number"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -477,6 +477,7 @@
|
|||
<!-- Scheduled conferences -->
|
||||
<string name="meetings_list_empty">Aucune réunion pour le moment…</string>
|
||||
<string name="meetings_list_today_indicator">Aujourd\'hui</string>
|
||||
<string name="meetings_list_no_meeting_for_today">Aucune réunion aujourd\'hui</string>
|
||||
|
||||
<string name="meeting_schedule_title">Nouvelle réunion</string>
|
||||
<string name="meeting_schedule_meeting_label">Réunion</string>
|
||||
|
|
|
|||
|
|
@ -513,6 +513,7 @@
|
|||
<!-- Scheduled conferences -->
|
||||
<string name="meetings_list_empty">No meeting for the moment…</string>
|
||||
<string name="meetings_list_today_indicator">Today</string>
|
||||
<string name="meetings_list_no_meeting_for_today">No meeting scheduled for today</string>
|
||||
|
||||
<string name="meeting_schedule_title">New meeting</string>
|
||||
<string name="meeting_schedule_meeting_label">Meeting</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue