summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJoe Onorato <joeo@google.com>2011-01-19 16:18:43 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-01-19 16:18:43 -0800
commit8960c49920ea91dff7ba1b68c8bb1c507895f9a7 (patch)
tree73590c15893e212de709fd9d36f253d7da4f66a3 /packages
parenta8eeff4dc944aebbc324e17612f9fe89df560734 (diff)
parentdf2b1d1c879a91830ea5d0012079514f64f119e6 (diff)
downloadframeworks_base-8960c49920ea91dff7ba1b68c8bb1c507895f9a7.zip
frameworks_base-8960c49920ea91dff7ba1b68c8bb1c507895f9a7.tar.gz
frameworks_base-8960c49920ea91dff7ba1b68c8bb1c507895f9a7.tar.bz2
am df2b1d1c: am b2b14397: Merge "Cut a hole in the status bar for events when the IME is open." into honeycomb
* commit 'df2b1d1c879a91830ea5d0012079514f64f119e6': Cut a hole in the status bar for events when the IME is open.
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/layout-xlarge/status_bar.xml5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/EventHole.java99
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);
+ }
+ }
+}
+