/Snat

It is a simple Android library implemented in Kotlin, which help you to implement Custom Toast and Snackbar in a single function call

Primary LanguageKotlinApache License 2.0Apache-2.0

Snat

A simple android library coded in Kotlin for showing Toast and Snackbar.

Release

Examples

Default Toast Message

Toast with Short Duration Toast with Long Duration

Positional Toast Message

Toast on Top of the Display Toast on Bottom of the Display Toast on Left of the Display Toast on Right of the Display

Library

The library is inside the Snat folder

Sample

The sample App is inside the app folder

Implementing Snat

Implementing Snat is really simple. You have to just call the function according to your need.

  • For Default Toast Message

          SnatToast.toastDefault(context, message, duration)

    Parameter of the function

    • context: Context of the Activity.
    • message: Message you want to display. It should be a String type variable.
    • duration: For how much time you want to show the toast. A Integer which can be either 0 for Short Duration or 1 for Long Duration.
  • For Positional Toast Message

         SnatToast.positionedToast(context, message, duration, gravity, xOffSet, yOffSet)

    Parameter of the function

    • context: Context of the Activity.
    • message: Message you want to display. It should be a String type variable.
    • duration: For how much time you want to show the toast. A Integer which can be either 0 for Short Duration or 1 for Long Duration.
    • gravity: The position for Toast message. A Integer which can:
      • 1 for positioning at TOP
      • 2 for positioning at BOTTOM
      • 3 for positioning at LEFT
      • 4 for positioning at RIGHT
    • xOffSet: For setting margin X coordinate. A Integer type value.
    • yOffSet: For setting margin in Y coordinate. A Integer type value.

How to add Snat to your Project

You can add Snat in your projects using jitpack maven disturbtion

Steps

  1. Add Maven Repository in build.gradle file (project-level).

     repositories {
         jcenter()
         maven {
             url "https://jitpack.io"
         }
     }
  2. Add dependency in build.gradle file (app-level)

    dependencies {
       implementation 'com.github.IronClad1607:Snat:1.3'
    }

Made with ❤️ by @IronClad1607