@@ -68,10 +68,11 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
6868 private View mRecentsScrim ;
6969 private View mRecentsNoApps ;
7070 private ViewGroup mRecentsContainer ;
71+ private StatusBarTouchProxy mStatusBarTouchProxy ;
7172
7273 private boolean mShowing ;
7374 private Choreographer mChoreo ;
74- private View mRecentsDismissButton ;
75+ OnRecentsPanelVisibilityChangedListener mVisibilityChangedListener ;
7576
7677 private RecentTasksLoader mRecentTasksLoader ;
7778 private ArrayList <TaskDescription > mRecentTaskDescriptions ;
@@ -81,8 +82,8 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
8182 private int mThumbnailWidth ;
8283 private boolean mFitThumbnailToXY ;
8384
84- public void setRecentTasksLoader ( RecentTasksLoader loader ) {
85- mRecentTasksLoader = loader ;
85+ public static interface OnRecentsPanelVisibilityChangedListener {
86+ public void onRecentsPanelVisibilityChanged ( boolean visible ) ;
8687 }
8788
8889 private final class OnLongClickDelegate implements View .OnLongClickListener {
@@ -171,15 +172,18 @@ public boolean onKeyUp(int keyCode, KeyEvent event) {
171172 return super .onKeyUp (keyCode , event );
172173 }
173174
174- public boolean isInContentArea (int x , int y ) {
175- // use mRecentsContainer's exact bounds to determine horizontal position
176- final int l = mRecentsContainer .getLeft ();
177- final int r = mRecentsContainer .getRight ();
178- final int t = mRecentsContainer .getTop ();
179- final int b = mRecentsContainer .getBottom ();
175+ private boolean pointInside (int x , int y , View v ) {
176+ final int l = v .getLeft ();
177+ final int r = v .getRight ();
178+ final int t = v .getTop ();
179+ final int b = v .getBottom ();
180180 return x >= l && x < r && y >= t && y < b ;
181181 }
182182
183+ public boolean isInContentArea (int x , int y ) {
184+ return pointInside (x , y , mRecentsContainer ) || pointInside (x , y , mStatusBarTouchProxy );
185+ }
186+
183187 public void show (boolean show , boolean animate ) {
184188 show (show , animate , null );
185189 }
@@ -278,7 +282,6 @@ public void onAnimationRepeat(Animator animation) {
278282 public void onAnimationStart (Animator animation ) {
279283 }
280284
281-
282285 /**
283286 * We need to be aligned at the bottom. LinearLayout can't do this, so instead,
284287 * let LinearLayout do all the hard work, and then shift everything down to the bottom.
@@ -312,6 +315,29 @@ public boolean isShowing() {
312315
313316 public void setBar (StatusBar bar ) {
314317 mBar = bar ;
318+
319+ }
320+
321+ public void setStatusBarView (View statusBarView ) {
322+ if (mStatusBarTouchProxy != null ) {
323+ mStatusBarTouchProxy .setStatusBar (statusBarView );
324+ }
325+ }
326+
327+ public void setRecentTasksLoader (RecentTasksLoader loader ) {
328+ mRecentTasksLoader = loader ;
329+ }
330+
331+ public void setOnVisibilityChangedListener (OnRecentsPanelVisibilityChangedListener l ) {
332+ mVisibilityChangedListener = l ;
333+
334+ }
335+
336+ public void setVisibility (int visibility ) {
337+ if (mVisibilityChangedListener != null ) {
338+ mVisibilityChangedListener .onRecentsPanelVisibilityChanged (visibility == VISIBLE );
339+ }
340+ super .setVisibility (visibility );
315341 }
316342
317343 public RecentsPanelView (Context context , AttributeSet attrs ) {
@@ -335,6 +361,7 @@ protected void onFinishInflate() {
335361 super .onFinishInflate ();
336362 mContext .getSystemService (Context .LAYOUT_INFLATER_SERVICE );
337363 mRecentsContainer = (ViewGroup ) findViewById (R .id .recents_container );
364+ mStatusBarTouchProxy = (StatusBarTouchProxy ) findViewById (R .id .status_bar_touch_proxy );
338365 mListAdapter = new TaskDescriptionAdapter (mContext );
339366 if (mRecentsContainer instanceof RecentsHorizontalScrollView ){
340367 RecentsHorizontalScrollView scrollView
@@ -355,14 +382,6 @@ protected void onFinishInflate() {
355382 mRecentsScrim = findViewById (R .id .recents_bg_protect );
356383 mRecentsNoApps = findViewById (R .id .recents_no_apps );
357384 mChoreo = new Choreographer (this , mRecentsScrim , mRecentsContainer , mRecentsNoApps , this );
358- mRecentsDismissButton = findViewById (R .id .recents_dismiss_button );
359- if (mRecentsDismissButton != null ) {
360- mRecentsDismissButton .setOnClickListener (new OnClickListener () {
361- public void onClick (View v ) {
362- hide (true );
363- }
364- });
365- }
366385
367386 // In order to save space, we make the background texture repeat in the Y direction
368387 if (mRecentsScrim != null && mRecentsScrim .getBackground () instanceof BitmapDrawable ) {
0 commit comments