disconnect cast session if user disables it in preferences and PlaybackService isn't running

This commit is contained in:
Domingos Lopes 2016-04-16 10:23:40 -04:00
parent 2762af8d50
commit 8a18adf50c
1 changed files with 4 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.cast.CastManager;
import de.danoeh.antennapod.core.cast.SwitchableMediaRouteActionProvider;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.service.playback.PlaybackService;
/**
* Activity that allows for showing the MediaRouter button whenever there's a cast device in the
@ -97,7 +98,9 @@ public abstract class CastEnabledActivity extends AppCompatActivity
mCastManager.decrementUiCounter();
castUICounter--;
}
//TODO disable any current casting (or possibly do it within the PlaybackService)
if (!PlaybackService.isRunning) {
CastManager.getInstance().disconnect();
}
}
}
}