| 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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.view.MotionEvent; | 8 import android.view.MotionEvent; |
| 9 import android.view.View; | 9 import android.view.View; |
| 10 import android.view.View.OnTouchListener; | 10 import android.view.View.OnTouchListener; |
| 11 | 11 |
| 12 import org.chromium.chrome.browser.UmaBridge; | 12 import org.chromium.chrome.browser.metrics.UmaBridge; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * A helper class for a menu button to decide when to show the app menu and forw
ard touch | 15 * A helper class for a menu button to decide when to show the app menu and forw
ard touch |
| 16 * events. | 16 * events. |
| 17 * | 17 * |
| 18 * Simply construct this class and pass the class instance to a menu button as T
ouchListener. | 18 * Simply construct this class and pass the class instance to a menu button as T
ouchListener. |
| 19 * Then this class will handle everything regarding showing app menu for you. | 19 * Then this class will handle everything regarding showing app menu for you. |
| 20 */ | 20 */ |
| 21 public class AppMenuButtonHelper implements OnTouchListener { | 21 public class AppMenuButtonHelper implements OnTouchListener { |
| 22 private final AppMenuHandler mMenuHandler; | 22 private final AppMenuHandler mMenuHandler; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // If user starts to drag on this menu button, ACTION_DOWN and all the s
ubsequent touch | 100 // If user starts to drag on this menu button, ACTION_DOWN and all the s
ubsequent touch |
| 101 // events are received here. We need to forward this event to the app me
nu to handle | 101 // events are received here. We need to forward this event to the app me
nu to handle |
| 102 // dragging correctly. | 102 // dragging correctly. |
| 103 AppMenuDragHelper dragHelper = mMenuHandler.getAppMenuDragHelper(); | 103 AppMenuDragHelper dragHelper = mMenuHandler.getAppMenuDragHelper(); |
| 104 if (dragHelper != null) { | 104 if (dragHelper != null) { |
| 105 isTouchEventConsumed |= dragHelper.handleDragging(event, view); | 105 isTouchEventConsumed |= dragHelper.handleDragging(event, view); |
| 106 } | 106 } |
| 107 return isTouchEventConsumed; | 107 return isTouchEventConsumed; |
| 108 } | 108 } |
| 109 } | 109 } |
| OLD | NEW |