package com.novoda.downloadmanager;

import android.app.Notification;
import android.support.v4.app.NotificationCompat;

public interface NotificationCustomizer<T> {

    NotificationDisplayState notificationDisplayState(T payload);

    /**
     * Create a custom {@link Notification} from the given {@link NotificationCompat.Builder} and payload.
     *
     * @param builder the base {@link NotificationCompat.Builder} to build the {@link Notification} from.
     * @param payload the information to add to the {@link Notification}.
     * @return the custom {@link Notification} to display.
     */
    Notification customNotificationFrom(NotificationCompat.Builder builder, T payload);

    enum NotificationDisplayState {
        SINGLE_PERSISTENT_NOTIFICATION,
        STACK_NOTIFICATION_NOT_DISMISSIBLE,
        STACK_NOTIFICATION_DISMISSIBLE,
        HIDDEN_NOTIFICATION
    }
}

package com.novoda.downloadmanager;

import android.app.Notification;
import android.support.v4.app.NotificationCompat;

/**
 * Used to customize the download notifications that are shown to the user.
 * Clients of this library can create their own custom implementation and
 * pass it to {@link DownloadManagerBuilder#withNotification(NotificationCustomizer)}.
 *
 * @param <T> The payload that is used to drive the customization.
 */
public interface NotificationCustomizer<T> {

    /**
     * Should return a given {@link NotificationDisplayState} for a given {@link T} payload.
     * Different payloads may want to hide or show differing notifications.
     * See {@link DownloadManagerBuilder.DownloadNotificationCustomizer} for an example.
     *
     * @param payload to determine the {@link NotificationDisplayState} from.
     * @return the {@link NotificationDisplayState} used to display notifications.
     */
    NotificationDisplayState notificationDisplayState(T payload);

    /**
     * Create a custom {@link Notification} from the given {@link NotificationCompat.Builder} and payload.
     *
     * @param builder the base {@link NotificationCompat.Builder} to build the {@link Notification} from.
     * @param payload the information to add to the {@link Notification}.
     * @return the custom {@link Notification} to display.
     */
    Notification customNotificationFrom(NotificationCompat.Builder builder, T payload);

    /**
     * Represents the different ways in which a notification can be displayed to a user.
     */
    enum NotificationDisplayState {
        SINGLE_PERSISTENT_NOTIFICATION,
        STACK_NOTIFICATION_NOT_DISMISSIBLE,
        STACK_NOTIFICATION_DISMISSIBLE,
        HIDDEN_NOTIFICATION
    }
}

Add full javadoc to NotificationCustomizer.