[TIMOB-23266] Android: Hyperloop: Allow requiring java package to access types
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-05-09T13:08:23.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.4.0 |
Components | Android, Hyperloop |
Labels | android, hyperloop |
Reporter | Hans Knöchel |
Assignee | Christopher Williams |
Created | 2016-04-22T13:22:44.000+0000 |
Updated | 2016-07-20T18:37:22.000+0000 |
Description
Currently, when we want to use a
View
with Hyperloop, we need to require it the following way:
*Android*:
var View = require("android.view.View");
Now if we want to use another class from the android.view
package e.g. Menu
, we need to do:
var Menu = require("android.view.Menu");
The approach is to make it possible to require frameworks like we do it in Swift/Objective-C and expose the available classes automatically:
var androidViewPackage = require("android.view.*");
var view = new androidViewPackage.View();
var menu = new androidViewPackage.Menu();
Or using ES6 syntax:
import { View, Menu } from 'android.view.*';
var view = new View();
var menu = new Menu();
https://github.com/appcelerator/hyperloop.next/pull/28
Verified the fix. Ran the alert test inside the hyperloop sample app. 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 5 - Android 6.0.1