mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Added current variable in the Application module (to provide a shortcut to the Application singleton).
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user