| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.inputmethodservice.navigationbar; |
| 18 |
|
| 19 |
import static android.view.MotionEvent.ACTION_OUTSIDE; |
| 20 |
|
| 21 |
import android.annotation.AttrRes; |
| 22 |
import android.annotation.NonNull; |
| 23 |
import android.annotation.Nullable; |
| 24 |
import android.content.Context; |
| 25 |
import android.util.AttributeSet; |
| 26 |
import android.view.MotionEvent; |
| 27 |
import android.widget.FrameLayout; |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
public final class NavigationBarFrame extends FrameLayout { |
| 33 |
|
| 34 |
private DeadZone mDeadZone = null; |
| 35 |
|
| 36 |
public NavigationBarFrame(@NonNull Context context) { |
| 37 |
super(context); |
| 38 |
} |
| 39 |
|
| 40 |
public NavigationBarFrame(Context context, AttributeSet attrs) { |
| 41 |
super(context, attrs); |
| 42 |
} |
| 43 |
|
| 44 |
public NavigationBarFrame(@NonNull Context context, @Nullable AttributeSet attrs, |
| 45 |
@AttrRes int defStyleAttr) { |
| 46 |
super(context, attrs, defStyleAttr); |
| 47 |
} |
| 48 |
|
| 49 |
public void setDeadZone(@NonNull DeadZone deadZone) { |
| 50 |
mDeadZone = deadZone; |
| 51 |
} |
| 52 |
|
| 53 |
@Override |
| 54 |
public boolean dispatchTouchEvent(MotionEvent event) { |
| 55 |
if (event.getAction() == ACTION_OUTSIDE) { |
| 56 |
if (mDeadZone != null) { |
| 57 |
return mDeadZone.onTouchEvent(event); |
| 58 |
} |
| 59 |
} |
| 60 |
return super.dispatchTouchEvent(event); |
| 61 |
} |
| 62 |
} |