What's new in Android M

What's new in Android M

167f2c9daf3e040134359926747a510b?s=128

Jérémie Laval

July 23, 2015
Tweet

Transcript

  1. You should be looking at

  2. Hi! I’m Jérémie @jeremie_laval

  3. None
  4. Android IDE tooling Android Component s Evangelis m A monkey?!

  5. Android Fanboy Android Fanboy Android Fanboy Banana!

  6. what’s new in Android M

  7. Android M Preview codename MNC Macadamia Nut Cookie (Marzipan?) (M&Ms?)

  8. Preview Availability

  9. Timeline A preview release ~every month Preview 1 Google I/O

    2015 Preview 2 July 16th Preview 3 August? Final release Late September
  10. Release Focus Polish Performance Battery savings 7

  11. Platform Highlights New Permission Workflow Doze / App Standby Material

    Design Updates
  12. App Permissions

  13. Old Style

  14. Issues Prevent automatic updates Out-of-context Low user-engagement

  15. Advantage Total Developer Freedom

  16. The New System Low and high risk permission split →

    Only if your app targets M Contextualized asking for more Cope with refusal/revocation
  17. What you get Bluetooth Internet Network State NFC Vibrate Settings

    Flashlight Accounts Alarm … As declared in app manifest
  18. Asking for a cookie if (CheckSelfPermission (this, Manifest.Permission.Camera) != Permission.Granted)

    {
 if (ShouldShowRequestPermissionRationale (Manifest.Permission.Camera))
 Toast.MakeText (/* ... */);
 RequestPermissions (new string[] { Manifest.Permission.Camera }, RequestCamera);
 } public override void OnRequestPermissionsResult (int requestCode,
 string[] permissions,
 int[] grantResults)
 {
 if (requestCode == RequestCamera) {
 // Handle permission response
 }
 }
  19. In-app permission

  20. Revoke permissions

  21. What about “necessary” permissions?

  22. Cold start permissions

  23. The Battery Savers

  24. Doze Smart detect device inactivity and force shut everything Network

    is disabled Wake locks are ignored AlarmManager, Sync, JobScheduler prevented
  25. App Standby Automatically jail inactive applications Network is disabled Wakeups

    are regulated → Unless charging or app deemed used
  26. Material Updates

  27. Spec Updates 1 year of Material design google.com/design

  28. New Resources Icon Library Device Metrics Tool

  29. Support Design Library Default implementation of Material Support Library Design

    Companion to support-v7-appcompat
  30. What’s in the box And more… NavigationView Snackbar Floating Action

    Button
  31. NavigationView <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 android:id="@+id/drawer_layout"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:fitsSystemWindows="true">
 <!-- Content

    view -->
 <android.support.design.widget.NavigationView
 android:id="@+id/left_drawer"
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 android:layout_gravity="start"
 app:headerLayout="@layout/drawerheader"
 app:menu="@menu/drawer_menu" />
 </android.support.v4.widget.DrawerLayout>
  32. NavigationView <menu xmlns:android="http://schemas.android.com/apk/res/android">
 <group android:checkableBehavior="single">
 <item
 android:id="@+id/drawer_nav_map"
 android:checked="true"
 android:icon="@drawable/ic_drawer_map"
 android:title="Map"


    android:orderInCategory="0" />
 <item
 android:id="@+id/drawer_nav_favorites"
 android:icon="@drawable/ic_drawer_star"
 android:title="Favorites"
 android:orderInCategory="1" />
 <item
 android:id="@+id/drawer_nav_rentals"
 android:icon="@drawable/ic_drawer_rentals"
 android:title="Rental History"
 android:orderInCategory="2" />
 </group>
 </menu>
  33. SnackBar Snackbar.Make (view, "Here's a snackbar!", Snackbar.LengthLong)
 .SetAction ("Action", v

    => {})
 .Show ();
  34. Floating Action Button <android.support.design.widget.FloatingActionButton
 android:id="@+id/fab"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_gravity="end|bottom"
 android:layout_margin="@dimen/fab_margin"
 android:src="@drawable/ic_add"

    />
  35. CoordinatorLayout Anchor floating items Choreograph view movements Implement interaction patterns

  36. CoordinatorLayout <android.support.design.widget.CoordinatorLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:fitsSystemWindows="true">
 <android.support.design.widget.AppBarLayout
 android:id="@+id/appbar" />


    <!-- ... -->
 <android.support.design.widget.FloatingActionButton
 android:layout_height="wrap_content"
 android:layout_width="wrap_content"
 android:src="@drawable/ic_discuss"
 android:layout_margin="@dimen/fab_margin"
 app:layout_anchor="@id/appbar"
 app:layout_anchorGravity="bottom|right|end"
 app:layout_behavior="FloatingActionButton.Behavior" />
 </android.support.design.widget.CoordinatorLayout>
  37. Behaviors CoordinatorLayout.Behavior LayoutDependsOn / OnDependentViewChanged OnLayoutChild/OnMeasureChild OnInterceptTouchEvent/OnTouchEvent OnNested*Scroll/OnNested*Fling

  38. Custom behavior public class InfoPaneFabBehavior : CoordinatorLayout.Behavior
 {
 // …


    
 public override bool LayoutDependsOn (CoordinatorLayout parent, Java.Lang.Object child, View dependency)
 {
 return dependency is InfoPane;
 }
 
 public override bool OnDependentViewChanged (CoordinatorLayout parent, Java.Lang.Object child, View dependency)
 {
 // Move the fab vertically to place correctly wrt the info pane
 var fab = child.JavaCast<SwitchableFab> ();
 var currentInfoPaneY = ViewCompat.GetTranslationY (dependency);
 var newTransY = (int)Math.Max (0, dependency.Height - currentInfoPaneY - minMarginBottom - fab.Height / 2);
 ViewCompat.SetTranslationY (fab, -newTransY);
 
 // If alternating between open/closed state, change the FAB face
 if (wasOpened ^ ((InfoPane)dependency).Opened) {
 fab.Switch ();
 wasOpened = !wasOpened;
 }
 
 return true;
 }
 }
  39. Custom behavior

  40. M Checklist Think about your permission workflow Be careful that

    Doze won’t break your app Consider porting your app to appcompat
  41. Links Google I/O 2015 talks Permissions youtu.be/f17qe9vZ8RM Material Now youtu.be/8UicJ0SxBwA

    Samples github.com/xamarin/monodroid-samples/tree/master/android-m github.com/xamarin/monodroid-samples/tree/master/android5.0/Cheesesquare Blogs android-developers.blogspot.com/2015/05/android-design-support-library.html blog.xamarin.com/add-beautiful-material-design-with-the-android-support-design-library/