Package com.example.oblong.entrant
Class EntrantMyEventsFragment
java.lang.Object
androidx.fragment.app.Fragment
com.example.oblong.entrant.EntrantMyEventsFragment
- All Implemented Interfaces:
android.content.ComponentCallbacks
,android.view.View.OnCreateContextMenuListener
,androidx.activity.result.ActivityResultCaller
,androidx.lifecycle.HasDefaultViewModelProviderFactory
,androidx.lifecycle.LifecycleOwner
,androidx.lifecycle.ViewModelStoreOwner
,androidx.savedstate.SavedStateRegistryOwner
public class EntrantMyEventsFragment
extends androidx.fragment.app.Fragment
Fragment class for displaying the events that the user is participating in.
This fragment retrieves a list of events where the user is marked as attending, using Firebase to fetch relevant data. It then populates a list view with these events for display.
-
Nested Class Summary
Nested classes/interfaces inherited from class androidx.fragment.app.Fragment
androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState
-
Field Summary
Fields inherited from class androidx.fragment.app.Fragment
mPreviousWho
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionandroid.view.View
onCreateView
(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState) Inflates the fragment's layout.void
Cleans up resources when the view is destroyed.void
onViewCreated
(android.view.View view, android.os.Bundle savedInstanceState) Called immediately afteronCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
has returned.Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getDefaultViewModelCreationExtras, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onResume, onSaveInstanceState, onStart, onStop, onViewStateRestored, postponeEnterTransition, postponeEnterTransition, registerForActivityResult, registerForActivityResult, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu
-
Constructor Details
-
EntrantMyEventsFragment
public EntrantMyEventsFragment()
-
-
Method Details
-
onCreateView
@Nullable public android.view.View onCreateView(@NonNull android.view.LayoutInflater inflater, @Nullable android.view.ViewGroup container, @Nullable android.os.Bundle savedInstanceState) Inflates the fragment's layout.- Overrides:
onCreateView
in classandroidx.fragment.app.Fragment
- Parameters:
inflater
- The LayoutInflater object used to inflate views.container
- The parent view that the fragment's UI should be attached to.savedInstanceState
- Bundle containing the fragment's previously saved state, if any.- Returns:
- The View for the fragment's UI.
-
onViewCreated
public void onViewCreated(@NonNull android.view.View view, @Nullable android.os.Bundle savedInstanceState) Called immediately afteronCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
has returned.This method initializes Firebase Firestore references and sets up the ListView adapter for displaying events. It also retrieves the current user's ID and starts fetching the user's participating events using a snapshot listener.
- Overrides:
onViewCreated
in classandroidx.fragment.app.Fragment
- Parameters:
view
- The View returned byonCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
.savedInstanceState
- The saved instance state bundle.
-
onDestroyView
public void onDestroyView()Cleans up resources when the view is destroyed.This method removes the Firestore snapshot listener to stop listening for participant updates when the fragment's view is destroyed.
- Overrides:
onDestroyView
in classandroidx.fragment.app.Fragment
-