Skip to content

Commit

Permalink
renamed branch
Browse files Browse the repository at this point in the history
  • Loading branch information
joemacd committed Mar 22, 2024
1 parent e585521 commit 24bd767
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,5 @@ class GsrReservationsFragment : Fragment() {
super.onDestroy()
LocalBroadcastManager.getInstance(mActivity).unregisterReceiver(broadcastReceiver);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,17 @@ class HomeAdapter(private val dataModel: HomepageDataModel) :
POLL -> {
ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.poll_card, parent, false))
}
//GSR_BOOKING -> {
//ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.gsr_reservation, parent, false))
//}
GSR_BOOKING -> {
ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.home_base_card, parent, false))
}
NOT_SUPPORTED -> {
ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.empty_view, parent, false))
}
//TODO: GSR CARD HERRRREEEEE (GSR_BOOKING)
else -> {
ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.home_base_card, parent, false))
}
}
}
//TODO: BIND GSR CELL
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val cell = dataModel.getCell(position)
when (cell.type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import com.bumptech.glide.Glide
import com.pennapps.labs.pennmobile.GsrReservationsFragment
import com.pennapps.labs.pennmobile.MainActivity
import com.pennapps.labs.pennmobile.MenuFragment
import com.pennapps.labs.pennmobile.R
import com.pennapps.labs.pennmobile.api.StudentLife
import com.pennapps.labs.pennmobile.classes.GSRReservation
import com.squareup.picasso.Picasso
import kotlinx.android.synthetic.main.dining_list_item.view.*
import kotlinx.android.synthetic.main.gsr_list_item.view.item_gsr_hours
import kotlinx.android.synthetic.main.gsr_list_item.view.item_gsr_date
import kotlinx.android.synthetic.main.gsr_list_item.view.item_gsr_image
import kotlinx.android.synthetic.main.gsr_list_item.view.item_gsr_name
import kotlinx.android.synthetic.main.gsr_list_item.view.item_gsr_status
import kotlinx.android.synthetic.main.gsr_list_item.view.item_gsr_location
import kotlinx.android.synthetic.main.gsr_reservation.view.gsr_reservation_cancel_btn
import kotlinx.android.synthetic.main.gsr_reservation.view.gsr_reservation_date_tv
import kotlinx.android.synthetic.main.gsr_reservation.view.gsr_reservation_iv
Expand All @@ -38,14 +38,9 @@ class HomeGsrReservationAdapter (reservations: List<GSRReservation>) : RecyclerV
private var activeReservations: List<GSRReservation> = reservations

private lateinit var itemImage: ImageView
//private lateinit var itemLocation: TextView
private lateinit var itemLocation: TextView
private lateinit var itemDate: TextView

private lateinit var itemName: TextView
private lateinit var itemStatus: TextView
private lateinit var itemHours: TextView

// private lateinit var itemButton: Button
//private lateinit var itemDate: TextView

//TODO("Image and text views")

Expand All @@ -55,8 +50,6 @@ class HomeGsrReservationAdapter (reservations: List<GSRReservation>) : RecyclerV
private lateinit var mStudentLife: StudentLife
override fun onBindViewHolder(holder: HomeGsrReservationAdapter.ViewHolder, position: Int) {
val currentReservation = activeReservations[position]
//get image
//get name
val location = currentReservation.name
val formatter: DateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ")
val from = formatter.parseDateTime(currentReservation.fromDate)
Expand All @@ -68,8 +61,8 @@ class HomeGsrReservationAdapter (reservations: List<GSRReservation>) : RecyclerV
val imageUrl = currentReservation.info?.get("thumbnail") ?: "https://s3.us-east-2.amazonaws.com/labs.api/dining/MBA+Cafe.jpg"
Picasso.get().load(imageUrl).fit().centerCrop().into(holder.itemView.item_gsr_image)

holder.itemView.item_gsr_name.text = location
holder.itemView.item_gsr_hours.text = day + "\n" + fromHour + "-" + toHour
holder.itemView.item_gsr_location.text = location
holder.itemView.item_gsr_date.text = day + "\n" + fromHour + "-" + toHour

}

Expand All @@ -90,15 +83,9 @@ class HomeGsrReservationAdapter (reservations: List<GSRReservation>) : RecyclerV

init {
itemImage = itemView.item_gsr_image
itemName = itemView.item_gsr_name
itemStatus = itemView.item_gsr_status
itemHours = itemView.item_gsr_hours

itemLocation = itemView.item_gsr_location
itemDate = itemView.item_gsr_date

// itemImage = itemView.gsr_reservation_iv
// itemLocation = itemView.gsr_reservation_location_tv
// itemButton = itemView.gsr_reservation_cancel_btn
// itemDate = itemView.gsr_reservation_date_tv
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class HomepageViewModel : HomepageDataModel, ViewModel() {
private fun getGSRReservations(studentLife: StudentLife, bearerToken: String, latch: CountDownLatch) {
studentLife.getGsrReservations(bearerToken).subscribe({ reservationsList ->
if (reservationsList.isEmpty()) {
//Womp-womp no reservations
addCell(HomeCell(), GSR_POS)

} else {
val gsrCell = GSRCell(reservationsList)
Expand Down
50 changes: 3 additions & 47 deletions PennMobile/src/main/res/layout/gsr_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,9 @@
app:layout_constraintGuide_percent="0.45"
/>

<TextView
android:id="@+id/item_gsr_status"
style="@style/DiningStatusLabel"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
app:layout_constraintStart_toEndOf="@+id/item_gsr_image_cardview"
app:layout_constraintTop_toBottomOf="@+id/item_gsr_name"
tools:background="@drawable/label_green"
tools:text="Open"
/>

<TextView
android:id="@+id/item_gsr_name"
android:id="@+id/item_gsr_location"
style="@style/HallName"
android:layout_width="0dp"
android:layout_marginStart="16dp"
Expand All @@ -73,7 +62,7 @@
/>

<TextView
android:id="@+id/item_gsr_hours"
android:id="@+id/item_gsr_date"
style="@style/Menu"
android:layout_width="0dp"
android:layout_height="22dp"
Expand All @@ -88,7 +77,7 @@
app:autoSizeTextType="uniform"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/item_gsr_image_cardview"
app:layout_constraintTop_toBottomOf="@+id/item_gsr_status"
app:layout_constraintTop_toBottomOf="@+id/item_gsr_location"
tools:text="Closes at 9:00PM"
/>

Expand All @@ -100,37 +89,4 @@
app:layout_constraintGuide_percent="0.9"
/>

<ProgressBar
android:id="@+id/gsr_progress"
style="@android:style/Widget.ProgressBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:layout_marginRight="8dp"
android:adjustViewBounds="true"
android:indeterminate="true"
android:indeterminateTint="@color/color_primary"
android:indeterminateTintMode="src_in"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="8dp"
android:paddingRight="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>

<ImageView
android:id="@+id/gsr_hall_menu_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:src="@drawable/ic_chevron_right_black_24dp"
android:tint="@color/settings_grey"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>

</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 24bd767

Please sign in to comment.