diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt index 67b782457..49d89139d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt @@ -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 diff --git a/app/src/main/res/drawable-hdpi/ic_check_green.png b/app/src/main/res/drawable-hdpi/ic_check_green.png new file mode 100644 index 000000000..cb997b53e Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_check_green.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_cross_red.png b/app/src/main/res/drawable-hdpi/ic_cross_red.png new file mode 100644 index 000000000..cc3c03c5c Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_cross_red.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_question_yellow.png b/app/src/main/res/drawable-hdpi/ic_question_yellow.png new file mode 100644 index 000000000..923e656dd Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_question_yellow.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_check_green.png b/app/src/main/res/drawable-xhdpi/ic_check_green.png new file mode 100644 index 000000000..d5e90a672 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_check_green.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_cross_red.png b/app/src/main/res/drawable-xhdpi/ic_cross_red.png new file mode 100644 index 000000000..a1fc51b8d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_cross_red.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_question_yellow.png b/app/src/main/res/drawable-xhdpi/ic_question_yellow.png new file mode 100644 index 000000000..1b1c9b1f8 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_question_yellow.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_check_green.png b/app/src/main/res/drawable-xxhdpi/ic_check_green.png new file mode 100644 index 000000000..3c2c589fc Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_check_green.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_cross_red.png b/app/src/main/res/drawable-xxhdpi/ic_cross_red.png new file mode 100644 index 000000000..5651f41ca Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_cross_red.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_question_yellow.png b/app/src/main/res/drawable-xxhdpi/ic_question_yellow.png new file mode 100644 index 000000000..313832456 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_question_yellow.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_check_green.png b/app/src/main/res/drawable-xxxhdpi/ic_check_green.png new file mode 100644 index 000000000..707b53598 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_check_green.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_cross_red.png b/app/src/main/res/drawable-xxxhdpi/ic_cross_red.png new file mode 100644 index 000000000..fb9f2e945 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_cross_red.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_question_yellow.png b/app/src/main/res/drawable-xxxhdpi/ic_question_yellow.png new file mode 100644 index 000000000..175b6ebe6 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_question_yellow.png differ diff --git a/app/src/main/res/drawable/attendee_status_circular_background.xml b/app/src/main/res/drawable/attendee_status_circular_background.xml new file mode 100644 index 000000000..e540e6cca --- /dev/null +++ b/app/src/main/res/drawable/attendee_status_circular_background.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/app/src/main/res/layout/item_attendee.xml b/app/src/main/res/layout/item_attendee.xml index e1d294a2b..8be5afdfd 100644 --- a/app/src/main/res/layout/item_attendee.xml +++ b/app/src/main/res/layout/item_attendee.xml @@ -37,6 +37,18 @@ android:layout_margin="@dimen/tiny_margin" android:adjustViewBounds="true"/> + + + tools:text="Simple Mobile Tools"/> 100dp 40dp + 16dp