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

Android: Add FACE_UP/FACE_DOWN support to Ti.Gesture

    Details

    • Story Points:
      3

      Description

      Summary:
      On Android, the "Ti.Gesture.orientation" property and the "orientationchange" event currently only support orientations PORTRAIT, UPSIDE_PORTRAIT, LANDSCAPE_LEFT, and LANDSCAPE_RIGHT. We should also add support for FACE_UP and FACE_DOWN like iOS and Windows Phone for feature parity.

      Test Procedure:

      1. Build and run the below on a physical Android device. (Cannot be tested via emulator.)
      2. Lay the android device flat on a table with the screen facing up towards the sky.
      3. Verify that the app displays "Face Up" onscreen.
      4. Lift the device above your head, with the screen facing straight down towards the Earth.
      5. Verify that the app display "Face Down" onscreen.

      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(
      {
      	orientationModes: [Ti.UI.PORTRAIT],
      });
      var label = Ti.UI.createLabel(
      {
      	text: getNameFromOrientationId(Ti.Gesture.orientation),
      });
      window.add(label);
      window.open();
      Ti.Gesture.addEventListener("orientationchange", function(e) {
      	label.text = getNameFromOrientationId(e.orientation);
      });
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Source Code