Added current variable in the Application module (to provide a shortcut to the Application singleton).

This commit is contained in:
atanasovg
2014-05-07 15:50:06 +03:00
parent beba0ae4f4
commit 6e2eae411f
9 changed files with 37 additions and 39 deletions

View File

@@ -1,4 +1,4 @@
import app_module = require("Application/application");
import appModule = require("Application/application");
var REQUEST_IMAGE_CAPTURE: number = 1;
var REQUEST_SELECT_PICTURE: number = 2;
@@ -6,7 +6,7 @@ var REQUEST_SELECT_PICTURE: number = 2;
export class CameraManager {
public takePicture(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any) {
var takePictureIntent = new android.content.Intent('android.media.action.IMAGE_CAPTURE');
var androidApp = app_module.Application.current.android;
var androidApp = appModule.current.android;
if (takePictureIntent.resolveActivity(androidApp.context.getPackageManager()) !== null) {
androidApp.currentActivity.startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
@@ -16,7 +16,7 @@ export class CameraManager {
// options { useSavedPhotos: true }
public pictureFromLibrary(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any) {
var readPictureIntent = new android.content.Intent();
var androidApp = app_module.Application.current.android;
var androidApp = appModule.current.android;
readPictureIntent.setType('image/*');
readPictureIntent.setAction('android.intent.action.GET_CONTENT');