fix(eventDetails): Fix showing time for instant events

This commit is contained in:
Peter Vacho 2025-01-05 16:57:57 +01:00
parent ae2efe89f2
commit 13b0664f6e
Signed by: school
GPG key ID: 8CFC3837052871B4
2 changed files with 10 additions and 2 deletions

View file

@ -117,11 +117,18 @@ class EventDetailsActivity : AppCompatActivity() {
private fun setEventDetails() { private fun setEventDetails() {
// Set basic event details // Set basic event details
tvEventTitle.text = event.title tvEventTitle.text = event.title
tvEventStartTime.text = getString(R.string.event_start_time, formatDateTime(event.start_time.toLocalDateTime()))
tvEventEndTime.text = getString(R.string.event_end_time, formatDateTime(event.end_time.toLocalDateTime()))
tvEventDescription.text = event.description tvEventDescription.text = event.description
tvEventCreatedAt.text = getString(R.string.event_created_at, formatDateTime(event.created_at.toLocalDateTime())) tvEventCreatedAt.text = getString(R.string.event_created_at, formatDateTime(event.created_at.toLocalDateTime()))
//
if (event.start_time == event.end_time) {
tvEventStartTime.text = getString(R.string.instant_event_time, formatDateTime(event.start_time.toLocalDateTime()))
tvEventEndTime.visibility = View.GONE
} else {
tvEventStartTime.text = getString(R.string.event_start_time, formatDateTime(event.start_time.toLocalDateTime()))
tvEventEndTime.text = getString(R.string.event_end_time, formatDateTime(event.end_time.toLocalDateTime()))
}
val userId = (application as MyApplication).tokenManager.userId val userId = (application as MyApplication).tokenManager.userId
// Set categories or show the placeholder // Set categories or show the placeholder

View file

@ -100,4 +100,5 @@
<string name="edit_category">Edit category</string> <string name="edit_category">Edit category</string>
<string name="please_enter_a_category_name">Please enter a category name</string> <string name="please_enter_a_category_name">Please enter a category name</string>
<string name="failed_to_save_category">Failed to save category: %1$s</string> <string name="failed_to_save_category">Failed to save category: %1$s</string>
<string name="instant_event_time">At: %1$s</string>
</resources> </resources>