Slide 1

Slide 1 text

MvvmCross & Material design Building Native Cross-Platform Apps Martijn van Dijk @mhvdijk [email protected] github.com/martijn00 speakerdeck.com/martijn00

Slide 2

Slide 2 text

Agenda ■ What is MvvmCross ■ Material Design explained ■ Bringing Material design to life with Android support

Slide 3

Slide 3 text

Why Mvvm? View Binder ViewModel Model Button Text 1. Action 1. Action 3. Command 5. Notify change 6. Change data 4. Access data 2. Event handling

Slide 4

Slide 4 text

Why MvvmCross? ■ Cross-platform awesomeness! ■ Support for all major platforms ■ Most advanced Mvvm library for Xamarin and .NET cross platform ■ Large and engaged community ■ Fast release cycle ■ Clean and easy conventions Miguel de Icaza (Xamarin CTO) “I love MvvmCross” ■ Used by many enterprise companies e.g: - Microsoft - Xamarin inc. - Dutch government - Olo - Nokia Scott Hanselman (Microsoft Developer Evangelist) “I am really impressed with MvvmCross”

Slide 5

Slide 5 text

MvvmCross supported platforms ■ Android ■ iOS ■ Windows ■ Xamarin.Forms ■ tvOS ■ Google wear ■ iWatch ■ Mac

Slide 6

Slide 6 text

MvvmCross details Highlights ■ Flexible architecture ■ PCL based ■ Inversion of Control ■ Dependency injection ■ Value Converters ■ Bindings ■ Testable ■ Plugins Resources ■ Github.com/MvvmCross ■ MvvmCross.com ■ Slack (#mvvmcross) ■ Stackoverflow ■ Xamarin Forums

Slide 7

Slide 7 text

Presenters Specifications ■ Customize view presentation ■ Platform-specific ■ Still retain View Model logic ■ Presentation hints Examples ■ Tabs / Panorama ■ Split View / Master-Detail ■ Fragments ■ Modals ■ Hamburger menu

Slide 8

Slide 8 text

Plugins ■ Messenger ■ Phone Call ■ Picture Chooser ■ SQLite ■ Visibility ■ Web Browser + Many More! MvvmCross ■ Accelerometer ■ Download Cache ■ Email ■ File ■ Json ■ Localization ■ Location Plugins available at https://github.com/MvvmCross/MvvmCross-Plugins

Slide 9

Slide 9 text

Generics ■ MvvmCross uses CoC (Convention over Configuration) by default - LoginView > LoginViewModel ■ Generics can be used too - LoginView : MvxActivity - MainView : MvxActivity ■ Possible to override in setup.cs - protected override IDictionary GetViewModelViewLookup()

Slide 10

Slide 10 text

IoC (Inversion of Control) 1. Use interfaces 2. Define implementation of interfaces at runtime 3. Job done! :) ■ Singleton: Mvx.RegisterSingleton(); ■ Lazy: Mvx.ConstructAndRegisterSingleton(); ■ Dynamic: Mvx.RegisterType(); Mvx.Resolve();

Slide 11

Slide 11 text

What is material design? and how it helps the user understand what’s happening.

Slide 12

Slide 12 text

It’s not only a “designer thingy”

Slide 13

Slide 13 text

The 3 principles of Material design

Slide 14

Slide 14 text

Principle 1 Material is the metaphor

Slide 15

Slide 15 text

met·a·phor noun A thing regarded as representative or symbolic of something else, especially something abstract.

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

The 3D space of Material design

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Principle 2 Bold, graphic, intentional

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Principle 3 Motion provides meaning

Slide 25

Slide 25 text

Material reacts to user input but is never distracting

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

Material & Android support for MvvmCross ■ Design - NavigationView - FloatingActionButton ■ AppCompat - android:Theme - Toolbar - DrawerToggle ■ V4 - DrawerLayout - SwipeRefresh - ViewPager (FragmentStatePager) ■ LeanBack ■ Preference - Compat Fragments ■ Fragging - V4 Fragments - MvxCachingFragmentActivity ■ RecyclerView - ItemTouchHelper for Xamarin

Slide 29

Slide 29 text

Other Material & Android support libraries ■ Cardview ■ Pallete ■ Gridlayout ■ Mediarouter ■ V8 Support ■ V13 Support ■ Annotations support ■ Custom tabs ■ Percent support ■ Recommendation support

Slide 30

Slide 30 text

How to use it?

Slide 31

Slide 31 text

Tips ■ Keep it simple ■ Separation of Concerns ■ Don’t try to invent the wheel again, use plugins, samples, etc ■ Use Xamarin player or GenyMotion as emulator for Android ■ Test all changes (UITest, Unit test, etc) ■ Use a common PCL profile (profile7 or profile259) or .NET Platform Standard ■ Enable “Analysis” XS > Preferences > Text Editor > Source Analysis > Enable ■ Get help on Slack: https://xamarinchat.herokuapp.com/ ■ Follow influencers on Twitter #Xamarin #MvvmCross

Slide 32

Slide 32 text

Xamarin & MvvmCross Hackathon ■ Wednesday December 16th ■ Thursday January 14th ■ C#6 and Xamarin Plugins ■ Get experience using real life scenarios ■ Have fun! http://www.meetup.com/Xamarin-MvvmCross-Meetup/