@@ -3,13 +3,13 @@ A fully and highly customizable material designed Toast for Android.
3
3
4
4
<img src =" https://raw.githubusercontent.com/marcoscgdev/MaterialToast/master/device-2018-12-22-164932.png " width =" 350 " >
5
5
6
- You can download the ** sample apk** [ here] ( https://github.com/marcoscgdev/MaterialToast/releases/download/1.0.1 /app-debug.apk ) .
6
+ You can download the ** sample apk** [ here] ( https://github.com/marcoscgdev/MaterialToast/releases/download/1.0.2 /app-debug.apk ) .
7
7
8
8
---
9
9
10
10
## Releases:
11
11
12
- #### Current release: 1.0.1 .
12
+ #### Current release: 1.0.2 .
13
13
14
14
You can see all the library releases [ here] ( https://github.com/marcoscgdev/MaterialToast/releases ) .
15
15
@@ -33,33 +33,39 @@ allprojects {
33
33
Now add the dependency to your app build.gradle file:
34
34
35
35
```
36
- implementation 'com.github.marcoscgdev:MaterialToast:1.0.1 '
36
+ implementation 'com.github.marcoscgdev:MaterialToast:1.0.2 '
37
37
```
38
38
39
39
### Creating a Toast
40
40
41
41
- Native version
42
42
43
43
``` java
44
- MaterialToast . makeText(this , " Hello, I'm a material toast!" , Toast . LENGTH_SHORT ). show();
44
+ MaterialToast . makeText(activity , " Hello, I'm a material toast!" , Toast . LENGTH_SHORT ). show();
45
45
```
46
46
47
47
Also with custom icon
48
48
49
49
``` java
50
- MaterialToast . makeText(this , " Hello, I'm a material toast!" , R . mipmap. ic_launcher, Toast . LENGTH_SHORT ). show();
50
+ MaterialToast . makeText(activity , " Hello, I'm a material toast!" , R . mipmap. ic_launcher, Toast . LENGTH_SHORT ). show();
51
51
```
52
52
53
53
And also with custom background color (text will be automatically colored based on background color)
54
54
55
55
``` java
56
- MaterialToast . makeText(this , " Hello, I'm a material toast!" , R . mipmap. ic_launcher, Toast . LENGTH_SHORT ). setBackgroundColor(Color . RED ). show();
56
+ MaterialToast . makeText(activity, " Hello, I'm a material toast!" , R . mipmap. ic_launcher, Toast . LENGTH_SHORT ). setBackgroundColor(Color . RED ). show();
57
+ ```
58
+
59
+ ** NEW!** With custom duration (in millis):
60
+
61
+ ``` java
62
+ MaterialToast . makeText(activity, " Hello, I'm a material toast!" , R . mipmap. ic_launcher, 4000 ). setBackgroundColor(Color . RED ). show();
57
63
```
58
64
59
65
- Complete version
60
66
61
67
``` java
62
- new MaterialToast (this )
68
+ new MaterialToast (activity )
63
69
.setMessage(" Hello, I'm a material toast!" )
64
70
.setIcon(R . mipmap. ic_launcher)
65
71
.setDuration(Toast . LENGTH_SHORT )
0 commit comments