private void loadAlreadyPlaying() {
   SongDetail mSongDetail = MediaController.getInstance().getPlayingSongDetail();
   if (mSongDetail != null) {
     loadSongsDetails(mSongDetail);
     updateTitle(false);
     MediaController.getInstance().checkIsFavorite(context, mSongDetail, img_Favorite);
   }
 }
 private void PlayPauseEvent(View v) {
   if (MediaController.getInstance().isAudioPaused()) {
     MediaController.getInstance().playAudio(MediaController.getInstance().getPlayingSongDetail());
     ((PlayPauseView) v).Play();
   } else {
     MediaController.getInstance()
         .pauseAudio(MediaController.getInstance().getPlayingSongDetail());
     ((PlayPauseView) v).Pause();
   }
 }
 public void addObserver() {
   TAG_Observer = MediaController.getInstance().generateObserverTag();
   NotificationManager.getInstance().addObserver(this, NotificationManager.audioDidReset);
   NotificationManager.getInstance().addObserver(this, NotificationManager.audioPlayStateChanged);
   NotificationManager.getInstance().addObserver(this, NotificationManager.audioDidStarted);
   NotificationManager.getInstance()
       .addObserver(this, NotificationManager.audioProgressDidChanged);
   NotificationManager.getInstance().addObserver(this, NotificationManager.newaudioloaded);
 }
 @Override
 public void didReceivedNotification(int id, Object... args) {
   if (id == NotificationManager.audioDidStarted
       || id == NotificationManager.audioPlayStateChanged
       || id == NotificationManager.audioDidReset) {
     updateTitle(id == NotificationManager.audioDidReset && (Boolean) args[1]);
   } else if (id == NotificationManager.audioProgressDidChanged) {
     SongDetail mSongDetail = MediaController.getInstance().getPlayingSongDetail();
     updateProgress(mSongDetail);
   }
 }
  private void updateTitle(boolean shutdown) {
    SongDetail mSongDetail = MediaController.getInstance().getPlayingSongDetail();
    if (mSongDetail == null && shutdown) {
      return;
    } else {
      updateProgress(mSongDetail);
      if (MediaController.getInstance().isAudioPaused()) {
        btn_playpausePanel.Pause();
        btn_playpause.Pause();
      } else {
        btn_playpausePanel.Play();
        btn_playpause.Play();
      }
      SongDetail audioInfo = MediaController.getInstance().getPlayingSongDetail();
      loadSongsDetails(audioInfo);

      if (txt_timetotal != null) {
        long duration = Long.valueOf(audioInfo.getDuration());
        txt_timetotal.setText(
            duration != 0 ? String.format("%d:%02d", duration / 60, duration % 60) : "-:--");
      }
    }
  }
  @Override
  public void onClick(View v) {

    switch (v.getId()) {
      case R.id.bottombar_play:

      case R.id.btn_play:
        if (MediaController.getInstance().getPlayingSongDetail() != null) PlayPauseEvent(v);
        break;

      case R.id.btn_forward:
        if (MediaController.getInstance().getPlayingSongDetail() != null)
          MediaController.getInstance().playNextSong();
        break;

      case R.id.btn_backward:
        if (MediaController.getInstance().getPlayingSongDetail() != null)
          MediaController.getInstance().playPreviousSong();
        break;

      case R.id.btn_suffel:
        break;

      case R.id.btn_toggle:
        break;

      case R.id.bottombar_img_Favorite:
        if (MediaController.getInstance().getPlayingSongDetail() != null) {
          MediaController.getInstance()
              .storeFavoritePlay(
                  context,
                  MediaController.getInstance().getPlayingSongDetail(),
                  v.isSelected() ? 0 : 1);
          v.setSelected(!v.isSelected());
          DMPlayerUtility.animateHeartButton(v);
          findViewById(R.id.like).setSelected(!v.isSelected());
          DMPlayerUtility.animatePhotoLike(findViewById(R.id.big_like), findViewById(R.id.like));
        }
        break;

      default:
        break;
    }
  }
 @Override
 public void onValueChanged(int value) {
   MediaController.getInstance()
       .seekToProgress(MediaController.getInstance().getPlayingSongDetail(), (float) value / 100);
 }
 @Override
 public void newSongLoaded(Object... args) {
   MediaController.getInstance().checkIsFavorite(context, (SongDetail) args[0], img_Favorite);
 }