openframeworks / openframeworks/openFrameworks

Orientation Issues with Nexus 10

Open
#2,065 2 comments 0 reactions 1 assignee View on GitHub

@arturoc is already working on this.

Since May 23, 2013.

addon android bug prelim-analysis
Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

I discovered that the orientation for the Nexus 10 is off by 90 degrees. The natural state (0) of the N10 is landscape verses the Nexus 4 and Nexus 7 where the natural state (0) is Portrait. So when the orientation degrees are returned by public void onOrientationChanged(int orientation) from an OrientationEventListener() is not correct for the cases we have define. For the N10, Landscape == 0, Portrait == 90, Landscape == 180, Portrait == 270, LandScape == 360. While everything else is Portrait == 0, Landscape == 90, Portrait == 180, Landscape == 270, Portrait == 360.

So currently this bit is broken in OFAndroid.java for the Nexus 10:

    switch(orientation){
        case 0:
            ofActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
            break;
        case 90:
            ofActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
            break;
        case 270:
            ofActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
            break;
        case 180:
            ofActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
            break;
        case -1:
            ofActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
            break;
    }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.