Whats new in Android

Whats new in Android

Lecture at University of malta as part of DevFest Malta

A8b79d304b5184e5a5b0a109590f6683?s=128

Danny Preussler

November 17, 2017
Tweet

Transcript

  1. 15.

    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. 17.

    NEW FEATURE IN ANDROID 8 • Picture in Picture •

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

    • Picture in Picture • Resizable TextView • Fonts in

    xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
  4. 19.

    NEW FEATURE IN ANDROID 8 • Picture in Picture •

    Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
  5. 20.

    NEW FEATURE IN ANDROID 8 • Picture in Picture •

    Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
  6. 21.

    NEW FEATURE IN ANDROID 8 • Picture in Picture •

    Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
  7. 22.

    NEW FEATURE IN ANDROID 8 • Picture in Picture •

    Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes • Instant Apps
  8. 24.

    NEW FEATURE IN ANDROID 8 • Picture in Picture •

    Resizable TextView • Fonts in xml and Downloadable fonts • Notification changes • Background changes •Instant apps
  9. 25.

    INSTANT APPS • “say no to app downloads” • (partial)

    app starts directly from website • Split up your app into feature modules
  10. 30.
  11. 31.

    NEWS IN ARCHITECTURE • Architecture blueprints • Architecture guidelines •Architecture

    components developer.android.com/topic/libraries/architecture/index.html
  12. 33.

    VIEWMODEL • provides the data for a specific UI •

    fits great into MVVM • survives configuration change
  13. 34.

    VIEWMODEL • provides the data for a specific UI •

    fits great into MVVM • survives configuration change
  14. 35.

    VIEWMODEL • provides the data for a specific UI •

    fits great into MVVM • survives configuration change Model ViewModel View
  15. 36.

    VIEWMODEL • provides the data for a specific UI •

    fits great into MVVM • survives configuration change
  16. 40.

    LIVE DATA • Observable similar to RxJava • Life cycle

    aware • Doesn’t emit when not needed • Memory leak save
  17. 41.

    LIVE DATA • Observable similar to RxJava • Life cycle

    aware • Doesn’t emit when not needed • Memory leak save
  18. 42.

    LIVE DATA • Observable similar to RxJava • Life cycle

    aware • Doesn’t emit when not needed • Memory leak save
  19. 43.

    LIVE DATA • Observable similar to RxJava • Life cycle

    aware • Doesn’t emit when not needed • Memory leak save
  20. 44.

    LIVE DATA • Observable similar to RxJava • Life cycle

    aware • Doesn’t emit when not needed • Memory leak save
  21. 45.

    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) {..} }
  22. 46.

    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!
  23. 48.

    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
  24. 49.

    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
  25. 50.
  26. 52.

    KOTLIN • Modern language • Reduce boilerplate • null safe

    • New possibilies • Communication with swift devs • Works great with Java • Multiplatform with web and backend
  27. 53.

    KOTLIN • Modern language • Works great with Java •

    Reduce boilerplate • null safe • New possibilies • Communication with swift devs • Multiplatform with web and backend
  28. 54.

    KOTLIN • Modern language • Works great with Java •

    Reduce boilerplate • null safe • New possibilies • Communication with swift devs • Multiplatform with web and backend
  29. 60.

    class MyViewModel extends ViewModel { MutableLiveData<String> message = new MutableLiveData<String>();

    myModel.message.observe(this, new Observer<String>() { @Override public void onChanged(String newName) {..} }
  30. 62.

    KOTLIN • Modern language • Works great with Java •

    Reduce boilerplate • null safe • New possibilies • Communication with swift devs • Multiplatform with web and backend
  31. 66.

    KOTLIN • Modern language • Works great with Java •

    Reduce boilerplate • null safe • New possibilities • Communication with swift devs • Multiplatform with web and backend
  32. 67.

    val typeOfPerson = when(age){ 0 -> "New born" in 1..12

    -> "Child" in 13..19 -> "Teenager" else -> "Adult" }
  33. 74.

    KOTLIN • Modern language • Works great with Java •

    Reduce boilerplate • null safe • New possibilities • Communication with swift devs • Multiplatform with web and backend
  34. 75.

    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
  35. 77.
  36. 81.