From 2302d7caefc88d94078da847c4fc34010a724b65 Mon Sep 17 00:00:00 2001 From: Tom Hennen Date: Mon, 28 Dec 2015 12:26:00 -0500 Subject: [PATCH] minor changes to fix #1493 --- .../antennapod/activity/MediaplayerActivity.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java index ab3e2eb8d..45cc50d69 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -485,16 +485,20 @@ public abstract class MediaplayerActivity extends ActionBarActivity public void onClick(View v) { showTimeLeft = !showTimeLeft; Playable media = controller.getMedia(); - if(showTimeLeft) { + if (media == null) { + return; + } + + if (showTimeLeft) { txtvLength.setText("-"+Converter.getDurationStringLong((media .getDuration()-media.getPosition()))); - }else{ - txtvLength.setText("-"+Converter.getDurationStringLong((media.getDuration()))); + } else { + txtvLength.setText(Converter.getDurationStringLong((media.getDuration()))); } SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean(PREF_SHOW_TIME_LEFT,showTimeLeft); - editor.commit(); + editor.apply(); Log.d("timeleft on click",showTimeLeft? "true":"false"); } });