diff options
author | alescdb <alescdb@users.noreply.github.com> | 2015-10-23 14:30:56 +0200 |
---|---|---|
committer | alescdb <alescdb@users.noreply.github.com> | 2015-10-23 14:30:56 +0200 |
commit | d5da7817cfcfb6f33d0e4050e2662942836b159b (patch) | |
tree | 284dc348f17eae663e204f6898133b83bfe375b5 /app/src/main/java | |
parent | dac102b706df09ebc5f4a3b88df11ce8d47b14b8 (diff) | |
download | connectbot-d5da7817cfcfb6f33d0e4050e2662942836b159b.tar.gz connectbot-d5da7817cfcfb6f33d0e4050e2662942836b159b.tar.bz2 connectbot-d5da7817cfcfb6f33d0e4050e2662942836b159b.zip |
Call MediaPlayer.seekTo() before MediaPlayer.start()
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/org/connectbot/service/TerminalManager.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/app/src/main/java/org/connectbot/service/TerminalManager.java b/app/src/main/java/org/connectbot/service/TerminalManager.java index e716094..73eb4d1 100644 --- a/app/src/main/java/org/connectbot/service/TerminalManager.java +++ b/app/src/main/java/org/connectbot/service/TerminalManager.java @@ -53,7 +53,6 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.media.AudioManager; import android.media.MediaPlayer; -import android.media.MediaPlayer.OnCompletionListener; import android.net.Uri; import android.os.Binder; import android.os.IBinder; @@ -560,10 +559,10 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen PreferenceConstants.DEFAULT_BELL_VOLUME); mediaPlayer.setAudioStreamType(AudioManager.STREAM_NOTIFICATION); - mediaPlayer.setOnCompletionListener(new BeepListener()); AssetFileDescriptor file = res.openRawResourceFd(R.raw.bell); try { + mediaPlayer.setLooping(false); mediaPlayer.setDataSource(file.getFileDescriptor(), file .getStartOffset(), file.getLength()); file.close(); @@ -582,19 +581,15 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen } public void playBeep() { - if (mediaPlayer != null) + if (mediaPlayer != null) { + mediaPlayer.seekTo(0); mediaPlayer.start(); + } if (wantBellVibration) vibrate(); } - private static class BeepListener implements OnCompletionListener { - public void onCompletion(MediaPlayer mp) { - mp.seekTo(0); - } - } - /** * Send system notification to user for a certain host. When user selects * the notification, it will bring them directly to the ConsoleActivity |