コード例 #1
0
 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();
   }
 }
コード例 #2
0
  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) : "-:--");
      }
    }
  }
コード例 #3
0
  // imp
  private void initSlidingUpPanel() {
    mLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);
    // songAlbumbg = (ImageView) findViewById(R.id.image_songAlbumbg);
    songAlbumbg = (ImageView) findViewById(R.id.image_songsAlbum);
    img_bottom_slideone = (ImageView) findViewById(R.id.img_bottom_slideone);
    img_bottom_slidetwo = (ImageView) findViewById(R.id.img_bottom_slidetwo);
    txt_timeprogress = (TextView) findViewById(R.id.slidepanel_time_progress);
    txt_timetotal = (TextView) findViewById(R.id.slidepanel_time_total);
    imgbtn_backward = (ImageView) findViewById(R.id.btn_backward);
    imgbtn_forward = (ImageView) findViewById(R.id.btn_forward);
    imgbtn_toggle = (ImageView) findViewById(R.id.btn_toggle);
    imgbtn_suffel = (ImageView) findViewById(R.id.btn_suffel);
    btn_playpause = (PlayPauseView) findViewById(R.id.btn_play);
    audio_progress = (Slider) findViewById(R.id.audio_progress_control);
    btn_playpausePanel = (PlayPauseView) findViewById(R.id.bottombar_play);
    img_Favorite = (ImageView) findViewById(R.id.bottombar_img_Favorite);

    TypedValue typedvaluecoloraccent = new TypedValue();
    getTheme().resolveAttribute(R.attr.colorAccent, typedvaluecoloraccent, true);
    final int coloraccent = typedvaluecoloraccent.data;
    audio_progress.setBackgroundColor(coloraccent);
    audio_progress.setValue(0);

    audio_progress.setOnValueChangedListener(this);
    imgbtn_backward.setOnClickListener(this);
    imgbtn_forward.setOnClickListener(this);
    imgbtn_toggle.setOnClickListener(this);
    imgbtn_suffel.setOnClickListener(this);
    img_Favorite.setOnClickListener(this);

    btn_playpausePanel.Pause();
    btn_playpause.Pause();

    txt_playesongname = (TextView) findViewById(R.id.txt_playesongname);
    txt_songartistname = (TextView) findViewById(R.id.txt_songartistname);
    txt_playesongname_slidetoptwo = (TextView) findViewById(R.id.txt_playesongname_slidetoptwo);
    txt_songartistname_slidetoptwo = (TextView) findViewById(R.id.txt_songartistname_slidetoptwo);

    slidepanelchildtwo_topviewone =
        (RelativeLayout) findViewById(R.id.slidepanelchildtwo_topviewone);
    slidepanelchildtwo_topviewtwo =
        (RelativeLayout) findViewById(R.id.slidepanelchildtwo_topviewtwo);

    slidepanelchildtwo_topviewone.setVisibility(View.VISIBLE);
    slidepanelchildtwo_topviewtwo.setVisibility(View.INVISIBLE);

    slidepanelchildtwo_topviewone.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            mLayout.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED);
          }
        });

    slidepanelchildtwo_topviewtwo.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            mLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
          }
        });

    ((PlayPauseView) findViewById(R.id.bottombar_play)).setOnClickListener(this);
    ((PlayPauseView) findViewById(R.id.btn_play)).setOnClickListener(this);

    mLayout.setPanelSlideListener(
        new SlidingUpPanelLayout.PanelSlideListener() {
          @Override
          public void onPanelSlide(View panel, float slideOffset) {
            Log.i(TAG, "onPanelSlide, offset " + slideOffset);

            if (slideOffset == 0.0f) {
              isExpand = false;
              slidepanelchildtwo_topviewone.setVisibility(View.VISIBLE);
              slidepanelchildtwo_topviewtwo.setVisibility(View.INVISIBLE);
            } else if (slideOffset > 0.0f && slideOffset < 1.0f) {
              // if (isExpand) {
              // slidepanelchildtwo_topviewone.setAlpha(1.0f);
              // slidepanelchildtwo_topviewtwo.setAlpha(1.0f -
              // slideOffset);
              // } else {
              // slidepanelchildtwo_topviewone.setAlpha(1.0f -
              // slideOffset);
              // slidepanelchildtwo_topviewtwo.setAlpha(1.0f);
              // }

            } else {
              isExpand = true;
              slidepanelchildtwo_topviewone.setVisibility(View.INVISIBLE);
              slidepanelchildtwo_topviewtwo.setVisibility(View.VISIBLE);
            }
          }

          @Override
          public void onPanelExpanded(View panel) {
            Log.i(TAG, "onPanelExpanded");
            isExpand = true;
          }

          @Override
          public void onPanelCollapsed(View panel) {
            Log.i(TAG, "onPanelCollapsed");
            isExpand = false;
          }

          @Override
          public void onPanelAnchored(View panel) {
            Log.i(TAG, "onPanelAnchored");
          }

          @Override
          public void onPanelHidden(View panel) {
            Log.i(TAG, "onPanelHidden");
          }
        });
  }