Skip to content

Commit

Permalink
Removed unnecesary code
Browse files Browse the repository at this point in the history
  • Loading branch information
joemacd committed Feb 27, 2024
1 parent 7b84e12 commit 6ae0b81
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -484,52 +484,12 @@ class HomeAdapter(private val dataModel: HomepageDataModel) :
//TODO: button on click
val reservations = cell.reservations
//holder.itemView.home_card_rv.adapter = HomeGsrBuildingAdapter(reservations)
if(reservations.isNotEmpty()) {
val res = reservations[0];
//holder.itemView.home_card_subtitle.text = res.name;
//
}

holder.itemView.home_card_rv.layoutManager = LinearLayoutManager(mContext,
LinearLayoutManager.VERTICAL, false)
LinearLayoutManager.VERTICAL, false)
holder.itemView.home_card_rv.adapter = HomeGsrReservationAdapter(reservations)


}

// holder.itemView.home_card_title.text = "Favorites"
// holder.itemView.home_card_subtitle.text = "DINING HALLS"
// holder.itemView.dining_prefs_btn.visibility = View.VISIBLE
// holder.itemView.dining_prefs_btn.setOnClickListener {
// mActivity.supportFragmentManager.beginTransaction()
// .replace(R.id.content_frame, DiningSettingsFragment(dataModel))
// .addToBackStack(null)
// .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
// .commit()
// }
//
// mStudentLife.venues()
// .flatMap { venues -> Observable.from(venues) }
// .flatMap { venue ->
// val hall = DiningFragment.createHall(venue)
// Observable.just(hall)
// }
// .toList()
// .subscribe { diningHalls ->
// mActivity.runOnUiThread {
// val favorites: ArrayList<DiningHall> = arrayListOf()
// val favoritesIdList: List<Int>? = cell.venues
// diningHalls.forEach {
// if (favoritesIdList?.contains(it.id) == true) {
// favorites.add(it)
// }
// }
// getMenus(favorites)
// holder.itemView.home_card_rv.layoutManager = LinearLayoutManager(mContext,
// LinearLayoutManager.VERTICAL, false)
// holder.itemView.home_card_rv.adapter = DiningCardAdapter(favorites)
// }
// }


// Chrome custom tabs to launch news site
internal inner class NewsCustomTabsServiceConnection : CustomTabsServiceConnection() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ 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_image
Expand All @@ -29,6 +30,8 @@ import kotlinx.android.synthetic.main.gsr_reservation.view.gsr_reservation_cance
import kotlinx.android.synthetic.main.gsr_reservation.view.gsr_reservation_date_tv
import kotlinx.android.synthetic.main.gsr_reservation.view.gsr_reservation_iv
import kotlinx.android.synthetic.main.gsr_reservation.view.gsr_reservation_location_tv
import org.joda.time.format.DateTimeFormat
import org.joda.time.format.DateTimeFormatter
import rx.android.schedulers.AndroidSchedulers

class HomeGsrReservationAdapter (reservations: List<GSRReservation>) : RecyclerView.Adapter<HomeGsrReservationAdapter.ViewHolder>() {
Expand All @@ -54,9 +57,21 @@ class HomeGsrReservationAdapter (reservations: List<GSRReservation>) : RecyclerV
val currentReservation = activeReservations[position]
//get image
//get name
itemName.text = currentReservation.name
val location = currentReservation.name
val formatter: DateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ")
val from = formatter.parseDateTime(currentReservation.fromDate)
val to = formatter.parseDateTime(currentReservation.toDate)
val day = from.toString("EEEE, MMMM d")
val fromHour = from.toString("h:mm a")
val toHour = to.toString("h:mm a")

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

//cancel button

}

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
id 'com.android.application' version '8.2.2' apply false
id 'com.android.library' version '8.2.2' apply false
id 'org.jetbrains.kotlin.android' version '1.7.22' apply false
id 'com.google.gms.google-services' version "4.4.0" apply false
id("com.google.firebase.crashlytics") version "2.9.9" apply false
Expand Down

0 comments on commit 6ae0b81

Please sign in to comment.