diff options
author | John Spurlock <jspurlock@google.com> | 2013-10-10 10:27:44 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2013-10-10 12:54:05 -0400 |
commit | 57beb3b5b3b1a1a2fb8387ae1fab0c18c7cf200d (patch) | |
tree | 4976c58ed5e3736d6a914e0f4d8e33aee932fd48 /core/java/com | |
parent | 5bd70c5eb3ccb5d1eed3f1f7e924a4fb96b0a053 (diff) | |
download | frameworks_base-57beb3b5b3b1a1a2fb8387ae1fab0c18c7cf200d.zip frameworks_base-57beb3b5b3b1a1a2fb8387ae1fab0c18c7cf200d.tar.gz frameworks_base-57beb3b5b3b1a1a2fb8387ae1fab0c18c7cf200d.tar.bz2 |
IME navigation guard implemented as a View.
Instead of a custom onDraw in order to stay 100% in sync with abrupt
layout changes.
Also use the unrestricted layout bottom to avoid unnecessary
fitSystemWindows churn.
Bug:11162351
Change-Id: If9bb9a52d503e348d642bf1238f75c4a418ad805
Diffstat (limited to 'core/java/com')
-rw-r--r-- | core/java/com/android/internal/inputmethod/InputMethodRoot.java | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/core/java/com/android/internal/inputmethod/InputMethodRoot.java b/core/java/com/android/internal/inputmethod/InputMethodRoot.java index f070a58..40a424b 100644 --- a/core/java/com/android/internal/inputmethod/InputMethodRoot.java +++ b/core/java/com/android/internal/inputmethod/InputMethodRoot.java @@ -17,15 +17,15 @@ package com.android.internal.inputmethod; import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Paint; import android.graphics.Rect; import android.util.AttributeSet; +import android.view.View; +import android.view.ViewGroup; import android.widget.LinearLayout; public class InputMethodRoot extends LinearLayout { - private final Rect mGuardRect = new Rect(); - private final Paint mGuardPaint = new Paint(); + + private View mNavigationGuard; public InputMethodRoot(Context context) { this(context, null); @@ -37,25 +37,19 @@ public class InputMethodRoot extends LinearLayout { public InputMethodRoot(Context context, AttributeSet attrs, int defStyle) { super(context, attrs); - setWillNotDraw(false); - mGuardPaint.setColor(context.getResources() - .getColor(com.android.internal.R.color.input_method_navigation_guard)); } @Override protected boolean fitSystemWindows(Rect insets) { - setPadding(0, 0, 0, insets.bottom); + if (mNavigationGuard == null) { + mNavigationGuard = findViewById(com.android.internal.R.id.navigationGuard); + } + if (mNavigationGuard == null) { + return super.fitSystemWindows(insets); + } + ViewGroup.LayoutParams lp = mNavigationGuard.getLayoutParams(); + lp.height = insets.bottom; + mNavigationGuard.setLayoutParams(lp); return true; } - - @Override - protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - - // draw navigation bar guard - final int w = getMeasuredWidth(); - final int h = getMeasuredHeight(); - mGuardRect.set(0, h - getPaddingBottom(), w, h); - canvas.drawRect(mGuardRect, mGuardPaint); - } } |