litesoft
@ 906
litesoft / trunk / mobileGWT / gwt-phonegap / src / main / java / com / googlecode / gwtphonegap / client / PhoneGap.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
/* * Copyright 2010 Daniel Kurka * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package com.googlecode.gwtphonegap.client; import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.HandlerRegistration; import com.googlecode.gwtphonegap.client.accelerometer.Accelerometer; import com.googlecode.gwtphonegap.client.camera.Camera; import com.googlecode.gwtphonegap.client.capture.Capture; import com.googlecode.gwtphonegap.client.compass.Compass; import com.googlecode.gwtphonegap.client.connection.Connection; import com.googlecode.gwtphonegap.client.contacts.Contacts; import com.googlecode.gwtphonegap.client.device.Device; import com.googlecode.gwtphonegap.client.event.Event; import com.googlecode.gwtphonegap.client.file.File; import com.googlecode.gwtphonegap.client.geolocation.Geolocation; import com.googlecode.gwtphonegap.client.globalization.Globalization; import com.googlecode.gwtphonegap.client.inappbrowser.InAppBrowser; import com.googlecode.gwtphonegap.client.log.PhoneGapLog; import com.googlecode.gwtphonegap.client.media.MediaModule; import com.googlecode.gwtphonegap.client.notification.Notification; import com.googlecode.gwtphonegap.client.plugins.PhoneGapPlugin; import com.googlecode.gwtphonegap.client.splashscreen.SplashScreen; /** * This class is a wrapper class for phonegap.js * * The implementation is based on {@link http://docs.phonegap.com/} * * Available modules are: * <ul> * <li>Accelerometer</li> * <li>Camera</li> * <li>Capture</li> * <li>Compass</li> * <li>Conntection</li> * <li>Contacts</li> * <li>Device</li> * <li>Events</li> * <li>File</li> * <li>Geolocation</li> * <li>InAppBrowser</li> * <li>Media</li> * <li>Log</li> * <li>Notification</li> * </ul> * * * * @author Daniel Kurka * */ public interface PhoneGap { /** * Determine if phonegap is initialized * * @return true if phonegap is initialized */ public boolean isPhoneGapInitialized(); /** * Initializes Phonegap with a default timeout see: * {@link PhoneGapStandardImpl#initializePhoneGap(int)} */ public void initializePhoneGap(); /** * initialize Phonegap * * If Phonegap is initialized successfully within timeout a {@link PhoneGapAvaibleEvent} is fired, * else a {@link PhoneGapTimeoutEvent} is fired * * @param timeoutInMs the timeout in milliseconds */ public void initializePhoneGap(final int timeoutInMs); /** * Add a handler for {@link PhoneGapAvaibleEvent} * * @param handler the handler to add * @return the handler registration */ public HandlerRegistration addHandler(PhoneGapAvailableHandler handler); /** * Add a handler for {@link PhoneGapTimeoutEvent} * * @param handler the handler to add * @return the handler registration */ public HandlerRegistration addHandler(PhoneGapTimeoutHandler handler); /** * get the phonegap device object * * @return the device object containing device specific information */ public Device getDevice(); /** * get the phonegap accelerometer object * * @return */ public Accelerometer getAccelerometer(); /** * get the phonegap camera object * * @return */ public Camera getCamera(); /** * get the phonegap geolocation object * * @return */ public Geolocation getGeolocation(); public Connection getConnection(); /** * get the phonegap notification object * * @return */ public Notification getNotification(); public Contacts getContacts(); public PhoneGapPlugin getPluginById(String name); public void loadPlugin(String id, PhoneGapPlugin instance); public File getFile(); public Event getEvent(); // testing for android.... public boolean exitApp(); public MediaModule getMedia(); public Compass getCompass(); public Capture getCapture(); public PhoneGapLog getLog(); public InAppBrowser getInAppBrowser(); public boolean isPhoneGapDevice(); /** * Allows to replace the default handlerManager used in PhoneGap by your own one so as you can * share it in your application. * * You should change it before adding any handler to PhoneGap. * * @param handlerManager your EventBus instance */ public void setEventBus(EventBus handlerManager); /** * Get the application splash-screen object. */ SplashScreen getSplashScreen(); public Globalization getGlobalization(); } |