File tree Expand file tree Collapse file tree
java/com/pennapps/labs/pennmobile/gsr/fragments Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com.pennapps.labs.pennmobile.gsr.fragments
22
3+ import android.content.Intent
34import android.os.Bundle
45import android.view.LayoutInflater
56import android.view.View
@@ -60,6 +61,17 @@ class GsrReservationDetailFragment : Fragment() {
6061 to.toString(" h:mm a" )
6162 binding.gsrDetailBookingIdTv.text = reservation.ownerName
6263
64+ binding.gsrCalendarButton.setOnClickListener {
65+ // Intent to open calendar and create new event
66+ val calIntent = Intent (Intent .ACTION_INSERT )
67+ calIntent.type = " vnd.android.cursor.item/event"
68+ calIntent.putExtra(android.provider.CalendarContract .Events .TITLE , " ${reservation.gsr.name} - ${reservation.roomName} " )
69+ calIntent.putExtra(android.provider.CalendarContract .Events .EVENT_LOCATION , reservation.gsr.name)
70+ calIntent.putExtra(android.provider.CalendarContract .EXTRA_EVENT_BEGIN_TIME , from.millis)
71+ calIntent.putExtra(android.provider.CalendarContract .EXTRA_EVENT_END_TIME , to.millis)
72+ startActivity(calIntent)
73+ }
74+
6375 Picasso .get().load(reservation.gsr.imageUrl).fit().centerCrop().into(binding.gsrDetailIv)
6476
6577 }, { error ->
Original file line number Diff line number Diff line change 139139
140140 </androidx .cardview.widget.CardView>
141141
142+ <Button
143+ android : id =" @+id/gsr_calendar_button"
144+ android : layout_width =" 0dp"
145+ android : layout_height =" wrap_content"
146+ android : layout_marginStart =" 16dp"
147+ android : layout_marginEnd =" 16dp"
148+ android : layout_marginTop =" 16dp"
149+ android : text =" Add to Calendar"
150+ android : textColor =" @color/white"
151+ android : textSize =" 15sp"
152+ android : textStyle =" bold"
153+ android : paddingTop =" 14dp"
154+ android : paddingBottom =" 14dp"
155+ android : background =" @color/pennmobile_blue"
156+ android : drawableTint =" @color/white"
157+ android : drawablePadding =" 8dp"
158+ app : layout_constraintTop_toBottomOf =" @id/gsr_info_card"
159+ app : layout_constraintStart_toStartOf =" parent"
160+ app : layout_constraintEnd_toEndOf =" parent" />
161+
142162 <View
143163 android : layout_width =" 0dp"
144164 android : layout_height =" 24dp"
145- app : layout_constraintTop_toBottomOf =" @id/gsr_info_card "
165+ app : layout_constraintTop_toBottomOf =" @id/gsr_calendar_button "
146166 app : layout_constraintStart_toStartOf =" parent"
147167 app : layout_constraintEnd_toEndOf =" parent" />
148168
You can’t perform that action at this time.
0 commit comments