diff options
author | John Spurlock <jspurlock@google.com> | 2013-10-09 21:57:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-10-09 21:57:01 +0000 |
commit | 65e911261d972758577f76cf41c6c0c532896fe1 (patch) | |
tree | 5efec4d980491e9490307be40ab4059f4911ad86 /core/java/com | |
parent | b0975540a42f10fad08364b636a22bcba33609a6 (diff) | |
parent | c68d577f29604d205573ee4253704c5b2c5e4f81 (diff) | |
download | frameworks_base-65e911261d972758577f76cf41c6c0c532896fe1.zip frameworks_base-65e911261d972758577f76cf41c6c0c532896fe1.tar.gz frameworks_base-65e911261d972758577f76cf41c6c0c532896fe1.tar.bz2 |
Merge "Allow IMEs to extend below nav bar, remove SystemUI veto." into klp-dev
Diffstat (limited to 'core/java/com')
-rw-r--r-- | core/java/com/android/internal/inputmethod/InputMethodRoot.java | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/core/java/com/android/internal/inputmethod/InputMethodRoot.java b/core/java/com/android/internal/inputmethod/InputMethodRoot.java new file mode 100644 index 0000000..f070a58 --- /dev/null +++ b/core/java/com/android/internal/inputmethod/InputMethodRoot.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +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.widget.LinearLayout; + +public class InputMethodRoot extends LinearLayout { + private final Rect mGuardRect = new Rect(); + private final Paint mGuardPaint = new Paint(); + + public InputMethodRoot(Context context) { + this(context, null); + } + + public InputMethodRoot(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + 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); + 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); + } +} |