Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Whats new in Android

Whats new in Android

Lecture at University of malta as part of DevFest Malta

Danny Preussler

November 17, 2017
Tweet

More Decks by Danny Preussler

Other Decks in Programming

Transcript

  1. 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
  2. NEW FEATURE IN ANDROID 8 • Picture in Picture •

    Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
  3. • Picture in Picture • Resizable TextView • Fonts in

    xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
  4. NEW FEATURE IN ANDROID 8 • Picture in Picture •

    Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
  5. NEW FEATURE IN ANDROID 8 • Picture in Picture •

    Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
  6. NEW FEATURE IN ANDROID 8 • Picture in Picture •

    Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
  7. NEW FEATURE IN ANDROID 8 • Picture in Picture •

    Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
  8. NEW FEATURE IN ANDROID 8 • Picture in Picture •

    Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes •Instant apps
  9. INSTANT APPS • “say no to app downloads” • (partial)

    app starts directly from website • Split up your app into feature modules
  10. NEWS IN ARCHITECTURE • Architecture blueprints • Architecture guidelines •Architecture

    components developer.android.com/topic/libraries/architecture/index.html
  11. VIEWMODEL • provides the data for a specific UI •

    fits great into MVVM • survives configuration change
  12. VIEWMODEL • provides the data for a specific UI •

    fits great into MVVM • survives configuration change
  13. VIEWMODEL • provides the data for a specific UI •

    fits great into MVVM • survives configuration change Model ViewModel View
  14. VIEWMODEL • provides the data for a specific UI •

    fits great into MVVM • survives configuration change
  15. LIVE DATA • Observable similar to RxJava • Life cycle

    aware • Doesn’t emit when not needed • Memory leak save
  16. LIVE DATA • Observable similar to RxJava • Life cycle

    aware • Doesn’t emit when not needed • Memory leak save
  17. LIVE DATA • Observable similar to RxJava • Life cycle

    aware • Doesn’t emit when not needed • Memory leak save
  18. LIVE DATA • Observable similar to RxJava • Life cycle

    aware • Doesn’t emit when not needed • Memory leak save
  19. LIVE DATA • Observable similar to RxJava • Life cycle

    aware • Doesn’t emit when not needed • Memory leak save
  20. 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) {..} }
  21. 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!
  22. 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
  23. 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
  24. KOTLIN • Modern language • Reduce boilerplate • null safe

    • New possibilies • Communication with swift devs • Works great with Java • Multiplatform with web and backend
  25. KOTLIN • Modern language • Works great with Java •

    Reduce boilerplate • null safe • New possibilies • Communication with swift devs • Multiplatform with web and backend
  26. KOTLIN • Modern language • Works great with Java •

    Reduce boilerplate • null safe • New possibilies • Communication with swift devs • Multiplatform with web and backend
  27. class MyViewModel extends ViewModel { MutableLiveData<String> message = new MutableLiveData<String>();

    myModel.message.observe(this, new Observer<String>() { @Override public void onChanged(String newName) {..} }
  28. KOTLIN • Modern language • Works great with Java •

    Reduce boilerplate • null safe • New possibilies • Communication with swift devs • Multiplatform with web and backend
  29. KOTLIN • Modern language • Works great with Java •

    Reduce boilerplate • null safe • New possibilities • Communication with swift devs • Multiplatform with web and backend
  30. val typeOfPerson = when(age){ 0 -> "New born" in 1..12

    -> "Child" in 13..19 -> "Teenager" else -> "Adult" }
  31. KOTLIN • Modern language • Works great with Java •

    Reduce boilerplate • null safe • New possibilities • Communication with swift devs • Multiplatform with web and backend
  32. 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