/** * Sets whether the navigation actions should be used. * * @param useNavigationActions Whether to use navigation actions or not. */ public final void setUseNavigationActions(boolean useNavigationActions) { if (this.useNavigationActions != useNavigationActions) { this.useNavigationActions = useNavigationActions; invalidate(); } }
/** * Sets whether the play and pause actions should be used. * * @param usePlayPauseActions Whether to use play and pause actions. */ public final void setUsePlayPauseActions(boolean usePlayPauseActions) { if (this.usePlayPauseActions != usePlayPauseActions) { this.usePlayPauseActions = usePlayPauseActions; invalidate(); } }
/** * Sets the rewind increment in milliseconds. * * @param rewindMs The rewind increment in milliseconds. A value of zero will cause the rewind * action to be disabled. */ public final void setRewindIncrementMs(long rewindMs) { if (this.rewindMs == rewindMs) { return; } this.rewindMs = rewindMs; invalidate(); }
/** * Sets the fast forward increment in milliseconds. * * @param fastForwardMs The fast forward increment in milliseconds. A value of zero will cause the * fast forward action to be disabled. */ public final void setFastForwardIncrementMs(long fastForwardMs) { if (this.fastForwardMs == fastForwardMs) { return; } this.fastForwardMs = fastForwardMs; invalidate(); }
/** * Sets whether the elapsed time of the media playback should be displayed * * <p>See {@link NotificationCompat.Builder#setUsesChronometer(boolean)}. * * @param useChronometer Whether to use chronometer. */ public final void setUseChronometer(boolean useChronometer) { if (this.useChronometer != useChronometer) { this.useChronometer = useChronometer; invalidate(); } }
/** * Sets the defaults. * * <p>See {@link NotificationCompat.Builder#setDefaults(int)}. * * @param defaults The default notification options. */ public final void setDefaults(int defaults) { if (this.defaults != defaults) { this.defaults = defaults; invalidate(); } }
/** * Sets the accent color of the notification. * * <p>See {@link NotificationCompat.Builder#setColor(int)}. * * @param color The color, in ARGB integer form like the constants in {@link Color}. */ public final void setColor(int color) { if (this.color != color) { this.color = color; invalidate(); } }
/** * Sets whether the notification should be colorized. When set, the color set with {@link * #setColor(int)} will be used as the background color for the notification. * * <p>See {@link NotificationCompat.Builder#setColorized(boolean)}. * * @param colorized Whether to colorize the notification. */ public final void setColorized(boolean colorized) { if (this.colorized != colorized) { this.colorized = colorized; invalidate(); } }
/** * Sets whether the notification should be ongoing. If {@code false} the user can dismiss the * notification by swiping. If in addition the stop action is enabled dismissing the notification * triggers the stop action. * * <p>See {@link NotificationCompat.Builder#setOngoing(boolean)}. * * @param ongoing Whether {@code true} the notification is ongoing and not dismissible. */ public final void setOngoing(boolean ongoing) { if (this.ongoing != ongoing) { this.ongoing = ongoing; invalidate(); } }
/** * Sets the small icon of the notification which is also shown in the system status bar. * * <p>See {@link NotificationCompat.Builder#setSmallIcon(int)}. * * @param smallIconResourceId The resource id of the small icon. */ public final void setSmallIcon(@DrawableRes int smallIconResourceId) { if (this.smallIconResourceId != smallIconResourceId) { this.smallIconResourceId = smallIconResourceId; invalidate(); } }
/** * Sets the badge icon type of the notification. * * <p>See {@link NotificationCompat.Builder#setBadgeIconType(int)}. * * @param badgeIconType The badge icon type. */ public final void setBadgeIconType(@NotificationCompat.BadgeIconType int badgeIconType) { if (this.badgeIconType == badgeIconType) { return; } switch (badgeIconType) { case NotificationCompat.BADGE_ICON_NONE: case NotificationCompat.BADGE_ICON_SMALL: case NotificationCompat.BADGE_ICON_LARGE: this.badgeIconType = badgeIconType; break; default: throw new IllegalArgumentException(); } invalidate(); }
/** * Sets the visibility of the notification which determines whether and how the notification is * shown when the device is in lock screen mode. * * <p>See {@link NotificationCompat.Builder#setVisibility(int)}. * * @param visibility The visibility which must be one of {@link * NotificationCompat#VISIBILITY_PUBLIC}, {@link NotificationCompat#VISIBILITY_PRIVATE} or * {@link NotificationCompat#VISIBILITY_SECRET}. */ public final void setVisibility(@Visibility int visibility) { if (this.visibility == visibility) { return; } switch (visibility) { case NotificationCompat.VISIBILITY_PRIVATE: case NotificationCompat.VISIBILITY_PUBLIC: case NotificationCompat.VISIBILITY_SECRET: this.visibility = visibility; break; default: throw new IllegalStateException(); } invalidate(); }
/** * Sets the priority of the notification required for API 25 and lower. * * <p>See {@link NotificationCompat.Builder#setPriority(int)}. * * @param priority The priority which can be one of {@link NotificationCompat#PRIORITY_DEFAULT}, * {@link NotificationCompat#PRIORITY_MAX}, {@link NotificationCompat#PRIORITY_HIGH}, {@link * NotificationCompat#PRIORITY_LOW} or {@link NotificationCompat#PRIORITY_MIN}. If not set * {@link NotificationCompat#PRIORITY_LOW} is used by default. */ public final void setPriority(@Priority int priority) { if (this.priority == priority) { return; } switch (priority) { case NotificationCompat.PRIORITY_DEFAULT: case NotificationCompat.PRIORITY_MAX: case NotificationCompat.PRIORITY_HIGH: case NotificationCompat.PRIORITY_LOW: case NotificationCompat.PRIORITY_MIN: this.priority = priority; break; default: throw new IllegalArgumentException(); } invalidate(); }
/** * Sets the {@link MediaSessionCompat.Token}. * * @param token The {@link MediaSessionCompat.Token}. */ public final void setMediaSessionToken(MediaSessionCompat.Token token) { if (!Util.areEqual(this.mediaSessionToken, token)) { mediaSessionToken = token; invalidate(); } }
/** * Sets the name of the action to be used as stop action to cancel the notification. If {@code * null} is passed the stop action is not displayed. * * @param stopAction The name of the stop action which must be {@link #ACTION_STOP} or an action * provided by the {@link CustomActionReceiver}. {@code null} to omit the stop action. */ public final void setStopAction(@Nullable String stopAction) { if (Util.areEqual(stopAction, this.stopAction)) { return; } this.stopAction = stopAction; if (ACTION_STOP.equals(stopAction)) { stopPendingIntent = Assertions.checkNotNull(playbackActions.get(ACTION_STOP)).actionIntent; } else if (stopAction != null) { stopPendingIntent = Assertions.checkNotNull(customActions.get(stopAction)).actionIntent; } else { stopPendingIntent = null; } invalidate(); }