mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
renamed folders with lower cases and renamed user preferences to local settings
This commit is contained in:
27
camera/camera.android.ts
Normal file
27
camera/camera.android.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import appModule = require("application/application");
|
||||
|
||||
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 = appModule.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 = appModule.android;
|
||||
|
||||
readPictureIntent.setType('image/*');
|
||||
readPictureIntent.setAction('android.intent.action.GET_CONTENT');
|
||||
|
||||
androidApp.currentActivity.startActivityForResult(android.content.Intent.createChooser(readPictureIntent, 'Select Picture'),
|
||||
REQUEST_SELECT_PICTURE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user