diff options
Diffstat (limited to 'policy/src')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindow.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index eba689d..1745bc7 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -23,6 +23,8 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static android.view.WindowManager.LayoutParams.*; import android.view.ViewConfiguration; + +import com.android.internal.R; import com.android.internal.view.RootViewSurfaceTaker; import com.android.internal.view.StandaloneActionMode; import com.android.internal.view.menu.ContextMenuBuilder; @@ -1920,6 +1922,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { private PopupWindow mActionModePopup; private Runnable mShowActionModePopup; + // View added at runtime to IME windows to cover the navigation bar + private View mNavigationGuard; + public DecorView(Context context, int featureId) { super(context); mFeatureId = featureId; @@ -2479,6 +2484,33 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { @Override protected boolean fitSystemWindows(Rect insets) { mFrameOffsets.set(insets); + + // IMEs lay out below the nav bar, but the content view must not (for back compat) + if (getAttributes().type == WindowManager.LayoutParams.TYPE_INPUT_METHOD) { + // prevent the content view from including the nav bar height + if (mContentParent != null) { + if (mContentParent.getLayoutParams() instanceof MarginLayoutParams) { + MarginLayoutParams mlp = + (MarginLayoutParams) mContentParent.getLayoutParams(); + mlp.bottomMargin = insets.bottom; + mContentParent.setLayoutParams(mlp); + } + } + // position the navigation guard view, creating it if necessary + if (mNavigationGuard == null) { + mNavigationGuard = new View(mContext); + mNavigationGuard.setBackgroundColor(mContext.getResources() + .getColor(R.color.input_method_navigation_guard)); + addView(mNavigationGuard, new LayoutParams( + LayoutParams.MATCH_PARENT, insets.bottom, + Gravity.START | Gravity.BOTTOM)); + } else { + LayoutParams lp = (LayoutParams) mNavigationGuard.getLayoutParams(); + lp.height = insets.bottom; + mNavigationGuard.setLayoutParams(lp); + } + } + if (getForeground() != null) { drawableChanged(); } |