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
PLoP 2024: The evolution of the microservice architecture pattern language
cer
PRO
0
1.6k
Kubernetes for Data Engineers: Building Scalable, Reliable Data Pipelines
sucitw
1
200
生成 AI を活用した toitta 切片分類機能の裏側 / Inside toitta's AI-Based Factoid Clustering
pokutuna
0
570
qmuntal/stateless のススメ
sgash708
0
120
EventSourcingの理想と現実
wenas
6
2.1k
Identifying User Idenity
moro
6
7.9k
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
140
Sidekiqで実現する 長時間非同期処理の中断と再開 / Pausing and Resuming Long-Running Asynchronous Jobs with Sidekiq
hypermkt
6
2.7k
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
23k
リリース8年目のサービスの1800個のERBファイルをViewComponentに移行した方法とその結果
katty0324
5
3.6k
C#/.NETのこれまでのふりかえり
tomokusaba
1
160
デプロイを任されたので、教わった通りにデプロイしたら障害になった件 ~俺のやらかしを越えてゆけ~
techouse
52
32k
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
296
20k
Embracing the Ebb and Flow
colly
84
4.4k
Designing the Hi-DPI Web
ddemaree
280
34k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Thoughts on Productivity
jonyablonski
67
4.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
43
6.6k
Done Done
chrislema
181
16k
GraphQLとの向き合い方2022年版
quramy
43
13k
What's in a price? How to price your products and services
michaelherold
243
12k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
32
1.8k
Designing for Performance
lara
604
68k
[RailsConf 2023] Rails as a piece of cake
palkan
51
4.9k
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