Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

18
We design and develop great software for mobile and web.

Transcript of Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Page 1: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

We design and develop great software for mobile and web.

Page 2: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Google I/O 2015 report:

Milkshakes, Marshmallows and Marblecakes

Page 3: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

M

Page 4: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Permissions:• Requested on first use of a feature

• Users can control individual permissions on a per app basis

• Won’t influence legacy apps (unless compiled against M)

• Developers will have to handle more and more cases

Page 5: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Fingerprint API:• Allows users to authenticate actions

• Simple usage with Authentication Callback

• Device credentials can be used to authenticate, creating a more fluid UX

• Samples:https://github.com/googlesamples/android-ConfirmCredentialhttps://github.com/googlesamples/android-FingerprintDialog

Page 6: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

App links:• Open twitter using twitter, open Facebook using Facebook

• Managed via both backend and app

Android Pay:• NFC based payment system

• Any NFC enabled phone can use it

• Fingerprint authentication if supported by device

Doze, Now on Tap, Custom Chrome Tabs

Page 7: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Tools

Page 8: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Android studio:• Full NDK support

• Vector drawables - generated from SVGs by build system

• New theme editor and new design editor (in 1.5)

• Play services integration, new SDK manager

• Improved profiling tools

Page 9: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Gradle 2.4 and plugin 1.+:• Performance increase

• Incremental builds and caching

• Jack The Compiler - Java -> Dex

• Better variant/flavour management

Page 10: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Design support libraryNavigation view:

<android.support.design.widget.NavigationView android:id="@+id/nav_view" android:layout_height="match_parent" android:layout_width="wrap_content" android:layout_gravity="start" android:fitsSystemWindows="true" app:headerLayout="@layout/nav_header" app:menu="@menu/drawer_view"/>

<menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkableBehavior="single"> <item android:id="@+id/nav_home" android:icon="@drawable/ic_dashboard" android:title="Home" />

Page 11: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Design support library

• Uses colorAccent

• Size can be fabSize=“mini"

• Drawable set using src

• Has to have borderWidth set if you want it to be round :)

Floating Action Button

Page 12: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Design support library

• Anchor and anchor gravity

• ScrollFlags - Behaviour of items on scroll

• Scroll interpolators and content scrims

• Behaviors - Defining user interactions with the view

CoordinatorLayout

Page 13: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Design support library• Toast-like view for quick feedback with an actionSnackbar

• Edit texts with labels floating above them. Much wow.Floating labels

• Tabbed layout that can be both fixed and scrollable. Can be setUpWithViewpager();

Tab layout

• Work together to create nice looking collapsable toolbars• Can use parallax and parallax multipliers• Still buggy

AppBar layout and CollapsingToolbar

Page 14: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Data binding• “Butterknife killer"

• Currently in Beta, coming as a part of AS 1.3

• Write model bindings and simple view logic in layout XML file

• Views can be even more passive > Cleaner code

Page 15: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Data binding<layout xmlns:android="http://schemas.android.com/apk/res/android"> <data> <variable name="cheesy" type=“com.support.android.designlibdemo.Cheese"/> </data> <android.support.design.widget.CoordinatorLayout POJO Model

Parent layout

<TextView android:layout_width=“match_parent" android:layout_height=“wrap_content" android:text="@{cheesy.text}" />

public class Cheese { public final String name; public final String text; public Cheese(String name, String text) { this.name = name; this.text = text; }

//Replaces setContentView(R.layout.activity_detail); with dynamically generated binding binding = DataBindingUtil.setContentView(this, R.layout.activity_detail); Cheese cheesy = new Cheese(cheeseName, getString(R.string.cheese_ipsum)); //We bind our POJO to it binding.setCheesy(cheesy); //We can access views without using findViewById binding.fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //Change the model binding.setCheesy(new Cheese("Got", "Cheddar")); } });

Activity:

Page 16: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Data binding:• Most of Java expressions and operators are allowed

• Missing super, this, new

• Automatic null check

• Observables can be used to automatically update UI on data change

• BaseObservable and @Bindable annotations

Page 17: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Samples:

• https://github.com/googlesamples/

• https://github.com/chrisbanes/cheesesquare

Page 18: Infinum android talks #12 - Google IO report: Milkshakes, Marshmallows and Marble Cakes

Thank you!

email: [email protected] twitter: @IanIsSoAwesome