Changes sequence of audio configuration modification events in order to aggregate pop-up notification events.

cusax-fix
Vincent Lucas 13 years ago
parent f3df7dc1f6
commit c4a0b3c6cb

@ -102,18 +102,17 @@ public void managePopupMessageListenerRegistration(boolean enable)
* change.
*
* @param title The title of the pop-up notification.
* @param device The device which has been connected, disconnected or
* selected as default device.
* @param body A body text describing the device modifications.
* @param popUpEvent The event for a device which has fired this
* notification: connected, disconnected or selected.
*/
public void showPopUpNotification(
String title,
CaptureDeviceInfo device,
String body,
String popUpEvent)
{
// Shows the pop-up notification.
if(title != null && device != null && popUpEvent != null)
if(title != null && body != null && popUpEvent != null)
{
NotificationService notificationService
= NeomediaActivator.getNotificationService();
@ -140,8 +139,8 @@ public void showPopUpNotification(
notificationService.fireNotification(
popUpEvent,
title,
device.getName()
+ "\r\n"
body
+ "\r\n\r\n"
+ resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_CONFIG_MANAGMENT_CLICK"),

@ -27,6 +27,22 @@
public class AudioDeviceConfigurationListener
extends AbstractDeviceConfigurationListener
{
/**
* The last selected capture device for which we have received an event.
*/
private CaptureDeviceInfo captureDevice = null;
/**
* The last selected playback device for which we have received an event.
*/
private CaptureDeviceInfo playbackDevice = null;
/**
* The last selected notification device for which we have received an
* event.
*/
private CaptureDeviceInfo notificationDevice = null;
/**
* Creates a listener to the click on the popup message concerning audio
* device configuration changes.
@ -81,11 +97,7 @@ else if(CaptureDevices.PROP_DEVICE.equals(event.getPropertyName()))
{
if(event.getNewValue() != null)
{
popUpEvent = NeomediaActivator.NEW_SELECTED_DEVICE;
title = resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_SELECTED_AUDIO_IN");
device = (CaptureDeviceInfo) event.getNewValue();
captureDevice = (CaptureDeviceInfo) event.getNewValue();
}
}
// If a new playback device has been selected.
@ -93,11 +105,7 @@ else if(PlaybackDevices.PROP_DEVICE.equals(event.getPropertyName()))
{
if(event.getNewValue() != null)
{
popUpEvent = NeomediaActivator.NEW_SELECTED_DEVICE;
title = resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_SELECTED_AUDIO_OUT");
device = (CaptureDeviceInfo) event.getNewValue();
playbackDevice = (CaptureDeviceInfo) event.getNewValue();
}
}
// If a new notify device has been selected.
@ -105,15 +113,53 @@ else if(NotifyDevices.PROP_DEVICE.equals(event.getPropertyName()))
{
if(event.getNewValue() != null)
{
popUpEvent = NeomediaActivator.NEW_SELECTED_DEVICE;
title = resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_SELECTED_AUDIO_NOTIFICATIONS");
device = (CaptureDeviceInfo) event.getNewValue();
notificationDevice = (CaptureDeviceInfo) event.getNewValue();
}
}
String body = null;
if(device != null)
{
body = device.getName();
if(captureDevice != null
|| playbackDevice != null
|| notificationDevice != null)
{
body += "\r\n";
if(captureDevice != null)
{
body += "\r\n"
+ resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_SELECTED_AUDIO_IN")
+ "\r\n\t"
+ captureDevice.getName();
captureDevice = null;
}
if(playbackDevice != null)
{
body += "\r\n"
+ resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_SELECTED_AUDIO_OUT")
+ "\r\n\t"
+ playbackDevice.getName();
playbackDevice = null;
}
if(notificationDevice != null)
{
body += "\r\n"
+ resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_SELECTED_AUDIO_NOTIFICATIONS")
+ "\r\n\t"
+ notificationDevice.getName();
notificationDevice = null;
}
}
}
// Shows the pop-up notification.
super.showPopUpNotification(title, device, popUpEvent);
super.showPopUpNotification(title, body, popUpEvent);
}
}

@ -67,7 +67,13 @@ public void propertyChange(PropertyChangeEvent event)
}
}
String body = null;
if(device != null)
{
body = device.getName();
}
// Shows the pop-up notification.
this.showPopUpNotification(title, device, popUpEvent);
this.showPopUpNotification(title, body, popUpEvent);
}
}

Loading…
Cancel
Save