Skip to content

Commit 9da2452

Browse files
Jim MillerAndroid (Google) Code Review
authored andcommitted
Merge "Fix 6441282: confine search gesture region on tablet navbar" into jb-dev
2 parents 1ca4399 + 1615389 commit 9da2452

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ public class DelegateViewHelper {
3333
private float mTriggerThreshhold;
3434

3535
public DelegateViewHelper(View sourceView) {
36-
mSourceView = sourceView;
37-
if (mSourceView != null) {
38-
mTriggerThreshhold = mSourceView.getContext().getResources()
39-
.getDimension(R.dimen.navbar_search_up_threshhold);
40-
}
36+
setSourceView(sourceView);
4137
}
4238

4339
public void setDelegateView(View view) {
@@ -92,4 +88,12 @@ public boolean onInterceptTouchEvent(MotionEvent event) {
9288
}
9389
return false;
9490
}
91+
92+
public void setSourceView(View view) {
93+
mSourceView = view;
94+
if (mSourceView != null) {
95+
mTriggerThreshhold = mSourceView.getContext().getResources()
96+
.getDimension(R.dimen.navbar_search_up_threshhold);
97+
}
98+
}
9599
}

packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarView.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.android.systemui.statusbar.tablet;
1818

19+
import com.android.systemui.R;
1920
import com.android.systemui.statusbar.BaseStatusBar;
2021
import com.android.systemui.statusbar.DelegateViewHelper;
2122

@@ -37,8 +38,7 @@ public class TabletStatusBarView extends FrameLayout {
3738
private DelegateViewHelper mDelegateHelper;
3839

3940
public TabletStatusBarView(Context context) {
40-
super(context);
41-
mDelegateHelper = new DelegateViewHelper(this);
41+
this(context, null);
4242
}
4343

4444
public TabletStatusBarView(Context context, AttributeSet attrs) {
@@ -54,6 +54,20 @@ public void setBar(BaseStatusBar phoneStatusBar) {
5454
mDelegateHelper.setBar(phoneStatusBar);
5555
}
5656

57+
@Override
58+
protected void onFinishInflate() {
59+
super.onFinishInflate();
60+
// Find the view we wish to grab events from in order to detect search gesture.
61+
// Depending on the device, this will be one of the id's listed below.
62+
// If we don't find one, we'll use the view provided in the constructor above (this view).
63+
View view = null;
64+
if ((view = findViewById(R.id.navigationArea)) != null) {
65+
mDelegateHelper.setSourceView(view);
66+
} else if ((view = findViewById(R.id.nav_buttons)) != null) {
67+
mDelegateHelper.setSourceView(view);
68+
}
69+
}
70+
5771
@Override
5872
public boolean onInterceptTouchEvent(MotionEvent ev) {
5973
if (ev.getAction() == MotionEvent.ACTION_DOWN) {

0 commit comments

Comments
 (0)