Exemplo n.º 1
0
 @Override
 public void onGetPlayresult(Boolean obj) {
   if (obj) {
     mPostButton.setClickable(true);
     try {
       mStatusButton.setImageResource(R.drawable.video_btn_pause);
       mMusicPlayService.pause();
       //				mIsPlayOnLocal = false;
       postGetPositionInfo();
     } catch (RemoteException e) {
       e.printStackTrace();
     }
   } else {
   }
 }
Exemplo n.º 2
0
 public void doClick(View view) throws RemoteException {
   switch (view.getId()) {
     case R.id.pause_play:
       if (LocalMediaUtil.getWhichOnRemote() == LocalMediaUtil.Defs.MUSIC) {
         if (mIsOnRemotePause) {
           postPauseToPlay();
           mStatusButton.setImageResource(R.drawable.video_btn_pause);
           mIsOnRemotePause = false;
         } else {
           postpause();
           mStatusButton.setImageResource(R.drawable.video_btn_start);
           mIsOnRemotePause = true;
         }
       } else {
         mMusicPlayService.pauseButtonPressed();
       }
       break;
     case R.id.stop:
       if (LocalMediaUtil.getWhichOnRemote() == LocalMediaUtil.Defs.MUSIC) {
         poststop();
         LocalMediaUtil.setWhichOnRemote(LocalMediaUtil.Defs.NOT_ANY_ONE);
         mIsOnRemotePause = true;
       }
       mMusicPlayService.stop();
       MusicData.setNowPlayingMusic(null);
       mMusicPlayService.setInitialed(false);
       finish();
       overridePendingTransition(R.anim.push_left_in, R.anim.push_right_out);
       break;
     case R.id.next:
       mMusicPlayService.next();
       updateMusicInfo();
       if (LocalMediaUtil.getWhichOnRemote() == LocalMediaUtil.Defs.MUSIC) {
         MusicItem music = MusicData.getNowPlayingMusic();
         mMusicPlayService.pause();
         //				mMusicProgress.setMax((int) mMusicPlayService.duration());
         //				mArtistTextView.setText(music.getArtist());
         //				mTitleTextView.setText(music.getTitle());
         //				mDuration.setText(setDurationFormat(Integer.parseInt(music.getDuration())));
         postNext(music.getItemUri(), music.metaData);
       } else {
         if (mMusicPlayService.getPreparedStatus()) {
           mMusicPlayService.play();
         }
       }
       break;
     case R.id.prev:
       mMusicPlayService.prev();
       updateMusicInfo();
       if (LocalMediaUtil.getWhichOnRemote() == LocalMediaUtil.Defs.MUSIC) {
         MusicItem music = MusicData.getNowPlayingMusic();
         mMusicPlayService.pause();
         //				mMusicProgress.setMax((int) mMusicPlayService.duration());
         //				mArtistTextView.setText(music.getArtist());
         //				mTitleTextView.setText(music.getTitle());
         //				mDuration.setText(setDurationFormat(Integer.parseInt(music.getDuration())));
         postNext(music.getItemUri(), music.metaData);
       } else {
         if (mMusicPlayService.getPreparedStatus()) {
           mMusicPlayService.play();
         }
       }
       break;
     case R.id.post:
       break;
     case R.id.nowplayinglist:
       MusicData.setMusicShowList(MusicData.getMusicPlayList());
       Intent intent = new Intent();
       intent.putExtra("title", getResources().getString(R.string.playing_list));
       intent.putExtra("scrollto", true);
       intent.setClass(getApplicationContext(), MusicListActivity.class);
       startActivityForResult(intent, 0);
       overridePendingTransition(R.anim.push_left_in, R.anim.push_right_out);
       break;
   }
 }