Package com.example.lottery.fragment
Class NotificationFragment
java.lang.Object
androidx.fragment.app.Fragment
androidx.fragment.app.DialogFragment
com.example.lottery.fragment.NotificationFragment
- 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 NotificationFragment
extends androidx.fragment.app.DialogFragment
DialogFragment used by Organizers to input a notification message.
This fragment handles the UI for composing a notification. The actual sending
logic is handled by the listener (e.g., EntrantsListActivity or
OrganizerNotificationsActivity) which will create entries in the global
'notifications' collection and individual user 'inbox' subcollections.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface for components that handle the actual notification sending logic.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_NORMALFields inherited from class androidx.fragment.app.Fragment
mPreviousWho -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NotificationFragmentInitializes and returns a new NotificationFragment with a default title.static NotificationFragmentnewInstance(String title) Initializes and returns a new NotificationFragment with a specific title.voidonAttach(android.content.Context context) Attaches the fragment to its context and ensures it implements theNotificationFragment.NotificationListener.android.app.DialogonCreateDialog(android.os.Bundle savedInstanceState) Creates and returns the notification composition dialog.Methods inherited from class androidx.fragment.app.DialogFragment
dismiss, dismissAllowingStateLoss, dismissNow, getDialog, getShowsDialog, getTheme, isCancelable, onActivityCreated, onCancel, onCreate, onDestroyView, onDetach, onDismiss, onGetLayoutInflater, onSaveInstanceState, onStart, onStop, onViewStateRestored, requireDialog, setCancelable, setShowsDialog, setStyle, setupDialog, show, show, showNowMethods 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
-
Constructor Details
-
NotificationFragment
public NotificationFragment()
-
-
Method Details
-
newInstance
Initializes and returns a new NotificationFragment with a default title.- Returns:
- a new notification fragment
-
newInstance
Initializes and returns a new NotificationFragment with a specific title.- Parameters:
title- The title to display on the dialog.- Returns:
- a new notification fragment
-
onAttach
public void onAttach(@NonNull android.content.Context context) Attaches the fragment to its context and ensures it implements theNotificationFragment.NotificationListener.- Overrides:
onAttachin classandroidx.fragment.app.DialogFragment- Parameters:
context- The context to which the fragment is being attached.- Throws:
RuntimeException- if the context or parent fragment does not implementNotificationFragment.NotificationListener.
-
onCreateDialog
@NonNull public android.app.Dialog onCreateDialog(@Nullable android.os.Bundle savedInstanceState) Creates and returns the notification composition dialog.- Overrides:
onCreateDialogin classandroidx.fragment.app.DialogFragment- Parameters:
savedInstanceState- The last saved instance state of the Fragment, or null if this is a freshly created Fragment.- Returns:
- A built
AlertDialogfor notification input.
-