Skip to content

Commit e192631

Browse files
committed
feat: Update Check-in status in orders (#1831)
1 parent 0c51baa commit e192631

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-0
lines changed

app/src/main/java/org/fossasia/openevent/general/order/OrderDetailsViewHolder.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import kotlinx.android.synthetic.main.item_card_order_details.view.organizer
1818
import kotlinx.android.synthetic.main.item_card_order_details.view.qrCodeView
1919
import kotlinx.android.synthetic.main.item_card_order_details.view.organizerLabel
2020
import kotlinx.android.synthetic.main.item_card_order_details.view.downloadButton
21+
import kotlinx.android.synthetic.main.item_card_order_details.view.checkInStatusView
22+
import kotlinx.android.synthetic.main.item_card_order_details.view.checkInStatusTextView
23+
import org.fossasia.openevent.general.R
2124
import org.fossasia.openevent.general.attendees.Attendee
2225
import org.fossasia.openevent.general.event.Event
2326
import org.fossasia.openevent.general.event.EventUtils
@@ -40,6 +43,7 @@ class OrderDetailsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
4043
val formattedDate = EventUtils.getFormattedDateShort(formattedDateTime)
4144
val formattedTime = EventUtils.getFormattedTime(formattedDateTime)
4245
val timezone = EventUtils.getFormattedTimeZone(formattedDateTime)
46+
val resources = itemView.resources
4347

4448
itemView.eventName.text = event.name
4549
itemView.location.text = event.locationName
@@ -51,6 +55,20 @@ class OrderDetailsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
5155
} else {
5256
itemView.organizer.text = event.organizerName
5357
}
58+
59+
if (attendee.isCheckedIn != null) {
60+
itemView.checkInStatusView.visibility = View.VISIBLE
61+
if (attendee.isCheckedIn) {
62+
itemView.checkInStatusTextView.text = resources.getString(R.string.checked_in)
63+
itemView.checkInStatusView.backgroundTintList =
64+
resources.getColorStateList(android.R.color.holo_green_light)
65+
} else {
66+
itemView.checkInStatusTextView.text = resources.getString(R.string.not_checked_in)
67+
itemView.checkInStatusView.backgroundTintList =
68+
resources.getColorStateList(android.R.color.holo_red_light)
69+
}
70+
}
71+
5472
itemView.map.setOnClickListener {
5573
val mapUrl = loadMapUrl(event)
5674
val mapIntent = Intent(Intent.ACTION_VIEW, Uri.parse(mapUrl))
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:shape="oval">
5+
6+
<size
7+
android:width="120dp"
8+
android:height="120dp"/>
9+
</shape>

app/src/main/res/layout/item_card_order_details.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,38 @@
6464
android:textSize="@dimen/text_size_large"
6565
tools:text="@string/event_preview" />
6666

67+
<TextView
68+
android:layout_width="wrap_content"
69+
android:layout_height="wrap_content"
70+
android:text="@string/checkin_status"
71+
android:textSize="@dimen/text_size_large"
72+
tools:text="@string/event" />
73+
74+
<LinearLayout
75+
android:layout_width="wrap_content"
76+
android:layout_height="wrap_content"
77+
android:layout_marginBottom="@dimen/layout_margin_large"
78+
android:orientation="horizontal">
79+
80+
<TextView
81+
android:id="@+id/checkInStatusTextView"
82+
android:layout_width="wrap_content"
83+
android:layout_height="wrap_content"
84+
android:text="@string/not_available"
85+
android:textColor="@color/black"
86+
android:textSize="@dimen/text_size_large"/>
87+
88+
<View
89+
android:id="@+id/checkInStatusView"
90+
android:layout_marginTop="@dimen/layout_margin_extra_small"
91+
android:layout_marginStart="@dimen/layout_margin_small"
92+
android:visibility="gone"
93+
android:layout_width="@dimen/card_tickets_radius"
94+
android:layout_height="@dimen/card_tickets_radius"
95+
android:background="@drawable/circle_shape"/>
96+
97+
</LinearLayout>
98+
6799
<LinearLayout
68100
android:layout_width="match_parent"
69101
android:layout_height="wrap_content"

app/src/main/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@
159159
<string name="date_preview" translatable="false">Thu,June 14</string>
160160
<string name="event_preview" translatable="false">FOSSASIA summit</string>
161161
<string name="name_preview" translatable="false">Nikit Bhandari</string>
162+
<string name="checkin_status">Check-in status</string>
163+
<string name="checked_in">Checked In</string>
164+
<string name="not_checked_in">Not Checked In</string>
165+
<string name="not_available">Not available</string>
162166

163167
<!--suggestion mail details-->
164168
<string name="emailInfo">List out your proposed Bug(s)/Feature(s)</string>

0 commit comments

Comments
 (0)