https://github.com/boybeak/notificationstyles
A demo project shows how to user Notification Styles, such as MediaStyle, InboxStyle, BigTextStyle, BigPictureStyle and MessagingStyle.
https://github.com/boybeak/notificationstyles
Last synced: 10 months ago
JSON representation
A demo project shows how to user Notification Styles, such as MediaStyle, InboxStyle, BigTextStyle, BigPictureStyle and MessagingStyle.
- Host: GitHub
- URL: https://github.com/boybeak/notificationstyles
- Owner: boybeak
- License: apache-2.0
- Created: 2017-01-18T09:05:18.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-12-26T08:58:09.000Z (over 4 years ago)
- Last Synced: 2025-05-13T00:48:08.074Z (about 1 year ago)
- Language: Java
- Size: 1.49 MB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NotificationStyles
## Install
Now it's available on jcenter.
With Gradle:
```groovy
compile 'com.github.boybeak:notify:1.3.1'
```
With Maven:
```xml
com.github.boybeak
notify
1.3.1
pom
```
## NotificationCenter
With this library, you can show a notification simply like belows:
```java
NotificationCenter.with(this)
.smallIcon(R.mipmap.ic_launcher)
.contentText("Messaging ContentText")
.contentTitle("Messaging ContentTitle")
.ticker("Messaging Ticker")
.when(System.currentTimeMillis(), true)
.withPendingIntent()
.flags(PendingIntent.FLAG_CANCEL_CURRENT)
.requestCode(100)
.activityContent(new Intent(this, MainActivity.class))
.withPendingIntent()
.flags(0)
.requestCode(200)
.broadcastDelete(new Intent("com.nulldreams.notificationstyles.DELETE"))
.asBigPictureStyle()
.bigContentTitle("InboxStyle bigContentTitle")
.summaryText("InboxStyle summaryText")
.bigLargeIcon(iconBmp)
.bigPicture(picture)
.show(4);
```
There are 4 styles for you, **BigPicture**, **BigText**, **Inbox** and **Messaging**. And also you can define your own Style, see the demo style [AsyncBigPicture.java](https://github.com/boybeak/NotificationStyles/blob/master/app/src/main/java/com/nulldreams/notificationstyles/AsyncBigPicture.java).
To use this custom style, you need call asStyle method of NotificationCenter.
> Now, MediaStyle still not finished.
## ToastCenter
Simply like this:
```java
ToastCenter.with(this).text(R.string.toast, "Alice").showShort();
```
With this, you can pass parameters directly.