to top
Datalogic APIs
public static class

ScreensaverItem.Builder

extends Object
java.lang.Object
   ↳ com.datalogic.device.configuration.ScreensaverItem.Builder

Class Overview

Builder class for constructing instances of ScreensaverItem. This class provides methods to set various properties of a screensaver item: file path, background color, duration, and animation type.

Key functionalities include:

  • Validation of file types to ensure they are either images or videos.
  • Support for setting background color in both string and integer formats.
  • Validation of duration to ensure it is non-negative.
  • Validation of animation type to ensure compatibility with the file type.

Usage example:

 ScreensaverItem item = new ScreensaverItem.Builder("image.jpg")
     .withBackgroundColor("#FF0000")
     .withDuration(60)
     .withAnimation(ScreensaverAnimation.PING_PONG)
     .build();
 

Summary

Public Constructors
Builder(String file)
Constructs a new Builder for creating a ScreensaverItem.
Public Methods
ScreensaverItem build()
Builds and returns a new ScreensaverItem instance with the configured properties.
ScreensaverItem.Builder withAnimation(String animation)
Sets the animation type of the screensaver.
ScreensaverItem.Builder withAnimation(ScreensaverAnimation animation)
Sets the animation type of the screensaver.
ScreensaverItem.Builder withBackgroundColor(int backgroundColor)
Sets the background color of the screensaver.
ScreensaverItem.Builder withBackgroundColor(String backgroundColor)
Sets the background color of the screensaver.
ScreensaverItem.Builder withDuration(int duration)
Sets the duration of the screensaver.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Builder (String file)

Added in revision 44

Constructs a new Builder for creating a ScreensaverItem.

Parameters
file The file path of the screensaver. Must be a valid image or video file. Type: String
Throws
IllegalArgumentException if the file path is null, empty, or not a valid image or video.

Public Methods

public ScreensaverItem build ()

Added in revision 44

Builds and returns a new ScreensaverItem instance with the configured properties.

Returns
  • A new ScreensaverItem instance. Type: ScreensaverItem

public ScreensaverItem.Builder withAnimation (String animation)

Added in revision 44

Sets the animation type of the screensaver.

Parameters
animation The animation type as a string. Must be a valid ScreensaverAnimation value. Type: String
Returns
  • The current Builder instance for chaining. Type: Builder

public ScreensaverItem.Builder withAnimation (ScreensaverAnimation animation)

Added in revision 44

Sets the animation type of the screensaver.

Parameters
animation The animation type as a ScreensaverAnimation enum value. Type: ScreensaverAnimation
Returns
  • The current Builder instance for chaining. Type: Builder
Throws
IllegalArgumentException if the animation is null or invalid for the file type.

public ScreensaverItem.Builder withBackgroundColor (int backgroundColor)

Added in revision 44

Sets the background color of the screensaver.

Parameters
backgroundColor The background color as an integer. Type: int
Returns
  • The current Builder instance for chaining. Type: Builder

public ScreensaverItem.Builder withBackgroundColor (String backgroundColor)

Added in revision 44

Sets the background color of the screensaver.

Parameters
backgroundColor The background color in hexadecimal string format (e.g., #RRGGBB or #AARRGGBB). Type: String
Returns
  • The current Builder instance for chaining. Type: Builder

public ScreensaverItem.Builder withDuration (int duration)

Added in revision 44

Sets the duration of the screensaver.

Parameters
duration The duration in seconds. Must be non-negative. Type: int
Returns
  • The current Builder instance for chaining. Type: Builder
Throws
IllegalArgumentException if the duration is negative.