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
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.5k
EMになってからチームの成果を最大化するために取り組んだこと/ Maximize team performance as EM
nashiusagi
0
100
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
C++でシェーダを書く
fadis
6
4.1k
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
250
受け取る人から提供する人になるということ
little_rubyist
0
250
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.2k
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
980
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Realtime API 入門
riofujimon
0
150
flutterkaigi_2024.pdf
kyoheig3
0
150
Macとオーディオ再生 2024/11/02
yusukeito
0
370
Featured
See All Featured
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Optimising Largest Contentful Paint
csswizardry
33
2.9k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
4 Signs Your Business is Dying
shpigford
180
21k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
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