Best improvement in M
● Design support library?
● Data binding?
Slide 6
Slide 6 text
What is the biggest
problem developing with
Android?
Slide 7
Slide 7 text
Android Problems
● Fragmentation anyone?
● Let`s talk about it…
● How many support libraries are there?
Slide 8
Slide 8 text
Design Support Library
Slide 9
Slide 9 text
Design Support Library
Yet Another Support Library:
compile 'com.android.support:design:22.2.0'
Embeds the normal support library
Slide 10
Slide 10 text
Design Support Library
● Snackbar -> fixing toasts and “manual”
snackbars
Snackbar.make(view, "Your message", LENGTH_SHORT)
.setAction(getString(R.string.text_undo), this)
.show();
Slide 11
Slide 11 text
Design Support Library
● FAB -> replaces “manual” libraries
Slide 12
Slide 12 text
Design Support Library
Customizable (size, tint, border, ripple…)
Slide 13
Slide 13 text
Design Support Library
● TextInputLayout -> awesome fields with
floating hints and errors
Slide 14
Slide 14 text
Design Support Library
Slide 15
Slide 15 text
Design Support Library
And errors:
setErrorEnabled(true);
setError(getString(R.string.text_error_message));
Slide 16
Slide 16 text
Design Support Library
● NavigationView replaces “manual” sidebar
Slide 17
Slide 17 text
Design Support Library
Slide 18
Slide 18 text
Design Support Library
We can group menu entries, change
background, capture click events...
Slide 19
Slide 19 text
Design Support Library
● TabLayout -> tabs made easy
Slide 20
Slide 20 text
Design Support Library
● TabMode
● Listeners
● Integration with ViewPager
● ...
Slide 21
Slide 21 text
Design Support Library
● CoordinatorLayout & AppBarLayout ->
automatic transitions and integration with
toolbar (or FAB…)
● Scroll actions like enterAlways
● Parallax effect
Slide 22
Slide 22 text
Design Support Library
● Vector drawables (this is cool) -> better
shapes
● Only on M
● But easy to animate!
Slide 23
Slide 23 text
Design Support Library
● And new support library version…
○ colorPrimary <3
● And new play-services…
● And support annotations
○ (Null, resources, threading, permissions…)
Slide 24
Slide 24 text
Design support library
Looks great but…
bugs!
Slide 25
Slide 25 text
App Permissions
Slide 26
Slide 26 text
App permissions
Now you have to be aware of the permissions
(and the chain of permissions!)
● You define the permissions in the manifest
(as always)
● But there are NORMAL permissions and
SPECIAL.
Slide 27
Slide 27 text
App permissions
Permission is requested on first use for
SPECIAL permissions.
● You have to check explicitly
● You have to deal with revoking a permission
○ Or the user deciding against granting it
Slide 28
Slide 28 text
App permissions
Only for M targeted builds!
Build.VERSION
Context.checkSelfPermission(permission_name)
Activity.requestPermissions(String[], int)
public void onRequestPermissionsResult(...)
Slide 29
Slide 29 text
App permissions
Reference
Slide 30
Slide 30 text
App Links
Slide 31
Slide 31 text
App links
Allow registering your app as default handler
(instead of dialog) of links.
Slide 32
Slide 32 text
App links
● Host a JSON, including your fingerprint
● And request the verification from your
manifest
Reference
Slide 33
Slide 33 text
Data binding
Slide 34
Slide 34 text
Data binding
● Declarative layouts
● Less code
Yeah… but why?
Simple Example
Slide 35
Slide 35 text
Data binding
Slide 36
Slide 36 text
Data binding
ActivityBindingBinding binding =
DataBindingUtil.setContentView(this,
R.layout.activity_binding);
binding.setMovie(new Movie("Mad Max"));
Slide 37
Slide 37 text
Data binding
Conditionals:
android:visibility="@{movie.isNew ? View.VISIBLE :
View.GONE}"
Includes:
Slide 38
Slide 38 text
Data binding
● Expression language!
Like JSTL, JSF: concatenation, math
expressions, comparisons, casts, method
calls…
Except this, new and super.
Slide 39
Slide 39 text
Data binding
New operators!
?? like || in JS
android:text="@{movie.displayName ?? movie.title}"
Slide 40
Slide 40 text
Data binding
NPE tolerant:
@{movie.name}
-> returns null if movie is null
Slide 41
Slide 41 text
Data binding
“Live” data binding with Observable Objects:
● inherit from BaseObservable
● @Bindable in getter
● notifyPropertyChanged in setter
Or being a instance of ObservableField or
ObservableArrayMap...
Slide 42
Slide 42 text
Data binding
Lots of more stuff:
● Converters
● Custom getters/setters
● Dynamic binding
● ...
Reference
Slide 43
Slide 43 text
Direct share
Slide 44
Slide 44 text
Direct share
Easy & powerful way of sharing :)
But only in M… (right now)
Slide 45
Slide 45 text
Backup & restore
Slide 46
Slide 46 text
Backup & restore
● Google Drive
● Every 24 hours
● Opt out
● Don’t do it with the registrationId
Slide 47
Slide 47 text
Backup & restore
Reference with the manifest and specify what
to save:
android:fullBackupContent="@xml/mybackupscheme"
Slide 48
Slide 48 text
Backup & restore
Testeable!:
adb shell bmgr run
Reference
Slide 49
Slide 49 text
And more things...
Slide 50
Slide 50 text
And more things...
● Cloud test lab
● Doze (testeable!)
● Now on tap
● API device unlock
● Developer page
● Lots.
Slide 51
Slide 51 text
Not Android L
but a lot of cool stuff
Slide 52
Slide 52 text
References
● Good android guide
● Exploring design support library !
● And another great one !