[TIMOB-19702] Android: Support implementing native interfaces in hyperloop
| GitHub Issue | n/a |
|---|---|
| Type | Story |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2015-10-22T17:44:17.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 5.4.0 |
| Components | Android, Hyperloop |
| Labels | n/a |
| Reporter | Christopher Williams |
| Assignee | Christopher Williams |
| Created | 2015-10-09T14:11:05.000+0000 |
| Updated | 2016-07-19T21:05:57.000+0000 |
Description
Support some syntax that allows users to implement a native interface in Hyperloop JS.
https://github.com/appcelerator/hyperloop-android-module/commit/48ad605150bd14700bec5ec095c98b9880cc4017
// Instantiate a Java interface anonymously: var OnClickListener = require('android.view.View.OnClickListener'); var instance = new OnClickListener({ onClick: function() { // Perform action on click console.log("On click from JS!"); } }); instance.onClick(); // Now you could set this onclicklistener on a native button and should see the log message when the button is clicked...Verified the fix. Closing. Environment: Appc Studio : 4.7.0.201607111053 Ti SDK : 5.4.0.v20160713141635 Ti CLI : 5.0.9 Alloy : 1.9.1 MAC El Capitan : 10.11.5 Appc NPM : 4.2.8-1 Appc CLI : 5.4.0-33 Node: 4.4.4 Nexus 6 - Android 6.0.1