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

Fitness #588

Merged
merged 39 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8423916
Add fitness (currently replaces PCA) with bar chart for room usage.
meiron03 Apr 13, 2023
a0fa1f4
Use aggregate data for bar chart and add rescaling.
meiron03 Apr 14, 2023
6c6af19
Fix time stuff.
meiron03 Sep 15, 2023
c29c67f
Merge branch 'main' into fitness
meiron03 Sep 17, 2023
083fd0f
Merge fitness with updated main branch for new bottom bar and newer m…
meiron03 Sep 17, 2023
b622263
Merge branch 'main' into fitness
meiron03 Sep 17, 2023
c63a6f9
Add capacity circle and last updated.
meiron03 Sep 17, 2023
a137c5a
Sort rooms by name and update room pictures.
meiron03 Sep 17, 2023
d1df8f3
Added functionality for favorites (not yet connected to backend). Als…
meiron03 Sep 23, 2023
b39afb1
connected preferences to backend.
meiron03 Sep 23, 2023
ca22bb3
minor code cleanup
meiron03 Sep 24, 2023
97d9608
Fixed news card "Read Article" button (#574)
JSnipes29 Sep 22, 2023
91373df
Fixed home icon to fill. Improves dark mode nav bar. (#575)
JSnipes29 Sep 22, 2023
de4252e
Improve GSR tab text (#576)
JSnipes29 Sep 22, 2023
1c2407c
add vedha
vavali08 Sep 29, 2023
a0fe45c
update fix merge
vavali08 Sep 29, 2023
cf157b7
fix merge conflict
vavali08 Sep 29, 2023
c63407c
rebase
trinif Sep 24, 2023
51a6c57
Added Trini to about page.
trinif Sep 29, 2023
88b8098
Update .gitignore (#579)
rchhaya Sep 29, 2023
7127e1a
update about page f2023 (#583)
rchhaya Oct 1, 2023
47a38c1
Fixed bug with dining settings
JSnipes29 Sep 15, 2023
39d6002
Moved Feedback button to links page on More
trinif Oct 1, 2023
6a9a96d
fixed gitignore for feedback
trinif Oct 6, 2023
76a3b69
Fix big bug
JSnipes29 Sep 29, 2023
44b3ee3
Add synchronous calls for accessing bearer token
JSnipes29 Oct 1, 2023
eb89ada
wrap all relevant network calls so they are guaranteed
meiron03 Oct 1, 2023
9751332
only replace the login fragment if we're not currently on the login f…
meiron03 Oct 1, 2023
80e9681
get rid of testing code oops.
meiron03 Oct 1, 2023
de7de68
Fix visual bug after booking gsr
JSnipes29 Oct 2, 2023
39b23a3
Fix weird login issue
JSnipes29 Oct 2, 2023
74742ec
Fix issue with GSR booking timeout and added waiting UI
JSnipes29 Oct 2, 2023
c9e2233
Remove user data when logging out
JSnipes29 Oct 9, 2023
4254b93
Fix getAccessToken() race condition.
meiron03 Oct 14, 2023
754cc8d
fix gsr loading on expired bearer token.
meiron03 Oct 16, 2023
169ee04
Merge remote-tracking branch 'origin/main'
meiron03 Oct 17, 2023
bcea48a
More:
meiron03 Oct 17, 2023
75f9c2d
Update AboutFragment.kt
meiron03 Oct 17, 2023
088d009
get rid of unused import MainPagerAdapter.kt
meiron03 Oct 17, 2023
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 @@ -60,7 +60,6 @@ class AboutFragment : Fragment() {
view.our_team_rv?.layoutManager = GridLayoutManager(context, 3)
view.alumni_rv?.layoutManager = GridLayoutManager(context, 3)
val members = arrayListOf("Rohan Chhaya", "Julius Snipes", "Aaron Mei", "Trini Feng", "Vedha Avali")

val alumni = arrayListOf("Marta García Ferreiro", "Varun Ramakrishnan", "Sahit Penmatcha",
"Anna Wang", "Sophia Ye", "Awad Irfan", "Liz Powell", "Davies Lumumba", "Anna Jiang", "Ali Krema")
view.our_team_rv?.adapter = AboutAdapter(members)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class DiningHolderFragment : Fragment() {
super.onCreate(savedInstanceState)
mActivity = activity as MainActivity
mActivity.closeKeyboard()

}

@RequiresApi(Build.VERSION_CODES.M)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,30 +68,6 @@ class FitnessFragment : Fragment() {
internetConnectionFitness?.visibility = View.GONE
}

// get API data
val labs = MainActivity.studentLifeInstance
labs.gymData.subscribe({ gyms ->
mActivity.runOnUiThread {
gym_list?.adapter = FitnessAdapter(gyms)
// get rid of loading screen
loadingPanel?.visibility = View.GONE
if (gyms.size > 0) {
no_results?.visibility = View.GONE
} else {
no_results?.visibility = View.VISIBLE
}
// stop refreshing
gym_refresh_layout?.isRefreshing = false
}
}, { throwable ->
mActivity.runOnUiThread {
throwable.printStackTrace()
Toast.makeText(activity, "Could not load gym information", Toast.LENGTH_LONG).show()
loadingPanel?.visibility = View.GONE
no_results?.visibility = View.VISIBLE
gym_refresh_layout?.isRefreshing = false
}
})
}

override fun onResume() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package com.pennapps.labs.pennmobile

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.fragment.app.Fragment
import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.tabs.TabLayoutMediator
import com.pennapps.labs.pennmobile.adapters.FitnessPagerAdapter
import com.pennapps.labs.pennmobile.components.collapsingtoolbar.ToolbarBehavior
import com.pennapps.labs.pennmobile.utils.Utils

import kotlinx.android.synthetic.main.fragment_fitness_holder.pager
import kotlinx.android.synthetic.main.fragment_fitness_holder.tabLayout

class FitnessHolderFragment: Fragment() {
private lateinit var mActivity : MainActivity
private lateinit var mView : View
private lateinit var pagerAdapter : FitnessPagerAdapter

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mActivity = activity as MainActivity
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
super.onCreateView(inflater, container, savedInstanceState)
return inflater.inflate(R.layout.fragment_fitness_holder, container, false)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mView = view
// initialize app bar and swipe refresh
initAppBar()

pagerAdapter = FitnessPagerAdapter(this)
pager?.adapter = pagerAdapter
pager.isUserInputEnabled = false
TabLayoutMediator(tabLayout, pager) { tab, position ->
if (position == 0) {
tab.text = "Pottruck"
} else {
tab.text = "Favorites"
}
}.attach()
}

/**
* Initialize the app bar of the fragment and
* fills in the textViews for the title/date
*/
private fun initAppBar() {
val appBarLayout : AppBarLayout = mView.findViewById(R.id.appbar_home_holder)
val titleView : TextView = mView.findViewById(R.id.title_view)
val dateView : TextView = mView.findViewById(R.id.date_view)

(appBarLayout.layoutParams as CoordinatorLayout.LayoutParams).behavior = ToolbarBehavior()
titleView.text = getString(R.string.fitness)
dateView.text = Utils.getCurrentSystemTime()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.pennapps.labs.pennmobile

import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.DialogFragment
import androidx.recyclerview.widget.RecyclerView
import com.pennapps.labs.pennmobile.adapters.FitnessPreferenceAdapter
import com.pennapps.labs.pennmobile.classes.FitnessPreferenceViewModel

interface CloseListener {
fun updateAdapters()
}

class FitnessPreferencesFragment(private val dataModel: FitnessPreferenceViewModel,
private val listener: CloseListener) : DialogFragment() {

private lateinit var mActivity : MainActivity
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
mActivity = activity as MainActivity
return inflater.inflate(R.layout.fragment_fitness_preferences, container, false)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val prefAdapter = FitnessPreferenceAdapter(dataModel)

val recyclerView: RecyclerView = view.findViewById(R.id.fitness_preference_recycler_view)
recyclerView.adapter = prefAdapter

val cancelText : TextView = view.findViewById(R.id.fitness_fragment_pref_cancel)
cancelText.setOnClickListener {
dataModel.restorePreferences()
dialog?.dismiss()
}

val saveText : TextView = view.findViewById(R.id.fitness_fragment_pref_save)
saveText.setOnClickListener {
dataModel.updatePositionMap()
dataModel.updateRemotePreferences(mActivity)
listener.updateAdapters()

dialog?.dismiss()
}
}

override fun onStart() {
super.onStart()
val dialog = dialog

if (dialog != null) {
val width = ViewGroup.LayoutParams.MATCH_PARENT
val height = ViewGroup.LayoutParams.MATCH_PARENT
dialog.window!!.setLayout(width, height)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class PennCourseAlertCreateAlertFragment : Fragment() {
// hideInternetErrorBar(view)
}


val sp = PreferenceManager.getDefaultSharedPreferences(activity)
val pennKey = sp.getString(getString(R.string.pennkey), null)
val bearerToken = "Bearer " + sp.getString(getString(R.string.access_token), "").toString()
Expand All @@ -80,9 +79,10 @@ class PennCourseAlertCreateAlertFragment : Fragment() {
viewModel.userInfo.observe(viewLifecycleOwner, Observer {
val formattedPhoneNumber = viewModel.userInfo.value?.profile?.phone?.drop(2)
val email = viewModel.userInfo.value?.profile?.email

phoneNumberEditText.text =
Editable.Factory.getInstance().newEditable(formattedPhoneNumber)
emailEditText.text = Editable.Factory.getInstance().newEditable(email)
Editable.Factory.getInstance().newEditable(formattedPhoneNumber?: "")
emailEditText.text = Editable.Factory.getInstance().newEditable(email?: "")
})

val alertButton = view.findViewById<Button>(R.id.pca_alert_button)
Expand Down
Loading
Loading