public class MidiSpinnerAdapter extends ArrayAdapter<MidiPortInfoWrapper>
List<MidiPortInfoWrapper> adapter for a Spinner
that displays the name of each port as a list entry.IGNORE_ITEM_VIEW_TYPE, NO_SELECTION| Modifier and Type | Method and Description |
|---|---|
void |
addDevice(MidiDeviceInfo deviceInfo)
Adds the relevant ports ports of a
MidiDeviceInfo to the dataset if they are not already there. |
boolean |
containsDevice(MidiDeviceInfo deviceInfo)
Checks whether any ports with a specific parent
MidiDeviceInfo are present. |
View |
getDropDownView(int position,
View convertView,
ViewGroup parent)
Triggered when a dropdown entry is created.
|
int |
getIndexOf(MidiPortInfoWrapper portInfo)
Gets the index of the first entry for the specified
MidiPortInfoWrapper. |
View |
getView(int position,
View convertView,
ViewGroup parent)
Triggered when an entry is created.
|
static MidiSpinnerAdapter |
newInstance(Context context,
List<MidiDeviceInfo> infos,
boolean selectInputs,
boolean selectOutputs)
Constructs a new
MidiSpinnerAdapter. |
void |
removeDevice(MidiDeviceInfo deviceInfo)
Removes all ports with a specific parent
MidiDeviceInfo from the dataset. |
add, addAll, addAll, clear, createFromResource, getAutofillOptions, getContext, getCount, getDropDownViewTheme, getFilter, getItem, getItemId, getPosition, insert, notifyDataSetChanged, remove, setDropDownViewResource, setDropDownViewTheme, setNotifyOnChange, sortareAllItemsEnabled, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetInvalidated, registerDataSetObserver, setAutofillOptions, unregisterDataSetObserverclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetItemViewType, getViewTypeCount, hasStableIds, isEmpty, registerDataSetObserver, unregisterDataSetObserverpublic static MidiSpinnerAdapter newInstance(Context context, List<MidiDeviceInfo> infos, boolean selectInputs, boolean selectOutputs)
MidiSpinnerAdapter.context - the context to create the MidiSpinnerAdapter ininfos - the List of MidiPortInfoWrappers to displayselectInputs - set to true if input ports should appear in the list, false if notselectOutputs - set to true if output ports should appear in the list, false if notMidiSpinnerAdapter@NonNull public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent)
getView in interface AdaptergetView in class ArrayAdapter<MidiPortInfoWrapper>public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent)
getDropDownView in interface SpinnerAdaptergetDropDownView in class ArrayAdapter<MidiPortInfoWrapper>public int getIndexOf(MidiPortInfoWrapper portInfo)
MidiPortInfoWrapper.portInfo - the port to look for-1 if not found, otherwise the indexpublic void addDevice(MidiDeviceInfo deviceInfo)
MidiDeviceInfo to the dataset if they are not already there.deviceInfo - the parent of the ports to addpublic void removeDevice(MidiDeviceInfo deviceInfo)
MidiDeviceInfo from the dataset.deviceInfo - the parent whose children ports should be removedpublic boolean containsDevice(MidiDeviceInfo deviceInfo)
MidiDeviceInfo are present.deviceInfo - the parent to look fortrue if child ports of parent are found, otherwise false