Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23266] Android: Hyperloop: Allow requiring java package to access types

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-05-09T13:08:23.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsAndroid, Hyperloop
Labelsandroid, hyperloop
ReporterHans Knöchel
AssigneeChristopher Williams
Created2016-04-22T13:22:44.000+0000
Updated2016-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();

Comments

  1. Christopher Williams 2016-05-06

    https://github.com/appcelerator/hyperloop.next/pull/28
  2. Lokesh Choudhary 2016-07-20

    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

JSON Source