Ejemplo n.º 1
0
 private String getNotificationString() {
   if (mPlayerState.isBuffering()) {
     return mController.getString(R.string.buffering);
   } else {
     if (mSongInfo != null) {
       return mSongInfo.toString();
     } else {
       return mController.getString(R.string.retrieveing_song_details);
     }
   }
 }
Ejemplo n.º 2
0
  public Notification createNotification() {
    mNotifyBuild =
        new NotificationCompat.Builder(mController.getApplicationContext())
            .setContentTitle(mController.getString(R.string.balatafm))
            .setSmallIcon(R.drawable.ic_notification)
            .setContentIntent(getPendingIntent());

    mNotifyBuild.setContentText(getNotificationString());

    if (mPlayerState.isBuffering()) {
      mNotifyBuild.setProgress(0, 0, true);
    } else {
      if (mPlayerState.isPlaying()) {
        mNotifyBuild.addAction(R.drawable.player_stop, "Stop", getBroadcastIntent("stop"));
        mNotifyBuild.setOngoing(true);
      } else {
        mNotifyBuild.addAction(R.drawable.player_play, "Play", getBroadcastIntent("play"));
      }
    }

    mNotificationVisible = true;
    return mNotifyBuild.build();
  }