diff options
author | Joe Onorato <joeo@google.com> | 2011-01-19 15:25:55 -0800 |
---|---|---|
committer | Joe Onorato <joeo@google.com> | 2011-01-19 15:29:31 -0800 |
commit | 020460b610d8196cb820ba390300e3fefda82f30 (patch) | |
tree | 510b0fa93a7e143fb33bfc57b80fd20844bfd342 /packages | |
parent | 120856c50a56595c0954ae1bf6f05888386937b9 (diff) | |
download | frameworks_base-020460b610d8196cb820ba390300e3fefda82f30.zip frameworks_base-020460b610d8196cb820ba390300e3fefda82f30.tar.gz frameworks_base-020460b610d8196cb820ba390300e3fefda82f30.tar.bz2 |
Cut a hole in the status bar for events when the IME is open.
Bug: 3238092
Change-Id: I8af18c2ebada624fbf5baee09b4b7ef98a7c8205
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/res/layout-xlarge/status_bar.xml | 5 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/EventHole.java | 99 |
2 files changed, 101 insertions, 3 deletions
diff --git a/packages/SystemUI/res/layout-xlarge/status_bar.xml b/packages/SystemUI/res/layout-xlarge/status_bar.xml index 0533b6f..852b729 100644 --- a/packages/SystemUI/res/layout-xlarge/status_bar.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar.xml @@ -78,15 +78,14 @@ </LinearLayout> <!-- fake space bar zone --> - <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/fake_space_bar" + <com.android.systemui.statusbar.policy.EventHole android:id="@+id/fake_space_bar" android:layout_height="match_parent" - android:layout_width="match_parent" + android:layout_width="0dp" android:paddingLeft="8dip" android:paddingRight="8dip" android:layout_toRightOf="@+id/navigationArea" android:layout_toLeftOf="@+id/notificationArea" android:visibility="gone" - systemui:keyCode="62" /> </RelativeLayout> </FrameLayout> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/EventHole.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EventHole.java new file mode 100644 index 0000000..47e758c --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/EventHole.java @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2008 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.systemui.statusbar.policy; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Region; +import android.graphics.drawable.AnimationDrawable; +import android.graphics.drawable.Drawable; +import android.os.RemoteException; +import android.os.SystemClock; +import android.os.ServiceManager; +import android.util.AttributeSet; +import android.util.Slog; +import android.view.HapticFeedbackConstants; +import android.view.IWindowManager; +import android.view.InputDevice; +import android.view.KeyCharacterMap; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewConfiguration; +import android.view.ViewTreeObserver; +import android.widget.RemoteViews.RemoteView; + +import com.android.systemui.R; + +public class EventHole extends View implements ViewTreeObserver.OnComputeInternalInsetsListener { + private static final String TAG = "StatusBar.EventHole"; + + private boolean mWindowVis; + private int[] mLoc = new int[2]; + + public EventHole(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public EventHole(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs); + } + + @Override + protected void onWindowVisibilityChanged(int visibility) { + super.onWindowVisibilityChanged(visibility); + mWindowVis = visibility == View.VISIBLE; + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + getViewTreeObserver().addOnComputeInternalInsetsListener(this); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + getViewTreeObserver().removeOnComputeInternalInsetsListener(this); + } + + public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info) { + final boolean visible = isShown() && mWindowVis && getWidth() > 0 && getHeight() > 0; + final int[] loc = mLoc; + getLocationInWindow(loc); + final int l = loc[0]; + final int r = l + getWidth(); + final int t = loc[1]; + final int b = t + getHeight(); + + View top = this; + while (top.getParent() instanceof View) { + top = (View)top.getParent(); + } + + if (visible) { + info.setTouchableInsets( + ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION); + info.touchableRegion.set(0, 0, top.getWidth(), top.getHeight()); + info.touchableRegion.op(l, t, r, b, Region.Op.DIFFERENCE); + } else { + info.setTouchableInsets( + ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME); + } + } +} + |