New Native Event Handler

Ashera provides framework to create predefined event handler in cross platform way.

Installation

The following are the steps to create new event handler:

  • Download a copy of https://github.com/AsheraCordova/Custom.git into the project folder. This project acts as a template for adding custom cross platform functionality.
  • Install the plugin onto the project using command cordova plugin add Custom.
  • Import the project into your favorite ide. e.g. eclipse
  • Sample event handler can be found in the project here
  • After you create your new event handler, you need to register it as follows com.ashera.widget.EventCommandFactory.registerCommand("custom", new CustomEventCommand());
  • The following code shows native event handler which is invoked on onPageScrolled event:
    onPageScrolled="+custom#onPageScrolled()"
    The + indicates that it is native event delivered to event handler with registration "custom".
  • Also given that the project is cordova plugin, you need to update plugin.xml and reinstall the plugin for any new functionality to take effect.

Example - View Pager

This example shows how you can add motion when swiping between ViewPager tabs.