with a little help from my libs

200
With a little help from my Libs By Royi Benyossef (+royiby)

Upload: royi-benyossef

Post on 28-Jul-2015

195 views

Category:

Mobile


1 download

TRANSCRIPT

Page 1: With a little help from my libs

With a little help from my Libs By Royi Benyossef (+royiby)

Page 2: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Android developer since 2009.

GDG Herzliya co-founder.

Android speaker and lecturer.

Android Mentor at CampusTLV.

Android GDE 2013, 2014, 2015.

Android group leader at Vidmind.

Royi Benyossef

Page 3: With a little help from my libs

Motivation

Why am i here?

Page 4: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Motivation

Page 5: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Motivation

Less fragmentation

Page 6: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Motivation

- Less fragmentation

Better looking UIs

Page 7: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Motivation

- Less fragmentation- Better looking UIs

More stability

Page 8: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Motivation

- Less fragmentation- Better looking UIs- More stability

Less boilerplate code

Page 9: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Page 10: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Google to the rescue!

Page 11: With a little help from my libs

Compat

support library

Page 12: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AppCompat(Widgets and lifecycles)

Page 13: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

Definition Views

Page 14: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

Definition ViewsWidgets

Page 15: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

Definition ViewsWidgetsActivities

Page 16: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

Definition ViewsWidgetsActivitiesDialogs

Page 17: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

Definition ViewsWidgetsActivitiesDialogs}Backw

ardCompatible

Page 18: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

Definition Backward compatible app components

Page 19: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

- Definition

AC*Activity Replaces ActionBarActivity

Page 20: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

- Definition

AC*Activity Replaces ActionBarActivityConsistent theming

Page 21: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

- Definition

AC*Activity Replaces ActionBarActivityConsistent themingTinting

Page 22: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

- Definition

AC*Activity Replaces ActionBarActivityConsistent themingTintingLifecycle

Page 23: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

- Definition

AC*Activity Replaces ActionBarActivityConsistent themingTintingLifecycleAppbar

Page 24: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

- Definition- AC*Activity

AC*DelegateAppCompat capabilities

Page 25: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

- Definition- AC*Activity

AC*DelegateAppCompat capabilitiesWorks on all Activities

Page 26: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

- Definition- AC*Activity- AC*Delegate

AC*Dialog

Material design

Page 27: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

- Definition- AC*Activity- AC*Delegate

AC*Dialog

Material designLollipop lifecycle

Page 28: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

App compat

- Definition- AC*Activity- AC*Delegate

AC*Dialog

Material designLollipop lifecycleNew animations

Page 29: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

DrawableCompat(Image tinting)

Page 30: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

Definition Tinting capabilities (V4)

Page 31: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

Definition Tinting capabilities (V4)Tintable views (AppCompat)

Page 32: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

Definition Tintable views (AppCompat):

>*AutoCompleteTextView

Page 33: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

Definition Tintable views (AppCompat):

*AutoCompleteTextView

>*Button

Page 34: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

Definition Tintable views (AppCompat):

*AutoCompleteTextView

*Button>*Checkbox

Page 35: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

Definition Tintable views (AppCompat):

*AutoCompleteTextView

*Button*Checkbox>*Spinner

Page 36: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

Definition Tintable views (AppCompat):

*AutoCompleteTextView

*Button*Checkbox*Spinner>...more!

Page 37: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

- Definition

Usages Branding

Page 38: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

- Definition

Usages BrandingLess drawables (less size)

Page 39: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

- Definition

Usages BrandingLess drawables (less size)Reuse w/o repetition

Page 40: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

DrawableCompat(Example)

Page 41: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

CustomView.wrap(drawable)

Page 42: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

CustomView.wrap(drawable) = > setTint()

Page 43: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

CustomView.wrap(drawable) = setTint()> setTintList()

Page 44: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Drawable compat

CustomView.wrap(drawable) = setTint()setTintList()>

setTintMode()

Page 45: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring(Available as of API level 4)

Page 46: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

Definition Match colors to content

Page 47: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

Definition Match colors to contentCreate diversity and interest

Page 48: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

- Definition

Palette Introduced in lollipop

Page 49: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

- Definition

Palette Introduced in lollipop Retrieve color from content

Page 50: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

- Definition

Palette Introduced in lollipop Retrieve color from contentChoose matching swatch

Page 51: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

- Definition

Palette Introduced in lollipop Retrieve color from contentChoose matching swatch = Profit

Page 52: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

- Definition

Palette Palette.from(bitmap)

Page 53: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

- Definition

Palette Palette.from(bitmap)

>6-8 times faster

Page 54: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

- Definition

Palette Palette.from(bitmap)

6-8 times faster> sync and

async

Page 55: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

- Definition- Palette

ColorUtilsAvailable from API level 4

Page 56: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

- Definition- Palette

ColorUtilsAvailable from API level 4Some of Palette’s internals

Page 57: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

- Definition- Palette

ColorUtilsAvailable from API level 4Some of Palette’s internals

>Calculate contrast

Page 58: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

- Definition- Palette

ColorUtilsAvailable from API level 4Some of Palette’s internals

Calculate contrast

>Determine min alpha

Page 59: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Content driven coloring

- Definition- Palette

ColorUtilsAvailable from API level 4Some of Palette’s internals

Calculate contrast

Determine min alpha

>Colors to HSL

Page 60: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Interpolators(Authentic motion is important)

Page 61: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Interpolators

Definition Controllers for animation change rate

Page 62: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Interpolators

- Definition

Diff Fast out linear in

Page 63: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Interpolators

- Definition

Diff Fast out linear inFast out slow in

Page 64: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Interpolators

- Definition

Diff Fast out linear inFast out slow inLinear out slow in

Page 65: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Interpolators

- Definition

Diff Fast out linear inFast out slow inLinear out slow inPathInterpolarCompat

Page 66: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

RecyclerView(ListView is just a fading memory)

Page 67: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

RecyclerView

Definition Replaced ListView in Lollipop

Page 68: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

RecyclerView

- Definition

SortedList Sorted list of custom objects

Page 69: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

RecyclerView

- Definition

SortedList Sorted list of custom objects Efficient CRUD event dispatch

Page 70: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

RecyclerView

- Definition

SortedListSorted list of custom objects Efficient CRUD event dispatchChanges batching

Page 71: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Leanback(AndroidTV best practices)

Page 72: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

RecyclerView

Definition GuidanceView

Page 73: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

RecyclerView

Definition GuidanceViewClasses & themes

Page 74: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

RecyclerView

Definition GuidanceViewClasses & themesMulti-step process

Page 75: With a little help from my libs

Design

support library

Page 76: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

NavigationView(NavigationDrawer++)

Page 77: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

NavigationView

Definition NavigationDrawer ++

Page 78: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

NavigationView

Definition NavigationDrawer ++Clearer navigation

Page 79: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

NavigationView

Definition NavigationDrawer ++Clearer navigationIdentity focal point

Page 80: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

NavigationView

- Definition

Diff Inflation from .xml

Page 81: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

NavigationView

- Definition

Diff Inflation from .xmlRuntime updates

Page 82: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

NavigationView

- Definition

Diff Inflation from .xmlRuntime updatesCallbacks

Page 83: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Navigation view

- Definition

Diff Inflation from .xmlRuntime updatesCallbacksScrim protection

Page 84: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Navigation view

- Definition

Diff Inflation from .xmlRuntime updatesCallbacksScrim protectionSubheaders

Page 85: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

NavigationView(Example)

Page 86: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

NavigationView

Layout <android.support.v4.widget.DrawerLayout 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">

<!-- your content layout -->

<android.support.design.widget.NavigationView android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerLayout="@layout/drawer_header" app:menu="@menu/drawer"/></android.support.v4.widget.DrawerLayout>

Page 87: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

NavigationView

- Layout

Menu<group android:checkableBehavior="single"> <item android:id="@+id/navigation_item_1" android:checked="true" android:icon="@drawable/ic_android" android:title="@string/navigation_item_1"/> <item android:id="@+id/navigation_item_2" android:icon="@drawable/ic_android" android:title="@string/navigation_item_2"/></group>

Page 88: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

NavigationView

- Layout- Menu

Subheaders

<item android:id="@+id/navigation_subheader" android:title="@string/navigation_subheader"> <menu> <item android:id="@+id/navigation_sub_item_1" android:icon="@drawable/ic_android" android:title="@string/navigation_sub_item_1"/> <item android:id="@+id/navigation_sub_item_2" android:icon="@drawable/ic_android" android:title="@string/navigation_sub_item_2"/> </menu></item>

Page 89: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

EditText(Labels & hints)

Page 90: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

EditText

Definition New labels and messages

Page 91: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

EditText

Definition New labels and messagesMore states

Page 92: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

EditText

Definition New labels and messagesMore statesMore clarity

Page 93: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

EditText

- Definition

Diff Floating labels

Page 94: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

EditText

- Definition

Diff Floating labelsError messages

Page 95: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

FAB(Absolutely FABulous)

Page 96: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Floating action button

Definition Primary action

Page 97: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Floating action button

Definition Primary actionPromoted items

Page 98: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Floating action button

Definition Primary actionPromoted itemsContinuous (mini FAB)

Page 99: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Floating action button

- Definition

Diff Standard implementation

Page 100: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

SnackBar(hmm… yum!)

Page 101: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Snack bar

Definition Toast++

Page 102: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Snack bar

- Definition

Diff New addition!

Page 103: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Snack bar

- Definition- Diff

UsagesOperation feedback

Page 104: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Snack bar

- Definition- Diff

UsagesOperation feedbackTemporary state

Page 105: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Snack bar

- Definition- Diff

UsagesOperation feedbackTemporary stateLong action result

Page 106: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

SnackBar(Example)

Page 107: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Snack bar

Show Snackbar .make(parentLayout, R.string.snackbar_text, Snackbar.LENGTH_LONG) .setAction(R.string.snackbar_action, myOnClickListener) .show(); // Don’t forget to show!

Page 108: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

TabLayout(Not just a material design thingy)

Page 109: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Tab layout

Definition Tabs 15.0

Page 110: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Tab layout

- Definition

Diff Adding programmatically

Page 111: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Tab layout

- Definition

Diff Adding programmaticallyViewPager integration

Page 112: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Tab layout

- Definition

Diff Adding programmaticallyViewPager integrationEasy fixed size or scrollable

Page 113: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Tab layout

- Definition- Diff

UsagesTop level nav. pattern

Page 114: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Tab layout

- Definition- Diff

UsagesTop level nav. patternContent group organizing

Page 115: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Tab layout

- Definition- Diff

UsagesTop level nav. patternContent group organizingViewPager mgmt.

Page 116: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

CoordinatorLayout(Because something needs to be)

Page 117: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Coordinator layout

Definition Child view touch event control

Page 118: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Coordinator layout

- Definition

Diff New!

Page 119: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Coordinator layout

- Definition- Diff

UsagesAnimated FAB

Page 120: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Coordinator layout

- Definition- Diff

UsagesAnimated FABlayout_anchor

Page 121: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Coordinator layout

- Definition- Diff

UsagesAnimated Floating action barlayout_anchorAppBar scrolling techniques

Page 122: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Coordinator layout

- Definition- Diff

UsagesAppBar scrolling techniques:

> Scrol

Page 123: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Coordinator layout

- Definition- Diff

UsagesAppBar scrolling techniques:

Scrol> Enter

always

Page 124: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Coordinator layout

- Definition- Diff

UsagesAppBar scrolling techniques:

ScrolEnter always

> Enter always collapsed

Page 125: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Coordinator layout

- Definition- Diff

UsagesAppBar scrolling techniques:

ScrolEnter always

Enter always collapsed

> Exit until collapsed

Page 126: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

CoordinatorLayout(Example)

Page 127: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Coordinator layout

AppBar <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"...> <! -- Your Scrollable View --> <android.support.v7.widget.RecyclerView android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.Toolbar app:layout_scrollFlags="scroll|enterAlways"> <android.support.design.widget.TabLayout app:layout_scrollFlags="scroll|enterAlways"> </...AppBarLayout></...CoordinatorLayout>

Page 128: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

CollapsingToolbar(You prayers has been answered)

Page 129: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Collapsing toolbar layout

Definition Animation controls

Page 130: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Collapsing toolbar layout

- Definition

Diff New!!!

Page 131: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Collapsing toolbar layout

- Definition-Diff

UsagesCollapse mode

Page 132: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Collapsing toolbar layout

- Definition-Diff

UsagesCollapse mode:

> Pin

Page 133: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Collapsing toolbar layout

- Definition-Diff

UsagesCollapse mode:

Pin> Parallax

Page 134: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Collapsing toolbar layout

- Definition-Diff

UsagesCollapse mode:

PinParallax

Layout parallax multiplier

Page 135: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

CollapsingToolbar(Example)

Page 136: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Coordinator layout

Pin <android.support.design.widget.AppBarLayout android:layout_height="192dp" android:layout_width="match_parent"> <android.support.design.widget.CollapsingToolbarLayout android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <android.support.v7.widget.Toolbar android:layout_height="?attr/actionBarSize" android:layout_width="match_parent" app:layout_collapseMode="pin"/> </android.support.design.widget.CollapsingToolbarLayout></android.support.design.widget.AppBarLayout>

Page 137: With a little help from my libs

Testingsupport library

Page 138: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Testing support library

Definition Backward compatible (API 8)

Page 139: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Testing support library

Definition Backward compatible (API 8)All test tool dependencies

Page 140: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner(Junit-¾ + testing framework)

Page 141: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

Definition Junit 3/4 compatible

Page 142: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

Definition Junit 3/4 compatibleActs as testing framework

Page 143: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

Definition Junit 3/4 compatibleActs as testing frameworkInstrumentationTestRunner

Page 144: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition

Jurisdiction Load test pkgs to device

Page 145: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition

Jurisdiction Load test pkgs to deviceRuns test

Page 146: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition

Jurisdiction Load test pkgs to deviceRuns test Reports results

Page 147: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction

Instrum. info.Related to test run

Page 148: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction

Instrum. info.Related to test runInstrumentation obj

Page 149: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction

Instrum. info.Related to test runInstrumentation objTarget app context

Page 150: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction

Instrum. info.Related to test runInstrumentation objTarget app contextTest app context

Page 151: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction

Instrum. info.Related to test runInstrumentation objTarget app contextTest app contextCmd line args

Page 152: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction

Instrum. info.Related to test runInstrumentation objTarget app contextTest app contextCmd line args= UIAutomator GOLD!

Page 153: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

@RunWith(AndroidJUnit4.class)

public class CalculatorInstrumentationTest extends ActivityInstrumentationTestCase2<CalculatorActivity> {

@Before

public void setUp() throws Exception {

super.setUp();

injectInstrumentation(InstrumentationRegistry.getInstrumentation());

mActivity = getActivity();

}

@Test

public void typeOperandsAndPerformAddOperation() {}

@After

public void tearDown() throws Exception {

super.tearDown();

}

}

Page 154: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction- Instrum. info.

Filtering

@RequiresDevice

Page 155: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction- Instrum. info.

Filtering

@RequiresDevice@SdkSupress

Page 156: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction- Instrum. info.

Filtering

@RequiresDevice@SdkSupress@SdkSupress(minAPI)

Page 157: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction- Instrum. info.

Filtering

@RequiresDevice@SdkSupress@SdkSupress(minAPI)@Small/Medium/LargeTest

Page 158: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction- Instrum. info.- Filtering

Sharding

Test case subset ability

Page 159: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction- Instrum. info.- Filtering

Sharding

Test case subset abilityRun full suite or by shards

Page 160: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction- Instrum. info.- Filtering

Sharding

Test case subset abilityRun full suite or by shardsIdentification by index

Page 161: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

AndroidJunitRunner

- Definition- Jurisdiction- Instrum. info.- Filtering

Sharding(Ex.)

adb shell am

instrument -w

-e numShards 10

-e shardIndex 2

Page 162: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso(Short, intense and efficient UI testing)

Page 163: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

Definition UI flow testing framework

Page 164: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

Definition UI flow testing frameworkWhite-box style

Page 165: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

Definition UI flow testing frameworkWhite-box style(Reliant on target app code)

Page 166: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition

View matchingUse target app R.id.*

Page 167: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition

View matchingUse target app R.id.*Matcher will search and find

Page 168: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition

View matchingonView(

withId

(

R.id.my_button

)

);

Page 169: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching

AdaptersDynamic data

Page 170: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching

AdaptersDynamic dataonView() might not work

Page 171: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching

AdaptersDynamic dataonView() might not workEspresso.onData()!

Page 172: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching

AdaptersDynamic dataonView() might not workEspresso.onData():

> data population event

Page 173: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching

AdaptersDynamic dataonView() might not workEspresso.onData():

data population event

> User action reference

Page 174: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching- Adapters

Actions API

View clicks

Page 175: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching- Adapters

Actions API

View clicksSwipes

Page 176: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching- Adapters

Actions API

View clicksSwipesKey & button press

Page 177: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching- Adapters

Actions API

View clicksSwipesKey & button pressText typing

Page 178: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching- Adapters

Actions API

View clicksSwipesKey & button pressText typingOpening links

Page 179: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching- Adapters

Actions API

// Type text into an EditText view, then close the

soft keyboard

onView(withId(R.id.editTextUserInput))

.perform(typeText(STRING_TO_BE_TYPED),

closeSoftKeyboard());

// Press the button to submit the text change

onView(withId(R.id.changeTextBt)).perform(click());

Page 180: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching- Adapters- Actions API

Thread sync

Fully integrated

Page 181: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching- Adapters- Actions API

Thread sync

Fully integratedNo sleep()

Page 182: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching- Adapters- Actions API

Thread sync

Fully integratedNo sleep()No wait()

Page 183: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching- Adapters- Actions API

Thread sync

Fully integratedNo sleep()No wait()No to test flakiness!

Page 184: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Espresso

- Definition- View matching- Adapters- Actions API

Thread sync

Fully integratedNo sleep()No wait()No to test flakiness!Yes to determinism!!!

Page 185: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

UIAutomator(Because not all the names can be witty)

Page 186: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

UIAutomator

Definition Black-box UI flow testing

Page 187: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

UIAutomator

Definition Black-box UI flow testing(No reliance on target code)

Page 188: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

UIAutomator

- Definition

APIs UIDevice (.pressHome())

Page 189: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

UIAutomator

- Definition

APIs UIDevice (.pressHome())UICollection

Page 190: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

UIAutomator

- Definition

APIs UIDevice (.pressHome())UICollectionUIObject

Page 191: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

UIAutomator

- Definition

APIs UIDevice (.pressHome())UICollectionUIObjectUIScrollable

Page 192: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

UIAutomator

- Definition

APIs UIDevice (.pressHome())UICollectionUIObjectUIScrollableUISelector

Page 193: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

UIAutomator

- Definition

APIs UIDevice (.pressHome())UICollectionUIObjectUIScrollableUISelectorConfigurer

Page 194: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Summary(What did we have here?)

Page 195: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Key points

AppCompat

Page 196: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Key points

- AppCompat

V4/V7/V13 support lib

Page 197: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Key points

- AppCompat- V4/V7/V13 support lib

Design support lib

Page 198: With a little help from my libs

With a little help from my libs by Royi Benyossef (+royiby)

Key points

- AppCompat- V4/V7/V13 support lib- Design support lib

Testing support lib

Page 199: With a little help from my libs

“We should be building great things. Things that Don’t yet exist”

Page 200: With a little help from my libs

I Hope You Liked ItThank you for listening

By Royi Benyossef (+royiby)