コード例 #1
0
ファイル: MainActivity.java プロジェクト: jrmeza514/Vibrato
 @Override
 public void onPlayerState(PlayerState playerState) {
   if (playerState.playing) {
     playPauseFloatingActionButton.setImageBitmap(
         BitmapFactory.decodeResource(getResources(), R.mipmap.ic_pause_white));
   } else {
     playPauseFloatingActionButton.setImageBitmap(
         BitmapFactory.decodeResource(getResources(), R.mipmap.ic_play_arrow_white));
   }
 }
コード例 #2
0
ファイル: MainActivity.java プロジェクト: jrmeza514/Vibrato
 @Override
 public void onPlayerState(PlayerState playerState) {
   /*
      Determine Plater State and play, Pause, or resume track
   */
   SharedPreferences playerPreferences = getSharedPreferences(PLAYER_PREFS, MODE_PRIVATE);
   if (playerState.playing) {
     mPlayer.pause();
     playPauseFloatingActionButton.setImageBitmap(
         BitmapFactory.decodeResource(getResources(), R.mipmap.ic_play_arrow_white));
   } else if (playerState.trackUri != null && !playerState.trackUri.equals("")) {
     mPlayer.resume();
     playPauseFloatingActionButton.setImageBitmap(
         BitmapFactory.decodeResource(getResources(), R.mipmap.ic_pause_white));
   } else {
     /*
        TODO: Implement an solution for storing
     */
     String trackUri = "spotify:track:6QPKYGnAW9QozVz2dSWqRg";
     mPlayer.play(trackUri);
     playPauseFloatingActionButton.setImageBitmap(
         BitmapFactory.decodeResource(getResources(), R.mipmap.ic_pause_white));
   }
 }