Package com.xffffff.wellfed.common
Class EditRecyclerViewFragment<Item extends java.io.Serializable>
- java.lang.Object
-
- androidx.fragment.app.Fragment
-
- com.xffffff.wellfed.common.EditRecyclerViewFragment<Item>
-
- Type Parameters:
Item
- the type of item to edit
- 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
,EditItemAdapter.OnDeleteListener<Item>
,EditItemAdapter.OnEditListener<Item>
- Direct Known Subclasses:
EditIngredientsFragment
,EditRecipesFragment
public abstract class EditRecyclerViewFragment<Item extends java.io.Serializable> extends androidx.fragment.app.Fragment implements EditItemAdapter.OnEditListener<Item>, EditItemAdapter.OnDeleteListener<Item>
The EditRecyclerViewFragment class is a fragment that displays a list of items that can be edited.
-
-
Constructor Summary
Constructors Constructor Description EditRecyclerViewFragment()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
add(Item item)
add adds an item to the list of itemsabstract android.content.Intent
createOnEditIntent(Item item)
createOnEditIntent creates an intent for the edit activityabstract android.content.Intent
createOnSearchIntent(Item item)
createOnSearchIntent creates an intent for the search activityjava.lang.Boolean
hasChanged()
hasChanged returns true if the list of items has changedandroid.view.View
onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
onCreateView inflates the viewvoid
onDelete(Item item)
onDeleted is called when an item is deletedvoid
onEdit(Item item)
onEdit is called when an item is editedvoid
onSearch(Item item)
onSearch is called when an item is searchedabstract void
onSearchActivityResult(android.util.Pair<java.lang.String,Item> result)
onSearchActivityResult is an abstract method that is called when the search activity returnsvoid
setAdapter(EditItemAdapter<Item> adapter)
setAdapter sets the adapter for the recycler viewvoid
setTitle(java.lang.String title)
setTitle sets the title string for the fragment-
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, onViewCreated, 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
-
-
-
-
Method Detail
-
setAdapter
public void setAdapter(EditItemAdapter<Item> adapter)
setAdapter sets the adapter for the recycler view- Parameters:
adapter
- the adapter
-
setTitle
public void setTitle(java.lang.String title)
setTitle sets the title string for the fragment- Parameters:
title
- the title string
-
onCreateView
@Nullable public android.view.View onCreateView(@NonNull android.view.LayoutInflater inflater, @Nullable android.view.ViewGroup container, @Nullable android.os.Bundle savedInstanceState)
onCreateView inflates the view- Overrides:
onCreateView
in classandroidx.fragment.app.Fragment
- Parameters:
inflater
- the inflatercontainer
- the containersavedInstanceState
- the saved instance state- Returns:
- the view
-
createOnEditIntent
public abstract android.content.Intent createOnEditIntent(Item item)
createOnEditIntent creates an intent for the edit activity- Parameters:
item
- the item to edit- Returns:
- the intent
-
createOnSearchIntent
public abstract android.content.Intent createOnSearchIntent(Item item)
createOnSearchIntent creates an intent for the search activity- Parameters:
item
- the item to search- Returns:
- the intent
-
onEdit
public void onEdit(Item item)
onEdit is called when an item is edited- Specified by:
onEdit
in interfaceEditItemAdapter.OnEditListener<Item extends java.io.Serializable>
- Parameters:
item
- the item to edit
-
onSearch
public void onSearch(Item item)
onSearch is called when an item is searched- Parameters:
item
- the item to search
-
onDelete
public void onDelete(Item item)
onDeleted is called when an item is deleted- Specified by:
onDelete
in interfaceEditItemAdapter.OnDeleteListener<Item extends java.io.Serializable>
- Parameters:
item
- the item to delete
-
hasChanged
public java.lang.Boolean hasChanged()
hasChanged returns true if the list of items has changed- Returns:
- true if the list of items has changed
-
onSearchActivityResult
public abstract void onSearchActivityResult(android.util.Pair<java.lang.String,Item> result)
onSearchActivityResult is an abstract method that is called when the search activity returns- Parameters:
result
- the result from the search activity
-
add
public void add(Item item)
add adds an item to the list of items- Parameters:
item
- the item to add
-
-