mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
Added missing export. Uncommented the camera.android implementation.
This commit is contained in:
@ -1,23 +1,30 @@
|
|||||||
export module tk {
|
import app_module = require("Application/application");
|
||||||
|
|
||||||
|
export module tk {
|
||||||
export module io {
|
export module io {
|
||||||
var REQUEST_IMAGE_CAPTURE: number = 1;
|
var REQUEST_IMAGE_CAPTURE: number = 1;
|
||||||
var REQUEST_SELECT_PICTURE: number = 2;
|
var REQUEST_SELECT_PICTURE: number = 2;
|
||||||
|
|
||||||
export class CameraManager {
|
export class CameraManager {
|
||||||
public takePicture(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any) {
|
public takePicture(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any) {
|
||||||
//var takePictureIntent = new android.content.Intent('android.media.action.IMAGE_CAPTURE');
|
var takePictureIntent = new android.content.Intent('android.media.action.IMAGE_CAPTURE');
|
||||||
//if (takePictureIntent.resolveActivity(UI.Application.android.context.getPackageManager()) !== null) {
|
var androidApp = app_module.tk.ui.Application.current.android;
|
||||||
// UI.Application.android.currentActivity.startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
|
|
||||||
//}
|
if (takePictureIntent.resolveActivity(androidApp.context.getPackageManager()) !== null) {
|
||||||
|
androidApp.currentActivity.startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// options { useSavedPhotos: true }
|
// options { useSavedPhotos: true }
|
||||||
public pictureFromLibrary(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any) {
|
public pictureFromLibrary(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any) {
|
||||||
//var readPictureIntent = new android.content.Intent();
|
var readPictureIntent = new android.content.Intent();
|
||||||
//readPictureIntent.setType('image/*');
|
var androidApp = app_module.tk.ui.Application.current.android;
|
||||||
//readPictureIntent.setAction('android.intent.action.GET_CONTENT');
|
|
||||||
//UI.Application.android.currentActivity.startActivityForResult(android.content.Intent.createChooser(readPictureIntent,
|
readPictureIntent.setType('image/*');
|
||||||
// 'Select Picture'), REQUEST_SELECT_PICTURE);
|
readPictureIntent.setAction('android.intent.action.GET_CONTENT');
|
||||||
|
|
||||||
|
androidApp.currentActivity.startActivityForResult(android.content.Intent.createChooser(readPictureIntent, 'Select Picture'),
|
||||||
|
REQUEST_SELECT_PICTURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module tk {
|
export module tk {
|
||||||
export module ui {
|
export module ui {
|
||||||
export enum ImageType {
|
export enum ImageType {
|
||||||
PNG = 0,
|
PNG = 0,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import utils_module = require("Utils/utils_ios");
|
import utils_module = require("Utils/utils_ios");
|
||||||
|
|
||||||
module tk {
|
export module tk {
|
||||||
// TODO: Think better naming and namespaces - e.g. tk.storage
|
// TODO: Think better naming and namespaces - e.g. tk.storage
|
||||||
export module preferences {
|
export module preferences {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user