Elements of the HC Look & Feel ● Status Bar – At the bottom now – Soft keys for HOME, BACK, etc. ● Action Bar – Combination toolbar, options menu, context menu, and title bar ● Holographic Theme
Enabling the HC Look & Feel ● <uses-sdk android:targetSdkVersion=“11” /> – Gives your widgets the Holographic theme, unless you overrode it – Replaces a MENU button in status bar with your options menu in the action bar
Adding to the Action Bar ● android:showAsAction – ifRoom or always – withText for text+icon vs. just icon ● android:actionLayout – Layout resource to inflate into the action bar instead of a toolbar button
Fragments: What and Why ● What: Layer Between Activity and View – Designed to create internally-reusable facets of your UI, to be combined based upon screen size – Can animate on/off, have own BACK stack ● Why: Future Honeycomb-on-Phones – Tries to simplify having single UI definition that scales up for larger screens
Fragments: User Experience ● Lists With Selection – Normally, touch mode is an action ● Lists Plus Detail Simultaneously – ...on tablets – Phones will have as separate activities due to limited screen space ● Intra-Activity BACK Operation
Fragments: The Mechanics ● Create Fragment Classes – Extend Fragment, ListFragment, etc. – Override onCreateView() to define content ● E.g., inflated layout – Lifecycle Methods ● onActivityCreated() ● onSaveInstanceState() ● Etc.
Fragments: The Mechanics ● Displaying Fragments – Embed in activity layouts via <fragment> ● Large/xlarge layouts have multiple fragments ● Small/normal layouts have single fragment – Add dynamically via FragmentManager – FragmentTransaction ● Add, replace, remove, etc. ● Configure if “transaction” can be reversed via BACK
Fragments: The Mechanics ● Problem: Backwards Compatibility – Fragments firmly in API Level 11 – Backwards-compatible fragment implementation in the works ● Android library project ● Wrapper API that uses Honeycomb if available or internal implementation if not ● Not available at the time of this writing
App Widgets in Honeycomb ● Adapter-Driven Widget Contents – ListView, GridView, StackView, AdapterViewFlipper – RemoteViewsService ● Preview Images – Shown to user before app widget is added to screen
Notifications in Honeycomb ● What We Gain – Control over Growl-style large pop-ups ● What We Lose – number ● What Users Lose – Single clear button – now individual close buttons per Notification
Animations in Honeycomb ● Animate Arbitrary Properties – E.g, change colors – ValueAnimator and ObjectAnimator – New view properties for rotation, pivot, scale, etc. – Can generally replace much of classic animation framework (translation, rotation, etc.)
The Rest of the HC Story ● android:hardwareAccelerated="true" – Speeds things up, but false by default for compatibility ● Rich Clipboard Contents ● Drag-and-Drop – For moving data, not widgets – Same engine as new clipboard contents
The Rest of the HC Story ● Loaders for asynchronous loading of data – Particularly for use with content providers ● New widgets: CalendarView, SearchView, NumberPicker, etc. ● Renderscript for 3D work ● Touch events across widgets ● And on, and on, and on...
Ice Cream Sandwich ● Current Working Theory – Android 3.1 – Summer 2011 – Honeycomb UI, other Android 3.0 goodness brought to phones ● Not everything, due to screen size or lower hardware requirements
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.