app / sg.edu.ntu.scse.cz2006.gymbuddies.ui.gymlist / GymListFragment

GymListFragment

open class GymListFragment : Fragment, ISwipeCallback

The fragment handling the viewing of just the favourited gyms of the user

Author
Kenneth Soh

Since
2019-10-03

Constructors

<init>

The fragment handling the viewing of just the favourited gyms of the user

GymListFragment()

Properties

backStack

Callback handler for Jetpack Navigation back override

var backStack: OnBackPressedCallback!

coordinates

The coordinates of the selected gym

var coordinates: LatLng!

coordinatorLayout

The coordinator layout handling the fragment

var coordinatorLayout: CoordinatorLayout!

detailsInit

Flag to determine if we are initializing the details view when the gym details bottom sheet appears

var detailsInit: Boolean

favAdapter

An adapter to store the favourites list for the RecyclerView

var favAdapter: FavGymAdapter!

favListener

Firebase Firestore Favourites List Real-time listener

var favListener: ListenerRegistration!

favouritesList

The favourites list recyclerview

var favouritesList: RecyclerView!

flagReviewing

If the user is currently reviewing a gym

var flagReviewing: Boolean

gymBottomSheet

The gym details bottom sheet

var gymBottomSheet: View!

gymDetailFavListener

The Firebase Firestore listener for favourites in the gym details bottom sheet This is used to handle real time updates to the favourites count of the gym

var gymDetailFavListener: ListenerRegistration!

gymListViewModel

The Fragment View Model as per MVVM architecture

var gymListViewModel: GymListViewModel!

reviews

Gym Reviews recyclerview

var reviews: RecyclerView!

swipeToRefresh

Swipe Refresh Listener

var swipeToRefresh: SwipeRefreshLayout!

TAG

Debug tag for logging purposes

static val TAG: String

Functions

delete

When a gym in the favourites list has been swiped to unfavourite

open fun delete(position: Int?): Boolean

emptyFavourites

Internal function to call when the user has no favourited gyms

open fun emptyFavourites(): Unit

onCreateView

Internal lifecycle fragment for creating the fragment view

open fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View?

onPause

Lifecycle event called when the fragment is paused

open fun onPause(): Unit

onResume

Lifecycle event called when the fragment is resumed

open fun onResume(): Unit

processFavListUpdates

Process real-time updates from Firebase Firestore

open fun processFavListUpdates(querySnapshot: QuerySnapshot!): Unit

setGymStatus

Internal function to set the logged in user's gym review status This will determine if the user has a review for that particular gym or not. If there is, the view review layout is used, otherwise the create new review layout is used

open fun setGymStatus(hasReview: Boolean, message: String?, rating: Float, selectedGymUid: String!): Unit

submitReview

Internal function to submit review for the selected gym

open fun submitReview(bar: MaterialRatingBar!, reviewMessage: TextInputEditText!, selectedGymUid: String!): Unit

updateGymRatings

Internal function to update gym ratings for a selected gym

open fun updateGymRatings(selectedGymUid: String!): Unit