public void initPlaybackSpeed() {
   if (mService.getRate() == 1.0f) {
     mPlaybackSpeed.setText(null);
     mPlaybackSpeed.setCompoundDrawablesWithIntrinsicBounds(
         0, Util.getResourceFromAttribute(mActivity, R.attr.ic_speed_normal_style), 0, 0);
   } else {
     mPlaybackSpeed.setText(Strings.formatRateString(mService.getRate()));
     mPlaybackSpeed.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_speed_on, 0, 0);
   }
 }
 public boolean onLongClick(View v) {
   switch (v.getId()) {
     case R.id.playback_speed:
       mService.setRate(1);
       initPlaybackSpeed();
       return true;
   }
   return false;
 }
  @Override
  public void onConnected(PlaybackService service) {
    mService = service;

    initSleep();
    initPlaybackSpeed();

    if (mMode == MODE_VIDEO) {
      // Init Chapter
      final MediaPlayer.Chapter[] chapters = mService.getChapters(-1);
      final int chaptersCount = chapters != null ? chapters.length : 0;

      if (chaptersCount > 1) {
        int index = mService.getChapterIdx();
        if (chapters[index].name == null || chapters[index].name.equals(""))
          mChaptersTitle.setText(getResources().getString(R.string.chapter) + " " + index);
        else mChaptersTitle.setText(chapters[index].name);
      } else mChaptersTitle.setVisibility(View.GONE);

      // Init Audio Delay
      long audiodelay = mService.getAudioDelay() / 1000l;
      if (audiodelay == 0l) {
        mAudioDelay.setText(null);
        mAudioDelay.setCompoundDrawablesWithIntrinsicBounds(
            0, Util.getResourceFromAttribute(mActivity, R.attr.ic_audiodelay), 0, 0);
      } else {
        mAudioDelay.setText(Long.toString(audiodelay) + " ms");
        mAudioDelay.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_audiodelay_on, 0, 0);
      }

      // Init Subtitle Delay
      long spudelay = mService.getSpuDelay() / 1000l;
      if (spudelay == 0l) {
        mSpuDelay.setText(null);
        mSpuDelay.setCompoundDrawablesWithIntrinsicBounds(
            0, Util.getResourceFromAttribute(mActivity, R.attr.ic_subtitledelay), 0, 0);
      } else {
        mSpuDelay.setText(Long.toString(spudelay) + " ms");
        mSpuDelay.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_subtitledelay_on, 0, 0);
      }
    }
  }