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
630
The Power of Types, KotlinConf 2019
dpreussler
7
1.1k
Java vs Kotlin
dpreussler
0
290
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
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
160
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
3
480
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
460
testcontainers のススメ
sgash708
1
120
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
470
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
780
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
470
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
3
470
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
Exploring: Partial and Independent Composables
blackbracken
0
100
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
280
useSyncExternalStoreを使いまくる
ssssota
6
1.1k
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Designing for Performance
lara
604
68k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Making the Leap to Tech Lead
cromwellryan
133
9k
Mobile First: as difficult as doing things right
swwweet
222
9k
Rails Girls Zürich Keynote
gr2m
94
13k
Adopting Sorbet at Scale
ufuk
73
9.1k
RailsConf 2023
tenderlove
29
940
A Philosophy of Restraint
colly
203
16k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
YesSQL, Process and Tooling at Scale
rocio
169
14k
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