OSDN Git Service

hide multiuser selector when IME is up.
authorChris Wren <cwren@android.com>
Fri, 2 Nov 2012 16:55:16 +0000 (12:55 -0400)
committerChris Wren <cwren@android.com>
Fri, 2 Nov 2012 16:55:16 +0000 (12:55 -0400)
Bug: 7437062
Change-Id: I7d1b2cf8e74b5ac8546aa9ae7545b69ab3584633

core/res/res/values-land/dimens.xml
core/res/res/values/dimens.xml
core/res/res/values/symbols.xml
policy/src/com/android/internal/policy/impl/keyguard/MultiPaneChallengeLayout.java

index 36f2628..8f1bd9a 100644 (file)
@@ -56,4 +56,9 @@
     <!-- Bottom padding for the widget pager -->
     <dimen name="kg_widget_pager_bottom_padding">0dp</dimen>
 
+    <!-- If the height if keyguard drops below this threshold (most likely
+    due to the appearance of the IME), then drop the multiuser selector.
+    Landscape's layout allows this to be smaller than for portrait. -->
+    <dimen name="kg_squashed_layout_threshold">400dp</dimen>
+
 </resources>
index 4966b97..3a24cc1 100644 (file)
     <!-- Size of the region along the edge of the screen that will accept
          swipes to scroll the widget area. -->
     <dimen name="kg_edge_swipe_region_size">24dp</dimen>
+
+    <!-- If the height if keyguard drops below this threshold (most likely
+    due to the appearance of the IME), then drop the multiuser selector. -->
+    <dimen name="kg_squashed_layout_threshold">600dp</dimen>
+
 </resources>
index 7299999..adf53a9 100644 (file)
   <java-symbol type="dimen" name="keyguard_avatar_frame_stroke_width" />
   <java-symbol type="dimen" name="keyguard_avatar_frame_shadow_radius" />
   <java-symbol type="dimen" name="kg_edge_swipe_region_size" />
+  <java-symbol type="dimen" name="kg_squashed_layout_threshold" />
   <java-symbol type="drawable" name="ic_jog_dial_sound_off" />
   <java-symbol type="drawable" name="ic_jog_dial_sound_on" />
   <java-symbol type="drawable" name="ic_jog_dial_unlock" />
index b38eb28..3bc39eb 100644 (file)
@@ -47,6 +47,7 @@ public class MultiPaneChallengeLayout extends ViewGroup implements ChallengeLayo
     private OnBouncerStateChangedListener mBouncerListener;
 
     private final Rect mTempRect = new Rect();
+    private final Context mContext;
 
     private final OnClickListener mScrimClickListener = new OnClickListener() {
         @Override
@@ -66,6 +67,8 @@ public class MultiPaneChallengeLayout extends ViewGroup implements ChallengeLayo
     public MultiPaneChallengeLayout(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
 
+        mContext = context;
+
         final TypedArray a = context.obtainStyledAttributes(attrs,
                 R.styleable.MultiPaneChallengeLayout, defStyleAttr, 0);
         mOrientation = a.getInt(R.styleable.MultiPaneChallengeLayout_orientation,
@@ -173,6 +176,8 @@ public class MultiPaneChallengeLayout extends ViewGroup implements ChallengeLayo
             throw new IllegalArgumentException(
                     "MultiPaneChallengeLayout must be measured with an exact size");
         }
+        float squashedLayoutThreshold =
+                mContext.getResources().getDimension(R.dimen.kg_squashed_layout_threshold);
 
         final int width = MeasureSpec.getSize(widthSpec);
         final int height = MeasureSpec.getSize(heightSpec);
@@ -208,28 +213,32 @@ public class MultiPaneChallengeLayout extends ViewGroup implements ChallengeLayo
                 mUserSwitcherView = child;
 
                 if (child.getVisibility() == GONE) continue;
-
-                int adjustedWidthSpec = widthSpec;
-                int adjustedHeightSpec = heightSpec;
-                if (lp.maxWidth >= 0) {
-                    adjustedWidthSpec = MeasureSpec.makeMeasureSpec(
-                            Math.min(lp.maxWidth, MeasureSpec.getSize(widthSpec)),
-                            MeasureSpec.EXACTLY);
-                }
-                if (lp.maxHeight >= 0) {
-                    adjustedHeightSpec = MeasureSpec.makeMeasureSpec(
-                            Math.min(lp.maxHeight, MeasureSpec.getSize(heightSpec)),
-                            MeasureSpec.EXACTLY);
-                }
-                // measureChildWithMargins will resolve layout direction for the LayoutParams
-                measureChildWithMargins(child, adjustedWidthSpec, 0, adjustedHeightSpec, 0);
-
-                // Only subtract out space from one dimension. Favor vertical.
-                // Offset by 1.5x to add some balance along the other edge.
-                if (Gravity.isVertical(lp.gravity)) {
-                    heightUsed += child.getMeasuredHeight() * 1.5f;
-                } else if (Gravity.isHorizontal(lp.gravity)) {
-                    widthUsed += child.getMeasuredWidth() * 1.5f;
+                if (height < squashedLayoutThreshold) {
+                    int zero = MeasureSpec.makeMeasureSpec(0, MeasureSpec.EXACTLY);
+                    measureChild(child, zero, zero);
+                } else {
+                    int adjustedWidthSpec = widthSpec;
+                    int adjustedHeightSpec = heightSpec;
+                    if (lp.maxWidth >= 0) {
+                        adjustedWidthSpec = MeasureSpec.makeMeasureSpec(
+                                Math.min(lp.maxWidth, MeasureSpec.getSize(widthSpec)),
+                                MeasureSpec.EXACTLY);
+                    }
+                    if (lp.maxHeight >= 0) {
+                        adjustedHeightSpec = MeasureSpec.makeMeasureSpec(
+                                Math.min(lp.maxHeight, MeasureSpec.getSize(heightSpec)),
+                                MeasureSpec.EXACTLY);
+                    }
+                    // measureChildWithMargins will resolve layout direction for the LayoutParams
+                    measureChildWithMargins(child, adjustedWidthSpec, 0, adjustedHeightSpec, 0);
+
+                    // Only subtract out space from one dimension. Favor vertical.
+                    // Offset by 1.5x to add some balance along the other edge.
+                    if (Gravity.isVertical(lp.gravity)) {
+                        heightUsed += child.getMeasuredHeight() * 1.5f;
+                    } else if (Gravity.isHorizontal(lp.gravity)) {
+                        widthUsed += child.getMeasuredWidth() * 1.5f;
+                    }
                 }
             } else if (lp.childType == LayoutParams.CHILD_TYPE_SCRIM) {
                 setScrimView(child);