Skip to content

๐Ÿš€ Merv Toast Message takes your toast messages to the next level โ€“ stylish, fast, and customizable!

Notifications You must be signed in to change notification settings

b3ddodev/Merv-Toast-Message

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

30 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Merv Toast Message

๐Ÿš€ Merv Toast Message takes your toast messages to the next level โ€“ stylish, fast, and customizable!


Platform API

Jitpack

Add the JitPack repository to your settings.gradle file

allprojects {
	repositories {
		...
		mavenCentral()
		maven { url 'https://jitpack.io' }
	}
}

Dependency

Add the dependency in your build.gradle

dependencies {
    implementation 'com.github.b3ddodev:Merv-Toast-Message:{release-version}'   
}

Toast Type

The main types you can set: MervToastType

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.

Using the library

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();

๐ŸŸข Success Toast Message

        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();

๐Ÿ”ด Error Toast Message

	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();

๐ŸŸก Warning Toast Message

        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();

๐Ÿ”ต Info Toast Message

	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();

6 Icon Changes

Adjustable Icon Styles:

Type Description Image
๐˜ฝ๐™๐™Š๐™†๐™€๐™‰ Broken Icon Type: This icon style represents a "broken" or damaged version of the icon. It's often used to convey a sense of failure or a broken state.
๐™‡๐™„ฬ‡๐™‰๐™€๐˜ผ๐™ Linear Icon Type: This icon uses a simple and clean linear design, typically featuring sharp lines and minimalistic elements.
๐™๐™’๐™Š_๐™๐™Š๐™‰๐™€ Two-Tone Icon Type: This icon features two contrasting tones, creating a distinctive and visually appealing effect through color contrast.
๐™Š๐™๐™๐™‡๐™„๐™‰๐™€ Outline Icon Type: The outline style icon focuses on the border of the design, with minimal interior detailing, often used for a more simplistic and modern appearance.
๐˜ฝ๐™๐™‡๐™† Bulk Icon Type: This icon is thick and solid, giving a strong, bold visual impact. It is often used for attention-grabbing purposes.
๐˜ฝ๐™Š๐™‡๐˜ฟ Bold Icon Type: The bold icon has a heavier weight, making it stand out more. It's ideal for highlighting important or emphasized elements.

Icon Style

    //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


Icon Animation Type

Major icon animations you can adjust: MervIconAnimationType

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.


Animation Type

Major animations you can adjust: MervAnimationType

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.

Features

There are several attributes you can set:

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.

Instagram Badge

License

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.

About

๐Ÿš€ Merv Toast Message takes your toast messages to the next level โ€“ stylish, fast, and customizable!

Topics

Resources

Stars

Watchers

Forks

Languages