Material Toast is a toast that is built based on Alert MUI
Material Toast is distributed through Github Package. To use it, you need to do the following:
-
Generate Personal Access Token
-
Store your Github Personal Access Token details
- Create a
github.propertiesfile within the root of your library’s Android project - Make sure you include this file within your .gitignore as it contains sensitive credentials
- Add properties
Replace GITHUB_USERID with your organisation user ID or your personal GitHub user ID. Replace PERSONA_ACCESS_TOKEN with the token generated in the previous step
gpr.user=GITHUB_USERID gpr.key=PERSONAL_ACCESS_TOKEN
- Create a
-
Add dependencies Material Toast
- Make the following changes to your build.gradle:
def githubProperties = new Properties() githubProperties.load(new FileInputStream(rootProject.file("github.properties"))) android { ... repositories { maven { name = "GitHubPackages" url = uri("https://maven.pkg.github.com/amary21/MaterialToast") credentials { username = githubProperties['gpr.user'] ?: System.getenv("GPR_USER") password = githubProperties['gpr.key'] ?: System.getenv("GPR_KEY") } } } } dependencies { ... implementation("com.amary.materialtoast:materialtoast:0.0.2") }
- Sync your project
- Make the following changes to your build.gradle:
-
description only
MToast.Builder(context) .setType(MToastType.INFO) .setMessage("This is an info alert — check it out!") .show()
Toast Type Output MToastType.INFO 
MToastType.SUCCESS 
MToastType.WARNING 
MToastType.ERROR 
-
title with description
MToast.Builder(context) .setType(MToastType.INFO) .setTitle("Info") .setMessage("This is an info alert — check it out!") .show()
Toast Type Output MToastType.INFO 
MToastType.SUCCESS 
MToastType.WARNING 
MToastType.ERROR 
