Commit 0f8aea56 authored by dtrainor@chromium.org's avatar dtrainor@chromium.org

Android Disable menu animations for low end devices

BUG=403143

Review URL: https://codereview.chromium.org/469583003

Cr-Commit-Position: refs/heads/master@{#289183}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289183 0039d316-1c4b-4281-b951-d872f2087c98
parent f35136d8
......@@ -24,6 +24,7 @@ import android.widget.ListPopupWindow;
import android.widget.PopupWindow;
import android.widget.PopupWindow.OnDismissListener;
import org.chromium.base.SysUtils;
import org.chromium.chrome.R;
import java.util.ArrayList;
......@@ -112,6 +113,9 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
mPopup.setAnimationStyle(R.style.OverflowMenuAnim);
}
// Turn off window animations for low end devices.
if (SysUtils.isLowEndDevice()) mPopup.setAnimationStyle(0);
Rect bgPadding = new Rect();
mPopup.getBackground().getPadding(bgPadding);
......@@ -155,14 +159,17 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
mPopup.getListView().setFadingEdgeLength(mVerticalFadeDistance);
}
mPopup.getListView().addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
mPopup.getListView().removeOnLayoutChangeListener(this);
runMenuItemEnterAnimations();
}
});
// Don't animate the menu items for low end devices.
if (!SysUtils.isLowEndDevice()) {
mPopup.getListView().addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
mPopup.getListView().removeOnLayoutChangeListener(this);
runMenuItemEnterAnimations();
}
});
}
}
private void setPopupOffset(ListPopupWindow popup, int screenRotation, Rect appRect) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment