Skip to content

Commit

Permalink
Format Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
baronhsieh2005 committed Aug 23, 2024
1 parent b7bc090 commit db52523
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 333 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class DiningSettingsFragment(dataModel: HomepageDataModel) : Fragment() {
} catch (e: Exception) {
e.printStackTrace()
}

}

override fun onDestroyView() {
Expand Down Expand Up @@ -171,7 +170,7 @@ class DiningSettingsFragment(dataModel: HomepageDataModel) : Fragment() {
}
},
)
} catch (e : Exception) {
} catch (e: Exception) {
e.printStackTrace()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ class FlingFragment : Fragment() {
mActivity.onBackPressed()
return true
}

R.id.fling_raffle -> {
val url = "https://docs.google.com/forms/d/e/1FAIpQLSexkehYfGgyAa7RagaCl8rze4KUKQSX9TbcvvA6iXp34TyHew/viewform"
val url =
"https://docs.google.com/forms/d/e/1FAIpQLSexkehYfGgyAa7RagaCl8rze4KUKQSX9TbcvvA6iXp34TyHew/viewform"
val builder = Builder()
val customTabsIntent = builder.build()
customTabsIntent.launchUrl(mActivity, Uri.parse(url))
Expand All @@ -62,12 +64,24 @@ class FlingFragment : Fragment() {
val view = binding.root
val labs = MainActivity.studentLifeInstance
try {
labs.flingEvents.subscribe({ flingEvents ->
activity?.runOnUiThread {
binding.flingFragmentRecyclerview.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
binding.flingFragmentRecyclerview.adapter = FlingRecyclerViewAdapter(context, flingEvents)
}
}, { activity?.runOnUiThread { Toast.makeText(activity, "Could not retrieve Spring Fling schedule", Toast.LENGTH_LONG).show() } })
labs.flingEvents.subscribe(
{ flingEvents ->
activity?.runOnUiThread {
binding.flingFragmentRecyclerview.layoutManager =
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
binding.flingFragmentRecyclerview.adapter =
FlingRecyclerViewAdapter(context, flingEvents)
}
},
{
activity?.runOnUiThread {
Toast.makeText(
activity,
"Could not retrieve Spring Fling schedule",
Toast.LENGTH_LONG
).show()
}
})
} catch (e: Exception) {
e.printStackTrace()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat
import java.util.Calendar
import java.util.Date
import kotlin.collections.ArrayList

class GsrFragment : Fragment() {
// ui components
Expand Down Expand Up @@ -113,9 +112,15 @@ class GsrFragment : Fragment() {
sortingSwitch = binding.sortingSwitch
sortByTime = sortingSwitch.isChecked

durationAdapter = ArrayAdapter(mActivity, R.layout.gsr_spinner_item, arrayOf("30m", "60m", "90m", "120m"))
whartonDurationAdapter = ArrayAdapter(mActivity, R.layout.gsr_spinner_item, arrayOf("30m", "60m", "90m"))
biotechDurationAdapter = ArrayAdapter(mActivity, R.layout.gsr_spinner_item, arrayOf("30m", "60m", "90m", "120m", "150m", "180m"))
durationAdapter =
ArrayAdapter(mActivity, R.layout.gsr_spinner_item, arrayOf("30m", "60m", "90m", "120m"))
whartonDurationAdapter =
ArrayAdapter(mActivity, R.layout.gsr_spinner_item, arrayOf("30m", "60m", "90m"))
biotechDurationAdapter = ArrayAdapter(
mActivity,
R.layout.gsr_spinner_item,
arrayOf("30m", "60m", "90m", "120m", "150m", "180m")
)

// update user status by getting the bearer token and checking wharton status
updateStatus()
Expand Down Expand Up @@ -186,7 +191,13 @@ class GsrFragment : Fragment() {
val entryMonth = monthOfYear + 1

// Update year + month + day
selectedDateTime = DateTime(year, entryMonth, dayOfMonth, selectedDateTime.hourOfDay, selectedDateTime.minuteOfHour)
selectedDateTime = DateTime(
year,
entryMonth,
dayOfMonth,
selectedDateTime.hourOfDay,
selectedDateTime.minuteOfHour
)

// Display the selected date; use Joda to do the formatting work
selectDateButton.text = selectedDateTime.toString(spinnerDateFormatter)
Expand Down Expand Up @@ -216,7 +227,10 @@ class GsrFragment : Fragment() {
searchForGSR(false)
}
// handle swipe to refresh
binding.gsrRefreshLayout.setColorSchemeResources(R.color.color_accent, R.color.color_primary)
binding.gsrRefreshLayout.setColorSchemeResources(
R.color.color_accent,
R.color.color_primary
)
binding.gsrRefreshLayout.setOnRefreshListener {
updateStatus()
searchForGSR(true)
Expand All @@ -226,7 +240,8 @@ class GsrFragment : Fragment() {

private fun updateStatus() {
mActivity.mNetworkManager.getAccessToken {
val bearerToken = sharedPreferences.getString(getString(R.string.access_token), "").toString()
val bearerToken =
sharedPreferences.getString(getString(R.string.access_token), "").toString()

if (bearerToken.isEmpty()) {
Toast.makeText(activity, "You are not logged in!", Toast.LENGTH_LONG).show()
Expand Down Expand Up @@ -269,7 +284,8 @@ class GsrFragment : Fragment() {
val location = mapGSR(gsrLocation)
val gid = mapGID(gsrLocation)
mActivity.mNetworkManager.getAccessToken {
val bearerToken = sharedPreferences.getString(getString(R.string.access_token), "").toString()
val bearerToken =
sharedPreferences.getString(getString(R.string.access_token), "").toString()

if (location.isEmpty() || bearerToken.isEmpty()) {
showNoResults()
Expand Down Expand Up @@ -312,7 +328,8 @@ class GsrFragment : Fragment() {
sortingSwitch.isClickable = false

mActivity.mNetworkManager.getAccessToken {
val bearerToken = sharedPreferences.getString(getString(R.string.access_token), "").toString()
val bearerToken =
sharedPreferences.getString(getString(R.string.access_token), "").toString()

Log.i("GsrFragment", "Bearer Token: $bearerToken")
Log.i("GsrFragment", "Wharton Status: $isWharton")
Expand Down Expand Up @@ -431,7 +448,8 @@ class GsrFragment : Fragment() {
val startTime = gsrSlotFormatter.parseDateTime(startingSlot.startTime)

// ending time and slot
val endingSlot = availableSlotsAfterSelectedTime[pos + durationDropDown.selectedItemPosition]
val endingSlot =
availableSlotsAfterSelectedTime[pos + durationDropDown.selectedItemPosition]
val endTime = gsrSlotFormatter.parseDateTime(endingSlot.endTime)

// if start time + duration = end time then these slots meet the duration requirement
Expand Down Expand Up @@ -493,7 +511,8 @@ class GsrFragment : Fragment() {

val gsrs = gsrHashMap.keys.toList().toTypedArray()

val adapter = ArrayAdapter(activity, R.layout.gsr_spinner_item, gsrs)
val adapter =
ArrayAdapter(activity, R.layout.gsr_spinner_item, gsrs)
gsrLocationDropDown.adapter = adapter

durationDropDown.adapter =
Expand Down Expand Up @@ -530,7 +549,8 @@ class GsrFragment : Fragment() {
gsrHashMap["PCPSE Building"] = "4370"
gsrGIDHashMap["PCPSE Building"] = 7426
val gsrs = gsrHashMap.keys.toList().toTypedArray()
val adapter = ArrayAdapter(activity, R.layout.gsr_spinner_item, gsrs)
val adapter =
ArrayAdapter(activity, R.layout.gsr_spinner_item, gsrs)
gsrLocationDropDown.adapter = adapter

durationDropDown.adapter =
Expand Down Expand Up @@ -642,7 +662,16 @@ class GsrFragment : Fragment() {
}
// can't find existing GSR. Create new object
if (!encountered) {
val newGSRObject = GSRContainer(gsrName, GSRTimeRange, GSRStartTime, GSRElementId, gid, roomId, start, end)
val newGSRObject = GSRContainer(
gsrName,
GSRTimeRange,
GSRStartTime,
GSRElementId,
gid,
roomId,
start,
end
)
mGSRS.add(newGSRObject)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ class PottruckFragment : Fragment() {
loadingPanel = view.findViewById(R.id.loadingPanel)

swipeRefresh.setColorSchemeResources(R.color.color_accent, R.color.color_primary)
recyclerView.layoutManager = LinearLayoutManager(mActivity, LinearLayoutManager.VERTICAL, false)
recyclerView.layoutManager =
LinearLayoutManager(mActivity, LinearLayoutManager.VERTICAL, false)
swipeRefresh.setOnRefreshListener { getFitnessRooms() }

// populate the title/date of the app bar
Expand Down Expand Up @@ -192,7 +193,12 @@ class PottruckFragment : Fragment() {
val connectionMessage: TextView = binding.textFitnessConnectionMessage

if (!isOnline(context)) {
connectionToolbar.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.darkRedBackground))
connectionToolbar.setBackgroundColor(
ContextCompat.getColor(
requireContext(),
R.color.darkRedBackground
)
)
connectionMessage.text = getString(R.string.internet_error)
connectionToolbar.visibility = View.VISIBLE
loadingPanel.visibility = View.GONE
Expand Down
Loading

0 comments on commit db52523

Please sign in to comment.