am 17bbd976: Merge "Add outset to decor view measuring" into klp-modular-dev
* commit '17bbd976c0971f25447b2ce66117f08029dc2fa9': Add outset to decor view measuring
This commit is contained in:
@@ -1639,6 +1639,7 @@
|
|||||||
that is, when in portrait. Can be either an absolute dimension
|
that is, when in portrait. Can be either an absolute dimension
|
||||||
or a fraction of the screen size in that dimension. -->
|
or a fraction of the screen size in that dimension. -->
|
||||||
<attr name="windowFixedHeightMajor" format="dimension|fraction" />
|
<attr name="windowFixedHeightMajor" format="dimension|fraction" />
|
||||||
|
<attr name="windowOutsetBottom" format="dimension" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<!-- The set of attributes that describe a AlertDialog's theme. -->
|
<!-- The set of attributes that describe a AlertDialog's theme. -->
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
TypedValue mFixedWidthMinor;
|
TypedValue mFixedWidthMinor;
|
||||||
TypedValue mFixedHeightMajor;
|
TypedValue mFixedHeightMajor;
|
||||||
TypedValue mFixedHeightMinor;
|
TypedValue mFixedHeightMinor;
|
||||||
|
TypedValue mOutsetBottom;
|
||||||
|
|
||||||
// This is the top-level view of the window, containing the window decor.
|
// This is the top-level view of the window, containing the window decor.
|
||||||
private DecorView mDecor;
|
private DecorView mDecor;
|
||||||
@@ -2289,7 +2290,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
} else {
|
} else {
|
||||||
h = 0;
|
h = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h > 0) {
|
if (h > 0) {
|
||||||
final int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
final int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
||||||
heightMeasureSpec = MeasureSpec.makeMeasureSpec(
|
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);
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
|
||||||
int width = getMeasuredWidth();
|
int width = getMeasuredWidth();
|
||||||
@@ -2904,6 +2913,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
a.getValue(com.android.internal.R.styleable.Window_windowFixedHeightMinor,
|
a.getValue(com.android.internal.R.styleable.Window_windowFixedHeightMinor,
|
||||||
mFixedHeightMinor);
|
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 Context context = getContext();
|
||||||
final int targetSdk = context.getApplicationInfo().targetSdkVersion;
|
final int targetSdk = context.getApplicationInfo().targetSdkVersion;
|
||||||
|
|||||||
Reference in New Issue
Block a user