Class AddQRCodeFragment
- java.lang.Object
-
- androidx.fragment.app.Fragment
-
- androidx.fragment.app.DialogFragment
-
- com.cmput301w23t09.qrhunter.qrcode.QRCodeFragment
-
- com.cmput301w23t09.qrhunter.qrcode.AddQRCodeFragment
-
- 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
public class AddQRCodeFragment extends QRCodeFragment
Displays information about a specific QRCode. It also lets the user:- Add scanned QR code to profile
- Record geolocation of scanned QR code
- Take location photo of scanned qr code
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.cmput301w23t09.qrhunter.qrcode.QRCodeFragment
activePlayer, addButton, commentBox, comments, commentsAdapter, deleteButton, listElement, listView, loadingButton, locationCheckbox, locationHandler, locationPhotoAdapter, locationPhotoSlider, locationPhotoStorage, qrCode, scansAdapter, tabLayout, takeLocationPhotoBtn
-
-
Constructor Summary
Constructors Constructor Description AddQRCodeFragment()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LocationPhotoAdapter
getLocationPhotoAdapter()
Retrieve the location photo adapterLocationPhotoController
getLocationPhotoController()
Retrieve the location photo controllerLocationPhotoFragment
getLocationPhotoFragment()
Retrieve the location photo fragmentstatic AddQRCodeFragment
newInstance(QRCode qrCode, Player activePlayer)
Creates a new AddQRCodeFragment to display a specific QR Codevoid
onRequestPermissionsResult(int requestCode, java.lang.String[] permissions, int[] grantResults)
Disables the "Record QR Location" box if the user has not granted location permissionsprotected void
setUpButtons(android.view.View view)
Enable and disable buttons of QRCodeFragmentprotected void
toggleCommentBox(boolean isShown)
Toggles whether or not the comment box should be shown or not.-
Methods inherited from class com.cmput301w23t09.qrhunter.qrcode.QRCodeFragment
onCreateDialog, onResume, updateLocationPhoto
-
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, 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
-
-
-
-
Method Detail
-
newInstance
public static AddQRCodeFragment newInstance(QRCode qrCode, Player activePlayer)
Creates a new AddQRCodeFragment to display a specific QR Code- Parameters:
qrCode
- The QR code to viewactivePlayer
- The player that scanned the given QR code- Returns:
- QRCodeFragment
-
setUpButtons
protected void setUpButtons(android.view.View view)
Description copied from class:QRCodeFragment
Enable and disable buttons of QRCodeFragment- Overrides:
setUpButtons
in classQRCodeFragment
- Parameters:
view
- the view
-
toggleCommentBox
protected void toggleCommentBox(boolean isShown)
Description copied from class:QRCodeFragment
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)
- Overrides:
toggleCommentBox
in classQRCodeFragment
- Parameters:
isShown
- Whether or not the comment box should be shown.
-
onRequestPermissionsResult
public void onRequestPermissionsResult(int requestCode, @NonNull java.lang.String[] permissions, @NonNull int[] grantResults)
Disables the "Record QR Location" box if the user has not granted location permissions- Overrides:
onRequestPermissionsResult
in classandroidx.fragment.app.Fragment
- Parameters:
requestCode
- The request code passed inFragment.requestPermissions(String[], int)
.permissions
- The requested permissions. Never null.grantResults
- The grant results for the corresponding permissions which is eitherPackageManager.PERMISSION_GRANTED
orPackageManager.PERMISSION_DENIED
. Never null.
-
getLocationPhotoFragment
public LocationPhotoFragment getLocationPhotoFragment()
Retrieve the location photo fragment- Returns:
- The location photo fragment
-
getLocationPhotoController
public LocationPhotoController getLocationPhotoController()
Retrieve the location photo controller- Returns:
- The location photo controller
-
getLocationPhotoAdapter
public LocationPhotoAdapter getLocationPhotoAdapter()
Retrieve the location photo adapter- Returns:
- The location photo adapter
-
-