add an image showing the attendees status at event details

This commit is contained in:
tibbi 2019-03-19 14:49:05 +01:00
parent e4376bd75c
commit 7d0e46705f
16 changed files with 43 additions and 5 deletions

View File

@ -1173,7 +1173,6 @@ class EventActivity : SimpleActivity() {
val autoCompleteView = attendeeHolder.event_attendee
val selectedAttendeeHolder = attendeeHolder.event_contact_attendee
val selectedAttendeeName = selectedAttendeeHolder.event_contact_name
val selectedAttendeeImage = attendeeHolder.event_contact_image
val selectedAttendeeDismiss = attendeeHolder.event_contact_dismiss
mAttendeeAutoCompleteViews.add(autoCompleteView)
@ -1206,23 +1205,41 @@ class EventActivity : SimpleActivity() {
autoCompleteView.setOnItemClickListener { parent, view, position, id ->
val currAttendees = (autoCompleteView.adapter as AutoCompleteTextViewAdapter).resultList
val selectedAttendee = currAttendees[position]
addSelectedAttendee(selectedAttendee, autoCompleteView, selectedAttendeeHolder, selectedAttendeeImage, selectedAttendeeName, selectedAttendeeDismiss)
addSelectedAttendee(selectedAttendee, autoCompleteView, selectedAttendeeHolder, selectedAttendeeName, selectedAttendeeDismiss)
}
if (attendee != null) {
addSelectedAttendee(attendee, autoCompleteView, selectedAttendeeHolder, selectedAttendeeImage, selectedAttendeeName, selectedAttendeeDismiss)
addSelectedAttendee(attendee, autoCompleteView, selectedAttendeeHolder, selectedAttendeeName, selectedAttendeeDismiss)
}
}
private fun addSelectedAttendee(attendee: Attendee, autoCompleteView: MyAutoCompleteTextView, selectedAttendeeHolder: RelativeLayout, selectedAttendeeImage: ImageView,
private fun addSelectedAttendee(attendee: Attendee, autoCompleteView: MyAutoCompleteTextView, selectedAttendeeHolder: RelativeLayout,
selectedAttendeeName: MyTextView, selectedAttendeeDismiss: ImageView) {
mSelectedContacts.add(attendee)
val selectedAttendeeImage = selectedAttendeeHolder.event_contact_image
val selectedAttendeeStatusImage = selectedAttendeeHolder.event_contact_status_image
val showAttendeeStatus = attendee.status == CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED ||
attendee.status == CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED ||
attendee.status == CalendarContract.Attendees.ATTENDEE_STATUS_TENTATIVE
val attendeeStatusImage = resources.getDrawable(when (attendee.status) {
CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED -> R.drawable.ic_check_green
CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED -> R.drawable.ic_cross_red
else -> R.drawable.ic_question_yellow
})
val attendeeStatusBackground = resources.getDrawable(R.drawable.attendee_status_circular_background)
(attendeeStatusBackground as LayerDrawable).findDrawableByLayerId(R.id.attendee_status_circular_background).applyColorFilter(config.backgroundColor)
selectedAttendeeStatusImage.background = attendeeStatusBackground
autoCompleteView.beGone()
autoCompleteView.focusSearch(View.FOCUS_DOWN)?.requestFocus()
selectedAttendeeName.text = attendee.getPublicName()
selectedAttendeeHolder.beVisible()
selectedAttendeeImage.beVisible()
selectedAttendeeStatusImage.beVisibleIf(showAttendeeStatus)
selectedAttendeeStatusImage.setImageDrawable(attendeeStatusImage)
attendee.updateImage(applicationContext, selectedAttendeeImage, mAttendeePlaceholder)
selectedAttendeeDismiss.beVisible()
selectedAttendeeDismiss.tag = attendee.contactId

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1019 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/attendee_status_circular_background">
<shape android:shape="oval">
<solid android:color="@color/default_background_color"/>
</shape>
</item>
</layer-list>

View File

@ -37,6 +37,18 @@
android:layout_margin="@dimen/tiny_margin"
android:adjustViewBounds="true"/>
<ImageView
android:id="@+id/event_contact_status_image"
android:layout_width="@dimen/avatar_status_size"
android:layout_height="@dimen/avatar_status_size"
android:layout_alignEnd="@+id/event_contact_image"
android:layout_alignBottom="@+id/event_contact_image"
android:adjustViewBounds="true"
android:background="@drawable/attendee_status_circular_background"
android:padding="@dimen/tiny_margin"
android:src="@drawable/ic_question_yellow"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_contact_name"
android:layout_width="match_parent"
@ -48,7 +60,7 @@
android:ellipsize="end"
android:lines="1"
android:textSize="@dimen/bigger_text_size"
tools:text="Simple Mobile"/>
tools:text="Simple Mobile Tools"/>
<ImageView
android:id="@+id/event_contact_dismiss"

View File

@ -30,4 +30,5 @@
<dimen name="event_color_bar_height">100dp</dimen>
<dimen name="avatar_size">40dp</dimen>
<dimen name="avatar_status_size">16dp</dimen>
</resources>