play notification sound when a move or chat is added to the board or

chat view. Still TODO: post a notification when that view isn't visible.
This commit is contained in:
Eric House 2016-04-14 21:39:23 -07:00
parent 994672667c
commit e239430260
3 changed files with 9 additions and 0 deletions

View file

@ -1936,6 +1936,7 @@ public class BoardDelegate extends DelegateBase
{
m_words = null == words? null : wordsToArray( words );
nonBlockingDialog( DlgID.DLG_SCORES, expl );
Utils.playNotificationSound( m_activity );
}
@Override

View file

@ -234,6 +234,7 @@ public class ChatDelegate extends DelegateBase {
&& s_visibleThis.m_rowid == rowid;
if ( handled ) {
s_visibleThis.addRow( msg, fromIndx );
Utils.playNotificationSound( s_visibleThis.m_activity );
}
return handled;
}

View file

@ -239,6 +239,13 @@ public class Utils {
nm.cancel( id );
}
public static void playNotificationSound( Context context )
{
Uri uri = RingtoneManager
.getDefaultUri( RingtoneManager.TYPE_NOTIFICATION );
RingtoneManager.getRingtone( context, uri ).play();
}
// adapted from
// http://stackoverflow.com/questions/2174048/how-to-look-up-a-contacts-name-from-their-phone-number-on-android
public static String phoneToContact( Context context, String phone,