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
73
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
460
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
Sidekiqで実現する 長時間非同期処理の中断と再開 / Pausing and Resuming Long-Running Asynchronous Jobs with Sidekiq
hypermkt
6
2.7k
色々なIaCツールを実際に触って比較してみる
iriikeita
0
270
Android 15 でアクションバー表示時にステータスバーが白くなってしまう問題
tonionagauzzi
0
140
Golang と Erlang
taiyow
8
1.9k
cXML という電子商取引の トランザクションを支える プロトコルと向きあっている話
phigasui
3
2.3k
C#/.NETのこれまでのふりかえり
tomokusaba
1
160
CSC509 Lecture 09
javiergs
PRO
0
110
macOS でできる リアルタイム動画像処理
biacco42
7
1.8k
CSC509 Lecture 08
javiergs
PRO
0
110
Amazon Neptuneで始めてみるグラフDB-OpenSearchによるグラフの全文検索-
satoshi256kbyte
4
330
Synchronizationを支える技術
s_shimotori
1
150
Vue SFCのtemplateでTypeScriptの型を活用しよう
tsukkee
3
1.5k
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
7
150
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
14
1.9k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
43
6.6k
Designing Experiences People Love
moore
138
23k
Done Done
chrislema
181
16k
A better future with KSS
kneath
238
17k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
37
1.8k
BBQ
matthewcrist
85
9.3k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
167
49k
Speed Design
sergeychernyshev
24
570
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