Class EditRecyclerViewFragment<Item extends java.io.Serializable>

  • 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.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class androidx.fragment.app.Fragment

        androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState
    • 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 items
      abstract android.content.Intent createOnEditIntent​(Item item)
      createOnEditIntent creates an intent for the edit activity
      abstract android.content.Intent createOnSearchIntent​(Item item)
      createOnSearchIntent creates an intent for the search activity
      java.lang.Boolean hasChanged()
      hasChanged returns true if the list of items has changed
      android.view.View onCreateView​(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
      onCreateView inflates the view
      void onDelete​(Item item)
      onDeleted is called when an item is deleted
      void onEdit​(Item item)
      onEdit is called when an item is edited
      void onSearch​(Item item)
      onSearch is called when an item is searched
      abstract void onSearchActivityResult​(android.util.Pair<java.lang.String,​Item> result)
      onSearchActivityResult is an abstract method that is called when the search activity returns
      void setAdapter​(EditItemAdapter<Item> adapter)
      setAdapter sets the adapter for the recycler view
      void 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
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface androidx.lifecycle.HasDefaultViewModelProviderFactory

        getDefaultViewModelCreationExtras
    • Constructor Detail

      • EditRecyclerViewFragment

        public EditRecyclerViewFragment()
    • 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 class androidx.fragment.app.Fragment
        Parameters:
        inflater - the inflater
        container - the container
        savedInstanceState - 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 interface EditItemAdapter.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
      • 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