Class AudioTrackSelectionDialogFragment
- java.lang.Object
-
- android.app.Fragment
-
- android.app.DialogFragment
-
- com.castlabs.sdk.playerui.dialogs.AbstractSelectionDialog<AudioTrack>
-
- com.castlabs.sdk.playerui.dialogs.AudioTrackSelectionDialogFragment
-
- All Implemented Interfaces:
ComponentCallbacks
,ComponentCallbacks2
,DialogInterface.OnCancelListener
,DialogInterface.OnClickListener
,DialogInterface.OnDismissListener
,View.OnCreateContextMenuListener
public class AudioTrackSelectionDialogFragment extends AbstractSelectionDialog<AudioTrack>
This is a utility class that allows you to create a DialogFragment that can be used to switch audio tracks. See the variousnewInstance
methods on how to customize the dialog. Note that the hosting activity that starts the dialog should implement thePlayerViewProvider
interface as the dialog needs to be able to access the underlyingIPlayerView
to retrieve its data and apply the selection even when the system disposes and recreates the dialog.- Since:
- 3.0.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class android.app.Fragment
Fragment.InstantiationException, Fragment.SavedState
-
-
Field Summary
-
Fields inherited from class com.castlabs.sdk.playerui.dialogs.AbstractSelectionDialog
ARG_ALLOW_DISABLE, ARG_ITEMS, ARG_SELECTED, ARG_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 AudioTrackSelectionDialogFragment()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AudioTrackSelectionDialogFragment
newInstance(IPlayerView playerView, String title)
Creates a new dialog fragment that shows the available audio tracks and allows selecting the new track.static AudioTrackSelectionDialogFragment
newInstance(IPlayerView playerView, String title, boolean allowDisable)
Creates a new dialog fragment that shows the available audio tracks and allows selecting the new track.static AudioTrackSelectionDialogFragment
newInstance(IPlayerView playerView, String title, boolean allowDisable, boolean showSupportedTracks, Converter<AudioTrack,String> converter)
Creates a new dialog fragment that shows the supported audio tracks on the device and allows selecting the new track.static AudioTrackSelectionDialogFragment
newInstance(IPlayerView playerView, String title, boolean allowDisable, Converter<AudioTrack,String> converter)
Creates a new dialog fragment that shows the available audio tracks and allows selecting the new track.-
Methods inherited from class com.castlabs.sdk.playerui.dialogs.AbstractSelectionDialog
getPlayerView, onClick, onCreateDialog, setPlayerView
-
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
-
-
-
-
Method Detail
-
newInstance
public static AudioTrackSelectionDialogFragment newInstance(IPlayerView playerView, String title)
Creates a new dialog fragment that shows the available audio tracks and allows selecting the new track. By default, this dialog will not allow to disable the audio track. The default string representation of the audio track is its label (seeAudioTrack.getLabel()
).- Parameters:
playerView
- The player viewtitle
- The dialog title- Returns:
- The dialog fragment
-
newInstance
public static AudioTrackSelectionDialogFragment newInstance(IPlayerView playerView, String title, boolean allowDisable)
Creates a new dialog fragment that shows the available audio tracks and allows selecting the new track. The default string representation of the audio track is its label (seeAudioTrack.getLabel()
).- Parameters:
playerView
- The player viewtitle
- The dialog titleallowDisable
- If true, the dialog will allow to disable the audio track. If you need to specify a custom label for the "disable" entry, usenewInstance(IPlayerView, String, boolean, Converter)
and specify a custom converter- Returns:
- The dialog fragment
-
newInstance
public static AudioTrackSelectionDialogFragment newInstance(IPlayerView playerView, String title, boolean allowDisable, Converter<AudioTrack,String> converter)
Creates a new dialog fragment that shows the available audio tracks and allows selecting the new track.- Parameters:
playerView
- The player viewtitle
- The dialog titleallowDisable
- If true, the dialog will allow to disable the audio track.converter
- The converter that is used to translateAudioTrack
instanced to Strings that are used as labels in the dialog. Note that the converter should translatenull
to the string representation of the "disable" item ifallowDisable
is set to true.- Returns:
- The dialog fragment
-
newInstance
public static AudioTrackSelectionDialogFragment newInstance(IPlayerView playerView, String title, boolean allowDisable, boolean showSupportedTracks, Converter<AudioTrack,String> converter) throws com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException
Creates a new dialog fragment that shows the supported audio tracks on the device and allows selecting the new track.- Parameters:
playerView
- The player viewtitle
- The dialog titleallowDisable
- If true, the dialog will allow to disable the audio track.converter
- The converter that is used to translateAudioTrack
instanced to Strings that are used as labels in the dialog. Note that the converter should translatenull
to the string representation of the "disable" item ifallowDisable
is set to true.showSupportedTracks
- It queries decoder to show just the tracks that are supported on either the device itself or passthrough.- Returns:
- The dialog fragment
- Throws:
com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException
- in case an error occurs when decoder information is queried
-
-