Android Development 201

1,174 views

Published on

Lecture about some advanced themes in Android development.
Faculty of Informatics, Masaryk University, 2014

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

No Downloads
Views
Total views
1,174
On SlideShare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
11
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Android Development 201

  1. 1. Android Development 201 Tomáš Kypta
  2. 2. Android Wear
  3. 3. Android Wear • extension to Android platform • wearable devices
  4. 4. Android Wear • UI core functions • Suggest • Demand
  5. 5. Android Wear • Suggest: The Context Stream
  6. 6. Android Wear • Demand: The Cue Card
  7. 7. Android Wear • Developer Preview • Notifications • Voice input from a notification • Notifications with additional pages
  8. 8. Design Patterns
  9. 9. ActionBar • dedicated piece of UI at the top of each screen • consistent navigation • important actions • app identity
  10. 10. ActionBar • navigation up the hierarchy
  11. 11. ActionBar • can have up to 3 parts • main action bar • top bar (tab bar) • bottom bar • layout differs for portrait and landscape
  12. 12. Navigation Drawer • panel that transitions from the left edge of the screen • displays the app’s main navigation options
  13. 13. Multi-pane layouts • many different screen sizes and types of devices • provide balanced and aesthetically pleasing layout
  14. 14. Multi-pane layouts • do not forget different orientations • strategies • stretch/compress • adjust the left column width ! ! • stack • rearrange the panels
  15. 15. Multi-pane layouts • strategies • expand/collapse • show only the most important information in the left panel ! ! • show/hide • in portrait behave like phone
  16. 16. Swipe views
  17. 17. Swipe views • allow efficient navigation between items • swiping between detail views • swiping between tabs
  18. 18. Swipe-to-dismiss • dismiss list item by swiping left or right
  19. 19. Swipe-to-dismiss with Undo
  20. 20. Pull-to-refresh • refresh list by pulling down • different on Android and iOS
  21. 21. Selection (contextual action bar) • use long press gesture to select data • contextual action bar is a temporary action bar
  22. 22. Libraries for Android Development
  23. 23. Libraries • saves time and work • it might be painful without libraries • back-porting new API to older Android versions • simplifying API
  24. 24. Libraries • The ideal library? • “perform one task and perform it well” • open-source
  25. 25. ActionBar • ActionBarSherlock • ActionBarCompat • support-v7
  26. 26. Dialogs • Why do we need a library for dialogs?
  27. 27. Dialogs
  28. 28. Dialogs • Let’s simplify • android-styled-dialogs
  29. 29. Dialogs • android-styled-dialogs • backports dialogs in Holo theme • makes styling and using dialogs a piece of cake
  30. 30. Dialogs
  31. 31. Pull-to-refresh • ActionBar-PullToRefresh
  32. 32. Navigation Drawer • DrawerLayour • support-v4 • SlidingMenu • android-menudrawer
  33. 33. Swipe views • ViewPager • support-v4
  34. 34. Swipe-to-dismiss • Android-SwipeToDismiss • SwipeToDismissNOA • backport to Android 2.x • SwipeToDismissUndoList • with undo
  35. 35. Networking • OkHttp • SPDY support • Volley • easier and faster networking
  36. 36. REST API • retrofit • simple REST client for Android and Java
  37. 37. Image loaders • displaying images from web
  38. 38. Image loaders • Volley • NetworkImageView • Picasso • easy to use • Android-Universal-Image-Loader • powerful and flexible library
  39. 39. View injection • getting rid of boilerplate code • TextView title = (TextView) findViewById(R.id.title);! • Butter Knife • @InjectView(R.id.title) TextView title;! • can’t be used in libraries
  40. 40. Dependency injection • Dagger
  41. 41. Event bus • Otto • Guava based event bus
  42. 42. IntelliJ IDEA plugins • android-selector-chapek • generates drawable selectors from appropriately named Android resources • android-butterknife-zelezny • allows one-click creation of Butterknife view injections
  43. 43. UI debugging • android-grid-wichterle • app that shows grid overlay • helps to verify app design
  44. 44. UI debugging • Scalpel • debugging tool to uncover the layers under our app
  45. 45. UI niceties • NineOldAndroids • backports animation API introduced in Android 3.0 • ViewPagerIndicator • paging indicator widgets for ViewPager
  46. 46. UI niceties • PagerSlidingTabStrip
  47. 47. Unit testing • Roboelectric • fest-android • FEST assertions geared toward testing Android
  48. 48. Other • Guava
  49. 49. Developing Libraries
  50. 50. Developing Libraries • jar • apklib • aar
  51. 51. Developing Libraries • How to publish?
  52. 52. Maven
  53. 53. Maven • project management tool • dependency management
  54. 54. Maven • repositories • The Central Repository • local repository
  55. 55. Maven • Configuration file • pom.xml
  56. 56. Maven • lifecycle phases • validate • compile • test • package • install • deploy
  57. 57. Maven • android-maven-plugin • mvn clean package android:deploy android:run
  58. 58. Gradle
  59. 59. Gradle • new build system introduced by Google • DSL • dependency management through Maven and/or Apache Ivy
  60. 60. ListView & EmptyView
  61. 61. ListView & EmptyView • How to effectively manage list loading and empty views?
  62. 62. ProGuard
  63. 63. ProGuard • shrinking • obfuscation • optimizing • repackaging
  64. 64. ProGuard • build time • reflection
  65. 65. ProGuard • Configuration file • proguard.cfg
  66. 66. ProGuard • output files • dump.txt • mapping.txt • seeds.txt • usage.txt
  67. 67. ProGuard • Decoding Obfuscated Stack Traces • ReTrace
  68. 68. ProGuard • Decoding Obfuscated Stack Traces • retrace.sh -verbose mapping.txt obfuscated_stacktrace.txt
  69. 69. Android Lint
  70. 70. Android Lint • static code analysis tool
  71. 71. Android Lint • Correctness • Security • Performance • Usability • Accessibility • I18n
  72. 72. Android Lint • lint path_to_my_project! • IntelliJ IDEA / Android Studio • Analyze > Inspect Code …
  73. 73. Android Lint • lint --check HardcodedText path_to_my_project! • lint —html lint-report.html path_to_my_project
  74. 74. Android Lint • Disabling lint checking • @SupressLint! • tools:ignore
  75. 75. Android Lint • Config file • lint.xml
  76. 76. Android Lint • custom lint rules
  77. 77. StrictMode
  78. 78. StrictMode • developer tool for detecting accidental wrong implementation • detection on current thread • detection on ony thread
  79. 79. Tools Attributes
  80. 80. Tools Attributes • tools:ignore! • @SuppressLint
  81. 81. Tools Attributes • tools:targetApi! • @TargetApi
  82. 82. Tools Attributes • Designtime Layout Attributes • tools:text! • tools:visibility! • etc.
  83. 83. Tools Attributes • tools:locale
  84. 84. Tools Attributes • tools:context
  85. 85. Tools Attributes • tools:layout
  86. 86. Tools Attributes • tools:listitem! • tools:listheader! • tools:listfooter
  87. 87. Traceview
  88. 88. Context
  89. 89. Context • interface to global information about an application environment
  90. 90. Context • Types • Application • Activity/Service • BroadcastReceiver • ContentProvider
  91. 91. Context & Singletons • Use only application context for singletons
  92. 92. Context & UI • Use only activity context
  93. 93. THE END

×