mirror of https://github.com/sipwise/jitsi.git
parent
2a12eeb074
commit
8a3d92b5ac
@ -0,0 +1,130 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.impl.gui.utils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.*;
|
||||
import net.java.sip.communicator.service.notification.*;
|
||||
|
||||
public class NotificationManager
|
||||
{
|
||||
public static final String INCOMING_MESSAGE = "IncomingMessage";
|
||||
|
||||
public static final String INCOMING_CALL = "IncomingCall";
|
||||
|
||||
public static final String OUTGOING_CALL = "OutgoingCall";
|
||||
|
||||
public static final String BUSY_CALL = "BusyCall";
|
||||
|
||||
private static Hashtable soundHandlers = new Hashtable();
|
||||
|
||||
public static void registerGuiNotifications()
|
||||
{
|
||||
NotificationService notificationService
|
||||
= GuiActivator.getNotificationService();
|
||||
|
||||
if(notificationService == null)
|
||||
return;
|
||||
|
||||
// Register incoming message notifications.
|
||||
notificationService.registerNotificationForEvent(
|
||||
INCOMING_MESSAGE,
|
||||
NotificationService.ACTION_POPUP_MESSAGE,
|
||||
null,
|
||||
null);
|
||||
|
||||
notificationService.registerNotificationForEvent(
|
||||
INCOMING_MESSAGE,
|
||||
NotificationService.ACTION_SOUND,
|
||||
Sounds.INCOMING_MESSAGE,
|
||||
null);
|
||||
|
||||
// Register incoming call notifications.
|
||||
notificationService.registerNotificationForEvent(
|
||||
INCOMING_CALL,
|
||||
NotificationService.ACTION_POPUP_MESSAGE,
|
||||
null,
|
||||
null);
|
||||
|
||||
SoundNotificationHandler inCallSoundHandler
|
||||
= (SoundNotificationHandler) notificationService
|
||||
.createSoundNotificationHandler(Sounds.INCOMING_CALL, 2000);
|
||||
|
||||
notificationService.registerNotificationForEvent(
|
||||
INCOMING_CALL,
|
||||
NotificationService.ACTION_SOUND,
|
||||
inCallSoundHandler);
|
||||
|
||||
soundHandlers.put(INCOMING_CALL, inCallSoundHandler);
|
||||
|
||||
// Register outgoing call notifications.
|
||||
SoundNotificationHandler outCallSoundHandler
|
||||
= (SoundNotificationHandler) notificationService
|
||||
.createSoundNotificationHandler(Sounds.OUTGOING_CALL, 3000);
|
||||
|
||||
notificationService.registerNotificationForEvent(
|
||||
OUTGOING_CALL,
|
||||
NotificationService.ACTION_SOUND,
|
||||
outCallSoundHandler);
|
||||
|
||||
soundHandlers.put(OUTGOING_CALL, outCallSoundHandler);
|
||||
|
||||
// Register busy call notifications.
|
||||
SoundNotificationHandler busyCallSoundHandler
|
||||
= (SoundNotificationHandler) notificationService
|
||||
.createSoundNotificationHandler(Sounds.BUSY, 0);
|
||||
|
||||
notificationService.registerNotificationForEvent(
|
||||
BUSY_CALL,
|
||||
NotificationService.ACTION_SOUND,
|
||||
busyCallSoundHandler);
|
||||
|
||||
soundHandlers.put(OUTGOING_CALL, outCallSoundHandler);
|
||||
|
||||
}
|
||||
|
||||
public static void fireNotification(String eventType,
|
||||
String messageTitle,
|
||||
String message)
|
||||
{
|
||||
NotificationService notificationService
|
||||
= GuiActivator.getNotificationService();
|
||||
|
||||
if(notificationService == null)
|
||||
return;
|
||||
|
||||
notificationService.fireNotification(eventType, messageTitle, message);
|
||||
}
|
||||
|
||||
public static void fireNotification(String eventType)
|
||||
{
|
||||
NotificationService notificationService
|
||||
= GuiActivator.getNotificationService();
|
||||
|
||||
if(notificationService == null)
|
||||
return;
|
||||
|
||||
notificationService.fireNotification(eventType);
|
||||
}
|
||||
|
||||
public static void stopSound(String eventType)
|
||||
{
|
||||
NotificationService notificationService
|
||||
= GuiActivator.getNotificationService();
|
||||
|
||||
if(notificationService == null)
|
||||
return;
|
||||
|
||||
SoundNotificationHandler soundHandler
|
||||
= (SoundNotificationHandler) notificationService
|
||||
.getEventNotificationActionHandler(
|
||||
eventType, NotificationService.ACTION_SOUND);
|
||||
|
||||
soundHandler.stop();
|
||||
}
|
||||
}
|
||||
@ -1,19 +1,19 @@
|
||||
INCOMING_MESSAGE=net/java/sip/communicator/impl/gui/resources/sounds/ship-sink.wav
|
||||
INCOMING_CALL=net/java/sip/communicator/impl/gui/resources/sounds/incomingCall.wav
|
||||
OUTGOING_CALL=net/java/sip/communicator/impl/gui/resources/sounds/ring.wav
|
||||
INCOMING_MESSAGE=resources/sounds/ship-sink.wav
|
||||
INCOMING_CALL=resources/sounds/incomingCall.wav
|
||||
OUTGOING_CALL=resources/sounds/ring.wav
|
||||
|
||||
DIAL_ZERO=net/java/sip/communicator/impl/gui/resources/sounds/one_1.wav
|
||||
DIAL_ONE=net/java/sip/communicator/impl/gui/resources/sounds/one_1.wav
|
||||
DIAL_TWO=net/java/sip/communicator/impl/gui/resources/sounds/two_2.wav
|
||||
DIAL_THREE=net/java/sip/communicator/impl/gui/resources/sounds/three_3.wav
|
||||
DIAL_FOUR=net/java/sip/communicator/impl/gui/resources/sounds/four_4.wav
|
||||
DIAL_FIVE=net/java/sip/communicator/impl/gui/resources/sounds/five_5.wav
|
||||
DIAL_SIX=net/java/sip/communicator/impl/gui/resources/sounds/six_6.wav
|
||||
DIAL_SEVEN=net/java/sip/communicator/impl/gui/resources/sounds/seven_7.wav
|
||||
DIAL_EIGHT=net/java/sip/communicator/impl/gui/resources/sounds/eight_8.wav
|
||||
DIAL_NINE=net/java/sip/communicator/impl/gui/resources/sounds/nine_9.wav
|
||||
DIAL_DIEZ=net/java/sip/communicator/impl/gui/resources/sounds/one_1.wav
|
||||
DIAL_STAR=net/java/sip/communicator/impl/gui/resources/sounds/one_1.wav
|
||||
DIAL_ZERO=resources/sounds/one_1.wav
|
||||
DIAL_ONE=resources/sounds/one_1.wav
|
||||
DIAL_TWO=resources/sounds/two_2.wav
|
||||
DIAL_THREE=resources/sounds/three_3.wav
|
||||
DIAL_FOUR=resources/sounds/four_4.wav
|
||||
DIAL_FIVE=resources/sounds/five_5.wav
|
||||
DIAL_SIX=resources/sounds/six_6.wav
|
||||
DIAL_SEVEN=resources/sounds/seven_7.wav
|
||||
DIAL_EIGHT=resources/sounds/eight_8.wav
|
||||
DIAL_NINE=resources/sounds/nine_9.wav
|
||||
DIAL_DIEZ=resources/sounds/one_1.wav
|
||||
DIAL_STAR=resources/sounds/one_1.wav
|
||||
|
||||
DIALING=net/java/sip/communicator/impl/gui/resources/sounds/dialing.wav
|
||||
BUSY=net/java/sip/communicator/impl/gui/resources/sounds/busy.wav
|
||||
DIALING=resources/sounds/dialing.wav
|
||||
BUSY=resources/sounds/busy.wav
|
||||
Loading…
Reference in new issue