mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
show my attendance status in a special way
This commit is contained in:
@@ -1160,9 +1160,15 @@ class EventActivity : SimpleActivity() {
|
|||||||
{ it.status })
|
{ it.status })
|
||||||
mAttendees.reverse()
|
mAttendees.reverse()
|
||||||
|
|
||||||
|
val currentCalendar = calDAVHelper.getCalDAVCalendars("", true).firstOrNull { it.id == mEventCalendarId }
|
||||||
|
|
||||||
mAttendees.forEach {
|
mAttendees.forEach {
|
||||||
val attendee = it
|
val attendee = it
|
||||||
val deviceContact = mAvailableContacts.firstOrNull { it.email.isNotEmpty() && it.email == attendee.email && it.photoUri.isNotEmpty() }
|
val deviceContact = mAvailableContacts.firstOrNull { it.email.isNotEmpty() && it.email == attendee.email && it.photoUri.isNotEmpty() }
|
||||||
|
if (attendee.email == currentCalendar?.accountName) {
|
||||||
|
attendee.name = ATTENDEE_ME
|
||||||
|
}
|
||||||
|
|
||||||
if (deviceContact != null) {
|
if (deviceContact != null) {
|
||||||
attendee.photoUri = deviceContact.photoUri
|
attendee.photoUri = deviceContact.photoUri
|
||||||
}
|
}
|
||||||
@@ -1244,17 +1250,26 @@ class EventActivity : SimpleActivity() {
|
|||||||
val attendeeStatusBackground = resources.getDrawable(R.drawable.attendee_status_circular_background)
|
val attendeeStatusBackground = resources.getDrawable(R.drawable.attendee_status_circular_background)
|
||||||
(attendeeStatusBackground as LayerDrawable).findDrawableByLayerId(R.id.attendee_status_circular_background).applyColorFilter(config.backgroundColor)
|
(attendeeStatusBackground as LayerDrawable).findDrawableByLayerId(R.id.attendee_status_circular_background).applyColorFilter(config.backgroundColor)
|
||||||
selectedAttendeeStatusImage.background = attendeeStatusBackground
|
selectedAttendeeStatusImage.background = attendeeStatusBackground
|
||||||
|
val isMe = attendee.name == ATTENDEE_ME
|
||||||
|
|
||||||
autoCompleteView.beGone()
|
autoCompleteView.beGone()
|
||||||
autoCompleteView.focusSearch(View.FOCUS_DOWN)?.requestFocus()
|
autoCompleteView.focusSearch(View.FOCUS_DOWN)?.requestFocus()
|
||||||
selectedAttendeeName.text = attendee.getPublicName()
|
selectedAttendeeName.text = if (isMe) getString(R.string.my_status) else attendee.getPublicName()
|
||||||
selectedAttendeeHolder.beVisible()
|
selectedAttendeeHolder.beVisible()
|
||||||
selectedAttendeeImage.beVisible()
|
selectedAttendeeImage.beVisible()
|
||||||
selectedAttendeeStatusImage.beVisibleIf(showAttendeeStatus)
|
selectedAttendeeStatusImage.beVisibleIf(showAttendeeStatus)
|
||||||
selectedAttendeeStatusImage.setImageDrawable(attendeeStatusImage)
|
selectedAttendeeStatusImage.setImageDrawable(attendeeStatusImage)
|
||||||
attendee.updateImage(applicationContext, selectedAttendeeImage, mAttendeePlaceholder)
|
attendee.updateImage(applicationContext, selectedAttendeeImage, mAttendeePlaceholder)
|
||||||
selectedAttendeeDismiss.beVisible()
|
selectedAttendeeDismiss.beGoneIf(isMe)
|
||||||
selectedAttendeeDismiss.tag = attendee.contactId
|
selectedAttendeeDismiss.tag = attendee.contactId
|
||||||
|
|
||||||
|
selectedAttendeeHolder.event_contact_me_status.beVisibleIf(isMe)
|
||||||
|
selectedAttendeeHolder.event_contact_me_status.text = getString(when (attendee.status) {
|
||||||
|
CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED -> R.string.going
|
||||||
|
CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED -> R.string.not_going
|
||||||
|
CalendarContract.Attendees.ATTENDEE_STATUS_TENTATIVE -> R.string.maybe_going
|
||||||
|
else -> R.string.invited
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkNewAttendeeField() {
|
private fun checkNewAttendeeField() {
|
||||||
|
@@ -16,6 +16,7 @@ const val WEEK_START_DATE_TIME = "week_start_date_time"
|
|||||||
const val CALDAV = "Caldav"
|
const val CALDAV = "Caldav"
|
||||||
const val VIEW_TO_OPEN = "view_to_open"
|
const val VIEW_TO_OPEN = "view_to_open"
|
||||||
const val SHORTCUT_NEW_EVENT = "shortcut_new_event"
|
const val SHORTCUT_NEW_EVENT = "shortcut_new_event"
|
||||||
|
const val ATTENDEE_ME = "attendee_me"
|
||||||
const val REGULAR_EVENT_TYPE_ID = 1L
|
const val REGULAR_EVENT_TYPE_ID = 1L
|
||||||
const val CHOPPED_LIST_DEFAULT_SIZE = 100
|
const val CHOPPED_LIST_DEFAULT_SIZE = 100
|
||||||
|
|
||||||
|
@@ -74,5 +74,18 @@
|
|||||||
android:padding="@dimen/small_margin"
|
android:padding="@dimen/small_margin"
|
||||||
android:src="@drawable/ic_cross_big"/>
|
android:src="@drawable/ic_cross_big"/>
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/event_contact_me_status"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="@dimen/activity_margin"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="end"
|
||||||
|
android:lines="1"
|
||||||
|
android:textSize="@dimen/bigger_text_size"
|
||||||
|
tools:text="@string/invited"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Reference in New Issue
Block a user