From 5de886a158e449912b21fb27f02bdf67c0c95010 Mon Sep 17 00:00:00 2001 From: Michael Kolb Date: Mon, 24 Mar 2014 16:18:52 -0700 Subject: [PATCH] Add outset to decor view measuring Change-Id: Ib0e68311ff8ed1fccf9219b28c42ee43c5952050 --- core/res/res/values/attrs.xml | 1 + .../android/internal/policy/impl/PhoneWindow.java | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 1dda8bfa58eba..91d502b24ce33 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -1639,6 +1639,7 @@ that is, when in portrait. Can be either an absolute dimension or a fraction of the screen size in that dimension. --> + diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index 7c047c3eaddce..bed3462cdd532 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -125,6 +125,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { TypedValue mFixedWidthMinor; TypedValue mFixedHeightMajor; TypedValue mFixedHeightMinor; + TypedValue mOutsetBottom; // This is the top-level view of the window, containing the window decor. private DecorView mDecor; @@ -2289,7 +2290,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } else { h = 0; } - if (h > 0) { final int heightSize = MeasureSpec.getSize(heightMeasureSpec); heightMeasureSpec = MeasureSpec.makeMeasureSpec( @@ -2298,6 +2298,15 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } } + if (mOutsetBottom != null) { + int mode = MeasureSpec.getMode(heightMeasureSpec); + if (mode != MeasureSpec.UNSPECIFIED) { + int outset = (int) mOutsetBottom.getDimension(metrics); + int height = MeasureSpec.getSize(heightMeasureSpec); + heightMeasureSpec = MeasureSpec.makeMeasureSpec(height + outset, mode); + } + } + super.onMeasure(widthMeasureSpec, heightMeasureSpec); int width = getMeasuredWidth(); @@ -2904,6 +2913,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { a.getValue(com.android.internal.R.styleable.Window_windowFixedHeightMinor, mFixedHeightMinor); } + if (a.hasValue(com.android.internal.R.styleable.Window_windowOutsetBottom)) { + if (mOutsetBottom == null) mOutsetBottom = new TypedValue(); + a.getValue(com.android.internal.R.styleable.Window_windowOutsetBottom, mOutsetBottom); + } final Context context = getContext(); final int targetSdk = context.getApplicationInfo().targetSdkVersion;