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()) {
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); case ACTION_SHOW_MAIN_PLAYER:
} else if (intent.getAction().equals(ACTION_HIDE_MAIN_PLAYER)) { bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); break;
} else if (intent.getAction().equals(ACTION_PLAYER_STARTED)) { case ACTION_HIDE_MAIN_PLAYER:
// If the state is not hidden we don't need to show the mini player bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN) { break;
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); case ACTION_PLAYER_STARTED:
} // If the state is not hidden we don't need to show the mini player
// Rebound to the service if it was closed via notification or mini player if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN) {
if (!PlayerHolder.bound) { bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
PlayerHolder.startService(App.getApp(), false, VideoDetailFragment.this); }
} // Rebound to the service if it was closed via notification or mini player
if (!PlayerHolder.bound) {
PlayerHolder.startService(
App.getApp(), false, VideoDetailFragment.this);
}
break;
} }
} }
}; };