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); } } }
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(); }