| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.appmenu; | 5 package org.chromium.chrome.browser.appmenu; |
| 6 | 6 |
| 7 import android.view.GestureDetector; | 7 import android.view.GestureDetector; |
| 8 import android.view.GestureDetector.SimpleOnGestureListener; | 8 import android.view.GestureDetector.SimpleOnGestureListener; |
| 9 import android.view.MotionEvent; | 9 import android.view.MotionEvent; |
| 10 import android.view.View; | 10 import android.view.View; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 event.getActionMasked() == MotionEvent.ACTION_UP) { | 107 event.getActionMasked() == MotionEvent.ACTION_UP) { |
| 108 mMenuButton.setPressed(false); | 108 mMenuButton.setPressed(false); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // This will take care of showing app menu. | 111 // This will take care of showing app menu. |
| 112 boolean isTouchEventConsumed = mAppMenuGestureDetector.onTouchEvent(even
t); | 112 boolean isTouchEventConsumed = mAppMenuGestureDetector.onTouchEvent(even
t); |
| 113 | 113 |
| 114 // If user starts to drag on this menu button, ACTION_DOWN and all the s
ubsequent touch | 114 // If user starts to drag on this menu button, ACTION_DOWN and all the s
ubsequent touch |
| 115 // events are received here. We need to forward this event to the app me
nu to handle | 115 // events are received here. We need to forward this event to the app me
nu to handle |
| 116 // dragging correctly. | 116 // dragging correctly. |
| 117 AppMenu menu = mMenuHandler.getAppMenu(); | 117 AppMenuDragHelper dragHelper = mMenuHandler.getAppMenuDragHelper(); |
| 118 if (menu != null && !isTouchEventConsumed) { | 118 if (dragHelper != null && !isTouchEventConsumed) { |
| 119 isTouchEventConsumed |= menu.handleDragging(event); | 119 isTouchEventConsumed |= dragHelper.handleDragging(event); |
| 120 } | 120 } |
| 121 return isTouchEventConsumed; | 121 return isTouchEventConsumed; |
| 122 } | 122 } |
| 123 } | 123 } |
| OLD | NEW |