Subversion Repository Public Repository

litesoft

Diff Revisions 905 vs 906 for /trunk/mobileGWT/gwt-phonegap/src/main/java/com/googlecode/gwtphonegap/client/camera/CameraMobileImpl.java

Diff revisions: vs.
  @@ -1,35 +1,33 @@
1 1 /*
2 2 * Copyright 2010 Daniel Kurka
3 3 *
4 - * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 - * use this file except in compliance with the License. You may obtain a copy of
6 - * the License at
4 + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 + * in compliance with the License. You may obtain a copy of the License at
7 6 *
8 7 * http://www.apache.org/licenses/LICENSE-2.0
9 8 *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 - * License for the specific language governing permissions and limitations under
9 + * Unless required by applicable law or agreed to in writing, software distributed under the License
10 + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 + * or implied. See the License for the specific language governing permissions and limitations under
14 12 * the License.
15 13 */
16 14 package com.googlecode.gwtphonegap.client.camera;
17 15
18 16 public class CameraMobileImpl implements Camera {
19 17
20 - @Override
21 - public void getPicture(PictureOptions options, PictureCallback callback) {
22 - if (options == null) {
23 - throw new IllegalArgumentException("options can not be null");
24 - }
25 -
26 - if (callback == null) {
27 - throw new IllegalArgumentException("callback can not be null");
28 - }
29 - getPicture0(options, callback);
30 - }
18 + @Override
19 + public void getPicture(PictureOptions options, PictureCallback callback) {
20 + if (options == null) {
21 + throw new IllegalArgumentException("options can not be null");
22 + }
23 +
24 + if (callback == null) {
25 + throw new IllegalArgumentException("callback can not be null");
26 + }
27 + getPicture0(options, callback);
28 + }
31 29
32 - private native void getPicture0(PictureOptions options, PictureCallback callback)/*-{
30 + private native void getPicture0(PictureOptions options, PictureCallback callback)/*-{
33 31 var successCallback = function(data) {
34 32 callback.@com.googlecode.gwtphonegap.client.camera.PictureCallback::onSuccess(Ljava/lang/String;)(data);
35 33 };
  @@ -63,6 +61,21 @@
63 61 correctOrientation : g_correct_o
64 62 };
65 63
64 + var jpop = options.@com.googlecode.gwtphonegap.client.camera.PictureOptions::getPopOverOptions()();
65 +
66 + if (jpop != null) {
67 + var popOver = {};
68 +
69 + popOver["x"] = jpop.@com.googlecode.gwtphonegap.client.camera.PopOverOptions::getX()();
70 + popOver["y"] = jpop.@com.googlecode.gwtphonegap.client.camera.PopOverOptions::getY()();
71 + popOver["width"] = jpop.@com.googlecode.gwtphonegap.client.camera.PopOverOptions::getWidth()();
72 + popOver["height"] = jpop.@com.googlecode.gwtphonegap.client.camera.PopOverOptions::getHeight()();
73 + popOver["arrowDir"] = jpop.@com.googlecode.gwtphonegap.client.camera.PopOverOptions::getArrowDir()();
74 +
75 + localOptions["popoverOptions"] = popOver;
76 +
77 + }
78 +
66 79 var th = options.@com.googlecode.gwtphonegap.client.camera.PictureOptions::getTargetHeightInPx()();
67 80 if (th != -1) {
68 81 localOptions["targetHeight"] = th;
  @@ -75,6 +88,21 @@
75 88
76 89 $wnd.navigator.camera.getPicture($entry(successCallback),
77 90 $entry(errorCallback), localOptions);
78 - }-*/;
91 + }-*/;
92 +
93 + @Override
94 + public native void cleanUp(CameraCallback callback) /*-{
95 +
96 + var win = function() {
97 + callback.@com.googlecode.gwtphonegap.client.camera.CameraCallback::onSuccess()();
98 + };
99 +
100 + var fail = function(message) {
101 + callback.@com.googlecode.gwtphonegap.client.camera.CameraCallback::onError(Ljava/lang/String;)(message);
102 + };
103 +
104 + $wnd.navigator.camera.cleanup($entry(win), $entry(fail));
105 +
106 + }-*/;
79 107
80 108 }