SkillAgentSearch skills...

AirySnackbar

Android custom top snackbar with predefined & custom types

Install / Use

/learn @akndmr/AirySnackbar
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

AirySnackbar 🪁

<img width="442" alt="airysnackbar" src="https://user-images.githubusercontent.com/15641747/205441655-cf4ecbde-18db-4b59-bc1f-cb7a1f7946a3.png">

A custom and customizable Android snackbar library.

Language GitHub issues GitHub Repo stars JitPack

Installation

Step 1. Add the JitPack repository to your build file

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

Step 2. Add the dependency

  dependencies {
	    implementation 'com.github.akndmr:AirySnackbar:LatestVersion'
	}

Demo

https://user-images.githubusercontent.com/15641747/203623672-40cc7e4a-78f2-4f77-bc66-c4495374ab90.mov

Usage

Show a AirySnackbar

   AirySnackbar.make(
                    source = AirySnackbarSource.ActivitySource(activity = this),
                    type = Type.Custom,
                    attributes =
                    listOf(
                        TextAttribute.Text(text = "Custom color bg AirySnackbar"),
                        TextAttribute.TextColor(textColor = R.color.black),
                        IconAttribute.Icon(iconRes = R.drawable.ic_custom),
                        IconAttribute.IconColor(iconTint = R.color.teal_200),
                        SizeAttribute.Margin(left = 24, right = 24, unit = SizeUnit.DP),
                        SizeAttribute.Padding(top = 12, bottom = 12, unit = SizeUnit.DP),
                        RadiusAttribute.Radius(radius = 8f),
                        GravityAttribute.Top,
                        AnimationAttribute.FadeInOut
                    )
                ).show()

We have 3 parameters for a snackbar, as listed below.

| Parameter | Type | Description | | :-------- | :------- | :------------------------- | | source | AirySnackbarSource | ActivitySource, DialogSource, ViewSource | | type | AirySnackbarType | Success, Error, Info, Warning, Default, Custom | | attributes | List<AirySnackbarAttribute> | IconAttribute, TextAttribute, SizeAttribute, RadiusAttribute, GravityAttribute, AnimationAttribute |

AirySnackbarSource

Provides parent ViewGroup and context for snackbar.

| Source | Description | | :-------- | :------- | | ActivitySource | Provides window?.decorView as source. | | DialogSource | Provides dialog's window?.decorView as source and dies if dialog is destroyed before snackbar itself. | | ViewSource | Provides view's parent (android.R.id.content) as source and dies if view is destroyed before snackbar itself. |

Note:

Choose right source wisely. Watch the video below to see possible side effects of sources.

https://user-images.githubusercontent.com/15641747/205439734-8fda16eb-0ef0-4290-97dc-70eb5750e6e6.mov

AirySnackbarType

There are predefined types like Success and Error. Only difference between types is background color for now. You can prefer Custom type to set your own background color. Custom(@ColorRes val bgColor: Int)

AirySnackbarAttribute

| Type | Attributes | | :-------- | :------- | | TextAttribute | Text, TextColor, TextSize | | IconAttribute | Icon, IconColor, NoIcon | | SizeAttribute | Margin, Padding | | RadiusAttribute | Radius | | GravityAttribute* | Top, Bottom | | AnimationAttribute** | FadeInOut, SlideInOut |

*Recommended gravity is the default top gravity. Using bottom may cause some issues. <br/> **Recommended animation is the default FadeInOut animation. Using SlideInOut animation with top(default) gravity will cause issues.

Roadmap

  • Fix animation issues or remove slide animation.
  • Add custom duration.
  • Fix bottom gravity issues or remove bottom option.
View on GitHub
GitHub Stars30
CategoryDevelopment
Updated1mo ago
Forks3

Languages

Kotlin

Security Score

80/100

Audited on Feb 7, 2026

No findings