Skip to content

Commit

Permalink
Update Snackbar gesture inset calculation to factor in translationY
Browse files Browse the repository at this point in the history
Fixes issue of compounding margins for legacy Snackbar which uses a slide animation that affects it's position on the screen

Resolves #741

PiperOrigin-RevId: 285246645
(cherry picked from commit 86b2ec3)
  • Loading branch information
dsn5ft committed Dec 18, 2019
1 parent a718fd1 commit 904d063
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -263,7 +263,10 @@ public boolean handleMessage(@NonNull Message message) {
new Runnable() {
@Override
public void run() {
int currentInsetBottom = getScreenHeight() - getViewAbsoluteBottom();
// Calculate current bottom inset, factoring in translationY to account for where the
// view will likely be animating to.
int currentInsetBottom =
getScreenHeight() - getViewAbsoluteBottom() + (int) view.getTranslationY();
if (currentInsetBottom >= extraBottomMarginGestureInset) {
// No need to add extra offset if view is already outside of bottom gesture area
return;
Expand Down

0 comments on commit 904d063

Please sign in to comment.