The Gluon JavaOne App: Building the UI with Gluon Mobile


As we announced early this week here, we have been working for the past four months on the Gluon application for JavaOne.

This project makes use of Gluon Mobile, Gluon CloudLink and Gluon Charm Down.

This is the first of a series of blog posts about how we built the application. We’ll explain with a little bit of detail how we used Gluon Mobile to create the UI.

Gluon JavaOne App: Building the UI

While using the Gluon Plugin on your favorite IDE gives you a head start on creating a mobile project, when dealing with complex projects (in terms of number of views, services, back-end connections,…) there are things that require a few iterations to ease the way to the developers team, so they can start putting all the pieces together in perfect harmony.

In this post, we’ll cover a few of them.

Easing View creation

With the View concept in mind, and using the afterburner.fx framework, each view is defined by an fxml file and its presenter class. Each view usually requires access to a service (i.e. to access data from the backend using Gluon CloudLink), which can be done via injection, and probably access to other views.

We define an abstract GluonPresenter, that will be extended by all the presenters:

And it also comes in handy defining a GluonView, that avoids defining an empty view class for each view:

Doing so, a view like the speakers view can be now created easily, with its fxml file, that includes just the View container and a CharmListView control, and its presenter, where the list items are retrieved from the injected service:

Managing all the views

The OTNView, our views manager, is an enum that collects all the view presenters, along with some icons and titles for the drawer, and some flags. A bunch of useful methods for each view are added, like registerView, switchView or getMenuItem.

When we launch the application, we can easily register all the views:

Or if we want to access a given Speaker’s view from the Speakers View when a speaker is selected, we need to switch the view, get its presenter instance, and set the data from the given speaker. Thanks to all those methods mentioned above, it just take a line of code:

Or when we create the navigation drawer, we can add the all the items from views that are flagged as to be shown in the drawer:

New controls

While developing the OTN app, we’ve been eating our own dog food, making extensive use of Gluon Mobile. This has allowed us to test almost all the features that the library provides, fixing some bugs here and there, or realizing that some controls required some API improvements.

The next release of Gluon Mobile will benefit from all that work.

And we also started the development of new controls. Some of them will be included in that release too, others are for now kept in our labs, and will be released in future versions.

BottomNavigation Control

One of the controls already included in the library is the BottomNavigation control, providing quick navigation between top-level views of an app, with two to five top-level destinations of similar importance referred to as action items.

The control is built by providing a string, an icon and an event handler to each of the buttons.

For instance, the Speaker view uses this control to give access to either the speaker’s information or the speaker’s sessions:

AvatarPane

While this control is still in our labs under development, we have developed an animated control that shows one to several images embedded in Avatar controls, while allows selection on each of them, displaying different content.

Other controls

Other controls have been developed like Toasts (available) or an ImageGallery control (labs):

Summary

It has been a great time working on UI development with Gluon Mobile, and certainly the next releases will benefit from it. If you’re an existing Gluon Mobile customer, you will have access to these releases as per usual. If you’re not yet a customer, head on over to the Gluon Mobile product page to learn more!

Stay tuned for the next series of blog posts, where we will cover how we integrated all platform-specific requirements by making use of Gluon Charm Down, and how we managed to synchronize our front-end with the backend, making use of Gluon CloudLink.

If you haven’t done it yet, download the application from the Google Play Store or the Apple App Store, and give it try, either if you are attending JavaOne or not.

And if you are at JavaOne, don’t miss the opportunity to attend our sessions and meet those of us there.