Touching the blue glow should close the system and notification panels.
Bug: 3029373 Change-Id: I96760656dcda20ab238305900f9964083a8e5273
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
-->
|
||||
|
||||
<!-- android:background="@drawable/status_bar_closed_default_background" -->
|
||||
<LinearLayout
|
||||
<com.android.systemui.statusbar.tablet.NotificationPanel
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
@@ -46,4 +46,4 @@
|
||||
>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
</com.android.systemui.statusbar.tablet.NotificationPanel>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -206,12 +206,16 @@ public class NotificationTestList extends TestActivity
|
||||
new Test("Layout") {
|
||||
public void run()
|
||||
{
|
||||
Notification n;
|
||||
|
||||
mNM.notify(1, new Notification(NotificationTestList.this,
|
||||
n = new Notification(NotificationTestList.this,
|
||||
R.drawable.ic_statusbar_missedcall,
|
||||
null, System.currentTimeMillis()-(1000*60*60*24),
|
||||
"(453) 123-2328",
|
||||
"", null));
|
||||
"", null);
|
||||
n.flags |= Notification.FLAG_ONGOING_EVENT;
|
||||
|
||||
mNM.notify(1, n);
|
||||
|
||||
mNM.notify(2, new Notification(NotificationTestList.this,
|
||||
R.drawable.ic_statusbar_email,
|
||||
|
||||
Reference in New Issue
Block a user