Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to Achieve the Best Experience for Multi-Window

How to Achieve the Best Experience for Multi-Window

If you aren’t handling config changes in your app and you plan on targeting Android N, you may be in for a rude awakening. Unlike most features released Multi-Window happens to be opt out only. What this means for you and your users is a whole new way to experience your app. Let’s talk about how to manage upgrading your app and how multi-window affects your design and some possible strategies to make this the best experience for your users.

Elliott Chenger

September 30, 2016
Tweet

More Decks by Elliott Chenger

Other Decks in Programming

Transcript

  1. • What is Multi-Window • How Multi-Window Affects Design •

    Upgrading to Multi-Window • Best Experience for Multi-Window HOW TO ACHIEVE THE BEST EXPERIENCE FOR MULTI-WINDOW 2
  2. APP BAR 56 DP 16 DP 48 DP 14 DP

    Not a typo, material design has DP for app bar title
  3. z FAB 19 case SIZE_AUTO:
 // If we're set to

    auto, grab the size from resources and refresh
 final int width = ConfigurationHelper.getScreenWidthDp(res);
 final int height = ConfigurationHelper.getScreenHeightDp(res);
 return Math.max(width, height) < AUTO_MINI_LARGEST_SCREEN_WIDTH
 ? getSizeDimension(SIZE_MINI)
 : getSizeDimension(SIZE_NORMAL);
  4. z FAB 20 case SIZE_AUTO:
 // If we're set to

    auto, grab the size from resources and refresh
 final int width = ConfigurationHelper.getScreenWidthDp(res);
 final int height = ConfigurationHelper.getScreenHeightDp(res);
 return Math.max(width, height) < AUTO_MINI_LARGEST_SCREEN_WIDTH
 ? getSizeDimension(SIZE_MINI)
 : getSizeDimension(SIZE_NORMAL);
  5. z FAB 21 /**
 * The switch point for the

    largest screen edge where SIZE_AUTO switches from mini to normal.
 */
 private static final int AUTO_MINI_LARGEST_SCREEN_WIDTH = 470;
  6. z HOW MULTI-WINDOW AFFECTS YOUR DESIGN 30 - Less Real-estate

    - UX of Widgets affected - Orientation or Screen Specific Layouts May not work - Custom Views
  7. 35 LEGACY SUPPORT API < 24 <activity android:name=".MainActivity">
 <intent-filter>
 <action

    android:name="android.intent.action.MAIN" />
 <category android:name="android.intent.category.LAUNCHER" />
 </intent-filter>
 </activity>
  8. 37 LEGACY SUPPORT API < 24 android:screenOrientation=["unspecified" | "behind" |

    "landscape" | "portrait" | "reverseLandscape" | "reversePortrait" | "sensorLandscape" | "sensorPortrait" | "userLandscape" | "userPortrait" | "sensor" | "fullSensor" | "nosensor" | "user" | "fullUser" | "locked"]
  9. Pros • One layout • No marshaling of data saved

    before activity destroyed • No re-inflation HANDLE CONFIG CHANGES 61 Cons • Layout invalidation and redrawing • Re-architecture of screen to be responsive • Multiple configs change at once
  10. Pros • Resources Qualifiers are your best friends • Less

    upfront engineering effort ANDROID HANDLE CONFIG CHANGES 64 Cons • Possible unnecessary layout and redrawing • Activity Creation can be costly • Marshaling data unnecessary
  11. z UPGRADING TO MULTI-WINDOW 69 - Legacy Apps may work

    in multi-window - Enable/Disable when targeting API 24 - Updates to Activity and Fragments - How to handle Config Changes or Not - Adjacent Activities
  12. 77 RESOURCE QUALIFIERS MyProject/ src/ MyActivity.java res/ drawable-<qualifier>/ graphic.png layout-<qualifier>/

    main.xml info.xml mipmap-<qualifier>/ icon.png values-<qualifier>/ strings.xml
  13. 86 ACTIVITY/FRAGMENT Configuration configuration = parent.getContext().getResources().getConfiguration();
 int smallestWidth = configuration.smallestScreenWidthDp;


    int smallestWidthBucket = Breakpoint.getSmallestWidthBucket(smallestWidth);
 switch (smallestWidthBucket) {
 case Breakpoint.SW_200:
 break;
 case Breakpoint.SW_300:
 break;
 case Breakpoint.SW_400:
 default:
 }

  14. 87 ACTIVITY/FRAGMENT Configuration configuration = parent.getContext().getResources().getConfiguration();
 int smallestWidth = configuration.smallestScreenWidthDp;


    int smallestWidthBucket = Breakpoint.getSmallestWidthBucket(smallestWidth);
 switch (smallestWidthBucket) {
 case Breakpoint.SW_200:
 break;
 case Breakpoint.SW_300:
 break;
 case Breakpoint.SW_400:
 default:
 }

  15. 88 ACTIVITY/FRAGMENT Configuration configuration = parent.getContext().getResources().getConfiguration();
 int smallestWidth = configuration.smallestScreenWidthDp;


    int smallestWidthBucket = Breakpoint.getSmallestWidthBucket(smallestWidth);
 switch (smallestWidthBucket) {
 case Breakpoint.SW_200:
 break;
 case Breakpoint.SW_300:
 break;
 case Breakpoint.SW_400:
 default:
 }

  16. 89 ACTIVITY/FRAGMENT Configuration configuration = parent.getContext().getResources().getConfiguration();
 int smallestWidth = configuration.smallestScreenWidthDp;


    int smallestWidthBucket = Breakpoint.getSmallestWidthBucket(smallestWidth);
 switch (smallestWidthBucket) {
 case Breakpoint.SW_200:
 break;
 case Breakpoint.SW_300:
 break;
 case Breakpoint.SW_400:
 default:
 }

  17. 90 ACTIVITY/FRAGMENT Configuration configuration = parent.getContext().getResources().getConfiguration();
 int smallestWidth = configuration.smallestScreenWidthDp;


    int smallestWidthBucket = Breakpoint.getSmallestWidthBucket(smallestWidth);
 switch (smallestWidthBucket) {
 case Breakpoint.SW_200:
 break;
 case Breakpoint.SW_300:
 break;
 case Breakpoint.SW_400:
 default:
 }

  18. z BEST EXPERIENCE FOR MULTI-WINDOW 91 - Change your design

    process - Develop breakpoints - Responsive UI - Lean on resource qualifiers for break points - Explore new technologies like CoordinatorLayout
  19. • Test your app on N, with and without targeting

    N • Design Auditing • Fluid Layouts • Responsive UI • Future Proof • Lean on Resources Configurations and Qualifiers FINALLY 92