Class QRCodeFragment

  • All Implemented Interfaces:
    android.content.ComponentCallbacks, android.content.DialogInterface.OnCancelListener, android.content.DialogInterface.OnDismissListener, android.view.View.OnCreateContextMenuListener, androidx.activity.result.ActivityResultCaller, androidx.lifecycle.HasDefaultViewModelProviderFactory, androidx.lifecycle.LifecycleOwner, androidx.lifecycle.ViewModelStoreOwner, androidx.savedstate.SavedStateRegistryOwner, java.io.Serializable
    Direct Known Subclasses:
    AddQRCodeFragment, DeleteQRCodeFragment

    public class QRCodeFragment
    extends androidx.fragment.app.DialogFragment
    implements java.io.Serializable
    Displays information about a specific QRCode. It also lets the user:
    See Also:
    Serialized Form
    • Nested Class Summary

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

        androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState
    • Constructor Summary

      Constructors 
      Constructor Description
      QRCodeFragment()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static QRCodeFragment newInstance​(QRCode qrCode, Player player)
      Creates a new QRCodeFragment to display a specific QR Code
      android.app.Dialog onCreateDialog​(android.os.Bundle savedInstanceState)  
      void onResume()  
      protected void setUpButtons​(android.view.View view)
      Enable and disable buttons of QRCodeFragment
      protected void toggleCommentBox​(boolean isShown)
      Toggles whether or not the comment box should be shown or not.
      void updateLocationPhoto()
      Updates the locationPhoto image view to show the newly-captured location photo
      • Methods inherited from class androidx.fragment.app.DialogFragment

        dismiss, dismissAllowingStateLoss, dismissNow, getDialog, getShowsDialog, getTheme, isCancelable, onActivityCreated, onAttach, onCancel, onCreate, onDestroyView, onDetach, onDismiss, onGetLayoutInflater, onSaveInstanceState, onStart, onStop, onViewStateRestored, requireDialog, setCancelable, setShowsDialog, setStyle, setupDialog, show, show, showNow
      • 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, onActivityResult, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onCreateView, onDestroy, onDestroyOptionsMenu, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onViewCreated, 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
    • Field Detail

      • qrCode

        protected QRCode qrCode
      • takeLocationPhotoBtn

        protected android.widget.Button takeLocationPhotoBtn
      • locationCheckbox

        protected android.widget.CheckBox locationCheckbox
      • activePlayer

        protected Player activePlayer
      • addButton

        protected com.google.android.material.floatingactionbutton.FloatingActionButton addButton
      • deleteButton

        protected com.google.android.material.floatingactionbutton.FloatingActionButton deleteButton
      • loadingButton

        protected com.google.android.material.floatingactionbutton.FloatingActionButton loadingButton
      • tabLayout

        protected com.google.android.material.tabs.TabLayout tabLayout
      • commentBox

        protected android.widget.EditText commentBox
      • listView

        protected android.widget.ListView listView
      • comments

        protected java.util.List<Comment> comments
      • locationPhotoSlider

        protected com.smarteist.autoimageslider.SliderView locationPhotoSlider
      • listElement

        protected android.widget.ListView listElement
    • Constructor Detail

      • QRCodeFragment

        public QRCodeFragment()
    • Method Detail

      • newInstance

        public static QRCodeFragment newInstance​(QRCode qrCode,
                                                 Player player)
        Creates a new QRCodeFragment to display a specific QR Code
        Parameters:
        qrCode - The QR code to view
        player - The player that scanned the given QR code
        Returns:
        QRCodeFragment
      • onCreateDialog

        @NonNull
        public android.app.Dialog onCreateDialog​(@Nullable
                                                 android.os.Bundle savedInstanceState)
        Overrides:
        onCreateDialog in class androidx.fragment.app.DialogFragment
      • onResume

        public void onResume()
        Overrides:
        onResume in class androidx.fragment.app.Fragment
      • setUpButtons

        protected void setUpButtons​(android.view.View view)
        Enable and disable buttons of QRCodeFragment
        Parameters:
        view - the view
      • toggleCommentBox

        protected void toggleCommentBox​(boolean isShown)
        Toggles whether or not the comment box should be shown or not.

        Behaves like a 'hook', where the comment box is only available to AddQRCodeFragment and DeleteQRCodeFragment (essentially whenever the player has/had scanned the code themselved)

        Parameters:
        isShown - Whether or not the comment box should be shown.