minor changes to fix #1493

This commit is contained in:
Tom Hennen 2015-12-28 12:26:00 -05:00
parent 83dbe4fe07
commit 2302d7caef
1 changed files with 8 additions and 4 deletions

View File

@ -485,16 +485,20 @@ public abstract class MediaplayerActivity extends ActionBarActivity
public void onClick(View v) { public void onClick(View v) {
showTimeLeft = !showTimeLeft; showTimeLeft = !showTimeLeft;
Playable media = controller.getMedia(); Playable media = controller.getMedia();
if(showTimeLeft) { if (media == null) {
return;
}
if (showTimeLeft) {
txtvLength.setText("-"+Converter.getDurationStringLong((media txtvLength.setText("-"+Converter.getDurationStringLong((media
.getDuration()-media.getPosition()))); .getDuration()-media.getPosition())));
}else{ } else {
txtvLength.setText("-"+Converter.getDurationStringLong((media.getDuration()))); txtvLength.setText(Converter.getDurationStringLong((media.getDuration())));
} }
SharedPreferences.Editor editor = prefs.edit(); SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean(PREF_SHOW_TIME_LEFT,showTimeLeft); editor.putBoolean(PREF_SHOW_TIME_LEFT,showTimeLeft);
editor.commit(); editor.apply();
Log.d("timeleft on click",showTimeLeft? "true":"false"); Log.d("timeleft on click",showTimeLeft? "true":"false");
} }
}); });