1package com.android.server.status; 2 3import android.content.Context; 4import android.util.AttributeSet; 5import android.view.MotionEvent; 6import android.widget.LinearLayout; 7 8 9public class CloseDragHandle extends LinearLayout { 10 StatusBarService mService; 11 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 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 30 public boolean onInterceptTouchEvent(MotionEvent event) { 31 return mService.interceptTouchEvent(event) 32 ? true : super.onInterceptTouchEvent(event); 33 } 34} 35 36