|
@@ -1,151 +1,159 @@ |
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 PictureOptions { |
19 |
17 |
|
|
20 |
|
- |
public static final int DESTINATION_TYPE_DATA_URL = 0; |
21 |
|
- |
public static final int DESTINATION_TYPE_FILE_URI = 1; |
|
18 |
+ |
public static final int DESTINATION_TYPE_DATA_URL = 0; |
|
19 |
+ |
public static final int DESTINATION_TYPE_FILE_URI = 1; |
22 |
20 |
|
|
23 |
|
- |
public static final int PICTURE_SOURCE_TYPE_PHOTO_LIBRARY = 0; |
24 |
|
- |
public static final int PICTURE_SOURCE_TYPE_CAMERA = 1; |
25 |
|
- |
public static final int PICTURE_SOURCE_TYPE_SAVED_PHOTO_ALBUM = 2; |
|
21 |
+ |
public static final int PICTURE_SOURCE_TYPE_PHOTO_LIBRARY = 0; |
|
22 |
+ |
public static final int PICTURE_SOURCE_TYPE_CAMERA = 1; |
|
23 |
+ |
public static final int PICTURE_SOURCE_TYPE_SAVED_PHOTO_ALBUM = 2; |
26 |
24 |
|
|
27 |
|
- |
public static final int CAMERA_ENCODING_TYPE_JPEG = 0; |
28 |
|
- |
public static final int CAMERA_ENCODING_TYPE_PNG = 1; |
|
25 |
+ |
public static final int CAMERA_ENCODING_TYPE_JPEG = 0; |
|
26 |
+ |
public static final int CAMERA_ENCODING_TYPE_PNG = 1; |
29 |
27 |
|
|
30 |
|
- |
public static final int CAMERA_MEDIA_TYPE_PICTURE = 0; |
31 |
|
- |
public static final int CAMERA_MEDIA_TYPE_VIDEO = 1; |
32 |
|
- |
public static final int CAMERA_MEDIA_TYPE_ALL = 2; |
|
28 |
+ |
public static final int CAMERA_MEDIA_TYPE_PICTURE = 0; |
|
29 |
+ |
public static final int CAMERA_MEDIA_TYPE_VIDEO = 1; |
|
30 |
+ |
public static final int CAMERA_MEDIA_TYPE_ALL = 2; |
33 |
31 |
|
|
34 |
|
- |
private int quality; |
|
32 |
+ |
private int quality; |
35 |
33 |
|
|
36 |
|
- |
private int destinationType; |
37 |
|
- |
private int sourceType; |
38 |
|
- |
private int encoding; |
|
34 |
+ |
private int destinationType; |
|
35 |
+ |
private int sourceType; |
|
36 |
+ |
private int encoding; |
39 |
37 |
|
|
40 |
|
- |
private int targetHeightInPx; |
41 |
|
- |
private int targetWidthInPx; |
42 |
|
- |
private int mediaType; |
|
38 |
+ |
private int targetHeightInPx; |
|
39 |
+ |
private int targetWidthInPx; |
|
40 |
+ |
private int mediaType; |
43 |
41 |
|
|
44 |
|
- |
private boolean allowEdit; |
45 |
|
- |
private boolean saveToPhotoAlbum; |
46 |
|
- |
private boolean correctorientation; |
|
42 |
+ |
private boolean allowEdit; |
|
43 |
+ |
private boolean saveToPhotoAlbum; |
|
44 |
+ |
private boolean correctorientation; |
47 |
45 |
|
|
48 |
|
- |
public PictureOptions() { |
49 |
|
- |
quality = 75; |
50 |
|
- |
destinationType = DESTINATION_TYPE_DATA_URL; |
51 |
|
- |
sourceType = PICTURE_SOURCE_TYPE_CAMERA; |
52 |
|
- |
encoding = CAMERA_ENCODING_TYPE_JPEG; |
|
46 |
+ |
private PopOverOptions popOverOptions; |
53 |
47 |
|
|
54 |
|
- |
// no sizing by default... |
55 |
|
- |
targetHeightInPx = -1; |
56 |
|
- |
targetWidthInPx = -1; |
|
48 |
+ |
public PictureOptions() { |
|
49 |
+ |
quality = 75; |
|
50 |
+ |
destinationType = DESTINATION_TYPE_DATA_URL; |
|
51 |
+ |
sourceType = PICTURE_SOURCE_TYPE_CAMERA; |
|
52 |
+ |
encoding = CAMERA_ENCODING_TYPE_JPEG; |
57 |
53 |
|
|
58 |
|
- |
mediaType = CAMERA_MEDIA_TYPE_PICTURE; |
|
54 |
+ |
// no sizing by default... |
|
55 |
+ |
targetHeightInPx = -1; |
|
56 |
+ |
targetWidthInPx = -1; |
59 |
57 |
|
|
60 |
|
- |
allowEdit = true; |
|
58 |
+ |
mediaType = CAMERA_MEDIA_TYPE_PICTURE; |
61 |
59 |
|
|
62 |
|
- |
correctorientation = false; |
63 |
|
- |
saveToPhotoAlbum = false; |
64 |
|
- |
} |
|
60 |
+ |
allowEdit = true; |
65 |
61 |
|
|
66 |
|
- |
public PictureOptions(int quality) { |
67 |
|
- |
this(); |
68 |
|
- |
this.quality = quality; |
69 |
|
- |
} |
|
62 |
+ |
correctorientation = false; |
|
63 |
+ |
saveToPhotoAlbum = false; |
|
64 |
+ |
} |
70 |
65 |
|
|
71 |
|
- |
public int getQuality() { |
72 |
|
- |
return quality; |
73 |
|
- |
} |
|
66 |
+ |
public PictureOptions(int quality) { |
|
67 |
+ |
this(); |
|
68 |
+ |
this.quality = quality; |
|
69 |
+ |
} |
74 |
70 |
|
|
75 |
|
- |
public void setQuality(int quality) { |
76 |
|
- |
this.quality = quality; |
77 |
|
- |
} |
|
71 |
+ |
public int getQuality() { |
|
72 |
+ |
return quality; |
|
73 |
+ |
} |
78 |
74 |
|
|
79 |
|
- |
public int getSourceType() { |
80 |
|
- |
return sourceType; |
81 |
|
- |
} |
|
75 |
+ |
public void setQuality(int quality) { |
|
76 |
+ |
this.quality = quality; |
|
77 |
+ |
} |
82 |
78 |
|
|
83 |
|
- |
public int getDestinationType() { |
84 |
|
- |
return destinationType; |
85 |
|
- |
} |
|
79 |
+ |
public int getSourceType() { |
|
80 |
+ |
return sourceType; |
|
81 |
+ |
} |
86 |
82 |
|
|
87 |
|
- |
public void setDestinationType(int destinationType) { |
88 |
|
- |
this.destinationType = destinationType; |
89 |
|
- |
} |
|
83 |
+ |
public int getDestinationType() { |
|
84 |
+ |
return destinationType; |
|
85 |
+ |
} |
90 |
86 |
|
|
91 |
|
- |
public void setSourceType(int sourceType) { |
92 |
|
- |
this.sourceType = sourceType; |
93 |
|
- |
} |
|
87 |
+ |
public void setDestinationType(int destinationType) { |
|
88 |
+ |
this.destinationType = destinationType; |
|
89 |
+ |
} |
94 |
90 |
|
|
95 |
|
- |
public int getEncoding() { |
96 |
|
- |
return encoding; |
97 |
|
- |
} |
|
91 |
+ |
public void setSourceType(int sourceType) { |
|
92 |
+ |
this.sourceType = sourceType; |
|
93 |
+ |
} |
98 |
94 |
|
|
99 |
|
- |
public void setEncoding(int encoding) { |
100 |
|
- |
this.encoding = encoding; |
101 |
|
- |
} |
|
95 |
+ |
public int getEncoding() { |
|
96 |
+ |
return encoding; |
|
97 |
+ |
} |
102 |
98 |
|
|
103 |
|
- |
public void setTargetHeightInPx(int targetHeightInPx) { |
104 |
|
- |
this.targetHeightInPx = targetHeightInPx; |
105 |
|
- |
} |
|
99 |
+ |
public void setEncoding(int encoding) { |
|
100 |
+ |
this.encoding = encoding; |
|
101 |
+ |
} |
106 |
102 |
|
|
107 |
|
- |
public int getTargetHeightInPx() { |
108 |
|
- |
return targetHeightInPx; |
109 |
|
- |
} |
|
103 |
+ |
public void setTargetHeightInPx(int targetHeightInPx) { |
|
104 |
+ |
this.targetHeightInPx = targetHeightInPx; |
|
105 |
+ |
} |
110 |
106 |
|
|
111 |
|
- |
public int getTargetWidthInPx() { |
112 |
|
- |
return targetWidthInPx; |
113 |
|
- |
} |
|
107 |
+ |
public int getTargetHeightInPx() { |
|
108 |
+ |
return targetHeightInPx; |
|
109 |
+ |
} |
114 |
110 |
|
|
115 |
|
- |
public void setTargetWidthInPx(int targetWidthInPx) { |
116 |
|
- |
this.targetWidthInPx = targetWidthInPx; |
117 |
|
- |
} |
|
111 |
+ |
public int getTargetWidthInPx() { |
|
112 |
+ |
return targetWidthInPx; |
|
113 |
+ |
} |
118 |
114 |
|
|
119 |
|
- |
public void setMediaType(int mediaType) { |
120 |
|
- |
this.mediaType = mediaType; |
121 |
|
- |
} |
|
115 |
+ |
public void setTargetWidthInPx(int targetWidthInPx) { |
|
116 |
+ |
this.targetWidthInPx = targetWidthInPx; |
|
117 |
+ |
} |
122 |
118 |
|
|
123 |
|
- |
public int getMediaType() { |
124 |
|
- |
return mediaType; |
125 |
|
- |
} |
|
119 |
+ |
public void setMediaType(int mediaType) { |
|
120 |
+ |
this.mediaType = mediaType; |
|
121 |
+ |
} |
126 |
122 |
|
|
127 |
|
- |
public void setAllowEdit(boolean allowEdit) { |
128 |
|
- |
this.allowEdit = allowEdit; |
129 |
|
- |
} |
|
123 |
+ |
public int getMediaType() { |
|
124 |
+ |
return mediaType; |
|
125 |
+ |
} |
130 |
126 |
|
|
131 |
|
- |
public boolean isAllowEdit() { |
132 |
|
- |
return allowEdit; |
133 |
|
- |
} |
|
127 |
+ |
public void setAllowEdit(boolean allowEdit) { |
|
128 |
+ |
this.allowEdit = allowEdit; |
|
129 |
+ |
} |
134 |
130 |
|
|
135 |
|
- |
public void setCorrectOrientation(boolean correctorientation) { |
136 |
|
- |
this.correctorientation = correctorientation; |
137 |
|
- |
} |
|
131 |
+ |
public boolean isAllowEdit() { |
|
132 |
+ |
return allowEdit; |
|
133 |
+ |
} |
138 |
134 |
|
|
139 |
|
- |
public boolean isCorrectorientation() { |
140 |
|
- |
return correctorientation; |
141 |
|
- |
} |
|
135 |
+ |
public void setCorrectOrientation(boolean correctorientation) { |
|
136 |
+ |
this.correctorientation = correctorientation; |
|
137 |
+ |
} |
142 |
138 |
|
|
143 |
|
- |
public void setSaveToPhotoAlbum(boolean saveToPhotoAlbum) { |
144 |
|
- |
this.saveToPhotoAlbum = saveToPhotoAlbum; |
145 |
|
- |
} |
|
139 |
+ |
public boolean isCorrectorientation() { |
|
140 |
+ |
return correctorientation; |
|
141 |
+ |
} |
146 |
142 |
|
|
147 |
|
- |
public boolean isSaveToPhotoAlbum() { |
148 |
|
- |
return saveToPhotoAlbum; |
149 |
|
- |
} |
|
143 |
+ |
public void setSaveToPhotoAlbum(boolean saveToPhotoAlbum) { |
|
144 |
+ |
this.saveToPhotoAlbum = saveToPhotoAlbum; |
|
145 |
+ |
} |
|
146 |
+ |
|
|
147 |
+ |
public boolean isSaveToPhotoAlbum() { |
|
148 |
+ |
return saveToPhotoAlbum; |
|
149 |
+ |
} |
|
150 |
+ |
|
|
151 |
+ |
public void setPopOverOptions(PopOverOptions popOverOptions) { |
|
152 |
+ |
this.popOverOptions = popOverOptions; |
|
153 |
+ |
} |
|
154 |
+ |
|
|
155 |
+ |
public PopOverOptions getPopOverOptions() { |
|
156 |
+ |
return popOverOptions; |
|
157 |
+ |
} |
150 |
158 |
|
|
151 |
159 |
|
} |