Skip to content

Latest commit

 

History

History
142 lines (108 loc) · 3.74 KB

README.md

File metadata and controls

142 lines (108 loc) · 3.74 KB

CustomToasta

CustomToast-Kotlin - Types of Toast Style ❤️

1. Info Toasta 2. Success Toasta 3. Warning Toasta 4. Error Toasta 5. Basic Toasta
## About

A Beautiful CustomToasta in Android using Kotlin.

Five Toast Types 🖐🏼

    1. Info Toasta  
    2. Success Toasta   
    3. Warning Toasta  
    4. Error Toasta  
    5. Basic Toasta  
    

Toast Duration ⌛️

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

Usage

Sample Code for - CustomToasta 🌟

1- Info Toasta

 fun makeInfoToast() {
        makeToast(this, "This is an Info Toast Message").show()
        
       // Toasta.makeToast(this, "This is an Info Toast Message").show()
    }


2. Success Toasta

fun makeSuccessToasta() {
        makeToast(
            this,
            "This is a Success Toast Message",
            Toasta.CUSTOM_DURATION_SHORT,
            Toasta.CUSTOM_TYPE_SUCCESS,
            Toasta.CUSTOM_GRAVITY_TOP
        ).show()

    }

3. Warning Toasta

 fun makeWarningToasta() {
        Toasta.makeToast(
            this,
            "This is a Warning Toast Message",
            Toasta.CUSTOM_DURATION_SHORT,
            Toasta.CUSTOM_TYPE_WARNING,
            Toasta.CUSTOM_GRAVITY_CENTER
        ).show()
    }


4. Error Toasta

fun makeErrorToasta() {
        makeToast(
            this,
            "This is an Error Toast Message",
            Toasta.CUSTOM_DURATION_LONG,
            Toasta.CUSTOM_TYPE_ERROR
        ).show()
    }
    

5. Basic Toasta

   fun makeToastabasic() {
        Toast.makeText(this, "This is an Basic Toast Message", Toast.LENGTH_SHORT).show()
    }

Run Btn Toasta

 fun btnView() {
        button.setOnClickListener {
            makeInfoToasta()

        }
        button2.setOnClickListener {
            makeSuccessToasta()
        }
        button3.setOnClickListener {
            makeWarningToasta()
        }
        button4.setOnClickListener {
            makeErrorToasta()
        }
        button5.setOnClickListener {
            makeToastabasic()
        }

    }