Skip to content

OSMToast Library helps in creating an awesome and meaningful toast message in your android apps.

Notifications You must be signed in to change notification settings

TripathiViky/OSMToastExample

Repository files navigation

OSMToastExample

platform API License

Prerequisites

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
	repositories {
		...
		mavenCentral()
	}
}

Dependency

Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
	...
	implementation 'com.github.TripathiViky:OSMToastExample:0.0.1'
}

Usage

Each method always returns a Toast object, so you can customize the Toast much more. DON'T FORGET THE show() METHOD!

To display an default Toast:

OSMToast.makeText(this, "Default Toast", OSMToast.LENGTH_LONG, OSMToast.DEFAULT).show();

To display a success Toast:

OSMToast.makeText(this, "Success Toast !", OSMToast.LENGTH_LONG, OSMToast.SUCCESS).show();

To display a warning Toast:

OSMToast.makeText(this, "Warning Toast", OSMToast.LENGTH_LONG, OSMToast.WARNING).show();

To display the error Toast:

OSMToast.makeText(this, "Error Toast", OSMToast.LENGTH_LONG, OSMToast.ERROR).show();

To display an info Toast:

OSMToast.makeText(this, "Info Toast", OSMToast.LENGTH_LONG, OSMToast.INFO).show();

To display the confusing Toast:

OSMToast.makeText(this, "Confuse Toast", OSMToast.LENGTH_LONG, OSMToast.CONFUSING).show();

You can also add custom logo on top-right corner by passing last parameter as drawable file.

OSMToast.makeText(this, "Success Toast with logo", OSMToast.LENGTH_LONG, OSMToast.SUCCESS, R.drawable.logo).show();

Contributing

Please fork this repository and contribute back using pull requests.

Any contributions, large or small, major features, bug fixes, are welcomed and appreciated but will be thoroughly reviewed .

Contact - Let's become friend

Don't forget to star ⭐ the repo it motivates me to share more open source

License

Copyright 2022 Vikas Tripathi
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.