Fixed building with Java 1.7
parent
83554cc307
commit
b701ac0266
|
@ -35,12 +35,16 @@ public class SDLAudioManager {
|
||||||
mAudioDeviceCallback = new AudioDeviceCallback() {
|
mAudioDeviceCallback = new AudioDeviceCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
|
public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
|
||||||
Arrays.stream(addedDevices).forEach(deviceInfo -> addAudioDevice(deviceInfo.isSink(), deviceInfo.getId()));
|
for (AudioDeviceInfo deviceInfo : addedDevices) {
|
||||||
|
addAudioDevice(deviceInfo.isSink(), deviceInfo.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
|
public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
|
||||||
Arrays.stream(removedDevices).forEach(deviceInfo -> removeAudioDevice(deviceInfo.isSink(), deviceInfo.getId()));
|
for (AudioDeviceInfo deviceInfo : removedDevices) {
|
||||||
|
removeAudioDevice(deviceInfo.isSink(), deviceInfo.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -286,25 +290,25 @@ public class SDLAudioManager {
|
||||||
private static AudioDeviceInfo getInputAudioDeviceInfo(int deviceId) {
|
private static AudioDeviceInfo getInputAudioDeviceInfo(int deviceId) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
||||||
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS))
|
for (AudioDeviceInfo deviceInfo : audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS)) {
|
||||||
.filter(deviceInfo -> deviceInfo.getId() == deviceId)
|
if (deviceInfo.getId() == deviceId) {
|
||||||
.findFirst()
|
return deviceInfo;
|
||||||
.orElse(null);
|
}
|
||||||
} else {
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AudioDeviceInfo getOutputAudioDeviceInfo(int deviceId) {
|
private static AudioDeviceInfo getOutputAudioDeviceInfo(int deviceId) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
||||||
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS))
|
for (AudioDeviceInfo deviceInfo : audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS)) {
|
||||||
.filter(deviceInfo -> deviceInfo.getId() == deviceId)
|
if (deviceInfo.getId() == deviceId) {
|
||||||
.findFirst()
|
return deviceInfo;
|
||||||
.orElse(null);
|
}
|
||||||
} else {
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerAudioDeviceCallback() {
|
private static void registerAudioDeviceCallback() {
|
||||||
|
|
Loading…
Reference in New Issue