Class OrganizerUploadPosterDialogFragment

java.lang.Object
androidx.fragment.app.Fragment
androidx.fragment.app.DialogFragment
com.example.lottery.fragment.OrganizerUploadPosterDialogFragment
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

public class OrganizerUploadPosterDialogFragment extends androidx.fragment.app.DialogFragment
DialogFragment for handling event poster selection and preview. Provides functionality to browse the device for images, preview selected images, and enlarge them for better visibility.

Key Responsibilities include:

  • Launches a system image picker to select a poster image.
  • Displays a thumbnail preview of the selected image within the dialog.
  • Allows users to enlarge the preview image by clicking the thumbnail. (Requirement US 02.04.01).
  • Passes the selected image URI back to the calling fragment or activity using the Fragment Result API.

Communication: This dialog sends results back via getParentFragmentManager().setFragmentResult("posterRequest", bundle) where the bundle contains the key "posterBase64" (as a string URI or Base64).

  • Nested Class Summary

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

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

    Fields inherited from class androidx.fragment.app.DialogFragment

    STYLE_NO_FRAME, STYLE_NO_INPUT, STYLE_NO_TITLE, STYLE_NORMAL

    Fields inherited from class androidx.fragment.app.Fragment

    mPreviousWho
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onCreate(android.os.Bundle savedInstanceState)
    Initializes the ActivityResultLauncher for picking images from the device storage.
    android.app.Dialog
    onCreateDialog(android.os.Bundle savedInstanceState)
    Creates and returns the dialog for this fragment.

    Methods inherited from class androidx.fragment.app.DialogFragment

    dismiss, dismissAllowingStateLoss, dismissNow, getDialog, getShowsDialog, getTheme, isCancelable, onActivityCreated, onAttach, onCancel, 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, onResume, 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
  • Constructor Details

    • OrganizerUploadPosterDialogFragment

      public OrganizerUploadPosterDialogFragment()
  • Method Details

    • onCreate

      public void onCreate(@Nullable android.os.Bundle savedInstanceState)
      Initializes the ActivityResultLauncher for picking images from the device storage.
      Overrides:
      onCreate in class androidx.fragment.app.DialogFragment
      Parameters:
      savedInstanceState - If the fragment is being re-created from a previous saved state, this is the state.
    • onCreateDialog

      @NonNull public android.app.Dialog onCreateDialog(@Nullable android.os.Bundle savedInstanceState)
      Creates and returns the dialog for this fragment. Sets up view bindings and click listeners for image browsing, selection confirmation, and preview enlargement.
      Overrides:
      onCreateDialog in class androidx.fragment.app.DialogFragment
      Parameters:
      savedInstanceState - If the fragment is being re-created from a previous saved state, this is the state.
      Returns:
      A new AlertDialog instance.