mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 05:18:39 +08:00
namespaces removed (except Application)
This commit is contained in:
@ -1,31 +1,27 @@
|
||||
import app_module = require("Application/application");
|
||||
|
||||
export module tk {
|
||||
export module io {
|
||||
var REQUEST_IMAGE_CAPTURE: number = 1;
|
||||
var REQUEST_SELECT_PICTURE: number = 2;
|
||||
var REQUEST_IMAGE_CAPTURE: number = 1;
|
||||
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.tk.ui.Application.current.android;
|
||||
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.tk.ui.Application.current.android;
|
||||
|
||||
if (takePictureIntent.resolveActivity(androidApp.context.getPackageManager()) !== null) {
|
||||
androidApp.currentActivity.startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
|
||||
}
|
||||
}
|
||||
|
||||
// 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.tk.ui.Application.current.android;
|
||||
|
||||
readPictureIntent.setType('image/*');
|
||||
readPictureIntent.setAction('android.intent.action.GET_CONTENT');
|
||||
|
||||
androidApp.currentActivity.startActivityForResult(android.content.Intent.createChooser(readPictureIntent, 'Select Picture'),
|
||||
REQUEST_SELECT_PICTURE);
|
||||
}
|
||||
if (takePictureIntent.resolveActivity(androidApp.context.getPackageManager()) !== null) {
|
||||
androidApp.currentActivity.startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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.tk.ui.Application.current.android;
|
||||
|
||||
readPictureIntent.setType('image/*');
|
||||
readPictureIntent.setAction('android.intent.action.GET_CONTENT');
|
||||
|
||||
androidApp.currentActivity.startActivityForResult(android.content.Intent.createChooser(readPictureIntent, 'Select Picture'),
|
||||
REQUEST_SELECT_PICTURE);
|
||||
}
|
||||
}
|
34
Camera/camera.d.ts
vendored
34
Camera/camera.d.ts
vendored
@ -1,22 +1,18 @@
|
||||
export declare module tk {
|
||||
export module camera {
|
||||
export enum CameraPosition {
|
||||
FRONT = 0,
|
||||
BACK = 1,
|
||||
}
|
||||
export declare enum CameraPosition {
|
||||
FRONT = 0,
|
||||
BACK = 1,
|
||||
}
|
||||
|
||||
export enum FlashMode {
|
||||
AUTO = 0, // default
|
||||
ON = 1,
|
||||
OFF = 2
|
||||
}
|
||||
export declare enum FlashMode {
|
||||
AUTO = 0, // default
|
||||
ON = 1,
|
||||
OFF = 2
|
||||
}
|
||||
|
||||
// TODO most of hardware related parts need to handle onPause and onResume of the calling activities
|
||||
export class CameraManager {
|
||||
takePicture(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any);
|
||||
// TODO most of hardware related parts need to handle onPause and onResume of the calling activities
|
||||
export declare class CameraManager {
|
||||
takePicture(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any);
|
||||
|
||||
// options { useSavedPhotos: true }
|
||||
pictureFromLibrary(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any);
|
||||
}
|
||||
}
|
||||
}
|
||||
// options { useSavedPhotos: true }
|
||||
pictureFromLibrary(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any);
|
||||
}
|
@ -1,15 +1,11 @@
|
||||
export module tk {
|
||||
export module io {
|
||||
var REQUEST_IMAGE_CAPTURE: number = 1;
|
||||
var REQUEST_SELECT_PICTURE: number = 2;
|
||||
var REQUEST_IMAGE_CAPTURE: number = 1;
|
||||
var REQUEST_SELECT_PICTURE: number = 2;
|
||||
|
||||
export class CameraManager {
|
||||
public takePicture(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any) {
|
||||
}
|
||||
|
||||
// options { useSavedPhotos: true }
|
||||
public pictureFromLibrary(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any) {
|
||||
}
|
||||
}
|
||||
export class CameraManager {
|
||||
public takePicture(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any) {
|
||||
}
|
||||
}
|
||||
|
||||
// options { useSavedPhotos: true }
|
||||
public pictureFromLibrary(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any) {
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user