From 6f5700b618619714fcc781b58d29a3423c19a2b2 Mon Sep 17 00:00:00 2001 From: atanasovg Date: Thu, 13 Mar 2014 13:02:00 +0200 Subject: [PATCH] Added missing export. Uncommented the camera.android implementation. --- Camera/camera.android.ts | 27 ++++++++++++++++--------- Image/image.ios.ts | 2 +- UserPreferences/user_preferences.ios.ts | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Camera/camera.android.ts b/Camera/camera.android.ts index 6d480f0fc..a52c3ce1e 100644 --- a/Camera/camera.android.ts +++ b/Camera/camera.android.ts @@ -1,23 +1,30 @@ -export module tk { +import app_module = require("Application/application"); + +export module tk { export module io { 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'); - //if (takePictureIntent.resolveActivity(UI.Application.android.context.getPackageManager()) !== null) { - // UI.Application.android.currentActivity.startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE); - //} + 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(); - //readPictureIntent.setType('image/*'); - //readPictureIntent.setAction('android.intent.action.GET_CONTENT'); - //UI.Application.android.currentActivity.startActivityForResult(android.content.Intent.createChooser(readPictureIntent, - // 'Select Picture'), REQUEST_SELECT_PICTURE); + 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); } } } diff --git a/Image/image.ios.ts b/Image/image.ios.ts index 8e556d310..bc267af8c 100644 --- a/Image/image.ios.ts +++ b/Image/image.ios.ts @@ -1,4 +1,4 @@ -module tk { +export module tk { export module ui { export enum ImageType { PNG = 0, diff --git a/UserPreferences/user_preferences.ios.ts b/UserPreferences/user_preferences.ios.ts index 20d0618c6..8acf6e3fe 100644 --- a/UserPreferences/user_preferences.ios.ts +++ b/UserPreferences/user_preferences.ios.ts @@ -1,6 +1,6 @@ import utils_module = require("Utils/utils_ios"); -module tk { +export module tk { // TODO: Think better naming and namespaces - e.g. tk.storage export module preferences {