summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThales Lima <tsuharesu@google.com>2022-02-17 15:28:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2022-02-17 15:28:09 +0000
commit73087f4b2c9d9a761fe0147c990a443a82c01e21 (patch)
treed7249faa6784276ed9a7edc0f581e7acc793cbd1 /src
parent369ae1aaf4c528a54bf351471b8e5f857579d4c3 (diff)
parent83b345338b6e0cd1aec2ddb36802250dd5c7a23d (diff)
downloadLauncher3-73087f4b2c9d9a761fe0147c990a443a82c01e21.tar.gz
Merge "Stop using bottom inset in preview"
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/graphics/LauncherPreviewRenderer.java22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
index 88ce57e40f..2459e0977a 100644
--- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
+++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
@@ -111,7 +111,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
* 3) Place appropriate elements like icons and first-page qsb
* 4) Measure and draw the view on a canvas
*/
-@TargetApi(Build.VERSION_CODES.O)
+@TargetApi(Build.VERSION_CODES.R)
public class LauncherPreviewRenderer extends ContextWrapper
implements ActivityContext, WorkspaceLayoutManager, LayoutInflater.Factory2 {
@@ -186,19 +186,13 @@ public class LauncherPreviewRenderer extends ContextWrapper
mIdp = idp;
mDp = idp.getDeviceProfile(context).copy(context);
- if (Utilities.ATLEAST_R) {
- WindowInsets currentWindowInsets = context.getSystemService(WindowManager.class)
- .getCurrentWindowMetrics().getWindowInsets();
- mInsets = new Rect(
- currentWindowInsets.getSystemWindowInsetLeft(),
- currentWindowInsets.getSystemWindowInsetTop(),
- currentWindowInsets.getSystemWindowInsetRight(),
- currentWindowInsets.getSystemWindowInsetBottom());
- } else {
- mInsets = new Rect();
- mInsets.left = mInsets.right = (mDp.widthPx - mDp.availableWidthPx) / 2;
- mInsets.top = mInsets.bottom = (mDp.heightPx - mDp.availableHeightPx) / 2;
- }
+ WindowInsets currentWindowInsets = context.getSystemService(WindowManager.class)
+ .getCurrentWindowMetrics().getWindowInsets();
+ mInsets = new Rect(
+ currentWindowInsets.getSystemWindowInsetLeft(),
+ currentWindowInsets.getSystemWindowInsetTop(),
+ currentWindowInsets.getSystemWindowInsetRight(),
+ mDp.isTaskbarPresent ? 0 : currentWindowInsets.getSystemWindowInsetBottom());
mDp.updateInsets(mInsets);
BaseIconFactory iconFactory =