1 package com.android.server.status; 2 3 import android.content.Context; 4 import android.util.AttributeSet; 5 import android.view.MotionEvent; 6 import android.widget.LinearLayout; 7 8 9 public class CloseDragHandle extends LinearLayout { 10 StatusBarService mService; 11 CloseDragHandle(Context context, AttributeSet attrs)12 public CloseDragHandle(Context context, AttributeSet attrs) { 13 super(context, attrs); 14 } 15 16 /** 17 * Ensure that, if there is no target under us to receive the touch, 18 * that we process it ourself. This makes sure that onInterceptTouchEvent() 19 * is always called for the entire gesture. 20 */ 21 @Override onTouchEvent(MotionEvent event)22 public boolean onTouchEvent(MotionEvent event) { 23 if (event.getAction() != MotionEvent.ACTION_DOWN) { 24 mService.interceptTouchEvent(event); 25 } 26 return true; 27 } 28 29 @Override onInterceptTouchEvent(MotionEvent event)30 public boolean onInterceptTouchEvent(MotionEvent event) { 31 return mService.interceptTouchEvent(event) 32 ? true : super.onInterceptTouchEvent(event); 33 } 34 } 35 36