Skip to content

Decorator Plugin Development

richard edited this page Nov 2, 2015 · 10 revisions

Overview

Decorator plug-in is responsible for modifying the notification to provider better experience, such as design polishing, additional functionality and even Android Wear/Auto support.

Decorators from different developers may work in a pipeline to processing the notification one by one, ordered by "priority" attribute, which provide the hint for final ordering. (User will be allowed to re-order the decorators in settings in a future version)

Work Flow

Decorator is implemented by extending "NevoDecoratorService" class. It has two basic methods:

  • apply() receives notification to be processed in its argument and applies modifications via various APIs on "StatusBarNotificationEvo" class.

  • onNotificationRemoved() receives the event of notification removal. Nothing can be applied to the notification here. It's commonly used to keep internal state synchronized with notification visibility state.

Limitations

  • Currently, besides the Nevolution app, an additional tiny "Extension Pack" app is required to be installed (from Nevolution - Settings - About) for 3rd-party decorators to work. This restriction will be removed before the public release of Nevolution.

  • Notification can only be altered, but not removed by 3rd-party decorators at present. It's a design choice to prevent notification loss caused by bugs or mis-configured settings in decorators. If you have different opinion on this decision, please feel free to discuss with us in the community.

  • Before Android 6.0, due to platform limitation, the status-bar icon of the original notification can not be restored if any part of the notification is altered. We are still working on a proper solution. At present, if the icon is very important for your decorator, please file a feature request with the app name and icon PNG file (in xxhdpi, extracted from that app) on the issue tracker. We'll ship the icon with Nevolution app, so your decorator could duplicate the required status bar icon in the altered notification.

Write an Effective Decorator

Optional: let user config your decorator

There are two activities for users to config your decorator, refer to BundleSettingsActivity and BundleActionActivity in Manifest.xml.

  1. For package level configuration called "Settings Activity", user could enter your activity by click "settings" icon upon your decorator description card.
  2. For notification level configuration called "Action Activity", will display an action item at bottom when user choose one notification which your decorator is enabled for that package. Your activity should provide an icon to show, which will multiply color #76ff03 , and provide an description text when user long click the icon. At present we haven't provide performing action by sending broadcast or any other, if you think this is necessary please let us know.

TODO

Clone this wiki locally