Convert Figma logo to code with AI

Spikeysanju logoMotionToast

🌈 A Beautiful Motion Toast Library for Kotlin Android

1,471
130
1,471
30

Top Related Projects

6,569

The usual Toast, but with steroids 💪

[Moved to MavenCentral] An Android library that takes the standard toast to the next level with many styling options. Works on all Android versions.

Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.

5,515

An Android Alerting Library

This library is a set of simple wrapper classes that are aimed to help you easily create fancy material dialogs.

Quick Overview

MotionToast is a custom Android toast library that provides animated, customizable toast notifications for Android applications. It offers a variety of pre-designed toast styles with animations, icons, and color schemes, allowing developers to create visually appealing and informative notifications easily.

Pros

  • Highly customizable with various pre-designed styles and options
  • Smooth animations for enhanced user experience
  • Easy to implement and integrate into existing Android projects
  • Supports both Kotlin and Java

Cons

  • Limited to Android platform only
  • May require additional setup for custom fonts or icons
  • Potential performance impact if overused in an application
  • Dependency on third-party libraries for some features

Code Examples

  1. Creating a success toast:
MotionToast.createColorToast(this,
    "Success",
    "Profile Updated Successfully!",
    MotionToastStyle.SUCCESS,
    MotionToast.GRAVITY_BOTTOM,
    MotionToast.LONG_DURATION,
    ResourcesCompat.getFont(this, R.font.helvetica_regular))
  1. Creating a warning toast with a custom position:
MotionToast.createToast(this,
    "Warning",
    "Please update your app!",
    MotionToastStyle.WARNING,
    MotionToast.GRAVITY_TOP or MotionToast.GRAVITY_CENTER,
    MotionToast.SHORT_DURATION,
    ResourcesCompat.getFont(this, R.font.helvetica_regular))
  1. Creating a custom toast with a dark style:
MotionToast.darkToast(this,
    "Dark Toast",
    "This is a dark toast with custom icon",
    MotionToastStyle.INFO,
    MotionToast.GRAVITY_BOTTOM,
    MotionToast.LONG_DURATION,
    ResourcesCompat.getFont(this, R.font.helvetica_regular))

Getting Started

  1. Add the JitPack repository to your project's build.gradle file:
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  1. Add the dependency to your app's build.gradle file:
dependencies {
    implementation 'com.github.Spikeysanju:MotionToast:1.4'
}
  1. Sync your project, and you're ready to use MotionToast in your Android application!

Competitor Comparisons

6,569

The usual Toast, but with steroids 💪

Pros of Toasty

  • Simpler implementation with fewer dependencies
  • Lightweight and faster to integrate
  • Supports custom fonts and icons

Cons of Toasty

  • Less customizable in terms of animations and styles
  • Limited to basic toast types (success, error, info, warning)
  • Lacks advanced features like swipe-to-dismiss or progress bar

Code Comparison

MotionToast:

MotionToast.createColorToast(this,
    "Success",
    "Profile Updated Successfully!",
    MotionToastStyle.SUCCESS,
    MotionToast.GRAVITY_BOTTOM,
    MotionToast.LONG_DURATION,
    ResourcesCompat.getFont(this, R.font.helvetica_regular))

Toasty:

Toasty.success(getApplicationContext(), "Success!", Toast.LENGTH_SHORT, true).show();

MotionToast offers more customization options and a more modern, animated appearance, while Toasty provides a simpler, more straightforward implementation. MotionToast is better suited for projects requiring advanced toast features and animations, whereas Toasty is ideal for quick integration and basic toast functionality. The choice between the two depends on the specific requirements of your project and the desired level of customization.

[Moved to MavenCentral] An Android library that takes the standard toast to the next level with many styling options. Works on all Android versions.

Pros of StyleableToast

  • Simpler API and easier to implement for basic toast notifications
  • Supports custom fonts and icons
  • Smaller library size, potentially better for app performance

Cons of StyleableToast

  • Less animation options compared to MotionToast
  • Lacks built-in support for different toast types (success, error, etc.)
  • No built-in dark mode support

Code Comparison

MotionToast:

MotionToast.createColorToast(this,
    "Success",
    "Profile Updated Successfully!",
    MotionToastStyle.SUCCESS,
    MotionToast.GRAVITY_BOTTOM,
    MotionToast.LONG_DURATION,
    ResourcesCompat.getFont(this, R.font.helvetica_regular))

StyleableToast:

StyleableToast.makeText(context, "Hello World!", R.style.myToast).show()

MotionToast offers more customization options out of the box, while StyleableToast provides a simpler API for basic toast notifications. MotionToast includes built-in styles for different message types, whereas StyleableToast requires manual styling for similar effects. The code comparison shows that MotionToast requires more parameters for customization, while StyleableToast uses a more concise syntax for basic toasts.

Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.

Pros of FancyToast-Android

  • Simpler implementation with fewer dependencies
  • Supports custom fonts and icons
  • Offers a wider range of pre-defined toast styles

Cons of FancyToast-Android

  • Less customizable animations compared to MotionToast
  • Limited to Android platform, while MotionToast supports both Android and Compose

Code Comparison

FancyToast-Android:

FancyToast.makeText(this, "Hello World!", FancyToast.LENGTH_LONG, FancyToast.SUCCESS, true).show()

MotionToast:

MotionToast.createColorToast(this,
    "Hello World!",
    "This is a success toast",
    MotionToastStyle.SUCCESS,
    MotionToast.GRAVITY_BOTTOM,
    MotionToast.LONG_DURATION,
    ResourcesCompat.getFont(this, R.font.helvetica_regular))

Both libraries aim to enhance the default Android Toast functionality with more visually appealing and customizable options. FancyToast-Android provides a simpler API with pre-defined styles, making it easier to implement quickly. However, MotionToast offers more advanced animation capabilities and supports both Android and Jetpack Compose, making it more versatile for modern Android development.

FancyToast-Android is a good choice for projects requiring quick implementation of enhanced toasts, while MotionToast is better suited for applications needing more complex animations and cross-platform compatibility between traditional Android views and Compose.

5,515

An Android Alerting Library

Pros of Alerter

  • More customizable appearance with options for icon, title, text, and background color
  • Supports stacking multiple alerts
  • Offers swipe-to-dismiss functionality

Cons of Alerter

  • Limited animation options compared to MotionToast
  • Lacks built-in toast types (success, error, warning, etc.)
  • Less modern design aesthetic

Code Comparison

MotionToast:

MotionToast.createColorToast(this,
    "Success",
    "Profile Updated Successfully!",
    MotionToastStyle.SUCCESS,
    MotionToast.GRAVITY_BOTTOM,
    MotionToast.LONG_DURATION,
    ResourcesCompat.getFont(this, R.font.helvetica_regular))

Alerter:

Alerter.create(this@YourActivity)
    .setTitle("Alert Title")
    .setText("Alert text...")
    .setIcon(R.drawable.alerter_ic_face)
    .setBackgroundColorRes(R.color.colorAccent)
    .show()

Both libraries offer easy-to-use APIs for creating alerts or toasts in Android applications. MotionToast focuses on pre-defined toast types with animated icons, while Alerter provides more flexibility in terms of appearance customization and alert behavior. MotionToast may be preferred for quick implementation of common toast types, whereas Alerter might be better suited for applications requiring more control over alert styling and positioning.

This library is a set of simple wrapper classes that are aimed to help you easily create fancy material dialogs.

Pros of LovelyDialog

  • More customization options for dialog appearance and animations
  • Supports chaining multiple dialogs together
  • Includes built-in input validation for text fields

Cons of LovelyDialog

  • Less modern design aesthetic compared to MotionToast
  • Fewer pre-built toast styles and configurations
  • Not actively maintained (last update was in 2018)

Code Comparison

MotionToast:

MotionToast.createColorToast(this,
    "Success",
    "Profile Updated Successfully!",
    MotionToastStyle.SUCCESS,
    MotionToast.GRAVITY_BOTTOM,
    MotionToast.LONG_DURATION,
    ResourcesCompat.getFont(this, R.font.helvetica_regular))

LovelyDialog:

LovelyStandardDialog(this)
    .setTopColorRes(R.color.indigo)
    .setIcon(R.drawable.ic_star)
    .setTitle("Success")
    .setMessage("Profile Updated Successfully!")
    .setPositiveButton(android.R.string.ok, null)
    .show()

Both libraries offer easy-to-use APIs for creating custom dialogs and toasts. MotionToast focuses on modern, animated toast messages, while LovelyDialog provides more traditional dialog options with extensive customization. MotionToast is more actively maintained and offers a sleeker design, but LovelyDialog may be preferred for projects requiring more complex dialog interactions or chaining.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Motion Toast - A Beautiful Toast Library for Android Kotlin 🤩🔥

platform API GitHub license GitHub stars GitHub forks Repo size GitHub follow Twitter Follow

A Beautiful Multipurpose Motion Toast Library in Android using Kotlin 😍

GitHub Cards Preview

Preview - Motion Toast 🌟

gif

Preview - Color Motion Toast 🌈

gif

Preview - Dark Toast 🌈

gif

Preview - Dark Color Toast 🌈

gif

Types of Toast Style ❤️

1. Motion Toast 2. Color Motion Toast 3. Dark Toast 4. Dark Color Toast

About

A Beautiful Multipurpose Motion Toast Library in Android using Kotlin.

Dependency Project Level

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

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

Dependency App Level

Add dependency in your app module

	dependencies {
	        implementation 'com.github.Spikeysanju:MotionToast:1.4' 
	}

Five Toast Types 🖐🏼

        1. TOAST_SUCCESS
        2. TOAST_ERROR
        3. TOAST_WARNING
        4. TOAST_INFO
        5. TOAST_DELETE

Toast Duration ⌛️

        1. LONG_DURATION // 4 Seconds
        2. SHORT_DURATION // 2 Seconds
       

Usage

Sample Code for - Motion Toast 🌟

Success Toast

 MotionToast.createToast(this,
 		"Hurray success 😍"
 		"Upload Completed successfully!",
                MotionToastStyle.SUCCESS,
                MotionToast.GRAVITY_BOTTOM,
                MotionToast.LONG_DURATION,
                ResourcesCompat.getFont(this,R.font.helvetica_regular))
                

Error Toast

 MotionToast.createToast(this,
 		    "Failed ☹️"
 		    "Profile Update Failed!",
                    MotionToastStyle.ERROR,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

Warning Toast

MotionToast.createToast(this,"Please fill all the details!",
                    MotionToastStyle.WARNING,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

        

Info Toast

       MotionToast.createToast(this,"This is information toast!",
                    MotionToastStyle.INFO,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

Delete Toast

       MotionToast.createToast(this,"Delete all history!",
                    MotionToastStyle.DELETE,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

Sample Code for - Color Motion Toast 🌈

Success Toast

 MotionToast.createColorToast(this,"Upload Completed!",
                MotionToastStyle.SUCCESS,
                MotionToast.GRAVITY_BOTTOM,
                MotionToast.LONG_DURATION,
                ResourcesCompat.getFont(this,R.font.helvetica_regular))
                

Error Toast

 MotionToast.createColorToast(this,"Profile Update Failed!",
                    MotionToastStyle.ERROR,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

Warning Toast

MotionToast.createColorToast(this,"Please fill all the details!",
                    MotionToastStyle.WARNING,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

        

Info Toast

       MotionToast.createColorToast(this,"This is information toast!",
                    MotionToastStyle.INFO,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

Delete Toast

       MotionToast.createColorToast(this,"Delete all history!",
                    MotionToastStyle.DELETE,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

Sample Code for - Dark Toast 🌚🖤

Success Toast

 MotionToast.darkToast(this,"Upload Completed!",
                MotionToastStyle.SUCCESS,
                MotionToast.GRAVITY_BOTTOM,
                MotionToast.LONG_DURATION,
                ResourcesCompat.getFont(this,R.font.helvetica_regular))
                

Error Toast

 MotionToast.darkToast(this,"Profile Update Failed!",
                    MotionToastStyle.ERROR,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

Warning Toast

MotionToast.darkToast(this,"Please fill all the details!",
                    MotionToastStyle.WARNING,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

        

Info Toast

       MotionToast.darkToast(this,"This is information toast!",
                    MotionToastStyle.INFO,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

Delete Toast

       MotionToast.darkToast(this,"Delete all history!",
                    MotionToastStyle.DELETE,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

Sample Code for - Dark Color Toast 🌚🖤🌈

Success Toast

 MotionToast.darkColorToast(this,"Upload Completed!",
                MotionToastStyle.SUCCESS,
                MotionToast.GRAVITY_BOTTOM,
                MotionToast.LONG_DURATION,
                ResourcesCompat.getFont(this,R.font.helvetica_regular))
                

Error Toast

 MotionToast.darkColorToast(this,"Profile Update Failed!",
                    MotionToastStyle.ERROR,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

Warning Toast

MotionToast.darkColorToast(this,"Please fill all the details!",
                    MotionToastStyle.WARNING,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

        

Info Toast

       MotionToast.darkColorToast(this,"This is information toast!",
                    MotionToastStyle.INFO,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

Delete Toast

       MotionToast.darkColorToast(this,"Delete all history!",
                    MotionToastStyle.DELETE,
                    MotionToast.GRAVITY_BOTTOM,
                    MotionToast.LONG_DURATION,
                    ResourcesCompat.getFont(this,R.font.helvetica_regular))  

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

paypal

License



    Copyright 2020 Spikey sanju

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.