Skip to content

Commit

Permalink
Keep showing attendees if the user is not part of them
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarX committed Jan 17, 2024
1 parent 11a7f87 commit 15c9b8a
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ class CalendarEventBannerView @JvmOverloads constructor(
maybeButton.handleChoiceButtonBehavior()
noButton.handleChoiceButtonBehavior()

attendanceLayout.isGone = attendees.isEmpty()
val iAmPartOfAttendees = attendees.any { it.isMe() }
attendeesLayout.isVisible = iAmPartOfAttendees
notPartOfAttendeesWarning.isGone = iAmPartOfAttendees
participationButtons.isVisible = iAmPartOfAttendees

attendeesLayout.isGone = attendees.isEmpty()

attendeesButton.apply {
addOnCheckedChangeListener { _, isChecked ->
attendeesSubMenu.isVisible = isChecked
Expand Down
194 changes: 97 additions & 97 deletions app/src/main/res/layout/view_calendar_event_banner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,31 +92,30 @@
app:drawableTint="@color/iconColor"
tools:text="Genève" />

<FrameLayout
android:id="@+id/attendanceLayout"
<LinearLayout
android:id="@+id/attendeesLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:id="@+id/notPartOfAttendeesWarning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/marginStandardMedium"
android:layout_marginTop="@dimen/marginStandardMedium"
android:drawablePadding="@dimen/marginStandardMedium"
android:gravity="center_vertical"
android:text="@string/calendarNotInvited"
app:drawableStartCompat="@drawable/ic_social_media"
app:drawableTint="@color/iconColor"
tools:visibility="gone" />
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">

<LinearLayout
android:id="@+id/attendeesLayout"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
android:layout_height="wrap_content">

<TextView
android:id="@+id/notPartOfAttendeesWarning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/marginStandardMedium"
android:layout_marginTop="@dimen/marginStandardMedium"
android:drawablePadding="@dimen/marginStandardMedium"
android:gravity="center_vertical"
android:text="@string/calendarNotInvited"
app:drawableStartCompat="@drawable/ic_social_media"
app:drawableTint="@color/iconColor"
tools:visibility="gone" />

<com.google.android.flexbox.FlexboxLayout
android:id="@+id/participationButtons"
Expand Down Expand Up @@ -156,97 +155,98 @@

</com.google.android.flexbox.FlexboxLayout>

<com.google.android.material.button.MaterialButton
android:id="@+id/attendeesButton"
style="@style/TextButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/marginStandardSmall"
android:checkable="true"
android:gravity="start|center_vertical"
android:insetTop="0dp"
android:insetBottom="0dp"
android:paddingHorizontal="@dimen/marginStandardMedium"
android:text="@string/buttonAttendees"
app:backgroundTint="@android:color/transparent"
app:cornerRadius="@dimen/calendarCornerRadius"
app:icon="@drawable/ic_calendar_participants_chevron"
app:iconGravity="textEnd"
app:iconSize="@dimen/smallIconSize"
app:iconTint="?attr/colorPrimary"
app:rippleColor="@color/color_primary_translucent_ripple" />
</FrameLayout>

<com.google.android.material.button.MaterialButton
android:id="@+id/attendeesButton"
style="@style/TextButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/marginStandardSmall"
android:checkable="true"
android:gravity="start|center_vertical"
android:insetTop="0dp"
android:insetBottom="0dp"
android:paddingHorizontal="@dimen/marginStandardMedium"
android:text="@string/buttonAttendees"
app:backgroundTint="@android:color/transparent"
app:cornerRadius="@dimen/calendarCornerRadius"
app:icon="@drawable/ic_calendar_participants_chevron"
app:iconGravity="textEnd"
app:iconSize="@dimen/smallIconSize"
app:iconTint="?attr/colorPrimary"
app:rippleColor="@color/color_primary_translucent_ripple" />

<LinearLayout
android:id="@+id/attendeesSubMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">

<LinearLayout
android:id="@+id/attendeesSubMenu"
android:id="@+id/organizerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
android:gravity="center_vertical"
android:paddingVertical="@dimen/marginStandardSmall">

<LinearLayout
android:id="@+id/organizerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingVertical="@dimen/marginStandardSmall">
<com.infomaniak.mail.views.AvatarView
android:id="@+id/organizerAvatar"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="@dimen/marginStandardMedium"
android:src="@drawable/ic_unknown_user_avatar"
tools:src="@tools:sample/avatars[9]" />

<com.infomaniak.mail.views.AvatarView
android:id="@+id/organizerAvatar"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="@dimen/marginStandardMedium"
android:src="@drawable/ic_unknown_user_avatar"
tools:src="@tools:sample/avatars[9]" />
<TextView
android:id="@+id/organizerName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/marginStandardSmall"
tools:text="Lucien Cheval (Organisateur)" />

<TextView
android:id="@+id/organizerName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/marginStandardSmall"
tools:text="Lucien Cheval (Organisateur)" />
</LinearLayout>

</LinearLayout>
<com.google.android.material.card.MaterialCardView
android:id="@+id/allAttendeesButton"
style="@style/CardViewMail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
app:cardCornerRadius="@dimen/calendarCornerRadius">

<com.google.android.material.card.MaterialCardView
android:id="@+id/allAttendeesButton"
style="@style/CardViewMail"
android:layout_width="match_parent"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="48dp"
app:cardCornerRadius="@dimen/calendarCornerRadius">
android:layout_gravity="center_vertical"
android:gravity="center_vertical">

<LinearLayout
<!-- 15dp as marginStart is 1 less than 16 and is here to account for the fact that the first avatar
of the list has a stroke which offsets the actual circle representing the avatar by 1. A stroke width
of 1.5 is needed to actually get the value we want when taking into account the actual stroke width
and the extra added padding to prevent the stroke from being cut off at the edge of the view-->
<com.infomaniak.mail.ui.main.thread.calendar.ManyAvatarsView
android:id="@+id/manyAvatarsView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">

<!-- 15dp as marginStart is 1 less than 16 and is here to account for the fact that the first avatar
of the list has a stroke which offsets the actual circle representing the avatar by 1. A stroke width
of 1.5 is needed to actually get the value we want when taking into account the actual stroke width
and the extra added padding to prevent the stroke from being cut off at the edge of the view-->
<com.infomaniak.mail.ui.main.thread.calendar.ManyAvatarsView
android:id="@+id/manyAvatarsView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
app:statusBackgroundColor="@color/backgroundColor"
app:strokeColor="@color/backgroundColor"
app:strokeWidth="1.5dp" />
android:layout_marginStart="15dp"
app:statusBackgroundColor="@color/backgroundColor"
app:strokeColor="@color/backgroundColor"
app:strokeWidth="1.5dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/marginStandardSmall"
android:text="@string/buttonSee"
android:textColor="?attr/colorPrimary" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/marginStandardSmall"
android:text="@string/buttonSee"
android:textColor="?attr/colorPrimary" />

</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</FrameLayout>
</LinearLayout>

<com.google.android.material.button.MaterialButton
android:id="@+id/addToCalendarButton"
Expand Down

0 comments on commit 15c9b8a

Please sign in to comment.