|
@@ -1,22 +1,21 @@ |
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; |
17 |
15 |
|
|
18 |
16 |
|
import com.google.web.bindery.event.shared.EventBus; |
19 |
17 |
|
import com.google.web.bindery.event.shared.HandlerRegistration; |
|
18 |
+ |
|
20 |
19 |
|
import com.googlecode.gwtphonegap.client.accelerometer.Accelerometer; |
21 |
20 |
|
import com.googlecode.gwtphonegap.client.camera.Camera; |
22 |
21 |
|
import com.googlecode.gwtphonegap.client.capture.Capture; |
|
@@ -27,6 +26,8 @@ |
27 |
26 |
|
import com.googlecode.gwtphonegap.client.event.Event; |
28 |
27 |
|
import com.googlecode.gwtphonegap.client.file.File; |
29 |
28 |
|
import com.googlecode.gwtphonegap.client.geolocation.Geolocation; |
|
29 |
+ |
import com.googlecode.gwtphonegap.client.globalization.Globalization; |
|
30 |
+ |
import com.googlecode.gwtphonegap.client.inappbrowser.InAppBrowser; |
30 |
31 |
|
import com.googlecode.gwtphonegap.client.log.PhoneGapLog; |
31 |
32 |
|
import com.googlecode.gwtphonegap.client.media.MediaModule; |
32 |
33 |
|
import com.googlecode.gwtphonegap.client.notification.Notification; |
|
@@ -50,6 +51,7 @@ |
50 |
51 |
|
* <li>Events</li> |
51 |
52 |
|
* <li>File</li> |
52 |
53 |
|
* <li>Geolocation</li> |
|
54 |
+ |
* <li>InAppBrowser</li> |
53 |
55 |
|
* <li>Media</li> |
54 |
56 |
|
* <li>Log</li> |
55 |
57 |
|
* <li>Notification</li> |
|
@@ -62,119 +64,122 @@ |
62 |
64 |
|
*/ |
63 |
65 |
|
public interface PhoneGap { |
64 |
66 |
|
|
65 |
|
- |
/** |
66 |
|
- |
* Determine if phonegap is initialized |
67 |
|
- |
* |
68 |
|
- |
* @return true if phonegap is initialized |
69 |
|
- |
*/ |
70 |
|
- |
public boolean isPhoneGapInitialized(); |
71 |
|
- |
|
72 |
|
- |
/** |
73 |
|
- |
* Initializes Phonegap with a default timeout see: |
74 |
|
- |
* {@link PhoneGapStandardImpl#initializePhoneGap(int)} |
75 |
|
- |
*/ |
76 |
|
- |
public void initializePhoneGap(); |
77 |
|
- |
|
78 |
|
- |
/** |
79 |
|
- |
* initialize Phonegap |
80 |
|
- |
* |
81 |
|
- |
* If Phonegap is initialized successfully within timeout a |
82 |
|
- |
* {@link PhoneGapAvaibleEvent} is fired, else a |
83 |
|
- |
* {@link PhoneGapTimeoutEvent} is fired |
84 |
|
- |
* |
85 |
|
- |
* @param timeoutInMs the timeout in milliseconds |
86 |
|
- |
*/ |
87 |
|
- |
public void initializePhoneGap(final int timeoutInMs); |
88 |
|
- |
|
89 |
|
- |
/** |
90 |
|
- |
* Add a handler for {@link PhoneGapAvaibleEvent} |
91 |
|
- |
* |
92 |
|
- |
* @param handler the handler to add |
93 |
|
- |
* @return the handler registration |
94 |
|
- |
*/ |
95 |
|
- |
public HandlerRegistration addHandler(PhoneGapAvailableHandler handler); |
96 |
|
- |
|
97 |
|
- |
/** |
98 |
|
- |
* Add a handler for {@link PhoneGapTimeoutEvent} |
99 |
|
- |
* |
100 |
|
- |
* @param handler the handler to add |
101 |
|
- |
* @return the handler registration |
102 |
|
- |
*/ |
103 |
|
- |
public HandlerRegistration addHandler(PhoneGapTimeoutHandler handler); |
104 |
|
- |
|
105 |
|
- |
/** |
106 |
|
- |
* get the phonegap device object |
107 |
|
- |
* |
108 |
|
- |
* @return the device object containing device specific information |
109 |
|
- |
*/ |
110 |
|
- |
public Device getDevice(); |
111 |
|
- |
|
112 |
|
- |
/** |
113 |
|
- |
* get the phonegap accelerometer object |
114 |
|
- |
* |
115 |
|
- |
* @return |
116 |
|
- |
*/ |
117 |
|
- |
public Accelerometer getAccelerometer(); |
118 |
|
- |
|
119 |
|
- |
/** |
120 |
|
- |
* get the phonegap camera object |
121 |
|
- |
* |
122 |
|
- |
* @return |
123 |
|
- |
*/ |
124 |
|
- |
public Camera getCamera(); |
125 |
|
- |
|
126 |
|
- |
/** |
127 |
|
- |
* get the phonegap geolocation object |
128 |
|
- |
* |
129 |
|
- |
* @return |
130 |
|
- |
*/ |
131 |
|
- |
public Geolocation getGeolocation(); |
132 |
|
- |
|
133 |
|
- |
public Connection getConnection(); |
134 |
|
- |
|
135 |
|
- |
/** |
136 |
|
- |
* get the phonegap notification object |
137 |
|
- |
* |
138 |
|
- |
* @return |
139 |
|
- |
*/ |
140 |
|
- |
public Notification getNotification(); |
141 |
|
- |
|
142 |
|
- |
public Contacts getContacts(); |
143 |
|
- |
|
144 |
|
- |
public PhoneGapPlugin getPluginById(String name); |
145 |
|
- |
|
146 |
|
- |
public void loadPlugin(String id, PhoneGapPlugin instance); |
147 |
|
- |
|
148 |
|
- |
public File getFile(); |
149 |
|
- |
|
150 |
|
- |
public Event getEvent(); |
151 |
|
- |
|
152 |
|
- |
// testing for android.... |
153 |
|
- |
public boolean exitApp(); |
154 |
|
- |
|
155 |
|
- |
public MediaModule getMedia(); |
156 |
|
- |
|
157 |
|
- |
public Compass getCompass(); |
158 |
|
- |
|
159 |
|
- |
public Capture getCapture(); |
160 |
|
- |
|
161 |
|
- |
public PhoneGapLog getLog(); |
162 |
|
- |
|
163 |
|
- |
public boolean isPhoneGapDevice(); |
164 |
|
- |
|
165 |
|
- |
/** |
166 |
|
- |
* Allows to replace the default handlerManager used in PhoneGap |
167 |
|
- |
* by your own one so as you can share it in your application. |
168 |
|
- |
* |
169 |
|
- |
* You should change it before adding any handler to PhoneGap. |
170 |
|
- |
* |
171 |
|
- |
* @param handlerManager your EventBus instance |
172 |
|
- |
*/ |
173 |
|
- |
public void setEventBus(EventBus handlerManager); |
174 |
|
- |
|
175 |
|
- |
/** |
176 |
|
- |
* Get the application splash-screen object. |
177 |
|
- |
*/ |
|
67 |
+ |
/** |
|
68 |
+ |
* Determine if phonegap is initialized |
|
69 |
+ |
* |
|
70 |
+ |
* @return true if phonegap is initialized |
|
71 |
+ |
*/ |
|
72 |
+ |
public boolean isPhoneGapInitialized(); |
|
73 |
+ |
|
|
74 |
+ |
/** |
|
75 |
+ |
* Initializes Phonegap with a default timeout see: |
|
76 |
+ |
* {@link PhoneGapStandardImpl#initializePhoneGap(int)} |
|
77 |
+ |
*/ |
|
78 |
+ |
public void initializePhoneGap(); |
|
79 |
+ |
|
|
80 |
+ |
/** |
|
81 |
+ |
* initialize Phonegap |
|
82 |
+ |
* |
|
83 |
+ |
* If Phonegap is initialized successfully within timeout a {@link PhoneGapAvaibleEvent} is fired, |
|
84 |
+ |
* else a {@link PhoneGapTimeoutEvent} is fired |
|
85 |
+ |
* |
|
86 |
+ |
* @param timeoutInMs the timeout in milliseconds |
|
87 |
+ |
*/ |
|
88 |
+ |
public void initializePhoneGap(final int timeoutInMs); |
|
89 |
+ |
|
|
90 |
+ |
/** |
|
91 |
+ |
* Add a handler for {@link PhoneGapAvaibleEvent} |
|
92 |
+ |
* |
|
93 |
+ |
* @param handler the handler to add |
|
94 |
+ |
* @return the handler registration |
|
95 |
+ |
*/ |
|
96 |
+ |
public HandlerRegistration addHandler(PhoneGapAvailableHandler handler); |
|
97 |
+ |
|
|
98 |
+ |
/** |
|
99 |
+ |
* Add a handler for {@link PhoneGapTimeoutEvent} |
|
100 |
+ |
* |
|
101 |
+ |
* @param handler the handler to add |
|
102 |
+ |
* @return the handler registration |
|
103 |
+ |
*/ |
|
104 |
+ |
public HandlerRegistration addHandler(PhoneGapTimeoutHandler handler); |
|
105 |
+ |
|
|
106 |
+ |
/** |
|
107 |
+ |
* get the phonegap device object |
|
108 |
+ |
* |
|
109 |
+ |
* @return the device object containing device specific information |
|
110 |
+ |
*/ |
|
111 |
+ |
public Device getDevice(); |
|
112 |
+ |
|
|
113 |
+ |
/** |
|
114 |
+ |
* get the phonegap accelerometer object |
|
115 |
+ |
* |
|
116 |
+ |
* @return |
|
117 |
+ |
*/ |
|
118 |
+ |
public Accelerometer getAccelerometer(); |
|
119 |
+ |
|
|
120 |
+ |
/** |
|
121 |
+ |
* get the phonegap camera object |
|
122 |
+ |
* |
|
123 |
+ |
* @return |
|
124 |
+ |
*/ |
|
125 |
+ |
public Camera getCamera(); |
|
126 |
+ |
|
|
127 |
+ |
/** |
|
128 |
+ |
* get the phonegap geolocation object |
|
129 |
+ |
* |
|
130 |
+ |
* @return |
|
131 |
+ |
*/ |
|
132 |
+ |
public Geolocation getGeolocation(); |
|
133 |
+ |
|
|
134 |
+ |
public Connection getConnection(); |
|
135 |
+ |
|
|
136 |
+ |
/** |
|
137 |
+ |
* get the phonegap notification object |
|
138 |
+ |
* |
|
139 |
+ |
* @return |
|
140 |
+ |
*/ |
|
141 |
+ |
public Notification getNotification(); |
|
142 |
+ |
|
|
143 |
+ |
public Contacts getContacts(); |
|
144 |
+ |
|
|
145 |
+ |
public PhoneGapPlugin getPluginById(String name); |
|
146 |
+ |
|
|
147 |
+ |
public void loadPlugin(String id, PhoneGapPlugin instance); |
|
148 |
+ |
|
|
149 |
+ |
public File getFile(); |
|
150 |
+ |
|
|
151 |
+ |
public Event getEvent(); |
|
152 |
+ |
|
|
153 |
+ |
// testing for android.... |
|
154 |
+ |
public boolean exitApp(); |
|
155 |
+ |
|
|
156 |
+ |
public MediaModule getMedia(); |
|
157 |
+ |
|
|
158 |
+ |
public Compass getCompass(); |
|
159 |
+ |
|
|
160 |
+ |
public Capture getCapture(); |
|
161 |
+ |
|
|
162 |
+ |
public PhoneGapLog getLog(); |
|
163 |
+ |
|
|
164 |
+ |
public InAppBrowser getInAppBrowser(); |
|
165 |
+ |
|
|
166 |
+ |
public boolean isPhoneGapDevice(); |
|
167 |
+ |
|
|
168 |
+ |
/** |
|
169 |
+ |
* Allows to replace the default handlerManager used in PhoneGap by your own one so as you can |
|
170 |
+ |
* share it in your application. |
|
171 |
+ |
* |
|
172 |
+ |
* You should change it before adding any handler to PhoneGap. |
|
173 |
+ |
* |
|
174 |
+ |
* @param handlerManager your EventBus instance |
|
175 |
+ |
*/ |
|
176 |
+ |
public void setEventBus(EventBus handlerManager); |
|
177 |
+ |
|
|
178 |
+ |
/** |
|
179 |
+ |
* Get the application splash-screen object. |
|
180 |
+ |
*/ |
178 |
181 |
|
SplashScreen getSplashScreen(); |
179 |
182 |
|
|
|
183 |
+ |
public Globalization getGlobalization(); |
|
184 |
+ |
|
180 |
185 |
|
} |