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
Whats new in Android
Search
Danny Preussler
November 17, 2017
Programming
1
74
Whats new in Android
Lecture at University of malta as part of DevFest Malta
Danny Preussler
November 17, 2017
Tweet
Share
More Decks by Danny Preussler
See All by Danny Preussler
Testing, how hard can it be? (Droidcon Lisbon 2022)
dpreussler
3
470
Take your Kotlin to the next step, abandon what you’ve learned (in Java)
dpreussler
0
620
The Power of Types, KotlinConf 2019
dpreussler
7
1.1k
Java vs Kotlin
dpreussler
0
280
Property Delegation with Kotlin for Android
dpreussler
1
100
Java vs Kotlin
dpreussler
2
320
To inject or not to inject: Dependency Injection with Kotlin (Droidcon Nairobi)
dpreussler
4
260
TDD on Android
dpreussler
4
370
To Inject or not inject, Dependency Injection in a Kotlin world (appbuilders.ch 2018)
dpreussler
10
4.6k
Other Decks in Programming
See All in Programming
Better Code Design in PHP
afilina
PRO
0
120
Macとオーディオ再生 2024/11/02
yusukeito
0
370
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
イベント駆動で成長して委員会
happymana
1
320
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
330
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.1k
Contemporary Test Cases
maaretp
0
140
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
330
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
cmp.Or に感動した
otakakot
2
150
Featured
See All Featured
Unsuck your backbone
ammeep
668
57k
Code Review Best Practice
trishagee
64
17k
How to train your dragon (web standard)
notwaldorf
88
5.7k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Music & Morning Musume
bryan
46
6.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
89
How GitHub (no longer) Works
holman
310
140k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Transcript
WHAT’S HOT IN GDG Malta Danny Preussler @PreusslerBerlin
WHO’S THAT GERMAN?
WHAT’S A DEVELOPER EXPERT?
WHAT’S A DEVELOPER EXPERT?
2009 ANDROID
SOOO 2016 • Material Design • Firebase • ConstraintLayout •
Databinding • RxJava
SOOO 2016 • Material Design • Firebase • ConstraintLayout •
Databinding • RxJava
SOOO 2016 • Material Design • Firebase • ConstraintLayout •
Databinding • RxJava
SOOO 2016 • Material Design • Firebase • ConstraintLayout •
Databinding • RxJava
SOOO 2016 • Material Design • Firebase • ConstraintLayout •
Databinding • RxJava
SOOO 2016 • Material Design • Firebase • ConstraintLayout •
Databinding • RxJava
SOOO 2016 • Material Design • Firebase • ConstraintLayout •
Databinding • RxJava ViewModel View
DATA BINDING
SOOO 2016 • Material Design • Firebase • ConstraintLayout •
Databinding • RxJava
RXJAVA tasksRepository.getTasks() .flatMap(Flowable::fromIterable) .filter(task -> { switch (currentFiltering) { case
ACTIVE_TASKS: return task.isActive(); case COMPLETED_TASKS: return task.isCompleted(); case ALL_TASKS: default return true; } }) * https://github.com/googlesamples/android-architecture
WHAT WAS NEW IN 2017
NEW FEATURE IN ANDROID 8 • Picture in Picture •
Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
• Picture in Picture • Resizable TextView • Fonts in
xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
NEW FEATURE IN ANDROID 8 • Picture in Picture •
Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
NEW FEATURE IN ANDROID 8 • Picture in Picture •
Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
NEW FEATURE IN ANDROID 8 • Picture in Picture •
Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
NEW FEATURE IN ANDROID 8 • Picture in Picture •
Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
BACKGROUND CHANGES • Doze and JobScheduler started with M (Android
6) • New background limitations
NEW FEATURE IN ANDROID 8 • Picture in Picture •
Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes •Instant apps
INSTANT APPS • “say no to app downloads” • (partial)
app starts directly from website • Split up your app into feature modules
NEWS IN ARCHITECTURE • Architecture blueprints • Architecture guidelines •
Architecture components
NEWS IN ARCHITECTURE •Architecture blueprints github.com/googlesamples/android-architecture • Architecture guidelines •
Architecture components
NEWS IN ARCHITECTURE • Architecture blueprints •Architecture guidelines developer.android.com/topic/libraries/architecture/guide.html •
Architecture components
NEWS IN ARCHITECTURE • Architecture blueprints •Architecture guidelines • Architecture
components
None
NEWS IN ARCHITECTURE • Architecture blueprints • Architecture guidelines •Architecture
components developer.android.com/topic/libraries/architecture/index.html
ARCHITECTURE COMPONENTS • Viewmodel • LiveData • LifeCycleObserver • Room
• Pagination
VIEWMODEL • provides the data for a specific UI •
fits great into MVVM • survives configuration change
VIEWMODEL • provides the data for a specific UI •
fits great into MVVM • survives configuration change
VIEWMODEL • provides the data for a specific UI •
fits great into MVVM • survives configuration change Model ViewModel View
VIEWMODEL • provides the data for a specific UI •
fits great into MVVM • survives configuration change
VIEWMODEL public void onCreate(...) { model = ViewModelProviders .of(this) .get(MyViewModel.class);
} class MyViewModel extends ViewModel { …
VIEWMODEL LIVES LONGER! Activity Activity ViewModel
INTRODUCING LIVE DATA Activity Activity LiveData LiveData ViewModel
LIVE DATA • Observable similar to RxJava • Life cycle
aware • Doesn’t emit when not needed • Memory leak save
LIVE DATA • Observable similar to RxJava • Life cycle
aware • Doesn’t emit when not needed • Memory leak save
LIVE DATA • Observable similar to RxJava • Life cycle
aware • Doesn’t emit when not needed • Memory leak save
LIVE DATA • Observable similar to RxJava • Life cycle
aware • Doesn’t emit when not needed • Memory leak save
LIVE DATA • Observable similar to RxJava • Life cycle
aware • Doesn’t emit when not needed • Memory leak save
LIVE DATA class MyViewModel extends ViewModel { MutableLiveData<String> message =
new MutableLiveData<String>(); myModel.message.observe(this, new Observer<String>() { @Override public void onChanged(String newValue) {..} }
LIFECYCLEOBSERVER • Helps building your own life cycle aware components
• Watch Activity, Fragment or Application life cycle • Avoid memory leaks • Avoid forwarding events from activities/fragments • Introduces ProcessLifeCycle!
ROOM • SQLite Object Mapper • Compile time check •
Works with RxJava
ROOM @Dao abstract class ConferenceStore { @Insert abstract void insert(List<Session>
sessions); @Query("SELECT * FROM tracks") abstract List<Track> allTracks(); ... https://commonsware.com/presos/2017-11-Room
ROOM @Entity(tableName = "tracks") class Track { @PrimaryKey(autoGenerate = true)
final Long id; @NonNull final String title; @NonNull final String location; ... https://commonsware.com/presos/2017-11-Room
ROOM @Database(version=1, entities = {Track.class, Session.class}) abstract public class ConferenceDatabase
extends RoomDatabase { https://commonsware.com/presos/2017-11-Room
A NEW PROGRAMMING LANGUAGE * Java still fully supported on
Android
KOTLIN • Modern language • Reduce boilerplate • null safe
• New possibilies • Communication with swift devs • Works great with Java • Multiplatform with web and backend
KOTLIN • Modern language • Works great with Java •
Reduce boilerplate • null safe • New possibilies • Communication with swift devs • Multiplatform with web and backend
KOTLIN • Modern language • Works great with Java •
Reduce boilerplate • null safe • New possibilies • Communication with swift devs • Multiplatform with web and backend
fun isEligibleToVote(): Boolean { return age >= 18 }
fun isEligibleToVote = age >= 18
data class MyModel(val lastName: String, val name: String = “”)
... Map<TYPE, Integer> signalStrength = new HashMap<>(); signalStrength.put(EDGE, 80); signalStrength.put(WIFI
to 90); ...
... val signalStrength = hashMapOf(EDGE to 80, WIFI to 90)
...
class MyViewModel extends ViewModel { MutableLiveData<String> message = new MutableLiveData<String>();
myModel.message.observe(this, new Observer<String>() { @Override public void onChanged(String newName) {..} }
class MyViewModel(): ViewModel(){ val message = MutableLiveData<String>() myModel.message.observe(this, Observer{ ..
})}
KOTLIN • Modern language • Works great with Java •
Reduce boilerplate • null safe • New possibilies • Communication with swift devs • Multiplatform with web and backend
NULL SAFETY var canNeverBeNull: String var canBeNull: String?
if (subscription != null) { subscription.dispose() }
subscription?.dispose()
KOTLIN • Modern language • Works great with Java •
Reduce boilerplate • null safe • New possibilities • Communication with swift devs • Multiplatform with web and backend
val typeOfPerson = when(age){ 0 -> "New born" in 1..12
-> "Child" in 13..19 -> "Teenager" else -> "Adult" }
fun String.toAspectRatio(): AspectRatio? = when (this) { "1:1" -> ONE_BY_ONE
"2:3" -> TWO_BY_THREE else -> null }
fun Int.clamp(lower: Int, upper: Int) = Math.max(lower, Math.min(this, upper)) progress.clamp(0,
100)
greeting shouldEqual "hello"
greeting.shouldEqual("hello”)
greeting shouldEqual "hello"
greeting `should equal` "hello"
KOTLIN • Modern language • Works great with Java •
Reduce boilerplate • null safe • New possibilities • Communication with swift devs • Multiplatform with web and backend
KOTLIN • Modern language • Works great with Java •
Reduce boilerplate • null safe • New possibilities • Communication with swift devs • Multiplatform with web and backend support for JVM, JS, native
KOTLIN = fun
None
SUMMARIZE It was never so easy to start with Android
WRITE ANDROID IN
ANDROID IS MORE THAN PHONE
None
WHAT’S HOT IN GDG Malta Danny Preussler @PreusslerBerlin