Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
[Android] Fix overflow menu enter tablet animation
Browse files Browse the repository at this point in the history
- On tablets the new anchor point was 6dp off due to the new shadow assets.  To fix
this add a 6dp translate to the enter animation that will move the asset into the
correct location as the scale animation runs.  This effectively mimics the old
animation but allows the offset to be included.

BUG=405352

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

Cr-Commit-Position: refs/heads/master@{#290773}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290773 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
dtrainor@chromium.org committed Aug 20, 2014
1 parent d9e358e commit 6f2a9c8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions chrome/android/java/res/anim/menu_enter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@
<alpha android:interpolator="@android:anim/linear_interpolator"
android:fromAlpha="0" android:toAlpha="1"
android:duration="200" />
<translate android:interpolator="@interpolator/transform_curve_interpolator"
android:fromYDelta="@dimen/menu_negative_software_vertical_offset"
android:toYDelta="0"
android:duration="200" />
</set>
2 changes: 1 addition & 1 deletion chrome/android/java/res/values-sw600dp/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<resources>
<!-- Menu Dimensions -->
<!-- Necessary to align the menu icon with the actual button. -->
<dimen name="menu_software_vertical_offset">-6dp</dimen>
<dimen name="menu_negative_software_vertical_offset">6dp</dimen>
</resources>
2 changes: 1 addition & 1 deletion chrome/android/java/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<!-- Custom Menu dimensions -->
<dimen name="menu_width">258dp</dimen>
<dimen name="menu_software_vertical_offset">0dp</dimen>
<dimen name="menu_negative_software_vertical_offset">0dp</dimen>
<!-- The amount to fade the edges of the menu to indicate more content is available
via scrolling. -->
<dimen name="menu_vertical_fade_distance">15dp</dimen>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
private final int mItemRowHeight;
private final int mItemDividerHeight;
private final int mVerticalFadeDistance;
private final int mAdditionalVerticalOffset;
private final int mNegativeSoftwareVerticalOffset;
private ListPopupWindow mPopup;
private AppMenuAdapter mAdapter;
private AppMenuHandler mHandler;
Expand All @@ -73,8 +73,8 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
mItemDividerHeight = itemDividerHeight;
assert mItemDividerHeight >= 0;

mAdditionalVerticalOffset =
res.getDimensionPixelSize(R.dimen.menu_software_vertical_offset);
mNegativeSoftwareVerticalOffset =
res.getDimensionPixelSize(R.dimen.menu_negative_software_vertical_offset);
mVerticalFadeDistance = res.getDimensionPixelSize(R.dimen.menu_vertical_fade_distance);
}

Expand Down Expand Up @@ -207,7 +207,7 @@ private void setPopupOffset(ListPopupWindow popup, int screenRotation, Rect appR
} else {
// The menu is displayed over and below the anchored view, so shift the menu up by the
// height of the anchor view.
popup.setVerticalOffset(mAdditionalVerticalOffset - anchorHeight);
popup.setVerticalOffset(-mNegativeSoftwareVerticalOffset - anchorHeight);
}
}

Expand Down

0 comments on commit 6f2a9c8

Please sign in to comment.