Package com.xffffff.wellfed.mealplan
Class MealBookFragment
- java.lang.Object
-
- androidx.fragment.app.Fragment
-
- com.xffffff.wellfed.mealplan.MealBookFragment
-
- 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
,Launcher<MealPlan>
,OnItemClickListener<MealPlan>
public class MealBookFragment extends androidx.fragment.app.Fragment implements Launcher<MealPlan>, OnItemClickListener<MealPlan>
The fragment for the meal book. This fragment shows the meals in the meal book. The user can add meals to the meal book by clicking on the add button.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) androidx.activity.result.ActivityResultLauncher<MealPlan>
editLauncher
ActivityResultLauncher for the meal plan activity to launch an activity to add a meal plan.(package private) androidx.activity.result.ActivityResultLauncher<MealPlan>
launcher
ActivityResultLauncher for the meal plan activity to launch, edit or delete the meal plan.
-
Constructor Summary
Constructors Constructor Description MealBookFragment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
launch(MealPlan mealPlan)
launch launches the meal plan activity.android.view.View
onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
onCreateView is called when the fragment is created.void
onItemClick(MealPlan mealPlan)
onItemClick is called when the user clicks on a meal plan.void
onViewCreated(android.view.View view, android.os.Bundle savedInstanceState)
onViewCreated is called when the view is created.-
Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, 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, onDestroyView, 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
-
-
-
-
Field Detail
-
editLauncher
androidx.activity.result.ActivityResultLauncher<MealPlan> editLauncher
ActivityResultLauncher for the meal plan activity to launch an activity to add a meal plan.
-
launcher
androidx.activity.result.ActivityResultLauncher<MealPlan> launcher
ActivityResultLauncher for the meal plan activity to launch, edit or delete the meal plan.
-
-
Method Detail
-
onCreateView
@Nullable public android.view.View onCreateView(@NonNull android.view.LayoutInflater inflater, @Nullable android.view.ViewGroup container, @Nullable android.os.Bundle savedInstanceState)
onCreateView is called when the fragment is created. It inflates the layout.- Overrides:
onCreateView
in classandroidx.fragment.app.Fragment
- Parameters:
inflater
- The layout inflater.container
- The view group container.savedInstanceState
- The saved instance state.- Returns:
- The view.
-
onViewCreated
public void onViewCreated(@NonNull android.view.View view, @Nullable android.os.Bundle savedInstanceState)
onViewCreated is called when the view is created. It sets up the recycler view and the call to action text view.- Overrides:
onViewCreated
in classandroidx.fragment.app.Fragment
- Parameters:
view
- The view.savedInstanceState
- The saved instance state.
-
launch
public void launch(MealPlan mealPlan)
launch launches the meal plan activity.
-
onItemClick
public void onItemClick(MealPlan mealPlan)
onItemClick is called when the user clicks on a meal plan. It launches the meal plan activity.- Specified by:
onItemClick
in interfaceOnItemClickListener<MealPlan>
- Parameters:
mealPlan
- The meal plan to launch.
-
-