Lint: 'if' replaceable with 'switch'

This commit is contained in:
TacoTheDank 2020-11-18 17:58:41 -05:00
parent c24999075d
commit ad2ea0b807

View file

@ -1346,19 +1346,24 @@ public final class VideoDetailFragment
broadcastReceiver = new BroadcastReceiver() { broadcastReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(final Context context, final Intent intent) { public void onReceive(final Context context, final Intent intent) {
if (intent.getAction().equals(ACTION_SHOW_MAIN_PLAYER)) { switch (intent.getAction()) {
case ACTION_SHOW_MAIN_PLAYER:
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
} else if (intent.getAction().equals(ACTION_HIDE_MAIN_PLAYER)) { break;
case ACTION_HIDE_MAIN_PLAYER:
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
} else if (intent.getAction().equals(ACTION_PLAYER_STARTED)) { break;
case ACTION_PLAYER_STARTED:
// If the state is not hidden we don't need to show the mini player // If the state is not hidden we don't need to show the mini player
if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN) { if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN) {
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
} }
// Rebound to the service if it was closed via notification or mini player // Rebound to the service if it was closed via notification or mini player
if (!PlayerHolder.bound) { if (!PlayerHolder.bound) {
PlayerHolder.startService(App.getApp(), false, VideoDetailFragment.this); PlayerHolder.startService(
App.getApp(), false, VideoDetailFragment.this);
} }
break;
} }
} }
}; };