Unravelling Android N Zoheb Syed Agenda Constraint Layout
Unravelling Android N Zoheb Syed
Agenda • Constraint Layout. • Layout editor (Blueprint mode) • Multi-Window • Picture-in-picture • Quick. Settings • Display Size • Doze Mode • Android Runtime • Project Svelte • Android for Work • Multi. Locale System settings • Support library 23. 2 • Direct boot • Data saver • Scoped directory access • Java 8 support • Instant Apps • Awareness API • Google Assist • Allo messaging app
Constraint Layout
Categories
Evolution of layouts • They have evolved primarily to prevent Nesting and have Shallow Hierarchies which directly affects there performance • Relative Layout to a greater degree helped resolve the problem, Views Can be Positioned based on establishing relationship among views
Constraint Layout • Getting Started • Features – – Unbundled Library Direct Integration with Android Studio Tools Blue Print Mode Currently in alpha Mode but promised faster iterations
attributes
STUDIO 2. 2 • The New Layout Editor to a great deal is what makes the Use of Constraint Layout Awesome • There are various Constraint Handles on a view, which can be used to define constraints among the views
• Resize Handle: Similar to other design/draw applications you may have used, the resize handles allow you to resize the widget. • Side Constraint Handle: The side constraint handles, represented as circles on the sides of each widget, let you specify the location of the widget. For example, you can use a widget's left side constraint handle to always be to the right of another widget by 24 dp. • Baseline Constraint Handle: The baseline constraint handle helps you align the text fields of any two widgets, irrespective of the widget sizes.
This is helpful for example, when you have two widgets of different sizes but want the text inside to be aligned Two Rules to be followed An anchor of a widget in the layout can be connected to any anchor of another widget, with the following exceptions: Anchors of different types cannot be connected. Anchors on different axis, such as left and top anchor cannot be connected. Baseline constraint handles can only be constrained to another baseline. Connecting anchors that would result in a cycle are not permitted.
Layout Editor • Auto Connect Mode Form constraints with the views that are closely placed • Delete Constraints To delete all the formed constraints, click on the following icon • Inference Engine The Inference engine creates constraints among all elements in a layout whereas Autoconnect creates constraints among neighboring elements. Inference engine honours your previously created constraints by running algorithms
View Inspector • The View Inspector helps you in configuring the View Properties Fixed: This option lets you specify the width/height of the widget. Any. Size: This option lets the widget occupy all available space to satisfy the constraint. In other words, this is more like match constraint. This is different from match_parent, which makes the widget occupy all available space of the parent view Wrap Content: This option only expands to fill the widget with the contained element such as text or a drawable.
When your Constraint Layout looks like
Multi Window Mode • Starting Android N, there's a feature available for running apps in Multi Window Mode • Two ways to get to it, long press the Overview Button or long press the activity title in overview screen
Affect on Activity Life. Cycle • It does not affect activity lifecycle. • The App with which the user interacts will be Foreground mode and the other app will be in paused state • Whenever your app enters Multi window mode or is brought back to it's original state, it is notified as configuration • Change and it undergoes the same cycle of events
Supporting Multi Window Mode • Via a manifest attribute • Targeting N then by default the attribute resizeable. Activity is set to true • There are layout attributes That are supported for the resizeable activity
Picture In Picture Mode • Pip Mode is a special case of the Multi Window Mode • The PIP window is 240 x 135 dp and is shown at the topmost layer in one of the four corners of the screen, chosen by the system.
• To support PIP Mode the manifest has to be configured • You can notify the activity based on the following block • Since the layout available to you is limited you can manipulate the UI from the following callback
• Since the activity is now in paused state, you would want to check if it’s in pip mode and continue playback
• You would also have to ensure that when a user select’s a different video, you do not start a new activity • There’s a good number of references on the best practices to follow when working with the Multi Window Mode
Bibiliography • https: //medium. com/google-developers/5 -tips-for-preparingfor-multi-window-in-android-n-7 bed 803 dda 64#. 7 uepph 5 vj • https: //github. com/googlesamples/android. Multi. Window. Playground. git • https: //commonsware. com/blog/2016/04/19/exportedactivities-freeform-multiwindow-mode. html • https: //github. com/googlecodelabs/constraint-layout. git
- Slides: 24