Top Libraries to Include in Your Gluon Mobile Project

Josiah Adegboye
Sep 4, 2018 · 5 min read

Given eight hours to chop down a tree, I would spend six hours sharpening my axe . — Abraham Lincoln

That been said, your tools matter. Maybe you just decided to implement your next mobile app with Gluon mobile or you just got onboard a new Gluon mobile project or a new platform is to be added to your app line and the entire project is to be ported to Gluon mobile. Starting a project with Gluon mobile (like any new technology) may be a little uphill and nobody likes uphill.

Source: Gluon Mobile

So this post is about Gluon mobile and how to save time and not get frustrated on your very first Gluon mobile project by selecting and using the best libraries you can. Let the journey begin.

This is my personal opinion of what I think are the most useful libraries which can be applicable in mobile applications.


Gluon Charm

The Gluon charm library installed with a new Gluon mobile project is packed with a load of awesome components and packages. The Gluon charm library contains many display components and services. The display components follow material design principles and provide awesome performance on mobile devices.

Gluon charm also includes tons of Service which are usually present on Mobile devices. These service make a lot of functionality available to the developer. If you need to do something that will require interaction with the native system, chances are there is a service that does that already. Also these service are installed as separate dependencies and you will only install what you want, keeping your project light.

Pros:

  • Support is available
  • Can be used with other libraries without stress

Unirest Java

If you ever need to send HTTP requests and receive responses from your app (You may never need to with Gluon Cloudlink), Unirest Java provides one of the most friendly HTTP client out there.

Source: Unirest for Java

With Unirest, Unirest.get("https://www.foobar.com").asJson(); performs a get request to https://www.foobar.comand returns the response as JSON. Unirest requests may be GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS . Unirest responses can be automatically serialized to Java Objects using an Object Mapper.

Also Unirest can perform asynchronous requests with callback functions which are implemented based on the response state. Unirest provides very decent handling for timeouts too and also supports files uploads and gzip.

Pros:

  • Easy HTTP requests
  • Asynchronous request
  • File uploads and Custom body entities
  • Implementation of Custom HttpClient

Cons:

  • Unirest does not store cookies by default. A custom HttpClient has to be implemented to do that.

Apache Commons Validator

If you are going to be handling inputs from user (Humans…), it is necessary to valid the data collected. The smoothest way to get that done is to use the Apache Commons Validator. The Apache Common Validator class is used to create instances of various Validators that are part of the Apache Commons Validator’s Routine package.

Apache Common Validator is used to validate regular expressions, integers, floats, time, email addresses, currency and even credit cards. The validators can also convert to the required types. One major function which I particularly like is the fact that it can validate numeric data types from string inputs (not very Java like, I know, but it’s so cool).

Pro:

  • Very easy validation of input.

Cons:

  • No available validator for files mime types
  • The entire package has to be installed even if just a single validator is needed

JFoeniX

At any point in your project, if the display components provided by Gluon charm do not seem enough or do not meet your requirements( for password fields in my own case), the good people at jetbrains gave us JFoeniX.

JFoeniX is an implementation of material design for JavaFX components. It provides a complete material design implementation for every even the window decorator. JFoeniX is most preferable if you would be building a desktop version for your app.

Some components included in JFoeniX include snackbar, dialog, badge, pickers, tree views and (my favorite) the masonry pane. Its performance is not a issue on mobile as the components i tried(Inputs) performed awesome.

Pro:

  • Provides an easy way to create very beautiful user interfaces.
  • Includes components not in Gluon Charm such as badge and masonry pane

Con:

  • JFoeniX components cannot be modified by switching Swatch from light to dark.

Gluon Maps

Source: Gluon Maps

Gluon maps is the way to create maps within your Gluon mobile app and not get an ANR all the time. Other libraries such as GMapsFX have performance lags on mobile devices and throws errors on desktop if network connectivity is poor.

The flexibility of Gluon Maps is amazing as many JavaFX components can be drawn over the maps as markers. Gluon Maps can scale between screen sizes and also include a number of motion effects on the maps. These features do not cause application lag in anyway(still wonder how they do it).

Pros:

  • Super fast mapping on mobile
  • Support for customized marker placement
  • Support for a lot of other custom overlays
  • Data from Google maps API can be used to draw Gluon maps

Cons:

  • I don’t know if it is possible to draw ground routes on the maps.

Developing apps with Gluon mobile can be fun and very rewarding. Like most app development technologies, it works better (at least faster) with libraries. Save yourself time, coffee and energy. Its not as hard as it looks.

Source: Odyssey

Know more about Gluon mobile or check out the Gluon developer website here.

Need clarity? I’m here.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade