Added typed information for lazily loaded android types.

This commit is contained in:
atanasovg
2016-01-20 14:03:04 +02:00
parent fbc612610f
commit f930914fa8
10 changed files with 13 additions and 12 deletions

View File

@ -256,7 +256,7 @@ export class AndroidApplication extends observable.Observable implements definit
ensureBroadCastReceiverClass(); ensureBroadCastReceiverClass();
var that = this; var that = this;
var registerFunc = function (context: android.content.Context) { var registerFunc = function (context: android.content.Context) {
var receiver = new BroadcastReceiverClass(onReceiveCallback); var receiver: android.content.BroadcastReceiver = new BroadcastReceiverClass(onReceiveCallback);
context.registerReceiver(receiver, new android.content.IntentFilter(intentFilter)); context.registerReceiver(receiver, new android.content.IntentFilter(intentFilter));
that._registeredReceivers[intentFilter] = receiver; that._registeredReceivers[intentFilter] = receiver;
} }

View File

@ -29,7 +29,7 @@ function doFrame(currentTimeMillis: number) {
} }
} }
var native; var native: fpsNative.FPSCallback;
function ensureNative() { function ensureNative() {
if (!native) { if (!native) {
native = new fpsNative.FPSCallback(doFrame); native = new fpsNative.FPSCallback(doFrame);

View File

@ -12,7 +12,7 @@ import http = require("http");
var requestIdCounter = 0; var requestIdCounter = 0;
var pendingRequests = {}; var pendingRequests = {};
var completeCallback; var completeCallback: com.tns.Async.CompleteCallback;
function ensureCompleteCallback() { function ensureCompleteCallback() {
if (completeCallback) { if (completeCallback) {
return; return;

View File

@ -64,7 +64,7 @@ export class Span extends spanCommon.Span {
(realFontAttributes & enums.FontAttributes.Italic) ? enums.FontStyle.italic : enums.FontStyle.normal, (realFontAttributes & enums.FontAttributes.Italic) ? enums.FontStyle.italic : enums.FontStyle.normal,
(realFontAttributes & enums.FontAttributes.Bold) ? enums.FontWeight.bold : enums.FontWeight.normal); (realFontAttributes & enums.FontAttributes.Bold) ? enums.FontWeight.bold : enums.FontWeight.normal);
ensureCustomTypefaceSpanClass(); ensureCustomTypefaceSpanClass();
let typefaceSpan = new CustomTypefaceSpanClass(realFontFamily, font.getAndroidTypeface()); let typefaceSpan: android.text.style.TypefaceSpan = new CustomTypefaceSpanClass(realFontFamily, font.getAndroidTypeface());
this.spanModifiers.push(typefaceSpan); this.spanModifiers.push(typefaceSpan);
} }
var realFontSize = this.fontSize || var realFontSize = this.fontSize ||

View File

@ -15,7 +15,7 @@ function ensureFloatType() {
} }
} }
var argbEvaluator; var argbEvaluator: android.animation.ArgbEvaluator;
function ensureArgbEvaluator() { function ensureArgbEvaluator() {
if (!argbEvaluator) { if (!argbEvaluator) {
argbEvaluator = new android.animation.ArgbEvaluator(); argbEvaluator = new android.animation.ArgbEvaluator();

View File

@ -30,7 +30,7 @@ function ensureLruBitmapCacheClass() {
export class Cache extends common.Cache { export class Cache extends common.Cache {
private _callback: any; private _callback: any;
private _cache; private _cache: android.util.LruCache<string, android.graphics.Bitmap>;
constructor() { constructor() {
super(); super();
@ -38,7 +38,6 @@ export class Cache extends common.Cache {
ensureLruBitmapCacheClass(); ensureLruBitmapCacheClass();
var maxMemory = java.lang.Runtime.getRuntime().maxMemory() / 1024; var maxMemory = java.lang.Runtime.getRuntime().maxMemory() / 1024;
var cacheSize = maxMemory / 8; var cacheSize = maxMemory / 8;
//console.log("cacheSize: " + cacheSize);
this._cache = new LruBitmapCacheClass(cacheSize); this._cache = new LruBitmapCacheClass(cacheSize);
var that = new WeakRef(this); var that = new WeakRef(this);

View File

@ -123,7 +123,7 @@ export class Page extends pageCommon.Page {
} }
/* tslint:disable */ /* tslint:disable */
private _dialogFragment; private _dialogFragment: android.app.DialogFragment;
/* tslint:enable */ /* tslint:enable */
protected _showNativeModalView(parent: Page, context: any, closeCallback: Function, fullscreen?: boolean) { protected _showNativeModalView(parent: Page, context: any, closeCallback: Function, fullscreen?: boolean) {
super._showNativeModalView(parent, context, closeCallback, fullscreen); super._showNativeModalView(parent, context, closeCallback, fullscreen);

View File

@ -88,7 +88,7 @@ function onItemsPropertyChanged(data: dependencyObservable.PropertyChangeData) {
var arr = java.lang.reflect.Array.newInstance(java.lang.Integer.class.getField("TYPE").get(null), 1); var arr = java.lang.reflect.Array.newInstance(java.lang.Integer.class.getField("TYPE").get(null), 1);
arr[0] = R_ATTR_STATE_SELECTED; arr[0] = R_ATTR_STATE_SELECTED;
var colorDrawable = new SegmentedBarColorDrawableClass(view.selectedBackgroundColor.android) var colorDrawable: android.graphics.drawable.ColorDrawable = new SegmentedBarColorDrawableClass(view.selectedBackgroundColor.android)
stateDrawable.addState(arr, colorDrawable); stateDrawable.addState(arr, colorDrawable);
stateDrawable.setBounds(0, 15, vg.getRight(), vg.getBottom()); stateDrawable.setBounds(0, 15, vg.getRight(), vg.getBottom());
@ -128,6 +128,8 @@ function ensureSegmentedBarColorDrawableClass() {
canvas.drawRect(0, this.getBounds().height() - 15, this.getBounds().width(), this.getBounds().height(), p); canvas.drawRect(0, this.getBounds().height() - 15, this.getBounds().width(), this.getBounds().height(), p);
} }
} }
SegmentedBarColorDrawableClass = SegmentedBarColorDrawable;
} }
export class SegmentedBarItem extends common.SegmentedBarItem { export class SegmentedBarItem extends common.SegmentedBarItem {
@ -144,7 +146,7 @@ export class SegmentedBarItem extends common.SegmentedBarItem {
} }
export class SegmentedBar extends common.SegmentedBar { export class SegmentedBar extends common.SegmentedBar {
private _android; private _android: android.widget.TabHost;
public _listener: android.widget.TabHost.OnTabChangeListener; public _listener: android.widget.TabHost.OnTabChangeListener;
public _createUI() { public _createUI() {

View File

@ -186,7 +186,7 @@ export class TabView extends common.TabView {
private _pagerAdapter: android.support.v4.view.PagerAdapter; private _pagerAdapter: android.support.v4.view.PagerAdapter;
private _androidViewId: number; private _androidViewId: number;
private _pageChagedListener; private _pageChagedListener: android.support.v4.view.ViewPager.SimpleOnPageChangeListener;
get android(): android.view.View { get android(): android.view.View {
return this._grid; return this._grid;

View File

@ -3,7 +3,7 @@ import { knownFolders } from "file-system"
export var debug = true; export var debug = true;
// TODO: Get this from the runtimes... // TODO: Get this from the runtimes...
var applicationRootPath; var applicationRootPath: string;
function ensureAppRootPath() { function ensureAppRootPath() {
if (!applicationRootPath) { if (!applicationRootPath) {
applicationRootPath = knownFolders.currentApp().path; applicationRootPath = knownFolders.currentApp().path;