summaryrefslogtreecommitdiff
path: root/src/com/android/launcher3/util/window/WindowManagerProxy.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/util/window/WindowManagerProxy.java')
-rw-r--r--src/com/android/launcher3/util/window/WindowManagerProxy.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/com/android/launcher3/util/window/WindowManagerProxy.java b/src/com/android/launcher3/util/window/WindowManagerProxy.java
index 278a37e353..51a96c4d8a 100644
--- a/src/com/android/launcher3/util/window/WindowManagerProxy.java
+++ b/src/com/android/launcher3/util/window/WindowManagerProxy.java
@@ -338,6 +338,20 @@ public class WindowManagerProxy implements ResourceBasedOverride {
}
/**
+ * Returns bounds of the display associated with the context, or bounds of DEFAULT_DISPLAY
+ * if the context isn't associated with a display.
+ */
+ public Rect getCurrentBounds(Context displayInfoContext) {
+ Resources res = displayInfoContext.getResources();
+ Configuration config = res.getConfiguration();
+
+ float screenWidth = config.screenWidthDp * res.getDisplayMetrics().density;
+ float screenHeight = config.screenHeightDp * res.getDisplayMetrics().density;
+
+ return new Rect(0, 0, (int) screenWidth, (int) screenHeight);
+ }
+
+ /**
* Returns rotation of the display associated with the context, or rotation of DEFAULT_DISPLAY
* if the context isn't associated with a display.
*/