Class AbstractSelectionDialog<T>
- java.lang.Object
-
- android.app.Fragment
-
- android.app.DialogFragment
-
- com.castlabs.sdk.playerui.dialogs.AbstractSelectionDialog<T>
-
- Type Parameters:
T
- The source type
- All Implemented Interfaces:
ComponentCallbacks
,ComponentCallbacks2
,DialogInterface.OnCancelListener
,DialogInterface.OnClickListener
,DialogInterface.OnDismissListener
,View.OnCreateContextMenuListener
- Direct Known Subclasses:
AudioTrackSelectionDialogFragment
,ScalingModeSelectionDialogFragment
,SubtitleSelectionDialogFragment
,VideoQualitySelectionDialogFragment
public abstract class AbstractSelectionDialog<T> extends DialogFragment implements DialogInterface.OnClickListener
This is a base class for utility selection dialogs that can be used to show and apply a selection if items. Subclasses can set the player view reference explicitly when instance are created, but for better compatibility with the fragment system, we encourage you to let the hosting Activity implementPlayerViewProvider
. That way dialogs can be recreated by by the system and will still be able to resolve the player view to apply selections.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class android.app.Fragment
Fragment.InstantiationException, Fragment.SavedState
-
-
Field Summary
Fields Modifier and Type Field Description static String
ARG_ALLOW_DISABLE
The argument key to store if disabling is allowed and an extra item will be displayed at the top of the liststatic String
ARG_ITEMS
The argument key to store the itemsstatic String
ARG_SELECTED
The argument key to store the currently selected itemstatic String
ARG_TITLE
The argument key for the dialog title-
Fields inherited from class android.app.DialogFragment
STYLE_NO_FRAME, STYLE_NO_INPUT, STYLE_NO_TITLE, STYLE_NORMAL
-
Fields inherited from interface android.content.ComponentCallbacks2
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
-
-
Constructor Summary
Constructors Constructor Description AbstractSelectionDialog()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IPlayerView
getPlayerView()
If the parent activity implementsPlayerViewProvider
, the provider is used to return the player view, otherwise this returns theIPlayerView
instance that is bound to this dialog.void
onClick(DialogInterface dialog, int which)
Dialog
onCreateDialog(Bundle savedInstanceState)
void
setPlayerView(IPlayerView playerView)
Set the player view reference-
Methods inherited from class android.app.DialogFragment
dismiss, dismissAllowingStateLoss, dump, getDialog, getShowsDialog, getTheme, isCancelable, onActivityCreated, onAttach, onCancel, onCreate, onDestroyView, onDetach, onDismiss, onGetLayoutInflater, onSaveInstanceState, onStart, onStop, setCancelable, setShowsDialog, setStyle, show, show
-
Methods inherited from class android.app.Fragment
equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isRemoving, isResumed, isStateSaved, isVisible, onActivityResult, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onCreateView, onDestroy, onDestroyOptionsMenu, onHiddenChanged, onInflate, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPictureInPictureModeChanged, onPrepareOptionsMenu, onRequestPermissionsResult, onResume, onTrimMemory, onViewCreated, onViewStateRestored, postponeEnterTransition, registerForContextMenu, requestPermissions, 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
-
-
-
-
Field Detail
-
ARG_TITLE
public static final String ARG_TITLE
The argument key for the dialog title- See Also:
- Constant Field Values
-
ARG_ITEMS
public static final String ARG_ITEMS
The argument key to store the items- See Also:
- Constant Field Values
-
ARG_SELECTED
public static final String ARG_SELECTED
The argument key to store the currently selected item- See Also:
- Constant Field Values
-
ARG_ALLOW_DISABLE
public static final String ARG_ALLOW_DISABLE
The argument key to store if disabling is allowed and an extra item will be displayed at the top of the list- See Also:
- Constant Field Values
-
-
Method Detail
-
getPlayerView
@Nullable public IPlayerView getPlayerView()
If the parent activity implementsPlayerViewProvider
, the provider is used to return the player view, otherwise this returns theIPlayerView
instance that is bound to this dialog.- Returns:
- The player view instance
-
setPlayerView
public void setPlayerView(@Nullable IPlayerView playerView)
Set the player view reference- Parameters:
playerView
- The player view reference
-
onCreateDialog
@NonNull public Dialog onCreateDialog(Bundle savedInstanceState)
- Overrides:
onCreateDialog
in classDialogFragment
-
onClick
public void onClick(DialogInterface dialog, int which)
- Specified by:
onClick
in interfaceDialogInterface.OnClickListener
-
-