public class DeviceSelectorDialog extends DialogFragment implements AdapterView.OnItemSelectedListener, CompoundButton.OnCheckedChangeListener
DialogFragment for selecting Moppy devices to connect/disconnect to.Fragment.InstantiationException, Fragment.SavedStateSTYLE_NO_FRAME, STYLE_NO_INPUT, STYLE_NO_TITLE, STYLE_NORMAL| Constructor and Description |
|---|
DeviceSelectorDialog() |
| Modifier and Type | Method and Description |
|---|---|
MediaBrowserCompat |
getMediaBrowser()
Retrieves the
MediaBrowserCompat this DeviceSelectorDialog uses to manage devices. |
static DeviceSelectorDialog |
newInstance(MediaBrowserCompat mediaBrowser)
Creates a new
DeviceSelectorDialog. |
void |
onCheckedChanged(CompoundButton buttonView,
boolean isChecked)
Triggered when the checked state of a
CheckBox changes. |
void |
onCreate(Bundle savedInstanceState)
Triggered when this
DeviceSelectorDialog is created. |
Dialog |
onCreateDialog(Bundle savedInstanceState)
Triggered when the contained dialog is created.
|
void |
onDestroyView()
Triggered when the contained dialog is destroyed.
|
void |
onDeviceConnectionStateChanged()
Updates this
DeviceSelectorDialog's available device lists if it is showing, otherwise waits
for the next time this DeviceSelectorDialog is shown to refresh. |
void |
onItemSelected(AdapterView<?> parent,
View view,
int position,
long id)
Triggered when an item in either of the
Spinners has been selected. |
void |
onNothingSelected(AdapterView<?> parent)
Triggered when the selection disappears from this view.
|
void |
onStart()
Triggered whenever this
DeviceSelectorDialog comes into the foreground from a hidden state
(e.g. |
void |
onUsbPermissionIntent(Intent intent)
Handles device connection when permission had to be requested first.
|
void |
updateDevices()
Updates the list of available devices in this
DeviceSelectorDialog. |
dismiss, dismissAllowingStateLoss, getDialog, getShowsDialog, getTheme, isCancelable, onActivityCreated, onAttach, onCancel, onDetach, onDismiss, onGetLayoutInflater, onSaveInstanceState, onStop, requireDialog, setCancelable, setShowsDialog, setStyle, setupDialog, show, show, showNowdump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, 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, onViewStateRestored, postponeEnterTransition, postponeEnterTransition, 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, unregisterForContextMenupublic static DeviceSelectorDialog newInstance(MediaBrowserCompat mediaBrowser)
DeviceSelectorDialog. This is the only way a DeviceSelectorDialog
should be created. If creation is not done through this method the DeviceSelectorDialog
will be unable to communicate with the MoppyMediaService and will be effectively useless.mediaBrowser - the MediaBrowserCompat used to communicate with the MoppyMediaServiceDeviceSelectorDialogpublic void onCreate(@Nullable Bundle savedInstanceState)
DeviceSelectorDialog is created.onCreate in class DialogFragmentsavedInstanceState - If the fragment is being re-created from
a previous saved state, this is the state.onCreateDialog(Bundle)public Dialog onCreateDialog(Bundle savedInstanceState)
onCreate(Bundle),
otherwise this will be called subsequently to onCreate.onCreateDialog in class DialogFragmentsavedInstanceState - The last saved instance state of the Fragment,
or null if this is a freshly created Fragment.public void onStart()
DeviceSelectorDialog comes into the foreground from a hidden state
(e.g. app minimized, device locked), including when this DeviceSelectorDialog first gets created.onStart in class DialogFragmentpublic void onDestroyView()
Fragment.onDestroy()
will not be called, but if the dialog was destroyed due to dismissal then onDestroy will be called.onDestroyView in class DialogFragmentpublic void onUsbPermissionIntent(Intent intent)
MainActivity.ACTION_USB_PERMISSION broadcast is handled by MainActivity's
BroadcastReceiver.intent - the intent associated with the ACTION_USB_PERMISSION broadcastpublic void onDeviceConnectionStateChanged()
DeviceSelectorDialog's available device lists if it is showing, otherwise waits
for the next time this DeviceSelectorDialog is shown to refresh. Should be called when either
UsbManager.ACTION_USB_DEVICE_ATTACHED or UsbManager.ACTION_USB_DEVICE_DETACHED occurs.public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
Spinners has been selected.onItemSelected in interface AdapterView.OnItemSelectedListenerpublic void onNothingSelected(AdapterView<?> parent)
onNothingSelected in interface AdapterView.OnItemSelectedListenerpublic void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
CheckBox changes.onCheckedChanged in interface CompoundButton.OnCheckedChangeListenerpublic void updateDevices()
DeviceSelectorDialog.public MediaBrowserCompat getMediaBrowser()
MediaBrowserCompat this DeviceSelectorDialog uses to manage devices.MediaBrowserCompat used to communicate with the MoppyMediaService