summaryrefslogtreecommitdiffstats
path: root/packages/PrintSpooler/src/com/android/printspooler/PrintDialogFrame.java
diff options
context:
space:
mode:
Diffstat (limited to 'packages/PrintSpooler/src/com/android/printspooler/PrintDialogFrame.java')
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/PrintDialogFrame.java37
1 files changed, 31 insertions, 6 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/PrintDialogFrame.java b/packages/PrintSpooler/src/com/android/printspooler/PrintDialogFrame.java
index 6dd8aa0..c1c4d21 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/PrintDialogFrame.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/PrintDialogFrame.java
@@ -24,6 +24,8 @@ public class PrintDialogFrame extends FrameLayout {
public final int mMaxWidth;
+ public int mHeight;
+
public PrintDialogFrame(Context context, AttributeSet attrs) {
super(context, attrs);
mMaxWidth = context.getResources().getDimensionPixelSize(
@@ -32,13 +34,36 @@ public class PrintDialogFrame extends FrameLayout {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+ int measuredWidth = getMeasuredWidth();
final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
- if (widthMode == MeasureSpec.AT_MOST) {
- final int receivedWidth = MeasureSpec.getSize(widthMeasureSpec);
- final int computedWidth = Math.min(mMaxWidth, receivedWidth);
- widthMeasureSpec = MeasureSpec.makeMeasureSpec(computedWidth,
- MeasureSpec.EXACTLY);
+ switch (widthMode) {
+ case MeasureSpec.UNSPECIFIED: {
+ measuredWidth = mMaxWidth;
+ } break;
+
+ case MeasureSpec.AT_MOST: {
+ final int receivedWidth = MeasureSpec.getSize(widthMeasureSpec);
+ measuredWidth = Math.min(mMaxWidth, receivedWidth);
+ } break;
}
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+ mHeight = Math.max(mHeight, getMeasuredHeight());
+
+ int measuredHeight = getMeasuredHeight();
+ final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
+ switch (heightMode) {
+ case MeasureSpec.UNSPECIFIED: {
+ measuredHeight = mHeight;
+ } break;
+
+ case MeasureSpec.AT_MOST: {
+ final int receivedHeight = MeasureSpec.getSize(heightMeasureSpec);
+ measuredHeight = Math.min(mHeight, receivedHeight);
+ } break;
+ }
+
+ setMeasuredDimension(measuredWidth, measuredHeight);
}
}