Package com.xffffff.wellfed.storage
Class IngredientStorageFragment
- java.lang.Object
-
- androidx.fragment.app.Fragment
-
- com.xffffff.wellfed.storage.IngredientStorageFragment
-
- 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<StorageIngredient>
,OnItemClickListener<StorageIngredient>
,SortingFragment.OnSortClick
public class IngredientStorageFragment extends androidx.fragment.app.Fragment implements Launcher<StorageIngredient>, OnItemClickListener<StorageIngredient>, SortingFragment.OnSortClick
The IngredientStorageFragment class is a fragment that displays a list of ingredients in the user's storage.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) androidx.activity.result.ActivityResultLauncher<StorageIngredient>
editIngredientLauncher
ActivityResultLauncher for the IngredientAddActivity to add an ingredient.(package private) androidx.activity.result.ActivityResultLauncher<StorageIngredient>
launcher
ActivityResultLauncher for the IngredientEditActivity to edit an ingredient.(package private) androidx.recyclerview.widget.RecyclerView
recyclerView
The recycler view for the ingredients.
-
Constructor Summary
Constructors Constructor Description IngredientStorageFragment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
launch(StorageIngredient storageIngredient)
Launches the IngredientAddActivity to add an ingredient.void
onClick(java.lang.String field)
onClick method for the IngredientStorageFragment.android.view.View
onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
onCreate method for the IngredientStorageFragment.void
onItemClick(StorageIngredient storageIngredient)
Launches the IngredientActivity to view an StorageIngredient.void
onViewCreated(android.view.View view, android.os.Bundle savedInstanceState)
onViewCreated method for the IngredientStorageFragment.-
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
-
recyclerView
androidx.recyclerview.widget.RecyclerView recyclerView
The recycler view for the ingredients.
-
editIngredientLauncher
androidx.activity.result.ActivityResultLauncher<StorageIngredient> editIngredientLauncher
ActivityResultLauncher for the IngredientAddActivity to add an ingredient. The result is a StorageIngredient. The result is null if the user cancels the add.
-
launcher
androidx.activity.result.ActivityResultLauncher<StorageIngredient> launcher
ActivityResultLauncher for the IngredientEditActivity to edit an ingredient. The result is a StorageIngredient. The result is null if the user cancels the edit.
-
-
Method Detail
-
onCreateView
@Nullable public android.view.View onCreateView(@NonNull android.view.LayoutInflater inflater, @Nullable android.view.ViewGroup container, @Nullable android.os.Bundle savedInstanceState)
onCreate method for the IngredientStorageFragment.- Overrides:
onCreateView
in classandroidx.fragment.app.Fragment
- Parameters:
inflater
- The LayoutInflater object that can be used to inflate any views in the fragment.container
- If non-null, this is the parent view that the fragment's UI should be attached to.savedInstanceState
- If non-null, this fragment is being re-constructed from a previous saved state as given here.- Returns:
- Return the View for the fragment's UI, or null.
-
onViewCreated
public void onViewCreated(@NonNull android.view.View view, @Nullable android.os.Bundle savedInstanceState)
onViewCreated method for the IngredientStorageFragment.- Overrides:
onViewCreated
in classandroidx.fragment.app.Fragment
- Parameters:
view
- The View returned by onCreateView.savedInstanceState
- If non-null, this fragment is being re-constructed from a previous saved state as given here.
-
launch
public void launch(StorageIngredient storageIngredient)
Launches the IngredientAddActivity to add an ingredient.- Specified by:
launch
in interfaceLauncher<StorageIngredient>
- Parameters:
storageIngredient
- the item
-
onItemClick
public void onItemClick(StorageIngredient storageIngredient)
Launches the IngredientActivity to view an StorageIngredient.- Specified by:
onItemClick
in interfaceOnItemClickListener<StorageIngredient>
- Parameters:
storageIngredient
- The StorageIngredient to view.
-
onClick
public void onClick(java.lang.String field)
onClick method for the IngredientStorageFragment.- Specified by:
onClick
in interfaceSortingFragment.OnSortClick
- Parameters:
field
- The field to sort by.
-
-