Skip to content

amary21/MaterialToast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Material Toast

Material Toast is a toast that is built based on Alert MUI

Getting Started

Material Toast is distributed through Github Package. To use it, you need to do the following:

  1. Generate Personal Access Token

    • login Github
    • go to Setting > Developer Setting > Personal Access Tokens > Generate new token
    • sure you select the following scopes: github-token
    • generate token
  2. Store your Github Personal Access Token details

    • Create a github.properties file 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
      gpr.user=GITHUB_USERID
      gpr.key=PERSONAL_ACCESS_TOKEN
      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
  3. 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

How To Use

  • description only

    MToast.Builder(context)
        .setType(MToastType.INFO)
        .setMessage("This is an info alert — check it out!")
        .show()
    Toast Type Output
    MToastType.INFO toast-info
    MToastType.SUCCESS toast-success
    MToastType.WARNING toast-warning
    MToastType.ERROR toast-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 toast-info-title
    MToastType.SUCCESS toast-success-title
    MToastType.WARNING toast-warning-title
    MToastType.ERROR toast-error-title

About

Toast Library for Android with base Material UI

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages