diff options
author | Joe Onorato <joeo@android.com> | 2010-09-26 13:59:40 -0700 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2010-09-26 13:59:40 -0700 |
commit | ddf680bff5bb9bc04ef04667644db8ade0b38c46 (patch) | |
tree | eff238f7b66bcd7e7faf3d7f98692f7635ddc681 /packages/SystemUI/src | |
parent | 30a31ef6e51abe8074e22508d88b96d24752ce0a (diff) | |
download | frameworks_base-ddf680bff5bb9bc04ef04667644db8ade0b38c46.zip frameworks_base-ddf680bff5bb9bc04ef04667644db8ade0b38c46.tar.gz frameworks_base-ddf680bff5bb9bc04ef04667644db8ade0b38c46.tar.bz2 |
Touching the blue glow should close the system and notification panels.
Bug: 3029373
Change-Id: I96760656dcda20ab238305900f9964083a8e5273
Diffstat (limited to 'packages/SystemUI/src')
4 files changed, 84 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java new file mode 100644 index 0000000..eee0a16 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 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.tablet; + +import android.content.Context; +import android.widget.LinearLayout; +import android.util.AttributeSet; + +public class NotificationPanel extends LinearLayout implements StatusBarPanel { + + public NotificationPanel(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public NotificationPanel(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + public boolean isInContentArea(int x, int y) { + final int l = getPaddingLeft(); + final int r = getWidth() - getPaddingRight(); + final int t = getPaddingTop(); + final int b = getHeight() - getPaddingBottom(); + return x >= l && x < r && y >= t && y < b; + } +} + diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/StatusBarPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/StatusBarPanel.java new file mode 100644 index 0000000..8fa01d5 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/StatusBarPanel.java @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2010 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.tablet; + +public interface StatusBarPanel { + public boolean isInContentArea(int x, int y); +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SystemPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SystemPanel.java index 491ef1d..a0f5be6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SystemPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/SystemPanel.java @@ -77,7 +77,7 @@ import com.android.internal.telephony.cdma.TtyIntent; import com.android.systemui.statusbar.*; import com.android.systemui.R; -public class SystemPanel extends LinearLayout { +public class SystemPanel extends LinearLayout implements StatusBarPanel { private static final String TAG = "SystemPanel"; private static final boolean DEBUG = TabletStatusBarService.DEBUG; private static final boolean DEBUG_SIGNAL = false; @@ -122,6 +122,14 @@ public class SystemPanel extends LinearLayout { boolean mDataEnabled, mDataConnected, mDataRoaming; int mDataLevel; + public boolean isInContentArea(int x, int y) { + final int l = getPaddingLeft(); + final int r = getWidth() - getPaddingRight(); + final int t = getPaddingTop(); + final int b = getHeight() - getPaddingBottom(); + return x >= l && x < r && y >= t && y < b; + } + private BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java index de939a4..d6f5cf0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java @@ -79,7 +79,7 @@ public class TabletStatusBarService extends StatusBarService { View mNotificationButtons; View mSystemInfo; - View mNotificationPanel; + NotificationPanel mNotificationPanel; SystemPanel mSystemPanel; ViewGroup mPile; @@ -110,10 +110,11 @@ public class TabletStatusBarService extends StatusBarService { final int barHeight= res.getDimensionPixelSize( com.android.internal.R.dimen.status_bar_height); - mNotificationPanel = View.inflate(this, R.layout.sysbar_panel_notifications, null); + mNotificationPanel = (NotificationPanel)View.inflate(this, + R.layout.sysbar_panel_notifications, null); mNotificationPanel.setVisibility(View.GONE); mNotificationPanel.setOnTouchListener( - new TouchOutsideListener(MSG_CLOSE_NOTIFICATION_PANEL)); + new TouchOutsideListener(MSG_CLOSE_NOTIFICATION_PANEL, mNotificationPanel)); mStatusBarView.setIgnoreChildren(0, mNotificationTrigger, mNotificationPanel); @@ -135,7 +136,8 @@ public class TabletStatusBarService extends StatusBarService { mSystemPanel = (SystemPanel) View.inflate(this, R.layout.sysbar_panel_system, null); mSystemPanel.setVisibility(View.GONE); - mSystemPanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_SYSTEM_PANEL)); + mSystemPanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_SYSTEM_PANEL, + mSystemPanel)); mStatusBarView.setIgnoreChildren(1, mSystemInfo, mSystemPanel); @@ -787,13 +789,18 @@ public class TabletStatusBarService extends StatusBarService { public class TouchOutsideListener implements View.OnTouchListener { private int mMsg; + private StatusBarPanel mPanel; - public TouchOutsideListener(int msg) { + public TouchOutsideListener(int msg, StatusBarPanel panel) { mMsg = msg; + mPanel = panel; } public boolean onTouch(View v, MotionEvent ev) { - if (ev.getAction() == MotionEvent.ACTION_OUTSIDE) { + final int action = ev.getAction(); + if (action == MotionEvent.ACTION_OUTSIDE + || (action == MotionEvent.ACTION_DOWN + && !mPanel.isInContentArea((int)ev.getX(), (int)ev.getY()))) { mHandler.removeMessages(mMsg); mHandler.sendEmptyMessage(mMsg); return true; |