OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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.animation.Animator; | 7 import android.animation.Animator; |
8 import android.animation.Animator.AnimatorListener; | 8 import android.animation.Animator.AnimatorListener; |
9 import android.animation.AnimatorSet; | 9 import android.animation.AnimatorSet; |
10 import android.annotation.SuppressLint; | |
10 import android.content.Context; | 11 import android.content.Context; |
11 import android.content.res.Resources; | 12 import android.content.res.Resources; |
12 import android.graphics.Rect; | 13 import android.graphics.Rect; |
13 import android.graphics.drawable.Drawable; | 14 import android.graphics.drawable.Drawable; |
14 import android.os.Build; | 15 import android.os.Build; |
15 import android.support.annotation.IdRes; | 16 import android.support.annotation.IdRes; |
16 import android.support.annotation.Nullable; | 17 import android.support.annotation.Nullable; |
17 import android.view.KeyEvent; | 18 import android.view.KeyEvent; |
18 import android.view.LayoutInflater; | 19 import android.view.LayoutInflater; |
19 import android.view.Menu; | 20 import android.view.Menu; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 * @param screenRotation Current device screen rotation. | 144 * @param screenRotation Current device screen rotation. |
144 * @param visibleDisplayFrame The display area rect in which AppMenu is supp osed to fit in. | 145 * @param visibleDisplayFrame The display area rect in which AppMenu is supp osed to fit in. |
145 * @param screenHeight Current device screen height. | 146 * @param screenHeight Current device screen height. |
146 * @param footerResourceId The resource id for a view to add to the end o f the menu list. Can | 147 * @param footerResourceId The resource id for a view to add to the end o f the menu list. Can |
147 * be 0 if no such view is required. | 148 * be 0 if no such view is required. |
148 * @param highlightedItemId The resource id of the menu item that should b e highlighted. Can | 149 * @param highlightedItemId The resource id of the menu item that should b e highlighted. Can |
149 * be {@code null} if no item should be highlight ed. Note that | 150 * be {@code null} if no item should be highlight ed. Note that |
150 * {@code 0} is dedicated to custom menu items an d can be declared by | 151 * {@code 0} is dedicated to custom menu items an d can be declared by |
151 * external apps. | 152 * external apps. |
152 */ | 153 */ |
154 // TODO(crbug.com/635567): Fix this properly. | |
Ted C
2017/04/27 19:02:47
What needs to be fixed? Can we put the todo above
F
2017/04/28 18:25:14
Done.
| |
155 @SuppressLint("ResourceType") | |
153 void show(Context context, View anchorView, boolean isByPermanentButton, int screenRotation, | 156 void show(Context context, View anchorView, boolean isByPermanentButton, int screenRotation, |
154 Rect visibleDisplayFrame, int screenHeight, @IdRes int footerResourc eId, | 157 Rect visibleDisplayFrame, int screenHeight, @IdRes int footerResourc eId, |
155 Integer highlightedItemId) { | 158 Integer highlightedItemId) { |
156 mPopup = new ListPopupWindow(context, null, android.R.attr.popupMenuStyl e); | 159 mPopup = new ListPopupWindow(context, null, android.R.attr.popupMenuStyl e); |
157 mPopup.setModal(true); | 160 mPopup.setModal(true); |
158 mPopup.setAnchorView(anchorView); | 161 mPopup.setAnchorView(anchorView); |
159 mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); | 162 mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); |
160 | 163 |
161 int footerHeight = 0; | 164 int footerHeight = 0; |
162 if (footerResourceId != 0) { | 165 if (footerResourceId != 0) { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
455 } else { | 458 } else { |
456 builder.with((Animator) animatorObject); | 459 builder.with((Animator) animatorObject); |
457 } | 460 } |
458 } | 461 } |
459 } | 462 } |
460 | 463 |
461 mMenuItemEnterAnimator.addListener(mAnimationHistogramRecorder); | 464 mMenuItemEnterAnimator.addListener(mAnimationHistogramRecorder); |
462 mMenuItemEnterAnimator.start(); | 465 mMenuItemEnterAnimator.start(); |
463 } | 466 } |
464 } | 467 } |
OLD | NEW |