-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Karn/develop
**New features**: - Notification Alerting -- configure the LED color, sounds and vibrations of Notifications. - Set the `LargeIcon`. - Configure the People associated with the notification, this helps the system prioritize notifications and bypass Do Not Disturb mode if applicable. **Breaking changes**: - Modified: - `NotifyCreator#alerting(Payload.Alert.() -> Unit)` -> `NotifyCreator#alerting(String, Payload.Alert.() -> Unit)` - `Notify#defaultConfig { }` now uses DSL syntax for default `Header` and Alerting configuration. - Renamed: - `Creator` -> `NotifyCreator` - `Notify#DEFAULT_CHANNEL_KEY` -> `Notify#CHANNEL_DEFAULT_KEY` - `Notify#DEFAULT_CHANNEL_NAME` -> `Notify#CHANNEL_DEFAULT_NAME` - `Notify#DEFAULT_CHANNEL_DESCRIPTION` -> `Notify#CHANNEL_DEFAULT_DESCRIPTION`
- Loading branch information
Showing
36 changed files
with
1,088 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Advanced Usage | ||
> **Note:** This page is still a work-in-progress. You can help complete the documentation by contributing to the project. | ||
|
||
#### RESPONDING TO CLICKS | ||
The `Payload.Meta` object provides `clickIntent` and `clearIntent` members which when not `null` will be fired when clicked or dismissed. | ||
|
||
#### STACKABLE NOTIFICATIONS | ||
|
||
#### ACTIONS |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
## Notification Types | ||
|
||
#### STANDARD NOTIFICATION | ||
|
||
![Standard Notification](./assets/types/default.svg) | ||
|
||
Simple notifications are very easy! | ||
|
||
```Kotlin | ||
Notify | ||
.with(context) | ||
.content { // this: Payload.Content.Default | ||
// The title of the notification (first line). | ||
title = "New dessert menu" | ||
// The second line of the notification. | ||
text = "The Cheesecake Factory has a new dessert for you to try!" | ||
} | ||
.show() | ||
``` | ||
|
||
#### LIST NOTIFICATION | ||
|
||
![List Notification](./assets/types/list-text.svg) | ||
|
||
Notifications with multiple lines are very common. Notify provides a simple DSL to build these notfications. | ||
|
||
```Kotlin | ||
Notify | ||
.with(context) | ||
.asTextList { // this: Payload.Content.TextList | ||
// The lines that are shown when the notification is expanded. | ||
lines = Arrays.asList("New! Fresh Strawberry Cheesecake.", | ||
"New! Salted Caramel Cheesecake.", | ||
"New! OREO Dream Dessert.") | ||
// The title of the collapsed notification. | ||
title = "New menu items!" | ||
// The second line of the collapsed notification. | ||
text = lines.size.toString() + " new dessert menu items found." | ||
} | ||
.show() | ||
``` | ||
|
||
#### BIG TEXT | ||
|
||
![Big Text Notification](./assets/types/big-text.svg) | ||
|
||
For instances where you'd like to show a longer message you can use the `BigText` notification type. These kinds of messages are ideal for things such as email content, and news previews. | ||
|
||
```Kotlin | ||
Notify | ||
.with(context) | ||
.asBigText { // this: Payload.Content.TextList | ||
// The title of the notification. | ||
title = "Chocolate brownie sundae" | ||
// The second line of the (collapsed) notification. | ||
text = "Try our newest dessert option!" | ||
// The second line of the expanded notification. | ||
expandedText = "Try our newest dessert option!" | ||
// Large string that is displayed under the line above. | ||
bigText = "Our own Fabulous Godiva Chocolate Brownie, Vanilla " + | ||
"Ice Cream, Hot Fudge, Whipped Cream and Toasted " + | ||
"Almonds.\n\n" + | ||
"Come try this delicious new dessert and get two for " + | ||
"the price of one!" | ||
} | ||
.show() | ||
``` | ||
|
||
#### BIG PICTURE | ||
|
||
![Big Picture Notification](./assets/types/big-picture.svg) | ||
|
||
The big picture allows an application to notify the user in a manner similar to the [screenshot saved](https://www.androidexplained.com/wp-content/uploads/2017/10/Pixel-2-Screenshot-Notification.png) notification which shows a preview of the screenshot within the main content of the notification. | ||
|
||
```Kotlin | ||
Notify | ||
.with(context) | ||
.asBigPicture { | ||
// The title of the notification. | ||
title = "Chocolate brownie sundae" | ||
// The second line of the (collapsed) notification. | ||
text = "Get a look at this amazing dessert!" | ||
// The second line of the expanded notification. | ||
expandedText = "The delicious brownie sundae now available." | ||
// A bitmap that is to be shown. The system will automatically resize | ||
// the image. | ||
image = BitmapFactory.decodeResource(context.resources, | ||
R.drawable.chocolate_brownie_sundae) | ||
} | ||
.show() | ||
``` | ||
|
||
#### MESSAGE NOTIFICATION | ||
|
||
![Messages notification](./assets/types/messages.svg) | ||
|
||
The message notification is useful when displaying conversations within an application. It can also be useful to set the `headerText` field of the `Header` block with the number of messages outside the scope (list.size - 6). | ||
|
||
```Kotlin | ||
Notify | ||
.with(context) | ||
.asMessage { | ||
userDisplayName = "Karn" | ||
conversationTitle = "Sundae chat" | ||
messages = Arrays.asList( | ||
NotificationCompat.MessagingStyle.Message( | ||
"Are you guys ready to try the Strawberry sundae?", | ||
System.currentTimeMillis() - (6 * 60 * 1000), // 6 Mins ago | ||
"Karn"), | ||
NotificationCompat.MessagingStyle.Message( | ||
"Yeah! I've heard great things about this place.", | ||
System.currentTimeMillis() - (5 * 60 * 1000), // 5 Mins ago | ||
"Nitish"), | ||
NotificationCompat.MessagingStyle.Message("What time are you getting there Karn?", | ||
System.currentTimeMillis() - (1 * 60 * 1000), // 1 Mins ago | ||
"Moez") | ||
) | ||
} | ||
.show() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#Wed Apr 25 23:19:53 EDT 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.