Chromium Code Reviews| 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.MotionEvent; | 7 import android.view.MotionEvent; |
| 8 import android.view.View; | 8 import android.view.View; |
| 9 import android.view.View.OnTouchListener; | 9 import android.view.View.OnTouchListener; |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 boolean isTouchEventConsumed = false; | 81 boolean isTouchEventConsumed = false; |
| 82 | 82 |
| 83 switch (event.getActionMasked()) { | 83 switch (event.getActionMasked()) { |
| 84 case MotionEvent.ACTION_DOWN: | 84 case MotionEvent.ACTION_DOWN: |
| 85 isTouchEventConsumed |= true; | 85 isTouchEventConsumed |= true; |
| 86 mMenuButton.setPressed(true); | 86 mMenuButton.setPressed(true); |
| 87 showAppMenu(true); | 87 showAppMenu(true); |
| 88 break; | 88 break; |
| 89 case MotionEvent.ACTION_UP: | 89 case MotionEvent.ACTION_UP: |
| 90 case MotionEvent.ACTION_CANCEL: | 90 case MotionEvent.ACTION_CANCEL: |
| 91 if (isTouchEventConsumed) { | |
| 92 mMenuButton.performClick(); | |
|
newt (away)
2014/10/20 22:20:53
This isn't the correct usage of performClick(), bu
wajahat
2014/10/21 14:34:56
Done.
| |
| 93 } | |
| 91 isTouchEventConsumed |= true; | 94 isTouchEventConsumed |= true; |
| 92 mMenuButton.setPressed(false); | 95 mMenuButton.setPressed(false); |
| 93 break; | 96 break; |
| 94 default: | 97 default: |
| 95 } | 98 } |
| 96 | 99 |
| 97 // 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 |
| 98 // 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 |
| 99 // dragging correctly. | 102 // dragging correctly. |
| 100 AppMenuDragHelper dragHelper = mMenuHandler.getAppMenuDragHelper(); | 103 AppMenuDragHelper dragHelper = mMenuHandler.getAppMenuDragHelper(); |
| 101 if (dragHelper != null) { | 104 if (dragHelper != null) { |
| 102 isTouchEventConsumed |= dragHelper.handleDragging(event); | 105 isTouchEventConsumed |= dragHelper.handleDragging(event); |
| 103 } | 106 } |
| 104 return isTouchEventConsumed; | 107 return isTouchEventConsumed; |
| 105 } | 108 } |
| 106 } | 109 } |
| OLD | NEW |