๐ Merv Toast Message takes your toast messages to the next level โ stylish, fast, and customizable!
Add the JitPack repository to your settings.gradle
file
allprojects {
repositories {
...
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add the dependency in your build.gradle
dependencies {
implementation 'com.github.b3ddodev:Merv-Toast-Message:{release-version}'
}
Type | Description |
---|---|
๐๐๐๐_๐๐๐๐_๐๐๐พ๐พ๐๐๐ |
Represents a success toast message, used to indicate that an action or operation was completed successfully. |
๐๐๐๐_๐๐๐๐_๐๐๐๐ |
Represents an informational toast message, typically used to provide general information or updates. |
๐๐๐๐_๐๐๐๐_๐๐๐๐๐ |
Represents an error toast message, used to indicate a failure or an issue that requires the user's attention. |
๐๐๐๐_๐๐๐๐_๐๐ผ๐๐๐๐๐ |
Represents a warning toast message, used to indicate potential issues or important cautions that the user should be aware of. |
Default Sample :
MervToastMessage.with(this)
.setToastType(MervToastType.MERV_TYPE_SUCCESS,SUCCESS_BOLD)
.setText("b3ddo dEV' All Right Reserved.")
.setTextColor(Color.WHITE)
.setTextSize(15f)
.setTextAllCaps(false)
.setChooseFont(R.font.outfit_regular)
.setIconAnimation(MervIconAnimationType.ICON_FADE_ANIMATION,500)
.setGravity(MervGravityType.MERV_GRAVITY_CENTER)
.setAnimation(MervAnimationType.MERV_FADE_ANIMATION,1000)
.setScreenTime(3000)
.setElevation(50) // Staying at 50 applies the Outline Spot Shadow Color
.setRadius(20)
.setStrokeWidth(2)
.setStrokeColor(Color.WHITE)
.setMargin(50,50,50,50)
.setLayoutIdentification(R.id.main) // Sets the layout Identification to position the toast inside a custom layout.
.setShowToastMessage();
int mIconAnimationDuration = 500;
int mToastAnimationDuration = 1000;
MervToastMessage.with(this)
.setToastType(MervToastType.MERV_TYPE_SUCCESS,SUCCESS_OUTLINE)
.setText("Success Toast Message!")
.setTextColor(Color.WHITE)
.setTextSize(15f)
.setTextAllCaps(false)
.setChooseFont(R.font.outfit_regular)
.setIconAnimation(MervIconAnimationType.ICON_FADE_ANIMATION,mIconAnimationDuration)
.setGravity(MervGravityType.MERV_GRAVITY_CENTER)
.setAnimation(MervAnimationType.MERV_FADE_ANIMATION , mToastAnimationDuration)
.setScreenTime(3000)
.setElevation(50)
.setRadius(20)
.setStrokeWidth(0)
.setStrokeColor(Color.TRANSPARENT)
.setMargin(50,50,50,50)
//Optional .setLayoutIdentification(R.id.main)
.setShowToastMessage();
int mIconAnimationDuration = 500;
int mToastAnimationDuration = 1000;
MervToastMessage.with(this)
.setToastType(MervToastType.MERV_TYPE_ERROR,ERROR_OUTLINE)
.setText("Error Toast Message!")
.setTextColor(Color.WHITE)
.setTextSize(15f)
.setTextAllCaps(false)
.setChooseFont(R.font.outfit_regular)
.setIconAnimation(MervIconAnimationType.ICON_FADE_ANIMATION,mIconAnimationDuration)
.setGravity(MervGravityType.MERV_GRAVITY_CENTER)
.setAnimation(MervAnimationType.MERV_FADE_ANIMATION , mToastAnimationDuration)
.setScreenTime(3000)
.setElevation(50)
.setRadius(20)
.setStrokeWidth(0)
.setStrokeColor(Color.TRANSPARENT)
.setMargin(50,50,50,50)
//Optional .setLayoutIdentification(R.id.main)
.setShowToastMessage();
MervToastMessage.with(this)
.setToastType(MervToastType.MERV_TYPE_WARNING,WARNING_OUTLINE)
.setText("Warning Toast Message!")
.setTextColor(Color.WHITE)
.setTextSize(15f)
.setTextAllCaps(false)
.setChooseFont(R.font.outfit_regular)
.setIconAnimation(MervIconAnimationType.ICON_FADE_ANIMATION,mIconAnimationDuration)
.setGravity(MervGravityType.MERV_GRAVITY_CENTER)
.setAnimation(MervAnimationType.MERV_FADE_ANIMATION , mToastAnimationDuration)
.setScreenTime(3000)
.setElevation(50)
.setRadius(20)
.setStrokeWidth(0)
.setStrokeColor(Color.TRANSPARENT)
.setMargin(50,50,50,50)
//Optional.setLayoutIdentification(R.id.main)
.setShowToastMessage();
int mIconAnimationDuration = 500;
int mToastAnimationDuration = 1000;
MervToastMessage.with(this)
.setToastType(MervToastType.MERV_TYPE_INFO,INFO_OUTLINE)
.setText("Info Toast Message!")
.setTextColor(Color.WHITE)
.setTextSize(15f)
.setTextAllCaps(false)
.setChooseFont(R.font.outfit_regular)
.setIconAnimation(MervIconAnimationType.ICON_FADE_ANIMATION,mIconAnimationDuration)
.setGravity(MervGravityType.MERV_GRAVITY_CENTER)
.setAnimation(MervAnimationType.MERV_FADE_ANIMATION , mToastAnimationDuration)
.setScreenTime(3000)
.setElevation(50)
.setRadius(20)
.setStrokeWidth(0)
.setStrokeColor(Color.TRANSPARENT)
.setMargin(50,50,50,50)
//Optional .setLayoutIdentification(R.id.main)
.setShowToastMessage();
//Success Icon Style
.setToastType(MervToastType.MERV_TYPE_SUCCESS,SUCCESS_BROKEN)
or: -SUCCESS_LINEAR, SUCCESS_TWO_TONE, SUCCESS_OUTLINE, SUCCESS_BULK, SUCCESS_BOLD
//Error Icon Style
.setToastType(MervToastType.MERV_TYPE_ERROR,ERROR_BROKEN)
or: -ERROR_LINEAR, ERROR_TWO_TONE, ERROR_OUTLINE, ERROR_BULK, ERROR_BOLD
//Warning Icon Style
.setToastType(MervToastType.MERV_TYPE_WARNING,WARNING_BROKEN)
or: -WARNING_LINEAR, WARNING_TWO_TONE, WARNING_OUTLINE, WARNING_BULK, WARNING_BOLD
//Info Icon Style
.setToastType(MervToastType.MERV_TYPE_INFO,INFO_BROKEN)
or: -INFO_LINEAR, INFO_TWO_TONE, INFO_OUTLINE, INFO_BULK, INFO_BOLD
Type | Description |
---|---|
๐๐พ๐๐_๐๐๐๐๐_๐ผ๐๐๐๐ผ๐๐๐๐ |
The icon performs a simple animation with no movement or effects, effectively remaining static while appearing and disappearing. |
๐๐พ๐๐_๐๐๐ผ๐๐_๐ผ๐๐๐๐ผ๐๐๐๐ |
The icon shakes back and forth, usually with a slight left-right motion, to grab attention. |
๐๐พ๐๐_๐ฝ๐๐ผ๐_๐ผ๐๐๐๐ผ๐๐๐๐ |
The icon performs a zoom-like effect, rapidly scaling up and down to give a pulsing beat effect. |
๐๐พ๐๐_๐๐ผ๐ฟ๐_๐ผ๐๐๐๐ผ๐๐๐๐ |
The icon fades in and out smoothly without any directional movement, only changing opacity. |
๐๐พ๐๐_๐ฝ๐๐ผ๐_๐๐ผ๐ฟ๐_๐ผ๐๐๐๐ผ๐๐๐๐ |
The icon combines both zoom (beat) and fade effects, pulsing while fading in and out. |
Type | Description |
---|---|
๐๐๐๐_๐๐๐๐_๐ผ๐๐๐๐ผ๐๐๐๐ |
The toast comes from the left side of the screen and exits to the right side |
๐๐๐๐_๐๐๐๐๐_๐ผ๐๐๐๐ผ๐๐๐๐ |
The toast comes from the right side of the screen and exits to the left side. |
๐๐๐๐_๐๐ผ๐ฟ๐_๐ผ๐๐๐๐ผ๐๐๐๐ |
The toast fades in from transparency and fades out to transparency, without a directional movement. |
๐๐๐๐_๐๐๐_๐ผ๐๐๐๐ผ๐๐๐๐ |
The toast comes from the bottom of the screen and exits to the top. |
๐๐๐๐_๐ฝ๐๐๐๐๐_๐ผ๐๐๐๐ผ๐๐๐๐ |
The toast comes from the top of the screen and exits to the bottom. |
Set | Description |
---|---|
.๐๐ฒ๐๐ง๐ผ๐ฎ๐๐๐ง๐๐ฝ๐ฒ(); |
This method configures the appearance of a toast message based on the specified type. Sets an icon, icon tint color, and background color based on predefined toast types such as Success, Error, Warning, and Information. |
.๐๐ฒ๐๐ง๐ฒ๐
๐(); |
This method is used to set the text of the toast message and supports method chaining for easier configuration. |
.๐๐ฒ๐๐ง๐ฒ๐
๐๐๐ผ๐น๐ผ๐ฟ (); |
Text color settings of toast message with this method. |
.๐๐ฒ๐๐ง๐ฒ๐
๐๐ฆ๐ถ๐๐ฒ(); |
This method adjusts the text size of the toast message. |
.๐๐ฒ๐๐ง๐ฒ๐
๐๐๐น๐น๐๐ฎ๐ฝ๐(); |
This method allows the text to be displayed in capital letters. |
.๐๐ฒ๐๐๐ต๐ผ๐ผ๐๐ฒ๐๐ผ๐ป๐(); |
This method sets the font of the toast message. |
.๐๐ฒ๐๐๐ฐ๐ผ๐ป๐๐ป๐ถ๐บ๐ฎ๐๐ถ๐ผ๐ป(); |
This method allows customization of how the Icon is animated (e.g. Shake, Zoom, Fade). |
.๐๐ฒ๐๐๐ฟ๐ฎ๐๐ถ๐๐(); |
This method sets the gravity (positioning) of the toast message on the screen. |
.๐๐ฒ๐๐๐ป๐ถ๐บ๐ฎ๐๐ถ๐ผ๐ป(); |
This method sets the animation style of the toast message. |
.๐๐ฒ๐๐ฆ๐ฐ๐ฟ๐ฒ๐ฒ๐ป๐ง๐ถ๐บ๐ฒ(); |
This method sets the display duration of the toast message in milliseconds. |
.๐๐ฒ๐๐๐น๐ฒ๐๐ฎ๐๐ถ๐ผ๐ป(); |
This method sets the elevation (shadow) of the toast message, which determines how high it appears above the content on the screen. |
.๐๐ฒ๐๐ฅ๐ฎ๐ฑ๐ถ๐๐(); |
This method sets the corner radius for the toast message, allowing you to create rounded corners. |
.๐๐ฒ๐๐ฆ๐๐ฟ๐ผ๐ธ๐ฒ๐ช๐ถ๐ฑ๐๐ต(); |
This method sets the stroke width for the border of the toast message, allowing you to adjust the thickness of the border line. |
.๐๐ฒ๐๐ฆ๐๐ฟ๐ผ๐ธ๐ฒ๐๐ผ๐น๐ผ๐ฟ(); |
This method sets the color of the border for the toast message, allowing you to customize the border's appearance. |
.๐๐ฒ๐๐ ๐ฎ๐ฟ๐ด๐ถ๐ป(); |
This method sets the margins for the toast message. You can define the start, top, end, and bottom margins to control the spacing around the toast message. |
.๐๐ฒ๐๐๐ฎ๐๐ผ๐๐๐๐ฑ๐ฒ๐ป๐๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป(); |
If there is an AppBar or Toolbar, this method can take that layout ID and show the toast message above or below that layout. That is, the toast message is not positioned directly at the top of the screen, but according to the layout you specify. |
The MIT License (MIT)
Copyright (c) 2025 b3ddo dEV' (github.com/b3ddodev)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.