consume volume down event
This commit is contained in:
parent
484f633180
commit
ebb38d7d75
|
@ -498,17 +498,21 @@ public class NotificationService {
|
|||
cancel(INCOMING_CALL_NOTIFICATION_ID);
|
||||
}
|
||||
|
||||
public void stopSoundAndVibration() {
|
||||
public boolean stopSoundAndVibration() {
|
||||
int stopped = 0;
|
||||
if (this.currentlyPlayingRingtone != null) {
|
||||
if (this.currentlyPlayingRingtone.isPlaying()) {
|
||||
Log.d(Config.LOGTAG, "stop playing ring tone");
|
||||
++stopped;
|
||||
}
|
||||
this.currentlyPlayingRingtone.stop();
|
||||
}
|
||||
if (this.vibrationFuture != null && !this.vibrationFuture.isCancelled()) {
|
||||
Log.d(Config.LOGTAG, "cancel vibration");
|
||||
Log.d(Config.LOGTAG, "stop vibration");
|
||||
this.vibrationFuture.cancel(true);
|
||||
++stopped;
|
||||
}
|
||||
return stopped > 0;
|
||||
}
|
||||
|
||||
public static void cancelIncomingCallNotification(final Context context) {
|
||||
|
|
|
@ -151,7 +151,9 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
|||
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN){
|
||||
if (xmppConnectionService != null) {
|
||||
xmppConnectionService.getNotificationService().stopSoundAndVibration();
|
||||
if (xmppConnectionService.getNotificationService().stopSoundAndVibration()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
|
|
Loading…
Reference in New Issue