Cross-Platform UI Controls, Andrey Baskov

2,188 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,188
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
40
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Cross-Platform UI Controls, Andrey Baskov

  1. 1. Cross-Platform UI ControlsAndrey Baskov, Touch InstinctMobile Developmentfrom Russia with Love
  2. 2. Put your hands up in the air!
  3. 3. Spring in Russia
  4. 4. In 2 years we’ve written6 720 353Lines of Code using Xamarin
  5. 5. Touch Instinct• Mobile outsourcing powered by Xamarin• Superb looking mobile apps• 2.5 years of experience with Xamarin• Always custom and complex UI• 40 geeks doing some crazy mobile stuff
  6. 6. Sooner – Wheel-based ToDo List
  7. 7. CoinKeeper – Personal Finance
  8. 8. Xamarin +Touch Instinct =Components!
  9. 9. Xamarin Components• Simplify and speedup development• Use the power of professionals• Available right from Xamarin Studio• Distribute and sell your own components• Visit components.xamarin.com
  10. 10. Xamarin ComponentsBefore After
  11. 11. You are at the beginning of new Era.Xamarin Era.
  12. 12. 2008. Appstore Launch.2013. Xamarin Components.
  13. 13. Creating your own component• Get the idea• Crack the code• Publish and set the price• ???• PROFIT!
  14. 14. 80% of what you are doingcan be used by others
  15. 15. 80% of what you are doingmight be already done byothers
  16. 16. Cross-platform UI is that easy:Step 1. Do iOS version.Step 2. Do Android version.Step 3. Do Windows version.
  17. 17. Platforms Differ• Different basics• Different UI-guidelines• Different rendering model• Different devices, resolutions and densities
  18. 18. UI Differs
  19. 19. Adopt UI for each platform
  20. 20. Make simple API
  21. 21. LockScreen
  22. 22. LockScreen APIpublic partial class AppDelegate : UIApplicationDelegate{public override bool FinishedLaunching (UIApplication app, NSDictionary options){Locker.Activate (window);}public override void DidEnterBackground (UIApplication application){Locker.Activate (window);}}
  23. 23. LockScreen APIpublic class MyProtectedActivity : PasscodeProtectedActivity{// ...}
  24. 24. LockScreen APILocker.Enable ();Locker.Disable ();
  25. 25. Make it easy to use,but yet powerful to customize
  26. 26. LockScreen customizationpublic class MyLockSettings : DefaultSettings{public override void InitSettings (){base.InitSettings();PasscodeValidator = new MyLockValidator ();}}
  27. 27. LockScreen customizationclass MyLocker :Locker<MyLockerSettings> { }MyLocker.Activate();MyLocker.Enable();MyLocker.Disable();
  28. 28. Beware of Android!
  29. 29. You can’t pass objects to Activity
  30. 30. var activity = new Activity(mySettings);
  31. 31. var activity = new Activity(mySettings);NO WAY!
  32. 32. public static void Start<CustomSettings> (Context context, Mode mode)where CustomSettings : DefaultSettings, new(){var settingsType = typeof(CustomSettings);var intent = new Intent (context, typeof(LockerActivity));intent.PutExtra (ModeKey, (int)mode);intent.PutExtra (SettingsClassNameKey, settingsType.AssemblyQualifiedName);intent.SetFlags (ActivityFlags.NoHistory);context.StartActivity (intent);}Simply passing an object to Android Activity
  33. 33. protected override void OnCreate (Bundle bundle){// …if (!(Intent.HasExtra (ModeKey) && Intent.HasExtra (SettingsClassNameKey)))throw new ArgumentException ("LockerActivity needs appropriate Intent to be started.");mode = (Mode)Intent.GetIntExtra (ModeKey, (int)Mode.Activate);var settingsClassName = Intent.GetStringExtra (SettingsClassNameKey);var settings = Activator.CreateInstance (Type.GetType (settingsClassName)) as DefaultSettings;if (settings == null)throw new ArgumentException ("LockerActivity settings must be a subclass ofDefaultSettings");// …}
  34. 34. Android isn’t that bad.Android is just fun.
  35. 35. Be aware of memory usage• Presence of Garbage Collector doesn’t meanyou don’t have to think about memory• Each time you create an object considerreusing old one• GREFs are your enemy. Dealing with 2 GCs inAndroid is fun.
  36. 36. Make it shine• Good description• Nice screenshots• Easy to read Getting Started• All this is must have
  37. 37. What’s next• More components• Custom app themes• More UI customization for components• Whatever you would request
  38. 38. We need your feedbackHave any idea or comment?Please, send me an email toab@touchinstinct.comorvisit components.xamarin.com
  39. 39. Thank you!Andrey BaskovTouch Instinctab@touchinstinct.comtouchinstinct.com

×