Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-25467

Android: "Ti.UI.Window.orientation" should return screen orientation in split-screen mode

    Details

    • Story Points:
      3

      Description

      Summary:
      The "Ti.UI.Window.orientation" property should return the orientation that the OS is displaying its screen contents. This is how it works on iOS. Instead, on Android, it returns the orientation of the app window based on its width and height (ex: if width > height, then it's landscape).

      This is an issue when displaying the app in split-screen mode. For example, when the device is held landscape, apps are displayed side-by-side in portrait form. Android currently returns portrait in this case when it should return landscape (the screen's orientation).

      Steps to Reproduce:

      1. Run the below code on an Android 7.0 or newer device.
      2. Hold the device in portrait orientation.
      3. On the bottom navigation bar, hold the square button (aka: the multi-tasking button).
      4. Select an app from the multi-tasking app list to put it into split-screen mode.
      5. Notice that this app displays "Landscape" instead of "Portrait".
      6. Rotate the device 90 degrees to landscape form.
      7. Notice that this app displays "Portrait" instead of "Landscape".

      Test Code:

      function getNameFromOrientationId(orientationId) {
      	switch (orientationId) {
      		case Ti.UI.PORTRAIT:
      			return "Portrait Upright";
      		case Ti.UI.UPSIDE_PORTRAIT:
      			return "Portrait Upside-Down";
      		case Ti.UI.LANDSCAPE_LEFT:
      			return "Landscape Left";
      		case Ti.UI.LANDSCAPE_RIGHT:
      			return "Landscape Right";
      		case Ti.UI.FACE_UP:
      			return "Face Up";
      		case Ti.UI.FACE_DOWN:
      			return "Face Down";
      	}
      	return "Unknown";
      }
       
      var window = Ti.UI.createWindow();
      var label = Ti.UI.createLabel(
      {
      	text: getNameFromOrientationId(Ti.Gesture.orientation),
      });
      window.add(label);
      window.open();
       
      var timerId = setInterval(function() {
      	if (window) {
      		label.text = getNameFromOrientationId(window.orientation);
      	}
      }, 1000);
      window.addEventListener("close", function(e) {
      	window = null;
      	clearInterval(timerId);
      });
      

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              jquick Joshua Quick
              Reviewer:
              Gary Mathews
              Tester:
              Lokesh Choudhary
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-5937
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code