am 93aae779: Merge "More fixes to ensure that touches outside the panel close it." into honeycomb

* commit '93aae779bec97fcf383cf80c54f348a8b8c4fd80':
  More fixes to ensure that touches outside the panel close it.
This commit is contained in:
Daniel Sandler
2011-01-19 21:59:41 -08:00
committed by Android Git Automerger
2 changed files with 14 additions and 7 deletions

View File

@@ -23,7 +23,6 @@
android:orientation="vertical" android:orientation="vertical"
android:background="@drawable/notify_panel_clock_bg" android:background="@drawable/notify_panel_clock_bg"
> >
<ImageView <ImageView
android:id="@+id/network_signal" android:id="@+id/network_signal"
android:layout_height="32dp" android:layout_height="32dp"
@@ -150,4 +149,10 @@
android:layout_marginLeft="32dp" android:layout_marginLeft="32dp"
/> />
<Button
android:id="@+id/mode_toggle"
android:background="@null"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout> </RelativeLayout>

View File

@@ -47,6 +47,7 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
boolean mShowing; boolean mShowing;
View mTitleArea; View mTitleArea;
View mModeToggle;
View mSettingsButton; View mSettingsButton;
View mNotificationButton; View mNotificationButton;
View mNotificationScroller; View mNotificationScroller;
@@ -75,7 +76,8 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
mContentParent = (ViewGroup)findViewById(R.id.content_parent); mContentParent = (ViewGroup)findViewById(R.id.content_parent);
mContentParent.bringToFront(); mContentParent.bringToFront();
mTitleArea = findViewById(R.id.title_area); mTitleArea = findViewById(R.id.title_area);
mTitleArea.setOnClickListener(this); mModeToggle = findViewById(R.id.mode_toggle);
mModeToggle.setOnClickListener(this);
mScrim = findViewById(R.id.scrim); mScrim = findViewById(R.id.scrim);
mGlow = findViewById(R.id.glow); mGlow = findViewById(R.id.glow);
@@ -138,7 +140,7 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
} }
public void onClick(View v) { public void onClick(View v) {
if (v == mTitleArea) { if (v == mModeToggle) {
if (mSettingsView == null) { if (mSettingsView == null) {
switchToSettingsMode(); switchToSettingsMode();
} else { } else {
@@ -163,10 +165,10 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
} }
public boolean isInContentArea(int x, int y) { public boolean isInContentArea(int x, int y) {
mContentArea.left = mContentFrame.getLeft(); mContentArea.left = mContentFrame.getLeft() + mContentFrame.getPaddingLeft();
mContentArea.top = mTitleArea.getTop(); mContentArea.top = mTitleArea.getTop() + mTitleArea.getPaddingTop();
mContentArea.right = mContentFrame.getRight(); mContentArea.right = mContentFrame.getRight() - mContentFrame.getPaddingRight();
mContentArea.bottom = mContentFrame.getBottom(); mContentArea.bottom = mContentFrame.getBottom() - mContentFrame.getPaddingBottom();
offsetDescendantRectToMyCoords(mContentParent, mContentArea); offsetDescendantRectToMyCoords(mContentParent, mContentArea);
return mContentArea.contains(x, y); return mContentArea.contains(x, y);
} }