diff options
author | Joe Onorato <joeo@android.com> | 2010-06-30 14:49:51 -0400 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2010-07-07 18:33:14 -0400 |
commit | 119a4015f0f7ac1f63d596da158768f880f9fe9b (patch) | |
tree | 620c03c44c66ce478a6821382dd7a2d782b6ce0e /packages | |
parent | 290357aca828854cb3b327eaac45a3ff13821d4a (diff) | |
download | frameworks_base-119a4015f0f7ac1f63d596da158768f880f9fe9b.zip frameworks_base-119a4015f0f7ac1f63d596da158768f880f9fe9b.tar.gz frameworks_base-119a4015f0f7ac1f63d596da158768f880f9fe9b.tar.bz2 |
add a button area
Change-Id: I78171b3d6cc44a5984e5f602565228909f3e1c00
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/res/layout/unused.xml | 4 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/StatusBarView.java | 19 |
2 files changed, 23 insertions, 0 deletions
diff --git a/packages/SystemUI/res/layout/unused.xml b/packages/SystemUI/res/layout/unused.xml new file mode 100644 index 0000000..05a7d7d --- /dev/null +++ b/packages/SystemUI/res/layout/unused.xml @@ -0,0 +1,4 @@ +<Unused + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/buttons"> +</Unused> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarView.java index 1e140b9..95f2fe5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarView.java @@ -19,6 +19,7 @@ package com.android.systemui.statusbar; import android.content.Context; import android.content.res.Configuration; import android.graphics.Canvas; +import android.graphics.Rect; import android.os.SystemClock; import android.util.AttributeSet; import android.view.MotionEvent; @@ -40,12 +41,16 @@ public class StatusBarView extends FrameLayout { ViewGroup mNotificationIcons; ViewGroup mStatusIcons; View mDate; + View mButtonArea; FixedSizeDrawable mBackground; boolean mNightMode = false; int mStartAlpha = 0, mEndAlpha = 0; long mEndTime = 0; + Rect mButtonBounds = new Rect(); + boolean mCapturingEvents = true; + public StatusBarView(Context context, AttributeSet attrs) { super(context, attrs); } @@ -60,6 +65,8 @@ public class StatusBarView extends FrameLayout { mBackground = new FixedSizeDrawable(mDate.getBackground()); mBackground.setFixedBounds(0, 0, 0, 0); mDate.setBackgroundDrawable(mBackground); + + mButtonArea = findViewById(R.id.buttons); } @Override @@ -125,6 +132,8 @@ public class StatusBarView extends FrameLayout { mDate.layout(mDate.getLeft(), mDate.getTop(), newDateRight, mDate.getBottom()); mBackground.setFixedBounds(-mDate.getLeft(), -mDate.getTop(), (r-l), (b-t)); + + mButtonArea.getHitRect(mButtonBounds); } @Override @@ -177,6 +186,9 @@ public class StatusBarView extends FrameLayout { */ @Override public boolean onTouchEvent(MotionEvent event) { + if (!mCapturingEvents) { + return false; + } if (event.getAction() != MotionEvent.ACTION_DOWN) { mService.interceptTouchEvent(event); } @@ -185,6 +197,13 @@ public class StatusBarView extends FrameLayout { @Override public boolean onInterceptTouchEvent(MotionEvent event) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + if (mButtonBounds.contains((int)event.getX(), (int)event.getY())) { + mCapturingEvents = false; + return false; + } + } + mCapturingEvents = true; return mService.interceptTouchEvent(event) ? true : super.onInterceptTouchEvent(event); } |