-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1270 from keymanapp/docs/android/size-18
docs: Add getOrientation, getWindowDensity, and getWindowSize APIs
- Loading branch information
Showing
4 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: KMManager.getOrientation() | ||
--- | ||
|
||
## Summary | ||
|
||
The `getOrientation()` method returns the current orientation of the device. | ||
|
||
## Syntax | ||
|
||
```java | ||
KMManager.getOrientation(Context context) | ||
``` | ||
|
||
`context` | ||
: The context. | ||
|
||
### Returns | ||
Returns the device orientation as an int, one of: | ||
|
||
* `Configuration.ORIENTATION_PORTRAIT` (`1`) | ||
* `Configuration.ORIENTATION_LANDSCAPE` (`2`) | ||
* `Configuration.ORIENTATION_UNDEFINED` (`0`) | ||
|
||
## Description | ||
Use this method to get the current orientation of the device | ||
|
||
## Examples | ||
|
||
### Example: Using `getOrientation()` | ||
|
||
The following code illustrates the use of `getOrientation()`: | ||
```java | ||
int orientation = KMManager.getOrientation(context); | ||
``` |
34 changes: 34 additions & 0 deletions
34
developer/engine/android/18.0/KMManager/getWindowDensity.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
title: KMManager.getWindowDensity() | ||
--- | ||
|
||
## Summary | ||
|
||
The `getWindowDensity()` method returns the density of the window. | ||
|
||
## Syntax | ||
|
||
```java | ||
KMManager.getWindowDensity(Context context) | ||
``` | ||
|
||
`context` | ||
: The context. | ||
|
||
### Returns | ||
Returns the density | ||
|
||
## Description | ||
Use this method to get the [density](https://developer.android.com/reference/android/util/DisplayMetrics#density) of the window. This is a scaling factor for the Density Independent Pixel (DIP) unit. | ||
|
||
## Examples | ||
|
||
### Example: Using `getWindowDensity()` | ||
|
||
The following code illustrates the use of `getWindowDensity()`: | ||
```java | ||
float density = KMManager.getWindowDensity(context); | ||
``` | ||
|
||
## See Also | ||
* [getWindowSize](getWindowSize) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: KMManager.getWindowSize() | ||
--- | ||
|
||
## Summary | ||
|
||
The `getWindowSize()` method returns the size of the area the window would occupy. | ||
|
||
## Syntax | ||
|
||
```java | ||
KMManager.getWindowSize(Context context) | ||
``` | ||
|
||
`context` | ||
: The context. | ||
|
||
### Returns | ||
Returns the window size (native resolution) of the display as (int x, int y). | ||
|
||
## Description | ||
Use this method to get the size of the entire display. | ||
|
||
For API level 29 and below, the size of the [entire display minus system decoration areas](https://developer.android.com/reference/android/view/Display#getSize(android.graphics.Point) is returned. | ||
|
||
For API level 30 and above, it may or may not include [system decoration areas](https://developer.android.com/reference/android/view/Display) | ||
|
||
## Examples | ||
|
||
### Example: Using `getWindowSize()` | ||
|
||
The following code illustrates the use of `getWindowSize()`: | ||
```java | ||
Point size = KMManager.getWindowSize(context); | ||
int screenHeight = size.y; | ||
``` | ||
|
||
## See also | ||
* [getWindowDensity](getWindowDensity) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters