Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcoscgdev/materialtoast
A fully and highly customizable material designed Toast for Android.
https://github.com/marcoscgdev/materialtoast
android free library material materialtoast notification toast
Last synced: 16 days ago
JSON representation
A fully and highly customizable material designed Toast for Android.
- Host: GitHub
- URL: https://github.com/marcoscgdev/materialtoast
- Owner: marcoscgdev
- License: apache-2.0
- Created: 2018-12-22T15:50:03.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-20T15:56:59.000Z (about 4 years ago)
- Last Synced: 2025-01-20T12:47:48.430Z (17 days ago)
- Topics: android, free, library, material, materialtoast, notification, toast
- Language: Kotlin
- Homepage: https://github.com/marcoscgdev/MaterialToast
- Size: 197 KB
- Stars: 31
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MaterialToast
A fully and highly customizable material designed Toast for Android.
You can download the **sample apk** [here](https://github.com/marcoscgdev/MaterialToast/releases/download/1.0.2/app-debug.apk).
---
## Releases:
#### Current release: 1.0.2.
You can see all the library releases [here](https://github.com/marcoscgdev/MaterialToast/releases).
---
## Usage:
### Adding the depencency
Add this to your root *build.gradle* file:
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```Now add the dependency to your app build.gradle file:
```
implementation 'com.github.marcoscgdev:MaterialToast:1.0.2'
```### Creating a Toast
- Native version
```java
MaterialToast.makeText(activity, "Hello, I'm a material toast!", Toast.LENGTH_SHORT).show();
```Also with custom icon
```java
MaterialToast.makeText(activity, "Hello, I'm a material toast!", R.mipmap.ic_launcher, Toast.LENGTH_SHORT).show();
```And also with custom background color (text will be automatically colored based on background color)
```java
MaterialToast.makeText(activity, "Hello, I'm a material toast!", R.mipmap.ic_launcher, Toast.LENGTH_SHORT).setBackgroundColor(Color.RED).show();
```**NEW!** With custom duration (in millis):
```java
MaterialToast.makeText(activity, "Hello, I'm a material toast!", R.mipmap.ic_launcher, 4000).setBackgroundColor(Color.RED).show();
```- Complete version
```java
new MaterialToast(activity)
.setMessage("Hello, I'm a material toast!")
.setIcon(R.mipmap.ic_launcher)
.setDuration(Toast.LENGTH_SHORT)
.setBackgroundColor(Color.RED)
.show();
```---
>See the *sample project* to clarify any queries you may have.---
## License
```
Copyright 2018 Marcos Calvo GarcíaLicensed 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 athttp://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.
```