Fix another crash with ringtone

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-07-17 16:21:02 +02:00
parent 9f15661273
commit a70d36bb80

View file

@ -229,7 +229,6 @@ public class RingtoneSelectionController extends BaseController implements Flexi
NotificationSoundItem notificationSoundItem = (NotificationSoundItem) adapter.getItem(position);
Uri ringtoneUri = null;
Runnable runnable = () -> endMediaPlayer();
if (!TextUtils.isEmpty(notificationSoundItem.getNotificationSoundUri())) {
ringtoneUri = Uri.parse(notificationSoundItem.getNotificationSoundUri());
@ -238,7 +237,12 @@ public class RingtoneSelectionController extends BaseController implements Flexi
mediaPlayer = MediaPlayer.create(getActivity(), ringtoneUri);
cancelMediaPlayerHandler = new Handler();
cancelMediaPlayerHandler.postDelayed(runnable, mediaPlayer.getDuration() + 25);
cancelMediaPlayerHandler.postDelayed(new Runnable() {
@Override
public void run() {
endMediaPlayer();
}
}, mediaPlayer.getDuration() + 25);
mediaPlayer.start();
}