Merge "Pressed states for the notification panel's title area."
diff --git a/core/res/res/drawable-hdpi/stat_sys_adb.png b/core/res/res/drawable-hdpi/stat_sys_adb.png
index 58c1746..af713e8 100755
--- a/core/res/res/drawable-hdpi/stat_sys_adb.png
+++ b/core/res/res/drawable-hdpi/stat_sys_adb.png
Binary files differ
diff --git a/core/res/res/drawable-ldpi/stat_sys_adb.png b/core/res/res/drawable-ldpi/stat_sys_adb.png
index cdead24..86b945b 100644
--- a/core/res/res/drawable-ldpi/stat_sys_adb.png
+++ b/core/res/res/drawable-ldpi/stat_sys_adb.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_sys_adb.png b/core/res/res/drawable-mdpi/stat_sys_adb.png
index 255ce94..2c4d2b5 100644
--- a/core/res/res/drawable-mdpi/stat_sys_adb.png
+++ b/core/res/res/drawable-mdpi/stat_sys_adb.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/notify_panel_clock_bg.9.png b/packages/SystemUI/res/drawable-mdpi/notify_panel_clock_bg.9.png
deleted file mode 100644
index 85d9795..0000000
--- a/packages/SystemUI/res/drawable-mdpi/notify_panel_clock_bg.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/notify_panel_clock_bg_normal.9.png b/packages/SystemUI/res/drawable-mdpi/notify_panel_clock_bg_normal.9.png
new file mode 100644
index 0000000..2266d15
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/notify_panel_clock_bg_normal.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/notify_panel_clock_bg_pressed.9.png b/packages/SystemUI/res/drawable-mdpi/notify_panel_clock_bg_pressed.9.png
new file mode 100644
index 0000000..4fc6b46
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/notify_panel_clock_bg_pressed.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_veto_pressed.png b/packages/SystemUI/res/drawable-mdpi/status_bar_veto_pressed.png
index 3b7c9c7..653acbb 100644
--- a/packages/SystemUI/res/drawable-mdpi/status_bar_veto_pressed.png
+++ b/packages/SystemUI/res/drawable-mdpi/status_bar_veto_pressed.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable/notify_panel_clock_bg.xml b/packages/SystemUI/res/drawable/notify_panel_clock_bg.xml
new file mode 100644
index 0000000..c83d878
--- /dev/null
+++ b/packages/SystemUI/res/drawable/notify_panel_clock_bg.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_pressed="true"
+ android:drawable="@drawable/notify_panel_clock_bg_pressed" />
+ <item android:drawable="@drawable/notify_panel_clock_bg_normal" />
+</selector>
+
diff --git a/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel_title.xml b/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel_title.xml
index 0cf28a7..1afb2e3 100644
--- a/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel_title.xml
+++ b/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel_title.xml
@@ -22,6 +22,7 @@
android:layout_height="0dp"
android:orientation="vertical"
android:background="@drawable/notify_panel_clock_bg"
+ android:clickable="true"
>
<LinearLayout
android:id="@+id/icons"
@@ -171,10 +172,12 @@
android:layout_marginLeft="32dp"
/>
- <Button
+ <view
+ class="com.android.systemui.statusbar.tablet.NotificationPanel$ModeToggle"
android:id="@+id/mode_toggle"
android:background="@null"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:clickable="true"
/>
</RelativeLayout>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
index 8a88792..64a4f16 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
@@ -28,7 +28,10 @@
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Slog;
+import android.view.accessibility.AccessibilityEvent;
import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.SoundEffectConstants;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
@@ -51,7 +54,7 @@
boolean mShowing;
int mNotificationCount = 0;
View mTitleArea;
- View mModeToggle;
+ ModeToggle mModeToggle;
View mSettingsButton;
View mNotificationButton;
View mNotificationScroller;
@@ -65,6 +68,48 @@
Choreographer mChoreo = new Choreographer();
+ static class ModeToggle extends View {
+ NotificationPanel mPanel;
+ View mTitle;
+ public ModeToggle(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+ public void setPanel(NotificationPanel p) {
+ mPanel = p;
+ }
+ public void setTitleArea(View v) {
+ mTitle = v;
+ }
+ @Override
+ public boolean onTouchEvent(MotionEvent e) {
+ final int x = (int)e.getX();
+ final int y = (int)e.getY();
+ switch (e.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ mTitle.setPressed(true);
+ break;
+ case MotionEvent.ACTION_MOVE:
+ mTitle.setPressed(x >= 0
+ && x < getWidth()
+ && y >= 0
+ && y < getHeight());
+ break;
+ case MotionEvent.ACTION_CANCEL:
+ mTitle.setPressed(false);
+ break;
+ case MotionEvent.ACTION_UP:
+ if (mTitle.isPressed()) {
+ sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
+ playSoundEffect(SoundEffectConstants.CLICK);
+ mPanel.swapPanels();
+ mTitle.setPressed(false);
+ }
+ break;
+ }
+ return true;
+ }
+ }
+
public NotificationPanel(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
@@ -82,8 +127,10 @@
mContentParent = (ViewGroup)findViewById(R.id.content_parent);
mContentParent.bringToFront();
mTitleArea = findViewById(R.id.title_area);
- mModeToggle = findViewById(R.id.mode_toggle);
+ mModeToggle = (ModeToggle) findViewById(R.id.mode_toggle);
mModeToggle.setOnClickListener(this);
+ mModeToggle.setPanel(this);
+ mModeToggle.setTitleArea(mTitleArea);
mSettingsButton = (ImageView)findViewById(R.id.settings_button);
mNotificationButton = (ImageView)findViewById(R.id.notification_button);