Class CodenameOneImplementation
Represents a vendor extension mechanizm for Codename One, WARNING: this class is for internal use only and is subject to change in future API revisions. To replace the way in which Codename One performs its task this class can be extended and its functionality replaced or enhanced.
It is the responsibility of the implementation class to grab and fire all events to the Display specifically for key, pointer events and screen resolution.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCompletionHandler(Media media, Runnable onCompletion) Adds a callback to a Media element that will be called when the media finishes playing.voidThis method is called by the NetworkManager when a request is added to the queue.voidAdds/replaces a cookie to be sent to the given domainvoidvoidaddHeavyActionListener(Object peer, ActionListener l) Adds an action listener which will be run in response to the native button's click event.voidAdds a load listener to a native browser window.voidCalled after internal paint of component finishesbooleananimateImage(Object nativeImage, long lastFrame) Callback to allow images animated by the underlying system to change their state e.g.voidannounceForAccessibility(Component cmp, String text) Manually announces text to native accessibility services, associating the announcement with a specific component when possible.booleanOn most platforms it is quite fast to draw on a mutable image and then render that image, however some platforms have much slower mutable images in comparison to just drawing on the screen.voidCalled before internal paint of component startsvoidblockCopyPaste(boolean blockCopyPaste) Blocks or enables copy and paste in the entire app.voidbrowserBack(PeerComponent browserPeer) Navigates back in the historyvoidbrowserClearHistory(PeerComponent browserPeer) Clears navigation historyvoidbrowserDestroy(PeerComponent internal) Release browser native resourcesvoidbrowserExecute(PeerComponent browserPeer, String javaScript) Executes the given JavaScript string within the current contextbrowserExecuteAndReturnString(PeerComponent internal, String javaScript) Executes javascript and returns string.voidbrowserExposeInJavaScript(PeerComponent browserPeer, Object o, String name) Allows exposing the given object to JavaScript code so the JavaScript code can invoke methods and access fields on the given object.voidbrowserForward(PeerComponent browserPeer) Navigates forward in the historybooleanbrowserHasBack(PeerComponent browserPeer) Indicates whether back is currently availablebooleanbrowserHasForward(PeerComponent browserPeer) Indicates whether forward is currently availablevoidbrowserReload(PeerComponent browserPeer) Reload the current pagevoidbrowserStop(PeerComponent browserPeer) Stops loading the current pageprotected booleanIndicates whether the implementation is interested in caching linear gradients for drawing.protected booleanIndicates whether the implementation is interested in caching radial gradients for drawing.voidcancelLocalNotification(String notificationId) voidcancelRepaint(Animation cmp) Removes an entry from the paint queue if it exists, this is important for cases in which a component was repainted and immediately removed from its parent container afterwards.booleancanDial()Returns true if the device has dialing capabilitiescanExecute(String url) Returns true if executing this URL should work, returns false if it will not and null if this is unknown.booleanReturns true if the device allows forcing the orientation via code, feature phones do not allow this although some include a jad property allowing for this featurebooleanChecks if the platform supports getting SSL certificates.booleanChecks to see if you can prompt the user to install the app on their homescreen.voidcaptureAudio(MediaRecorderBuilder recordingOptions, ActionListener<ActionEvent> response) Captures a audio and notifies with the raw data when availablevoidcaptureAudio(ActionListener<ActionEvent> response) captureBrowserScreenshot(PeerComponent browserPeer) Captures a screenshot from a browser component asynchronously.voidcapturePhoto(ActionListener response) Captures a photo and notifies with the image data when availableCaptures a screenshot of the screen.voidcaptureVideo(VideoCaptureConstraints constraints, ActionListener response) Captures a video, and notifies with the data when available.voidcaptureVideo(ActionListener response) Captures a video and notifies with the data when availableabstract intcharsWidth(Object nativeFont, char[] ch, int offset, int length) Return the width of the given characters in the given native font instanceabstract intReturn the width of the specific character when rendered alonebooleanSSL certificate checks must be performed via a callback from the native side, rather than explicitly checking as part of NetworkManager's connection flow.voidCloses the object (connection, stream etc.) without throwing any exception, even if the object is nullvoidvoidvoidDeletes all the files in the application storageabstract voidChanges the current clipping rectangle to subset the current clipping with the given clipping.voidChanges the current clipping rectangle to subset the current clipping with the given clipping.voidAllows binding logic to occur before closing the output stream such as syncingvoidIndicates to the port that the component was removed from the view and its UI should be removed in the next flush operation.final intconcatenateAlpha(Object graphics, int alpha) Concatenates alpha value to current alpha.voidconcatenateTransform(Object t1, Object t2) Concatenates two transforms and sets the first transform to be the result of the concatenation.voidCallback method allowing the implementation to confirm that it controls the view just before a new form is installed.abstract ObjectConnects to a given URL, returns a connection object to be used with the implementation laterConnects to a given URL, returns a connection object to be used with the implementation laterconnectSocket(String host, int port) Creates a socket to connect to the given host on the given portconnectSocket(String host, int port, int connectTimeout) Creates a socket to connect to the given host on the given portConverts the given string from logical bidi layout to visual bidi layout so it can be rendered properly on the screen.protected ObjectConverts a sound object to a form which will be easy for the implementation to play later on.intconvertToPixels(int dipCount, boolean horizontal) Converts the dips count to pixels, dips are roughly 1mm in length.voidCopies the current text selection to the clipboard.voidcopyToClipboard(Object obj) Performs a clipboard copy operation, if the native clipboard is supported by the implementation it would be usedvoidcopyTransform(Object src, Object dest) Copies the setting of one transform into another.Creates an audio media that can be played in the background.Creates an audio media that can be played in the background.createBrowserComponent(Object browserComponent) If the implementation supports the creation of a browser component it should be returned in this methodcreateContact(String firstName, String surname, String officePhone, String homePhone, String cellPhone, String email) Create a contact to the device contacts bookabstract ObjectcreateFont(int face, int style, int size) Creates a new instance of a native fontcreateHeavyButton(Button aThis) Creates the native side of acom.codename1.ui.HeavyButton.abstract ObjectcreateImage(byte[] bytes, int offset, int len) Create a nativate image from its compressed byte dataabstract ObjectcreateImage(int[] rgb, int width, int height) Create a platform native image object from the given RGB datacreateImage(Shape shape, Stroke stroke, int color) abstract ObjectCreates a native image from a given input streamabstract ObjectcreateImage(String path) Creates a native image from a file in the system jar or file system storage.createMedia(InputStream stream, String mimeType, Runnable onCompletion) Plays the sound in the given streamcreateMedia(String uri, boolean isVideo, Runnable onCompletion) Plays the sound in the given URI which is partially platform specific.createMediaAsync(InputStream stream, String mimeType, Runnable onCompletion) Creates media asynchronously.createMediaAsync(String uri, boolean video, Runnable onCompletion) Creates media asynchronously.createMediaRecorder(MediaRecorderBuilder builder) Creates a Media recorder Object which will record from the device mic to a file in the given path.createMediaRecorder(String path, String mimeType) Creates a Media recorder Object which will record from the device mic to a file in the given path.abstract ObjectcreateMutableImage(int width, int height, int fillColor) Creates a modifable native image that can return a graphics objectcreateNativeBrowserWindow(String startURL) Creates a native web browser window object.createNativeIndexed(Image image) Creates a native image representing the indexed imageCreates a native overlay for the given component.createNativePeer(Object nativeComponent) Creates a peer component for the given lightweight componentprotected BrowserComponentCreates a shared javascript context.Creates a soft/weak reference to an object that allows it to be collected yet caches it.abstract InputStreamCreates an input stream to the given storage source fileabstract OutputStreamCreates an output stream to the storage with the given namecreateSVGImage(String baseURL, byte[] data) Creates an SVG Image from the given byte array data and the base URLvoidAllows subclasses to cleanup if necessaryvoidDeinitializes a heavy button.voidDeinitializes text selection.booleandeleteContact(String id) removed a contact from the device contacts bookvoidDeletes databaseabstract voiddeleteFile(String file) Deletes the specific file or empty directory.abstract voiddeleteStorageFile(String name) Deletes the given file name from the storagevoidStop receiving push notifications to this client applicationstatic voidFor use by implementations, stop receiving push notifications from the serverderiveTrueTypeFont(Object font, float size, int weight) Creates a font based on this truetype font with the given pixel, WARNING! This method will only work in the case of truetype fonts!voidOpens the device Dialer application with the given phone numbervoiddisconnectSocket(Object socket) Disconnects the current socket from the server/client on the other sidevoidRemoves the notification previously posted with the notify status bar methodvoiddisposeGraphics(Object graphics) Cleans up resources used by graphics objectvoiddownloadImageToCache(String url, SuccessCallback<Image> onSuccess, FailureCallback<Image> onFail) Downloads an image from a URL to the cache.voiddownloadImageToFileSystem(String url, String fileName, SuccessCallback<Image> onSuccess, FailureCallback<Image> onFail) Downloads an image to file system.voiddownloadImageToStorage(String url, String fileName, SuccessCallback<Image> onSuccess, FailureCallback<Image> onFail) Downloads an image to storage.abstract voidDraws a circular or elliptical arc based on the given angles and bounding boxabstract voidDraws the image so its top left coordinate corresponds to x/yvoidDraws the image so its top left coordinate corresponds to x/yvoiddrawImageArea(Object nativeGraphics, Object img, int x, int y, int imageX, int imageY, int imageWidth, int imageHeight) Draws a portion of the imagevoiddrawImageRotated(Object graphics, Object img, int x, int y, int degrees) Draws the image so its top left coordinate corresponds to x/y with a fast native rotation in a square angle which must be one of 0, 90, 180 or 270voidThis method is used by the JavaSE implementation for performance loggingvoiddrawLabelComponent(Object nativeGraphics, int cmpX, int cmpY, int cmpHeight, int cmpWidth, Style style, String text, Object icon, Object stateIcon, int preserveSpaceForState, int gap, boolean rtl, boolean isOppositeSide, int textPosition, int stringWidth, boolean isTickerRunning, int tickerShiftText, boolean endsWith3Points, int valign) Draws a label on the given graphics context, this method allows optimizing the very common drawing operation using platform native codeprotected intdrawLabelText(Object nativeGraphics, int textDecoration, boolean rtl, boolean isTickerRunning, boolean endsWith3Points, Object nativeFont, int txtW, int textSpaceW, int shiftText, String text, int x, int y, int fontHeight) Draws the text of a labelabstract voidDraws a line between the 2 X/Y coordinatesvoiddrawPolygon(Object graphics, int[] xPoints, int[] yPoints, int nPoints) Draws a closed polygon defined by arrays of x and y coordinates.abstract voidDraws a rectangle in the given coordinatesvoidDraws a rectangle in the given coordinatesabstract voiddrawRGB(Object graphics, int[] rgbData, int offset, int x, int y, int w, int h, boolean processAlpha) Draws the RGB values based on the MIDP API of a similar name.abstract voiddrawRoundRect(Object graphics, int x, int y, int width, int height, int arcWidth, int arcHeight) Draws a rounded corner rectangle in the given coordinates with the arcWidth/height matching the last two arguments respectively.voiddrawShadow(Object graphics, Object image, int x, int y, int offsetX, int offsetY, int blurRadius, int spreadRadius, int color, float opacity) Draws a drop shadow for an image onto the given graphics context.voidDraws outline of shape on the given graphics context.voiddrawString(Object nativeGraphics, Object nativeFont, String str, int x, int y, int textDecoration) Draw a string using the current font and color in the x,y coordinates.abstract voiddrawString(Object graphics, String str, int x, int y) Draw a string using the current font and color in the x,y coordinates.abstract voideditString(Component cmp, int maxSize, int constraint, String text, int initiatingKeycode) Encapsulates the editing code which is specific to the platform, some platforms would allow "in place editing" MIDP does not.final voideditStringImpl(Component cmp, int maxSize, int constraint, String text, int initiatingKeycode) Encapsulates the editing code which is specific to the platform, some platforms would allow "in place editing" MIDP does not.voidedtIdle(boolean enter) This method is a callback from the edt before the edt enters to an idle statevoidExecutes the given URL on the native platformvoidexecute(String url, ActionListener response) Executes the given URL on the native platform, this method is useful if the platform has the ability to send an event to the app when the execution has ended, currently this works only for Android platform to invoke other intents.abstract booleanIndicates whether the given file existsbooleanIndicates weather a database existsvoidexit()Exits the application...voidExits the application...booleanExit full-screen mode.Extracts the hard reference from the soft/weak reference givenabstract voidFills a circular or elliptical arc based on the given angles and bounding box.voidfillLinearGradient(Object graphics, int startColor, int endColor, int x, int y, int width, int height, boolean horizontal) Draws a linear gradient in the given coordinates with the given colors, doesn't take alpha into consideration when drawing the gradientvoidfillPolygon(Object graphics, int[] xPoints, int[] yPoints, int nPoints) Fills a closed polygon defined by arrays of x and y coordinates.voidfillRadialGradient(Object graphics, int startColor, int endColor, int x, int y, int width, int height) Draws a radial gradient in the given coordinates with the given colors, doesn't take alpha into consideration when drawing the gradient.voidfillRadialGradient(Object graphics, int startColor, int endColor, int x, int y, int width, int height, int startAngle, int arcAngle) Draws a radial gradient in the given coordinates with the given colors, doesn't take alpha into consideration when drawing the gradient.abstract voidFills the rectangle from the given position according to the width/height minus 1 pixel according to the convention in Java.voidFills a rectangle with an optionally translucent fill colorvoidfillRectRadialGradient(Object graphics, int startColor, int endColor, int x, int y, int width, int height, float relativeX, float relativeY, float relativeSize) Draws a radial gradient in the given coordinates with the given colors, doesn't take alpha into consideration when drawing the gradient.abstract voidfillRoundRect(Object graphics, int x, int y, int width, int height, int arcWidth, int arcHeight) Fills a rounded rectangle in the same way as drawRoundRectvoidFills the given shape in the specified graphics context using the graphics context's currently selected color and alpha.voidfillTriangle(Object graphics, int x1, int y1, int x2, int y2, int x3, int y3) Draws a filled triangle with the given coordinatesvoidflashBacklight(int duration) Flash the backlight of the device for the given length of timeflipImageHorizontally(Image image, boolean maintainOpacity) Flips the given image on the horizontal axisflipImageVertically(Image image, boolean maintainOpacity) Flips the given image on the vertical axisabstract voidFlush the currently painted drawing onto the screen if using a double bufferabstract voidflushGraphics(int x, int y, int width, int height) Flush the currently painted drawing onto the screen if using a double buffervoidFlush the storage cache allowing implementations that cache storage objects to storegaussianBlurImage(Image image, float radius) intReturns the display height ignoring manipulations performed by the VKBString[]getAllContacts(boolean withNumbers) Gets all contacts from the address book of the deviceContact[]getAllContacts(boolean withNumbers, boolean includesFullName, boolean includesPicture, boolean includesNumbers, boolean includesEmail, boolean includeAddress) Notice: this method might be very slow and should be invoked on a separate thread! It might have platform specific optimizations over getAllContacts followed by looping over individual contacts but that isn't guaranteed.abstract intAlpha value from 0-255 can be ignored for some operationsString[]getAPIds()Returns the ids of the access points available if supportedReturns the user displayable name for the given access pointThis will return the application home directory.Returns an image representing the application icon, or null if not supported.protected static StringReturns the key for the application comprised of the builders email coupled with the package name.intReturns the type of the access pointString[]Gets the available recording MimeTypesabstract intReturns the keycode for the back keyabstract intReturns the keycode for the backspace keygetBrowserTitle(PeerComponent browserPeer) The page titlegetBrowserURL(PeerComponent browserPeer) The page URLReturns a device specific directory designed for cache style files, or null if#hasCachesDir()is falseintgetCharLocation(String source, int index) Returns the index of the given char within the source string, the actual index isn't necessarily the same when bidi is involved See this for more on visual vs.abstract intReturns the keycode for the clear keyabstract intgetClipHeight(Object graphics) Returns the clipping coordinategetClipRect(Object graphics) Returns the internal clipping rectangle.abstract intgetClipWidth(Object graphics) Returns the clipping coordinateabstract intReturns the clipping coordinateabstract intReturns the clipping coordinateprotected GraphicsReturns a graphics object for use by the paintingReturns the native implementation of the code scanner or nullabstract intReturns the current colorintIndicates the way commands should be added to a form as one of the ocmmand constants defined in this classgetComponentScreenGraphics(Component cmp, Graphics currentContext) This method allows customizing/creating a graphics context per component which is useful for some elaborate implementations of Codename One.getContactById(String id) Get a Contact according to it's contact id.getContactById(String id, boolean includesFullName, boolean includesPicture, boolean includesNumbers, boolean includesEmail, boolean includeAddress) This method returns a Contact by the contact id and fills it's data according to the given flagsabstract intgetContentLength(Object connection) Returns the content length for this connectiongetCookiesForURL(String url) Returns the cookies for this URLReturns the id of the current access pointReturns the current form, this method is for internal use only and does not take transitions/menus into considerationgetDatabasePath(String databaseName) Returns the file path of the Database if exists and if supported on the platform.abstract ObjectReturn the global default font instance, if font is passed as null this font should be usedReturns the size of the desktop area hosting the application window when running on a desktop platform.intReturns one of the density variables appropriate for this device, notice that density doesn't always correspond to resolution and an implementation might decide to change the density based on DPI constraints.abstract intReturns the height dimension of the display controlled by this implementationgetDisplaySafeArea(Rectangle rect) This method returns a rectangle defining the "safe" area of the display, which excludes areas on the screen that are covered by notches, task bars, rounded corners, etc.abstract intReturns the width dimension of the display controlled by this implementationprotected intThis method allows subclasses to manipulate the drag started detection logic.intIndicates how many drag points are used to calculate dragging speedintIndicates what drag points are valid for the drag speed calculation.floatgetDragSpeed(float[] points, long[] dragPathTime, int dragPathOffset, int dragPathLength) This method returns the dragging speed based on the latest dragged eventsintThis method allows us to manipulate the drag started detection logic.Gets the component that is currently editing textintReturns the platform EDT thread priorityintOptional operation returning the font face for the fontlonggetFileLastModified(String file) Returns the time that the file denoted by this abstract pathname was last modified.abstract longgetFileLength(String file) Returns the length of the fileabstract charReturns the file system separator char normally '/'intgetFontAscent(Object nativeFont) Returns the ascent of the specified native font instance.intgetFontDescent(Object nativeFont) Returns the descent below the baseline that a font can span.String[]Returns a list of the platform names ordered by priority, platform names are used to choose a font based on platform.abstract intgetGameAction(int keyCode) Returns the display game action for the given keyCode if applicable to match the contrct of Codename One for the game action behaviorabstract StringgetHeaderField(String name, Object connection) Returns the HTTP response header fieldabstract String[]getHeaderFieldNames(Object connection) Returns the HTTP response header fieldabstract String[]getHeaderFields(String name, Object connection) Returns the HTTP response header fields, returns optionally more than one result or null if no field is present.abstract intReturn the total height of the fontReturns the device host or ip address if availablestatic ClassThis is a temporary workaround for an XMLVM Bug!abstract intReturns the height of a native imageReturns the image IO instance that allows scaling image files.abstract intReturns the width of a native imageReturns the native OS purchase implementation if applicable, if not this method will fallback to a cross platform purchase manager.Returns the optional desktop window size hint provided by the first form.intReturns the height of the VKB when it is open for an implementation that requires us to allow scrolling furtherintReturns the type of the input device one of: KEYBOARD_TYPE_UNKNOWN, KEYBOARD_TYPE_NUMERIC, KEYBOARD_TYPE_QWERTY, KEYBOARD_TYPE_VIRTUAL, KEYBOARD_TYPE_HALF_QWERTYabstract intgetKeyCode(int gameAction) Returns a keycode which can be sent to getGameActionfloatReturns a scale factor representing how much larger system fonts should be.String[]Gets the IDs of all contacts that are linked to the provided contact.abstract L10NManagerThis method returns the platform Location ControlReturns the MSISDN for devices that expose itabstract ObjectReturns the native graphics object on which all rendering operations occurabstract ObjectgetNativeGraphics(Object image) Returns the native graphics object on the given native image occurThis method allows a native implementation to implement a native version of a given transition that can be fasterstatic ClassThis is a temporary workaround for an XMLVM Bug!protected StringReturns the package name for the applicationReturns the current content of the clipboardabstract StringReturns a 2-3 letter code representing the platform name for the platform overrideString[]Returns the suffixes for ovr files that should be used when loading a layered resource file on this platformintGets the preferred time (in seconds) between background fetches.Returns the build hints for the simulator, this will only work in the debug environment and it's designed to allow extensions/API's to verify user settings/build hints existgetProperty(String key, String defaultValue) Returns the property from the underlying platform deployment or the default value if no deployment values are supported.static PurchaseCallbackReturns the purchase callback instanceintgetRenderingHints(Object nativeGraphics) Gets the rendering hints for this graphics contextgetResourceAsStream(Class cls, String resource) This method is essentially equivalent to cls.getResourceAsStream(String) however some platforms might define unique ways in which to load resources within the implementation.abstract intgetResponseCode(Object connection) Returns the server response code for the requestabstract StringgetResponseMessage(Object connection) Returns the server response message for the requestabstract voidExtracts RGB data from the given native image and places it in the given arrayabstract longgetRootAvailableSpace(String root) Returns the available space in the given root directoryabstract longgetRootSizeBytes(String root) Returns the size of the given root directoryintgetRootType(String root) Returns the type of the root often by guessingfinal BrowserComponentGets a reference to an application-wide shared Javascript context that can be used for running Javascript commands.intOptional operation returning the font size for system fontsintIndicates the level of SMS support in the platform as one of: SMS_NOT_SUPPORTED (for desktop, tablet etc.), SMS_SEAMLESS (no UI interaction), SMS_INTERACTIVE (with compose UI), SMS_BOTH.intgetSocketAvailableInput(Object socket) Returns whether data is available for input on the socketintgetSocketErrorCode(Object socket) Returns the pending error code on the given socketgetSocketErrorMessage(Object socket) Return the pending error message on the given socketabstract int[]getSoftkeyCode(int index) Returns the softkey keycode for the given softkey indexabstract intReturns the number of softkeys on the deviceString[]getSSLCertificates(Object connection, String url) Gets the SSL certificates for a connectiongetStackTrace(Thread parentThread, Throwable t) Returns the stack trace from the exception on the given thread.The storage data is used by some storage implementations (e.g. CDC) to place the storage object in a "proper" location matching the application name.intgetStorageEntrySize(String name) Returns the size of the entry in bytesstatic ClassThis is a temporary workaround for an XMLVM Bug!static ClassThis is a temporary workaround for an XMLVM Bug!intOptional operation returning the font style for system fontsgetSVGDocument(Object svgImage) Returns a platform specific DOM object that can be manipulated by the user to change the SVG ImagegetTransform(Object graphics) Gets the current transformation matrix.voidgetTransform(Object nativeGraphics, Transform t) Sets the given transform to the current transform in the given graphics object.intgetTranslateX(Object graphics) Returns the current x translate valueintgetTranslateY(Object graphics) Returns the current y translate valuegetUdid()Returns the UDID for devices that support itgetURLDomain(String url) Returns the domain for the given URLgetURLPath(String url) Returns the bounds of the application window when running on a desktop platform.booleanInvoked when an exception occurs on the EDT, allows the implementation to take control of the device to produce testing information.booleanReturns true if the device has a directory dedicated for "cache" filesbooleanReturns true if the device has camera false otherwise.protected booleanhasDragStarted(int[] x, int[] y) This method can be overriden by subclasses to indicate whether a drag event has started or whether the device is just sending out "noise".protected booleanhasDragStarted(int x, int y) This method can be overriden by subclasses to indicate whether a drag event has started or whether the device is just sending out "noise".booleanIndicates if the implemenetation has a native underlying themebooleanReturns true if the implementation still has elements to paint.voidhideNativeOverlay(Component cmp, Object nativeOverlay) Hides the native overlay for a component.protected voidSubclasses should invoke this method, it delegates the event to the display and into Codename One.voidIn case of scrolling we can hide the text editor unless the user starts typing again, this is only relevant for the async mode...abstract voidInvoked by the display init method allowing the implementation to "bind"protected voidSome old platforms might need this but for modern platforms the user agent should "just work".voidinitEDT()Some implementations might need to perform initializations of the EDT threadvoidinitHeavyButton(Object peer) Initializes a heavy button.voidInitializes text selection.final voidInvoked by the display init method allowing the implementation to "bind"voidinstallBuiltinSound(String soundIdentifier, InputStream data) Installs a replacement sound as the builtin sound responsible for the given sound identifier (this will override the system sound if such a sound exists).booleaninstallMessageListener(Object browserComponent) Installs a message listener to allow webpages inside a browser component to send messages to CN1 cross-domain.voidInstalls the native theme, this is only applicable if hasNativeTheme() returned true.voidInstalls a tar file from the build server into the file system storage so it can be used with respect for hierarchybooleanWorkaround for XMLVM bugbooleanWorkaround for XMLVM bugbooleanWorkaround for XMLVM bugbooleanWorkaround for XMLVM bugbooleanWorkaround for XMLVM bugbooleanWorkaround for XMLVM bugbooleanWorkaround for XMLVM bugbooleanIndicates whether the underlying implementation can draw using an affine transform hence methods such as rotate, scale and shear would workbooleanReturns true if alpha can be applied for all elements globally and efficiently otherwise alpha should be ignored.booleanIndicates whether mutable images respect alpha values when constructedbooleanChecks whether the altgraph key is currently down.booleanChecks whether the alt key is currently down.booleanisAnimation(Object nativeImage) Animations should return true to allow the native image animation to updatebooleanisAntiAliased(Object graphics) Returns anti-aliasing mode for regular rendering operationsbooleanisAntiAliasedText(Object graphics) Returns anti-aliasing mode for font rendering operationsbooleanIndicates whether the underlying implementation allows for anti-aliased fontsbooleanisAntiAliasedTextSupported(Object graphics) booleanIndicates whether the underlying implementation allows for anti-aliasing in regular drawing operationsbooleanisAntiAliasingSupported(Object graphics) booleanIndicates whether looking up an access point is supported by this devicebooleanReturns true if edit string will return immediately and broadcast editing events directly to the text fieldbooleanChecks to see if the current platform supports background fetch.booleanReturns true if the underlying OS supports numeric badges on icons.booleanChecks whether the implementation supports drawing text on the baseline.booleanIndicates whether Codename One should consider the bidi RTL algorithm when drawing text or navigating with the text field cursor.booleanisBuiltinSoundAvailable(String soundIdentifier) Indicates whether a user installed or system sound is availablebooleanAllows muting/unmuting the builtin sounds easilybooleanIndicates whether this platform can attempt to detect when an active phone call is interrupting the app.booleanIndicates whether the device has a double layer screen thus allowing two stages to touch events: click and hover.booleanSome platforms allow the user to block contacts access on a per application basis (specifically iOS).booleanChecks whether the control key is currently down.Returns true if the platform is in dark mode, null is returned for unknown statusbooleanChecks if this platform supports custom database paths.booleanReturns true if this is a desktop applicationabstract booleanisDirectory(String file) Indicates whether the given file is a directorybooleanChecks to see if drawing shadows on this platform is hardware accelerated.booleanChecks to see if drawing shadows is supported on this platform.booleanReturns true if we are currently editing a componentbooleanReturns true if we are currently editing this componentbooleanChecks if the platform supports full-screen mode.booleanisGalleryTypeSupported(int type) Checks if the given gallery type is supported on this platform.booleanbooleanIndicates if the getAllContacts is platform optimized, notice that the method might still take seconds or more to run so you should still use a separate thread!abstract booleanIndicates the hidden state of the filebooleanisInCall()Best-effort check for whether the platform believes a phone call is active.booleanChecks to see if the app is currently running in full-screen mode.booleanReturns true if the implementation is initialized.booleanReturns true if this device is jailbroken or rooted, false if not or unknown.booleanReturns true if the user has selected larger type fonts in the system settings.protected booleanisLogged()Indicates whether logging is turned onbooleanIndicates whether loading a font by a string is supported by the platformbooleanChecks whether the meta key is currently down.booleanIndicates whether an application is minimizedbooleanIndicates whether the device supports multi-touch events, this is only relevant when touch events are supportedbooleanAn implementation can return true if it supports embedding a native browser widgetbooleanChecks if this platform supports sharing cookies between Native components (e.g. BrowserComponent) and ConnectionRequests.booleanChecks whether the native text editor is currently visible over top of the given component (usually aTextAreabooleanIndicates whether the implementation supports loading a font "natively" to handle one of the common native prefixesbooleanReturns true if indexed images should be used nativelybooleanIndicates whether the device should switch to native input immediately on first touchbooleanIndicates whether the device supports native in place editing in which case lightweight input logic shouldn't be used for input.booleanisNativePickerTypeSupported(int pickerType) Indicates whether the native picker dialog is supported for the given type which can include one of PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_TIME, PICKER_TYPE_DATEbooleanIndicates if the underlying platform supports sharing capabilitiesbooleanIndicates if the title of the Form is native title(in android ICS devices if the command behavior is native the ActionBar is used to display the title and the menu)booleanIndicates if the native video player includes its own play/pause etc.booleanIndicates whether the notify status bar method will present a notification to the userbooleanReturns true if the image was opaquebooleanReturns true if the underlying OS supports opening the native navigation applicationbooleanChecks of the Transform class can be used on this platform to perform perspective transforms.booleanisPerspectiveTransformSupported(Object graphics) Checks if 3d/perspective transformations are supported in the provided graphics context.booleanReturns true if the device is currently in portrait modebooleanChecks if this platform supports read timeout in network connections.booleanChecks if last mouse press was a right click.booleanIndicates whether drawImageRotated is supported by the platform for FAST drawing, if not then its not worth calling the method which will be unimplemented!booleanisRTL(char c) Returns true if the given character is an RTL characterbooleanisRTLOrWhitespace(char c) Returns true if the given character is an RTL character or a space characterbooleanIndicates if image scaling on the fly is supported by the platform, if not Codename One will just scale the images on its own before drawingbooleanChecks if the device supports locking the screen display from dimming, allowing the developer to keep the screen display on.booleanbooleanIndicates whether the underlying implementation supports server socketsbooleanChecks if this platform supports custom cursors.booleanisShapeClipSupported(Object graphics) Checks if clipping shapes is supported by the provided graphics context.booleanisShapeSupported(Object graphics) Checks if drawing shapes is supported by the provided graphics context.booleanChecks whether the shift key is currently down.booleanAllows detecting development mode so debugging code and special cases can be used to simplify flowbooleanIndicates whether the underlying implementation supports socketsbooleanisSocketConnected(Object socket) Indicates whether the socket is currently connectedbooleanIndicates whether the underlying platform supports creating an SVG ImagebooleanisTablet()Indicates whether the device is a tablet, notice that this is often a guessbooleanIndicates the default status to apply to the 3rd softbutton variablebooleanIndicates whether the underlying implementation supports the notion of a network operation timeout.abstract booleanReturns true if the device will send touch eventsbooleanChecks if the Transform class can be used on this platform.booleanisTransformSupported(Object graphics) Checks if matrix transformations are supported in the provided graphics context.booleanCodename One can translate all coordinates and never requires a call to translate this works well for some devices which have hairy issues with translate.booleanReturns true if the system supports dynamically loading truetype fonts from a file.booleanReturns true if setBrowserURL with custom headers is supportedbooleanUses the native cookie store if applicable, this might break simulator compatibilitybooleanBest-effort check for whether a VPN appears to be active.booleanIndicates whether this platform can attempt to detect active VPN usage.protected voidkeyPressed(int keyCode) Subclasses should invoke this method, it delegates the event to the display and into Codename One.protected voidkeyReleased(int keyCode) Subclasses should invoke this method, it delegates the event to the display and into Codename One.listenSocket(int port) Listens on the given port similar to the accept method of server socket in Java.abstract String[]Lists the files within the given directory, returns relative file names and not full file names.abstract String[]Returns the filesystem roots from which the structure of the file system can be traversedabstract String[]Lists the names of the storage filesloadNativeFont(String lookup) Loads a native font based on a lookup for a font name and attributes.loadTrueTypeFont(String fontName, String fileName) Creates a true type font with the given name/filename (font name might be different from the file name and is required by some devices e.g. iOS).voidlockOrientation(boolean portrait) On devices that return true for canForceOrientation() this method can lock the device orientation either to portrait or landscape modevoidIf Locking isScreenLockSupported() returns true calling this method will lock the screen display onprotected voidDispatch the message to the loggervoidlogStreamClose(String name, boolean isInput, int count) Logs the closing of a streamvoidlogStreamCreate(String name, boolean isInput, int count) Logs the creation of a streamvoidlogStreamDoubleClose(String name, boolean isInput) Logs the closing of a streammakeTransformAffine(double m00, double m10, double m01, double m11, double m02, double m12) Makes a transform given the specified AffineTransform values.makeTransformCamera(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) Makes a transform to simulate a camera's perspective at a given location.Makes a new identity native transform.makeTransformInverse(Object nativeTransform) Gets the inverse transformation for the provided transform.makeTransformOrtho(float left, float right, float bottom, float top, float near, float far) Makes a new orthographic projection transform.makeTransformPerspective(float fovy, float aspect, float zNear, float zFar) Makes a new perspective transform.makeTransformRotation(float angle, float x, float y, float z) Makes a new native rotation transform.makeTransformScale(float scaleX, float scaleY, float scaleZ) Makes a new native scale transform.makeTransformTranslation(float translateX, float translateY, float translateZ) Makes a new native translation transform.booleanMinimizes the current application if minimization is supported by the platform (may fail).abstract voidCreates the given directoryvoidAdds close listener to native browser window.voidnativeBrowserWindowCleanup(Object window) Cleans up and disposes of a native browser window.voidnativeBrowserWindowEval(Object window, BrowserWindow.EvalRequest req) Evaluates javascript on native browser window.voidnativeBrowserWindowHide(Object window) Hides a native browser window.voidRemoves close listener from native browser window.voidnativeBrowserWindowSetSize(Object window, int width, int height) Sets the size of a native browser window.voidnativeBrowserWindowSetTitle(Object window, String title) Sets the window title of a native browser window.voidnativeBrowserWindowShow(Object window) Shows a native browser window.booleanvoidIndicates to the port that the component won't be painted due to clippingvoidnotifyCommandBehavior(int commandBehavior) This method notifies the implementation about the chosen commands behaviorvoidNotifies the platform that push notification processing is complete.notifyStatusBar(String tickerText, String contentTitle, String contentBody, boolean vibrate, boolean flashLights, Hashtable args) Place a notification on the device status bar (if device has this functionality).intReturn the number of alpha levels supported by the implementation.intReturns the number of colors applicable on the device, note that the API does not support gray scale devices.voidA callback fired when you are allowed to prompt the user to install the app on their homescreen.voidCallback before showing a specific formopenFileInputStream(String file) Returns an input stream for the given connectionopenFileOutputStream(String file) Returns an output stream for the given filevoidopenGallery(ActionListener response, int type) Opens the device gallery The method returns immediately and the response will be sent asynchronously to the given ActionListener ObjectvoidopenImageGallery(ActionListener response) Opens the device image galleryabstract InputStreamopenInputStream(Object connection) Returns an input stream for the given connectionvoidopenNativeNavigationApp(double latitude, double longitude) Opens the native navigation app in the given coordinate.voidopenNativeNavigationApp(String location) Opens the native navigation app with the given search locationopenOrCreateDB(String databaseName) Opens a database or create one if not existsabstract OutputStreamopenOutputStream(Object connection) Returns an output stream for the given connectionabstract OutputStreamopenOutputStream(Object connection, int offset) Returns an output stream for the given connectionvoidpaintComponentBackground(Object nativeGraphics, int x, int y, int width, int height, Style s) Paints the background of a component based on the style values on the given graphics context, the style could be accessed from the drawing thread in read only capacity to make the code slightly more efficientvoidInvoked by the EDT to paint the dirty regionsbooleanA flag that can be overridden by a platform to indicate that native peers are rendered behind the main codename one graphics layer.protected voidAllows for painting an overlay on top of the implementation for notices during testing etc.booleanChecks to see if this is a platform that uses theTextField#setInputMode(java.lang.String).voidplayBuiltinSound(String soundIdentifier) Plays a builtin device sound matching the given identifier, implementations and themes can offer additional identifiers to the ones that are already built in.voidplayDialogSound(int type) Invoked when a dialog is shown, this method allows a dialog to play a soundprotected voidplayNativeBuiltinSound(Object data) This method allows implementations to store sound objects natively e.g.protected voidplayUserSound(String soundIdentifier) Plays a sound defined by the userprotected voidpointerDragged(int[] x, int[] y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.protected voidpointerDragged(int x, int y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.protected voidpointerHover(int[] x, int[] y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.protected voidpointerHover(int x, int y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.protected voidpointerHoverPressed(int[] x, int[] y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.protected voidpointerHoverPressed(int x, int y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.protected voidpointerHoverReleased(int[] x, int[] y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.protected voidpointerHoverReleased(int x, int y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.protected voidpointerPressed(int[] x, int[] y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.protected voidpointerPressed(int x, int y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.protected voidpointerReleased(int[] x, int[] y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.protected voidpointerReleased(int x, int y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.voidPops the clip from the top of the clip stack and sets it as the current clip.voidpostInit()Callback allowing the implementation to perform an operation on the init thread after initialization was completedvoidpostMessage(MessageEvent message) Posts a message to the native platform.booleanpostMessage(Object browserComponent, String message, String targetOrigin) Posts a message to the window in a BrowserComponent.voidAllows the logger to print the stack trace into the log when the native platform supports thatbooleanPrompts the user to install this app on their homescreen.voidPushes the current clip onto the clip stack so that it can be retrieved later by#popClip.protected final voidpushReceived(String data) byte[]readFromSocketStream(Object socket) Read pending bytes from the socketvoidClears the addressbook cache.voidif the title is native(e.g the android action bar), notify the native title that is needs to be refreshedprotected static voidRegisters a polling thread to simulate push notificationvoidregisterPush(Hashtable metaData, boolean noFallback) User register to receive push notificationstatic voidregisterPushOnServer(String id, String applicationKey, byte pushType, String udid, String packageName) Sends a server request to register push support.static booleanregisterServerPush(String id, String applicationKey, byte pushType, String udid, String packageName) Sends a server request to register push support.voidreleaseImage(Object image) Allows buggy implementations (Android) to release image objectsvoidremoveCompletionHandler(Media media, Runnable onCompletion) Removes onComplete callback from Media element.protected final voidremoveCookiesForDomain(String domain) voidRemoves a heavy action listener from a heavy button.voidRemoves a load listener from a native browser window.abstract voidRenames a file to the given name, expects the new name to be relative to the current directoryvoidInvoked to add an element to the paintQueueprotected final voidrepaintTextEditor(boolean focus) Allows the implementation to refresh the text fieldbooleanAttempt to enter full-screen mode.booleanChecks whether the current platform requires a heavy button for copy to clipboard functionality to work.voidresetAffine(Object nativeGraphics) Resets the affine transform to the default valuevoidRestore the minimized application if minimization is supported by the platformvoidRotates the coordinate system around a radian angle using the affine transformvoidRotates the coordinate system around a radian angle using the affine transformReturns an instance of this image rotated by the given number of degrees.rotate180Degrees(Image image, boolean maintainOpacity) Rotates the given image by 180 degreesrotate270Degrees(Image image, boolean maintainOpacity) Rotates the given image by 270 degrees while changing the ratio of the picturerotate90Degrees(Image image, boolean maintainOpacity) Rotates the given image by 90 degrees while changing the ratio of the picturevoidInvoked if Codename One needs to dispose the native text editing but would like the editor to store its state.voidScales the coordinate system using the affine transformabstract ObjectScales a native image and returns the scaled versionvoidscalePoints(int pointSize, float sX, float sY, float sZ, float[] in, int srcPos, float[] out, int destPos, int numPoints) Scales a set of points.voidscheduleLocalNotification(LocalNotification notif, long firstTime, int repeat) voidscreenshot(SuccessCallback<Image> callback) Tries to grab an OS native screenshot which would include peer components etc.voidsendMessage(String[] recipients, String subject, Message msg) Send an email using the platform mail clientprotected voidsendPushRegistrationError(String message, int errorCode) Allows implementations to send an error to the push callbackprotected final voidvoidSends a SMS message to the given phone numberabstract voidAlpha value from 0-255 can be ignored for some operationsvoidsetAntiAliased(Object graphics, boolean a) Toggles anti-aliasing mode for regular rendering operationsvoidsetAntiAliasedText(Object graphics, boolean a) Toggles anti-aliasing mode for font rendering operationsvoidvoidsetBadgeNumber(int number) Sets the number that appears on the application icon in iOSvoidsetBidiAlgorithm(boolean activate) Indicates whether Codename One should consider the bidi RTL algorithm when drawing text or navigating with the text field cursor.voidsetBrowserPage(PeerComponent browserPeer, String html, String baseUrl) Shows the given HTML in the native viewervoidsetBrowserPageInHierarchy(PeerComponent browserPeer, String url) Sets a relative URL from the html hierarchyvoidsetBrowserProperty(PeerComponent browserPeer, String key, Object value) This method allows customizing the properties of a web view in various ways including platform specific settings.voidsetBrowserURL(PeerComponent browserPeer, String url) Sets the page URL, jar: URL's must be supported by the implementationvoidsetBrowserURL(PeerComponent browserPeer, String url, Map<String, String> headers) Sets the page URL, jar: URL's must be supported by the implementationvoidsetBuiltinSoundsEnabled(boolean enabled) Allows muting/unmuting the builtin sounds easilyvoidsetChunkedStreamingMode(Object connection, int bufferLen) This method is used to enable streaming of a HTTP request body without internal buffering, when the content length is not known in advance.abstract voidInstalls a new clipping rectanglevoidClips the Graphics context to the Shape.voidsetClipRect(Object graphics, Rectangle rect) Installs a new clipping rectanglevoidInstalls the Codename One graphics object into the implementationabstract voidSets the current rgb color while ignoring any potential alpha component within said color value.voidsetCommandBehavior(int commandBehavior) Indicates the way commands should be added to a form as one of the ocmmand constants defined in this classvoidsetConnectionId(Object connection, int id) voidReturns the id of the current access pointvoidThis method is used internally to determine the actual current form it doesn't perform the logic of transitions etc.voidsetDisplayLock(Object lock) Installs the display lock allowing implementors to synchronize against the Display mutex, this method is invoked internally and should not be used.voidsetDragStartPercentage(int dragStartPercentage) This method allows us to manipulate the drag started detection logic.voidSets current editingText value and sets it focused.abstract voidIndicates the HTTP header value for an HTTP connectionabstract voidToggles the hidden state of the filevoidsetHttpMethod(Object connection, String method) Requests special http method such as put or deletevoidsetImageName(Object nativeImage, String name) Allows for easier debugging of native implementations by setting the image name to the native image objectvoidStores an optional window size hint (in percent values) for desktop environments.voidsetInsecure(Object connection, boolean insecure) Sets connection to be insecure.voidThis method is useful strictly for debugging, the logger can use it to track file opening/closing thus detecting potential file resource leaks that can cause serious problems in some OS's.voidsetNativeBrowserScrollingEnabled(PeerComponent browserPeer, boolean e) Allows disabling the browsers native scrolling on devices that support itvoidsetNativeCommands(Vector commands) Places the following commands on the native menu systemabstract voidsetNativeFont(Object graphics, Object font) Installs a native font objectstatic voidSet a task to be executed once the implementation is being destroyedvoidsetPinchToZoomEnabled(PeerComponent browserPeer, boolean e) Some platforms require that you enable pinch to zoom explicitly.voidsetPlatformHint(String key, String value) Makes it easier to pass hints to the underlying implementation for quicker hacks/pipelinesvoidsetPollingFrequency(int freq) Sets the frequency for polling the server in case of polling based push notificationabstract voidsetPostRequest(Object connection, boolean p) Indicates the whether the request method is GET or POSTvoidsetPreferredBackgroundFetchInterval(int seconds) Sets the preferred time interval between background fetches.voidsetProjectBuildHint(String key, String value) Sets a build hint into the settings while overwriting any previous value.static voidAllows the system to register the purchase callback instancestatic voidsetPushCallback(PushCallback push) Allows the system to register to receive push callbacksvoidsetReadTimeout(Object connection, int readTimeout) Sets the read timeout of a connection.voidsetRenderingHints(Object nativeGraphics, int hints) Sets the rendering hints for a graphics context.voidsetStorageData(Object storageData) The storage data is used by some storage implementations (e.g. CDC) to place the storage object in a "proper" location matching the application name.voidsetThreadPriority(Thread t, int p) Allows an implementation to modify setting thread priority, some implementations don't handle thread priorities wellvoidsetTimeout(int t) This will work only if http timeout is supportedvoidsetTransform(Object graphics, Transform transform) Sets the transformation matrix to be applied to all drawing operations.voidsetTransformAffine(Object nativeTransform, double m00, double m10, double m01, double m11, double m02, double m12) Sets transform to the given specified AffineTransform values.voidsetTransformCamera(Object nativeTransform, float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) voidsetTransformIdentity(Object transform) Sets the given native transform to the identiy transformvoidsetTransformInverse(Object nativeTransform) voidsetTransformOrtho(Object nativeTransform, float left, float right, float bottom, float top, float near, float far) voidsetTransformPerspective(Object nativeTransform, float fovy, float aspect, float zNear, float zFar) voidsetTransformRotation(Object nativeTransform, float angle, float x, float y, float z) voidsetTransformScale(Object nativeTransform, float scaleX, float scaleY, float scaleZ) voidsetTransformTranslation(Object nativeTransform, float translateX, float translateY, float translateZ) voidsetUseNativeCookieStore(boolean useNativeCookieStore) Uses the native cookie store if applicable, this might break simulator compatibilityvoidsetWindowSize(int width, int height) Requests a resize of the application window when supported by the platform.voidShare the required information using the platform sharing services.voidShare the required information using the platform sharing services.voidShear the graphics coordinate system using the affine transformbooleanThis callback allows highly broken devices like the blackberry to automatically detect the network typebooleanIndicates the implementation is capable of keeping the background painted by being non-destructive.booleanFor some reason the standard code for writing UTF8 output in a server request doesn't work as expected on SE/CDC stacks.showNativePicker(int type, Component source, Object currentValue, Object data) Shows a native modal dialog allowing us to perform the picking for the given type which can include one of PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_TIME, PICKER_TYPE_DATEvoidshowNativeScreen(Object nativeFullScreenPeer) Shows a native Form/Canvas or some other heavyweight native screenprotected voidSubclasses should invoke this method, it delegates the event to the display and into Codename One.protected voidsizeChanged(int w, int h) Subclasses should invoke this method, it delegates the event to the display and into Codename One.voidsplitString(String source, char separator, ArrayList<String> out) voidStarts the remote control service.voidstartThread(String name, Runnable r) Some devices need more elaborate thread creation logic e.g.protected static voidStops the polling push loopvoidStops the remote control service.voidInvoked for special cases to stop text editing and clear native editing statevoidstopTextEditing(Runnable onFinish) Invoked for special cases to stop text editing and clear native editing stateabstract booleanstorageFileExists(String name) Returns true if the given storage file existsabstract intstringWidth(Object nativeFont, String str) Return the width of the given string in this font instancebooleanbooleanReturns true if the platform supports a native image cache.booleanChecks whether the platform's native text areas support vertical alignment.voidSystem printvoidAllows an implementation to optimize image tiling rendering logictoNativePath(String path) Converts a FileSystemStorage path to a native path.booleantransformEqualsImpl(Transform t1, Transform t2) booleantransformNativeEqualsImpl(Object t1, Object t2) voidtransformPoint(Object nativeTransform, float[] in, float[] out) Transforms a point and stores the result in a provided array.voidtransformPoints(Object nativeTransform, int pointSize, float[] in, int srcPos, float[] out, int destPos, int numPoints) Transforms a set of points using the provided transform.voidtransformRotate(Object nativeTransform, float angle, float x, float y, float z) Rotates the provided transform.voidtransformScale(Object nativeTransform, float x, float y, float z) Scales the provided transform by the provide scale factors.voidtransformTranslate(Object nativeTransform, float x, float y, float z) Translates the transform by the specified amounts.voidTranslates the X/Y location for drawing on the underlying surface.voidtranslatePoints(int pointSize, float tX, float tY, float tZ, float[] in, int srcPos, float[] out, int destPos, int numPoints) Translates a set of points.booleanuninstallMessageListener(Object browserComponent) Uninstalls a message listener to allow webpages inside a browser component to send messages to CN1 cross-domain.voidThis is the reverse method for lock orientation allowing orientation lock to be disabledvoidUnlock the screen display allowing the screen to dim.voidupdateHeavyButtonBounds(Object peer, int x, int y, int width, int height) Updates the bounds of the native heavy button to match the bounds of the lightweight button.voidupdateNativeEditorText(Component c, String text) Called when TextArea text is changed.voidupdateNativeOverlay(Component cmp, Object nativeOverlay) Updates the native overlay after the component has been repositioned.booleanUsing invokeAndBlock inside EditString creates peculiar behaviour that needs to be worked around.voidvibrate(int duration) Vibrates the device for the given length of timevoidwriteToSocketStream(Object socket, byte[] data) Write the following byte array to the socket
-
Constructor Details
-
CodenameOneImplementation
public CodenameOneImplementation()
-
-
Method Details
-
setOnExit
Set a task to be executed once the implementation is being destroyed -
setPushCallback
Allows the system to register to receive push callbacks
Parameters
push: the callback object
-
getPurchaseCallback
Returns the purchase callback instance -
setPurchaseCallback
Allows the system to register the purchase callback instance
Parameters
pc: the pc callback
-
getStringArrayClass
This is a temporary workaround for an XMLVM Bug! -
getStringArray2DClass
This is a temporary workaround for an XMLVM Bug! -
getImageArrayClass
This is a temporary workaround for an XMLVM Bug! -
getObjectArrayClass
This is a temporary workaround for an XMLVM Bug! -
stopPolling
protected static void stopPolling()Stops the polling push loop -
getApplicationKey
Returns the key for the application comprised of the builders email coupled with the package name. It should uniquely identify the application across different builds which allows interaction with the cloud.
Returns
a unique string with the format builders_email/packagename
-
registerServerPush
public static boolean registerServerPush(String id, String applicationKey, byte pushType, String udid, String packageName) Sends a server request to register push support. This is a method for use by implementations.
Parameters
-
id: the platform specific push ID -
applicationKey: the unique id of the application -
pushType: for server side type -
packageName: the application package name used by the push service
Returns
true for success, false otherwise
-
-
registerPushOnServer
public static void registerPushOnServer(String id, String applicationKey, byte pushType, String udid, String packageName) Sends a server request to register push support. This is a method for use by implementations.
Parameters
-
id: the platform specific push ID -
applicationKey: the unique id of the application -
pushType: for server side type -
packageName: the application package name used by the push service
-
-
deregisterPushFromServer
public static void deregisterPushFromServer()For use by implementations, stop receiving push notifications from the server -
registerPollingFallback
protected static void registerPollingFallback()Registers a polling thread to simulate push notification
Deprecated
this functionality is no longer supported
-
initImpl
Invoked by the display init method allowing the implementation to "bind"
Parameters
m: the object passed to the Display init method
-
isInitialized
public boolean isInitialized()Returns true if the implementation is initialized. -
sendPushRegistrationError
Allows implementations to send an error to the push callback
Parameters
-
message: the error message -
errorCode: the error code
-
-
init
Invoked by the display init method allowing the implementation to "bind"
Parameters
m: the object passed to the Display init method
-
initEDT
public void initEDT()Some implementations might need to perform initializations of the EDT thread -
deinitialize
public void deinitialize()Allows subclasses to cleanup if necessary -
playDialogSound
public void playDialogSound(int type) Invoked when a dialog is shown, this method allows a dialog to play a sound
Parameters
type: the type of the dialog matching the dialog classes defined types
-
vibrate
public void vibrate(int duration) Vibrates the device for the given length of time
Parameters
duration: length of time to vibrate
-
flashBacklight
public void flashBacklight(int duration) Flash the backlight of the device for the given length of time
Parameters
duration: length of time to flash the backlight
-
getDisplayWidth
public abstract int getDisplayWidth()Returns the width dimension of the display controlled by this implementation
Returns
the width
-
getDisplayHeight
public abstract int getDisplayHeight()Returns the height dimension of the display controlled by this implementation
Returns
the height
-
getActualDisplayHeight
public int getActualDisplayHeight()Returns the display height ignoring manipulations performed by the VKB
Returns
the height
-
getDesktopSize
Returns the size of the desktop area hosting the application window when running on a desktop platform. Implementations that do not support windows may return
null.Returns
the desktop size or
null -
getWindowBounds
Returns the bounds of the application window when running on a desktop platform.
Returns
the window bounds, defaults to the current display size
-
setWindowSize
public void setWindowSize(int width, int height) Requests a resize of the application window when supported by the platform.
Parameters
-
width: the desired window width in pixels -
height: the desired window height in pixels
-
-
getInitialWindowSizeHintPercent
Returns the optional desktop window size hint provided by the first form.
Returns
the stored hint or
null -
setInitialWindowSizeHintPercent
Stores an optional window size hint (in percent values) for desktop environments. Implementations that do not support windows may ignore this value.
Parameters
hint: @param hint aDimensionwhose width/height represent percentages of the desktop to use for the initial window size, ornullto clear a previously stored hint
-
handleEDTException
Invoked when an exception occurs on the EDT, allows the implementation to take control of the device to produce testing information.
Parameters
err: the exception that was caught in the EDT loop
Returns
- Returns:
- false by default, true if the exception shouldn't be handled further by the EDT
-
editStringImpl
public final void editStringImpl(Component cmp, int maxSize, int constraint, String text, int initiatingKeycode) Encapsulates the editing code which is specific to the platform, some platforms would allow "in place editing" MIDP does not.
Parameters
-
cmp: theTextAreacomponent -
maxSize: the maximum size from the text area -
constraint: the constraints of the text area -
text: the string to edit -
initiatingKeycode: the keycode used to initiate the edit.
-
-
setFocusedEditingText
Sets current editingText value and sets it focused. NB! it not call editString, that is it should be called only internally and actually the methdo should not be added :) -
stopTextEditing
public void stopTextEditing()Invoked for special cases to stop text editing and clear native editing state -
stopTextEditing
Invoked for special cases to stop text editing and clear native editing state -
usesInvokeAndBlockForEditString
public boolean usesInvokeAndBlockForEditString()Using invokeAndBlock inside EditString creates peculiar behaviour that needs to be worked around. Ideally no port should use invokeAndBlock for this but currently JavaSE and UWP both do. Need to be able to detect this for workarounds. -
editString
public abstract void editString(Component cmp, int maxSize, int constraint, String text, int initiatingKeycode) Encapsulates the editing code which is specific to the platform, some platforms would allow "in place editing" MIDP does not.
Parameters
-
cmp: theTextAreacomponent -
maxSize: the maximum size from the text area -
constraint: the constraints of the text area -
text: the string to edit -
initiatingKeycode: the keycode used to initiate the edit.
-
-
nativeEditorPaintsHint
public boolean nativeEditorPaintsHint() -
isEditingText
public boolean isEditingText()Returns true if we are currently editing a component
Returns
whether a component is being edited
-
platformUsesInputMode
public boolean platformUsesInputMode()Checks to see if this is a platform that uses theTextField#setInputMode(java.lang.String). -
isNativeEditorVisible
Checks whether the native text editor is currently visible over top of the given component (usually a
TextAreaParameters
c: The textarea/component we are checking
Returns
True if the native editor is visible.
-
updateNativeEditorText
-
hideTextEditor
public void hideTextEditor()In case of scrolling we can hide the text editor unless the user starts typing again, this is only relevant for the async mode... -
getAppArg
-
setAppArg
-
repaintTextEditor
protected final void repaintTextEditor(boolean focus) Allows the implementation to refresh the text field -
isEditingText
Returns true if we are currently editing this component
Returns
whether a component is being edited
-
getEditingText
Gets the component that is currently editing text -
isAsyncEditMode
public boolean isAsyncEditMode()Returns true if edit string will return immediately and broadcast editing events directly to the text field
Returns
false by default
-
getInvisibleAreaUnderVKB
public int getInvisibleAreaUnderVKB()Returns the height of the VKB when it is open for an implementation that requires us to allow scrolling further
Returns
height in pixels
-
saveTextEditingState
public void saveTextEditingState()Invoked if Codename One needs to dispose the native text editing but would like the editor to store its state. -
hasPendingPaints
public boolean hasPendingPaints()Returns true if the implementation still has elements to paint.
Returns
false by default
-
numAlphaLevels
public int numAlphaLevels()Return the number of alpha levels supported by the implementation.
Returns
the number of alpha levels supported by the implementation
Deprecated
this method isn't implemented in most modern devices
-
numColors
public int numColors()Returns the number of colors applicable on the device, note that the API does not support gray scale devices.
Returns
the number of colors applicable on the device
Deprecated
this method isn't implemented in most modern devices
-
getComponentScreenGraphics
This method allows customizing/creating a graphics context per component which is useful for some elaborate implementations of Codename One. This method is only relevant for elborate components such as container which render their own components rather than invoke repaint()
Parameters
-
cmp: component being rendered -
currentContext: the current graphics context
Returns
a graphics object thats appropriate for the given component.
-
-
paintOverlay
Allows for painting an overlay on top of the implementation for notices during testing etc.
Parameters
g: graphics context on which to draw the overlay
-
paintDirty
public void paintDirty()Invoked by the EDT to paint the dirty regions -
edtIdle
public void edtIdle(boolean enter) This method is a callback from the edt before the edt enters to an idle state
Parameters
enter: @param enter true before the edt sleeps and false when exits from the idle state
-
flushGraphics
public abstract void flushGraphics(int x, int y, int width, int height) Flush the currently painted drawing onto the screen if using a double buffer
Parameters
-
x: position of the dirty region -
y: position of the dirty region -
width: width of the dirty region -
height: height of the dirty region
-
-
flushGraphics
public abstract void flushGraphics()Flush the currently painted drawing onto the screen if using a double buffer -
getCodenameOneGraphics
Returns a graphics object for use by the painting
Returns
- Returns:
- a graphics object, either recycled or new, this object will be used on the EDT
-
setCodenameOneGraphics
Installs the Codename One graphics object into the implementation
Parameters
g: graphics object for use by the implementation
-
paintNativePeersBehind
public boolean paintNativePeersBehind()A flag that can be overridden by a platform to indicate that native peers are rendered behind the main codename one graphics layer. The main effect of this is that Graphics will call clearRect() any time a native component is "painted" to poke a hole through the CN1 layer. -
setDisplayLock
Installs the display lock allowing implementors to synchronize against the Display mutex, this method is invoked internally and should not be used.
Parameters
lock: the mutex from display
-
cancelRepaint
Removes an entry from the paint queue if it exists, this is important for cases in which a component was repainted and immediately removed from its parent container afterwards. This happens sometimes in cases where a replace() operation changes a component to a new component that has an animation() the animation might have triggered a repaint before the removeComponent method was invoked
Parameters
cmp: the component to
-
repaint
Invoked to add an element to the paintQueue
Parameters
cmp: component or animation to push into the paint queue
-
getRGB
public abstract void getRGB(Object nativeImage, int[] arr, int offset, int x, int y, int width, int height) Extracts RGB data from the given native image and places it in the given array
Parameters
-
nativeImage: native platform image object -
arr: int array to store RGB data -
offset: position within the array to start -
x: x position within the image -
y: y position within the image -
width: width to extract -
height: height to extract
-
-
createImage
Create a platform native image object from the given RGB data
Parameters
-
rgb: ARGB data from which to create a platform image -
width: width for the resulting image -
height: height for the resulting image
Returns
platform image object
-
-
createImage
Creates a native image from a file in the system jar or file system storage.
Parameters
path: If path begins with file: this will load a file from FileSystemStorage. Otherwise it will load from jar.
Returns
native system image
Throws
java.io.IOException: if thrown by loading
- Throws:
IOException
-
createImage
Creates a native image from a given input stream
Parameters
i: input stream from which to load the image
Returns
native system image
Throws
java.io.IOException: if thrown by loading
- Throws:
IOException
-
createMutableImage
Creates a modifable native image that can return a graphics object
Parameters
-
width: the width of the mutable image -
height: the height of the mutable image -
fillColor: @param fillColor the ARGB fill color, alpha may be ignored based on the value of isAlphaMutableImageSupported
Returns
the native image
-
-
isAlphaMutableImageSupported
public boolean isAlphaMutableImageSupported()Indicates whether mutable images respect alpha values when constructed
Returns
true if mutable images can have an alpha value when initially created
-
createImage
Create a nativate image from its compressed byte data
Parameters
-
bytes: the byte array representing the image data -
offset: offset within the byte array -
len: the length for the image within the byte array
Returns
a native image
-
-
getImageWidth
Returns the width of a native image
Parameters
i: the native image
Returns
the width of the native image
-
getImageHeight
Returns the height of a native image
Parameters
i: the native image
Returns
the height of the native image
-
scale
-
rotate
Returns an instance of this image rotated by the given number of degrees. By default 90 degree angle divisions are supported, anything else is implementation dependent. This method assumes a square image. Notice that it is inefficient in the current implementation to rotate to non-square angles,
E.g. rotating an image to 45, 90 and 135 degrees is inefficient. Use rotatate to 45, 90 and then rotate the 45 to another 90 degrees to achieve the same effect with less memory.
Parameters
degrees: A degree in right angle must be larger than 0 and up to 359 degrees
Returns
new image instance with the closest possible rotation
-
rotate90Degrees
-
rotate180Degrees
-
rotate270Degrees
-
flipImageHorizontally
-
flipImageVertically
-
screenshot
Tries to grab an OS native screenshot which would include peer components etc. On fallback draws the current Form object.
Parameters
callback: invoked with the screenshot
-
notifyPushCompletion
public void notifyPushCompletion()Notifies the platform that push notification processing is complete. -
supportsNativeImageCache
public boolean supportsNativeImageCache()Returns true if the platform supports a native image cache. The native image cache is different than just
FileSystemStorage#hasCachesDir(). A native image cache is an image cache that the platform provides that is full transparent to Codename One with respect to how images are stored, and whether they are cached. Currently only the Javascript port supprts a native image cache.This is used by
java.lang.String, com.codename1.ui.Image, int)to determine if it should use a cached image, or to defer to its storage and filesystem methods.Returns
True on platforms that support a native image cache. Currently only Javascript.
See also
- Display#supportsNativeImageCache()
-
downloadImageToCache
public void downloadImageToCache(String url, SuccessCallback<Image> onSuccess, FailureCallback<Image> onFail) Downloads an image from a URL to the cache. Platforms that support a native image cache
#supportsNativeImageCache()(e.g. Javascript) override this method to defer to the platform's handling of cached images. Platforms that have a caches directory (FileSystemStorage#hasCachesDir()will use that directory to cache the image. Other platforms will just download to storage.Parameters
-
url: The URL of the image to download. -
onSuccess: Callback on success. -
onFail: Callback on fail.
See also
- URLImage#createToCache(com.codename1.ui.EncodedImage, java.lang.String, com.codename1.ui.URLImage.ImageAdapter)
-
-
downloadImageToStorage
public void downloadImageToStorage(String url, String fileName, SuccessCallback<Image> onSuccess, FailureCallback<Image> onFail) Downloads an image to storage. This will not first check to see if the image is located in storage already. It will download and overwrite any existing image at the provided location.
Some platforms may override this method to use platform-level caching. E.g. Javascript will use the browser cache for downloading the image.
Parameters
-
url: The URL of the image to download. -
fileName: The storage key to be used to store the image. -
onSuccess: Callback on success. Will be executed on EDT. -
onFail: Callback on failure. Will be executed on EDT.
-
-
downloadImageToFileSystem
public void downloadImageToFileSystem(String url, String fileName, SuccessCallback<Image> onSuccess, FailureCallback<Image> onFail) Downloads an image to file system. This will not first check to see if the file exists already. It will download and overwrite any existing image at the provided location.
Some platforms may override this method to use platform-level caching. E.g. Javascript will use the browser cache for downloading the image.
Parameters
-
url: The URL of the image to download. -
fileName: The storage key to be used to store the image. -
onSuccess: Callback on success. Will be executed on EDT. -
onFail: Callback on failure. Will be executed on EDT.
-
-
getSoftkeyCount
public abstract int getSoftkeyCount()Returns the number of softkeys on the device
Returns
the number of softkey buttons on the device
-
getSoftkeyCode
public abstract int[] getSoftkeyCode(int index) Returns the softkey keycode for the given softkey index
Parameters
index: the index of the softkey
Returns
- Returns:
- the set of keycodes which can indicate the softkey, multiple keycodes might apply to the same functionality
-
getClearKeyCode
public abstract int getClearKeyCode()Returns the keycode for the clear key
Returns
the system key code for this device
-
getBackspaceKeyCode
public abstract int getBackspaceKeyCode()Returns the keycode for the backspace key
Returns
the system key code for this device
-
getBackKeyCode
public abstract int getBackKeyCode()Returns the keycode for the back key
Returns
the system key code for this device
-
getGameAction
public abstract int getGameAction(int keyCode) Returns the display game action for the given keyCode if applicable to match the contrct of Codename One for the game action behavior
Parameters
keyCode: the device keycode
Returns
a game action or 0
-
getKeyCode
public abstract int getKeyCode(int gameAction) Returns a keycode which can be sent to getGameAction
Parameters
gameAction: the game action
Returns
key code matching the given game action
-
isTouchDevice
public abstract boolean isTouchDevice()Returns true if the device will send touch events
Returns
true if the device will send touch events
-
onShow
Callback before showing a specific form
Parameters
f: the form shown
-
confirmControlView
public void confirmControlView()Callback method allowing the implementation to confirm that it controls the view just before a new form is installed. -
getCurrentForm
Returns the current form, this method is for internal use only and does not take transitions/menus into consideration
Returns
The internal current form
-
setCurrentForm
This method is used internally to determine the actual current form it doesn't perform the logic of transitions etc. and shouldn't be invoked by developers
Parameters
f: the current form
-
isTranslationSupported
public boolean isTranslationSupported()Codename One can translate all coordinates and never requires a call to translate this works well for some devices which have hairy issues with translate. However for some platforms where translate can be leveraged with affine transforms this can be a problem. These platforms can choose to translate on their own
Returns
- Returns:
- true if the implementation is interested in receiving translate calls and handling them.
-
translate
Translates the X/Y location for drawing on the underlying surface. Translation is incremental so the new value will be added to the current translation and in order to reset translation we have to invoke
translate(-getTranslateX(), -getTranslateY())Parameters
-
graphics: the graphics context -
x: the x coordinate -
y: the y coordinate
-
-
getTranslateX
Returns the current x translate value
Parameters
graphics: the graphics context
Returns
the current x translate value
-
getTranslateY
Returns the current y translate value
Parameters
graphics: the graphics context
Returns
the current y translate value
-
getColor
Returns the current color
Parameters
graphics: the graphics context
Returns
the RGB graphics color
-
setColor
Sets the current rgb color while ignoring any potential alpha component within said color value.
Parameters
-
graphics: the graphics context -
rgb: the RGB value for the color.
-
-
setAlpha
Alpha value from 0-255 can be ignored for some operations
Parameters
-
graphics: the graphics context -
alpha: the alpha channel
-
-
concatenateAlpha
Concatenates alpha value to current alpha.
Parameters
-
graphics: The graphics context -
alpha: The alpha to concatenate.
Returns
The previous alpha value.
-
-
getAlpha
Alpha value from 0-255 can be ignored for some operations
Parameters
graphics: the graphics context
Returns
the alpha channel
-
isAlphaGlobal
public boolean isAlphaGlobal()Returns true if alpha can be applied for all elements globally and efficiently otherwise alpha should be ignored. Notice that fillRect MUST always support alpha regardless of the value of this variable!
Returns
true if alpha support is natively implemented
-
isAntiAliasingSupported
public boolean isAntiAliasingSupported()Indicates whether the underlying implementation allows for anti-aliasing in regular drawing operations
Returns
false by default
-
isAntiAliasingSupported
-
isAntiAliasedTextSupported
public boolean isAntiAliasedTextSupported()Indicates whether the underlying implementation allows for anti-aliased fonts
Returns
false by default
-
isAntiAliasedTextSupported
-
setAntiAliased
Toggles anti-aliasing mode for regular rendering operations
Parameters
-
graphics: the graphics context -
a: true to activate Anti-aliasing, false to disable it
-
-
isAntiAliased
Returns anti-aliasing mode for regular rendering operations
Parameters
graphics: the graphics context
Returns
true if Anti-aliasing is active, false otherwise
-
setAntiAliasedText
Toggles anti-aliasing mode for font rendering operations
Parameters
-
graphics: the graphics context -
a: true to activate Anti-aliasing, false to disable it
-
-
isAntiAliasedText
Returns anti-aliasing mode for font rendering operations
Parameters
graphics: the graphics context
Returns
true if Anti-aliasing is active, false otherwise
-
setNativeFont
-
getClipRect
-
getClipX
Returns the clipping coordinate
Parameters
graphics: the graphics context
Returns
the clipping coordinate
-
getClipY
Returns the clipping coordinate
Parameters
graphics: the graphics context
Returns
the clipping coordinate
-
getClipWidth
Returns the clipping coordinate
Parameters
graphics: the graphics context
Returns
the clipping coordinate
-
getClipHeight
Returns the clipping coordinate
Parameters
graphics: the graphics context
Returns
the clipping coordinate
-
setClipRect
-
setClip
Installs a new clipping rectangle
Parameters
-
graphics: the graphics context -
x: coordinate -
y: coordinate -
width: size -
height: size -
rect: rectangle representing the new clipping area
-
-
setClip
-
clipRect
-
clipRect
Changes the current clipping rectangle to subset the current clipping with the given clipping.
Parameters
-
graphics: the graphics context -
x: coordinate -
y: coordinate -
width: size -
height: size -
rect: rectangle representing the new clipping area
-
-
pushClip
Pushes the current clip onto the clip stack so that it can be retrieved later by
#popClip.Parameters
graphics: The native graphics context.
-
disposeGraphics
Cleans up resources used by graphics object
Parameters
graphics
-
popClip
Pops the clip from the top of the clip stack and sets it as the current clip.
Parameters
graphics: The native graphics context.
Returns
The clip that was popped off the top of the clip stack.
-
drawLine
Draws a line between the 2 X/Y coordinates
Parameters
-
graphics: the graphics context -
x1: first x position -
y1: first y position -
x2: second x position -
y2: second y position
-
-
fillRect
Fills the rectangle from the given position according to the width/height minus 1 pixel according to the convention in Java.
Parameters
-
graphics: the graphics context -
x: the x coordinate of the rectangle to be filled. -
y: the y coordinate of the rectangle to be filled. -
width: the width of the rectangle to be filled. -
height: the height of the rectangle to be filled.
-
-
clearRect
-
drawRect
Draws a rectangle in the given coordinates
Parameters
-
graphics: the graphics context -
x: the x coordinate of the rectangle to be drawn. -
y: the y coordinate of the rectangle to be drawn. -
width: the width of the rectangle to be drawn. -
height: the height of the rectangle to be drawn.
-
-
drawRect
Draws a rectangle in the given coordinates
Parameters
-
graphics: the graphics context -
x: the x coordinate of the rectangle to be drawn. -
y: the y coordinate of the rectangle to be drawn. -
width: the width of the rectangle to be drawn. -
height: the height of the rectangle to be drawn. -
thickness: the thickness in pixels
-
-
drawRoundRect
public abstract void drawRoundRect(Object graphics, int x, int y, int width, int height, int arcWidth, int arcHeight) Draws a rounded corner rectangle in the given coordinates with the arcWidth/height matching the last two arguments respectively.
Parameters
-
graphics: the graphics context -
x: the x coordinate of the rectangle to be drawn. -
y: the y coordinate of the rectangle to be drawn. -
width: the width of the rectangle to be drawn. -
height: the height of the rectangle to be drawn. -
arcWidth: the horizontal diameter of the arc at the four corners. -
arcHeight: the vertical diameter of the arc at the four corners.
-
-
fillRoundRect
public abstract void fillRoundRect(Object graphics, int x, int y, int width, int height, int arcWidth, int arcHeight) Fills a rounded rectangle in the same way as drawRoundRect
Parameters
-
graphics: the graphics context -
x: the x coordinate of the rectangle to be filled. -
y: the y coordinate of the rectangle to be filled. -
width: the width of the rectangle to be filled. -
height: the height of the rectangle to be filled. -
arcWidth: the horizontal diameter of the arc at the four corners. -
arcHeight: the vertical diameter of the arc at the four corners.
See also
- #drawRoundRect
-
-
fillArc
public abstract void fillArc(Object graphics, int x, int y, int width, int height, int startAngle, int arcAngle) Fills a circular or elliptical arc based on the given angles and bounding box. The resulting arc begins at startAngle and extends for arcAngle degrees.
Parameters
-
graphics: the graphics context -
x: the x coordinate of the upper-left corner of the arc to be filled. -
y: the y coordinate of the upper-left corner of the arc to be filled. -
width: the width of the arc to be filled. -
height: the height of the arc to be filled. -
startAngle: the beginning angle. -
arcAngle: the angular extent of the arc, relative to the start angle.
-
-
drawArc
public abstract void drawArc(Object graphics, int x, int y, int width, int height, int startAngle, int arcAngle) Draws a circular or elliptical arc based on the given angles and bounding box
Parameters
-
graphics: the graphics context -
x: the x coordinate of the upper-left corner of the arc to be drawn. -
y: the y coordinate of the upper-left corner of the arc to be drawn. -
width: the width of the arc to be drawn. -
height: the height of the arc to be drawn. -
startAngle: the beginning angle. -
arcAngle: the angular extent of the arc, relative to the start angle.
-
-
drawString
Draw a string using the current font and color in the x,y coordinates. The font is drawn from the top position and not the baseline.
Parameters
-
graphics: the graphics context -
str: the string to be drawn. -
x: the x coordinate. -
y: the y coordinate.
-
-
drawImage
-
drawImage
-
createImage
-
drawShape
Draws outline of shape on the given graphics context.
The last 4 parameters specify a bounding box for drawing the Shape. The shape's bounds will be made to fit this box exactly for drawing. This allows for resizing the shape on the GPU if graphics acceleration is supported.
Parameters
-
graphics: the graphics context -
shape: the shape to draw. -
stroke: The stroke to use for drawing the contour.
See also
- See Also:
-
-
fillShape
-
drawShadow
public void drawShadow(Object graphics, Object image, int x, int y, int offsetX, int offsetY, int blurRadius, int spreadRadius, int color, float opacity) Draws a drop shadow for an image onto the given graphics context.
This is used for the elevation feature.
Note: This operation is expensive on most platforms as it is not hardware accelerated. Codename One's elevation functionality uses this method to generate shadow images which it reuses as much as possible for maximum performance.
Note: Currently this is not supported on all platforms. Use
#isDrawShadowSupported()to check for platform support at runtime. Use#isDrawShadowFast()to check for hardware acceleration.Note: On iOS, this is only supported for drawing to mutable images - not the global graphics context.
Parameters
-
graphics: The graphics context. -
image: @param image The image whose raster should be used to generate the shadow. The alpha channel of this image is used as the bases for the shadow projection. -
x: x-coordinate of the graphics context where shadow should be painted. -
y: y-coordinate of the graphics context where shadow should be painted. -
offsetX: The shadow offset X in pixels. -
offsetY: The shadow offset Y in pixels. -
blurRadius: The blur radius in pixels. -
spreadRadius: The shadow spread in pixels. -
color: The shadow color. -
opacity: The shadow opacity.
Since
8.0
See also
-
Component#paintShadows(Graphics, int, int)
-
Container#paintSurfaceShadows(Graphics)
-
#isDrawShadowSupported()
-
#isDrawShadowFast()
-
-
isDrawShadowSupported
public boolean isDrawShadowSupported()Checks to see if drawing shadows is supported on this platform.
Returns
True if the platform supports drawing shadows.
Since
8.0
See also
- #drawShadow(Object, Object, int, int, int, int, int, int, int, float)
-
isDrawShadowFast
public boolean isDrawShadowFast()Checks to see if drawing shadows on this platform is hardware accelerated.
Returns
True if drawing shadows is hardware accelerated.
Since
8.0
-
setTransform
Sets the transformation matrix to be applied to all drawing operations. If originX, originY are non-zero, then the the transformation will first be translated to the origin, then applied, and then translated back.
If isTransformSupported() returns false, then this method won't do anything.
If isPerspectiveTransformSupported() returns false, then this method will only deal with 2D transformation matrices (i.e. the upper left 3x3 matrix of the provided transformation matrix.
Parameters
-
graphics -
m: The transformation matrix. Can be 3x3 or 4x4.
See also
- isTransformSupported() To check if this graphics context supports transformations.
- See Also:
-
-
getTransform
Gets the current transformation matrix. This will populate the provided matrix with the data of the current transformation.
Parameters
graphics
Deprecated
Use
com.codename1.ui.Transform)instead.See also
-
isTransformSupported()
-
isPerspectiveTransformSupported()
-
isTransformSupported
Checks if matrix transformations are supported in the provided graphics context.
Parameters
graphics
Returns
True if matrix transformations are supported by this graphics context.
See also
-
setTransform()
-
getTransform()
-
isPerspectiveTransformSupported()
-
isPerspectiveTransformSupported
Checks if 3d/perspective transformations are supported in the provided graphics context.
Parameters
graphics
See also
-
setTransform()
-
getTransform()
-
isTransformSupported()
-
isShapeSupported
Checks if drawing shapes is supported by the provided graphics context.
Parameters
graphics
-
isShapeClipSupported
Checks if clipping shapes is supported by the provided graphics context.
Parameters
graphics
-
tileImage
Allows an implementation to optimize image tiling rendering logic
Parameters
-
graphics: the graphics object -
img: the image -
x: coordinate to tile the image along -
y: coordinate to tile the image along -
w: coordinate to tile the image along -
h: coordinate to tile the image along
-
-
isNativeVideoPlayerControlsIncluded
public boolean isNativeVideoPlayerControlsIncluded()Indicates if the native video player includes its own play/pause etc. controls so the movie player component doesn't need to include them
Returns
true if the movie player component doesn't need to include such controls
-
isScaledImageDrawingSupported
public boolean isScaledImageDrawingSupported()Indicates if image scaling on the fly is supported by the platform, if not Codename One will just scale the images on its own before drawing -
drawImageArea
public void drawImageArea(Object nativeGraphics, Object img, int x, int y, int imageX, int imageY, int imageWidth, int imageHeight) Draws a portion of the image
Parameters
-
nativeGraphics: the graphics context -
img: the specified native image to be drawn -
x: the x coordinate. -
y: the y coordinate. -
imageX: location within the image to draw -
imageY: location within the image to draw -
imageWidth: size of the location within the image to draw -
imageHeight: size of the location within the image to draw
-
-
drawImageRotated
Draws the image so its top left coordinate corresponds to x/y with a fast native rotation in a square angle which must be one of 0, 90, 180 or 270
Parameters
-
graphics: the graphics context -
img: the specified native image to be drawn -
x: the x coordinate. -
y: the y coordinate. -
degrees: either 0, 90, 180 or 270 degree rotation for the image drawing
-
-
isRotationDrawingSupported
public boolean isRotationDrawingSupported()Indicates whether drawImageRotated is supported by the platform for FAST drawing, if not then its not worth calling the method which will be unimplemented!
Returns
true if drawImageRotated will draw an image
-
fillTriangle
Draws a filled triangle with the given coordinates
Parameters
-
graphics: the graphics context -
x1: the x coordinate of the first vertex of the triangle -
y1: the y coordinate of the first vertex of the triangle -
x2: the x coordinate of the second vertex of the triangle -
y2: the y coordinate of the second vertex of the triangle -
x3: the x coordinate of the third vertex of the triangle -
y3: the y coordinate of the third vertex of the triangle
-
-
drawRGB
public abstract void drawRGB(Object graphics, int[] rgbData, int offset, int x, int y, int w, int h, boolean processAlpha) Draws the RGB values based on the MIDP API of a similar name. Renders a series of device-independent RGB+transparency values in a specified region. The values are stored in rgbData in a format with 24 bits of RGB and an eight-bit alpha value (0xAARRGGBB), with the first value stored at the specified offset. The scanlength specifies the relative offset within the array between the corresponding pixels of consecutive rows. Any value for scanlength is acceptable (even negative values) provided that all resulting references are within the bounds of the rgbData array. The ARGB data is rasterized horizontally from left to right within each row. The ARGB values are rendered in the region specified by x, y, width and height, and the operation is subject to the current clip region and translation for this Graphics object.
Parameters
-
graphics: the graphics context -
rgbData: an array of ARGB values in the format 0xAARRGGBB -
offset: the array index of the first ARGB value -
x: the horizontal location of the region to be rendered -
y: the vertical location of the region to be rendered -
w: the width of the region to be rendered -
h: the height of the region to be rendered -
processAlpha: @param processAlpha true if rgbData has an alpha channel, false if all pixels are fully opaque
-
-
getNativeGraphics
Returns the native graphics object on which all rendering operations occur
Returns
a native graphics context
-
getNativeGraphics
-
charsWidth
Return the width of the given characters in the given native font instance
Parameters
-
nativeFont: the font for which the string width should be calculated -
ch: array of characters -
offset: characters offsets -
length: characters length
Returns
the width of the given characters in this font instance
-
-
getFontAscent
Returns the ascent of the specified native font instance. Should always return a non-negative value.
Parameters
nativeFont
Returns
The ascent of the native font instance
-
getFontDescent
Returns the descent below the baseline that a font can span. Should always be non-negative.
Parameters
nativeFont
-
isBaselineTextSupported
public boolean isBaselineTextSupported()Checks whether the implementation supports drawing text on the baseline. -
stringWidth
-
charWidth
Return the width of the specific character when rendered alone
Parameters
-
nativeFont: the font for which the string width should be calculated -
ch: the specific character
Returns
the width of the specific character when rendered alone
-
-
getHeight
Return the total height of the font
Parameters
nativeFont: the font for which the string width should be calculated
Returns
the total height of the font
-
getDefaultFont
Return the global default font instance, if font is passed as null this font should be used
Returns
the global default font instance
-
getFace
Optional operation returning the font face for the font
Parameters
nativeFont: the font for which the string width should be calculated
Returns
Optional operation returning the font face for system fonts
-
getSize
Optional operation returning the font size for system fonts
Parameters
nativeFont: the font for which the string width should be calculated
Returns
Optional operation returning the font size for system fonts
-
getStyle
Optional operation returning the font style for system fonts
Parameters
nativeFont: the font for which the string width should be calculated
Returns
Optional operation returning the font style for system fonts
-
createFont
Creates a new instance of a native font
Parameters
-
face: @param face the face of the font, can be one of FACE_SYSTEM, FACE_PROPORTIONAL, FACE_MONOSPACE. -
style: @param style the style of the font. The value is an OR'ed combination of STYLE_BOLD, STYLE_ITALIC, and STYLE_UNDERLINED; or the value is zero (STYLE_PLAIN). -
size: @param size the size of the font, can be one of SIZE_SMALL, SIZE_MEDIUM, SIZE_LARGE
Returns
a native font object
-
-
keyPressed
protected void keyPressed(int keyCode) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
keyCode: the key for the event
-
keyReleased
protected void keyReleased(int keyCode) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
keyCode: the key for the event
-
isRightMouseButtonDown
public boolean isRightMouseButtonDown()Checks if last mouse press was a right click.
Returns
True if last mouse press was a right click.
Since
7.0
-
isAltKeyDown
public boolean isAltKeyDown()Checks whether the alt key is currently down. Only relevant on desktop ports. -
isShiftKeyDown
public boolean isShiftKeyDown()Checks whether the shift key is currently down. Only relevant on desktop ports. -
isAltGraphKeyDown
public boolean isAltGraphKeyDown()Checks whether the altgraph key is currently down. Only relevant on desktop ports. -
isControlKeyDown
public boolean isControlKeyDown()Checks whether the control key is currently down. Only relevant on desktop ports. -
isMetaKeyDown
public boolean isMetaKeyDown()Checks whether the meta key is currently down. Only relevant on desktop ports. -
pointerDragged
protected void pointerDragged(int x, int y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
-
x: the position of the event -
y: the position of the event
-
-
pointerPressed
protected void pointerPressed(int x, int y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
-
x: the position of the event -
y: the position of the event
-
-
pointerReleased
protected void pointerReleased(int x, int y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
-
x: the position of the event -
y: the position of the event
-
-
pointerHover
protected void pointerHover(int[] x, int[] y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
-
x: the position of the event -
y: the position of the event
-
-
pointerHoverReleased
protected void pointerHoverReleased(int[] x, int[] y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
-
x: the position of the event -
y: the position of the event
-
-
pointerHoverReleased
protected void pointerHoverReleased(int x, int y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
-
x: the position of the event -
y: the position of the event
-
-
pointerHoverPressed
protected void pointerHoverPressed(int[] x, int[] y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
-
x: the position of the event -
y: the position of the event
-
-
pointerHoverPressed
protected void pointerHoverPressed(int x, int y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
-
x: the position of the event -
y: the position of the event
-
-
pointerHover
protected void pointerHover(int x, int y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
-
x: the position of the event -
y: the position of the event
-
-
pointerDragged
protected void pointerDragged(int[] x, int[] y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
-
x: the position of the event -
y: the position of the event
-
-
hasDragStarted
protected boolean hasDragStarted(int[] x, int[] y) This method can be overriden by subclasses to indicate whether a drag event has started or whether the device is just sending out "noise". This method is invoked by pointer dragged to determine whether to propogate the actual pointer drag event to Codename One.
Parameters
-
x: the position of the current drag event -
y: the position of the current drag event
Returns
true if the drag should propagate into Codename One
-
-
hasDragStarted
protected boolean hasDragStarted(int x, int y) This method can be overriden by subclasses to indicate whether a drag event has started or whether the device is just sending out "noise". This method is invoked by pointer dragged to determine whether to propagate the actual pointer drag event to Codename One.
Parameters
-
x: the position of the current drag event -
y: the position of the current drag event
Returns
true if the drag should propagate into Codename One
-
-
getDragStartPercentage
public int getDragStartPercentage()This method allows us to manipulate the drag started detection logic. If the pointer was dragged for more than this percentage of the display size it is safe to assume that a drag is in progress.
Returns
motion percentage
-
setDragStartPercentage
public void setDragStartPercentage(int dragStartPercentage) This method allows us to manipulate the drag started detection logic. If the pointer was dragged for more than this percentage of the display size it is safe to assume that a drag is in progress.
Parameters
dragStartPercentage: percentage of the screen required to initiate drag
-
getDragAutoActivationThreshold
protected int getDragAutoActivationThreshold()This method allows subclasses to manipulate the drag started detection logic. If more than this number of drag events were delivered it is safe to assume a drag has started This number must be bigger than 0!
Returns
number representing a minimum number of motion events to start a drag operation
-
pointerPressed
protected void pointerPressed(int[] x, int[] y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
-
x: the position of the event -
y: the position of the event
-
-
pointerReleased
protected void pointerReleased(int[] x, int[] y) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
-
x: the position of the event -
y: the position of the event
-
-
sizeChanged
protected void sizeChanged(int w, int h) Subclasses should invoke this method, it delegates the event to the display and into Codename One.
Parameters
-
w: the size of the screen -
h: the size of the screen
-
-
hideNotify
protected void hideNotify()Subclasses should invoke this method, it delegates the event to the display and into Codename One. -
showNotify
protected void showNotify()Subclasses should invoke this method, it delegates the event to the display and into Codename One. -
fillRectRadialGradient
public void fillRectRadialGradient(Object graphics, int startColor, int endColor, int x, int y, int width, int height, float relativeX, float relativeY, float relativeSize) Draws a radial gradient in the given coordinates with the given colors, doesn't take alpha into consideration when drawing the gradient. Notice that a radial gradient will result in a circular shape, to create a square use fillRect or draw a larger shape and clip to the appropriate size.
Parameters
-
graphics: the graphics context -
startColor: the starting RGB color -
endColor: the ending RGB color -
x: the x coordinate -
y: the y coordinate -
width: the width of the region to be filled -
height: the height of the region to be filled -
relativeX: indicates the relative position of the gradient within the drawing region -
relativeY: indicates the relative position of the gradient within the drawing region -
relativeSize: indicates the relative size of the gradient within the drawing region
-
-
fillRadialGradient
public void fillRadialGradient(Object graphics, int startColor, int endColor, int x, int y, int width, int height) Draws a radial gradient in the given coordinates with the given colors, doesn't take alpha into consideration when drawing the gradient. Notice that a radial gradient will result in a circular shape, to create a square use fillRect or draw a larger shape and clip to the appropriate size.
Parameters
-
graphics: the graphics context -
startColor: the starting RGB color -
endColor: the ending RGB color -
x: the x coordinate -
y: the y coordinate -
width: the width of the region to be filled -
height: the height of the region to be filled
-
-
fillRadialGradient
public void fillRadialGradient(Object graphics, int startColor, int endColor, int x, int y, int width, int height, int startAngle, int arcAngle) Draws a radial gradient in the given coordinates with the given colors, doesn't take alpha into consideration when drawing the gradient. Notice that a radial gradient will result in a circular shape, to create a square use fillRect or draw a larger shape and clip to the appropriate size.
Parameters
-
graphics: the graphics context -
startColor: the starting RGB color -
endColor: the ending RGB color -
x: the x coordinate -
y: the y coordinate -
width: the width of the region to be filled -
height: the height of the region to be filled -
startAngle: the beginning angle. Zero is at 3 o'clock. Positive angles are counter-clockwise. -
arcAngle: the angular extent of the arc, relative to the start angle. Positive angles are counter-clockwise.
-
-
fillLinearGradient
public void fillLinearGradient(Object graphics, int startColor, int endColor, int x, int y, int width, int height, boolean horizontal) Draws a linear gradient in the given coordinates with the given colors, doesn't take alpha into consideration when drawing the gradient
Parameters
-
graphics: the graphics context -
startColor: the starting RGB color -
endColor: the ending RGB color -
x: the x coordinate -
y: the y coordinate -
width: the width of the region to be filled -
height: the height of the region to be filled -
horizontal: indicating wheter it is a horizontal fill or vertical
-
-
fillPolygon
Fills a closed polygon defined by arrays of x and y coordinates. Each pair of (x, y) coordinates defines a point.
Parameters
-
graphics: the graphics context -
xPoints: - a an array of x coordinates. -
yPoints: - a an array of y coordinates. -
nPoints: - a the total number of points.
-
-
drawPolygon
Draws a closed polygon defined by arrays of x and y coordinates. Each pair of (x, y) coordinates defines a point.
Parameters
-
graphics: the graphics context -
xPoints: - a an array of x coordinates. -
yPoints: - a an array of y coordinates. -
nPoints: - a the total number of points.
-
-
getKeyboardType
public int getKeyboardType()Returns the type of the input device one of: KEYBOARD_TYPE_UNKNOWN, KEYBOARD_TYPE_NUMERIC, KEYBOARD_TYPE_QWERTY, KEYBOARD_TYPE_VIRTUAL, KEYBOARD_TYPE_HALF_QWERTY
Returns
KEYBOARD_TYPE_UNKNOWN
-
isNativeInputSupported
public boolean isNativeInputSupported()Indicates whether the device supports native in place editing in which case lightweight input logic shouldn't be used for input.
Returns
false by default
-
isNativeInputImmediate
public boolean isNativeInputImmediate()Indicates whether the device should switch to native input immediately on first touch
Returns
false by default
-
isMultiTouch
public boolean isMultiTouch()Indicates whether the device supports multi-touch events, this is only relevant when touch events are supported
Returns
false by default
-
isClickTouchScreen
public boolean isClickTouchScreen()Indicates whether the device has a double layer screen thus allowing two stages to touch events: click and hover. This is true for devices such as the storm but can also be true for a PC with a mouse pointer floating on top.
A click touch screen will also send pointer hover events to the underlying software and will only send the standard pointer events on click.
Returns
false by default
-
isNativeIndexed
public boolean isNativeIndexed()Returns true if indexed images should be used natively
Returns
true if a native image should be used for indexed images
-
createNativeIndexed
-
isOpaque
-
isAffineSupported
public boolean isAffineSupported()Indicates whether the underlying implementation can draw using an affine transform hence methods such as rotate, scale and shear would work
Returns
true if an affine transformation matrix is present
-
resetAffine
Resets the affine transform to the default value
Parameters
nativeGraphics: the native graphics object
-
scale
Scales the coordinate system using the affine transform
Parameters
-
nativeGraphics: the native graphics object -
x: factor for x -
y: factor for y
-
-
rotate
Rotates the coordinate system around a radian angle using the affine transform
Parameters
-
angle: the rotation angle in radians -
nativeGraphics: the native graphics object
-
-
rotate
Rotates the coordinate system around a radian angle using the affine transform
Parameters
-
angle: the rotation angle in radians -
pivotX: the pivot location -
pivotY: the pivot location -
nativeGraphics: the native graphics object
-
-
shear
Shear the graphics coordinate system using the affine transform
Parameters
-
x: factor for x -
y: factor for y -
nativeGraphics: the native graphics object
-
-
isSVGSupported
public boolean isSVGSupported()Indicates whether the underlying platform supports creating an SVG Image
Returns
- Returns:
- true if the method create SVG image would return a valid image object from an SVG Input stream
-
createSVGImage
Creates an SVG Image from the given byte array data and the base URL
Parameters
-
baseURL: URL which is used to resolve relative references within the SVG file -
data: the content of the SVG file
Returns
a native image that can be used within the image object
Throws
IOException: if resource lookup fail SVG is unsupported
- Throws:
IOException
-
-
getSVGDocument
-
animateImage
Callback to allow images animated by the underlying system to change their state e.g. for SVG or animated gif support. This method returns true if an animation state has changed requiring a repaint.
Parameters
-
nativeImage: a native image used within the image object -
lastFrame: the time the last frame of animation was shown
Returns
true if a repaint is required since the image state changed, false otherwise
-
-
getFontPlatformNames
Returns a list of the platform names ordered by priority, platform names are used to choose a font based on platform. Since a platform might support several layers for choice in narrowing platform font selection
Returns
the platform names ordered according to priority.
-
loadTrueTypeFont
Creates a true type font with the given name/filename (font name might be different from the file name and is required by some devices e.g. iOS). The font file must reside in the src root of the project in order to be detectable. The file name should contain no slashes or any such value.
Parameters
-
fontName: the name of the font -
fileName: the file name of the font as it appears in the src directory of the project
Returns
the native font created from the stream
-
-
isNativeFontSchemeSupported
public boolean isNativeFontSchemeSupported()Indicates whether the implementation supports loading a font "natively" to handle one of the common native prefixes
Returns
true if the "native:" prefix is supported by loadTrueTypeFont
-
deriveTrueTypeFont
Creates a font based on this truetype font with the given pixel, WARNING! This method will only work in the case of truetype fonts!
Parameters
-
font: the native font instance -
size: the size of the font in pixels -
weight: PLAIN, BOLD or ITALIC weight based on the constants in this class
Returns
scaled font instance
-
-
isTrueTypeSupported
public boolean isTrueTypeSupported()Returns true if the system supports dynamically loading truetype fonts from a file.
Returns
- Returns:
- true if the system supports dynamically loading truetype fonts from a file.
-
loadNativeFont
Loads a native font based on a lookup for a font name and attributes. Font lookup values can be separated by commas and thus allow fallback if the primary font isn't supported by the platform.
Parameters
lookup: string describing the font
Returns
the native font object
-
isLookupFontSupported
public boolean isLookupFontSupported()Indicates whether loading a font by a string is supported by the platform
Returns
true if the platform supports font lookup
-
minimizeApplication
public boolean minimizeApplication()Minimizes the current application if minimization is supported by the platform (may fail). Returns false if minimization failed.
Returns
false if minimization failed true if it succeeded or seems to be successful
-
restoreMinimizedApplication
public void restoreMinimizedApplication()Restore the minimized application if minimization is supported by the platform -
isMinimized
public boolean isMinimized()Indicates whether an application is minimized
Returns
true if the application is minimized
-
cacheRadialGradients
protected boolean cacheRadialGradients()Indicates whether the implementation is interested in caching radial gradients for drawing.
Returns
true to activate radial gradient caching
-
cacheLinearGradients
protected boolean cacheLinearGradients()Indicates whether the implementation is interested in caching linear gradients for drawing.
Returns
true to activate linear gradient caching
-
isThirdSoftButton
public boolean isThirdSoftButton()Indicates the default status to apply to the 3rd softbutton variable
Returns
true if the 3rd softbutton should be set as true
See also
-
com.codename1.ui.Display#isThirdSoftButton()
-
com.codename1.ui.Display#setThirdSoftButton()
-
-
getDragPathLength
public int getDragPathLength()Indicates how many drag points are used to calculate dragging speed
Returns
the size of points to calculate the speed
-
getDragPathTime
public int getDragPathTime()Indicates what drag points are valid for the drag speed calculation. Points that are older then the current time - the path time are ignored
Returns
the relevance time per point
-
getDragSpeed
public float getDragSpeed(float[] points, long[] dragPathTime, int dragPathOffset, int dragPathLength) This method returns the dragging speed based on the latest dragged events
Parameters
-
points: array of locations -
dragPathTime: the time difference between each point -
dragPathOffset: the offset in the arrays -
dragPathLength
-
-
isBidiAlgorithm
public boolean isBidiAlgorithm()Indicates whether Codename One should consider the bidi RTL algorithm when drawing text or navigating with the text field cursor.
Returns
true if the bidi algorithm should be considered
-
setBidiAlgorithm
public void setBidiAlgorithm(boolean activate) Indicates whether Codename One should consider the bidi RTL algorithm when drawing text or navigating with the text field cursor.
Parameters
activate: @param activate set to true to activate the bidi algorithm, false to disable it
-
convertBidiLogicalToVisual
Converts the given string from logical bidi layout to visual bidi layout so it can be rendered properly on the screen. This method is only necessary for devices/platforms that don't have "built in" bidi support such as Sony Ericsson devices. See this for more on visual vs. logical ordering.
Parameters
s: a "logical" string with RTL characters
Returns
a "visual" renderable string
-
getCharLocation
Returns the index of the given char within the source string, the actual index isn't necessarily the same when bidi is involved See this for more on visual vs. logical ordering.
Parameters
-
source: the string in which we are looking for the position -
index: the "logical" location of the cursor
Returns
the "visual" location of the cursor
-
-
isRTLOrWhitespace
public boolean isRTLOrWhitespace(char c) Returns true if the given character is an RTL character or a space character
Parameters
c: character to test
Returns
true if bidi is active and this is a
-
isRTL
public boolean isRTL(char c) Returns true if the given character is an RTL character
Parameters
c: character to test
Returns
true if the charcter is an RTL character
-
getResourceAsStream
This method is essentially equivalent to cls.getResourceAsStream(String) however some platforms might define unique ways in which to load resources within the implementation.
Parameters
-
cls: class to load the resource from -
resource: relative/absolute URL based on the Java convention
Returns
input stream for the resource or null if not found
-
-
isAnimation
Animations should return true to allow the native image animation to update
Parameters
nativeImage: underlying native imae
Returns
true if this is an animation
-
createNativePeer
Creates a peer component for the given lightweight component
Parameters
nativeComponent: a platform specific "native component"
Returns
- Returns:
- a Codename One peer component that can be manipulated just like any other Codename One component but would internally encapsulate the given native peer
-
showNativeScreen
Shows a native Form/Canvas or some other heavyweight native screen
Parameters
nativeFullScreenPeer: the native screen peer
-
setNativeCommands
Places the following commands on the native menu system
Parameters
commands: the Codename One commands to use
-
exitApplication
public void exitApplication()Exits the application... -
exit
public void exit()Exits the application... -
getProperty
Returns the property from the underlying platform deployment or the default value if no deployment values are supported. This is equivalent to the getAppProperty from the jad file.
The implementation should be responsible for the following keys to return reasonable valid values for the application:
-
AppName
-
User-Agent - ideally although not required
-
AppVersion
-
Platform - Similar to microedition.platform
Parameters
-
key: the key of the property -
defaultValue: a default return value
Returns
the value of the property
-
-
canExecute
Returns true if executing this URL should work, returns false if it will not and null if this is unknown.
Parameters
url: the url that would be executed
Returns
- Returns:
- true if executing this URL should work, returns false if it will not and null if this is unknown
-
execute
Executes the given URL on the native platform
Parameters
url: the url to execute
-
execute
Executes the given URL on the native platform, this method is useful if the platform has the ability to send an event to the app when the execution has ended, currently this works only for Android platform to invoke other intents.
Parameters
-
url: the url to execute -
response: @param response a callback from the platform when this execution returned to the application
-
-
getDeviceDensity
public int getDeviceDensity()Returns one of the density variables appropriate for this device, notice that density doesn't always correspond to resolution and an implementation might decide to change the density based on DPI constraints.
Returns
one of the DENSITY constants of Display
-
getDisplaySafeArea
This method returns a rectangle defining the "safe" area of the display, which excludes areas on the screen that are covered by notches, task bars, rounded corners, etc.
This feature was primarily added to deal with the task bar on the iPhone X, which is displayed on the screen near the bottom edge, and can interfere with components that are laid out at the bottom of the screen.
Most platforms will simply return a Rectangle with bounds (0, 0, displayWidth, displayHeight). iPhone X will return a rectangle that excludes the notch, and task bar regions.
Parameters
rect: Out parameter where safe bounds are set.
Returns
The same rectangle that was passed as a parameter.
Since
7.0
See also
- Form#getSafeArea()
-
playBuiltinSound
Plays a builtin device sound matching the given identifier, implementations and themes can offer additional identifiers to the ones that are already built in.
Parameters
soundIdentifier: @param soundIdentifier the sound identifier which can match one of the common constants in this class or be a user/implementation defined sound
-
playUserSound
Plays a sound defined by the user
Parameters
soundIdentifier: @param soundIdentifier the sound identifier which can match one of the common constants in this class or be a user/implementation defined sound
-
playNativeBuiltinSound
This method allows implementations to store sound objects natively e.g. in files, byte arrays whatever
Parameters
data: native data object
-
convertBuiltinSound
Converts a sound object to a form which will be easy for the implementation to play later on. E.g. a byte array or a file/file name and return an object that will allow playNativeBuiltinSound() to use
Parameters
i: stream containing a sound file
Returns
native playback object
Throws
java.io.IOException: thrown by the stream
- Throws:
IOException
-
installBuiltinSound
Installs a replacement sound as the builtin sound responsible for the given sound identifier (this will override the system sound if such a sound exists).
Parameters
-
soundIdentifier: the sound string passed to playBuiltinSound -
data: @param data an input stream containing platform specific audio file, its usually safe to assume that wav/mp3 would be supported.
Throws
IOException: if the stream throws an exception
- Throws:
IOException
-
-
isBuiltinSoundAvailable
Indicates whether a user installed or system sound is available
Parameters
soundIdentifier: the sound string passed to playBuiltinSound
Returns
true if a sound of this given type is avilable
-
isBuiltinSoundsEnabled
public boolean isBuiltinSoundsEnabled()Allows muting/unmuting the builtin sounds easily
Returns
true if the sound is not muted
-
setBuiltinSoundsEnabled
public void setBuiltinSoundsEnabled(boolean enabled) Allows muting/unmuting the builtin sounds easily
Parameters
enabled: indicates whether the sound is muted
-
createMedia
Plays the sound in the given URI which is partially platform specific.
Parameters
-
uri: the platform specific location for the sound -
onCompletion: invoked when the audio file finishes playing, may be null
Returns
a handle that can be used to control the playback of the audio
Throws
java.io.IOException: if the URI access fails
- Throws:
IOException
-
-
createMediaAsync
Creates media asynchronously.
Parameters
-
uri: the platform specific location for the sound -
onCompletion: invoked when the audio file finishes playing, may be null
Returns
a handle that can be used to control the playback of the audio
See also
- #createMedia(java.lang.String, boolean, java.lang.Runnable)
-
-
addCompletionHandler
Adds a callback to a Media element that will be called when the media finishes playing.
Parameters
-
media: The media to add the callback to. -
onCompletion: The callback that will run on the EDT when the playback completes.
See also
-
#removeCompletionHandler(com.codename1.media.Media, java.lang.Runnable)
-
Display#addCompletionHandler(com.codename1.media.Media, java.lang.Runnable)
-
-
removeCompletionHandler
Removes onComplete callback from Media element.
Parameters
-
media: The media element. -
onCompletion: The callback.
See also
-
#addCompletionHandler(com.codename1.media.Media, java.lang.Runnable)
-
Display#removeCompletionHandler(com.codename1.media.Media, java.lang.Runnable)
-
-
createMedia
public Media createMedia(InputStream stream, String mimeType, Runnable onCompletion) throws IOException Plays the sound in the given stream
Parameters
-
stream: the stream containing the media data -
mimeType: the type of the data in the stream -
onCompletion: invoked when the audio file finishes playing, may be null
Returns
a handle that can be used to control the playback of the audio
Throws
java.io.IOException: if the URI access fails
See also
- #createMediaAsync(java.io.InputStream, java.lang.String, java.lang.Runnable)
- Throws:
IOException
-
-
createMediaAsync
public AsyncResource<Media> createMediaAsync(InputStream stream, String mimeType, Runnable onCompletion) Creates media asynchronously.
Parameters
-
stream: the stream containing the media data -
mimeType: the type of the data in the stream -
onCompletion: invoked when the audio file finishes playing, may be null
Returns
a handle that can be used to control the playback of the audio
Since
7.0
See also
- #createMedia(java.io.InputStream, java.lang.String, java.lang.Runnable)
-
-
createBackgroundMedia
Creates an audio media that can be played in the background.
Parameters
uri: @param uri the uri of the media can start with jar://, file://, http:// (can also use rtsp:// if supported on the platform)
Returns
- Returns:
Media a Media Object that can be used to control the playback of the media
Throws
IOException: if creation of media from the given URI has failed
- Throws:
IOException
-
createBackgroundMediaAsync
Creates an audio media that can be played in the background.
This is run asynchronously so that this call does not block.
Parameters
uri: @param uri the uri of the media can start with jar://, file://, http:// (can also use rtsp:// if supported on the platform)
Returns
- Returns:
Media a Media Object that can be used to control the playback of the media
Throws
IOException: if creation of media from the given URI has failed
-
createSoftWeakRef
Creates a soft/weak reference to an object that allows it to be collected yet caches it. This method is in the porting layer since CLDC only includes weak references while some platforms include nothing at all and some include the superior soft references.
Parameters
o: object to cache
Returns
a caching object or null if caching isn't supported
-
extractHardRef
-
notifyCommandBehavior
public void notifyCommandBehavior(int commandBehavior) This method notifies the implementation about the chosen commands behavior
Parameters
commandBehavior: see Display.COMMAND_BEHAVIOR...
-
hasNativeTheme
public boolean hasNativeTheme()Indicates if the implemenetation has a native underlying theme
Returns
true if the implementation has a native theme available
-
installNativeTheme
public void installNativeTheme()Installs the native theme, this is only applicable if hasNativeTheme() returned true. Notice that this method might replace the DefaultLookAndFeel instance and the default transitions. -
copyToClipboard
Performs a clipboard copy operation, if the native clipboard is supported by the implementation it would be used
Parameters
obj: @param obj object to copy, while this can be any arbitrary object it is recommended that only Strings or Codename One image objects be used to copy
-
getPasteDataFromClipboard
Returns the current content of the clipboard
Returns
can be any object or null see copyToClipboard
-
isPortrait
public boolean isPortrait()Returns true if the device is currently in portrait mode
Returns
true if the device is in portrait mode
-
canForceOrientation
public boolean canForceOrientation()Returns true if the device allows forcing the orientation via code, feature phones do not allow this although some include a jad property allowing for this feature
Returns
true if lockOrientation would work
-
lockOrientation
public void lockOrientation(boolean portrait) On devices that return true for canForceOrientation() this method can lock the device orientation either to portrait or landscape mode
Parameters
portrait: true to lock to portrait mode, false to lock to landscape mode
-
unlockOrientation
public void unlockOrientation()This is the reverse method for lock orientation allowing orientation lock to be disabled -
isNativeBrowserComponentSupported
public boolean isNativeBrowserComponentSupported()An implementation can return true if it supports embedding a native browser widget
Returns
true if the implementation supports embedding a native browser widget
-
setPinchToZoomEnabled
Some platforms require that you enable pinch to zoom explicitly. This method has no effect if pinch to zoom isn't supported by the platform
Parameters
-
browserPeer: browser instance -
e: true to enable pinch to zoom, false to disable it
-
-
setNativeBrowserScrollingEnabled
Allows disabling the browsers native scrolling on devices that support it
Parameters
-
browserPeer: browser instance -
e: true to enables scrolling and false disables it
-
-
createBrowserComponent
If the implementation supports the creation of a browser component it should be returned in this method
Parameters
browserComponent: instance of the browser component thru which events should be fired
Returns
an instance of the native browser peer or null
-
postMessage
Posts a message to the window in a BrowserComponent. This is intended to be an abstraction of the Javascript postMessage() API.
This is only overridden by the Javascript port to provide proper CORS handling. Other ports use the implementation in BrowserComponent.
Web pages wishing to receive messages via this mechanism should register a "message" event listener. See Javascript postMessage() docs for more details about this.
Parameters
-
browserComponent: The browser component peer. -
message: The message to send -
targetOrigin: The target origin for the message.
Returns
True if the implementation handled the message. False to let BrowserComponent handle it in its default way.
Since
7.0
See also
-
BrowserComponent#postMessage(java.lang.String, java.lang.String)
-
#installMessageListener(java.lang.Object)
-
#uninstallMessageListener(java.lang.Object)
-
-
installMessageListener
Installs a message listener to allow webpages inside a browser component to send messages to CN1 cross-domain.
This will be overridden by the Javascript port only to handle CORS. Other ports use the default implementation in
BrowserComponent.Parameters
browserComponent: The browser component peer.
Returns
True if a message listener was installed. False otherwise.
See also
-
#postMessage(java.lang.Object, java.lang.String, java.lang.String)
-
BrowserComponent#onMessage
-
BrowserComponent#postMessage(java.lang.String, java.lang.String)
-
uninstallMessageListener
Uninstalls a message listener to allow webpages inside a browser component to send messages to CN1 cross-domain.
This will be overridden by the Javascript port only to handle CORS. Other ports use the default implementation in
BrowserComponent.Parameters
browserComponent: The browser component peer.
Returns
True if a message listener was installed. False otherwise.
See also
-
#postMessage(java.lang.Object, java.lang.String, java.lang.String)
-
BrowserComponent#onMessage
-
BrowserComponent#postMessage(java.lang.String, java.lang.String)
-
createNativeOverlay
Creates a native overlay for the given component. A native overlay is a native component that is always present over the given component. It can be used to help processing user events in a more native way. In the Javascript port, native overlays are used on TextFields, for example, so that users can tap on the text field and activate the keyboard. This was necessary because iOS doesn't allow us to programmatically activate the keyboard. Without a native overlay, the user would first have to tap the lightweight keyboard - upon which we create a native text field, and then the user would have to tap again to activate the keyboard. Using native overlays in that case yields better UX.
When using native overlays, you will need to implement
#createNativeOverlay(com.codename1.ui.Component),java.lang.Object), andjava.lang.Object).#createNativeOverlay(com.codename1.ui.Component)is called inComponent#initComponent()(i.e. when the component is added to the form). This is where you would create the native view and add it to the native view hierarchy above the CN1 canvas.java.lang.Object)is called inComponent#laidOut()(i.e. when the component is resized/positioned). This is where you can reposition the native view or change its properties to be appropriate for the "occasion".java.lang.Object)is called inComponent#deinitialize()(i.e. when the component is removed from the form). You should destroy the native view and remove it from the native view hierarchy here.Parameters
cmp: The component to create the overlay for.
Returns
A native object. The object type/format is decided by the implementation.
See also
-
#hideNativeOverlay(com.codename1.ui.Component, java.lang.Object)
-
#updateNativeOverlay(com.codename1.ui.Component, java.lang.Object)
-
Component#showNativeOverlay()
-
hideNativeOverlay
Hides the native overlay for a component.
Parameters
-
cmp: The component -
nativeOverlay: The native overlay.
See also
-
#createNativeOverlay(com.codename1.ui.Component)
-
#updateNativeOverlay(com.codename1.ui.Component, java.lang.Object)
-
Component#hideNativeOverlay()
-
-
updateNativeOverlay
Updates the native overlay after the component has been repositioned.
Parameters
-
cmp: The component -
nativeOverlay: The native overlay
See also
-
#createNativeOverlay(com.codename1.ui.Component)
-
#hideNativeOverlay(com.codename1.ui.Component, java.lang.Object)
-
Component#updateNativeOverlay()
-
-
setBrowserProperty
This method allows customizing the properties of a web view in various ways including platform specific settings. When a property isn't supported by a specific platform it is just ignored.
Parameters
-
browserPeer: browser instance -
key: see the documentation with the Codename One Implementation for further details -
value: see the documentation with the Codename One Implementation for further details
-
-
getBrowserTitle
The page title
Parameters
browserPeer: browser instance
Returns
the title
-
getBrowserURL
The page URL
Parameters
browserPeer: browser instance
Returns
the URL
-
captureBrowserScreenshot
Captures a screenshot from a browser component asynchronously.
Parameters
browserPeer: The browser instance
Returns
- Returns:
AsyncResource resolving to an image of the snapshot. If this returns null, then
BrowserComponent#captureScreenshot()will just useComponent#toImage()for screenshots.Since
7.0
-
setBrowserPageInHierarchy
Sets a relative URL from the html hierarchy
Parameters
-
browserPeer: the peer component -
url: the url relative to the HTML directory
- Throws:
IOException
-
-
setBrowserURL
Sets the page URL, jar: URL's must be supported by the implementation
Parameters
-
browserPeer: browser instance -
url: the URL -
headers: custom headers for the request URL
-
-
isURLWithCustomHeadersSupported
public boolean isURLWithCustomHeadersSupported()Returns true if setBrowserURL with custom headers is supported
Returns
returns false by default
-
setBrowserURL
Sets the page URL, jar: URL's must be supported by the implementation
Parameters
-
browserPeer: browser instance -
url: the URL
-
-
browserReload
Reload the current page
Parameters
browserPeer: browser instance
-
browserHasBack
Indicates whether back is currently available
Parameters
browserPeer: browser instance
Returns
true if back should work
-
browserHasForward
Indicates whether forward is currently available
Parameters
browserPeer: browser instance
Returns
true if forward should work
-
browserBack
Navigates back in the history
Parameters
browserPeer: browser instance
-
browserStop
Stops loading the current page
Parameters
browserPeer: browser instance
-
browserDestroy
Release browser native resources
Parameters
internal: browser instance
-
browserForward
Navigates forward in the history
Parameters
browserPeer: browser instance
-
browserClearHistory
Clears navigation history
Parameters
browserPeer: browser instance
-
setBrowserPage
Shows the given HTML in the native viewer
Parameters
-
browserPeer: browser instance -
html: HTML web page -
baseUrl: base URL to associate with the HTML
-
-
browserExecute
Executes the given JavaScript string within the current context
Parameters
-
browserPeer: browser instance -
javaScript: the JavaScript string
-
-
browserExecuteAndReturnString
Executes javascript and returns string. The default implementation just wraps the browserExecute() method that doesn't return anything. It will return null always. You need to override this in the native implementation to return meaningful values.
Parameters
-
internal: The peer browser component. -
javaScript: The javascript to execute.
Returns
String result of the javascript expression.
-
-
supportsBrowserExecuteAndReturnString
-
browserExposeInJavaScript
Allows exposing the given object to JavaScript code so the JavaScript code can invoke methods and access fields on the given object. Notice that on RIM devices which don't support reflection this object must implement the propriatery Scriptable interface http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/script/Scriptable.html
Parameters
-
browserPeer: browser instance -
o: the object to invoke, notice all public fields and methods would be exposed to JavaScript -
name: the name to expose within JavaScript
Deprecated
-
-
convertToPixels
public int convertToPixels(int dipCount, boolean horizontal) Converts the dips count to pixels, dips are roughly 1mm in length. This is a very rough estimate and not to be relied upon
Parameters
-
dipCount: the dips that we will convert to pixels -
horizontal: indicates pixels in the horizontal plane
Returns
value in pixels
-
-
isTablet
public boolean isTablet()Indicates whether the device is a tablet, notice that this is often a guess
Returns
true if the device is assumed to be a tablet
-
isDesktop
public boolean isDesktop()Returns true if this is a desktop application
Returns
true if this is a desktop application
-
canDial
public boolean canDial()Returns true if the device has dialing capabilities
Returns
false if it cannot dial
-
setThreadPriority
Allows an implementation to modify setting thread priority, some implementations don't handle thread priorities well
Parameters
-
t: the thread -
p: the priority
-
-
postInit
public void postInit()Callback allowing the implementation to perform an operation on the init thread after initialization was completed -
initDefaultUserAgent
protected void initDefaultUserAgent()Some old platforms might need this but for modern platforms the user agent should "just work". -
setImageName
-
areMutableImagesFast
public boolean areMutableImagesFast()On most platforms it is quite fast to draw on a mutable image and then render that image, however some platforms have much slower mutable images in comparison to just drawing on the screen. These platforms should return false here and Codename One will try to use less mutable image related optimizations in transitions and other operations.
Returns
true if mutable images are fast on this platform
-
removeCookiesForDomain
-
addCookie
-
isNativeCookieSharingSupported
public boolean isNativeCookieSharingSupported()Checks if this platform supports sharing cookies between Native components (e.g. BrowserComponent) and ConnectionRequests. Currently only Android and iOS ports support this.
Returns
True if platform supports native cookie sharing.
Since
8.0
-
addCookie
Adds/replaces a cookie to be sent to the given domain
Parameters
c: cookie to add
-
getURLDomain
-
getURLPath
-
getCookiesForURL
-
clearNativeCookies
public void clearNativeCookies() -
connect
Connects to a given URL, returns a connection object to be used with the implementation later
Parameters
-
url: the URL to connect to -
read: indicates whether the connection will be read from -
write: indicates whether writing will occur into the connection
Returns
a URL instance
- Throws:
IOException
-
-
getSSLCertificates
Gets the SSL certificates for a connection
Parameters
-
connection: The connection. -
url: The url of the connection.
Returns
String array where each certificate is in form :
Throws
IOException
- Throws:
IOException
-
-
canGetSSLCertificates
public boolean canGetSSLCertificates()Checks if the platform supports getting SSL certificates.
Returns
True if the platform supports SSL certificates.
-
checkSSLCertificatesRequiresCallbackFromNative
public boolean checkSSLCertificatesRequiresCallbackFromNative()SSL certificate checks must be performed via a callback from the native side, rather than explicitly checking as part of NetworkManager's connection flow. This is mainly for iOS POST requests. If we try to get the SSL certs explicitly, it forces the connection to be sent without a POST body. Hence we need to let iOS do the check on the native side, and callback into Java to run the checkSSLCertificates method of the request.
Returns
True if the platform requires a native callback fo check SSL certificates
-
setConnectionId
-
addConnectionToQueue
This method is called by the NetworkManager when a request is added to the queue. This allows the implementation to track the time that the request was queued for diagnostics purposes. The Simulator's Network monitor uses this information to display stats about each network connection.
Parameters
req: The ConnectionRequest that is queued.
-
connect
Connects to a given URL, returns a connection object to be used with the implementation later
Parameters
-
url: the URL to connect to -
read: indicates whether the connection will be read from -
write: indicates whether writing will occur into the connection -
timeout: the timeout version of this method
Returns
a URL instance
- Throws:
IOException
-
-
setHttpMethod
Requests special http method such as put or delete
Parameters
-
connection: the connection object -
method: the method string
- Throws:
IOException
-
-
setHeader
-
setChunkedStreamingMode
This method is used to enable streaming of a HTTP request body without internal buffering, when the content length is not known in advance. In this mode, chunked transfer encoding is used to send the request body. Note, not all HTTP servers support this mode. This mode is supported on Android and the Desktop ports.
Parameters
-
connection: the connection object -
bufferLen: @param bufferLen The number of bytes to write in each chunk. If chunklen is less than or equal to zero, a default value will be used.
-
-
cleanup
Closes the object (connection, stream etc.) without throwing any exception, even if the object is null
Parameters
o: Connection, Stream or other closeable object
-
isSetCursorSupported
public boolean isSetCursorSupported()Checks if this platform supports custom cursors.
Returns
True if the platform supports custom cursors.
See also
-
Form#setEnableCursors(boolean)
-
Component#setCursor(int)
-
ComponentSelector#setCursor(int)
-
-
getContentLength
Returns the content length for this connection
Parameters
connection: the connection
Returns
the content length
-
openOutputStream
Returns an output stream for the given connection
Parameters
connection: the connection to open an output stream on
Returns
the created output stream
Throws
IOException: thrown by underlying implemnetation
- Throws:
IOException
-
openOutputStream
Returns an output stream for the given connection
Parameters
-
connection: the connection to open an output stream on -
offset: position in the file
Returns
the created output stream
Throws
IOException: thrown by underlying implemnetation
- Throws:
IOException
-
-
openInputStream
Returns an input stream for the given connection
Parameters
connection: the connection to open an input stream on
Returns
the created input stream
Throws
IOException: thrown by underlying implemnetation
- Throws:
IOException
-
openFileOutputStream
Returns an output stream for the given file
Parameters
file: the file to which we should open a stream
Returns
the created output stream
Throws
IOException: thrown by underlying implemnetation
- Throws:
IOException
-
openFileInputStream
Returns an input stream for the given connection
Parameters
file: the file to which we should open a stream
Returns
the created input stream
Throws
IOException: thrown by underlying implemnetation
- Throws:
IOException
-
setPostRequest
Indicates the whether the request method is GET or POST
Parameters
-
connection: the connection object -
p: true for post false for get
-
-
getResponseCode
Returns the server response code for the request
Parameters
connection: the connection object
Returns
a numeric HTTP response code
Throws
IOException: if the request failed
- Throws:
IOException
-
getResponseMessage
Returns the server response message for the request
Parameters
connection: the connection object
Returns
a text message to go along with the response code
Throws
IOException: if the request failed
- Throws:
IOException
-
getHeaderField
Returns the HTTP response header field
Parameters
-
name: field name for http header -
connection: the connection object
Returns
the value of the header field
Throws
IOException: if the request failed
- Throws:
IOException
-
-
getHeaderFieldNames
Returns the HTTP response header field
Parameters
connection: the connection object
Returns
the value of the header field
Throws
IOException: if the request failed
- Throws:
IOException
-
getHeaderFields
Returns the HTTP response header fields, returns optionally more than one result or null if no field is present.
Parameters
-
name: field name for http header -
connection: the connection object
Returns
the values of the header fields
Throws
IOException: if the request failed
- Throws:
IOException
-
-
isTimeoutSupported
public boolean isTimeoutSupported()Indicates whether the underlying implementation supports the notion of a network operation timeout. If not timeout is "faked"
Returns
true if HTTP timeout can be configured for this IO implementation
-
setTimeout
public void setTimeout(int t) This will work only if http timeout is supported
Parameters
t: time in milliseconds
-
flushStorageCache
public void flushStorageCache()Flush the storage cache allowing implementations that cache storage objects to store -
getStorageData
The storage data is used by some storage implementations (e.g. CDC) to place the storage object in a "proper" location matching the application name. This needs to be set by the user, the name might be ignored in platforms (such as MIDP) where storage is mapped to a native application specific storage.
Returns
the name for the storage
-
setStorageData
The storage data is used by some storage implementations (e.g. CDC) to place the storage object in a "proper" location matching the application name. This needs to be set by the user, the name might be ignored in platforms (such as MIDP) where storage is mapped to a native application specific storage.
Parameters
storageData: the name for the storage or its context
-
deleteStorageFile
Deletes the given file name from the storage
Parameters
name: the name of the storage file
-
clearStorage
public void clearStorage()Deletes all the files in the application storage -
createStorageOutputStream
Creates an output stream to the storage with the given name
Parameters
name: the storage file name
Returns
an output stream of limited capcity
- Throws:
IOException
-
createStorageInputStream
Creates an input stream to the given storage source file
Parameters
name: the name of the source file
Returns
the input stream
- Throws:
IOException
-
storageFileExists
Returns true if the given storage file exists
Parameters
name: the storage file name
Returns
true if it exists
-
listStorageEntries
Lists the names of the storage files
Returns
the names of all the storage files
-
getStorageEntrySize
Returns the size of the entry in bytes
Parameters
name: the entry name
Returns
the size
-
listFilesystemRoots
Returns the filesystem roots from which the structure of the file system can be traversed
Returns
the roots of the filesystem
-
listFiles
Lists the files within the given directory, returns relative file names and not full file names.
Parameters
directory: the directory in which files should be listed
Returns
array of file names
- Throws:
IOException
-
getRootSizeBytes
Returns the size of the given root directory
Parameters
root: the root directory in the filesystem
Returns
the byte size of the directory
-
getRootAvailableSpace
Returns the available space in the given root directory
Parameters
root: the root directory in the filesystem
Returns
the bytes available in the directory
-
mkdir
Creates the given directory
Parameters
directory: the directory name to create
-
deleteFile
Deletes the specific file or empty directory.
Parameters
file: file or empty directory to delete
-
isHidden
Indicates the hidden state of the file
Parameters
file: file
Returns
true for a hidden file
-
setHidden
Toggles the hidden state of the file
Parameters
-
file: file -
h: hidden state
-
-
getFileLength
Returns the length of the file
Parameters
file: file
Returns
length of said file
-
getFileLastModified
Returns the time that the file denoted by this abstract pathname was last modified.
Returns
- Returns:
- A long value representing the time the file was last modified, measured in milliseconds
-
isDirectory
Indicates whether the given file is a directory
Parameters
file: file
Returns
true if its a directory
-
exists
Indicates whether the given file exists
Parameters
file: file
Returns
true if it exists
-
rename
-
getFileSystemSeparator
public abstract char getFileSystemSeparator()Returns the file system separator char normally '/'
Returns
the separator char
-
getLineSeparator
-
isAPSupported
public boolean isAPSupported()Indicates whether looking up an access point is supported by this device
Returns
true if access point lookup is supported
-
getAPIds
Returns the ids of the access points available if supported
Returns
ids of access points
-
getAPType
Returns the type of the access point
Parameters
id: access point id
Returns
one of the supported access point types from network manager
-
getAPName
-
getCurrentAccessPoint
Returns the id of the current access point
Returns
id of the current access point
-
setCurrentAccessPoint
Returns the id of the current access point
Parameters
id: id of the current access point
-
isVPNDetectionSupported
public boolean isVPNDetectionSupported()Indicates whether this platform can attempt to detect active VPN usage.
The default implementation returns
false. Platforms that provide a best-effort VPN heuristic should override this method and#isVPNActive().Returns
trueif VPN detection is implemented on this platform. -
isVPNActive
public boolean isVPNActive()Best-effort check for whether a VPN appears to be active.
This API is intentionally heuristic and should not be used as a security boundary. False positives and false negatives are both possible, and some VPN products may avoid detection completely.
Returns
trueif the platform believes a VPN may be active. -
shouldWriteUTFAsGetBytes
public boolean shouldWriteUTFAsGetBytes()For some reason the standard code for writing UTF8 output in a server request doesn't work as expected on SE/CDC stacks.
Returns
true if the getBytes() approach should be used
-
startThread
-
closingOutput
Allows binding logic to occur before closing the output stream such as syncing
Parameters
s: the closing stream
-
printStackTraceToStream
-
setLogListener
This method is useful strictly for debugging, the logger can use it to track file opening/closing thus detecting potential file resource leaks that can cause serious problems in some OS's.
Parameters
al: action listener to receive the callback
-
isLogged
protected boolean isLogged()Indicates whether logging is turned on
Returns
true or false
-
log
Dispatch the message to the logger
Parameters
content: content of the message
-
systemOut
System print
Parameters
content
-
logStreamCreate
Logs the creation of a stream
Parameters
-
name: the name of the stream -
isInput: whether the stream is an input or output stream -
count: the number of streams of this type
-
-
logStreamClose
Logs the closing of a stream
Parameters
-
name: the name of the stream -
isInput: whether the stream is an input or output stream -
count: the number of streams of this type
-
-
logStreamDoubleClose
Logs the closing of a stream
Parameters
-
name: the name of the stream -
isInput: whether the stream is an input or output stream
-
-
getRootType
Returns the type of the root often by guessing
Parameters
root: the root whose type we are checking
Returns
one of the type constants above
-
getLocationManager
This method returns the platform Location Control
Returns
LocationManager Object
-
releaseImage
Allows buggy implementations (Android) to release image objects
Parameters
image: native image object
-
capturePhoto
Captures a photo and notifies with the image data when available
Parameters
response: callback for the resulting image
-
captureScreen
Captures a screenshot of the screen.
Returns
An image of the screen, or null if it failed.
Since
7.0
Deprecated
replaced by screenshot()
-
captureAudio
-
captureAudio
public void captureAudio(MediaRecorderBuilder recordingOptions, ActionListener<ActionEvent> response) Captures a audio and notifies with the raw data when available
Parameters
response: callback for the resulting data
-
captureVideo
Captures a video and notifies with the data when available
Parameters
response: callback for the resulting video
-
captureVideo
Captures a video, and notifies with the data when available. This version accepts capture constraints which may be used if the platform supports them.
Parameters
-
constraints: Constraints for the capture. -
response: Callback for the resulting video.
Since
7.0
See also
- com.codename1.capture.Capture#captureVideo(com.codename1.capture.VideoCaptureConstraints, com.codename1.ui.events.ActionListener)
-
-
isGalleryTypeSupported
public boolean isGalleryTypeSupported(int type) Checks if the given gallery type is supported on this platform.
Parameters
type: A gallery type constant. E.g.CN1Constants#GALLERY_IMAGE,CN1Constants#GALLERY_VIDEO,CN1Constants#GALLERY_ALL,CN1Constants#GALLERY_IMAGE_MULTI,CN1Constants#GALLERY_VIDEO_MULTI,CN1Constants#GALLERY_ALL_MULTI
Returns
True if the gallery type is supported on this platform.
-
openGallery
Opens the device gallery The method returns immediately and the response will be sent asynchronously to the given ActionListener Object
use this in the actionPerformed to retrieve the file path String path = (String) evt.getSource();
Parameters
-
response: a callback Object to retrieve the file path -
type: one of the following GALLERY_IMAGE, GALLERY_VIDEO, GALLERY_ALL
Throws
RuntimeException: if this feature failed or unsupported on the platform
-
-
openImageGallery
Opens the device image gallery
Parameters
response: callback for the resulting image
-
getPlatformName
Returns a 2-3 letter code representing the platform name for the platform override
Returns
the name of the platform e.g. ios, rim, win, and, me
-
getPlatformOverrides
Returns the suffixes for ovr files that should be used when loading a layered resource file on this platform
Returns
a string array with the proper order of resource override layers
-
shouldAutoDetectAccessPoint
public boolean shouldAutoDetectAccessPoint()This callback allows highly broken devices like the blackberry to automatically detect the network type -
sendMessage
-
dial
Opens the device Dialer application with the given phone number
Parameters
phoneNumber
-
isCallDetectionSupported
public boolean isCallDetectionSupported()Indicates whether this platform can attempt to detect when an active phone call is interrupting the app.
The default implementation returns
false. Platforms with a best-effort call interruption heuristic should override this method and#isInCall().Returns
trueif call detection is implemented on this platform. -
isInCall
public boolean isInCall()Best-effort check for whether the platform believes a phone call is active.
This API is intentionally heuristic and should not be treated as a reliable telephony state machine. Depending on platform restrictions it may report false positives (e.g. other interruptions that temporarily move the app out of the foreground) and false negatives (e.g. calls that are never surfaced to the app lifecycle).
Returns
trueif the platform currently believes a phone call interruption is active. -
sendSMS
Sends a SMS message to the given phone number
Parameters
-
phoneNumber: to send the sms -
message: the content of the sms
Throws
IOException: if for some reason sending failed
- Throws:
IOException
-
-
getSMSSupport
public int getSMSSupport()Indicates the level of SMS support in the platform as one of: SMS_NOT_SUPPORTED (for desktop, tablet etc.), SMS_SEAMLESS (no UI interaction), SMS_INTERACTIVE (with compose UI), SMS_BOTH.
Returns
one of the SMS_* values
-
getApplicationIconImage
Returns an image representing the application icon, or null if not supported. This is used on Android to support the title bar icon -
getAllContacts
Gets all contacts from the address book of the device
Parameters
withNumbers: if true returns only contacts that has a number
Returns
array of contacts unique ids
-
getLinkedContactIds
-
getContactById
-
getAllContacts
public Contact[] getAllContacts(boolean withNumbers, boolean includesFullName, boolean includesPicture, boolean includesNumbers, boolean includesEmail, boolean includeAddress) Notice: this method might be very slow and should be invoked on a separate thread! It might have platform specific optimizations over getAllContacts followed by looping over individual contacts but that isn't guaranteed. See isGetAllContactsFast for information.
Parameters
-
withNumbers: if true returns only contacts that has a number -
includesFullName: if true try to fetch the full name of the Contact(not just display name) -
includesPicture: if true try to fetch the Contact Picture if exists -
includesNumbers: if true try to fetch all Contact numbers -
includesEmail: if true try to fetch all Contact Emails -
includeAddress: if true try to fetch all Contact Addresses
Returns
array of the contacts
-
-
isGetAllContactsFast
public boolean isGetAllContactsFast()Indicates if the getAllContacts is platform optimized, notice that the method might still take seconds or more to run so you should still use a separate thread!
Returns
true if getAllContacts will perform faster that just getting each contact
-
getContactById
public Contact getContactById(String id, boolean includesFullName, boolean includesPicture, boolean includesNumbers, boolean includesEmail, boolean includeAddress) This method returns a Contact by the contact id and fills it's data according to the given flags
Parameters
-
id: of the Contact -
includesFullName: if true try to fetch the full name of the Contact(not just display name) -
includesPicture: if true try to fetch the Contact Picture if exists -
includesNumbers: if true try to fetch all Contact numbers -
includesEmail: if ture try to fetch all Contact Emails -
includeAddress: if ture try to fetch all Contact Addresses
Returns
a Contact Object
-
-
createContact
public String createContact(String firstName, String surname, String officePhone, String homePhone, String cellPhone, String email) Create a contact to the device contacts book
Parameters
-
firstName: the Contact firstName -
surname: the Contact familyName -
officePhone: the Contact work phone or null -
homePhone: the Contact home phone or null -
cellPhone: the Contact mobile phone or null -
email: the Contact email or null
Returns
the contact id if creation succeeded or null if failed
-
-
isContactsPermissionGranted
public boolean isContactsPermissionGranted()Some platforms allow the user to block contacts access on a per application basis (specifically iOS).
Returns
true if contacts access is allowed or globally available, false otherwise
-
deleteContact
removed a contact from the device contacts book
Parameters
id: the contact id to remove
Returns
true if deletion succeeded false otherwise
-
beforeComponentPaint
-
afterComponentPaint
-
nothingWithinComponentPaint
Indicates to the port that the component won't be painted due to clipping
Parameters
c: the component that won't be painted
-
componentRemoved
Indicates to the port that the component was removed from the view and its UI should be removed in the next flush operation.
Parameters
c: the removed component.
-
getLocalizationManager
-
getPackageName
Returns the package name for the application -
isTransformSupported
public boolean isTransformSupported()Checks if the Transform class can be used on this platform. This is similar to
#isTransformSupported(java.lang.Object)but it is more general as it only verifies that transforms can be performed, but not necessarily that they will be respected by any particular graphics context.Returns
True if this platform supports transforms.
See also
- #isTransformSupported(java.lang.Object)
-
isPerspectiveTransformSupported
public boolean isPerspectiveTransformSupported()Checks of the Transform class can be used on this platform to perform perspective transforms. This is similar to
#isPerspectiveTransformSupported(java.lang.Object)but it is more general as it only verifies that transforms can be performed, but not necessarily that they will be respected by any particular graphics context.Returns
True if this platform supports perspective transforms.
-
transformEqualsImpl
-
transformNativeEqualsImpl
-
makeTransformTranslation
Makes a new native translation transform. Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format. This is used by the
com.codename1.ui.Transformclass.This can only be used if
#isTransformSupported()returns true.Parameters
-
translateX: The x-coordinate of the translation. -
translateY: The y-coordinate of the translation. -
translateZ: The z-coordinate of the translation.
Returns
A native transform object encapsulating the specified translation.
See also
- #isTransformSupported()
-
-
setTransformTranslation
public void setTransformTranslation(Object nativeTransform, float translateX, float translateY, float translateZ) -
makeTransformScale
Makes a new native scale transform. Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format. This is used by the
com.codename1.ui.Transformclass.This can only be used if
#isTransformSupported()returns true.Parameters
-
scaleX: The x-scale factor of the transform. -
scaleY: The y-scale factor of the transform. -
scaleZ: The z-scale factor of the transform.
Returns
A native transform object encapsulating the specified scale.
See also
- #isTransformSupported()
-
-
makeTransformAffine
public Object makeTransformAffine(double m00, double m10, double m01, double m11, double m02, double m12) Makes a transform given the specified AffineTransform values.
Parameters
-
m00: the X coordinate scaling element of the 3x3 matrix -
m10: the Y coordinate shearing element of the 3x3 matrix -
m01: the X coordinate shearing element of the 3x3 matrix -
m11: the Y coordinate scaling element of the 3x3 matrix -
m02: the X coordinate translation element of the 3x3 matrix -
m12: the Y coordinate translation element of the 3x3 matrix
Since
7.0
-
-
setTransformAffine
public void setTransformAffine(Object nativeTransform, double m00, double m10, double m01, double m11, double m02, double m12) Sets transform to the given specified AffineTransform values.
Parameters
-
nativeTransform: Platform-specific native transform. -
m00: the X coordinate scaling element of the 3x3 matrix -
m10: the Y coordinate shearing element of the 3x3 matrix -
m01: the X coordinate shearing element of the 3x3 matrix -
m11: the Y coordinate scaling element of the 3x3 matrix -
m02: the X coordinate translation element of the 3x3 matrix -
m12: the Y coordinate translation element of the 3x3 matrix
Since
7.0
-
-
setTransformScale
-
makeTransformRotation
Makes a new native rotation transform. Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format. This is used by the
com.codename1.ui.Transformclass.This can only be used if
#isTransformSupported()returns true.Parameters
-
angle: The angle to rotate. -
x: The x-component of the vector around which to rotate. -
y: The y-component of the vector around which to rotate. -
z: The z-component of the vector around which to rotate.
Returns
A native transform object encapsulating the specified rotation.
See also
- #isTransformSupported()
-
-
setTransformRotation
-
makeTransformPerspective
Makes a new perspective transform. Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format. This is used by the
com.codename1.ui.Transformclass.This can only be used if
#isPerspectiveTransformSupported()returns true.Parameters
-
fovy: The y field of view angle. -
aspect: The aspect ratio. -
zNear: The nearest visible z coordinate. -
zFar: The farthest z coordinate.
Returns
A native transform object encapsulating the given perspective.
See also
- #isPerspectiveTransformSupported()
-
-
setTransformPerspective
public void setTransformPerspective(Object nativeTransform, float fovy, float aspect, float zNear, float zFar) -
makeTransformOrtho
public Object makeTransformOrtho(float left, float right, float bottom, float top, float near, float far) Makes a new orthographic projection transform. Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format. This is used by the
com.codename1.ui.Transformclass.This can only be used if
#isPerspectiveTransformSupported()returns true.Parameters
-
left: x-coordinate that is the left edge of the view. -
right: The x-coordinate that is the right edge of the view. -
bottom: The y-coordinate that is the bottom edge of the view. -
top: The y-coordinate that is the top edge of the view. -
near: The nearest visible z-coordinate. -
far: The farthest visible z-coordinate.
Returns
A native transform with the provided orthographic projection.
See also
- #isPerspectiveTransformSupported()
-
-
setTransformOrtho
public void setTransformOrtho(Object nativeTransform, float left, float right, float bottom, float top, float near, float far) -
makeTransformCamera
public Object makeTransformCamera(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) Makes a transform to simulate a camera's perspective at a given location. Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format. This is used by the
com.codename1.ui.Transformclass.This can only be used if
#isTransformSupported()returns true.Parameters
-
eyeX: The x-coordinate of the camera's eye. -
eyeY: The y-coordinate of the camera's eye. -
eyeZ: The z-coordinate of the camera's eye. -
centerX: The center x coordinate of the view. -
centerY: The center y coordinate of the view. -
centerZ: The center z coordinate of the view. -
upX: The x-coordinate of the up vector for the camera. -
upY: The y-coordinate of the up vector for the camera. -
upZ: The z-coordinate of the up vector for the camera.
Returns
A native transform with the provided camera's view perspective.
See also
- #isPerspectiveTransformSupported()
-
-
setTransformCamera
public void setTransformCamera(Object nativeTransform, float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) -
transformRotate
Rotates the provided transform.
Parameters
nativeTransform: @param nativeTransform The transform to rotate. Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format. This is used by thecom.codename1.ui.Transformclass.
This can only be used if
#isTransformSupported()returns true.-
angle: The angle to rotate. -
x: The x-coordinate of the vector around which to rotate. -
y: The y-coordinate of the vector around which to rotate. -
z: The z-coordinate of the vector around which to rotate.
See also
- #isTransformSupported()
-
transformTranslate
Translates the transform by the specified amounts. with the specified translation.
Parameters
nativeTransform: @param nativeTransform The native transform to translate. Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format. This is used by thecom.codename1.ui.Transformclass.
This can only be used if
#isTransformSupported()returns true.-
x: The x translation. -
y: The y translation. -
z: The z translation.
See also
- #isTransformSupported()
-
transformScale
Scales the provided transform by the provide scale factors.
Parameters
nativeTransform: @param nativeTransform Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format. This is used by thecom.codename1.ui.Transformclass.
This can only be used if
#isTransformSupported()returns true.-
x: The x-scale factor -
y: The y-scale factor -
z: The z-scale factor
See also
- #isTransformSupported()
-
makeTransformInverse
Gets the inverse transformation for the provided transform.
Parameters
nativeTransform: @param nativeTransform The native transform of which to make the inverse. Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format. This is used by thecom.codename1.ui.Transformclass.
This can only be used if
#isTransformSupported()returns true.Returns
- Returns:
The inverse transform as a native transform object. Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format. This is used by the
com.codename1.ui.Transformclass.See also
- #isTransformSupported()
-
setTransformInverse
- Throws:
Transform.NotInvertibleException
-
makeTransformIdentity
Makes a new identity native transform. Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format. This is used by the
com.codename1.ui.Transformclass.This can only be used if
#isTransformSupported()returns true.Returns
An identity native transform.
See also
- #isTransformSupported()
-
setTransformIdentity
Sets the given native transform to the identiy transform
Parameters
transform
-
copyTransform
Copies the setting of one transform into another. Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format. This is used by the
com.codename1.ui.Transformclass.This can only be used if
#isTransformSupported()returns true.Parameters
-
src: The source native transform. -
dest: The destination native transform.
See also
- #isTransformSupported()
-
-
concatenateTransform
Concatenates two transforms and sets the first transform to be the result of the concatenation.
This can only be used if
#isTransformSupported()returns true.Parameters
-
t1: The left native transform. The result will also be stored in this transform. -
t2: The right native transform.
See also
- #isTransformSupported()
-
-
transformPoint
Transforms a point and stores the result in a provided array.
Parameters
nativeTransform: @param nativeTransform The native transform to use for the transformation. Each implementation can decide the format to use internally for transforms. This should return a transform in that internal format.
This can only be used if
#isTransformSupported()returns true.This is used by the
com.codename1.ui.Transformclass.-
in: A 2 or 3 element array representing either an (x,y) or (x,y,z) tuple to be transformed. -
out: A 2 or 3 element array (length should match ) to store the result of the transformation.
See also
- #isTransformSupported()
-
transformPoints
public void transformPoints(Object nativeTransform, int pointSize, float[] in, int srcPos, float[] out, int destPos, int numPoints) Transforms a set of points using the provided transform.
Parameters
-
nativeTransform: The transform to use for transforming the points -
pointSize: The size of the points (either 2 or 3) -
in: Input array of points. -
srcPos: The start position of the input array -
out: The output array of points -
destPos: The start position of the output array. -
numPoints: The number of points to transform.
-
-
translatePoints
public void translatePoints(int pointSize, float tX, float tY, float tZ, float[] in, int srcPos, float[] out, int destPos, int numPoints) Translates a set of points.
Parameters
-
pointSize: The size of each point (2 or 3) -
tX: Size of translation along x-axis -
tY: Size of translation along y-axis -
tZ: Size of translation along z-axis (only used if pointSize == 3) -
in: Input array of points. -
srcPos: Start position in input array -
out: Output array of points -
destPos: Start position in output array -
numPoints: Number of points to translate.
-
-
scalePoints
public void scalePoints(int pointSize, float sX, float sY, float sZ, float[] in, int srcPos, float[] out, int destPos, int numPoints) Scales a set of points.
Parameters
-
pointSize: The size of each point (2 or 3) -
sX: Scale factor along x-axis -
sY: Scale factor along y-axis -
sZ: Scale factor along z-axis (only used if pointSize == 3) -
in: Input array of points. -
srcPos: Start position in input array -
out: Output array of points -
destPos: Start position in output array -
numPoints: Number of points to translate.
-
-
refreshContacts
public void refreshContacts()Clears the addressbook cache. This is only necessary on iOS since its AddressBookRef is transactional. -
getTransform
-
isScrollWheeling
public boolean isScrollWheeling() -
blockCopyPaste
public void blockCopyPaste(boolean blockCopyPaste) Blocks or enables copy and paste in the entire app.
Parameters
blockCopyPaste: True to block copy and paste. False to enable it.
-
isDatabaseCustomPathSupported
public boolean isDatabaseCustomPathSupported()Checks if this platform supports custom database paths. On platforms where this returns true,
#openOrCreateDB(java.lang.String)will accept a file path (starting with "file://"Returns
True if platform supports custom paths.
-
requestFullScreen
public boolean requestFullScreen()Attempt to enter full-screen mode. Should be overridden by the platform implementation.
Returns
True if already in full-screen mode, or successfully entered full-screen mode.
-
exitFullScreen
public boolean exitFullScreen()Exit full-screen mode.
Returns
True if already not in full-screen mode or successfully exited full-screen mode.
-
isInFullScreenMode
public boolean isInFullScreenMode()Checks to see if the app is currently running in full-screen mode.
Returns
True if the app is currently running in full-screen mode.
-
isFullScreenSupported
public boolean isFullScreenSupported()Checks if the platform supports full-screen mode. If this returns true then a call to#requestFullScreen()should enter full-screen mode. -
initializeTextSelection
Initializes text selection. This provides an opportunity for the native platform to register listeners on text selection to ensure that it works.
Implementations that implement this method should also implement
#deinitializeTextSelection(com.codename1.ui.TextSelection)Parameters
aThis
Since
7.0
See also
- #deinitializeTextSelection(com.codename1.ui.TextSelection)
-
deinitializeTextSelection
Deinitializes text selection.
Parameters
aThis
Since
7.0
See also
- #initializeTextSelection(com.codename1.ui.TextSelection)
-
createHeavyButton
Creates the native side of a
com.codename1.ui.HeavyButton. A HeavyButton is a button that has a native button displayed over top of it. It is primarily used in the Javascript port where some functions can only be executed as a direct result of user interaction.Parameters
aThis: The lightweight button for which a heavy peer is created
Returns
Native peer. Format chosen by implementation.
Since
7.0
See also
- #addHeavyActionListener(java.lang.Object, com.codename1.ui.events.ActionListener)
-
addHeavyActionListener
Adds an action listener which will be run in response to the native button's click event.
ActionListener#actionPerformed(com.codename1.ui.events.ActionEvent)will be executed on the native UI thread, not the EDT.Parameters
-
peer: The peer. -
l: The action listener.
Since
7.0
See also
-
#createHeavyButton(com.codename1.ui.Button)
-
#removeHeavyActionListener(java.lang.Object, com.codename1.ui.events.ActionListener)
-
-
removeHeavyActionListener
Removes a heavy action listener from a heavy button.
Parameters
-
peer: THe heavy button peer. -
l: The action listener.
Since
7.0
See also
-
#addHeavyActionListener(java.lang.Object, com.codename1.ui.events.ActionListener)
-
#createHeavyButton(com.codename1.ui.Button)
-
-
updateHeavyButtonBounds
Updates the bounds of the native heavy button to match the bounds of the lightweight button.
Parameters
-
peer: The heavy peer. -
x: The absolute X coordinate of the light peer. -
y: The absolute Y coordinate of the light peer. -
width: The width of the light peer. -
height: The height of the light peer.
Since
7.0
-
-
initHeavyButton
Initializes a heavy button. This is called whenever the light peer's initComponent() method is called. It should add the heavy button to the native UI hierarchy.
Parameters
peer: The heavy peer.
Since
7.0
See also
- #createHeavyButton(com.codename1.ui.Button)
-
deinitializeHeavyButton
Deinitializes a heavy button. This is called whenever the light peer's deinitialize() method is called. It should remove the heavy button from the native UI hierarchy.
Parameters
peer: The heavy peer.
Since
7.0
See also
-
#initHeavyButton(java.lang.Object)
-
#createHeavyButton(com.codename1.ui.Button)
-
requiresHeavyButtonForCopyToClipboard
public boolean requiresHeavyButtonForCopyToClipboard()Checks whether the current platform requires a heavy button for copy to clipboard functionality to work. This will be true on the Javascript port.
Since
7.0
See also
- #createHeavyButton(com.codename1.ui.Button)
-
copySelectionToClipboard
Copies the current text selection to the clipboard.
Parameters
sel: The current TextSelection instance for the current form.
Since
7.0
-
setRenderingHints
Sets the rendering hints for a graphics context.
Parameters
-
nativeGraphics: The native graphics context -
hints: Hints
Since
7.0
See also
- Graphics#RENDERING_HINT_FAST
-
-
getRenderingHints
Gets the rendering hints for this graphics context
Parameters
nativeGraphics: The native graphics context.
Returns
The current rendering hints.
Since
7.0
See also
- Graphics#RENDERING_HINT_FAST
-
startRemoteControl
public void startRemoteControl()Starts the remote control service. This should be implemented in the platform to handle binding the
RemoteControlListenerwith the platform's remote control.This is executed when the user registers a new listener using
MediaManager#setRemoteControlListener(com.codename1.media.RemoteControlListener)Since
7.0
-
stopRemoteControl
public void stopRemoteControl()Stops the remote control service. This should be implemented in the platform to handle unbinding the
RemoteControlListenerwith the platform's remote control.This is executed when a new listener is registered using
MediaManager#setRemoteControlListener(com.codename1.media.RemoteControlListener)Since
7.0
-
setReadTimeout
Sets the read timeout of a connection.
Parameters
-
connection -
readTimeout
Since
7.0
-
-
setInsecure
Sets connection to be insecure. If platform supports it, this will turn off SSL cerficate checks for validity.
Parameters
-
connection -
insecure: True to make connection insecure.
Since
7.0
See also
-
ConnectionRequest#setInsecure(boolean)
-
ConnectionRequest#isInsecure()
-
-
isReadTimeoutSupported
public boolean isReadTimeoutSupported()Checks if this platform supports read timeout in network connections.
Returns
True if the platform supports read timeouts.
Since
7.0
-
createNativeBrowserWindow
Creates a native web browser window object. Default implementation returns null. Platform may override this to return its own browser window.
Parameters
startURL: The Start URL to open in the browser window.
Returns
The browser window object, or null.
Since
7.0
See also
-
com.codename1.ui.BrowserWindow
-
#addNativeBrowserWindowOnLoadListener(java.lang.Object, com.codename1.ui.events.ActionListener)
-
#removeNativeBrowserWindowOnLoadListener(java.lang.Object, com.codename1.ui.events.ActionListener)
-
#nativeBrowserWindowAddCloseListener(java.lang.Object, com.codename1.ui.events.ActionListener)
-
#nativeBrowserWindowRemoveCloseListener(java.lang.Object, com.codename1.ui.events.ActionListener)
-
#nativeBrowserWindowCleanup(java.lang.Object)
-
#nativeBrowserWindowHide(java.lang.Object)
-
#nativeBrowserWindowShow(java.lang.Object)
-
#nativeBrowserWindowSetTitle(java.lang.Object, java.lang.String)
-
#nativeBrowserWindowSetSize(java.lang.Object, int, int)
-
#nativeBrowserWindowEval(java.lang.Object, com.codename1.ui.BrowserWindow.EvalRequest)
-
addNativeBrowserWindowOnLoadListener
Adds a load listener to a native browser window.
Parameters
-
window: The window to add the listener to. -
l: The listener
Since
7.0
See also
- #createNativeBrowserWindow(java.lang.String)
-
-
removeNativeBrowserWindowOnLoadListener
Removes a load listener from a native browser window.
Parameters
-
window: The window from which to remove the listener. -
l: The listener
Since
7.0
See also
- #createNativeBrowserWindow(java.lang.String)
-
-
nativeBrowserWindowSetSize
Sets the size of a native browser window.
Parameters
-
window: The window -
width: The width in pixels. -
height: The height in pixels.
Since
7.0
See also
- #createNativeBrowserWindow(java.lang.String)
-
-
nativeBrowserWindowSetTitle
-
nativeBrowserWindowShow
Shows a native browser window.
Parameters
window: The window
Since
7.0
See also
- #createNativeBrowserWindow(java.lang.String)
-
nativeBrowserWindowHide
Hides a native browser window.
Parameters
window: The window
Since
7.0
See also
- #createNativeBrowserWindow(java.lang.String)
-
nativeBrowserWindowCleanup
Cleans up and disposes of a native browser window.
Parameters
window: The window
Since
7.0
See also
- #createNativeBrowserWindow(java.lang.String)
-
nativeBrowserWindowEval
Evaluates javascript on native browser window.
Parameters
-
window: The window -
req: The javascript eval request.
Since
7.0
See also
- #createNativeBrowserWindow(java.lang.String)
-
-
nativeBrowserWindowAddCloseListener
Adds close listener to native browser window.
Parameters
-
window: The window. -
l: The listener
Since
7.0
See also
- #createNativeBrowserWindow(java.lang.String)
-
-
nativeBrowserWindowRemoveCloseListener
Removes close listener from native browser window.
Parameters
-
window: The window. -
l: The listener
Since
7.0
See also
- #createNativeBrowserWindow(java.lang.String)
-
-
registerPush
User register to receive push notification
Parameters
noFallback: @param noFallback some devices don't support an efficient push API and will resort to polling to provide push like functionality. If this flag is set to true no polling will occur and the error PushCallback.REGISTRATION_ERROR_SERVICE_NOT_AVAILABLE will be sent to the push interface.
-
deregisterPush
public void deregisterPush()Stop receiving push notifications to this client application -
createMediaRecorder
Creates a Media recorder Object which will record from the device mic to a file in the given path.
Parameters
-
path: @param path a file path to where to store the recording, if the file does not exists it will be created. -
mimeType: @param mimeType the output mime type that is supported see getAvailableRecordingMimeTypes()
- Throws:
IOException
-
-
createMediaRecorder
Creates a Media recorder Object which will record from the device mic to a file in the given path.
Parameters
builder: @param builder THe media builder with settings for the recorder. getAvailableRecordingMimeTypes()
Since
7.0
- Throws:
IOException
-
sendRegisteredForPush
-
pushReceived
-
setPollingFrequency
public void setPollingFrequency(int freq) Sets the frequency for polling the server in case of polling based push notification
Parameters
freq: the frequency in milliseconds
Deprecated
we no longer support push polling
-
getImageIO
Returns the image IO instance that allows scaling image files.
Returns
the image IO instance
-
instanceofObjArray
Workaround for XMLVM bug -
instanceofByteArray
Workaround for XMLVM bug -
instanceofShortArray
Workaround for XMLVM bug -
instanceofLongArray
Workaround for XMLVM bug -
instanceofIntArray
Workaround for XMLVM bug -
instanceofFloatArray
Workaround for XMLVM bug -
instanceofDoubleArray
Workaround for XMLVM bug -
getAvailableRecordingMimeTypes
Gets the available recording MimeTypes -
openOrCreateDB
Opens a database or create one if not exists
Parameters
databaseName: the name of the database
Returns
Database Object or null if not supported on the platform
Throws
IOException: if database cannot be created
- Throws:
IOException
-
deleteDB
Deletes database
Parameters
databaseName: the name of the database
Throws
IOException: if database cannot be deleted
- Throws:
IOException
-
existsDB
Indicates weather a database exists
Parameters
databaseName: the name of the database
Returns
true if database exists
-
getDatabasePath
-
isNativeTitle
public boolean isNativeTitle()Indicates if the title of the Form is native title(in android ICS devices if the command behavior is native the ActionBar is used to display the title and the menu)
Returns
true if platform would like to show the Form title
-
refreshNativeTitle
public void refreshNativeTitle()if the title is native(e.g the android action bar), notify the native title that is needs to be refreshed -
getCommandBehavior
public int getCommandBehavior()Indicates the way commands should be added to a form as one of the ocmmand constants defined in this class
Returns
the commandBehavior
-
setCommandBehavior
public void setCommandBehavior(int commandBehavior) Indicates the way commands should be added to a form as one of the ocmmand constants defined in this class
Parameters
commandBehavior: the commandBehavior to set
-
notifyStatusBar
public Object notifyStatusBar(String tickerText, String contentTitle, String contentBody, boolean vibrate, boolean flashLights, Hashtable args) Place a notification on the device status bar (if device has this functionality). The notification will re-start the Application.
Parameters
-
tickerText: the ticker text of the Notification -
contentTitle: the title of the Notification -
contentBody: the content of the Notification -
vibrate: enable/disable notification alert -
flashLights: enable/disable notification flashing -
args: additional arguments to the notification
Returns
a platform native object that allows modifying notification state
Deprecated
use scheduleLocalNotification instead
-
-
isNotificationSupported
public boolean isNotificationSupported()Indicates whether the notify status bar method will present a notification to the user
Returns
true if the notify status bar method will present a notification to the user
-
dismissNotification
Removes the notification previously posted with the notify status bar method
Parameters
o: the object returned from the notifyStatusBar method
-
isBadgingSupported
public boolean isBadgingSupported()Returns true if the underlying OS supports numeric badges on icons. Notice this is only available on iOS and only when push notification is enabled
Returns
true if the underlying OS supports numeric badges
-
setBadgeNumber
public void setBadgeNumber(int number) Sets the number that appears on the application icon in iOS
Parameters
number: number to show on the icon
-
getUdid
Returns the UDID for devices that support it
Returns
the UDID or null
-
getMsisdn
Returns the MSISDN for devices that expose it
Returns
the msisdn or null
-
getInAppPurchase
Returns the native OS purchase implementation if applicable, if not this method will fallback to a cross platform purchase manager.
Returns
instance of the purchase class
-
getCodeScanner
Returns the native implementation of the code scanner or null
Returns
code scanner instance
Deprecated
Use cn1-codescan cn1lib instead.
-
toNativePath
-
getAppHomePath
This will return the application home directory.
Returns
a writable directory that represent the application home directory
-
hasCachesDir
public boolean hasCachesDir()Returns true if the device has a directory dedicated for "cache" files
Returns
true if a caches style directory exists in this device type
-
getCachesDir
Returns a device specific directory designed for cache style files, or null if
#hasCachesDir()is falseReturns
file URL or null
-
isUseNativeCookieStore
public boolean isUseNativeCookieStore()Uses the native cookie store if applicable, this might break simulator compatibility
Returns
the useNativeCookieStore
-
setUseNativeCookieStore
public void setUseNativeCookieStore(boolean useNativeCookieStore) Uses the native cookie store if applicable, this might break simulator compatibility
Parameters
useNativeCookieStore: the useNativeCookieStore to set
-
shouldPaintBackground
public boolean shouldPaintBackground()Indicates the implementation is capable of keeping the background painted by being non-destructive.
Returns
whether to paint the background
-
getNativeTransition
This method allows a native implementation to implement a native version of a given transition that can be faster
Parameters
t: the transition that is about to execute
Returns
the given transition or a native version of that transition
-
isScreenLockSupported
public boolean isScreenLockSupported()Checks if the device supports locking the screen display from dimming, allowing the developer to keep the screen display on. -
lockScreen
public void lockScreen()If Locking isScreenLockSupported() returns true calling this method will lock the screen display on -
unlockScreen
public void unlockScreen()Unlock the screen display allowing the screen to dim. -
hasCamera
public boolean hasCamera()Returns true if the device has camera false otherwise. -
getEDTThreadPriority
public int getEDTThreadPriority()Returns the platform EDT thread priority -
drawingEncodedImage
This method is used by the JavaSE implementation for performance logging
Parameters
img: the image being drawn
-
isNativePickerTypeSupported
public boolean isNativePickerTypeSupported(int pickerType) Indicates whether the native picker dialog is supported for the given type which can include one of PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_TIME, PICKER_TYPE_DATE
Parameters
pickerType: the picker type constant
Returns
true if the native platform supports this picker type
-
showNativePicker
Shows a native modal dialog allowing us to perform the picking for the given type which can include one of PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_TIME, PICKER_TYPE_DATE
Parameters
-
type: the picker type constant -
source: @param source the source component (optional) the native dialog will be placed in relation to this component if applicable -
currentValue: the currently selected value -
data: additional meta data specific to the picker type when applicable
Returns
the value from the picker or null if the operation was canceled.
-
-
connectSocket
-
connectSocket
-
listenSocket
Listens on the given port similar to the accept method of server socket in Java. This method will only work if isServerSocketAvailable() is true.
Parameters
port: the port to listen on
Returns
server socket instance
-
getHostOrIP
Returns the device host or ip address if available
Returns
device host or ip
-
disconnectSocket
Disconnects the current socket from the server/client on the other side
Parameters
socket: the socket instance
-
isSocketConnected
Indicates whether the socket is currently connected
Parameters
socket: is the socket we are connected to
Returns
true if the socket is connected
-
isServerSocketAvailable
public boolean isServerSocketAvailable()Indicates whether the underlying implementation supports server sockets
Returns
false by default
-
isSocketAvailable
public boolean isSocketAvailable()Indicates whether the underlying implementation supports sockets
Returns
false by default
-
getSocketErrorMessage
-
getSocketErrorCode
Returns the pending error code on the given socket
Parameters
socket: the socket instance
Returns
the error code
-
getSocketAvailableInput
Returns whether data is available for input on the socket
Parameters
socket: the socket instance
Returns
a none zero value if data is available for input
-
readFromSocketStream
Read pending bytes from the socket
Parameters
socket: the socket object
Returns
byte array with data read from the socket
-
writeToSocketStream
Write the following byte array to the socket
Parameters
-
socket: the socket instance -
data: the data written
-
-
installTar
Installs a tar file from the build server into the file system storage so it can be used with respect for hierarchy- Throws:
IOException
-
splitString
-
isSimulator
public boolean isSimulator()Allows detecting development mode so debugging code and special cases can be used to simplify flow
Returns
true if we are running in the simulator, false otherwise
-
paintComponentBackground
public void paintComponentBackground(Object nativeGraphics, int x, int y, int width, int height, Style s) Paints the background of a component based on the style values on the given graphics context, the style could be accessed from the drawing thread in read only capacity to make the code slightly more efficient
Parameters
-
nativeGraphics: the graphics context -
x: coordinate to draw -
y: coordinate to draw -
width: coordinate to draw -
height: coordinate to draw -
s: the style object to draw
-
-
fillRect
Fills a rectangle with an optionally translucent fill color
Parameters
-
nativeGraphics: the underlying native graphics object -
x: the x coordinate of the rectangle to be filled -
y: the y coordinate of the rectangle to be filled -
w: the width of the rectangle to be filled -
h: the height of the rectangle to be filled -
alpha: the alpha values specify semitransparency
-
-
drawLabelComponent
public void drawLabelComponent(Object nativeGraphics, int cmpX, int cmpY, int cmpHeight, int cmpWidth, Style style, String text, Object icon, Object stateIcon, int preserveSpaceForState, int gap, boolean rtl, boolean isOppositeSide, int textPosition, int stringWidth, boolean isTickerRunning, int tickerShiftText, boolean endsWith3Points, int valign) Draws a label on the given graphics context, this method allows optimizing the very common drawing operation using platform native code -
drawLabelText
protected int drawLabelText(Object nativeGraphics, int textDecoration, boolean rtl, boolean isTickerRunning, boolean endsWith3Points, Object nativeFont, int txtW, int textSpaceW, int shiftText, String text, int x, int y, int fontHeight) Draws the text of a label
Parameters
-
nativeGraphics: graphics context -
textDecoration: decoration information for the text -
text: the text for the label -
x: position for the label -
y: position for the label -
txtW: @param txtW stringWidth(text) equivalent which is faster than just invoking string width all the time -
textSpaceW: the width available for the component
Returns
the space used by the drawing
-
-
drawString
public void drawString(Object nativeGraphics, Object nativeFont, String str, int x, int y, int textDecoration) Draw a string using the current font and color in the x,y coordinates. The font is drawn from the top position and not the baseline.
Parameters
-
nativeGraphics: the graphics context -
nativeFont: the font used -
str: the string to be drawn. -
x: the x coordinate. -
y: the y coordinate. -
textDecoration: @param textDecoration Text decoration bitmask (See Style's TEXT_DECORATION_* constants)
-
-
setPlatformHint
-
scheduleLocalNotification
-
cancelLocalNotification
-
getPreferredBackgroundFetchInterval
public int getPreferredBackgroundFetchInterval()Gets the preferred time (in seconds) between background fetches.
Returns
The time interval in seconds.
See also
-
#isBackgroundFetchSupported()
-
#setPreferredBackgroundFetchInterval(int)
-
com.codename1.background.BackgroundFetch
-
com.codename1.ui.Display.setPreferredBackgroundFetchInterval(int)
-
-
setPreferredBackgroundFetchInterval
public void setPreferredBackgroundFetchInterval(int seconds) Sets the preferred time interval between background fetches. This is only a preferred interval and is not guaranteed. Some platforms, like iOS, maintain sovereign control over when and if background fetches will be allowed. This number is used only as a guideline.
This method must be called in order to activate background fetch.>
Note: If the platform doesn't support background fetch (i.e.
#isBackgroundFetchSupported()returnsfalse, then this method does nothing.Parameters
seconds: The time interval in seconds.
See also
-
#isBackgroundFetchSupported()
-
#getPreferredBackgroundFetchInterval()
-
com.codename1.background.BackgroundFetch
-
com.codename1.ui.Display.setPreferredBackgroundFetchInterval(int)
-
isBackgroundFetchSupported
public boolean isBackgroundFetchSupported()Checks to see if the current platform supports background fetch.
Returns
True if the current platform supports background fetch.
See also
-
#setPreferredBackgroundFetchInterval(int)
-
#getPreferredBackgroundFetchInterval()
-
com.codename1.background.BackgroundFetch
-
com.codename1.ui.Display.setPreferredBackgroundFetchInterval(int)
-
-
gaussianBlurImage
-
isGaussianBlurSupported
public boolean isGaussianBlurSupported() -
isJailbrokenDevice
public boolean isJailbrokenDevice()Returns true if this device is jailbroken or rooted, false if not or unknown. Notice that this method isn't accurate and can't detect all jailbreak/rooting cases
Returns
true if this device is jailbroken or rooted, false if not or unknown.
-
getProjectBuildHints
Returns the build hints for the simulator, this will only work in the debug environment and it's designed to allow extensions/API's to verify user settings/build hints exist
Returns
map of the build hints that isn't modified without the codename1.arg. prefix
-
setProjectBuildHint
Sets a build hint into the settings while overwriting any previous value. This will only work in the debug environment and it's designed to allow extensions/API's to verify user settings/build hints exist. Important: this will throw an exception outside of the simulator!
Parameters
-
key: the build hint without the codename1.arg. prefix -
value: the value for the hint
-
-
canInstallOnHomescreen
public boolean canInstallOnHomescreen()Checks to see if you can prompt the user to install the app on their homescreen. This is only relevant for the Javascript port with PWAs. This is not a "static" property, as it only returns true if the app is in a state that allows you to prompt the user. E.g. if you have previously prompted the user and they have declined, then this will return false.
Best practice is to use
#onCanInstallOnHomescreen(java.lang.Runnable)to be notified when you are allowed to prompt the user for installation. Then call#promptInstallOnHomescreen()inside that method - or sometime after.Example
`onCanInstallOnHomescreen(()->{ if (canInstallOnHomescreen()) { if (promptInstallOnHomescreen()) { // User accepted installation` else { // user rejected installation } } }); }https://developers.google.com/web/fundamentals/app-install-banners/
Returns
True if you are able to prompt the user to install the app on their homescreen.
See also
-
#promptInstallOnHomescreen()
-
#onCanInstallOnHomescreen(java.lang.Runnable)
-
-
promptInstallOnHomescreen
public boolean promptInstallOnHomescreen()Prompts the user to install this app on their homescreen. This is only relevant in the javascript port.
Returns
- Returns:
The result of the user prompt. true if the user accepts the installation, false if they reject it.
See also
-
#canInstallOnHomescreen()
-
#onCanInstallOnHomescreen(java.lang.Runnable)
-
-
onCanInstallOnHomescreen
A callback fired when you are allowed to prompt the user to install the app on their homescreen. Only relevant in the javascript port.
Parameters
r: @param r Runnable that will be run when/if you are permitted to prompt the user to install the app on their homescreen.
-
supportsNativeTextAreaVerticalAlignment
public boolean supportsNativeTextAreaVerticalAlignment()Checks whether the platform's native text areas support vertical alignment. -
postMessage
Posts a message to the native platform.
Parameters
message: The message.
Since
7.0
-
isDarkMode
Returns true if the platform is in dark mode, null is returned for unknown status
Returns
true in case of dark mode
-
announceForAccessibility
Manually announces text to native accessibility services, associating the announcement with a specific component when possible. Components are typically announced automatically when focused; this hook allows platforms to expose announcements triggered outside the normal focus lifecycle. The default implementation is a no-op.
Parameters
-
cmp: the component related to this announcement ornullfor the root context -
text: the message to announce
-
-
isLargerTextEnabled
public boolean isLargerTextEnabled()Returns true if the user has selected larger type fonts in the system settings. Default implementation returns false.
Returns
true when the platform indicates a larger text preference.
Since
7.1
-
getLargerTextScale
public float getLargerTextScale()Returns a scale factor representing how much larger system fonts should be. A value of
1.0indicates the default system font size.Returns
scale factor for larger system fonts.
Since
7.1
-
getStackTrace
Returns the stack trace from the exception on the given thread. This API isn't supported on all platforms and may return a blank string when unavailable.
Parameters
-
parentThread: the thread in which the exception was thrown -
t: the exception
Returns
a stack trace string that might be blank
-
-