Code Monkey home page Code Monkey logo

Comments (3)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
This is a non-ideal fix in PLView:

    private int getDeviceDefaultOrientation() {
        WindowManager windowManager =  (WindowManager) getSystemService(WINDOW_SERVICE);
        Configuration config = getResources().getConfiguration();
        int rotation = windowManager.getDefaultDisplay().getRotation();
        if ( ((rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) &&
                config.orientation == Configuration.ORIENTATION_LANDSCAPE)
            || ((rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) &&    
                config.orientation == Configuration.ORIENTATION_PORTRAIT)) 
          return Configuration.ORIENTATION_LANDSCAPE;
        else 
          return Configuration.ORIENTATION_PORTRAIT;
    }

onSensorChanged/case Sensor.TYPE_ORIENTATION:

After the orientation is detected, correct it.

            if (Configuration.ORIENTATION_LANDSCAPE == getDeviceDefaultOrientation())
                switch (newOrientation) {
                case UIDeviceOrientationPortrait: {
                    newOrientation = UIDeviceOrientation.UIDeviceOrientationLandscapeLeft;
                    break;
                }
                case UIDeviceOrientationPortraitUpsideDown: {
                    newOrientation = UIDeviceOrientation.UIDeviceOrientationLandscapeRight;
                    break;
                }
                case UIDeviceOrientationLandscapeLeft: {
                    newOrientation = UIDeviceOrientation.UIDeviceOrientationPortrait;
                    break;
                }
                case UIDeviceOrientationLandscapeRight: {
                    newOrientation = UIDeviceOrientation.UIDeviceOrientationPortraitUpsideDown;
                    break;
                }
                }

Original comment by [email protected] on 13 May 2014 at 11:37

from panoramagl-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
trying the same solution for a Acer A-810 .. in this case I get the problem 
highlighted in the issue both using the original PLView, both trying this 
solution.
The "new" issue is that defaultOrientation is ORIENTATION_UNDEFINED and all 
positions bring to Portrait.
Example:
printing rotation and config.orientation variables we get:
in portrait positition --> rotation=0 (so 0 degrees) + orient=1 (portrait) = 
Configuration.ORIENTATION_PORTRAIT
in "landscape left" positition --> rotation=3 (so 270 degrees) + orient=2 
(landscape) = Configuration.ORIENTATION_PORTRAIT
in "upsideDown portrait" positition --> rotation=2 (so 180 degrees) + orient=1 
(portrait) = Configuration.ORIENTATION_PORTRAIT
in "landscape right" positition --> rotation=1 (so 90 degrees) + orient=2 
(landscape) = Configuration.ORIENTATION_PORTRAIT


Original comment by [email protected] on 6 Jun 2014 at 7:23

from panoramagl-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
showing toasts during exectution .. I discovered that in my case in method 
onSensorChanged the exectution goes directly to case Sensor.TYPE_GYROSCOPE 
without passing through Sensor.TYPE_ORIENTATION ..so maybe this part should be 
edited too to solve this mismatch of sceen orientation and movement of 
sensorialRotation..

Original comment by [email protected] on 6 Jun 2014 at 7:59

from panoramagl-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.