/**
   * Update the UI when the song changes, either because the track has changed, or the active player
   * has changed.
   *
   * @param playerState the player state for the song.
   */
  @UiThread
  private void updateSongInfo(@NonNull PlayerState playerState) {
    updateTimeDisplayTo(playerState.getCurrentTimeSecond(), playerState.getCurrentSongDuration());

    Song song = playerState.getCurrentSong();

    if (song != null) {
      albumText.setText(song.getAlbumName());
      trackText.setText(song.getName());
      if (mFullHeightLayout) {
        artistText.setText(song.getArtist());
        totalTime.setText(Util.formatElapsedTime(song.getDuration()));
        if (song.isRemote()) {
          if (song.getButtons().length() == 0) {
            nextButton.setEnabled(false);
            Util.setAlpha(nextButton, 0.25f);
          } else {
            // TODO: figure out how to parse the buttons HASH;
            // for now just assume the next button is enabled
            nextButton.setEnabled(true);
            Util.setAlpha(nextButton, 1.0f);
          }
          prevButton.setEnabled(false);
          Util.setAlpha(prevButton, 0.25f);
          btnContextMenu.setVisibility(View.GONE);
        } else {
          nextButton.setEnabled(true);
          Util.setAlpha(nextButton, 1.0f);
          prevButton.setEnabled(true);
          Util.setAlpha(prevButton, 1.0f);
          btnContextMenu.setVisibility(View.VISIBLE);
        }
      }
    } else {
      albumText.setText("");
      trackText.setText("");
      if (mFullHeightLayout) {
        artistText.setText("");
        btnContextMenu.setVisibility(View.GONE);
      }
    }

    if (song == null || !song.hasArtwork()) {
      if (mFullHeightLayout) {
        albumArt.setImageResource(
            song != null && song.isRemote()
                ? R.drawable.icon_iradio_noart_fullscreen
                : R.drawable.icon_album_noart_fullscreen);
      } else {
        albumArt.setImageResource(
            song != null && song.isRemote()
                ? R.drawable.icon_iradio_noart
                : R.drawable.icon_album_noart);
      }
      return;
    }

    ImageFetcher.getInstance(mActivity).loadImage(song.getArtworkUrl(), albumArt);
  }
  /**
   * Update the UI based on the player state. Call this when the active player changes.
   *
   * @param playerState the player state to reflect in the UI.
   */
  @UiThread
  private void updateUiFromPlayerState(@NonNull PlayerState playerState) {
    updateSongInfo(playerState);

    updatePlayPauseIcon(playerState.getPlayStatus());
    updateShuffleStatus(playerState.getShuffleStatus());
    updateRepeatStatus(playerState.getRepeatStatus());
    updatePowerMenuItems(canPowerOn(), canPowerOff());
  }
 private Song getCurrentSong() {
   PlayerState playerState = getPlayerState();
   return playerState != null ? playerState.getCurrentSong() : null;
 }