NotificationViewModel
A ViewModel that provides the information to show within a NotificationFragment.
The notification template is divided in several sections. Each section can be populated by its own data field in this ViewModel. A section is only visible if its view model is set.
There are two view variants of the notification, a narrow
one and a wide
one. Depending on whether the panel is shown in the notification center, the header description will include the date/time and the close icon will be visible. In the schematic overview below both are marked with an asterisk (*).
A schematic overview of the narrow notification template:
Header section Close section
__________________________________________________________
| _____ | |
| | | Header title | Close icon (*) |
| | | Header description | [X] |
| |_____| Header time (*) | |
|_________________________________________|________________|
| |
| Body text | Body section
|__________________________________________________________|
| ___________________ ____________________ |
| | | | | |
| | Primary button | | Secondary button | | Button section
| |___________________| |____________________| |
|__________________________________________________________|
| __ | |
| |__| | Option 1 |
|________|_________________________________________________|
| __ | |
| |__| | Option 2 | Options section
|________|_________________________________________________|
| __ | |
| |__| | Option N |
|________|_________________________________________________|
A schematic overview of the wide notification template:
Header section Button section Close section
______________________________________________________________________________________________
| _____ | ________________ __________________ | |
| | | Header title | | | | | | Close icon (*) |
| | | Header description | | Primary button | | Secondary button | | [X] |
| |_____| Header time (*) | |________________| |__________________| | |
|_________________________________|___________________________________________|________________|
| | |
| | Body text |
|____________|_________________________________________________________________________________|
| | __ | |
| | |__| | Option 1 |
|____________|________|________________________________________________________________________|
| | __ | |
| | |__| | Option 2 |
|____________|________|________________________________________________________________________|
| | __ | |
| | |__| | Option N |
|____________|________|________________________________________________________________________|
The header section gives the user a context on the notifications appearing (e.g. someone's calling, car warning, etc.). The body section is used to provide a description of a notification. The button section provides the user the ability to act upon the notification (if applicable). The options section provides the user a set of extra options to choose from (e.g. send quick replies, multiple options given by VPA, etc.).
Parameters
The type of the panel.
The NotificationPanel of type P that hosts this NotificationViewModel.
Inheritors
Types
A view model used to populate the header section of the notification template. The header summarizes the main contents of the notification. E.g., the image and the name of the contact of an incoming call.
A view model be used to populate one item in the options section.
Properties
The text shown in the creation time section. By default it returns RelativeTimeSpanStringResolver of the panel's creation time.
The view model for the header section containing the thumbnail, title and description.
The view models for options in the options section. Each view model populates an additional item in the options section. Each item represents one option a user can choose from(e.g. send quick replies, an option given by VPA, etc.).
The view model for the primary button in the button section.
The view model for the secondary action button in the button section.