Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update Check-in status in orders #1844

Merged
merged 1 commit into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import kotlinx.android.synthetic.main.item_card_order_details.view.organizer
import kotlinx.android.synthetic.main.item_card_order_details.view.qrCodeView
import kotlinx.android.synthetic.main.item_card_order_details.view.organizerLabel
import kotlinx.android.synthetic.main.item_card_order_details.view.downloadButton
import kotlinx.android.synthetic.main.item_card_order_details.view.checkInStatusView
import kotlinx.android.synthetic.main.item_card_order_details.view.checkInStatusTextView
import org.fossasia.openevent.general.R
import org.fossasia.openevent.general.attendees.Attendee
import org.fossasia.openevent.general.event.Event
import org.fossasia.openevent.general.event.EventUtils
Expand All @@ -40,6 +43,7 @@ class OrderDetailsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
val formattedDate = EventUtils.getFormattedDateShort(formattedDateTime)
val formattedTime = EventUtils.getFormattedTime(formattedDateTime)
val timezone = EventUtils.getFormattedTimeZone(formattedDateTime)
val resources = itemView.resources

itemView.eventName.text = event.name
itemView.location.text = event.locationName
Expand All @@ -51,6 +55,20 @@ class OrderDetailsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
} else {
itemView.organizer.text = event.organizerName
}

if (attendee.isCheckedIn != null) {
itemView.checkInStatusView.visibility = View.VISIBLE
if (attendee.isCheckedIn) {
itemView.checkInStatusTextView.text = resources.getString(R.string.checked_in)
itemView.checkInStatusView.backgroundTintList =
resources.getColorStateList(android.R.color.holo_green_light)
} else {
itemView.checkInStatusTextView.text = resources.getString(R.string.not_checked_in)
itemView.checkInStatusView.backgroundTintList =
resources.getColorStateList(android.R.color.holo_red_light)
}
}

itemView.map.setOnClickListener {
val mapUrl = loadMapUrl(event)
val mapIntent = Intent(Intent.ACTION_VIEW, Uri.parse(mapUrl))
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/circle_shape.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">

<size
android:width="120dp"
android:height="120dp"/>
</shape>
32 changes: 32 additions & 0 deletions app/src/main/res/layout/item_card_order_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,38 @@
android:textSize="@dimen/text_size_large"
tools:text="@string/event_preview" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/checkin_status"
android:textSize="@dimen/text_size_large"
tools:text="@string/event" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/layout_margin_large"
android:orientation="horizontal">

<TextView
android:id="@+id/checkInStatusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/not_available"
android:textColor="@color/black"
android:textSize="@dimen/text_size_large"/>

<View
android:id="@+id/checkInStatusView"
android:layout_marginTop="@dimen/layout_margin_extra_small"
android:layout_marginStart="@dimen/layout_margin_small"
android:visibility="gone"
android:layout_width="@dimen/card_tickets_radius"
android:layout_height="@dimen/card_tickets_radius"
android:background="@drawable/circle_shape"/>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@
<string name="date_preview" translatable="false">Thu,June 14</string>
<string name="event_preview" translatable="false">FOSSASIA summit</string>
<string name="name_preview" translatable="false">Nikit Bhandari</string>
<string name="checkin_status">Check-in status</string>
<string name="checked_in">Checked In</string>
<string name="not_checked_in">Not Checked In</string>
<string name="not_available">Not available</string>

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