SlideShare a Scribd company logo
CREATE MODERNAPPS WITH
ANDROID JETPACK
Ramon Ribeiro Rabello
Hi, I’m Ramon Rabello | Bio
10 years in Android
GDG Floripa Organizer
Keen to Communities
Star Wars fan, I am!
Master Software Engineer |
about.me/ramonrabello
A keep-learner
We’re hiring | ArcTouch Brasil (Florianópolis Office)
arctouch.com/brjobs
DevFest Floripa 2018 | Coming soon
Android Dev Generations™
Android Dev 1st Gen | 2008-2012
Android Dev 1st Gen | Activity-centered development
public class MainActivity extends Activity {
private Button signInButton;
private Button signUpButton;
@Override
public void onCreate(Bundle savedInstanceState) {
signInButton = (TextView) findViewById(R.id.sign_in_button);
signUpButton = (TextView) findViewById(R.id.sign_up_button);
signInButton.setOnClickListener(new View.OnClickListener(){
// onClick()
signIn();
})
signUpButton.setOnClickListener(new View.OnClickListener(){
// onClick()
signUp();
})
private void signIn() { … }
private void signUp() { … }
God-Activity effect
Android Dev 1st Gen | Async programming was challenging
private class LoadDataTask extends AsyncTask<Params, Progress, Result> {
@Override void onPreExecute(){
showProgress(); // run on UI Thread
}
@Override public Result doInBackground(Params params…) {
return loadData(); // run on background Thread
}
@Override void onPostExecute(Result result){
if (uiComponent != null){ // needed to avoid NPE
updateView(result);
}
}
private void updateView(Result result) { … }
Android Dev 1st Gen | Lifecycle handling was error prone
@Override
public void onStart() {
super.onStart();
loadData();
}
@Override
public void onStop() {
super.onStop();
releaseData();
}
Race conditions & Memory Leaks
Android Dev 1st Gen | Java was the only supported language
Android Dev 1st Gen | The developer guide was poor
Android Dev 2nd Gen | 2013 - 2016
Android Dev 2nd Gen | Android Studio Preview was launched
Android Dev 2nd Gen | Gradle as a new build system
Android Dev 2nd Gen | Material Design as UI/UX guideline
Android Dev 2nd Gen | Plenty of 3rd-party libraries created
Networking
Retrofit
Glide
UIL
Okio
Picasso
ActionBarSherlock
SuperRecyclerView
AHBottomBar
…
OkHttp
Volley
HttpClient
Imaging
Fresco
JSON
Jackson
Gson
Moshi
DI
EventBus
RoboGuice
ButterKnife
AndroidAnnotations
Async
Dagger 1/2
ToothPick
Otto
RxJava
RxAndroid
Testing
Robolectric
Robotium
Espresso
UI
Database
GreenDAO
ActiveDroid
ORMLite
Realm
DBFlow
Mockito
Hamcrest
Firestore
CircleImageView
Android Dev 3rd Gen | 2017 - …
Android Dev 3rd Gen | MVP pattern matured in Android
interface AddNoteContract {
interface View {
fun updateNotesList()
fun showLoading()
fun hideLoading()
}
interface Presenter {
fun addNote(note: Note)
}
}
Android Dev 3rd Gen | Kotlin as a primary language for Android
data class Person(val name : String, val age: Int)
fun View.show() { visibility = View.VISIBLE }
fun View.gone() { visibility = View.GONE }
peopleRecyclerView.show()
loadingProgressBar.gone()
fun loadList(onSuccess:() -> Unit, onError:() -> Unit)
presenter.loadList(
onSuccess = { … },
onError = { … }
)
data classes
extension
functions
lambdas
high-order functions
Android Dev 3rd Gen | RxJava + MVVM = reactive apps
class NoteListViewModel {
fun getNoteList(): Subscription {
return repository.getNoteList()
}
}
class NoteListActivity: AppCompatActivity() {
private val viewModel = AddNoteViewModel()
private val compositeSubscription = CompositeSubscription()
private fun subscribeToNoteListChanges(): Subscription {
return viewModel.getNoteList()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(adapter::updateList, this::handleError)
}
override fun onResume() {
super.onResume()
compositeSubscription.add(subscribeToNoteListChanges())
}
override fun onPause() {
compositeSubscription.clear()
super.onPause()
}
}
NOW ANDROID HAS 10 YEARS!
Here comes Android Jetpack!
Android Jetpack | Overview
Simplify complex tasks
A collection of Android software components
Follow best practices
Free you from writing boilerplate code
Comprises the androidx.* packages
Android Jetpack | Components
Architecture
Foundation Behaviour
UI
•
Jetpack Components | Foundation
AppComponent
Android KTX
Multidex
Test
Architecture
Foundation Behaviour
UI
•
NEW
Jetpack Components | Architecture
DataBinding
Lifecycles
LiveData
Navigation
Paging
Room
ViewModel
WorkManager
Architecture
Foundation Behaviour
UI
•
NEW
NEW
NEW
Jetpack Components | UI
Animation & transitions
Auto
Emoji
Fragment
Layout
Palette
TV
Wear OS by Google
Architecture
Foundation Behaviour
UI
•
Jetpack Components | Behaviour
Download manager
Media & playback
Notifications
Permissions
Sharing
Slices
Architecture
Foundation Behaviour
UI
•
NEW
androidx
androidx | Overview
androidx | Migrating to androidx
Manually
Automagically
Add both androidX=true and enableJetfier=true to
gradle.properties file
In Android Studio 3.2.1: Refactor -> Migrate to AndroidX…
android-ktx
ANDROIDX.CORE:CORE-KTX
KOTLIN
sharedPreferences.edit()
.putBoolean("key", value)
.apply()
KOTLIN + ANDROID KTX
sharedPreferences.edit {
putBoolean("key", value)
}
KOTLIN
view.viewTreeObserver.addOnPreDrawListener(
object : ViewTreeObserver.OnPreDrawListener {
override fun onPreDraw(): Boolean {
viewTreeObserver.removeOnPreDrawListener(this)
actionToBeTriggered()
return true
}
}
)
KOTLIN + ANDROID KTX
view.doOnPreDraw {
actionToBeTriggered()
}
WorkManager
BASICS
CREATE A WORKER
class UploadPhotoWorker(context: Context, params:
WorkerParameters) : Worker(context, params) {
override fun doWork(): Result {
uploadPhoto()
return Result.SUCCESS
}
}
CREATE A WORKER REQUEST
val uploadWork =
OneTimeRequestBuilder<CompressWorker>().build()
WorkerManager.getInstance().enqueue(uploadWork)
OBSERVING WORK STATUS
WorkManager.getInstance().getStatusById(uploadWork.id)
.observe(lifecycleOwner, Observer { workStatus ->
if (workStatus != null && workStaus.state.isFinished) {
// do something according to the status
}
}
Who has already adopted
Android Jetpack?
Android Jetpack adoption | top apps
Demo ramonrabello
Android-Jetpack-Playground
AndroidX
Architecture Components
Material Theming
Coroutines
Retrofit 2
Gson
Kotlin 1.3
What’s next?
What’s next? | Learn more
Modern Android development: Android Jetpack, Kotlin, and more
(Google I/O 2018)
https://www.youtube.com/watch?v=IrMw7MEgADk
Android X | Android Developers
https://developer.android.com/jetpack/androidx/
Android Jetpack | Android Developers
https://developer.android.com/jetpack/
Android KTX | Android Developers
https://developer.android.com/kotlin/ktx
Q & A
THANK YOU.
https://about.me/ramonrabello

More Related Content

What's hot

Jetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UIJetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UI
Gilang Ramadhan
 
Reactive, component 그리고 angular2
Reactive, component 그리고  angular2Reactive, component 그리고  angular2
Reactive, component 그리고 angular2
Jeado Ko
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testing
Visual Engineering
 
Workshop 24: React Native Introduction
Workshop 24: React Native IntroductionWorkshop 24: React Native Introduction
Workshop 24: React Native Introduction
Visual Engineering
 
MVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire LhotelierMVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire Lhotelier
CocoaHeads France
 
老派浪漫:用 Kotlin 寫 Command Line 工具
老派浪漫:用 Kotlin 寫 Command Line 工具老派浪漫:用 Kotlin 寫 Command Line 工具
老派浪漫:用 Kotlin 寫 Command Line 工具
Shengyou Fan
 
Testing Android apps based on Dagger and RxJava Droidcon UK
Testing Android apps based on Dagger and RxJava Droidcon UKTesting Android apps based on Dagger and RxJava Droidcon UK
Testing Android apps based on Dagger and RxJava Droidcon UK
Fabio Collini
 
Intro to Retrofit 2 and RxJava2
Intro to Retrofit 2 and RxJava2Intro to Retrofit 2 and RxJava2
Intro to Retrofit 2 and RxJava2
Fabio Collini
 
Dagger 2. Right way to do Dependency Injection
Dagger 2. Right way to do Dependency InjectionDagger 2. Right way to do Dependency Injection
Dagger 2. Right way to do Dependency Injection
Stfalcon Meetups
 
Dagger 2. The Right Way to Dependency Injections
Dagger 2. The Right Way to Dependency InjectionsDagger 2. The Right Way to Dependency Injections
Dagger 2. The Right Way to Dependency Injections
GlobalLogic Ukraine
 
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Ontico
 
The Road to Native Web Components
The Road to Native Web ComponentsThe Road to Native Web Components
The Road to Native Web Components
Mike North
 
To-Do App With Flutter: Step By Step Guide
To-Do App With Flutter: Step By Step GuideTo-Do App With Flutter: Step By Step Guide
To-Do App With Flutter: Step By Step Guide
Biztech Consulting & Solutions
 
React, Redux and es6/7
React, Redux and es6/7React, Redux and es6/7
React, Redux and es6/7
Dongho Cho
 
Serverless Spring by Stephane Maldini
Serverless Spring by Stephane MaldiniServerless Spring by Stephane Maldini
Serverless Spring by Stephane Maldini
VMware Tanzu
 
Using hilt in a modularized project
Using hilt in a modularized projectUsing hilt in a modularized project
Using hilt in a modularized project
Fabio Collini
 
Gerenciamento de estado no Angular com NgRx
Gerenciamento de estado no Angular com NgRxGerenciamento de estado no Angular com NgRx
Gerenciamento de estado no Angular com NgRx
Loiane Groner
 
Open sourcing the store
Open sourcing the storeOpen sourcing the store
Open sourcing the store
Mike Nakhimovich
 
OpenStack Dashboard - Diablo
OpenStack Dashboard - DiabloOpenStack Dashboard - Diablo
OpenStack Dashboard - Diablo
devcamcar
 

What's hot (20)

Jetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UIJetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UI
 
Reactive, component 그리고 angular2
Reactive, component 그리고  angular2Reactive, component 그리고  angular2
Reactive, component 그리고 angular2
 
AngularJS - TechTalk 3/2/2014
AngularJS - TechTalk 3/2/2014AngularJS - TechTalk 3/2/2014
AngularJS - TechTalk 3/2/2014
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testing
 
Workshop 24: React Native Introduction
Workshop 24: React Native IntroductionWorkshop 24: React Native Introduction
Workshop 24: React Native Introduction
 
MVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire LhotelierMVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire Lhotelier
 
老派浪漫:用 Kotlin 寫 Command Line 工具
老派浪漫:用 Kotlin 寫 Command Line 工具老派浪漫:用 Kotlin 寫 Command Line 工具
老派浪漫:用 Kotlin 寫 Command Line 工具
 
Testing Android apps based on Dagger and RxJava Droidcon UK
Testing Android apps based on Dagger and RxJava Droidcon UKTesting Android apps based on Dagger and RxJava Droidcon UK
Testing Android apps based on Dagger and RxJava Droidcon UK
 
Intro to Retrofit 2 and RxJava2
Intro to Retrofit 2 and RxJava2Intro to Retrofit 2 and RxJava2
Intro to Retrofit 2 and RxJava2
 
Dagger 2. Right way to do Dependency Injection
Dagger 2. Right way to do Dependency InjectionDagger 2. Right way to do Dependency Injection
Dagger 2. Right way to do Dependency Injection
 
Dagger 2. The Right Way to Dependency Injections
Dagger 2. The Right Way to Dependency InjectionsDagger 2. The Right Way to Dependency Injections
Dagger 2. The Right Way to Dependency Injections
 
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
 
The Road to Native Web Components
The Road to Native Web ComponentsThe Road to Native Web Components
The Road to Native Web Components
 
To-Do App With Flutter: Step By Step Guide
To-Do App With Flutter: Step By Step GuideTo-Do App With Flutter: Step By Step Guide
To-Do App With Flutter: Step By Step Guide
 
React, Redux and es6/7
React, Redux and es6/7React, Redux and es6/7
React, Redux and es6/7
 
Serverless Spring by Stephane Maldini
Serverless Spring by Stephane MaldiniServerless Spring by Stephane Maldini
Serverless Spring by Stephane Maldini
 
Using hilt in a modularized project
Using hilt in a modularized projectUsing hilt in a modularized project
Using hilt in a modularized project
 
Gerenciamento de estado no Angular com NgRx
Gerenciamento de estado no Angular com NgRxGerenciamento de estado no Angular com NgRx
Gerenciamento de estado no Angular com NgRx
 
Open sourcing the store
Open sourcing the storeOpen sourcing the store
Open sourcing the store
 
OpenStack Dashboard - Diablo
OpenStack Dashboard - DiabloOpenStack Dashboard - Diablo
OpenStack Dashboard - Diablo
 

Similar to Create Modern Apps with Android Jetpack

Android 3
Android 3Android 3
Android 3
Robert Cooper
 
React native: building shared components for Android and iOS
React native: building shared components for Android and iOSReact native: building shared components for Android and iOS
React native: building shared components for Android and iOS
Calum Gathergood
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recieversUtkarsh Mankad
 
Compose In Practice
Compose In PracticeCompose In Practice
Compose In Practice
Kelvin Harron
 
What's New in Android
What's New in AndroidWhat's New in Android
What's New in Android
Robert Cooper
 
Saindo da zona de conforto… resolvi aprender android
Saindo da zona de conforto… resolvi aprender androidSaindo da zona de conforto… resolvi aprender android
Saindo da zona de conforto… resolvi aprender android
Daniel Baccin
 
Android development with Scala and SBT
Android development with Scala and SBTAndroid development with Scala and SBT
Android development with Scala and SBT
Anton Yalyshev
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
Monir Zzaman
 
Advancing the UI — Part 1: Look, Motion, and Gestures
Advancing the UI — Part 1: Look, Motion, and GesturesAdvancing the UI — Part 1: Look, Motion, and Gestures
Advancing the UI — Part 1: Look, Motion, and Gestures
Samsung Developers
 
Desarrollo para Android con Groovy
Desarrollo para Android con GroovyDesarrollo para Android con Groovy
Desarrollo para Android con Groovy
Software Guru
 
JSAnkara Swift v React Native
JSAnkara Swift v React NativeJSAnkara Swift v React Native
JSAnkara Swift v React Native
Muhammed Demirci
 
ハンズオン資料 電話を作ろう(v1.6用)
ハンズオン資料 電話を作ろう(v1.6用)ハンズオン資料 電話を作ろう(v1.6用)
ハンズオン資料 電話を作ろう(v1.6用)
Kenji Sakashita
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_android
Denis Minja
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Native
joshcjensen
 
Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015 Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015
Mario Jorge Pereira
 
Android gui framework
Android gui frameworkAndroid gui framework
Android gui framework
Sri Harsha Pamu
 
ハンズオン資料 電話を作ろう(v2.x用)
ハンズオン資料 電話を作ろう(v2.x用)ハンズオン資料 電話を作ろう(v2.x用)
ハンズオン資料 電話を作ろう(v2.x用)
Kenji Sakashita
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & Intents
Lope Emano
 
Android应用开发简介
Android应用开发简介Android应用开发简介
Android应用开发简介
easychen
 
CS6611 Mobile Application Development Lab Manual-2018-19
CS6611 Mobile Application Development Lab Manual-2018-19CS6611 Mobile Application Development Lab Manual-2018-19
CS6611 Mobile Application Development Lab Manual-2018-19
Gobinath Subramaniam
 

Similar to Create Modern Apps with Android Jetpack (20)

Android 3
Android 3Android 3
Android 3
 
React native: building shared components for Android and iOS
React native: building shared components for Android and iOSReact native: building shared components for Android and iOS
React native: building shared components for Android and iOS
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
 
Compose In Practice
Compose In PracticeCompose In Practice
Compose In Practice
 
What's New in Android
What's New in AndroidWhat's New in Android
What's New in Android
 
Saindo da zona de conforto… resolvi aprender android
Saindo da zona de conforto… resolvi aprender androidSaindo da zona de conforto… resolvi aprender android
Saindo da zona de conforto… resolvi aprender android
 
Android development with Scala and SBT
Android development with Scala and SBTAndroid development with Scala and SBT
Android development with Scala and SBT
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Advancing the UI — Part 1: Look, Motion, and Gestures
Advancing the UI — Part 1: Look, Motion, and GesturesAdvancing the UI — Part 1: Look, Motion, and Gestures
Advancing the UI — Part 1: Look, Motion, and Gestures
 
Desarrollo para Android con Groovy
Desarrollo para Android con GroovyDesarrollo para Android con Groovy
Desarrollo para Android con Groovy
 
JSAnkara Swift v React Native
JSAnkara Swift v React NativeJSAnkara Swift v React Native
JSAnkara Swift v React Native
 
ハンズオン資料 電話を作ろう(v1.6用)
ハンズオン資料 電話を作ろう(v1.6用)ハンズオン資料 電話を作ろう(v1.6用)
ハンズオン資料 電話を作ろう(v1.6用)
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_android
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Native
 
Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015 Android por onde começar? Mini Curso Erbase 2015
Android por onde começar? Mini Curso Erbase 2015
 
Android gui framework
Android gui frameworkAndroid gui framework
Android gui framework
 
ハンズオン資料 電話を作ろう(v2.x用)
ハンズオン資料 電話を作ろう(v2.x用)ハンズオン資料 電話を作ろう(v2.x用)
ハンズオン資料 電話を作ろう(v2.x用)
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & Intents
 
Android应用开发简介
Android应用开发简介Android应用开发简介
Android应用开发简介
 
CS6611 Mobile Application Development Lab Manual-2018-19
CS6611 Mobile Application Development Lab Manual-2018-19CS6611 Mobile Application Development Lab Manual-2018-19
CS6611 Mobile Application Development Lab Manual-2018-19
 

More from Ramon Ribeiro Rabello

Cultura de testes em times mobile
Cultura de testes em times mobileCultura de testes em times mobile
Cultura de testes em times mobile
Ramon Ribeiro Rabello
 
Ninja Productivity in Android Studio
Ninja Productivity in Android StudioNinja Productivity in Android Studio
Ninja Productivity in Android Studio
Ramon Ribeiro Rabello
 
Produtividade ninja com android studio
Produtividade ninja com android studioProdutividade ninja com android studio
Produtividade ninja com android studio
Ramon Ribeiro Rabello
 
Automatize seus testes de UI com a Espresso!
Automatize seus testes de UI com a Espresso!Automatize seus testes de UI com a Espresso!
Automatize seus testes de UI com a Espresso!
Ramon Ribeiro Rabello
 
Os caminhos da Agilidade em Empresa Pública
Os caminhos da Agilidade em Empresa PúblicaOs caminhos da Agilidade em Empresa Pública
Os caminhos da Agilidade em Empresa Pública
Ramon Ribeiro Rabello
 
Making your app see with Mobile Vision API
Making your app see with Mobile Vision APIMaking your app see with Mobile Vision API
Making your app see with Mobile Vision API
Ramon Ribeiro Rabello
 
Inovar em tempos de crise? Yes, We Can!
Inovar em tempos de crise?  Yes, We Can!Inovar em tempos de crise?  Yes, We Can!
Inovar em tempos de crise? Yes, We Can!
Ramon Ribeiro Rabello
 
O ecossistema android
O ecossistema androidO ecossistema android
O ecossistema android
Ramon Ribeiro Rabello
 
Android Marshmallow na prática
Android Marshmallow na práticaAndroid Marshmallow na prática
Android Marshmallow na prática
Ramon Ribeiro Rabello
 
Android Wear: Estendendo sua app para relógios inteligentes
Android Wear: Estendendo sua app para relógios inteligentesAndroid Wear: Estendendo sua app para relógios inteligentes
Android Wear: Estendendo sua app para relógios inteligentes
Ramon Ribeiro Rabello
 
Introdução ao Android Studio
Introdução ao Android StudioIntrodução ao Android Studio
Introdução ao Android Studio
Ramon Ribeiro Rabello
 
O caminho de um desenvolvedor android
O caminho de um desenvolvedor androidO caminho de um desenvolvedor android
O caminho de um desenvolvedor android
Ramon Ribeiro Rabello
 
Criando Apps Sociais em Android
Criando Apps Sociais em AndroidCriando Apps Sociais em Android
Criando Apps Sociais em Android
Ramon Ribeiro Rabello
 
Porque Aprender Android
Porque Aprender AndroidPorque Aprender Android
Porque Aprender Android
Ramon Ribeiro Rabello
 
Workshop Android em Ambientes de Integração
Workshop Android em Ambientes de IntegraçãoWorkshop Android em Ambientes de Integração
Workshop Android em Ambientes de Integração
Ramon Ribeiro Rabello
 
De idealista à empreendedor - como desenvolver aplicações em android que conq...
De idealista à empreendedor - como desenvolver aplicações em android que conq...De idealista à empreendedor - como desenvolver aplicações em android que conq...
De idealista à empreendedor - como desenvolver aplicações em android que conq...
Ramon Ribeiro Rabello
 
Desenvolvimento Web para Android
Desenvolvimento Web para AndroidDesenvolvimento Web para Android
Desenvolvimento Web para Android
Ramon Ribeiro Rabello
 
Agora é Android, Tá Safo? - #tasafoemacaocastanhal
Agora é Android, Tá Safo? - #tasafoemacaocastanhalAgora é Android, Tá Safo? - #tasafoemacaocastanhal
Agora é Android, Tá Safo? - #tasafoemacaocastanhal
Ramon Ribeiro Rabello
 
Boas Práticas em Android
Boas Práticas em AndroidBoas Práticas em Android
Boas Práticas em Android
Ramon Ribeiro Rabello
 
"Facebookoid"
"Facebookoid""Facebookoid"
"Facebookoid"
Ramon Ribeiro Rabello
 

More from Ramon Ribeiro Rabello (20)

Cultura de testes em times mobile
Cultura de testes em times mobileCultura de testes em times mobile
Cultura de testes em times mobile
 
Ninja Productivity in Android Studio
Ninja Productivity in Android StudioNinja Productivity in Android Studio
Ninja Productivity in Android Studio
 
Produtividade ninja com android studio
Produtividade ninja com android studioProdutividade ninja com android studio
Produtividade ninja com android studio
 
Automatize seus testes de UI com a Espresso!
Automatize seus testes de UI com a Espresso!Automatize seus testes de UI com a Espresso!
Automatize seus testes de UI com a Espresso!
 
Os caminhos da Agilidade em Empresa Pública
Os caminhos da Agilidade em Empresa PúblicaOs caminhos da Agilidade em Empresa Pública
Os caminhos da Agilidade em Empresa Pública
 
Making your app see with Mobile Vision API
Making your app see with Mobile Vision APIMaking your app see with Mobile Vision API
Making your app see with Mobile Vision API
 
Inovar em tempos de crise? Yes, We Can!
Inovar em tempos de crise?  Yes, We Can!Inovar em tempos de crise?  Yes, We Can!
Inovar em tempos de crise? Yes, We Can!
 
O ecossistema android
O ecossistema androidO ecossistema android
O ecossistema android
 
Android Marshmallow na prática
Android Marshmallow na práticaAndroid Marshmallow na prática
Android Marshmallow na prática
 
Android Wear: Estendendo sua app para relógios inteligentes
Android Wear: Estendendo sua app para relógios inteligentesAndroid Wear: Estendendo sua app para relógios inteligentes
Android Wear: Estendendo sua app para relógios inteligentes
 
Introdução ao Android Studio
Introdução ao Android StudioIntrodução ao Android Studio
Introdução ao Android Studio
 
O caminho de um desenvolvedor android
O caminho de um desenvolvedor androidO caminho de um desenvolvedor android
O caminho de um desenvolvedor android
 
Criando Apps Sociais em Android
Criando Apps Sociais em AndroidCriando Apps Sociais em Android
Criando Apps Sociais em Android
 
Porque Aprender Android
Porque Aprender AndroidPorque Aprender Android
Porque Aprender Android
 
Workshop Android em Ambientes de Integração
Workshop Android em Ambientes de IntegraçãoWorkshop Android em Ambientes de Integração
Workshop Android em Ambientes de Integração
 
De idealista à empreendedor - como desenvolver aplicações em android que conq...
De idealista à empreendedor - como desenvolver aplicações em android que conq...De idealista à empreendedor - como desenvolver aplicações em android que conq...
De idealista à empreendedor - como desenvolver aplicações em android que conq...
 
Desenvolvimento Web para Android
Desenvolvimento Web para AndroidDesenvolvimento Web para Android
Desenvolvimento Web para Android
 
Agora é Android, Tá Safo? - #tasafoemacaocastanhal
Agora é Android, Tá Safo? - #tasafoemacaocastanhalAgora é Android, Tá Safo? - #tasafoemacaocastanhal
Agora é Android, Tá Safo? - #tasafoemacaocastanhal
 
Boas Práticas em Android
Boas Práticas em AndroidBoas Práticas em Android
Boas Práticas em Android
 
"Facebookoid"
"Facebookoid""Facebookoid"
"Facebookoid"
 

Create Modern Apps with Android Jetpack

  • 1. CREATE MODERNAPPS WITH ANDROID JETPACK Ramon Ribeiro Rabello
  • 2. Hi, I’m Ramon Rabello | Bio 10 years in Android GDG Floripa Organizer Keen to Communities Star Wars fan, I am! Master Software Engineer | about.me/ramonrabello A keep-learner
  • 3. We’re hiring | ArcTouch Brasil (Florianópolis Office) arctouch.com/brjobs
  • 4. DevFest Floripa 2018 | Coming soon
  • 6. Android Dev 1st Gen | 2008-2012
  • 7. Android Dev 1st Gen | Activity-centered development public class MainActivity extends Activity { private Button signInButton; private Button signUpButton; @Override public void onCreate(Bundle savedInstanceState) { signInButton = (TextView) findViewById(R.id.sign_in_button); signUpButton = (TextView) findViewById(R.id.sign_up_button); signInButton.setOnClickListener(new View.OnClickListener(){ // onClick() signIn(); }) signUpButton.setOnClickListener(new View.OnClickListener(){ // onClick() signUp(); }) private void signIn() { … } private void signUp() { … } God-Activity effect
  • 8. Android Dev 1st Gen | Async programming was challenging private class LoadDataTask extends AsyncTask<Params, Progress, Result> { @Override void onPreExecute(){ showProgress(); // run on UI Thread } @Override public Result doInBackground(Params params…) { return loadData(); // run on background Thread } @Override void onPostExecute(Result result){ if (uiComponent != null){ // needed to avoid NPE updateView(result); } } private void updateView(Result result) { … }
  • 9. Android Dev 1st Gen | Lifecycle handling was error prone @Override public void onStart() { super.onStart(); loadData(); } @Override public void onStop() { super.onStop(); releaseData(); } Race conditions & Memory Leaks
  • 10. Android Dev 1st Gen | Java was the only supported language
  • 11. Android Dev 1st Gen | The developer guide was poor
  • 12. Android Dev 2nd Gen | 2013 - 2016
  • 13. Android Dev 2nd Gen | Android Studio Preview was launched
  • 14. Android Dev 2nd Gen | Gradle as a new build system
  • 15. Android Dev 2nd Gen | Material Design as UI/UX guideline
  • 16. Android Dev 2nd Gen | Plenty of 3rd-party libraries created Networking Retrofit Glide UIL Okio Picasso ActionBarSherlock SuperRecyclerView AHBottomBar … OkHttp Volley HttpClient Imaging Fresco JSON Jackson Gson Moshi DI EventBus RoboGuice ButterKnife AndroidAnnotations Async Dagger 1/2 ToothPick Otto RxJava RxAndroid Testing Robolectric Robotium Espresso UI Database GreenDAO ActiveDroid ORMLite Realm DBFlow Mockito Hamcrest Firestore CircleImageView
  • 17. Android Dev 3rd Gen | 2017 - …
  • 18. Android Dev 3rd Gen | MVP pattern matured in Android interface AddNoteContract { interface View { fun updateNotesList() fun showLoading() fun hideLoading() } interface Presenter { fun addNote(note: Note) } }
  • 19. Android Dev 3rd Gen | Kotlin as a primary language for Android data class Person(val name : String, val age: Int) fun View.show() { visibility = View.VISIBLE } fun View.gone() { visibility = View.GONE } peopleRecyclerView.show() loadingProgressBar.gone() fun loadList(onSuccess:() -> Unit, onError:() -> Unit) presenter.loadList( onSuccess = { … }, onError = { … } ) data classes extension functions lambdas high-order functions
  • 20. Android Dev 3rd Gen | RxJava + MVVM = reactive apps class NoteListViewModel { fun getNoteList(): Subscription { return repository.getNoteList() } } class NoteListActivity: AppCompatActivity() { private val viewModel = AddNoteViewModel() private val compositeSubscription = CompositeSubscription() private fun subscribeToNoteListChanges(): Subscription { return viewModel.getNoteList() .observeOn(AndroidSchedulers.mainThread()) .subscribe(adapter::updateList, this::handleError) } override fun onResume() { super.onResume() compositeSubscription.add(subscribeToNoteListChanges()) } override fun onPause() { compositeSubscription.clear() super.onPause() } }
  • 21. NOW ANDROID HAS 10 YEARS!
  • 22. Here comes Android Jetpack!
  • 23. Android Jetpack | Overview Simplify complex tasks A collection of Android software components Follow best practices Free you from writing boilerplate code Comprises the androidx.* packages
  • 24. Android Jetpack | Components Architecture Foundation Behaviour UI •
  • 25. Jetpack Components | Foundation AppComponent Android KTX Multidex Test Architecture Foundation Behaviour UI • NEW
  • 26. Jetpack Components | Architecture DataBinding Lifecycles LiveData Navigation Paging Room ViewModel WorkManager Architecture Foundation Behaviour UI • NEW NEW NEW
  • 27. Jetpack Components | UI Animation & transitions Auto Emoji Fragment Layout Palette TV Wear OS by Google Architecture Foundation Behaviour UI •
  • 28. Jetpack Components | Behaviour Download manager Media & playback Notifications Permissions Sharing Slices Architecture Foundation Behaviour UI • NEW
  • 31. androidx | Migrating to androidx Manually Automagically Add both androidX=true and enableJetfier=true to gradle.properties file In Android Studio 3.2.1: Refactor -> Migrate to AndroidX…
  • 35. KOTLIN + ANDROID KTX sharedPreferences.edit { putBoolean("key", value) }
  • 36. KOTLIN view.viewTreeObserver.addOnPreDrawListener( object : ViewTreeObserver.OnPreDrawListener { override fun onPreDraw(): Boolean { viewTreeObserver.removeOnPreDrawListener(this) actionToBeTriggered() return true } } )
  • 37. KOTLIN + ANDROID KTX view.doOnPreDraw { actionToBeTriggered() }
  • 40. CREATE A WORKER class UploadPhotoWorker(context: Context, params: WorkerParameters) : Worker(context, params) { override fun doWork(): Result { uploadPhoto() return Result.SUCCESS } }
  • 41. CREATE A WORKER REQUEST val uploadWork = OneTimeRequestBuilder<CompressWorker>().build() WorkerManager.getInstance().enqueue(uploadWork)
  • 42. OBSERVING WORK STATUS WorkManager.getInstance().getStatusById(uploadWork.id) .observe(lifecycleOwner, Observer { workStatus -> if (workStatus != null && workStaus.state.isFinished) { // do something according to the status } }
  • 43. Who has already adopted Android Jetpack?
  • 47. What’s next? | Learn more Modern Android development: Android Jetpack, Kotlin, and more (Google I/O 2018) https://www.youtube.com/watch?v=IrMw7MEgADk Android X | Android Developers https://developer.android.com/jetpack/androidx/ Android Jetpack | Android Developers https://developer.android.com/jetpack/ Android KTX | Android Developers https://developer.android.com/kotlin/ktx
  • 48. Q & A