Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Goin' Mobile: Developing Apps for iOS and Andro...
Search
gailasgteach
February 27, 2018
Technology
0
900
Goin' Mobile: Developing Apps for iOS and Android with Java and JavaFX
Use a single code base, JavaFX UI, Gluon Framework, and your favorite IDE
gailasgteach
February 27, 2018
Tweet
Share
Other Decks in Technology
See All in Technology
色々なAWSサービス名の由来を調べてみた
iriikeita
0
150
Mocking your codebase without cursing it
gaqzi
0
130
GraphRAG: What I Thought I Knew (But Didn’t)
sashimimochi
0
110
大学教員が押さえておくべき生成 AI の基礎と活用例〜より効率的な教育のために〜
soh9834
1
160
信頼性を支えるテレメトリーパイプラインの構築 / Building Telemetry Pipeline with OpenTelemetry
ymotongpoo
9
4.1k
2025-01-24-SRETT11-OpenTofuについてそろそろ調べてみるか
masasuzu
0
130
生成AIを活用した機能を、顧客に提供するまでに乗り越えた『4つの壁』
toshiblues
1
170
PaaSの歴史と、 アプリケーションプラットフォームのこれから
jacopen
7
1.7k
サーバレスの未来〜The Key to Simplifying Everything〜
kawaji_scratch
2
330
デザインシステムを始めるために取り組んだこと - TechTrain x ゆめみ ここを意識してほしい!リファクタリング勉強会
kajitack
2
290
2週に1度のビッグバンリリースをデイリーリリース化するまでの苦悩 ~急成長するスタートアップのリアルな裏側~
kworkdev
PRO
8
5.5k
15年入社者に聞く! これまでのCAのキャリアとこれから
kurochan
1
130
Featured
See All Featured
Building Applications with DynamoDB
mza
93
6.2k
A Modern Web Designer's Workflow
chriscoyier
693
190k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
510
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
980
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
360
Docker and Python
trallard
43
3.2k
BBQ
matthewcrist
85
9.4k
Making Projects Easy
brettharned
116
6k
A Philosophy of Restraint
colly
203
16k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Transcript
Atlanta February 23, 2018 Goin’ Mobile: Developing Apps for iOS
and Android with Java and JavaFX Paul Anderson Gail Anderson Anderson Software Group, Inc. asgteach.com 1 © 2018 Anderson Software Group
! Training Company ◦ Java, JavaFX Courses ! JavaFX Authors
◦ JavaFX Rich Client Programming on the NetBeans Platform ◦ Essential JavaFX ! LiveLesson Videos ◦ JavaFX Programming ◦ Java Reflection 2 © 2018 Anderson Software Group
! Why JavaFX on Mobile? ! Gluon Framework ! Gluon
Charm ! Gluon Connect and Gluon CloudLink ! Gluon Cloud Authentication ! Afterburner Framework ! Wrap Up, Q & A 3 © 2018 Anderson Software Group
! Critical Goal ◦ Platform independent source code ◦ “Write
Once, Install Everywhere” ! Design Approach ◦ Frameworks are a must ◦ Hide platform dependencies and messy details ! JavaFX Advantages ◦ Java UI, scene graph, nodes, FXML views ◦ Properties, listeners, binding, event handlers 4 © 2018 Anderson Software Group
5 © 2018 Anderson Software Group
! Development Tools ◦ Scene Builder for layouts, CSS and
skins ◦ Gradle for builds, IDE independent ! Gluon Library ◦ Charm Controls, Gluon Maps ◦ Local and cloud storage ◦ Material Design for mobile footprint ! Hardware Control ◦ Camera, accelerometer, GPS, gestures, … 6 © 2018 Anderson Software Group
7 © 2018 Anderson Software Group
! MobileApplication ◦ Main class for JavaFX mobile applications ◦
Extends JavaFX Application class ◦ Specify views as factories that are called on demand ! Views ◦ View class invokes FXMLLoader for FXML ◦ Presenter class is the FXML controller class ! Resources ◦ fxml, css, images, licensing files 8 © 2018 Anderson Software Group
© 2018 Anderson Software Group 9
! UI Controls ◦ View, AppBar, SidePopupView ◦ MaterialDesignIcon, Avatar,
CharmListView ◦ FloatingActionButton, ProgressIndicator ! Dialogs ◦ Alert, ExceptionDialog ◦ DatePicker, TimePicker ! API Library 10 © 2018 Anderson Software Group
! Access Hardware Features on Devices ◦ Platform-agnostic ◦ Gluon
open source under GPL license ◦ Optional commercial support ! Supported Services ◦ Accelerometer, Barcode Scan, Battery, Bluetooth, ◦ Camera-Picture, Compass, Device Info, Display Info, ◦ Magnetometer, Orientation, Phone, Storage, etc. 11 © 2018 Anderson Software Group
12 © 2018 Anderson Software Group
13 © 2018 Anderson Software Group
! Client Side Library ◦ Maps data with observable properties
and lists ◦ Supports bidirectional data transfers ◦ Provides notifications ◦ Syncs data automatically ! Supports Common Data Sources ◦ Gluon CloudLink ◦ File provider ◦ REST provider © 2018 Anderson Software Group 14
15 © 2018 Anderson Software Group
! Cloud Storage GluonClient gluonClient = GluonClientBuilder.create().credentials( new GluonCredentials(applicationKey, applicationSecret)).build();
! Local Storage GluonClient gluonClient = GluonClientBuilder .create().credentials(new GluonCredentials( applicationKey,applicationSecret)) .operationMode(OperationMode.LOCAL_ONLY) .build(); © 2018 Anderson Software Group 16
! Message Class class Message { private final StringProperty text
= new SimpleStringProperty(); public StringProperty textProperty() { return text; } } ! Bind to UI Control Label msgLabel = new Label(); msgLabel.textProperty().bind(msg.textProperty()); © 2018 Anderson Software Group 17
! Write Through ◦ Update remote copy when local data
changes ◦ LIST_WRITE_THROUGH ◦ OBJECT_WRITE_THROUGH ! Read Through ◦ Update local copy when remote data changes ◦ LIST_READ_THROUGH ◦ OBJECT_READ_THROUGH © 2018 Anderson Software Group 18
! Cloud Object Storage GluonObservableObject<Message> gluonMsg = DataProvider.retrieveObject( gluonClient.createObjectDataReader("data", Message.class,
SyncFlag.OBJECT_READ_THROUGH, SyncFlag.OBJECT_WRITE_THROUGH)); . . . Label msgLabel = new Label(); msgLabel.textProperty().bind( gluonMsg.get().textProperty()); © 2018 Anderson Software Group 19
! Observable UI Control ObservableList<Message> messages = FXCollections.observableArrayList(); loadMessages(messages) ListView<Message>
listView = new ListView<>(); listView.setItems(messages); ! Advantages ◦ Add and remove elements in list ◦ Updates UI control automatically © 2018 Anderson Software Group 20
! Cloud Storage and Synchronization GluonObservableList<Message> gluonList = DataProvider.retrieveList( gluonClient.createListDataReader("data",
Message.class)); . . . ListView<Message> listView = new ListView<>(); listView.setItems(gluonList); © 2018 Anderson Software Group 21
! Two Levels ◦ Update list for adds and removals
◦ Update list elements ! First Level SyncFlag.LIST_WRITE_THROUGH SyncFlag.LIST_READ_THROUGH ! Second Level SyncFlag.OBJECT_WRITE_THROUGH SyncFlag.OBJECT_READ_THROUGH © 2018 Anderson Software Group 22
! BPData Local Storage GluonObservableList<BPData> gluonBPData = DataProvider.retrieveList( gluonClient.createListDataReader(BPDATA, BPData.class,
SyncFlag.LIST_WRITE_THROUGH, SyncFlag.OBJECT_WRITE_THROUGH)); gluonBPData.stateProperty() .addListener((obs, ov, nv) -> { if (ConnectState.SUCCEEDED.equals(nv)) { bpList.set(gluonBPData); } }); © 2018 Anderson Software Group 23
© 2018 Anderson Software Group 24
! BPMonitor ◦ Four views (Readings, Graph, Stats, Edit) ◦
Stores readings locally on device ◦ No data sharing with other devices ! BPCloud ◦ Four views (Readings, Graph, Stats, Edit) ◦ Writes data to cloud ◦ Data tied to authenticated users ◦ User can access data from any authenticated device © 2018 Anderson Software Group 25
! Service Class void getData() { GluonObservableList<BPData> gluonBPData = DataProvider.retrieveList(
gluonClient.createListDataReader( user.get().getNick() + user.get().getNetworkId(), BPData.class, SyncFlag.LIST_READ_THROUGH, SyncFlag.LIST_WRITE_THROUGH, SyncFlag.OBJECT_READ_THROUGH, SyncFlag.OBJECT_WRITE_THROUGH)); . . . } © 2018 Anderson Software Group 26
! Credentials ◦ Register application on CloudLink ◦ Application keys
supplied by Gluon ! Gluon Client GluonClient gluonClient = GluonClientBuilder.create().credentials( new GluonCredentials(APPKEY, APPSECRET)) .authenticationMode( AuthenticationMode.USER) .build(); © 2018 Anderson Software Group 27
! What is Afterburner? ◦ Lightweight framework ◦ Provides dependency
injection ! Why Use Afterburner? ◦ Injects FXML for views and Java objects ◦ Generates Java boilerplate code ! Advantages ◦ Reduces Java code ◦ Safe and easy object sharing among views 28 © 2018 Anderson Software Group
! JavaFX Advantages ◦ Platform independent source code ◦ Observables,
binding & background tasks to sync UI ◦ Flexible skinning to fit mobile form ! Useful Frameworks ◦ Gluon/Gradle framework for mobile deployment ◦ Based on OpenJDK 9 ◦ Afterburner framework for dependency injection ◦ Platform/IDE independence 29 © 2018 Anderson Software Group
! Thanks for Coming! ◦
[email protected]
@paul_asgteach ◦
[email protected]
@gail_asgteach
! Source Code ◦ asgteach.com ! DevNexus2018 Code Samples ! Click to Download ◦ Q & A 30 © 2018 Anderson Software Group