Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5cb70b54 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Rename Display.getOrientation() to Display.getRotation().

Update various docs.
parent 08bbffb0
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -166286,7 +166286,7 @@
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 deprecated="deprecated"
 visibility="public"
>
</method>
@@ -166486,6 +166486,17 @@
 visibility="public"
>
</method>
<method name="getRotation"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getWidth"
 return="int"
 abstract="false"
+11 −7
Original line number Diff line number Diff line
@@ -1179,8 +1179,11 @@ public class SensorManager
     * 
     * <p>When the rotation matrix is used for drawing (for instance with 
     * OpenGL ES), it usually <b>doesn't need</b> to be transformed by this 
     * function, unless the screen is physically rotated, such as when used
     * in landscape mode. 
     * function, unless the screen is physically rotated, in which case you
     * can use {@link android.view.Display#getRotation() Display.getRotation()}
     * to retrieve the current rotation of the screen.  Note that because the
     * user is generally free to rotate their screen, you often should
     * consider the rotation in deciding the parameters to use here.
     *
     * <p><u>Examples:</u><p>
     *
@@ -1189,13 +1192,14 @@ public class SensorManager
     *
     * <code>remapCoordinateSystem(inR, AXIS_X, AXIS_Z, outR);</code><p>
     *
     * <li>Using the device as a mechanical compass in landscape mode:</li><p>
     * <li>Using the device as a mechanical compass when rotation is
     * {@link android.view.Surface#ROTATION_90 Surface.ROTATION_90}:</li><p>
     *
     * <code>remapCoordinateSystem(inR, AXIS_Y, AXIS_MINUS_X, outR);</code><p>
     *
     * Beware of the above example. This call is needed only if the device is
     * physically used in landscape mode to calculate the rotation angles (see 
     * {@link #getOrientation}).
     * Beware of the above example. This call is needed only to account for
     * a rotation from its natural orientation when calculating the
     * rotation angles (see {@link #getOrientation}).
     * If the rotation matrix is also used for rendering, it may not need to 
     * be transformed, for instance if your {@link android.app.Activity
     * Activity} is running in landscape mode.
+42 −7
Original line number Diff line number Diff line
@@ -45,41 +45,76 @@ public class Display
    }
    
    /**
     * @return index of this display.
     * Returns the index of this display.  This is currently undefined; do
     * not use.
     */
    public int getDisplayId() {
        return mDisplay;
    }

    /**
     * @return the number of displays connected to the device.
     * Returns the number of displays connected to the device.  This is
     * currently undefined; do not use.
     */
    native static int getDisplayCount();
    
    /**
     * @return width of this display in pixels.
     * Returns the raw width of the display, in pixels.  Note that this
     * should <em>not</em> generally be used for computing layouts, since
     * a device will typically have screen decoration (such as a status bar)
     * along the edges of the display that reduce the amount of application
     * space available from the raw size returned here.  This value is
     * adjusted for you based on the current rotation of the display.
     */
    native public int getWidth();
    
    /**
     * @return height of this display in pixels.
     * Returns the raw height of the display, in pixels.  Note that this
     * should <em>not</em> generally be used for computing layouts, since
     * a device will typically have screen decoration (such as a status bar)
     * along the edges of the display that reduce the amount of application
     * space available from the raw size returned here.  This value is
     * adjusted for you based on the current rotation of the display.
     */
    native public int getHeight();

    /**
     * Returns the rotation of the screen from its "natural" orientation.
     * The returned value may be {@link Surface#ROTATION_0 Surface.ROTATION_0}
     * (no rotation), {@link Surface#ROTATION_90 Surface.ROTATION_90},
     * {@link Surface#ROTATION_180 Surface.ROTATION_180}, or
     * {@link Surface#ROTATION_270 Surface.ROTATION_270}.  For
     * example, if a device has a naturally tall screen, and the user has
     * turned it on its side to go into a landscape orientation, the value
     * returned here may be either {@link Surface#ROTATION_90 Surface.ROTATION_90}
     * or {@link Surface#ROTATION_270 Surface.ROTATION_270} depending on
     * the direction it was turned.  The angle is the rotation of the drawn
     * graphics on the screen, which is the opposite direction of the physical
     * rotation of the device.  For example, if the device is rotated 90
     * degrees counter-clockwise, to compensate rendering will be rotated by
     * 90 degrees clockwise and thus the returned value here will be
     * {@link Surface#ROTATION_90 Surface.ROTATION_90}.
     */
    public int getRotation() {
        return getOrientation();
    }
    
    /**
     * @deprecated use
     * @return orientation of this display.
     */
    native public int getOrientation();
    @Deprecated native public int getOrientation();

    /**
     * @return pixel format of this display.
     * Return the native pixel format of the display.  The returned value
     * may be one of the constants int {@link android.graphics.PixelFormat}.
     */
    public int getPixelFormat() {
        return mPixelFormat;
    }
    
    /**
     * @return refresh rate of this display in frames per second.
     * Return the refresh rate of this display in frames per second.
     */
    public float getRefreshRate() {
        return mRefreshRate;