Java Code Examples for android.util.SparseArray#indexOfValue()

The following examples show how to use android.util.SparseArray#indexOfValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: USBMonitor.java    From AndroidUSBCamera with Apache License 2.0 5 votes vote down vote up
/**
 * close interface
 * @param intf
 * @throws IllegalStateException
 */
public synchronized void releaseInterface(final UsbInterface intf) throws IllegalStateException {
	checkConnection();
	final SparseArray<UsbInterface> intfs = mInterfaces.get(intf.getId());
	if (intfs != null) {
		final int index = intfs.indexOfValue(intf);
		intfs.removeAt(index);
		if (intfs.size() == 0) {
			mInterfaces.remove(intf.getId());
		}
	}
	mConnection.releaseInterface(intf);
}
 
Example 2
Source File: USBMonitor.java    From libcommon with Apache License 2.0 5 votes vote down vote up
/**
 * インターフェースを閉じる
 * @param intf
 * @throws IllegalStateException
 */
public synchronized void releaseInterface(final UsbInterface intf)
	throws IllegalStateException {

	checkConnection();
	final SparseArray<UsbInterface> intfs = mInterfaces.get(intf.getId());
	if (intfs != null) {
		final int index = intfs.indexOfValue(intf);
		intfs.removeAt(index);
		if (intfs.size() == 0) {
			mInterfaces.remove(intf.getId());
		}
	}
	mConnection.releaseInterface(intf);
}
 
Example 3
Source File: USBMonitor.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
/**
 * close interface
 * @param intf
 * @throws IllegalStateException
 */
public synchronized void releaseInterface(final UsbInterface intf) throws IllegalStateException {
	checkConnection();
	final SparseArray<UsbInterface> intfs = mInterfaces.get(intf.getId());
	if (intfs != null) {
		final int index = intfs.indexOfValue(intf);
		intfs.removeAt(index);
		if (intfs.size() == 0) {
			mInterfaces.remove(intf.getId());
		}
	}
	mConnection.releaseInterface(intf);
}
 
Example 4
Source File: Node.java    From BlueSTSDK_Android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private int extractFeatureMask(Feature f){
    SparseArray<Class<? extends Feature>> decoder = Manager.getNodeFeatures(
            mAdvertise.getDeviceId());
    int index = decoder.indexOfValue(f.getClass());
    return decoder.keyAt(index);
}