Package xyz.gmitch215.socketmc.screen
Class Toast
java.lang.Object
xyz.gmitch215.socketmc.screen.Toast
- All Implemented Interfaces:
Serializable
,Paramaterized
Represents a Toast Message that appears in the top right corner of the screen.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Represents the types for a System Toast Message.static enum
Represents the icon next to the tutorial message. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The default height of a toast message.static final int
The default width of a toast message. -
Method Summary
Modifier and TypeMethodDescriptioncustom
(int width, int height, @NotNull DrawingContext context, long duration) Creates a custom Toast Message.custom
(int width, int height, @NotNull DrawingContext context, @NotNull Duration duration) Creates a custom Toast Message.custom
(@NotNull DrawingContext context, long millis) Creates a custom Toast Message using the default dimensions.custom
(@NotNull DrawingContext context, @NotNull Duration duration) Creates a custom Toast Message using the default dimensions.long
Gets the duration of the toast message, in milliseconds.int
Gets the height of the toast message.Gets an immutbale copy of the paramaters for the toast message.int
getType()
Gets the internal type of the toast message.int
getWidth()
Gets the width of the toast message.system
(@NotNull Toast.System type, @NotNull Text title) Creates a System Toast Message with no message content.Creates a System Toast Message.tutorial
(@NotNull Toast.Tutorial type, @NotNull Text title) Creates a Tutorial Toast Message with no message content.Creates a Tutorial Toast Message.tutorial
(@NotNull Toast.Tutorial type, @NotNull Text title, @NotNull Text message, boolean progressable) Creates a Tutorial Toast Message.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface xyz.gmitch215.socketmc.util.Paramaterized
booleanParameter, booleanParameter, doubleParameter, doubleParameter, firstBooleanParameter, firstDoubleParameter, firstFloatParameter, firstIntParameter, firstLongParameter, firstParameter, firstParameter, firstStringParameter, floatParameter, floatParameter, getParameters, intParameter, intParameter, lastBooleanParameter, lastDoubleParameter, lastFloatParameter, lastIntParameter, lastLongParameter, lastParameter, lastParameter, lastStringParameter, longParameter, longParameter, parameter, parameter, parameter, stringParameter, stringParameter
-
Field Details
-
DEFAULT_WIDTH
public static final int DEFAULT_WIDTHThe default width of a toast message.- See Also:
-
DEFAULT_HEIGHT
public static final int DEFAULT_HEIGHTThe default height of a toast message.- See Also:
-
-
Method Details
-
getType
public int getType()Gets the internal type of the toast message.- Returns:
- Toast Message Type
-
getWidth
public int getWidth()Gets the width of the toast message.- Returns:
- Toast Width
-
getHeight
public int getHeight()Gets the height of the toast message.- Returns:
- Toast Height
-
getParameters
Gets an immutbale copy of the paramaters for the toast message.- Specified by:
getParameters
in interfaceParamaterized
- Returns:
- Toast Paramaters
-
getDuration
public long getDuration()Gets the duration of the toast message, in milliseconds. If it is-1
, the duration is not modifiable.- Returns:
- Display Duration
-
custom
@NotNull public static @NotNull Toast custom(@NotNull @NotNull DrawingContext context, @NotNull @NotNull Duration duration) throws IllegalArgumentException Creates a custom Toast Message using the default dimensions.- Parameters:
context
- Drawing Context to renderduration
- Display Duration- Returns:
- Custom Toast Message
- Throws:
IllegalArgumentException
- if the width, height, or duration is not positive, or if the duration/context is null
-
custom
@NotNull public static @NotNull Toast custom(@NotNull @NotNull DrawingContext context, long millis) throws IllegalArgumentException Creates a custom Toast Message using the default dimensions.- Parameters:
context
- Drawing Context to rendermillis
- Display Duration, in milliseconds- Returns:
- Custom Toast Message
- Throws:
IllegalArgumentException
- if the width, height, or duration is not positive, or if the context is null
-
custom
@NotNull public static @NotNull Toast custom(int width, int height, @NotNull @NotNull DrawingContext context, @NotNull @NotNull Duration duration) throws IllegalArgumentException Creates a custom Toast Message.- Parameters:
width
- Toast Widthheight
- Toast Heightcontext
- Drawing Context to renderduration
- Display Duration- Returns:
- Custom Toast Message
- Throws:
IllegalArgumentException
- if the width, height, or duration is not positive, or if the duration/context is null
-
custom
@NotNull public static @NotNull Toast custom(int width, int height, @NotNull @NotNull DrawingContext context, long duration) throws IllegalArgumentException Creates a custom Toast Message.- Parameters:
width
- Toast Widthheight
- Toast Heightcontext
- Drawing Context to renderduration
- Display Duration, in milliseconds- Returns:
- Custom Toast Message
- Throws:
IllegalArgumentException
- if the width, height, or duration is not positive, or if the context is null
-
system
@NotNull public static @NotNull Toast system(@NotNull @NotNull Toast.System type, @NotNull @NotNull Text title) throws IllegalArgumentException Creates a System Toast Message with no message content.- Parameters:
type
- System Toast Typetitle
- Title of Message- Returns:
- System Toast Message
- Throws:
IllegalArgumentException
- if the type, title, or message is null
-
system
@NotNull public static @NotNull Toast system(@NotNull @NotNull Toast.System type, @NotNull @NotNull Text title, @NotNull @NotNull Text message) throws IllegalArgumentException Creates a System Toast Message.- Parameters:
type
- System Toast Typetitle
- Title of Messagemessage
- Message Content- Returns:
- System Toast Message
- Throws:
IllegalArgumentException
- if the type, title, or message is null
-
tutorial
@NotNull public static @NotNull Toast tutorial(@NotNull @NotNull Toast.Tutorial type, @NotNull @NotNull Text title) throws IllegalArgumentException Creates a Tutorial Toast Message with no message content.- Parameters:
type
- Tutorial Typetitle
- Title of Message- Returns:
- Tutorial Toast Message
- Throws:
IllegalArgumentException
- if the type, title, or message is null
-
tutorial
@NotNull public static @NotNull Toast tutorial(@NotNull @NotNull Toast.Tutorial type, @NotNull @NotNull Text title, @NotNull @NotNull Text message) throws IllegalArgumentException Creates a Tutorial Toast Message.- Parameters:
type
- Tutorial Typetitle
- Title of Messagemessage
- Message Content- Returns:
- Tutorial Toast Message
- Throws:
IllegalArgumentException
- if the type, title, or message is null
-
tutorial
@NotNull public static @NotNull Toast tutorial(@NotNull @NotNull Toast.Tutorial type, @NotNull @NotNull Text title, @NotNull @NotNull Text message, boolean progressable) throws IllegalArgumentException Creates a Tutorial Toast Message.- Parameters:
type
- Tutorial Typetitle
- Title of Messagemessage
- Message Contentprogressable
- Whether to show a progress bar during its duration- Returns:
- Tutorial Toast Message
- Throws:
IllegalArgumentException
- if the type, title, or message is null
-